Added SaveImageDialog to mussagl
authorBrandon King <kingb@caltech.edu>
Thu, 2 Mar 2006 02:23:48 +0000 (02:23 +0000)
committerBrandon King <kingb@caltech.edu>
Thu, 2 Mar 2006 02:23:48 +0000 (02:23 +0000)
qui/PathWindow.cxx
qui/PathWindow.h

index 92beaa67a08715cff8dbc5fb5ef2757909e25fa4..bb6dbf4b4641fa10c7616942bc0a2541f35d2be4 100644 (file)
@@ -13,6 +13,7 @@
 
 #include "qui/PathScene.h"
 #include "qui/ThresholdWidget.h"
+#include "qui/ImageSaveDialog.h"
 
 #include <iostream>
 
@@ -38,6 +39,10 @@ PathWindow::PathWindow(QWidget *) :
   connect(threshold, SIGNAL(thresholdChanged(int)),
           scene, SLOT(setClipPlane(int)));
   mussaViewTB->addWidget(threshold);
+
+  //Image Save Dialog
+  imageSaveDialog = new ImageSaveDialog(scene, this);
+
   addToolBar(mussaViewTB);
 
   statusBar()->showMessage("Welcome to mussa", 2000);
@@ -103,6 +108,12 @@ void PathWindow::setupActions()
 
   whatsThisAction = QWhatsThis::createAction(this);
   whatsThisAction->setIcon(QIcon("icons/help.png"));
+
+  //Save pixel map action
+  saveOpenGlPixmapAction = new QAction(tr("Save to image..."), this);
+  connect(saveOpenGlPixmapAction, (SIGNAL(triggered())),
+         this, SLOT(promptSaveOpenGlPixmap()));
+  saveOpenGlPixmapAction->setIcon(QIcon("icons/image2.png"));
 }
 
 void PathWindow::setupMainMenu()
@@ -120,6 +131,8 @@ void PathWindow::setupMainMenu()
   newMenu->addAction(loadMotifListAction);
   newMenu->addAction(saveMotifListAction);
   newMenu->addSeparator();
+  newMenu->addAction(saveOpenGlPixmapAction);
+  newMenu->addSeparator();
   newMenu->addAction(closeAction);
 
   newMenu = menuBar()->addMenu(tr("&View"));
@@ -195,4 +208,12 @@ void PathWindow::NotImplementedBox()
   QMessageBox::warning(this, QObject::tr("mussa"), QObject::tr("Not implemented yet"));
 }      
 
+void PathWindow::promptSaveOpenGlPixmap()
+{
+  QSize size;
+  size = scene->size();
+  imageSaveDialog->setSize(size.width(), size.height());
+  int result = imageSaveDialog->exec();
+  std::cout << "Result: " << result << "\n";
+}
 
index 1aefe0cda3ce9fc54204fd1fb601e5c6856eea66..8f1c7da26be4bc2163c11a4146352872775e3042 100644 (file)
@@ -2,9 +2,10 @@
 #define _PATHWINDOW_H_
 
 #include <QMainWindow>
-
+#include <QPixmap>
 class QAction;
 class PathScene;
+class ImageSaveDialog;
 
 class PathWindow : public QMainWindow
 {
@@ -37,11 +38,14 @@ public slots:
   //\@}
 
   void showMussaToolbar();
+  
+  void promptSaveOpenGlPixmap();
 
 protected:
   // display our wonderful mussa output
   PathScene *scene;
   QToolBar *mussaViewTB;
+  ImageSaveDialog *imageSaveDialog;
   
   QAction *aboutAction;
   QAction *closeAction;
@@ -54,6 +58,7 @@ protected:
   QAction *showMussaViewToolbarAction;
   QAction *toggleMotifsAction;
   QAction *whatsThisAction;
+  QAction *saveOpenGlPixmapAction;
 
   //! initialze the actions
   void setupActions();