From 6c0db49277fa832fb930771c794c9055c197e684 Mon Sep 17 00:00:00 2001 From: Dirk H Bartley Date: Tue, 7 Aug 2007 14:21:00 +0000 Subject: [PATCH] Write and read the settings for the previously created splitters in restoretree and joblist. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5297 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/qt-console/joblist/joblist.cpp | 38 +++++++++++++++++-- bacula/src/qt-console/joblist/joblist.h | 4 ++ bacula/src/qt-console/restore/restoretree.cpp | 6 ++- bacula/src/qt-console/restore/restoretree.h | 1 + 4 files changed, 43 insertions(+), 6 deletions(-) diff --git a/bacula/src/qt-console/joblist/joblist.cpp b/bacula/src/qt-console/joblist/joblist.cpp index 376b5c48a6..f01eaaf763 100644 --- a/bacula/src/qt-console/joblist/joblist.cpp +++ b/bacula/src/qt-console/joblist/joblist.cpp @@ -76,15 +76,24 @@ JobList::JobList(const QString &mediaName, const QString &clientName, m_gridLayout->setMargin(9); m_gridLayout->setObjectName(QString::fromUtf8("m_gridLayout")); - QSplitter *splitter_2 = new QSplitter(Qt::Vertical, this); + splitter = new QSplitter(Qt::Vertical, this); QScrollArea *area = new QScrollArea(); area->setObjectName(QString::fromUtf8("area")); area->setWidget(frame); area->setWidgetResizable(true); - splitter_2->addWidget(mp_tableWidget); - splitter_2->addWidget(area); + splitter->addWidget(mp_tableWidget); + splitter->addWidget(area); - m_gridLayout->addWidget(splitter_2, 0, 0, 1, 1); + m_gridLayout->addWidget(splitter, 0, 0, 1, 1); + readSettings(); +} + +/* + * Write the splitter settings in the destructor + */ +JobList::~JobList() +{ + writeSettings(); } /* @@ -577,3 +586,24 @@ void JobList::graphTable() QTreeWidgetItem* pageSelectorTreeWidgetItem = mainWin->getFromHash(this); new JobPlot(pageSelectorTreeWidgetItem, pass); } +/* + * Save user settings associated with this page + */ +void JobList::writeSettings() +{ + QSettings settings(m_console->m_dir->name(), "bat"); + settings.beginGroup("JobListPage"); + settings.setValue("splitterSizes", splitter->saveState()); + settings.endGroup(); +} + +/* + * Read and restore user settings associated with this page + */ +void JobList::readSettings() +{ + QSettings settings(m_console->m_dir->name(), "bat"); + settings.beginGroup("JobListPage"); + splitter->restoreState(settings.value("splitterSizes").toByteArray()); + settings.endGroup(); +} diff --git a/bacula/src/qt-console/joblist/joblist.h b/bacula/src/qt-console/joblist/joblist.h index 994e2dea59..ad7b5d896a 100644 --- a/bacula/src/qt-console/joblist/joblist.h +++ b/bacula/src/qt-console/joblist/joblist.h @@ -45,6 +45,7 @@ class JobList : public Pages, public Ui::JobListForm public: JobList(const QString &medianame, const QString &clientname, const QString &jobname, const QString &filesetname, QTreeWidgetItem *); + ~JobList(); virtual void PgSeltreeWidgetClicked(); virtual void currentStackItem(); int m_resultCount; @@ -71,6 +72,9 @@ private slots: private: void createConnections(); void setStatusColor(QTableWidgetItem *item, QString &field); + void writeSettings(); + void readSettings(); + QSplitter *splitter; QString m_mediaName; QString m_clientName; QString m_jobName; diff --git a/bacula/src/qt-console/restore/restoretree.cpp b/bacula/src/qt-console/restore/restoretree.cpp index 3799d79bd4..a4de6eb0df 100644 --- a/bacula/src/qt-console/restore/restoretree.cpp +++ b/bacula/src/qt-console/restore/restoretree.cpp @@ -50,7 +50,6 @@ restoreTree::restoreTree() m_closeable = true; m_populated = false; - readSettings(); dockPage(); m_winRegExpDrive.setPattern("^[a-z]:/$"); m_winRegExpPath.setPattern("^[a-z]:/"); @@ -63,7 +62,7 @@ restoreTree::restoreTree() m_gridLayout->setMargin(9); m_gridLayout->setObjectName(QString::fromUtf8("m_gridLayout")); - QSplitter *splitter_2 = new QSplitter(Qt::Vertical, this); + splitter_2 = new QSplitter(Qt::Vertical, this); QScrollArea *area = new QScrollArea(); area->setObjectName(QString::fromUtf8("area")); area->setWidget(widget); @@ -84,6 +83,7 @@ restoreTree::restoreTree() limitSpinBox->setValue(mainWin->m_recordLimitVal); daysCheckBox->setCheckState(mainWin->m_daysLimitCheck ? Qt::Checked : Qt::Unchecked); daysSpinBox->setValue(mainWin->m_daysLimitVal); + readSettings(); } restoreTree::~restoreTree() @@ -620,6 +620,7 @@ void restoreTree::writeSettings() QSettings settings(m_console->m_dir->name(), "bat"); settings.beginGroup("RestoreTree"); settings.setValue("splitterSizes", splitter->saveState()); + settings.setValue("splitter_2Sizes", splitter_2->saveState()); settings.endGroup(); } @@ -631,6 +632,7 @@ void restoreTree::readSettings() QSettings settings(m_console->m_dir->name(), "bat"); settings.beginGroup("RestoreTree"); splitter->restoreState(settings.value("splitterSizes").toByteArray()); + splitter_2->restoreState(settings.value("splitter_2Sizes").toByteArray()); settings.endGroup(); } diff --git a/bacula/src/qt-console/restore/restoretree.h b/bacula/src/qt-console/restore/restoretree.h index 541fccc25d..f6121a9280 100644 --- a/bacula/src/qt-console/restore/restoretree.h +++ b/bacula/src/qt-console/restore/restoretree.h @@ -95,6 +95,7 @@ private: void setJobsCheckedList(); int queryFileIndex(QString &fullPath, int jobID); + QSplitter *splitter_2; bool m_populated; bool m_dropdownChanged; QRegExp m_winRegExpDrive; -- 2.39.5