GUI: Remember main window splitter state.

Save and restore the vertical splitter state (sizes of tree view and
details panel).
This commit is contained in:
Kimmo Varis 2010-11-23 21:57:16 +02:00
parent 81a599e260
commit f1b511a366
4 changed files with 13 additions and 4 deletions

View File

@ -65,6 +65,7 @@ ShowTypes;
#define SETTINGS_TOOLBARS_VIEW_SHOW "Toolbars/ShowView"
#define SETTINGS_LOG_VIEW_WIDTH "Log/View width"
#define SETTINGS_LOG_VIEW_HEIGHT "Log/View height"
#define SETTINGS_MAINWND_SPLITTER_STATE "Mainwindow/Vertical splitter state"
/// @}
#endif

View File

@ -206,7 +206,7 @@ void MainWindow::SaveSettings()
mApplications->SaveSettings(mSettings);
mSettings->setValue(SETTINGS_LANGUAGE, mTranslation->GetCurrentLanguage());
mUI.mResults->SaveSettings();
mUI.mResults->SaveSettings(mSettings);
}
void MainWindow::DoCheckFiles(const QStringList &files)

View File

@ -24,6 +24,7 @@
#include <QVariant>
#include <QString>
#include <QModelIndex>
#include <QSettings>
#include "erroritem.h"
#include "resultsview.h"
#include "resultstree.h"
@ -43,9 +44,11 @@ ResultsView::ResultsView(QWidget * parent) :
void ResultsView::Initialize(QSettings *settings, ApplicationList *list)
{
mUI.mProgress->setMinimum(0);
mUI.mProgress->setVisible(false);
QByteArray state = settings->value(SETTINGS_MAINWND_SPLITTER_STATE).toByteArray();
mUI.mVerticalSplitter->restoreState(state);
mShowNoErrorsMessage = settings->value(SETTINGS_SHOW_NO_ERRORS, true).toBool();
mUI.mTree->Initialize(settings, list);
@ -210,9 +213,12 @@ bool ResultsView::HasResults() const
return mUI.mTree->HasResults();
}
void ResultsView::SaveSettings()
void ResultsView::SaveSettings(QSettings *settings)
{
mUI.mTree->SaveSettings();
QByteArray state = mUI.mVerticalSplitter->saveState();
settings->setValue(SETTINGS_MAINWND_SPLITTER_STATE, state);
mUI.mVerticalSplitter->restoreState(state);
}
void ResultsView::Translate()

View File

@ -30,6 +30,7 @@
class ErrorItem;
class QModelIndex;
class QSettings;
/// @addtogroup GUI
/// @{
@ -121,8 +122,9 @@ public:
/**
* @brief Save View's settings
*
* @param settings program settings.
*/
void SaveSettings();
void SaveSettings(QSettings *settings);
/**
* @brief Translate this view