comparison main/main.cpp @ 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 40116f709d3b
children d4487202d0e8
comparison
equal deleted inserted replaced
4:a8b4a6efefff 5:0a687ed1b50f
26 #include <QApplication> 26 #include <QApplication>
27 #include <QDesktopWidget> 27 #include <QDesktopWidget>
28 #include <QMessageBox> 28 #include <QMessageBox>
29 #include <QTranslator> 29 #include <QTranslator>
30 #include <QLocale> 30 #include <QLocale>
31 #include <QSettings>
31 32
32 #include <iostream> 33 #include <iostream>
33 #include <signal.h> 34 #include <signal.h>
34 35
35 //!!! catch trappable signals, cleanup temporary directory etc 36 //!!! catch trappable signals, cleanup temporary directory etc
61 signal(SIGQUIT, signalHandler); 62 signal(SIGQUIT, signalHandler);
62 #endif 63 #endif
63 64
64 svSystemSpecificInitialisation(); 65 svSystemSpecificInitialisation();
65 66
67 QApplication::setOrganizationName("Sonic Visualiser");
68 QApplication::setOrganizationDomain("sonicvisualiser.org");
69 QApplication::setApplicationName("Sonic Visualiser");
70
66 QString language = QLocale::system().name(); 71 QString language = QLocale::system().name();
67 72
68 QTranslator qtTranslator; 73 QTranslator qtTranslator;
69 QString qtTrName = QString("qt_%1").arg(language); 74 QString qtTrName = QString("qt_%1").arg(language);
70 std::cerr << "Loading " << qtTrName.toStdString() << "..." << std::endl; 75 std::cerr << "Loading " << qtTrName.toStdString() << "..." << std::endl;
89 int width = available.width() * 2 / 3; 94 int width = available.width() * 2 / 3;
90 int height = available.height() / 2; 95 int height = available.height() / 2;
91 if (height < 450) height = available.height() * 2 / 3; 96 if (height < 450) height = available.height() * 2 / 3;
92 if (width > height * 2) width = height * 2; 97 if (width > height * 2) width = height * 2;
93 98
94 gui.resize(width, height); 99 QSettings settings;
100 settings.beginGroup("MainWindow");
101 QSize size = settings.value("size", QSize(width, height)).toSize();
102 gui.resize(size);
103 if (settings.contains("position")) {
104 gui.move(settings.value("position").toPoint());
105 }
106 settings.endGroup();
107
95 gui.show(); 108 gui.show();
96 109
97 if (argc > 1) { 110 if (argc > 1) {
98 QString path = argv[1]; 111 QString path = argv[1];
99 bool success = false; 112 bool success = false;
113 std::cerr << "application.exec() returned " << rv << std::endl; 126 std::cerr << "application.exec() returned " << rv << std::endl;
114 127
115 cleanupMutex.lock(); 128 cleanupMutex.lock();
116 TempDirectory::getInstance()->cleanup(); 129 TempDirectory::getInstance()->cleanup();
117 Preferences::getInstance()->getConfigFile()->commit(); 130 Preferences::getInstance()->getConfigFile()->commit();
131
118 return rv; 132 return rv;
119 } 133 }