Added SaveImageDialog to mussagl
[mussa.git] / qui / PathWindow.cxx
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";
+}