GUI: Simplify settings usage in Log window.

This commit is contained in:
Kimmo Varis 2011-05-13 10:38:54 +03:00
parent 1002d2e785
commit 056476d28a
3 changed files with 10 additions and 18 deletions

View File

@ -24,8 +24,7 @@
#include "common.h" #include "common.h"
#include "logview.h" #include "logview.h"
LogView::LogView(QSettings *programSettings, QWidget *parent) LogView::LogView(QWidget *parent)
: mSettings(programSettings)
{ {
Q_UNUSED(parent); Q_UNUSED(parent);
mUI.setupUi(this); mUI.setupUi(this);
@ -35,14 +34,16 @@ LogView::LogView(QSettings *programSettings, QWidget *parent)
connect(mUI.mClearButton, SIGNAL(clicked()), this, SLOT(ClearButtonClicked())); connect(mUI.mClearButton, SIGNAL(clicked()), this, SLOT(ClearButtonClicked()));
connect(mUI.mSaveButton, SIGNAL(clicked()), this, SLOT(SaveButtonClicked())); connect(mUI.mSaveButton, SIGNAL(clicked()), this, SLOT(SaveButtonClicked()));
resize(mSettings->value(SETTINGS_LOG_VIEW_WIDTH, 400).toInt(), QSettings settings;
mSettings->value(SETTINGS_LOG_VIEW_HEIGHT, 300).toInt()); resize(settings.value(SETTINGS_LOG_VIEW_WIDTH, 400).toInt(),
settings.value(SETTINGS_LOG_VIEW_HEIGHT, 300).toInt());
} }
LogView::~LogView() LogView::~LogView()
{ {
mSettings->setValue(SETTINGS_LOG_VIEW_WIDTH, size().width()); QSettings settings;
mSettings->setValue(SETTINGS_LOG_VIEW_HEIGHT, size().height()); settings.setValue(SETTINGS_LOG_VIEW_WIDTH, size().width());
settings.setValue(SETTINGS_LOG_VIEW_HEIGHT, size().height());
} }
void LogView::AppendLine(const QString &line) void LogView::AppendLine(const QString &line)

View File

@ -22,8 +22,6 @@
#include <QWidget> #include <QWidget>
#include "ui_logview.h" #include "ui_logview.h"
class QSettings;
/// @addtogroup GUI /// @addtogroup GUI
/// @{ /// @{
@ -35,7 +33,7 @@ class LogView : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
LogView(QSettings *programSettings, QWidget *parent = 0); LogView(QWidget *parent = 0);
~LogView(); ~LogView();
/** /**
@ -67,13 +65,6 @@ protected slots:
private: private:
Ui::LogView mUI; Ui::LogView mUI;
/**
* @brief Settings
*
*/
QSettings *mSettings;
}; };
/// @} /// @}

View File

@ -53,7 +53,7 @@ MainWindow::MainWindow() :
mUI.mResults->Initialize(mSettings, mApplications); mUI.mResults->Initialize(mSettings, mApplications);
mThread = new ThreadHandler(this); mThread = new ThreadHandler(this);
mLogView = new LogView(mSettings); mLogView = new LogView;
// Filter timer to delay filtering results slightly while typing // Filter timer to delay filtering results slightly while typing
mFilterTimer = new QTimer(this); mFilterTimer = new QTimer(this);
@ -862,7 +862,7 @@ void MainWindow::EditProjectFile()
void MainWindow::ShowLogView() void MainWindow::ShowLogView()
{ {
if (mLogView == NULL) if (mLogView == NULL)
mLogView = new LogView(mSettings); mLogView = new LogView;
mLogView->show(); mLogView->show();
if (!mLogView->isActiveWindow()) if (!mLogView->isActiveWindow())