From f85d9ac48410082dc5965ccf86d3b758508a61a0 Mon Sep 17 00:00:00 2001 From: Dirk H Bartley Date: Sat, 19 May 2007 20:03:10 +0000 Subject: [PATCH] This commit puts prefences for debuggin output and prefences for the joblist with the 2 checkboxes and 2 spinboxes for limiting the output from the sql statement. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4841 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/qt-console/TODO | 29 +- bacula/src/qt-console/bat.h | 2 - bacula/src/qt-console/clients/clients.cpp | 6 +- bacula/src/qt-console/console/console.cpp | 42 +-- bacula/src/qt-console/fileset/fileset.cpp | 7 +- bacula/src/qt-console/joblist/joblist.cpp | 20 +- bacula/src/qt-console/joblist/joblist.ui | 24 +- bacula/src/qt-console/label/label.cpp | 5 +- bacula/src/qt-console/main.cpp | 8 - bacula/src/qt-console/mainwin.cpp | 62 +++- bacula/src/qt-console/mainwin.h | 11 + bacula/src/qt-console/mediaedit/mediaedit.cpp | 10 +- bacula/src/qt-console/medialist/medialist.cpp | 5 +- bacula/src/qt-console/mount/mount.cpp | 5 +- bacula/src/qt-console/prefs.ui | 291 +++++++++++++----- bacula/src/qt-console/relabel/relabel.cpp | 5 +- bacula/src/qt-console/restore/prerestore.cpp | 7 +- bacula/src/qt-console/restore/restore.cpp | 34 +- bacula/src/qt-console/storage/storage.cpp | 6 +- 19 files changed, 395 insertions(+), 184 deletions(-) diff --git a/bacula/src/qt-console/TODO b/bacula/src/qt-console/TODO index af88907e4a..31857521ec 100644 --- a/bacula/src/qt-console/TODO +++ b/bacula/src/qt-console/TODO @@ -1,16 +1,11 @@ dhb ==================================================== -Further testing of restore with .mod - -User preferences. With log to stdout options. -Have settings for defaults of limits on joblist - -Add fileset to joblist. - joblist cancel a running job. Set default for replace in run restore job to "always"?????? +Fixes to final restore widgets. + Add context sensitive options for most commands status dir on page select director item All items with jobid= that I thought could work from joblist are done. @@ -18,14 +13,8 @@ As well as many more update slots scan see COMMANDS file -Option in joblist like with restore from jobid but restore populating timestamp -of the selected job. - Get the 5 second bring to bottom of console to stop -Resolve issue of connection during restore selection. Could go with preempt of -connections. (Kern is to work on) - ========LOW priority items: Human readable in joblist for purged, joblevel and job type. @@ -86,6 +75,20 @@ global one defined in the mainWin class (if I remember right). ============================================================ DONE: ============================================================ +Option in joblist like with restore from jobid but restore populating timestamp +of the selected job. + +User preferences. With log to stdout options. +Have settings for defaults of limits on joblist + +Resolve issue of connection during restore selection. Could go with preempt of +connections. Temporary resolution is in. (Kern is to work on) + +Further testing of restore with .mod + Tested a few things, not all. + +Add fileset to joblist. + Test left pane of restore with 2 windows drives in one backup job. Yup, id didn't work, now it does. diff --git a/bacula/src/qt-console/bat.h b/bacula/src/qt-console/bat.h index c1d8f5d9bc..606077e658 100644 --- a/bacula/src/qt-console/bat.h +++ b/bacula/src/qt-console/bat.h @@ -46,8 +46,6 @@ using namespace qstd; extern MainWin *mainWin; extern QApplication *app; -extern bool g_commDebug; -extern bool g_displayAll; int bvsnprintf(char *str, int32_t size, const char *format, va_list ap); diff --git a/bacula/src/qt-console/clients/clients.cpp b/bacula/src/qt-console/clients/clients.cpp index 77c646baca..c2d2dad52e 100644 --- a/bacula/src/qt-console/clients/clients.cpp +++ b/bacula/src/qt-console/clients/clients.cpp @@ -80,8 +80,6 @@ void Clients::populateTree() mp_treeWidget->setColumnCount(headerlist.count()); mp_treeWidget->setHeaderLabels(headerlist); - /* This could be a log item */ - //printf("In Clients::populateTree()\n"); foreach (QString clientName, m_console->client_list){ clientItem = new QTreeWidgetItem(topItem); @@ -99,7 +97,9 @@ void Clients::populateTree() QStringList results; /* This could be a log item */ - //printf("Clients query cmd : %s\n",query.toUtf8().data()); + if (mainWin->m_sqlDebug) { + Pmsg1(000, "Clients query cmd : %s\n",query.toUtf8().data()); + } if (m_console->sql_cmd(query, results)) { int resultCount = results.count(); if (resultCount == 1){ diff --git a/bacula/src/qt-console/console/console.cpp b/bacula/src/qt-console/console/console.cpp index d7ebbef4ec..3e5eb4af4b 100644 --- a/bacula/src/qt-console/console/console.cpp +++ b/bacula/src/qt-console/console/console.cpp @@ -190,7 +190,7 @@ bool Console::dir_cmd(const char *cmd, QStringList &results) notify(false); write(cmd); while ((stat = read()) > 0) { - if (g_displayAll) display_text(msg()); + if (mainWin->m_displayAll) display_text(msg()); strip_trailing_junk(msg()); results << msg(); } @@ -222,7 +222,7 @@ bool Console::sql_cmd(const char *query, QStringList &results) pm_strcat(cmd, "\""); write(cmd.c_str()); while ((stat = read()) > 0) { - if (g_displayAll) display_text(msg()); + if (mainWin->m_displayAll) display_text(msg()); strip_trailing_junk(msg()); results << msg(); } @@ -247,7 +247,7 @@ bool Console::get_job_defaults(struct job_defaults &job_defs) scmd = QString(".defaults job=\"%1\"").arg(job_defs.job_name); write(scmd); while ((stat = read()) > 0) { - if (g_displayAll) display_text(msg()); + if (mainWin->m_displayAll) display_text(msg()); def = strchr(msg(), '='); if (!def) { continue; @@ -474,7 +474,7 @@ int Console::write(const char *msg) m_sock->msglen = pm_strcpy(m_sock->msg, msg); m_at_prompt = false; m_at_main_prompt = false; - if (g_commDebug) Pmsg1(000, "send: %s\n", msg); + if (mainWin->m_commDebug) Pmsg1(000, "send: %s\n", msg); return m_sock->send(); } @@ -485,15 +485,15 @@ void Console::beginNewCommand() { write(".\n"); while (read() > 0) { - if (g_displayAll) display_text(msg()); + if (mainWin->m_displayAll) display_text(msg()); } write(".\n"); while (read() > 0) { - if (g_displayAll) display_text(msg()); + if (mainWin->m_displayAll) display_text(msg()); } write(".\n"); while (read() > 0) { - if (g_displayAll) display_text(msg()); + if (mainWin->m_displayAll) display_text(msg()); } display_text("\n"); } @@ -501,25 +501,25 @@ void Console::beginNewCommand() void Console::displayToPrompt() { int stat; - if (g_commDebug) Pmsg0(000, "DisplaytoPrompt\n"); + if (mainWin->m_commDebug) Pmsg0(000, "DisplaytoPrompt\n"); while (!m_at_prompt) { if ((stat=read()) > 0) { display_text(msg()); } } - if (g_commDebug) Pmsg1(000, "endDisplaytoPrompt=%d\n", stat); + if (mainWin->m_commDebug) Pmsg1(000, "endDisplaytoPrompt=%d\n", stat); } void Console::discardToPrompt() { int stat; - if (g_commDebug) Pmsg0(000, "discardToPrompt\n"); + if (mainWin->m_commDebug) Pmsg0(000, "discardToPrompt\n"); while (!m_at_prompt) { if ((stat=read()) > 0) { - if (g_displayAll) display_text(msg()); + if (mainWin->m_displayAll) display_text(msg()); } } - if (g_commDebug) Pmsg1(000, "endDisplayToPrompt=%d\n", stat); + if (mainWin->m_commDebug) Pmsg1(000, "endDisplayToPrompt=%d\n", stat); } @@ -548,27 +548,27 @@ int Console::read() m_at_prompt = false; m_at_main_prompt = false; } - if (g_commDebug) Pmsg1(000, "got: %s", m_sock->msg); + if (mainWin->m_commDebug) Pmsg1(000, "got: %s", m_sock->msg); } switch (m_sock->msglen) { case BNET_MSGS_PENDING: - if (g_commDebug) Pmsg0(000, "MSGS PENDING\n"); + if (mainWin->m_commDebug) Pmsg0(000, "MSGS PENDING\n"); write_dir(".messages"); displayToPrompt(); m_messages_pending = false; continue; case BNET_CMD_OK: - if (g_commDebug) Pmsg0(000, "CMD OK\n"); + if (mainWin->m_commDebug) Pmsg0(000, "CMD OK\n"); m_at_prompt = false; m_at_main_prompt = false; continue; case BNET_CMD_BEGIN: - if (g_commDebug) Pmsg0(000, "CMD BEGIN\n"); + if (mainWin->m_commDebug) Pmsg0(000, "CMD BEGIN\n"); m_at_prompt = false; m_at_main_prompt = false; continue; case BNET_MAIN_PROMPT: - if (g_commDebug) Pmsg0(000, "PROMPT\n"); + if (mainWin->m_commDebug) Pmsg0(000, "PROMPT\n"); m_at_prompt = true; m_at_main_prompt = true; mainWin->set_status(_("At prompt waiting for input ...")); @@ -576,7 +576,7 @@ int Console::read() QApplication::restoreOverrideCursor(); break; case BNET_PROMPT: - if (g_commDebug) Pmsg0(000, "PROMPT\n"); + if (mainWin->m_commDebug) Pmsg0(000, "PROMPT\n"); m_at_prompt = true; m_at_main_prompt = false; mainWin->set_status(_("At prompt waiting for input ...")); @@ -584,14 +584,14 @@ int Console::read() QApplication::restoreOverrideCursor(); break; case BNET_CMD_FAILED: - if (g_commDebug) Pmsg0(000, "CMD FAIL\n"); + if (mainWin->m_commDebug) Pmsg0(000, "CMD FAIL\n"); mainWin->set_status(_("Command failed. At prompt waiting for input ...")); update_cursor(); QApplication::restoreOverrideCursor(); break; /* We should not get this one */ case BNET_EOD: - if (g_commDebug) Pmsg0(000, "EOD\n"); + if (mainWin->m_commDebug) Pmsg0(000, "EOD\n"); mainWin->set_status_ready(); update_cursor(); QApplication::restoreOverrideCursor(); @@ -646,7 +646,7 @@ void Console::read_dir(int fd) int stat; (void)fd; - if (g_commDebug) Pmsg0(000, "read_dir\n"); + if (mainWin->m_commDebug) Pmsg0(000, "read_dir\n"); while ((stat = read()) >= 0) { display_text(msg()); } diff --git a/bacula/src/qt-console/fileset/fileset.cpp b/bacula/src/qt-console/fileset/fileset.cpp index deb2743dac..1aeb9a1bb0 100644 --- a/bacula/src/qt-console/fileset/fileset.cpp +++ b/bacula/src/qt-console/fileset/fileset.cpp @@ -81,8 +81,6 @@ void FileSet::populateTree() mp_treeWidget->setColumnCount(headerlist.count()); mp_treeWidget->setHeaderLabels(headerlist); - /* This could be a log item */ - //printf("In FileSet::populateTree()\n"); foreach(QString filesetName, m_console->fileset_list) { filesetItem = new QTreeWidgetItem(topItem); @@ -99,8 +97,9 @@ void FileSet::populateTree() query += " ORDER BY FileSet"; QStringList results; - /* This could be a log item */ - //printf("FileSet query cmd : %s\n",query.toUtf8().data()); + if (mainWin->m_sqlDebug) { + Pmsg1(000, "FileSet query cmd : %s\n",query.toUtf8().data()); + } if (m_console->sql_cmd(query, results)) { int resultCount = results.count(); if (resultCount == 1){ diff --git a/bacula/src/qt-console/joblist/joblist.cpp b/bacula/src/qt-console/joblist/joblist.cpp index ec02dfdf0c..d31043709d 100644 --- a/bacula/src/qt-console/joblist/joblist.cpp +++ b/bacula/src/qt-console/joblist/joblist.cpp @@ -57,10 +57,10 @@ JobList::JobList(QString &mediaName, QString &clientname, createConnections(); /* Set Defaults for check and spin for limits */ - limitCheckBox->setCheckState(Qt::Checked); - limitSpinBox->setValue(150); - daysCheckBox->setCheckState(Qt::Unchecked); - daysSpinBox->setValue(30); + limitCheckBox->setCheckState(mainWin->m_recordLimitCheck ? Qt::Checked : Qt::Unchecked); + limitSpinBox->setValue(mainWin->m_recordLimitVal); + daysCheckBox->setCheckState(mainWin->m_daysLimitCheck ? Qt::Checked : Qt::Unchecked); + daysSpinBox->setValue(mainWin->m_daysLimitVal); } /* @@ -86,8 +86,10 @@ void JobList::populateTable() if (clientIndex != -1) clientsComboBox->setCurrentIndex(clientIndex); - /* Not m_console->volume_list will query database */ QString query("SELECT VolumeName AS Media FROM Media ORDER BY Media"); + if (mainWin->m_sqlDebug) { + Pmsg1(000, "Query cmd : %s\n",query.toUtf8().data()); + } QStringList results, volumeList; if (m_console->sql_cmd(query, results)) { QString field; @@ -114,6 +116,9 @@ void JobList::populateTable() fileSetComboBox->addItem("Any"); fileSetComboBox->addItems(m_console->fileset_list); QString statusQuery("SELECT JobStatusLong FROM Status"); + if (mainWin->m_sqlDebug) { + Pmsg1(000, "Query cmd : %s\n",query.toUtf8().data()); + } QStringList statusResults, statusLongList; if (m_console->sql_cmd(statusQuery, statusResults)) { QString field; @@ -213,8 +218,9 @@ void JobList::populateTable() mp_tableWidget->setColumnCount(headerlist.size()); mp_tableWidget->setHorizontalHeaderLabels(headerlist); - /* This could be a user preference debug message?? */ - printf("Query cmd : %s\n",query.toUtf8().data()); + if (mainWin->m_sqlDebug) { + Pmsg1(000, "Query cmd : %s\n",query.toUtf8().data()); + } if (m_console->sql_cmd(query, results)) { m_resultCount = results.count(); diff --git a/bacula/src/qt-console/joblist/joblist.ui b/bacula/src/qt-console/joblist/joblist.ui index 95abf3e00f..fd67d053e1 100644 --- a/bacula/src/qt-console/joblist/joblist.ui +++ b/bacula/src/qt-console/joblist/joblist.ui @@ -133,7 +133,7 @@ - 10 + 7 @@ -324,7 +324,7 @@ - :images/run.png + ../../../../../../../:images/run.png Refresh Job List @@ -335,7 +335,7 @@ - :images/unmark.png + ../../../../../../../:images/unmark.png ListJobid @@ -343,7 +343,7 @@ - :images/unmark.png + ../../../../../../../:images/unmark.png List Files On Job @@ -351,7 +351,7 @@ - :images/unmark.png + ../../../../../../../:images/unmark.png ListJobMedia @@ -359,7 +359,7 @@ - :images/unmark.png + ../../../../../../../:images/unmark.png ListVolumes @@ -367,7 +367,7 @@ - :images/unmark.png + ../../../../../../../:images/unmark.png LongListJob @@ -375,7 +375,7 @@ - :images/unmark.png + ../../../../../../../:images/unmark.png DeleteJob @@ -383,7 +383,7 @@ - :images/unmark.png + ../../../../../../../:images/unmark.png PurgeFiles @@ -391,7 +391,7 @@ - :images/unmark.png + ../../../../../../../:images/unmark.png Restore From Job @@ -399,7 +399,7 @@ - :images/unmark.png + ../../../../../../../:images/unmark.png Restore From Time @@ -407,7 +407,7 @@ - :images/unmark.png + ../../../../../../../:images/unmark.png Show Log for Job diff --git a/bacula/src/qt-console/label/label.cpp b/bacula/src/qt-console/label/label.cpp index 6185c5ba62..b4c0ad8365 100644 --- a/bacula/src/qt-console/label/label.cpp +++ b/bacula/src/qt-console/label/label.cpp @@ -92,8 +92,9 @@ void labelPage::okButtonPushed() .arg(poolCombo->currentText()) .arg(storageCombo->currentText()) .arg(slotSpin->value()); - /* FIXME Make this a user configurable logging action and dont use printf */ - //printf("sending command : %s\n",scmd.toUtf8().data()); + if (mainWin->m_commandDebug) { + Pmsg1(000, "sending command : %s\n",scmd.toUtf8().data()); + } m_console->write_dir(scmd.toUtf8().data()); m_console->displayToPrompt(); m_console->notify(true); diff --git a/bacula/src/qt-console/main.cpp b/bacula/src/qt-console/main.cpp index 43eeaf6a87..e5d8145726 100644 --- a/bacula/src/qt-console/main.cpp +++ b/bacula/src/qt-console/main.cpp @@ -41,14 +41,6 @@ MainWin *mainWin; QApplication *app; -/* - * ***FIXME*** move the following two into the MainWin class or - * the Console class. - */ -bool g_commDebug = false; -bool g_displayAll = false; - - /* Forward referenced functions */ void terminate_console(int sig); static void usage(); diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index 561bd75f19..0e23313aa4 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -52,6 +52,7 @@ MainWin::MainWin(QWidget *parent) : QMainWindow(parent) mainWin = this; setupUi(this); /* Setup UI defined by main.ui (designer) */ + readPreferences(); treeWidget->clear(); treeWidget->setColumnCount(1); treeWidget->setHeaderLabel("Select Page"); @@ -72,11 +73,11 @@ MainWin::MainWin(QWidget *parent) : QMainWindow(parent) } m_currentConsole = (Console*)getFromHash(m_firstItem); m_currentConsole->setCurrent(); - /* FIXME - * I'd like to turn this into a debug item - * DIRRES* dirres = m_currentConsole->getDirRes(); - * printf("Setting initial window to %s\n", dirres->name()); - */ + if (m_miscDebug) { + QString directoryResourceName; + m_currentConsole->getDirResName(directoryResourceName); + Pmsg1(000, "Setting initial window to %s\n", directoryResourceName.toUtf8().data()); + } } void MainWin::createPages() @@ -608,8 +609,15 @@ QTreeWidgetItem *MainWin::currentTopItem() void MainWin::setPreferences() { prefsDialog prefs; - prefs.commDebug->setCheckState(g_commDebug ? Qt::Checked : Qt::Unchecked); - prefs.displayAll->setCheckState(g_displayAll ? Qt::Checked : Qt::Unchecked); + prefs.commDebug->setCheckState(m_commDebug ? Qt::Checked : Qt::Unchecked); + prefs.displayAll->setCheckState(m_displayAll ? Qt::Checked : Qt::Unchecked); + prefs.sqlDebug->setCheckState(m_sqlDebug ? Qt::Checked : Qt::Unchecked); + prefs.commandDebug->setCheckState(m_commandDebug ? Qt::Checked : Qt::Unchecked); + prefs.miscDebug->setCheckState(m_miscDebug ? Qt::Checked : Qt::Unchecked); + prefs.recordLimit->setCheckState(m_recordLimitCheck ? Qt::Checked : Qt::Unchecked); + prefs.recordSpinBox->setValue(m_recordLimitVal); + prefs.daysLimit->setCheckState(m_daysLimitCheck ? Qt::Checked : Qt::Unchecked); + prefs.daysSpinBox->setValue(m_daysLimitVal); prefs.exec(); } @@ -622,8 +630,27 @@ prefsDialog::prefsDialog() void prefsDialog::accept() { this->hide(); - g_commDebug = this->commDebug->checkState() == Qt::Checked; - g_displayAll = this->displayAll->checkState() == Qt::Checked; + mainWin->m_commDebug = this->commDebug->checkState() == Qt::Checked; + mainWin->m_displayAll = this->displayAll->checkState() == Qt::Checked; + mainWin->m_sqlDebug = this->sqlDebug->checkState() == Qt::Checked; + mainWin->m_commandDebug = this->commandDebug->checkState() == Qt::Checked; + mainWin->m_miscDebug = this->miscDebug->checkState() == Qt::Checked; + mainWin->m_recordLimitCheck = this->recordLimit->checkState() == Qt::Checked; + mainWin->m_recordLimitVal = this->recordSpinBox->value(); + mainWin->m_daysLimitCheck = this->daysLimit->checkState() == Qt::Checked; + mainWin->m_daysLimitVal = this->daysSpinBox->value(); + QSettings settings("www.bacula.org", "bat"); + settings.beginGroup("Messages"); + settings.setValue("commDebug", mainWin->m_commDebug); + settings.setValue("displayAll", mainWin->m_displayAll); + settings.setValue("sqlDebug", mainWin->m_sqlDebug); + settings.setValue("commandDebug", mainWin->m_commandDebug); + settings.setValue("miscDebug", mainWin->m_miscDebug); + settings.setValue("recordLimitCheck", mainWin->m_recordLimitCheck); + settings.setValue("recordLimitVal", mainWin->m_recordLimitVal); + settings.setValue("daysLimitCheck", mainWin->m_daysLimitCheck); + settings.setValue("daysLimitVal", mainWin->m_daysLimitVal); + settings.endGroup(); } void prefsDialog::reject() @@ -631,3 +658,20 @@ void prefsDialog::reject() this->hide(); mainWin->set_status("Canceled"); } + +/* read preferences for the prefences dialog box */ +void MainWin::readPreferences() +{ + QSettings settings("www.bacula.org", "bat"); + settings.beginGroup("Messages"); + m_commDebug = settings.value("commDebug", false).toBool(); + m_displayAll = settings.value("displayAll", false).toBool(); + m_sqlDebug = settings.value("sqlDebug", false).toBool(); + m_commandDebug = settings.value("commandDebug", false).toBool(); + m_miscDebug = settings.value("miscDebug", false).toBool(); + m_recordLimitCheck = settings.value("recordLimitCheck", true).toBool(); + m_recordLimitVal = settings.value("recordLimitVal", 150).toInt(); + m_daysLimitCheck = settings.value("daysLimitCheck", false).toBool(); + m_daysLimitVal = settings.value("daysLimitVal", 28).toInt(); + settings.endGroup(); +} diff --git a/bacula/src/qt-console/mainwin.h b/bacula/src/qt-console/mainwin.h index 814b1889e8..0e965c6b8c 100644 --- a/bacula/src/qt-console/mainwin.h +++ b/bacula/src/qt-console/mainwin.h @@ -69,6 +69,16 @@ public: /* This is a list of consoles */ QHash m_consoleHash; void createPageJobList(QString &, QString &, QTreeWidgetItem *); + bool m_commDebug; + bool m_displayAll; + bool m_sqlDebug; + bool m_commandDebug; + bool m_miscDebug; + bool m_recordLimitCheck; + int m_recordLimitVal; + bool m_daysLimitCheck; + int m_daysLimitVal; + public slots: void input_line(); @@ -83,6 +93,7 @@ public slots: void toggleDockContextWindow(); void closePage(); void setPreferences(); + void readPreferences(); protected: void closeEvent(QCloseEvent *event); diff --git a/bacula/src/qt-console/mediaedit/mediaedit.cpp b/bacula/src/qt-console/mediaedit/mediaedit.cpp index ee0bdb987c..d846463f5a 100644 --- a/bacula/src/qt-console/mediaedit/mediaedit.cpp +++ b/bacula/src/qt-console/mediaedit/mediaedit.cpp @@ -78,8 +78,9 @@ MediaEdit::MediaEdit(Console *console, QString &mediaId) query += " AND Media.MediaId='" + mediaId + "'"; query += " ORDER BY Pool.Name"; - /* FIXME Make this a user configurable logging action and dont use printf */ - //printf("MediaList query cmd : %s\n",query.toUtf8().data()); + if (mainWin->m_sqlDebug) { + Pmsg1(000, "MediaList query cmd : %s\n",query.toUtf8().data()); + } QStringList results; if (m_console->sql_cmd(query, results)) { QString field; @@ -157,8 +158,9 @@ void MediaEdit::accept() docmd = true; } if (docmd) { - /* FIXME Make this a user configurable logging action and dont use printf */ - //printf("sending command : %s\n",scmd.toUtf8().data()); + if (mainWin->m_commandDebug) { + Pmsg1(000, "sending command : %s\n",scmd.toUtf8().data()); + } m_console->write_dir(scmd.toUtf8().data()); m_console->displayToPrompt(); m_console->notify(true); diff --git a/bacula/src/qt-console/medialist/medialist.cpp b/bacula/src/qt-console/medialist/medialist.cpp index 894c937dc4..544f0c91f1 100644 --- a/bacula/src/qt-console/medialist/medialist.cpp +++ b/bacula/src/qt-console/medialist/medialist.cpp @@ -106,8 +106,9 @@ void MediaList::populateTree() query += " AND Pool.Name='" + pool_listItem + "'"; query += " ORDER BY Media"; - /* FIXME Make this a user configurable loggin action and dont use printf */ - //printf("MediaList query cmd : %s\n",query.toUtf8().data()); + if (mainWin->m_sqlDebug) { + Pmsg1(000, "MediaList query cmd : %s\n",query.toUtf8().data()); + } QStringList results; if (m_console->sql_cmd(query, results)) { QString field; diff --git a/bacula/src/qt-console/mount/mount.cpp b/bacula/src/qt-console/mount/mount.cpp index 53dc9a919e..6e430ba0f6 100644 --- a/bacula/src/qt-console/mount/mount.cpp +++ b/bacula/src/qt-console/mount/mount.cpp @@ -65,8 +65,9 @@ void mountDialog::accept() scmd = QString("mount storage=\"%1\" slot=%2") .arg(m_storageName) .arg(slotSpin->value()); - /* FIXME Make this a user configurable logging action and dont use printf */ - //printf("sending command : %s\n",scmd.toUtf8().data()); + if (mainWin->m_commandDebug) { + Pmsg1(000, "sending command : %s\n",scmd.toUtf8().data()); + } m_console->display_text("Context sensitive command :\n\n"); m_console->display_text("**** "); diff --git a/bacula/src/qt-console/prefs.ui b/bacula/src/qt-console/prefs.ui index 492e8585a9..1ad81c8466 100644 --- a/bacula/src/qt-console/prefs.ui +++ b/bacula/src/qt-console/prefs.ui @@ -5,8 +5,8 @@ 0 0 - 277 - 224 + 384 + 378 @@ -23,15 +23,106 @@ images/bat.png - - - 9 + + + + 9 + 343 + 366 + 26 + - - 6 + + Qt::Horizontal - + + QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok + + + + + + 0 + 0 + 310 + 25 + + + + + 0 + + + 6 + + + + + Qt::Horizontal + + + + 81 + 20 + + + + + + + + + 5 + 0 + 0 + 0 + + + + <h2>Preferences</h2> + + + + + + + Qt::Horizontal + + + + 101 + 20 + + + + + + + + + + 9 + 40 + 366 + 297 + + + + 1 + + + + Messages + + + + 10 + 30 + 271 + 181 + + 5 @@ -43,14 +134,93 @@ Debugging Options - + + + + 10 + 21 + 241 + 131 + + + + + 0 + + + 6 + + + + + Debug comm + + + + + + + Display all messages in console + + + + + + + Debug Commands + + + + + + + Debug Sql queries + + + + + + + Debug Miscelaneous Items + + + + + + + + + + Joblist + + + + + 9 + 62 + 301 + 146 + + + + + 5 + 0 + 0 + 0 + + + + Jolist Limit Options + + 9 6 - + 0 @@ -58,17 +228,43 @@ 6 - - + + - Display all messages + Days Limit + + + + + + + 10000 + + + 1 + + + 7 + + + + + + + 10000 + + + 1 + + + 25 - + - Debug comm + Record Limit @@ -76,69 +272,8 @@ - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok - - - - - - - 0 - - - 6 - - - - - Qt::Horizontal - - - - 81 - 20 - - - - - - - - - 5 - 0 - 0 - 0 - - - - <h2>Preferences</h2> - - - - - - - Qt::Horizontal - - - - 101 - 20 - - - - - - - + + diff --git a/bacula/src/qt-console/relabel/relabel.cpp b/bacula/src/qt-console/relabel/relabel.cpp index 27d1e3b7e2..78e32c47b0 100644 --- a/bacula/src/qt-console/relabel/relabel.cpp +++ b/bacula/src/qt-console/relabel/relabel.cpp @@ -78,8 +78,9 @@ void relabelDialog::accept() .arg(volumeName->text()) .arg(poolCombo->currentText()) .arg(slotSpin->value()); - /* FIXME Make this a user configurable logging action and dont use printf */ - //printf("sending command : %s\n",scmd.toUtf8().data()); + if (mainWin->m_commandDebug) { + Pmsg1(000, "sending command : %s\n",scmd.toUtf8().data()); + } m_console->write_dir(scmd.toUtf8().data()); m_console->displayToPrompt(); m_console->notify(true); diff --git a/bacula/src/qt-console/restore/prerestore.cpp b/bacula/src/qt-console/restore/prerestore.cpp index 7a6829261f..9b065762a3 100644 --- a/bacula/src/qt-console/restore/prerestore.cpp +++ b/bacula/src/qt-console/restore/prerestore.cpp @@ -166,8 +166,9 @@ void prerestorePage::okButtonPushed() cmd += " all done"; } - /* ***FIXME*** */ - //printf("preRestore command \'%s\'\n", cmd.toUtf8().data()); + if (mainWin->m_commandDebug) { + Pmsg1(000, "preRestore command \'%s\'\n", cmd.toUtf8().data()); + } consoleCommand(cmd); /* Note, do not turn notifier back on here ... */ if (selectFilesRadio->isChecked()) { @@ -239,7 +240,7 @@ int prerestorePage::jobdefsFromJob(QStringList &fieldlist, QString &jobId) " From Job, Client, FileSet" " WHERE Job.FileSetId=FileSet.FileSetId AND Job.ClientId=Client.ClientId" " AND JobId=\'" + jobId + "\'"; - //printf("query = %s\n", query.toUtf8().data()); + if (mainWin->m_sqlDebug) { Pmsg1(000, "query = %s\n", query.toUtf8().data()); } QStringList results; if (m_console->sql_cmd(query, results)) { QString field; diff --git a/bacula/src/qt-console/restore/restore.cpp b/bacula/src/qt-console/restore/restore.cpp index 0f5e75dbe6..0b3d252661 100644 --- a/bacula/src/qt-console/restore/restore.cpp +++ b/bacula/src/qt-console/restore/restore.cpp @@ -162,22 +162,30 @@ void restorePage::addDirectory(QString &newdirr) bool ok = true; bool windrive = false; - //printf("In addDirectory cwd \"%s\" newdir \"%s\"\n", m_cwd.toUtf8().data(), - //newdir.toUtf8().data()); + if (mainWin->m_miscDebug) { + QString msg = QString("In addDirectory cwd \"%1\" newdir \"%2\"\n") + .arg(m_cwd) + .arg(newdir); + Pmsg0(000, msg.toUtf8().data()); + } /* add unix '/' directory first */ if (m_dirPaths.empty() && (regex.indexIn(fullpath,0) == -1)) { QTreeWidgetItem *item = new QTreeWidgetItem(directoryWidget); QString text("/"); item->setText(0, text.toUtf8().data()); - //printf("Pre Inserting %s\n",text.toUtf8().data()); + if (mainWin->m_miscDebug) { + Pmsg1(000, "Pre Inserting %s\n",text.toUtf8().data()); + } m_dirPaths.insert(text, item); m_dirTreeItems.insert(item, text); } if (regex.indexIn(fullpath,0) == 0) { /* this is a windows drive */ - //printf("Need to do windows \"letter\":/\n"); + if (mainWin->m_miscDebug) { + printf("Need to do windows \"letter\":/\n"); + } fullpath.replace(0,1,""); windrive = true; } @@ -198,13 +206,19 @@ void restorePage::addDirectory(QString &newdirr) directoryWidget->expandItem(parent); } else { ok = false; - //printf("In else of if parent cwd \"%s\" newdir \"%s\"\n", - //m_cwd.toUtf8().data() ,newdir.toUtf8().data()); + if (mainWin->m_miscDebug) { + QString msg = QString("In else of if parent cwd \"%1\" newdir \"%2\"\n") + .arg(m_cwd) + .arg(newdir); + Pmsg0(000, msg.toUtf8().data()); + } } } /* insert into both forward and reverse hash */ if (ok) { - //printf("Inserting %s\n",fullpath.toUtf8().data()); + if (mainWin->m_miscDebug) { + Pmsg1(000, "Inserting %s\n",fullpath.toUtf8().data()); + } m_dirPaths.insert(fullpath, item); m_dirTreeItems.insert(item, fullpath); } @@ -280,8 +294,10 @@ void restorePage::fileDoubleClicked(QTreeWidgetItem *item, int column) if (item) { directoryWidget->setCurrentItem(item); } else { - /* FIXME ***** Create an error log */ - //printf("DoubleClick else of item column %i fullpath %s\n", column, fullpath.toUtf8().data()); + QString msg = QString("DoubleClick else of item column %1 fullpath %2\n") + .arg(column,10) + .arg(fullpath); + Pmsg0(000, msg.toUtf8().data()); } } } diff --git a/bacula/src/qt-console/storage/storage.cpp b/bacula/src/qt-console/storage/storage.cpp index 4a5e32ac48..8dd41a89e6 100644 --- a/bacula/src/qt-console/storage/storage.cpp +++ b/bacula/src/qt-console/storage/storage.cpp @@ -84,8 +84,6 @@ void Storage::populateTree() mp_treeWidget->setColumnCount(headerlist.count()); mp_treeWidget->setHeaderLabels(headerlist); - /* This could be a log item */ - //printf("In Storage::populateTree()\n"); foreach(QString storageName, m_console->storage_list){ storageItem = new QTreeWidgetItem(topItem); @@ -101,7 +99,9 @@ void Storage::populateTree() QStringList results; /* This could be a log item */ - //printf("Storage query cmd : %s\n",query.toUtf8().data()); + if (mainWin->m_sqlDebug) { + Pmsg1(000, "Storage query cmd : %s\n",query.toUtf8().data()); + } if (m_console->sql_cmd(query, results)) { int resultCount = results.count(); if (resultCount == 1){ -- 2.39.5