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

View File

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

View File

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