From a111bc044125c105ccd2aafca9b05b55818d5c54 Mon Sep 17 00:00:00 2001 From: Daniel Klaffenbach Date: Sun, 7 Nov 2010 14:18:32 +0100 Subject: [PATCH] Implement settings as pointer Settings should be a pointer because we might need to connect signals from Settings to a MainWindow slot. --- src/mainwindow.cpp | 16 ++++++++-------- src/mainwindow.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 168e513..022d628 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -40,9 +40,7 @@ MainWindow::MainWindow(QWidget *parent) : //create UI refresh timer refreshTimer( this ), //create a QGraphicsScene for the little chip icon - scene( this ), - //the settings widget - settings(this) + scene( this ) { //this is a stacked window on Maemo 5 #if defined(Q_WS_MAEMO_5) @@ -70,7 +68,8 @@ MainWindow::MainWindow(QWidget *parent) : helpWindow.setWindowFlags( windowFlags() | Qt::Window ); //Settings widget - settings.hide(); + settings = new Settings; + settings->hide(); //show errors about the sudo setup only once showSudoError = true; @@ -88,6 +87,7 @@ MainWindow::MainWindow(QWidget *parent) : MainWindow::~MainWindow() { + delete settings; delete ui; } @@ -124,7 +124,7 @@ void MainWindow::adjustFreq() //check for overclocking #if defined(Q_WS_MAEMO_5) - if (!settings.useOverclocking() && newmax > 600000) { + if (!settings->useOverclocking() && newmax > 600000) { QMaemo5InformationBox::information(this, tr( "You need to enable overclocking in QCPUFreq's settings in order to set frequencies above 600MHz!"), 0); refresh(); return; @@ -438,7 +438,7 @@ void MainWindow::orientationChanged() void MainWindow::setAutoRotation() { #if defined(Q_WS_MAEMO_5) - setAttribute(Qt::WA_Maemo5AutoOrientation, settings.useAutoRotate()); + setAttribute(Qt::WA_Maemo5AutoOrientation, settings->useAutoRotate()); #endif } @@ -477,8 +477,8 @@ void MainWindow::showHelp() */ void MainWindow::showSettings() { - settings.reset(); - settings.show(); + settings->reset(); + settings->show(); } diff --git a/src/mainwindow.h b/src/mainwindow.h index 6dc82c6..b2fc16c 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -79,7 +79,7 @@ private: //! the QGraphicsScene will contain the large chip icon displayed in the UI QGraphicsScene scene; bool showSudoError; - Settings settings; + Settings *settings; bool usePortrait(); }; -- 1.7.9.5