From 660d1c86c6927495ab46aa2f3607221546226fa9 Mon Sep 17 00:00:00 2001 From: Dirk H Bartley Date: Wed, 22 Jul 2009 00:13:12 +0000 Subject: [PATCH] Do not restore spliiter settings if the settings do not contain settings for that splitter. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@9081 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/qt-console/jobgraphs/jobplot.cpp | 2 +- bacula/src/qt-console/joblist/joblist.cpp | 18 +- bacula/src/qt-console/restore/restore.cpp | 5 +- bacula/src/qt-console/restore/restore.h | 1 + bacula/src/qt-console/restore/restoretree.cpp | 8 +- bacula/src/qt-console/restore/restoretree.ui | 341 +++++++++--------- bacula/src/qt-console/status/clientstat.cpp | 2 +- bacula/src/qt-console/status/dirstat.cpp | 2 +- bacula/src/qt-console/status/storstat.cpp | 2 +- 9 files changed, 194 insertions(+), 187 deletions(-) diff --git a/bacula/src/qt-console/jobgraphs/jobplot.cpp b/bacula/src/qt-console/jobgraphs/jobplot.cpp index 92a2f1a8af..2fe38d5f28 100644 --- a/bacula/src/qt-console/jobgraphs/jobplot.cpp +++ b/bacula/src/qt-console/jobgraphs/jobplot.cpp @@ -571,6 +571,6 @@ void JobPlot::readSplitterSettings() { QSettings settings(m_console->m_dir->name(), "bat"); settings.beginGroup("JobPlot"); - m_splitter->restoreState(settings.value("m_splitterSizes").toByteArray()); + if (settings.contains("m_splitterSizes")) { m_splitter->restoreState(settings.value("m_splitterSizes").toByteArray()); } settings.endGroup(); } diff --git a/bacula/src/qt-console/joblist/joblist.cpp b/bacula/src/qt-console/joblist/joblist.cpp index 27cc840859..0455a668e3 100644 --- a/bacula/src/qt-console/joblist/joblist.cpp +++ b/bacula/src/qt-console/joblist/joblist.cpp @@ -50,7 +50,7 @@ JobList::JobList(const QString &mediaName, const QString &clientName, const QString &jobName, const QString &filesetName, QTreeWidgetItem *parentTreeWidgetItem) { setupUi(this); - m_name = ""; /* treeWidgetName has a virtual override in this class */ + m_name = "Jobs Run"; /* treeWidgetName has a virtual override in this class */ m_mediaName = mediaName; m_clientName = clientName; m_jobName = jobName; @@ -84,8 +84,8 @@ JobList::JobList(const QString &mediaName, const QString &clientName, area->setObjectName(QString::fromUtf8("area")); area->setWidget(frame); area->setWidgetResizable(true); - m_splitter->addWidget(mp_tableWidget); m_splitter->addWidget(area); + m_splitter->addWidget(mp_tableWidget); gridLayout->addWidget(m_splitter, 0, 0, 1, 1); readSettings(); @@ -367,15 +367,15 @@ void JobList::currentStackItem() void JobList::treeWidgetName(QString &desc) { if (m_mediaName != "" ) { - desc = tr("JobList of Volume %1").arg(m_mediaName); + desc = tr("Jobs Run on Volume %1").arg(m_mediaName); } else if (m_clientName != "" ) { - desc = tr("JobList of Client %1").arg(m_clientName); + desc = tr("Jobs Run from Client %1").arg(m_clientName); } else if (m_jobName != "" ) { - desc = tr("JobList of Job %1").arg(m_jobName); + desc = tr("Jobs Run of Job %1").arg(m_jobName); } else if (m_filesetName != "" ) { - desc = tr("JobList of fileset %1").arg(m_filesetName); + desc = tr("Jobs Run with fileset %1").arg(m_filesetName); } else { - desc = tr("JobList"); + desc = tr("Jobs Run"); } } @@ -582,10 +582,10 @@ void JobList::writeSettings() void JobList::readSettings() { m_groupText = "JobListPage"; - m_splitText = "splitterSizes_1"; + m_splitText = "splitterSizes_2"; QSettings settings(m_console->m_dir->name(), "bat"); settings.beginGroup(m_groupText); - m_splitter->restoreState(settings.value(m_splitText).toByteArray()); + if (settings.contains(m_splitText)) { m_splitter->restoreState(settings.value(m_splitText).toByteArray()); } filterCopyCheckBox->setCheckState((Qt::CheckState)settings.value("FilterCopyCheckState").toInt()); filterMigrationCheckBox->setCheckState((Qt::CheckState)settings.value("FilterMigrationCheckState").toInt()); settings.endGroup(); diff --git a/bacula/src/qt-console/restore/restore.cpp b/bacula/src/qt-console/restore/restore.cpp index b349fdefea..557a6d05b4 100644 --- a/bacula/src/qt-console/restore/restore.cpp +++ b/bacula/src/qt-console/restore/restore.cpp @@ -491,7 +491,8 @@ void restorePage::writeSettings() { QSettings settings(m_console->m_dir->name(), "bat"); settings.beginGroup("RestorePage"); - settings.setValue("splitterSizes", splitter->saveState()); + m_splitText = "splitterSizes_2"; + settings.setValue(m_splitText, splitter->saveState()); settings.endGroup(); } @@ -502,6 +503,6 @@ void restorePage::readSettings() { QSettings settings(m_console->m_dir->name(), "bat"); settings.beginGroup("RestorePage"); - splitter->restoreState(settings.value("splitterSizes").toByteArray()); + if (settings.contains(m_splitText)) { splitter->restoreState(settings.value(m_splitText).toByteArray()); } settings.endGroup(); } diff --git a/bacula/src/qt-console/restore/restore.h b/bacula/src/qt-console/restore/restore.h index 92f972f665..c25f2fdc96 100644 --- a/bacula/src/qt-console/restore/restore.h +++ b/bacula/src/qt-console/restore/restore.h @@ -110,6 +110,7 @@ private: QHash m_dirPaths; QHash m_dirTreeItems; QRegExp m_rx; + QString m_splitText; }; diff --git a/bacula/src/qt-console/restore/restoretree.cpp b/bacula/src/qt-console/restore/restoretree.cpp index b410d3cf7d..094fc73d83 100644 --- a/bacula/src/qt-console/restore/restoretree.cpp +++ b/bacula/src/qt-console/restore/restoretree.cpp @@ -714,12 +714,12 @@ void restoreTree::writeSettings() void restoreTree::readSettings() { m_groupText = tr("RestoreTreePage"); - m_splitText1 = "splitterSizes1_2"; - m_splitText2 = "splitterSizes2_2"; + m_splitText1 = "splitterSizes1_3"; + m_splitText2 = "splitterSizes2_3"; QSettings settings(m_console->m_dir->name(), "bat"); settings.beginGroup(m_groupText); - m_splitter->restoreState(settings.value(m_splitText1).toByteArray()); - splitter->restoreState(settings.value(m_splitText2).toByteArray()); + if (settings.contains(m_splitText1)) { m_splitter->restoreState(settings.value(m_splitText1).toByteArray()); } + if (settings.contains(m_splitText2)) { splitter->restoreState(settings.value(m_splitText2).toByteArray()); } settings.endGroup(); } diff --git a/bacula/src/qt-console/restore/restoretree.ui b/bacula/src/qt-console/restore/restoretree.ui index 9362ac0ea5..77f1affdd2 100644 --- a/bacula/src/qt-console/restore/restoretree.ui +++ b/bacula/src/qt-console/restore/restoretree.ui @@ -1,158 +1,165 @@ - + + restoreTreeForm - - + + 0 0 - 711 - 524 + 695 + 432 - + Form - - + + - 60 - 160 + 120 + 190 382 221 - + Qt::Horizontal - - - - 0 - - + + + 6 + + 0 + - - + + Jobs - + Qt::AlignCenter - + - - + + TextLabel - + Qt::AlignCenter - - + + true - + 24 - + Qt::Horizontal - - + + TextLabel - + Qt::AlignCenter - - + + true - + 24 - + Qt::Horizontal - - - - - 0 + + + + 1 - + + + + + 6 + + 0 + - - + + Files - + Qt::AlignCenter - + - - - - 0 - - + + + 6 + + 0 + - - + + Versions of File - + Qt::AlignCenter - - + + FileName - + Qt::AlignCenter - + - - + + 20 59 @@ -160,93 +167,93 @@ 95 - + 900 95 - - + + 3 - + 2 - - - - 2 - - + + + 4 + + 2 + - - + + 2 - + 3 - - - + + + Refresh - - :/images/view-refresh.png + + + :/images/view-refresh.png:/images/view-refresh.png - - - + + + TextLabel - - - + + + Restore - - :/images/restore.png + + + :/images/restore.png:/images/restore.png - - - 2 - - + + 3 + + 2 + - - + + Job - - - - 7 - 0 + + + 0 0 - + Job List Job Criterion Selector - + Job List Job Criterion Selector @@ -254,34 +261,32 @@ - - - 2 - - + + 3 + + 2 + - - + + Client - - - - 7 - 0 + + + 0 0 - + Job List Client Criterion Selector - + Job List Client Criterion Selector @@ -289,34 +294,32 @@ - - - 2 - - + + 3 + + 2 + - - + + FileSet - - - - 7 - 0 + + + 0 0 - + Job List Fileset Criterion Selector - + Job List Fileset Criterion Selector @@ -324,29 +327,29 @@ - - - 2 - - + + 3 + + 2 + - - + + Record Limit - - - 10000 - - + + 1 - + + 10000 + + 25 @@ -354,23 +357,23 @@ - - - 2 - - + + 3 + + 2 + - - + + Days Limit - - + + 7 @@ -379,45 +382,47 @@ - - - - - 5 - 0 + + + + 0 0 - - 13 + + PointingHandCursor - + Directory - - - + + + + + - + Select Directory - - - + + + + + - + UnselectDirectory - + diff --git a/bacula/src/qt-console/status/clientstat.cpp b/bacula/src/qt-console/status/clientstat.cpp index ccba961177..3a1ba5bd67 100644 --- a/bacula/src/qt-console/status/clientstat.cpp +++ b/bacula/src/qt-console/status/clientstat.cpp @@ -277,7 +277,7 @@ void ClientStat::readSettings() m_splitText = "splitterSizes_1"; QSettings settings(m_console->m_dir->name(), "bat"); settings.beginGroup(m_groupText); - splitter->restoreState(settings.value(m_splitText).toByteArray()); + if (settings.contains(m_splitText)) { splitter->restoreState(settings.value(m_splitText).toByteArray()); } spinBox->setValue(settings.value("refreshInterval", 28).toInt()); checkBox->setCheckState((Qt::CheckState)settings.value("refreshCheck", Qt::Checked).toInt()); settings.endGroup(); diff --git a/bacula/src/qt-console/status/dirstat.cpp b/bacula/src/qt-console/status/dirstat.cpp index 54913d40fc..a4d05860f3 100644 --- a/bacula/src/qt-console/status/dirstat.cpp +++ b/bacula/src/qt-console/status/dirstat.cpp @@ -345,7 +345,7 @@ void DirStat::readSettings() m_splitText = "splitterSizes_0"; QSettings settings(m_console->m_dir->name(), "bat"); settings.beginGroup(m_groupText); - splitter->restoreState(settings.value(m_splitText).toByteArray()); + if (settings.contains(m_splitText)) { splitter->restoreState(settings.value(m_splitText).toByteArray()); } spinBox->setValue(settings.value("refreshInterval", 28).toInt()); checkBox->setCheckState((Qt::CheckState)settings.value("refreshCheck", Qt::Checked).toInt()); settings.endGroup(); diff --git a/bacula/src/qt-console/status/storstat.cpp b/bacula/src/qt-console/status/storstat.cpp index 0d2f7bb497..a6a6e7df10 100644 --- a/bacula/src/qt-console/status/storstat.cpp +++ b/bacula/src/qt-console/status/storstat.cpp @@ -349,7 +349,7 @@ void StorStat::readSettings() m_splitText = "splitterSizes_0"; QSettings settings(m_console->m_dir->name(), "bat"); settings.beginGroup(m_groupText); - splitter->restoreState(settings.value(m_splitText).toByteArray()); + if (settings.contains(m_splitText)) { splitter->restoreState(settings.value(m_splitText).toByteArray()); } spinBox->setValue(settings.value("refreshInterval", 28).toInt()); checkBox->setCheckState((Qt::CheckState)settings.value("refreshCheck", Qt::Checked).toInt()); settings.endGroup(); -- 2.39.5