GUI: Remember log view size.

This commit is contained in:
Kimmo Varis 2010-07-16 23:27:57 +03:00
parent 8bf8dd4bf7
commit de767a7cf1
4 changed files with 28 additions and 4 deletions

View File

@ -58,6 +58,8 @@ ShowTypes;
#define SETTINGS_LANGUAGE "Application language" #define SETTINGS_LANGUAGE "Application language"
#define SETTINGS_TOOLBARS_MAIN_SHOW "Toolbars/ShowStandard" #define SETTINGS_TOOLBARS_MAIN_SHOW "Toolbars/ShowStandard"
#define SETTINGS_TOOLBARS_VIEW_SHOW "Toolbars/ShowView" #define SETTINGS_TOOLBARS_VIEW_SHOW "Toolbars/ShowView"
#define SETTINGS_LOG_VIEW_WIDTH "Log/View width"
#define SETTINGS_LOG_VIEW_HEIGHT "Log/View height"
/// @} /// @}
#endif #endif

View File

@ -16,9 +16,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <QSettings>
#include "common.h"
#include "logview.h" #include "logview.h"
LogView::LogView(QWidget *parent) LogView::LogView(QSettings *programSettings, QWidget *parent)
: mSettings(programSettings)
{ {
Q_UNUSED(parent); Q_UNUSED(parent);
mUI.setupUi(this); mUI.setupUi(this);
@ -26,6 +29,15 @@ LogView::LogView(QWidget *parent)
connect(mUI.mCloseButton, SIGNAL(clicked()), this, SLOT(CloseButtonClicked())); connect(mUI.mCloseButton, SIGNAL(clicked()), this, SLOT(CloseButtonClicked()));
connect(mUI.mClearButton, SIGNAL(clicked()), this, SLOT(ClearButtonClicked())); 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) void LogView::AppendLine(const QString &line)

View File

@ -22,6 +22,8 @@
#include <QWidget> #include <QWidget>
#include "ui_logview.h" #include "ui_logview.h"
class QSettings;
/// @addtogroup GUI /// @addtogroup GUI
/// @{ /// @{
@ -33,7 +35,8 @@ class LogView : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
LogView(QWidget *parent = 0); LogView(QSettings *programSettings, QWidget *parent = 0);
~LogView();
/** /**
* @brief Append new log file to view. * @brief Append new log file to view.
@ -58,6 +61,13 @@ 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(this); mLogView = new LogView(mSettings);
connect(mUI.mActionQuit, SIGNAL(triggered()), this, SLOT(close())); connect(mUI.mActionQuit, SIGNAL(triggered()), this, SLOT(close()));
connect(mUI.mActionCheckFiles, SIGNAL(triggered()), this, SLOT(CheckFiles())); connect(mUI.mActionCheckFiles, SIGNAL(triggered()), this, SLOT(CheckFiles()));
@ -740,7 +740,7 @@ void MainWindow::NewProjectFile()
void MainWindow::ShowLogView() void MainWindow::ShowLogView()
{ {
if (mLogView == NULL) if (mLogView == NULL)
mLogView = new LogView(this); mLogView = new LogView(mSettings);
mLogView->show(); mLogView->show();
if (!mLogView->isActiveWindow()) if (!mLogView->isActiveWindow())