MainWin::MainWin(QWidget *parent) : QMainWindow(parent)
{
+ app->setOverrideCursor(QCursor(Qt::WaitCursor));
m_isClosing = false;
+ m_waitState = false;
+ m_doConnect = 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(750, this, SLOT(popLists()));
if (m_miscDebug) {
QString directoryResourceName;
m_currentConsole->getDirResName(directoryResourceName);
}
}
+void MainWin::popLists()
+{
+ foreach(Console *console, m_consoleHash)
+ console->populateLists(true);
+ app->restoreOverrideCursor();
+ m_doConnect = true;
+ connectConsoleSignals();
+ connectSignals();
+ m_currentConsole->setCurrent();
+}
+
void MainWin::createPages()
{
DIRRES *dir;
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()
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()));
}
/*
*/
void MainWin::waitEnter()
{
+ if (m_waitState){
+ if (mainWin->m_connDebug)
+ Pmsg0(000, "Should Never Get Here DANGER DANGER, for now I'll return\n");
+ return;
+ }
+ 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);
- connectSignals();
- connectConsoleSignals();
+ if (m_doConnect) {
+ connectSignals();
+ connectConsoleSignals();
+ }
}
void MainWin::connectConsoleSignals()
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
{
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) {
settings.setValue("winPos", pos());
settings.setValue("state", saveState());
settings.endGroup();
+
}
void MainWin::readSettings()
QString cmdStr = lineEdit->text(); /* Get the text */
lineEdit->clear(); /* clear the lineEdit box */
if (m_currentConsole->is_connected()) {
- /* Use consoleInput to allow typing anything */
- m_currentConsole->consoleInput(cmdStr);
+ /* Use consoleCommand to allow typing anything */
+ m_currentConsole->consoleCommand(cmdStr);
} else {
set_status(tr("Director not connected. Click on connect button."));
}
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);
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;
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);
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();