From de767a7cf195f4387c243032526ff344cc6ce546 Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Fri, 16 Jul 2010 23:27:57 +0300 Subject: [PATCH] GUI: Remember log view size. --- gui/common.h | 2 ++ gui/logview.cpp | 14 +++++++++++++- gui/logview.h | 12 +++++++++++- gui/mainwindow.cpp | 4 ++-- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/gui/common.h b/gui/common.h index d0226db95..c4fd7c070 100644 --- a/gui/common.h +++ b/gui/common.h @@ -58,6 +58,8 @@ ShowTypes; #define SETTINGS_LANGUAGE "Application language" #define SETTINGS_TOOLBARS_MAIN_SHOW "Toolbars/ShowStandard" #define SETTINGS_TOOLBARS_VIEW_SHOW "Toolbars/ShowView" +#define SETTINGS_LOG_VIEW_WIDTH "Log/View width" +#define SETTINGS_LOG_VIEW_HEIGHT "Log/View height" /// @} #endif diff --git a/gui/logview.cpp b/gui/logview.cpp index 94baae276..8d3b6856a 100644 --- a/gui/logview.cpp +++ b/gui/logview.cpp @@ -16,9 +16,12 @@ * along with this program. If not, see . */ +#include +#include "common.h" #include "logview.h" -LogView::LogView(QWidget *parent) +LogView::LogView(QSettings *programSettings, QWidget *parent) + : mSettings(programSettings) { Q_UNUSED(parent); mUI.setupUi(this); @@ -26,6 +29,15 @@ LogView::LogView(QWidget *parent) connect(mUI.mCloseButton, SIGNAL(clicked()), this, SLOT(CloseButtonClicked())); connect(mUI.mClearButton, SIGNAL(clicked()), this, SLOT(ClearButtonClicked())); + + resize(mSettings->value(SETTINGS_LOG_VIEW_WIDTH, 400).toInt(), + mSettings->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()); } void LogView::AppendLine(const QString &line) diff --git a/gui/logview.h b/gui/logview.h index 3923616db..d56ae2ef6 100644 --- a/gui/logview.h +++ b/gui/logview.h @@ -22,6 +22,8 @@ #include #include "ui_logview.h" +class QSettings; + /// @addtogroup GUI /// @{ @@ -33,7 +35,8 @@ class LogView : public QWidget { Q_OBJECT public: - LogView(QWidget *parent = 0); + LogView(QSettings *programSettings, QWidget *parent = 0); + ~LogView(); /** * @brief Append new log file to view. @@ -58,6 +61,13 @@ protected slots: private: Ui::LogView mUI; + + /** + * @brief Settings + * + */ + QSettings *mSettings; + }; /// @} diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 5202ee49b..67821c720 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -53,7 +53,7 @@ MainWindow::MainWindow() : mUI.mResults->Initialize(mSettings, mApplications); mThread = new ThreadHandler(this); - mLogView = new LogView(this); + mLogView = new LogView(mSettings); connect(mUI.mActionQuit, SIGNAL(triggered()), this, SLOT(close())); connect(mUI.mActionCheckFiles, SIGNAL(triggered()), this, SLOT(CheckFiles())); @@ -740,7 +740,7 @@ void MainWindow::NewProjectFile() void MainWindow::ShowLogView() { if (mLogView == NULL) - mLogView = new LogView(this); + mLogView = new LogView(mSettings); mLogView->show(); if (!mLogView->isActiveWindow())