]> git.sur5r.net Git - bacula/bacula/commitdiff
Changes to put the mouse and the application into a wait state.
authorDirk H Bartley <dbartley@schupan.com>
Fri, 27 Mar 2009 01:42:11 +0000 (01:42 +0000)
committerDirk H Bartley <dbartley@schupan.com>
Fri, 27 Mar 2009 01:42:11 +0000 (01:42 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@8605 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/qt-console/console/console.cpp
bacula/src/qt-console/mainwin.cpp
bacula/src/qt-console/mainwin.h

index f1291ca4fd67460df9094e1013734c2360fe26f3..2d2bab9db2406f8fc64104a9319f97cbc8d0735f 100644 (file)
@@ -191,6 +191,7 @@ bool Console::dir_cmd(const char *cmd, QStringList &results)
  */
 bool Console::dir_cmd(int conn, const char *cmd, QStringList &results)
 {
+   mainWin->waitEnter();
    DirComm *dircomm = m_dircommHash.value(conn);
    int stat;
 
@@ -206,6 +207,7 @@ bool Console::dir_cmd(int conn, const char *cmd, QStringList &results)
    if (stat > 0 && mainWin->m_displayAll) display_text(dircomm->msg());
    notify(conn, true);
    discardToPrompt(conn);
+   mainWin->waitExit();
    return true;              /* ***FIXME*** return any command error */
 }
 
@@ -251,6 +253,7 @@ bool Console::sql_cmd(int &conn, const char *query, QStringList &results, bool d
       Pmsg2(000, "sql_cmd conn %i %s\n", conn, query);
    if (donotify)
       dircomm->notify(false);
+   mainWin->waitEnter();
    
    pm_strcpy(cmd, ".sql query=\"");
    pm_strcat(cmd, query);
@@ -275,6 +278,7 @@ bool Console::sql_cmd(int &conn, const char *query, QStringList &results, bool d
    if (donotify)
       dircomm->notify(true);
    discardToPrompt(conn);
+   mainWin->waitExit();
    return true;              /* ***FIXME*** return any command error */
 }
 
@@ -294,8 +298,9 @@ void Console::write_dir(int conn, const char *msg)
 
    if (dircomm->m_sock) {
       mainWin->set_status(_("Processing command ..."));
-      QApplication::setOverrideCursor(Qt::WaitCursor);
+      mainWin->waitEnter();
       dircomm->write(msg);
+      mainWin->waitExit();
    } else {
       mainWin->set_status( tr(" Director not connected. Click on connect button."));
       mainWin->actionConnect->setIcon(QIcon(":images/disconnected.png"));
@@ -733,13 +738,19 @@ char *Console::msg(int conn)
 int Console::write(int conn, const QString msg)
 {
    DirComm *dircomm = m_dircommHash.value(conn);
-   return dircomm->write(msg);
+   mainWin->waitEnter();
+   int ret = dircomm->write(msg);
+   mainWin->waitExit();
+   return ret;
 }
 
 int Console::write(int conn, const char *msg)
 {
    DirComm *dircomm = m_dircommHash.value(conn);
-   return dircomm->write(msg);
+   mainWin->waitEnter();
+   int ret = dircomm->write(msg);
+   mainWin->waitExit();
+   return ret;
 }
 
 /* This checks to see if any is connected */
index 96af3bb2bbbae8c108a7d1fe7a1b177c939ecc39..e41793171aef6472b454f587125fe826463fb9c2 100644 (file)
@@ -236,13 +236,9 @@ void MainWin::createConnections()
    connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(input_line()));
    connect(actionAbout_bat, SIGNAL(triggered()), this, SLOT(about()));
    connect(actionBat_Help, SIGNAL(triggered()), this, SLOT(help()));
-   connect(treeWidget, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, 
-           SLOT(treeItemClicked(QTreeWidgetItem *, int)));
-   connect(treeWidget, SIGNAL(
-           currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),
-           this, SLOT(treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
-   connect(stackedWidget, SIGNAL(currentChanged(int)),
-           this, SLOT(stackItemChanged(int)));
+   connect(treeWidget, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, SLOT(treeItemClicked(QTreeWidgetItem *, int)));
+   connect(treeWidget, SIGNAL( currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
+   connect(stackedWidget, SIGNAL(currentChanged(int)), this, SLOT(stackItemChanged(int)));
    connect(actionQuit, SIGNAL(triggered()), app, SLOT(closeAllWindows()));
    connect(actionLabel, SIGNAL(triggered()), this,  SLOT(labelButtonClicked()));
    connect(actionRun, SIGNAL(triggered()), this,  SLOT(runButtonClicked()));
@@ -259,6 +255,49 @@ void MainWin::createConnections()
    connect(actionPreferences, SIGNAL(triggered()), this,  SLOT(setPreferences()));
 }
 
+void MainWin::disconnectConnections()
+{
+   /* Connect signals to slots */
+   disconnect(lineEdit, SIGNAL(returnPressed()), this, SLOT(input_line()));
+   disconnect(actionAbout_bat, SIGNAL(triggered()), this, SLOT(about()));
+   disconnect(actionBat_Help, SIGNAL(triggered()), this, SLOT(help()));
+   disconnect(treeWidget, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this, SLOT(treeItemClicked(QTreeWidgetItem *, int)));
+   disconnect(treeWidget, SIGNAL( currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(treeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)));
+   disconnect(stackedWidget, SIGNAL(currentChanged(int)), this, SLOT(stackItemChanged(int)));
+   disconnect(actionQuit, SIGNAL(triggered()), app, SLOT(closeAllWindows()));
+   disconnect(actionLabel, SIGNAL(triggered()), this,  SLOT(labelButtonClicked()));
+   disconnect(actionRun, SIGNAL(triggered()), this,  SLOT(runButtonClicked()));
+   disconnect(actionEstimate, SIGNAL(triggered()), this,  SLOT(estimateButtonClicked()));
+   disconnect(actionBrowse, SIGNAL(triggered()), this,  SLOT(browseButtonClicked()));
+   disconnect(actionStatusDirPage, SIGNAL(triggered()), this,  SLOT(statusPageButtonClicked()));
+#ifdef HAVE_QWT
+   disconnect(actionJobPlot, SIGNAL(triggered()), this,  SLOT(jobPlotButtonClicked()));
+#endif
+   disconnect(actionRestore, SIGNAL(triggered()), this,  SLOT(restoreButtonClicked()));
+   disconnect(actionUndock, SIGNAL(triggered()), this,  SLOT(undockWindowButton()));
+   disconnect(actionToggleDock, SIGNAL(triggered()), this,  SLOT(toggleDockContextWindow()));
+   disconnect(actionClosePage, SIGNAL(triggered()), this,  SLOT(closePage()));
+   disconnect(actionPreferences, SIGNAL(triggered()), this,  SLOT(setPreferences()));
+}
+
+/*
+ *  Enter wait state
+ */
+void MainWin::waitEnter()
+{
+   app->setOverrideCursor(QCursor(Qt::WaitCursor));
+   disconnectConnections();
+}
+
+/*
+ *  Leave wait state
+ */
+void MainWin::waitExit()
+{
+   app->restoreOverrideCursor();
+   createConnections();
+}
+
 /* 
  * Reimplementation of QWidget closeEvent virtual function   
  */
index 87b49c4cba6364d94b53288bfe020c9a20257bc6..393079283bf5ecf186977ea1c56979fd890ed067 100644 (file)
@@ -124,15 +124,18 @@ public slots:
    void closePage();
    void setPreferences();
    void readPreferences();
+   void waitEnter();
+   void waitExit();
 
 protected:
    void closeEvent(QCloseEvent *event);
    void keyPressEvent(QKeyEvent *event);
 
 private:
-   void createConnections(); 
    void connectConsole();
    void createPages();
+   void createConnections(); 
+   void disconnectConnections(); 
 
 private:
    Console *m_currentConsole;