changeset 5:0a687ed1b50f

* Add Thumbwheel widget for all our zooming needs * Use QSettings to save/restore window size and position -- precursor to switching our preferences to QSettings as well -- wish I'd noticed it sooner * Only suspend writes (not reads from the underlying cache objects) from the fft caches when repainting the spectrogram -- performance should now be significantly better
author Chris Cannam
date Thu, 03 Aug 2006 15:40:11 +0000
parents a8b4a6efefff
children d4487202d0e8
files main/MainWindow.cpp main/main.cpp
diffstat 2 files changed, 22 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/main/MainWindow.cpp	Wed Aug 02 16:42:17 2006 +0000
+++ b/main/MainWindow.cpp	Thu Aug 03 15:40:11 2006 +0000
@@ -74,6 +74,7 @@
 #include <QFile>
 #include <QTextStream>
 #include <QProcess>
+#include <QSettings>
 
 #include <iostream>
 #include <cstdio>
@@ -2115,6 +2116,12 @@
 	return;
     }
 
+    QSettings settings;
+    settings.beginGroup("MainWindow");
+    settings.setValue("size", size());
+    settings.setValue("position", pos());
+    settings.endGroup();
+
     e->accept();
     return;
 }
--- a/main/main.cpp	Wed Aug 02 16:42:17 2006 +0000
+++ b/main/main.cpp	Thu Aug 03 15:40:11 2006 +0000
@@ -28,6 +28,7 @@
 #include <QMessageBox>
 #include <QTranslator>
 #include <QLocale>
+#include <QSettings>
 
 #include <iostream>
 #include <signal.h>
@@ -63,6 +64,10 @@
 
     svSystemSpecificInitialisation();
 
+    QApplication::setOrganizationName("Sonic Visualiser");
+    QApplication::setOrganizationDomain("sonicvisualiser.org");
+    QApplication::setApplicationName("Sonic Visualiser");
+
     QString language = QLocale::system().name();
 
     QTranslator qtTranslator;
@@ -91,7 +96,15 @@
     if (height < 450) height = available.height() * 2 / 3;
     if (width > height * 2) width = height * 2;
 
-    gui.resize(width, height);
+    QSettings settings;
+    settings.beginGroup("MainWindow");
+    QSize size = settings.value("size", QSize(width, height)).toSize();
+    gui.resize(size);
+    if (settings.contains("position")) {
+        gui.move(settings.value("position").toPoint());
+    }
+    settings.endGroup();
+    
     gui.show();
 
     if (argc > 1) {
@@ -115,5 +128,6 @@
     cleanupMutex.lock();
     TempDirectory::getInstance()->cleanup();
     Preferences::getInstance()->getConfigFile()->commit();
+
     return rv;
 }