From b186460d8f7b752685f917bef2704953506d7b04 Mon Sep 17 00:00:00 2001 From: Dirk H Bartley Date: Tue, 26 May 2009 18:28:50 +0000 Subject: [PATCH] On vacation I am having a little fun !! Storage status, dir status and client status pages all now have separate timers which are visible and configurable from within the page. The user can see the countdown of the timer. Add a tab widget to the client status for a little different look containing the heading and running outputs. Changing to a different tab auto refreshes the widget that becomes in front like with the storage status. In the client status page make the table right click to a refresh option. In both client and storage pages, if the right click option for a status window is chosen, a test is done to see if that staus already exists. If so, then bring that status window to the current window instead of creating a repeat instance of the class In the storage status page, miscelaneous tab - add two more buttons to perform commands for label and release identical to the right click options from the storage page. If a status window for a specific client or storage is open when bat is closed, a settings is written and if the storage or client page is populated the next time bat is opened, the status page for the storage or client will automatically be created. In the main menu, add an option to execute "reload" AND ALSO repopulate the lists for an easy way to do both after modifying bacula-dir.conf With each status page having it's own timer, the common timer from prefs is no longer required The joblist page now has a column for pool. A dropdown for selecting based on pool has also been added. Restoretree: The bug that was issued for a directory not being restored has been resolved. I thought this would take a while. Turns out a query just needed one line removed. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8866 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/qt-console/clients/clients.cpp | 43 ++- bacula/src/qt-console/clients/clients.h | 2 + bacula/src/qt-console/joblist/joblist.cpp | 17 +- bacula/src/qt-console/joblist/joblist.ui | 260 +++++++-------- bacula/src/qt-console/main.ui | 11 +- bacula/src/qt-console/mainwin.cpp | 29 +- bacula/src/qt-console/mainwin.h | 3 +- bacula/src/qt-console/prefs.ui | 63 +--- bacula/src/qt-console/restore/restoretree.cpp | 1 - bacula/src/qt-console/status/clientstat.cpp | 47 ++- bacula/src/qt-console/status/clientstat.h | 1 + bacula/src/qt-console/status/clientstat.ui | 221 ++++++++----- bacula/src/qt-console/status/dirstat.cpp | 34 +- bacula/src/qt-console/status/dirstat.ui | 208 +++++++----- bacula/src/qt-console/status/storstat.cpp | 56 ++-- bacula/src/qt-console/status/storstat.h | 3 +- bacula/src/qt-console/status/storstat.ui | 304 ++++++++++-------- bacula/src/qt-console/storage/storage.cpp | 42 ++- bacula/src/qt-console/storage/storage.h | 2 + 19 files changed, 787 insertions(+), 560 deletions(-) diff --git a/bacula/src/qt-console/clients/clients.cpp b/bacula/src/qt-console/clients/clients.cpp index 9f3f4a93b4..2104d1c0a8 100644 --- a/bacula/src/qt-console/clients/clients.cpp +++ b/bacula/src/qt-console/clients/clients.cpp @@ -55,6 +55,7 @@ Clients::Clients() m_populated = false; m_checkcurwidget = true; m_closeable = false; + m_firstpopulation = true; /* add context sensitive menu items specific to this classto the page * selector tree. m_contextActions is QList of QActions */ m_contextActions.append(actionRefreshClients); @@ -127,6 +128,11 @@ void Clients::populateTable() foreach (QString resultline, results) { QStringList fieldlist = resultline.split("\t"); + if (m_firstpopulation) { + m_firstpopulation = false; + settingsOpenStatus(fieldlist[0]); + } + TableItemFormatter item(*tableWidget, row); /* Iterate through fields in the record */ @@ -319,6 +325,39 @@ void Clients::prune() */ void Clients::statusClientWindow() { - QTreeWidgetItem *parentItem = mainWin->getFromHash(this); - new ClientStat(m_currentlyselected, parentItem); + /* if one exists, then just set it current */ + bool found = false; + foreach(Pages *page, mainWin->m_pagehash) { + if (mainWin->currentConsole() == page->console()) { + if (page->name() == tr("Client Status %1").arg(m_currentlyselected)) { + found = true; + page->setCurrent(); + } + } + } + if (!found) { + QTreeWidgetItem *parentItem = mainWin->getFromHash(this); + new ClientStat(m_currentlyselected, parentItem); + } +} + +/* + * If first time, then check to see if there were status pages open the last time closed + * if so open + */ +void Clients::settingsOpenStatus(QString &client) +{ + QSettings settings(m_console->m_dir->name(), "bat"); + + settings.beginGroup("OpenOnExit"); + QString toRead = "ClientStatus_" + client; + if (settings.value(toRead) == 1) { + Pmsg1(000, "Do open Client Status window for : %s\n", client.toUtf8().data()); + new ClientStat(client, mainWin->getFromHash(this)); + setCurrent(); + mainWin->getFromHash(this)->setExpanded(true); + } else { + Pmsg1(000, "Do NOT open Client Status window for : %s\n", client.toUtf8().data()); + } + settings.endGroup(); } diff --git a/bacula/src/qt-console/clients/clients.h b/bacula/src/qt-console/clients/clients.h index 8c206faa49..6bc77e5f51 100644 --- a/bacula/src/qt-console/clients/clients.h +++ b/bacula/src/qt-console/clients/clients.h @@ -61,8 +61,10 @@ private slots: private: void createContextMenu(); + void settingsOpenStatus(QString& client); QString m_currentlyselected; bool m_populated; + bool m_firstpopulation; bool m_checkcurwidget; }; diff --git a/bacula/src/qt-console/joblist/joblist.cpp b/bacula/src/qt-console/joblist/joblist.cpp index aa62e5e10e..dddf9991f2 100644 --- a/bacula/src/qt-console/joblist/joblist.cpp +++ b/bacula/src/qt-console/joblist/joblist.cpp @@ -122,7 +122,8 @@ void JobList::populateTable() QStringList headerlist = (QStringList() << tr("Job Id") << tr("Job Name") << tr("Client") << tr("Job Starttime") << tr("Job Type") << tr("Job Level") << tr("Job Files") - << tr("Job Bytes") << tr("Job Status") << tr("Purged") << tr("File Set")); + << tr("Job Bytes") << tr("Job Status") << tr("Purged") << tr("File Set") + << tr("Pool Name")); m_jobIdIndex = headerlist.indexOf(tr("Job Id")); m_purgedIndex = headerlist.indexOf(tr("Purged")); @@ -158,7 +159,7 @@ void JobList::populateTable() QString resultline; foreach (resultline, results) { fieldlist = resultline.split("\t"); - if (fieldlist.size() < 12) + if (fieldlist.size() < 13) continue; /* some fields missing, ignore row */ TableItemFormatter jobitem(*mp_tableWidget, row); @@ -200,6 +201,8 @@ void JobList::populateTable() /* fileset */ jobitem.setTextFld(col++, fld.next()); + /* pool name */ + jobitem.setTextFld(col++, fld.next()); row++; } } @@ -257,6 +260,9 @@ void JobList::prepareFilterWidgets() fileSetComboBox->addItems(m_console->fileset_list); comboSel(fileSetComboBox, m_filesetName); + poolComboBox->addItem(tr("Any")); + poolComboBox->addItems(m_console->pool_list); + jobStatusComboFill(statusComboBox); } } @@ -274,10 +280,12 @@ void JobList::fillQueryString(QString &query) " Job.Starttime AS JobStart, Job.Type AS JobType," " Job.Level AS BackupLevel, Job.Jobfiles AS FileCount," " Job.JobBytes AS Bytes, Job.JobStatus AS Status," - " Job.PurgedFiles AS Purged, FileSet.FileSet" + " Job.PurgedFiles AS Purged, FileSet.FileSet," + " Pool.Name AS Pool" " FROM Job" " JOIN Client ON (Client.ClientId=Job.ClientId)" - " LEFT OUTER JOIN FileSet ON (FileSet.FileSetId=Job.FileSetId) "; + " LEFT OUTER JOIN FileSet ON (FileSet.FileSetId=Job.FileSetId) " + " LEFT OUTER JOIN pool ON Job.PoolId = Pool.PoolId "; QStringList conditions; if (m_mediaName != tr("Any")) { query += " LEFT OUTER JOIN JobMedia ON (JobMedia.JobId=Job.JobId) " @@ -291,6 +299,7 @@ void JobList::fillQueryString(QString &query) jobStatusComboCond(conditions, statusComboBox, "Job.JobStatus"); boolComboCond(conditions, purgedComboBox, "Job.PurgedFiles"); comboCond(conditions, fileSetComboBox, "FileSet.FileSet"); + comboCond(conditions, poolComboBox, "Pool.Name"); /* If Limit check box For limit by days is checked */ if (daysCheckBox->checkState() == Qt::Checked) { diff --git a/bacula/src/qt-console/joblist/joblist.ui b/bacula/src/qt-console/joblist/joblist.ui index ef1899244c..91df743541 100644 --- a/bacula/src/qt-console/joblist/joblist.ui +++ b/bacula/src/qt-console/joblist/joblist.ui @@ -25,10 +25,10 @@ - 30 - 170 - 533 - 172 + 20 + 220 + 545 + 154 @@ -44,62 +44,28 @@ QFrame::Raised - - 9 - - - 9 - - - 9 - - - 9 - - - 6 - - - 6 - - - + + + + 6 + - 0 + 3 - 0 + 3 - 0 + 3 - 0 - - - 6 - - - 6 + 3 - - - - Qt::Horizontal - - - QSizePolicy::Ignored - - - - 16 - 75 - + + + + 6 - - - - 3 @@ -112,35 +78,29 @@ 3 - - 3 - - - 3 - - - + + - Refresh - - - :/images/view-refresh.png + Record Limit - - - - Graph + + + + 1 - - :/images/applications-graphics.png + + 10000 + + + 25 - + 6 @@ -158,26 +118,24 @@ 3 - - - - 16777215 - 20 - - + - FileSet + Days Limit - + + + 7 + + - + 6 @@ -212,14 +170,14 @@ 3 - + - Status + Clients - + @@ -241,20 +199,20 @@ 3 - + - Purged + Volume - + - + 6 @@ -289,24 +247,14 @@ 3 - + - Record Limit + Job - - - 1 - - - 10000 - - - 25 - - + @@ -328,24 +276,20 @@ 3 - + - Days Limit + Level - - - 7 - - + - + 6 @@ -380,14 +324,14 @@ 3 - + - Clients + Status - + @@ -409,36 +353,21 @@ 3 - + - Volume + Purged - + - + - - 6 - - - 3 - - - 3 - - - 3 - - - 3 - @@ -457,14 +386,14 @@ 3 - + - Job + FileSet - + @@ -486,17 +415,76 @@ 3 - + - Level + Pool - + + + + + + + + + + + + 3 + + + 3 + + + 3 + + + 3 + + + 3 + + + 3 + + + + + Refresh + + + :/images/view-refresh.png + + + + + + + Graph + + + :/images/applications-graphics.png + + + + + + Qt::Vertical + + + + 20 + 40 + + + + diff --git a/bacula/src/qt-console/main.ui b/bacula/src/qt-console/main.ui index cfb309d958..0cd9ae5787 100644 --- a/bacula/src/qt-console/main.ui +++ b/bacula/src/qt-console/main.ui @@ -81,7 +81,7 @@ 0 0 882 - 22 + 24 @@ -114,6 +114,7 @@ + @@ -643,6 +644,14 @@ Repop Lists + + + :/images/mark.png + + + Reload and Repop + + diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index a1352c7429..1d5975d732 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -265,6 +265,7 @@ void MainWin::connectSignals() connect(actionClosePage, SIGNAL(triggered()), this, SLOT(closePage())); connect(actionPreferences, SIGNAL(triggered()), this, SLOT(setPreferences())); connect(actionRepopLists, SIGNAL(triggered()), this, SLOT(repopLists())); + connect(actionReloadRepop, SIGNAL(triggered()), this, SLOT(reloadRepopLists())); } void MainWin::disconnectSignals() @@ -291,6 +292,7 @@ void MainWin::disconnectSignals() disconnect(actionClosePage, SIGNAL(triggered()), this, SLOT(closePage())); disconnect(actionPreferences, SIGNAL(triggered()), this, SLOT(setPreferences())); disconnect(actionRepopLists, SIGNAL(triggered()), this, SLOT(repopLists())); + disconnect(actionReloadRepop, SIGNAL(triggered()), this, SLOT(reloadRepopLists())); } /* @@ -345,10 +347,21 @@ void MainWin::disconnectConsoleSignals(Console *console) disconnect(actionSelectFont, SIGNAL(triggered()), console, SLOT(set_font())); } + +/* + * Two functions to respond to menu items to repop lists and execute reload and repopulate + * the lists for jobs, clients, filesets .. .. + */ void MainWin::repopLists() { m_currentConsole->populateLists(false); } +void MainWin::reloadRepopLists() +{ + QString cmd = "reload"; + m_currentConsole->consoleCommand(cmd); + m_currentConsole->populateLists(false); +} /* * Reimplementation of QWidget closeEvent virtual function @@ -357,6 +370,13 @@ void MainWin::closeEvent(QCloseEvent *event) { m_isClosing = true; writeSettings(); + /* Remove all groups from settings for OpenOnExit so that we can start some of the status windows */ + foreach(Console *console, m_consoleHash){ + QSettings settings(console->m_dir->name(), "bat"); + settings.beginGroup("OpenOnExit"); + settings.remove(""); + settings.endGroup(); + } /* close all non console pages, this will call settings in destructors */ while (m_consoleHash.count() < m_pagehash.count()) { foreach(Pages *page, m_pagehash) { @@ -386,6 +406,7 @@ void MainWin::writeSettings() settings.setValue("winPos", pos()); settings.setValue("state", saveState()); settings.endGroup(); + } void MainWin::readSettings() @@ -748,8 +769,6 @@ void MainWin::setPreferences() prefs.daysSpinBox->setValue(m_daysLimitVal); prefs.checkMessages->setCheckState(m_checkMessages ? Qt::Checked : Qt::Unchecked); prefs.checkMessagesSpin->setValue(m_checkMessagesInterval); - prefs.refreshStatusDir->setCheckState(m_refreshStatusDir ? Qt::Checked : Qt::Unchecked); - prefs.refreshStatusDirSpin->setValue(m_refreshStatusDirInterval); prefs.executeLongCheckBox->setCheckState(m_longList ? Qt::Checked : Qt::Unchecked); prefs.rtPopDirCheckBox->setCheckState(m_rtPopDirDebug ? Qt::Checked : Qt::Unchecked); prefs.rtDirCurICCheckBox->setCheckState(m_rtDirCurICDebug ? Qt::Checked : Qt::Unchecked); @@ -804,8 +823,6 @@ void prefsDialog::accept() mainWin->m_daysLimitVal = this->daysSpinBox->value(); mainWin->m_checkMessages = this->checkMessages->checkState() == Qt::Checked; mainWin->m_checkMessagesInterval = this->checkMessagesSpin->value(); - mainWin->m_refreshStatusDir = this->refreshStatusDir->checkState() == Qt::Checked; - mainWin->m_refreshStatusDirInterval = this->refreshStatusDirSpin->value(); mainWin->m_longList = this->executeLongCheckBox->checkState() == Qt::Checked; mainWin->m_rtPopDirDebug = this->rtPopDirCheckBox->checkState() == Qt::Checked; @@ -849,8 +866,6 @@ void prefsDialog::accept() settings.beginGroup("Timers"); settings.setValue("checkMessages", mainWin->m_checkMessages); settings.setValue("checkMessagesInterval", mainWin->m_checkMessagesInterval); - settings.setValue("refreshStatusDir", mainWin->m_refreshStatusDir); - settings.setValue("refreshStatusDirInterval", mainWin->m_refreshStatusDirInterval); settings.endGroup(); settings.beginGroup("Misc"); settings.setValue("longList", mainWin->m_longList); @@ -902,8 +917,6 @@ void MainWin::readPreferences() settings.beginGroup("Timers"); m_checkMessages = settings.value("checkMessages", false).toBool(); m_checkMessagesInterval = settings.value("checkMessagesInterval", 28).toInt(); - m_refreshStatusDir = settings.value("refreshStatusDir", false).toBool(); - m_refreshStatusDirInterval = settings.value("refreshStatusDirInterval", 28).toInt(); settings.endGroup(); settings.beginGroup("Misc"); m_longList = settings.value("longList", false).toBool(); diff --git a/bacula/src/qt-console/mainwin.h b/bacula/src/qt-console/mainwin.h index 21624a3522..1d3fab3934 100644 --- a/bacula/src/qt-console/mainwin.h +++ b/bacula/src/qt-console/mainwin.h @@ -87,8 +87,6 @@ public: int m_daysLimitVal; bool m_checkMessages; int m_checkMessagesInterval; - bool m_refreshStatusDir; - int m_refreshStatusDirInterval; bool m_longList; bool m_rtPopDirDebug; bool m_rtDirCurICDebug; @@ -128,6 +126,7 @@ public slots: void waitEnter(); void waitExit(); void repopLists(); + void reloadRepopLists(); void popLists(); protected: diff --git a/bacula/src/qt-console/prefs.ui b/bacula/src/qt-console/prefs.ui index f5f4ddcd8e..ca83939a55 100644 --- a/bacula/src/qt-console/prefs.ui +++ b/bacula/src/qt-console/prefs.ui @@ -43,7 +43,7 @@ - 3 + 0 @@ -107,67 +107,6 @@ - - - - 60 - 200 - 180 - 106 - - - - - 0 - 0 - - - - Status Dir - - - - - 11 - 81 - 158 - 16 - - - - Refresh Status Dir Interval - - - - - - 11 - 25 - 158 - 20 - - - - Refresh Status Dir - - - - - - 11 - 51 - 158 - 24 - - - - 15 - - - 3600 - - - diff --git a/bacula/src/qt-console/restore/restoretree.cpp b/bacula/src/qt-console/restore/restoretree.cpp index d1a157318f..d19619823e 100644 --- a/bacula/src/qt-console/restore/restoretree.cpp +++ b/bacula/src/qt-console/restore/restoretree.cpp @@ -1555,7 +1555,6 @@ void restoreTree::restoreButtonPushed() " INNER JOIN Job ON (Job.JobId=File.JobId)" " WHERE File.PathId=" + QString("%1").arg(pathid) + " AND Job.Jobid IN (" + m_checkedJobs + ")" - " AND File.FilenameId!=" + QString("%1").arg(m_nullFileNameId) + " GROUP BY File.FilenameId" ") t1, File " " INNER JOIN Filename on (Filename.FilenameId=File.FilenameId)" diff --git a/bacula/src/qt-console/status/clientstat.cpp b/bacula/src/qt-console/status/clientstat.cpp index 87d146c861..a193e777ca 100644 --- a/bacula/src/qt-console/status/clientstat.cpp +++ b/bacula/src/qt-console/status/clientstat.cpp @@ -52,10 +52,9 @@ ClientStat::ClientStat(QString &client, QTreeWidgetItem *parentTreeWidgetItem) readSettings(); dockPage(); m_timer = new QTimer(this); - QWidget::connect(m_timer, SIGNAL(timeout()), this, SLOT(timerTriggered())); - m_timer->start(mainWin->m_refreshStatusDirInterval*1000); createConnections(); + m_timer->start(1000); setCurrent(); } @@ -87,9 +86,8 @@ ClientStat::~ClientStat() */ void ClientStat::populateAll() { - populateHeader(); populateTerminated(); - populateRunning(); + populateCurrentTab(tabWidget->currentIndex()); } /* @@ -97,10 +95,25 @@ void ClientStat::populateAll() */ void ClientStat::timerTriggered() { - bool iscurrent = mainWin->stackedWidget->currentIndex() == mainWin->stackedWidget->indexOf(this); - if (((isDocked() && iscurrent) || (!isDocked())) && mainWin->m_refreshStatusDir) { - populateAll(); + double value = timerDisplay->value(); + value -= 1; + if (value == 0) { + value = spinBox->value(); + bool iscurrent = mainWin->stackedWidget->currentIndex() == mainWin->stackedWidget->indexOf(this); + if (((isDocked() && iscurrent) || (!isDocked())) && (checkBox->checkState() == Qt::Checked)) { + populateAll(); + } } + timerDisplay->display(value); +} + + +void ClientStat::populateCurrentTab(int index) +{ + if (index == 0) + populateHeader(); + if (index == 1) + populateRunning(); } /* @@ -217,6 +230,8 @@ void ClientStat::PgSeltreeWidgetClicked() void ClientStat::currentStackItem() { populateAll(); + timerDisplay->display(spinBox->value()); + if (!m_populated) { m_populated=true; } @@ -228,8 +243,11 @@ void ClientStat::currentStackItem() */ void ClientStat::createConnections() { - connect(actionRefresh, SIGNAL(triggered()), this, - SLOT(populateAll())); + connect(actionRefresh, SIGNAL(triggered()), this, SLOT(populateAll())); + connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(populateCurrentTab(int))); + connect(m_timer, SIGNAL(timeout()), this, SLOT(timerTriggered())); + terminatedTable->setContextMenuPolicy(Qt::ActionsContextMenu); + terminatedTable->addAction(actionRefresh); } /* @@ -240,6 +258,13 @@ void ClientStat::writeSettings() QSettings settings(m_console->m_dir->name(), "bat"); settings.beginGroup(m_groupText); settings.setValue(m_splitText, splitter->saveState()); + settings.setValue("refreshInterval", spinBox->value()); + settings.setValue("refreshCheck", checkBox->checkState()); + settings.endGroup(); + + settings.beginGroup("OpenOnExit"); + QString toWrite = "ClientStatus_" + m_client; + settings.setValue(toWrite, 1); settings.endGroup(); } @@ -253,5 +278,9 @@ void ClientStat::readSettings() QSettings settings(m_console->m_dir->name(), "bat"); settings.beginGroup(m_groupText); 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(); + + timerDisplay->display(spinBox->value()); } diff --git a/bacula/src/qt-console/status/clientstat.h b/bacula/src/qt-console/status/clientstat.h index ccae6551b5..af90f0de48 100644 --- a/bacula/src/qt-console/status/clientstat.h +++ b/bacula/src/qt-console/status/clientstat.h @@ -53,6 +53,7 @@ public slots: void populateTerminated(); void populateRunning(); void populateAll(); + void populateCurrentTab(int); private slots: void timerTriggered(); diff --git a/bacula/src/qt-console/status/clientstat.ui b/bacula/src/qt-console/status/clientstat.ui index 57026d9685..9862c58e65 100644 --- a/bacula/src/qt-console/status/clientstat.ui +++ b/bacula/src/qt-console/status/clientstat.ui @@ -5,8 +5,8 @@ 0 0 - 618 - 630 + 557 + 350 @@ -18,111 +18,154 @@ Qt::Vertical - - + + - - - Qt::LeftToRight - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:13pt; font-weight:600;">Header</span></p></body></html> - - - Qt::AlignCenter - + + + 0 + + + + Header + + + + + + + 200 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + + 1 + 0 + + + + Qt::StrongFocus + + + false + + + + + + + + + + + + Qt::ScrollBarAsNeeded + + + QTextEdit::AutoNone + + + false + + + + + + QTextEdit::NoWrap + + + true + + + + + + + + Running + + + + + + + - - - - 200 - 0 - - + - 0 + 141 0 - 16777215 + 141 16777215 - - - 1 - 0 - - - - Qt::StrongFocus - - - false - - - - - - - - - - - - Qt::ScrollBarAsNeeded - - - QTextEdit::AutoNone - - - false - - - - - - QTextEdit::NoWrap - - - true - - - - - - - - - - - Qt::LeftToRight - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:13pt; font-weight:600;">Running</span></p></body></html> - - - Qt::AlignCenter - + + Refresh Timer + + + + + 20 + 50 + 111 + 24 + + + + 5 + + + 999 + + + + + + 20 + 20 + 101 + 20 + + + + Do Refresh + + + + + + 20 + 80 + 101 + 31 + + + - - - - + diff --git a/bacula/src/qt-console/status/dirstat.cpp b/bacula/src/qt-console/status/dirstat.cpp index 03efffdf7e..400eb23bdc 100644 --- a/bacula/src/qt-console/status/dirstat.cpp +++ b/bacula/src/qt-console/status/dirstat.cpp @@ -49,11 +49,10 @@ DirStat::DirStat() thisitem->setIcon(0,QIcon(QString::fromUtf8(":images/status.png"))); m_cursor = new QTextCursor(textEdit->document()); + m_timer = new QTimer(this); readSettings(); dockPage(); - m_timer = new QTimer(this); - QWidget::connect(m_timer, SIGNAL(timeout()), this, SLOT(timerTriggered())); - m_timer->start(mainWin->m_refreshStatusDirInterval*1000); + m_timer->start(1000); createConnections(); setCurrent(); @@ -98,10 +97,16 @@ void DirStat::populateAll() */ void DirStat::timerTriggered() { - bool iscurrent = mainWin->stackedWidget->currentIndex() == mainWin->stackedWidget->indexOf(this); - if (((isDocked() && iscurrent) || (!isDocked())) && mainWin->m_refreshStatusDir) { - populateAll(); + double value = timerDisplay->value(); + value -= 1; + if (value == 0) { + value = spinBox->value(); + bool iscurrent = mainWin->stackedWidget->currentIndex() == mainWin->stackedWidget->indexOf(this); + if (((isDocked() && iscurrent) || (!isDocked())) && (checkBox->checkState() == Qt::Checked)) { + populateAll(); + } } + timerDisplay->display(value); } /* @@ -290,6 +295,7 @@ void DirStat::PgSeltreeWidgetClicked() void DirStat::currentStackItem() { populateAll(); + timerDisplay->display(spinBox->value()); if (!m_populated) { m_populated=true; } @@ -301,12 +307,10 @@ void DirStat::currentStackItem() */ void DirStat::createConnections() { - connect(actionRefresh, SIGNAL(triggered()), this, - SLOT(populateAll())); - connect(actionCancelRunning, SIGNAL(triggered()), this, - SLOT(consoleCancelJob())); - connect(actionDisableScheduledJob, SIGNAL(triggered()), this, - SLOT(consoleDisableJob())); + connect(actionRefresh, SIGNAL(triggered()), this, SLOT(populateAll())); + connect(actionCancelRunning, SIGNAL(triggered()), this, SLOT(consoleCancelJob())); + connect(actionDisableScheduledJob, SIGNAL(triggered()), this, SLOT(consoleDisableJob())); + connect(m_timer, SIGNAL(timeout()), this, SLOT(timerTriggered())); scheduledTable->setContextMenuPolicy(Qt::ActionsContextMenu); scheduledTable->addAction(actionRefresh); @@ -326,6 +330,8 @@ void DirStat::writeSettings() QSettings settings(m_console->m_dir->name(), "bat"); settings.beginGroup(m_groupText); settings.setValue(m_splitText, splitter->saveState()); + settings.setValue("refreshInterval", spinBox->value()); + settings.setValue("refreshCheck", checkBox->checkState()); settings.endGroup(); } @@ -339,7 +345,11 @@ void DirStat::readSettings() QSettings settings(m_console->m_dir->name(), "bat"); settings.beginGroup(m_groupText); 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(); + + timerDisplay->display(spinBox->value()); } /* diff --git a/bacula/src/qt-console/status/dirstat.ui b/bacula/src/qt-console/status/dirstat.ui index edc0657288..41a4b40d60 100644 --- a/bacula/src/qt-console/status/dirstat.ui +++ b/bacula/src/qt-console/status/dirstat.ui @@ -5,95 +5,147 @@ 0 0 - 409 - 326 + 514 + 425 Form - - 9 - - - 9 - - - 9 - - - 9 - - - 6 - - - 6 - Qt::Vertical - - - - 200 - 0 - - - - - 0 - 0 - - - - - 16777215 - 100 - - - - - 1 - 0 - - - - Qt::StrongFocus - - - false - - - - - - - - - - - - Qt::ScrollBarAsNeeded - - - QTextEdit::AutoNone - - - false - - - - - - QTextEdit::NoWrap - - - true - + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 100 + + + + + 1 + 0 + + + + Qt::StrongFocus + + + false + + + + + + + + + + + + Qt::ScrollBarAsNeeded + + + QTextEdit::AutoNone + + + false + + + + + + QTextEdit::NoWrap + + + true + + + + + + + + 0 + 0 + + + + + 221 + 100 + + + + + 221 + 100 + + + + Refresh Timer + + + + + 20 + 60 + 111 + 24 + + + + 5 + + + 999 + + + + + + 20 + 20 + 101 + 20 + + + + Do Refresh + + + + + + 110 + 20 + 101 + 31 + + + + + + diff --git a/bacula/src/qt-console/status/storstat.cpp b/bacula/src/qt-console/status/storstat.cpp index 7a148e9bd2..4925778a0f 100644 --- a/bacula/src/qt-console/status/storstat.cpp +++ b/bacula/src/qt-console/status/storstat.cpp @@ -36,6 +36,7 @@ #include #include "storstat.h" #include "mount/mount.h" +#include "label/label.h" /* .status storage= @@ -67,9 +68,9 @@ StorStat::StorStat(QString &storage, QTreeWidgetItem *parentTreeWidgetItem) m_timer = new QTimer(this); readSettings(); dockPage(); - QWidget::connect(m_timer, SIGNAL(timeout()), this, SLOT(timerTriggered())); createConnections(); + m_timer->start(1000); setCurrent(); } @@ -110,10 +111,16 @@ void StorStat::populateAll() */ void StorStat::timerTriggered() { - bool iscurrent = mainWin->stackedWidget->currentIndex() == mainWin->stackedWidget->indexOf(this); - if (((isDocked() && iscurrent) || (!isDocked())) && (checkBox->checkState() == Qt::Checked)) { - populateAll(); + double value = timerDisplay->value(); + value -= 1; + if (value == 0) { + value = spinBox->value(); + bool iscurrent = mainWin->stackedWidget->currentIndex() == mainWin->stackedWidget->indexOf(this); + if (((isDocked() && iscurrent) || (!isDocked())) && (checkBox->checkState() == Qt::Checked)) { + populateAll(); + } } + timerDisplay->display(value); } /* @@ -291,6 +298,7 @@ void StorStat::PgSeltreeWidgetClicked() void StorStat::currentStackItem() { populateAll(); + timerDisplay->display(spinBox->value()); if (!m_populated) { m_populated=true; } @@ -302,16 +310,15 @@ void StorStat::currentStackItem() */ void StorStat::createConnections() { - connect(actionRefresh, SIGNAL(triggered()), this, - SLOT(populateAll())); - connect(tabWidget, SIGNAL(currentChanged(int)), this, - SLOT(populateCurrentTab(int))); - connect(spinBox, SIGNAL(valueChanged(int)), this, - SLOT(spinBoxValueChanged(int))); + connect(actionRefresh, SIGNAL(triggered()), this, SLOT(populateAll())); + connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(populateCurrentTab(int))); connect(mountButton, SIGNAL(pressed()), this, SLOT(mountButtonPushed())); connect(umountButton, SIGNAL(pressed()), this, SLOT(umountButtonPushed())); + connect(labelButton, SIGNAL(pressed()), this, SLOT(labelButtonPushed())); + connect(releaseButton, SIGNAL(pressed()), this, SLOT(releaseButtonPushed())); terminatedTable->setContextMenuPolicy(Qt::ActionsContextMenu); terminatedTable->addAction(actionRefresh); + connect(m_timer, SIGNAL(timeout()), this, SLOT(timerTriggered())); } /* @@ -325,6 +332,11 @@ void StorStat::writeSettings() settings.setValue("refreshInterval", spinBox->value()); settings.setValue("refreshCheck", checkBox->checkState()); settings.endGroup(); + + settings.beginGroup("OpenOnExit"); + QString toWrite = "StorageStatus_" + m_storage; + settings.setValue(toWrite, 1); + settings.endGroup(); } /* @@ -341,7 +353,7 @@ void StorStat::readSettings() checkBox->setCheckState((Qt::CheckState)settings.value("refreshCheck", Qt::Checked).toInt()); settings.endGroup(); - m_timer->start(spinBox->value()*1000); + timerDisplay->display(spinBox->value()); } /* @@ -363,14 +375,6 @@ void StorStat::populateCurrentTab(int index) populateRunning(); } -/* - * Set the timer when changed - */ -void StorStat::spinBoxValueChanged(int newval) -{ - m_timer->setInterval(newval*1000); -} - /* * execute mount in console */ @@ -428,3 +432,17 @@ void StorStat::umountButtonPushed() QString cmd("umount storage=" + m_storage); consoleCommand(cmd); } + +/* Release a tape in the drive */ +void StorStat::releaseButtonPushed() +{ + QString cmd("release storage="); + cmd += m_storage; + consoleCommand(cmd); +} + +/* Label Media populating current storage by default */ +void StorStat::labelButtonPushed() +{ + new labelPage(m_storage); +} diff --git a/bacula/src/qt-console/status/storstat.h b/bacula/src/qt-console/status/storstat.h index 8648d39a5e..7eb846a5ac 100644 --- a/bacula/src/qt-console/status/storstat.h +++ b/bacula/src/qt-console/status/storstat.h @@ -60,10 +60,11 @@ public slots: private slots: void timerTriggered(); - void spinBoxValueChanged(int); void populateCurrentTab(int); void mountButtonPushed(); void umountButtonPushed(); + void releaseButtonPushed(); + void labelButtonPushed(); private: void createConnections(); diff --git a/bacula/src/qt-console/status/storstat.ui b/bacula/src/qt-console/status/storstat.ui index fd1960e20c..36a1049f47 100644 --- a/bacula/src/qt-console/status/storstat.ui +++ b/bacula/src/qt-console/status/storstat.ui @@ -5,8 +5,8 @@ 0 0 - 367 - 310 + 694 + 393 @@ -18,143 +18,179 @@ Qt::Vertical - - - 0 - - - - Header - - - - - - - - - - Waitreservation - - - - - - - - - - Devices - - - - - - - - - - Volumes - - - - - - - - - - Spooling - - - - - - - - - - Running - - - - - - - - - - Misc - - - - - 170 - 40 - 80 - 24 - - - - Mount - - - - - - 170 - 70 - 80 - 24 - - - - UMount - - - - - - 10 - 10 - 151 - 91 - - - - Refresh Timer Top - - - - - 20 - 50 - 111 - 24 - - - - 5 - - - 999 + + + + + + 6 + + + Header + + + + + + + + + + Waitreservation + + + + + + + + + + Devices + + + + + + + + + + Volumes + + + + + + + + + + Spooling + + + + + + + + + + Running + + + + + + + + + + Misc + + + + + 10 + 10 + 168 + 60 + + + + + + + Mount + + + + + + + UMount + + + + + + + Label + + + + + + + Release + + + + + + - - - - 20 - 20 - 101 - 20 - + + + + + + 141 + 0 + - - Do Refresh + + + 141 + 16777215 + + + + Refresh Timer + + + + 20 + 50 + 111 + 24 + + + + 5 + + + 999 + + + + + + 20 + 20 + 101 + 20 + + + + Do Refresh + + + + + + 20 + 80 + 101 + 31 + + + - - + + diff --git a/bacula/src/qt-console/storage/storage.cpp b/bacula/src/qt-console/storage/storage.cpp index 8484ae12d6..d76c8e9e07 100644 --- a/bacula/src/qt-console/storage/storage.cpp +++ b/bacula/src/qt-console/storage/storage.cpp @@ -53,6 +53,7 @@ Storage::Storage() /* mp_treeWidget, Storage Tree Tree Widget inherited from ui_storage.h */ m_populated = false; + m_firstpopulation = true; m_checkcurwidget = true; m_closeable = false; m_currentStorage = ""; @@ -132,6 +133,10 @@ void Storage::populateTree() foreach (QString resultline, results) { fieldlist = resultline.split("\t"); storageName = fieldlist.takeFirst(); + if (m_firstpopulation) { + m_firstpopulation = false; + settingsOpenStatus(storageName); + } TreeItemFormatter storageItem(*m_topItem, 1); storageItem.setTextFld(0, storageName); if(settings.contains(storageName)) @@ -404,8 +409,20 @@ void Storage::consoleRelease() */ void Storage::statusStorageWindow() { - QTreeWidgetItem *parentItem = mainWin->getFromHash(this); - new StorStat(m_currentStorage, parentItem); + /* if one exists, then just set it current */ + bool found = false; + foreach(Pages *page, mainWin->m_pagehash) { + if (mainWin->currentConsole() == page->console()) { + if (page->name() == tr("Storage Status %1").arg(m_currentStorage)) { + found = true; + page->setCurrent(); + } + } + } + if (!found) { + QTreeWidgetItem *parentItem = mainWin->getFromHash(this); + new StorStat(m_currentStorage, parentItem); + } } /* @@ -422,3 +439,24 @@ void Storage::writeExpandedSettings() } settings.endGroup(); } + +/* + * If first time, then check to see if there were status pages open the last time closed + * if so open + */ +void Storage::settingsOpenStatus(QString &storage) +{ + QSettings settings(m_console->m_dir->name(), "bat"); + + settings.beginGroup("OpenOnExit"); + QString toRead = "StorageStatus_" + storage; + if (settings.value(toRead) == 1) { + Pmsg1(000, "Do open Storage Status window for : %s\n", storage.toUtf8().data()); + new StorStat(storage, mainWin->getFromHash(this)); + setCurrent(); + mainWin->getFromHash(this)->setExpanded(true); + } else { + Pmsg1(000, "Do NOT open Storage Status window for : %s\n", storage.toUtf8().data()); + } + settings.endGroup(); +} diff --git a/bacula/src/qt-console/storage/storage.h b/bacula/src/qt-console/storage/storage.h index 3e778f12bb..8f3f416d5a 100644 --- a/bacula/src/qt-console/storage/storage.h +++ b/bacula/src/qt-console/storage/storage.h @@ -65,9 +65,11 @@ private slots: private: void createContextMenu(); void mediaList(QTreeWidgetItem *parent, const QString &storageID); + void settingsOpenStatus(QString& storage); QString m_currentStorage; bool m_currentAutoChanger; bool m_populated; + bool m_firstpopulation; bool m_checkcurwidget; void writeExpandedSettings(); QTreeWidgetItem *m_topItem; -- 2.39.5