From: Kern Sibbald Date: Tue, 15 May 2007 21:22:39 +0000 (+0000) Subject: Implement crude preferences dialog X-Git-Tag: Release-7.0.0~6338 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=46da6496eda05ce7f3d6c95b6716a73b1d50aaf0;p=bacula%2Fbacula Implement crude preferences dialog git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4794 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/qt-console/bat.pro.in b/bacula/src/qt-console/bat.pro.in index 5ec12d5e6b..c0e25ad517 100644 --- a/bacula/src/qt-console/bat.pro.in +++ b/bacula/src/qt-console/bat.pro.in @@ -28,7 +28,8 @@ OBJECTS_DIR = obj UI_DIR = ui # Main window -FORMS += main.ui +FORMS += main.ui +FORMS += prefs.ui FORMS += label/label.ui FORMS += relabel/relabel.ui FORMS += mount/mount.ui @@ -99,7 +100,7 @@ SOURCES += storage/storage.cpp HEADERS += fileset/fileset.h SOURCES += fileset/fileset.cpp -## Fileset +## Job log HEADERS += joblog/joblog.h SOURCES += joblog/joblog.cpp diff --git a/bacula/src/qt-console/main.ui b/bacula/src/qt-console/main.ui index f9fa3e542f..c7650c0fb2 100644 --- a/bacula/src/qt-console/main.ui +++ b/bacula/src/qt-console/main.ui @@ -80,12 +80,6 @@ - - - Settings - - - &Edit @@ -102,6 +96,13 @@ + + + Settings + + + + @@ -485,6 +486,17 @@ Display any messages queued at the director + + + &Preferences ... + + + Set Preferences + + + Set Preferences + + diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index 8fa0aec17a..4820df1d2a 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -47,6 +47,8 @@ #include "joblist/joblist.h" #include "clients/clients.h" +extern bool commDebug; + MainWin::MainWin(QWidget *parent) : QMainWindow(parent) { @@ -271,6 +273,7 @@ void MainWin::createConnections() connect(actionUndock, SIGNAL(triggered()), this, SLOT(undockWindowButton())); connect(actionToggleDock, SIGNAL(triggered()), this, SLOT(toggleDockContextWindow())); connect(actionClosePage, SIGNAL(triggered()), this, SLOT(closePage())); + connect(actionPreferences, SIGNAL(triggered()), this, SLOT(setPreferences())); } /* @@ -602,3 +605,29 @@ QTreeWidgetItem *MainWin::currentTopItem() { return m_currentConsole->directorTreeItem(); } + +/* Preferences menu item clicked */ +void MainWin::setPreferences() +{ + prefsDialog prefs; + prefs.checkBox->setCheckState(commDebug ? Qt::Checked : Qt::Unchecked); + prefs.exec(); +} + +/* Preferences dialog */ +prefsDialog::prefsDialog() +{ + setupUi(this); +} + +void prefsDialog::accept() +{ + this->hide(); + commDebug = this->checkBox->checkState() == Qt::Checked; +} + +void prefsDialog::reject() +{ + this->hide(); + mainWin->set_status("Canceled"); +} diff --git a/bacula/src/qt-console/mainwin.h b/bacula/src/qt-console/mainwin.h index 60ad2630b3..814b1889e8 100644 --- a/bacula/src/qt-console/mainwin.h +++ b/bacula/src/qt-console/mainwin.h @@ -82,6 +82,7 @@ public slots: void stackItemChanged(int); void toggleDockContextWindow(); void closePage(); + void setPreferences(); protected: void closeEvent(QCloseEvent *event); @@ -106,4 +107,18 @@ private: QTreeWidgetItem *m_firstItem; }; +#include "ui_prefs.h" + +class prefsDialog : public QDialog, public Ui::PrefsForm +{ + Q_OBJECT + +public: + prefsDialog(); + +private slots: + void accept(); + void reject(); +}; + #endif /* _MAINWIN_H_ */