diff options
Diffstat (limited to 'src/mainwindow.cc')
-rw-r--r-- | src/mainwindow.cc | 45 |
1 files changed, 11 insertions, 34 deletions
diff --git a/src/mainwindow.cc b/src/mainwindow.cc index 69e4398..4b49325 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -34,7 +34,6 @@ #include <QStatusBar> #include <QApplication> #include <QDockWidget> -#include <QSettings> #include <QToolBar> #include <QAction> #include <QMenuBar> @@ -51,7 +50,7 @@ #include "volumefader.h" #include "selectioneditor.h" #include "zoomslider.h" - +#include "settings.h" #define MAXVAL 10000000L //#define SINGLESTEP MAXVAL/100000 @@ -67,7 +66,8 @@ static void addTool(QToolBar* toolbar, Canvas* canvas, CanvasTool* tool) canvas->tools.push_back(tool); } -MainWindow::MainWindow() +MainWindow::MainWindow(Settings& settings) + : settings(settings) { { int start = 44100 * 60; @@ -205,23 +205,6 @@ MainWindow::MainWindow() loadSettings(); - //QSettings settings("presets.ini", QSettings::IniFormat); - //QStringList list = settings.childGroups(); - //for(int i = 0; i != list.size(); i++) - //{ - // QString presetname = list.at(i); - // Preset p; - // settings.beginGroup(presetname); - // p.prefix = settings.value("prefix", "unknown").toString(); - // p.attacklength = settings.value("attacklength", 0).toInt(); - // p.falloff = settings.value("falloff", 0).toInt(); - // p.fadelength = settings.value("fadelength", 0).toInt(); - // settings.endGroup(); - // QVariant v; - // v.setValue(p); - // presets->addItem(presetname, v); - //} - statusBar()->showMessage(tr("Ready")); } @@ -483,24 +466,18 @@ void MainWindow::closeEvent(QCloseEvent*) void MainWindow::loadSettings() { - QSettings settings; - - settings.beginGroup("MainWindow"); - lineed_exportp->setText(settings.value("exportpath", "").toString()); - resize(settings.value("size", QSize(700, 800)).toSize()); - move(settings.value("pos", QPoint(0, 0)).toPoint()); - settings.endGroup(); + QSize size; + QPoint pos; + settings.loadGeometry(size, pos); + resize(size); + move(pos); + lineed_exportp->setText(settings.loadExportPath()); } void MainWindow::saveSettings() { - QSettings settings; - - settings.beginGroup("MainWindow"); - settings.setValue("exportpath", lineed_exportp->text()); - settings.setValue("size", size()); - settings.setValue("pos", pos()); - settings.endGroup(); + settings.saveGeometry(size(), pos()); + settings.saveExportPath(lineed_exportp->text()); } //void MainWindow::setXScale(float val) |