delete m_notifier;
m_notifier = NULL;
}
+ if (mainWin->m_connDebug)
+ Pmsg2(000, "DirComm %i terminating connections %s\n", m_conn, m_console->m_dir->name());
m_sock->close();
m_sock = NULL;
}
m_console->display_textf(_("Already connected\"%s\".\n"),
m_console->m_dir->name());
if (mainWin->m_connDebug)
- Pmsg1(000, "DirComm %i BAILING already connected\n", m_conn);
+ Pmsg2(000, "DirComm %i BAILING already connected %s\n", m_conn, m_console->m_dir->name());
goto bail_out;
}
m_console->display_textf(_("Failed to initialize TLS context for Console \"%s\".\n"),
m_console->m_dir->name());
if (mainWin->m_connDebug)
- Pmsg1(000, "DirComm %i BAILING Failed to initialize TLS context for Console \n", m_conn);
+ Pmsg2(000, "DirComm %i BAILING Failed to initialize TLS context for Console %s\n", m_conn, m_console->m_dir->name());
goto bail_out;
}
}
m_console->m_dir->name());
mainWin->set_status("Connection failed");
if (mainWin->m_connDebug)
- Pmsg1(000, "DirComm %i BAILING Failed to initialize TLS context for Director \n", m_conn);
+ Pmsg2(000, "DirComm %i BAILING Failed to initialize TLS context for Director %s\n", m_conn, m_console->m_dir->name());
goto bail_out;
}
}
if (m_sock == NULL) {
mainWin->set_status("Connection failed");
if (mainWin->m_connDebug)
- Pmsg1(000, "DirComm %i BAILING Connection failed\n", m_conn);
+ Pmsg2(000, "DirComm %i BAILING Connection failed %s\n", m_conn, m_console->m_dir->name());
goto bail_out;
} else {
/* Update page selector to green to indicate that Console is connected */
if (!authenticate_director(jcr, m_console->m_dir, cons, buf, sizeof(buf))) {
m_console->display_text(buf);
if (mainWin->m_connDebug)
- Pmsg1(000, "DirComm %i BAILING Connection failed\n", m_conn);
+ Pmsg2(000, "DirComm %i BAILING Connection failed %s\n", m_conn, m_console->m_dir->name());
goto bail_out;
}
mainWin->set_status(_("Connected"));
if (mainWin->m_connDebug)
- Pmsg1(000, "Returning TRUE from DirComm->connect_dir : %i\n", m_conn);
+ Pmsg2(000, "Returning TRUE from DirComm->connect_dir : %i %s\n", m_conn, m_console->m_dir->name());
return true;
bail_out:
if (mainWin->m_connDebug)
- Pmsg1(000, "Returning FALSE from DirComm->connect_dir : %i\n", m_conn);
+ Pmsg2(000, "Returning FALSE from DirComm->connect_dir : %i %s\n", m_conn, m_console->m_dir->name());
delete jcr;
return false;
}
m_at_prompt = true;
m_at_main_prompt = true;
mainWin->set_status(_("At main prompt waiting for input ..."));
- QApplication::restoreOverrideCursor();
break;
case BNET_PROMPT:
if (mainWin->m_commDebug) Pmsg1(000, "conn %i PROMPT\n", m_conn);
m_at_prompt = true;
m_at_main_prompt = false;
mainWin->set_status(_("At prompt waiting for input ..."));
- QApplication::restoreOverrideCursor();
break;
case BNET_CMD_FAILED:
if (mainWin->m_commDebug) Pmsg1(000, "CMD FAILED\n", m_conn);
if (--m_in_command < 0) {
-// Pmsg0(000, "m_in_command < 0\n");
m_in_command = 0;
}
mainWin->set_status(_("Command failed."));
- QApplication::restoreOverrideCursor();
break;
/* We should not get this one */
case BNET_EOD:
if (mainWin->m_commDebug) Pmsg1(000, "conn %i EOD\n", m_conn);
mainWin->set_status_ready();
- QApplication::restoreOverrideCursor();
if (!m_api_set) {
break;
}
m_notifier = NULL;
}
mainWin->set_status(_("Director disconnected."));
- QApplication::restoreOverrideCursor();
+// QApplication::restoreOverrideCursor();
stat = BNET_HARDEOF;
}
break;
if (m_notifier) {
prev_enabled = m_notifier->isEnabled();
m_notifier->setEnabled(enable);
- if (mainWin->m_connDebug)
+ if (mainWin->m_connDebug) {
if (prev_enabled && !enable)
- Pmsg1(000, "m_notifier Disabling notifier: %i\n", m_conn);
+ Pmsg2(000, "m_notifier Disabling notifier: %i %s\n", m_conn, m_console->m_dir->name());
else if (!prev_enabled && enable)
- Pmsg1(000, "m_notifier Enabling notifier: %i\n", m_conn);
- } else if (mainWin->m_connDebug)
- Pmsg1(000, "m_notifier does not exist: %i\n", m_conn);
+ Pmsg2(000, "m_notifier Enabling notifier: %i %s\n", m_conn, m_console->m_dir->name());
+ }
+ } else if (mainWin->m_connDebug)
+ Pmsg2(000, "m_notifier does not exist: %i %s\n", m_conn, m_console->m_dir->name());
return prev_enabled;
}
if (dircomm->connect_dir()) {
if (mainWin->m_connDebug)
- Pmsg0(000, "DirComm 0 Seems to have Connected\n");
+ Pmsg1(000, "DirComm 0 Seems to have Connected %s\n", m_dir->name());
beginNewCommand(0);
}
- populateLists(true);
mainWin->set_status(_("Connected"));
startTimer(); /* start message timer */
int conn;
if (forcenew) {
if (!newDirComm(conn)) {
- Pmsg0(000, "newDirComm Seems to Failed to create a connection for populateLists\n");
+ Pmsg1(000, "newDirComm Seems to Failed to create a connection for populateLists %s\n", m_dir->name());
return;
}
} else {
if(!availableDirComm(conn)) {
- Pmsg0(000, "availableDirComm Seems to Failed to find a connection for populateLists\n");
+ Pmsg1(000, "availableDirComm Seems to Failed to find a connection for populateListsi %s\n", m_dir->name());
return;
}
}
dir_cmd(conn, ".levels", level_list);
if (mainWin->m_connDebug) {
- QString dbgmsg = QString("jobs=%1 clients=%2 filesets=%3 msgs=%4 pools=%5 storage=%6 types=%7 levels=%8 conn=%9\n")
+ QString dbgmsg = QString("jobs=%1 clients=%2 filesets=%3 msgs=%4 pools=%5 storage=%6 types=%7 levels=%8 conn=%9 %10\n")
.arg(job_list.count()).arg(client_list.count()).arg(fileset_list.count()).arg(messages_list.count())
.arg(pool_list.count()).arg(storage_list.count()).arg(type_list.count()).arg(level_list.count())
- .arg(conn);
- Pmsg1(000, "%s\n", dbgmsg.toUtf8().data());
+ .arg(conn).arg(m_dir->name());
+ Pmsg1(000, "%s", dbgmsg.toUtf8().data());
}
}
dir_cmd(conn, cmd, results);
return true;
} else {
- Pmsg0(000, "dir_cmd Seems to Failed to find a connection\n");
+ Pmsg1(000, "dir_cmd Seems to Failed to find a connection %s\n", m_dir->name());
return false;
}
}
DirComm *dircomm = m_dircommHash.value(conn);
int stat;
- if (mainWin->m_connDebug)
- Pmsg2(000, "dir_cmd conn %i %s\n", conn, cmd);
+ if (mainWin->m_connDebug) {
+ QString dbgmsg = QString("dir_cmd conn %1 %2 %3\n").arg(conn).arg(m_dir->name()).arg(cmd);
+ Pmsg1(000, "%s", dbgmsg.toUtf8().data());
+ }
notify(conn, false);
dircomm->write(cmd);
while ((stat = dircomm->read()) > 0 && dircomm->is_in_command()) {
conn = notifyOff();
beginNewCommand(conn);
DirComm *dircomm = m_dircommHash.value(conn);
+ bool prevWaitState = mainWin->getWaitState();
+ if (!prevWaitState)
+ mainWin->waitEnter();
if (mainWin->m_connDebug)
- Pmsg1(000, "job_defaults conn %i\n", conn);
+ Pmsg2(000, "job_defaults conn %i %s\n", conn, m_dir->name());
scmd = QString(".defaults job=\"%1\"").arg(job_defs.job_name);
dircomm->write(scmd);
while ((stat = dircomm->read()) > 0) {
if (donotify)
notify(conn, true);
+ if (!prevWaitState)
+ mainWin->waitExit();
return true;
bail_out:
if (donotify)
notify(conn, true);
+ if (!prevWaitState)
+ mainWin->waitExit();
return false;
}
/* Position cursor to end of screen */
void Console::update_cursor()
{
- QApplication::restoreOverrideCursor();
+// QApplication::restoreOverrideCursor();
m_textEdit->moveCursor(QTextCursor::End);
m_textEdit->ensureCursorVisible();
}
for (int i=0; i < 3; i++) {
dircomm->write(".");
while (dircomm->read() > 0) {
+ Pmsg2(000, "begin new command loop %i %s\n", i, m_dir->name());
if (mainWin->m_displayAll) display_text(dircomm->msg());
}
if (dircomm->m_at_main_prompt) {
int stat = 0;
QString buf;
- if (mainWin->m_commDebug) Pmsg0(000, "DisplaytoPrompt\n");
+ if (mainWin->m_commDebug) Pmsg1(000, "DisplaytoPrompt %s\n", m_dir->name());
while (!dircomm->m_at_prompt) {
if ((stat=dircomm->read()) > 0) {
buf += dircomm->msg();
}
}
display_text(buf);
- if (mainWin->m_commDebug) Pmsg1(000, "endDisplaytoPrompt=%d\n", stat);
+ if (mainWin->m_commDebug) Pmsg2(000, "endDisplaytoPrompt=%d %s\n", stat, m_dir->name());
}
void Console::discardToPrompt(int conn)
DirComm *dircomm = m_dircommHash.value(conn);
int stat = 0;
- if (mainWin->m_commDebug) Pmsg0(000, "discardToPrompt\n");
+ if (mainWin->m_commDebug) Pmsg1(000, "discardToPrompt %s\n", m_dir->name());
if (mainWin->m_displayAll) {
displayToPrompt(conn);
} else {
stat=dircomm->read();
}
}
- if (mainWin->m_commDebug) Pmsg1(000, "endDiscardToPrompt=%d\n", stat);
+ if (mainWin->m_commDebug) Pmsg2(000, "endDiscardToPrompt=%d %s\n", stat, m_dir->name());
}
/*
m_dircommCounter += 1;
conn = m_dircommCounter;
if (mainWin->m_connDebug)
- Pmsg1(000, "DirComm %i About to Create and Connect\n", m_dircommCounter);
+ Pmsg2(000, "DirComm %i About to Create and Connect %s\n", m_dircommCounter, m_dir->name());
DirComm *dircomm = new DirComm(this, m_dircommCounter);
m_dircommHash.insert(m_dircommCounter, dircomm);
bool success = dircomm->connect_dir();
- if (mainWin->m_connDebug)
+ if (mainWin->m_connDebug) {
if (success)
- Pmsg1(000, "DirComm %i Connected\n", conn);
+ Pmsg2(000, "DirComm %i Connected %s\n", conn, m_dir->name());
else
- Pmsg1(000, "DirComm %i NOT Connected\n", conn);
+ Pmsg2(000, "DirComm %i NOT Connected %s\n", conn, m_dir->name());
+ }
return success;
}
void Jobs::populateTable()
{
m_populated = true;
+ mainWin->waitEnter();
Freeze frz(*tableWidget); /* disable updating*/
item->setFlags(Qt::ItemFlags(item->flags() & (~Qt::ItemIsEditable)));
}
}
+ mainWin->waitExit();
}
/*
MainWin::MainWin(QWidget *parent) : QMainWindow(parent)
{
+ app->setOverrideCursor(QCursor(Qt::WaitCursor));
m_isClosing = false;
+ m_waitState = false;
m_dtformat = "yyyy-MM-dd HH:mm:ss";
mainWin = this;
setupUi(this); /* Setup UI defined by main.ui (designer) */
createPages();
- resetFocus();
-
- connectSignals();
+ resetFocus(); /* lineEdit->setFocus() */
#ifndef HAVE_QWT
actionJobPlot->setEnabled(false);
readSettings();
- foreach(Console *console, m_consoleHash) {
+ foreach(Console *console, m_consoleHash)
console->connect_dir();
- }
m_currentConsole = (Console*)getFromHash(m_firstItem);
m_currentConsole->setCurrent();
- connectConsoleSignals();
+ QTimer::singleShot(2000, this, SLOT(popLists()));
if (m_miscDebug) {
QString directoryResourceName;
m_currentConsole->getDirResName(directoryResourceName);
}
}
+void MainWin::popLists()
+{
+ foreach(Console *console, m_consoleHash)
+ console->populateLists(true);
+ connectConsoleSignals();
+ connectSignals();
+ app->restoreOverrideCursor();
+}
+
void MainWin::createPages()
{
DIRRES *dir;
*/
void MainWin::waitEnter()
{
+ m_waitState = true;
+ if (mainWin->m_connDebug)
+ Pmsg0(000, "Entering Wait State\n");
app->setOverrideCursor(QCursor(Qt::WaitCursor));
disconnectSignals();
disconnectConsoleSignals(m_currentConsole);
*/
void MainWin::waitExit()
{
+ m_waitState = false;
+ if (mainWin->m_connDebug)
+ Pmsg0(000, "Exiting Wait State\n");
app->restoreOverrideCursor();
if (m_waitTreeItem != treeWidget->currentItem())
treeWidget->setCurrentItem(m_waitTreeItem);
void hashRemove(Pages *);
void hashRemove(QTreeWidgetItem *, Pages *);
void setMessageIcon();
+ bool getWaitState() {return m_waitState; };
Console *currentConsole();
QTreeWidgetItem *currentTopItem();
Pages* getFromHash(QTreeWidgetItem *);
void waitEnter();
void waitExit();
void repopLists();
+ void popLists();
protected:
void closeEvent(QCloseEvent *event);
QTreeWidgetItem *m_firstItem;
QTreeWidgetItem *m_waitTreeItem;
bool m_isClosing;
+ bool m_waitState;
};
#include "ui_prefs.h"
Freeze::Freeze(QWidget &q):
qw(&q)
{
- QApplication::setOverrideCursor(Qt::WaitCursor);
qw->setUpdatesEnabled(false);
}
{
if (qw) {
qw->setUpdatesEnabled(true);
- QApplication::restoreOverrideCursor();
qw->update();
}
}