]> git.sur5r.net Git - bacula/bacula/commitdiff
Write and read the settings for the previously created splitters in restoretree
authorDirk H Bartley <dbartley@schupan.com>
Tue, 7 Aug 2007 14:21:00 +0000 (14:21 +0000)
committerDirk H Bartley <dbartley@schupan.com>
Tue, 7 Aug 2007 14:21:00 +0000 (14:21 +0000)
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
bacula/src/qt-console/joblist/joblist.h
bacula/src/qt-console/restore/restoretree.cpp
bacula/src/qt-console/restore/restoretree.h

index 376b5c48a64b7b62a2929efaef58476ea125eb9e..f01eaaf7630b8aef41cfd4069e6149914f86d6d5 100644 (file)
@@ -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();
+}
index 994e2dea59916b53cde3d75563eae644568ce097..ad7b5d896a8d8451bf98a55d2ac86a22dc4169f1 100644 (file)
@@ -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;
index 3799d79bd44ff5cf2b0686f65892ef26fcdd1a40..a4de6eb0dfcd57f0bf94b6b8bd46afd6430c2dc4 100644 (file)
@@ -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();
 }
 
index 541fccc25db8eef169ffb5fbeac636f2d7e4d1b0..f6121a9280d064d6d068374b81132e067f05b64b 100644 (file)
@@ -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;