From 9b485e40adee0e9eb46da2e85b5594acc223251b Mon Sep 17 00:00:00 2001 From: Dirk H Bartley Date: Sat, 20 Feb 2010 09:01:00 +0100 Subject: [PATCH] This version fixes an issue where the console window would start out not docked. It is fixed by initiating the variables in the Pages class with a constructor. --- bacula/src/qt-console/job/job.cpp | 1 - bacula/src/qt-console/jobgraphs/jobplot.cpp | 1 - bacula/src/qt-console/joblog/joblog.cpp | 1 - bacula/src/qt-console/label/label.cpp | 1 - bacula/src/qt-console/mainwin.cpp | 5 ++--- bacula/src/qt-console/mediaedit/mediaedit.cpp | 1 - bacula/src/qt-console/mediainfo/mediainfo.cpp | 1 - bacula/src/qt-console/pages.cpp | 8 ++++++++ bacula/src/qt-console/pages.h | 1 + bacula/src/qt-console/restore/brestore.cpp | 1 - bacula/src/qt-console/restore/prerestore.cpp | 1 - bacula/src/qt-console/restore/restore.cpp | 1 - bacula/src/qt-console/restore/restoretree.cpp | 1 - bacula/src/qt-console/status/clientstat.cpp | 1 - bacula/src/qt-console/status/dirstat.cpp | 1 - bacula/src/qt-console/status/storstat.cpp | 1 - bacula/src/qt-console/storage/content.cpp | 1 - 17 files changed, 11 insertions(+), 17 deletions(-) diff --git a/bacula/src/qt-console/job/job.cpp b/bacula/src/qt-console/job/job.cpp index f78bfd8c4e..9fe7ba1b67 100644 --- a/bacula/src/qt-console/job/job.cpp +++ b/bacula/src/qt-console/job/job.cpp @@ -35,7 +35,6 @@ Job::Job(QString &jobId, QTreeWidgetItem *parentTreeWidgetItem) { setupUi(this); - m_closeable = true; pgInitialize(tr("Job"), parentTreeWidgetItem); QTreeWidgetItem* thisitem = mainWin->getFromHash(this); thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/joblog.png"))); diff --git a/bacula/src/qt-console/jobgraphs/jobplot.cpp b/bacula/src/qt-console/jobgraphs/jobplot.cpp index f2b56735c1..86c8a88fb1 100644 --- a/bacula/src/qt-console/jobgraphs/jobplot.cpp +++ b/bacula/src/qt-console/jobgraphs/jobplot.cpp @@ -85,7 +85,6 @@ JobPlot::JobPlot(QTreeWidgetItem *parentTreeWidgetItem, JobPlotPass &passVals) /* this invokes the pass values = operator function */ m_pass = passVals; - m_closeable = true; dockPage(); /* If the values of the controls are predetermined (from joblist), then set * this class as current window at the front of the stack */ diff --git a/bacula/src/qt-console/joblog/joblog.cpp b/bacula/src/qt-console/joblog/joblog.cpp index dad1dfacaa..0e1182f8f1 100644 --- a/bacula/src/qt-console/joblog/joblog.cpp +++ b/bacula/src/qt-console/joblog/joblog.cpp @@ -41,7 +41,6 @@ JobLog::JobLog(QString &jobId, QTreeWidgetItem *parentTreeWidgetItem) { setupUi(this); - m_closeable = true; pgInitialize(tr("JobLog"), parentTreeWidgetItem); QTreeWidgetItem* thisitem = mainWin->getFromHash(this); thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/joblog.png"))); diff --git a/bacula/src/qt-console/label/label.cpp b/bacula/src/qt-console/label/label.cpp index 446da44e4f..4834f4926a 100644 --- a/bacula/src/qt-console/label/label.cpp +++ b/bacula/src/qt-console/label/label.cpp @@ -50,7 +50,6 @@ labelPage::labelPage() */ labelPage::labelPage(QString &defString) { - m_closeable = true; showPage(defString); } diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index 6bb7519e59..10cccd0bf1 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -98,7 +98,7 @@ MainWin::MainWin(QWidget *parent) : QMainWindow(parent) console->connect_dir(); } m_currentConsole = (Console*)getFromHash(m_firstItem); - QTimer::singleShot(5000, this, SLOT(popLists())); + QTimer::singleShot(2000, this, SLOT(popLists())); if (m_miscDebug) { QString directoryResourceName; m_currentConsole->getDirResName(directoryResourceName); @@ -151,6 +151,7 @@ void MainWin::createPages() /* insert the cosole and tree widget item into the hashes */ hashInsert(item, m_currentConsole); + m_currentConsole->dockPage(); /* Set Color of treeWidgetItem for the console * It will be set to green in the console class if the connection is made. @@ -183,8 +184,6 @@ void MainWin::createPages() treeWidget->expandItem(topItem); tabWidget->setCurrentWidget(m_currentConsole); - m_currentConsole->undockPage(); - m_currentConsole->dockPage(); } UnlockRes(); } diff --git a/bacula/src/qt-console/mediaedit/mediaedit.cpp b/bacula/src/qt-console/mediaedit/mediaedit.cpp index f38ae472d0..565f0bd0af 100644 --- a/bacula/src/qt-console/mediaedit/mediaedit.cpp +++ b/bacula/src/qt-console/mediaedit/mediaedit.cpp @@ -46,7 +46,6 @@ MediaEdit::MediaEdit(QTreeWidgetItem *parentWidget, QString &mediaId) pgInitialize(tr("Media Edit"), parentWidget); QTreeWidgetItem* thisitem = mainWin->getFromHash(this); thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/cartridge-edit.png"))); - m_closeable = true; dockPage(); setCurrent(); diff --git a/bacula/src/qt-console/mediainfo/mediainfo.cpp b/bacula/src/qt-console/mediainfo/mediainfo.cpp index 77163346c0..1f11f12c4f 100644 --- a/bacula/src/qt-console/mediainfo/mediainfo.cpp +++ b/bacula/src/qt-console/mediainfo/mediainfo.cpp @@ -53,7 +53,6 @@ MediaInfo::MediaInfo(QTreeWidgetItem *parentWidget, QString &mediaName) connect(pbEdit, SIGNAL(clicked()), this, SLOT(editVol())); connect(tableJob, SIGNAL(itemDoubleClicked(QTableWidgetItem*)), this, SLOT(showInfoForJob(QTableWidgetItem *))); - m_closeable = true; dockPage(); setCurrent(); populateForm(); diff --git a/bacula/src/qt-console/pages.cpp b/bacula/src/qt-console/pages.cpp index de0f2d3926..e99ad6d7a3 100644 --- a/bacula/src/qt-console/pages.cpp +++ b/bacula/src/qt-console/pages.cpp @@ -51,6 +51,14 @@ bool isWin32Path(QString &fullPath) return toret; } +/* Need to initialize variables here */ +Pages::Pages() +{ + m_docked = false; + m_onceDocked = false; + m_closeable = true; +} + /* * dockPage * This function is intended to be called from within the Pages class to pull diff --git a/bacula/src/qt-console/pages.h b/bacula/src/qt-console/pages.h index 4cdacc9aea..b938465b99 100644 --- a/bacula/src/qt-console/pages.h +++ b/bacula/src/qt-console/pages.h @@ -55,6 +55,7 @@ class Console; class Pages : public QWidget { public: + Pages(); void dockPage(); void undockPage(); void togglePageDocking(); diff --git a/bacula/src/qt-console/restore/brestore.cpp b/bacula/src/qt-console/restore/brestore.cpp index d6a643712e..8e491468d6 100644 --- a/bacula/src/qt-console/restore/brestore.cpp +++ b/bacula/src/qt-console/restore/brestore.cpp @@ -43,7 +43,6 @@ bRestore::bRestore() m_name = "bRestore"; setupUi(this); pgInitialize(); - m_closeable = true; dockPage(); } diff --git a/bacula/src/qt-console/restore/prerestore.cpp b/bacula/src/qt-console/restore/prerestore.cpp index d09469d84f..2244bffdeb 100644 --- a/bacula/src/qt-console/restore/prerestore.cpp +++ b/bacula/src/qt-console/restore/prerestore.cpp @@ -63,7 +63,6 @@ void prerestorePage::buildPage() setupUi(this); pgInitialize(); m_conn = m_console->notifyOff(); - m_closeable = true; QTreeWidgetItem* thisitem = mainWin->getFromHash(this); thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/restore.png"))); diff --git a/bacula/src/qt-console/restore/restore.cpp b/bacula/src/qt-console/restore/restore.cpp index 28fa4e64f8..f3e875804f 100644 --- a/bacula/src/qt-console/restore/restore.cpp +++ b/bacula/src/qt-console/restore/restore.cpp @@ -51,7 +51,6 @@ restorePage::restorePage(int conn) thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/restore.png"))); m_console->notify(m_conn, false); /* this should already be off */ - m_closeable = true; connect(fileWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), this, SLOT(fileDoubleClicked(QTreeWidgetItem *, int))); diff --git a/bacula/src/qt-console/restore/restoretree.cpp b/bacula/src/qt-console/restore/restoretree.cpp index dbcbb6ac24..41a6880454 100644 --- a/bacula/src/qt-console/restore/restoretree.cpp +++ b/bacula/src/qt-console/restore/restoretree.cpp @@ -47,7 +47,6 @@ restoreTree::restoreTree() QTreeWidgetItem* thisitem = mainWin->getFromHash(this); thisitem->setIcon(0, QIcon(QString::fromUtf8(":images/browse.png"))); - m_closeable = true; m_populated = false; m_debugCnt = 0; diff --git a/bacula/src/qt-console/status/clientstat.cpp b/bacula/src/qt-console/status/clientstat.cpp index 42d2fdba87..07e444bae3 100644 --- a/bacula/src/qt-console/status/clientstat.cpp +++ b/bacula/src/qt-console/status/clientstat.cpp @@ -43,7 +43,6 @@ ClientStat::ClientStat(QString &client, QTreeWidgetItem *parentTreeWidgetItem) { m_client = client; setupUi(this); - m_closeable = true; pgInitialize(tr("Client Status %1").arg(m_client), parentTreeWidgetItem); QTreeWidgetItem* thisitem = mainWin->getFromHash(this); thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/status.png"))); diff --git a/bacula/src/qt-console/status/dirstat.cpp b/bacula/src/qt-console/status/dirstat.cpp index f8eb317645..d20bc7b623 100644 --- a/bacula/src/qt-console/status/dirstat.cpp +++ b/bacula/src/qt-console/status/dirstat.cpp @@ -43,7 +43,6 @@ DirStat::DirStat() { setupUi(this); m_name = tr("Director Status"); - m_closeable = true; pgInitialize(); QTreeWidgetItem* thisitem = mainWin->getFromHash(this); thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/status.png"))); diff --git a/bacula/src/qt-console/status/storstat.cpp b/bacula/src/qt-console/status/storstat.cpp index a6a6e7df10..3615c2c17a 100644 --- a/bacula/src/qt-console/status/storstat.cpp +++ b/bacula/src/qt-console/status/storstat.cpp @@ -59,7 +59,6 @@ StorStat::StorStat(QString &storage, QTreeWidgetItem *parentTreeWidgetItem) { m_storage = storage; setupUi(this); - m_closeable = true; pgInitialize(tr("Storage Status %1").arg(m_storage), parentTreeWidgetItem); QTreeWidgetItem* thisitem = mainWin->getFromHash(this); thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/status.png"))); diff --git a/bacula/src/qt-console/storage/content.cpp b/bacula/src/qt-console/storage/content.cpp index 93e779f4a8..2c87ebbd00 100644 --- a/bacula/src/qt-console/storage/content.cpp +++ b/bacula/src/qt-console/storage/content.cpp @@ -52,7 +52,6 @@ Content::Content(QString storage, QTreeWidgetItem *parentWidget) m_populated = false; m_firstpopulation = true; m_checkcurwidget = true; - m_closeable = true; m_currentStorage = storage; connect(pbUpdate, SIGNAL(clicked()), this, -- 2.39.5