changeset 13466:32e2bc78ae77

Loading, saving and clearing the workspace now works via the GUI.
author Jacob Dawid <jacob.dawid@googlemail.com>
date Sun, 17 Apr 2011 22:51:07 +0200
parents 3542af417878
children df787fd0a6e5
files gui//src/MainWindow.cpp gui//src/Vt102Emulation.cpp
diffstat 2 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/gui//src/MainWindow.cpp	Sun Apr 17 22:12:02 2011 +0200
+++ b/gui//src/MainWindow.cpp	Sun Apr 17 22:51:07 2011 +0200
@@ -21,6 +21,7 @@
 #include <QAction>
 #include <QSettings>
 #include <QDesktopServices>
+#include <QFileDialog>
 #include "MainWindow.h"
 #include "FileEditorMdiSubWindow.h"
 #include "ImageViewerMdiSubWindow.h"
@@ -63,15 +64,24 @@
 }
 
 void MainWindow::handleSaveWorkspaceRequest() {
-    // TODO: Handle saving of workspace.
+    QDesktopServices desktopServices;
+    QString selectedFile = QFileDialog::getSaveFileName(this, "Save Workspace",
+        desktopServices.storageLocation(QDesktopServices::HomeLocation) + "/.quint/workspace");
+    m_octaveTerminal->sendText(QString("save \'%1\'\n").arg(selectedFile));
+    m_octaveTerminal->setFocus();
 }
 
 void MainWindow::handleLoadWorkspaceRequest() {
-    // TODO: Handle loading of workspace.
+    QDesktopServices desktopServices;
+    QString selectedFile = QFileDialog::getOpenFileName(this, "Load Workspace",
+        desktopServices.storageLocation(QDesktopServices::HomeLocation) + "/.quint/workspace");
+    m_octaveTerminal->sendText(QString("load \'%1\'\n").arg(selectedFile));
+    m_octaveTerminal->setFocus();
 }
 
 void MainWindow::handleClearWorkspaceRequest() {
-    // TODO: Handle clearing of workspace.
+    m_octaveTerminal->sendText("clear\n");
+    m_octaveTerminal->setFocus();
 }
 
 void MainWindow::handleCommandDoubleClicked(QString command) {
--- a/gui//src/Vt102Emulation.cpp	Sun Apr 17 22:12:02 2011 +0200
+++ b/gui//src/Vt102Emulation.cpp	Sun Apr 17 22:51:07 2011 +0200
@@ -888,6 +888,7 @@
                     0, 
                     Qt::NoModifier, 
                     text);
+
     sendKeyEvent(&event); // expose as a big fat keypress event
   }
 }