]> git.sur5r.net Git - bacula/bacula/commitdiff
Bat now connecting to Bacula
authorKern Sibbald <kern@sibbald.com>
Sun, 28 Jan 2007 18:25:10 +0000 (18:25 +0000)
committerKern Sibbald <kern@sibbald.com>
Sun, 28 Jan 2007 18:25:10 +0000 (18:25 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4069 91ce42f0-d328-0410-95d8-f526ca767f89

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

index eeff11fc95ca6ffbe5f4084b01d1bf991f970e6b..3127c9c8d198bb73ed1feabba3aba5cd28278fcf 100644 (file)
@@ -41,6 +41,7 @@ Console::Console()
    QTreeWidgetItem *item, *topItem;
    QTreeWidget *treeWidget = mainWin->treeWidget;
 
+   m_sock = NULL;
    m_textEdit = mainWin->textEdit;   /* our console screen */
 
    /* Just take the first Director */
@@ -67,15 +68,19 @@ Console::Console()
  * Connect to Director. If there are more than one, put up
  * a modal dialog so that the user chooses one.
  */
-bool Console::connect()
+void Console::connect()
 {
    JCR jcr;
 
    m_textEdit = mainWin->textEdit;   /* our console screen */
 
-
-   if (!m_dir) {
-      return false;
+   if (!m_dir) {          
+      set_text("No Director to connect to.\n");
+      return;
+   }
+   if (m_sock) {
+      set_text("Already connected.\n");
+      return;
    }
 
    memset(&jcr, 0, sizeof(jcr));
@@ -94,14 +99,15 @@ bool Console::connect()
    m_sock = bnet_connect(NULL, 5, 15, _("Director daemon"), m_dir->address,
                           NULL, m_dir->DIRport, 0);
    if (m_sock == NULL) {
-      return false;
+      set_text("Connection failed\n");
+      return;
    }
 
    jcr.dir_bsock = m_sock;
 
    if (!authenticate_director(&jcr, m_dir, cons)) {
       set_text(m_sock->msg);
-      return false;
+      return;
    }
 
    /* Give GUI a chance */
@@ -124,7 +130,9 @@ bool Console::connect()
     */
 
    set_status(_(" Connected"));
-   return true;
+   set_text("Connected\n");
+
+   return;
 }
 
 void Console::set_textf(const char *fmt, ...)
@@ -163,6 +171,7 @@ void Console::set_status_ready()
 void Console::set_status(const char *buf)
 {
    mainWin->statusBar()->showMessage(buf);
+   set_text(buf);
 // ready = false;
 }
 
index b5b8ba79e35fa9c33ad19213d63639210241430b..138f7e55375910502535d2453a7f8af195f6ed0d 100644 (file)
@@ -14,13 +14,15 @@ class Console : public QWidget
    Q_OBJECT 
 public:
    Console();
-   bool connect();
    void set_text(const char *buf);
    void set_textf(const char *fmt, ...);
    void set_statusf(const char *fmt, ...);
    void set_status_ready();
    void set_status(const char *buf);
 
+public slots:
+   void connect();
+
 private:
    QTextEdit *m_textEdit;
    DIRRES *m_dir;
index 0c802c7378fe63c40979fb778887fe23113064c0..502d303cbff291dfed5e2d704114a0e99a9b942b 100644 (file)
@@ -53,7 +53,6 @@ static char *configfile = NULL;
 
 MainWin *mainWin;
 QApplication *app;
-BSOCK *UA_sock = NULL;
 
 
 int main(int argc, char *argv[])
index a071dfc00b0905f00c92881c57ebf72c41c83aa8..6451ea78e869798f448b0aadd527952ffd49443b 100644 (file)
    </property>
    <widget class="QMenu" name="menuHelp" >
     <property name="title" >
-     <string>Help</string>
+     <string>&amp;Help</string>
     </property>
-    <addaction name="actionAbout_qt_console" />
+    <addaction name="actionAbout_bat" />
    </widget>
    <widget class="QMenu" name="menuEdit" >
     <property name="title" >
-     <string>Edit</string>
+     <string>&amp;Edit</string>
     </property>
     <addaction name="actionCopy" />
     <addaction name="actionCut" />
    </widget>
    <widget class="QMenu" name="menuFile" >
     <property name="title" >
-     <string>File</string>
+     <string>&amp;File</string>
     </property>
     <addaction name="actionPrint" />
     <addaction name="actionSave" />
-    <addaction name="actionExit" />
+    <addaction name="actionQuit" />
    </widget>
    <addaction name="menuFile" />
    <addaction name="menuEdit" />
    <addaction name="menuHelp" />
   </widget>
-  <widget class="QStatusBar" name="statusbar" />
+  <widget class="QStatusBar" name="statusbar" >
+   <property name="toolTip" >
+    <string>Current Status</string>
+   </property>
+   <property name="statusTip" >
+    <string>Current Status</string>
+   </property>
+  </widget>
   <widget class="QToolBar" name="toolBar" >
    <property name="minimumSize" >
     <size>
      <height>39</height>
     </size>
    </property>
+   <property name="toolTip" >
+    <string>Tool Bar</string>
+   </property>
    <property name="orientation" >
     <enum>Qt::Horizontal</enum>
    </property>
    <addaction name="actionPrint" />
    <addaction name="actionLabel" />
    <addaction name="actionRestore" />
+   <addaction name="actionRun" />
   </widget>
-  <action name="actionExit" >
+  <action name="actionQuit" >
    <property name="text" >
-    <string>Quit</string>
+    <string>&amp;Quit</string>
+   </property>
+   <property name="shortcut" >
+    <string>Ctrl+Q</string>
+   </property>
+   <property name="menuRole" >
+    <enum>QAction::QuitRole</enum>
    </property>
   </action>
-  <action name="actionAbout_qt_console" >
+  <action name="actionAbout_bat" >
    <property name="text" >
-    <string>About bat</string>
+    <string>&amp;About bat</string>
    </property>
   </action>
   <action name="actionCopy" >
     <iconset>images/copy.png</iconset>
    </property>
    <property name="text" >
-    <string>Copy</string>
+    <string>&amp;Copy</string>
    </property>
   </action>
   <action name="actionCut" >
     <iconset>images/cut.png</iconset>
    </property>
    <property name="text" >
-    <string>Cut</string>
+    <string>Cu&amp;t</string>
    </property>
   </action>
   <action name="actionNew" >
     <iconset>images/paste.png</iconset>
    </property>
    <property name="text" >
-    <string>Paste</string>
+    <string>&amp;Paste</string>
    </property>
   </action>
   <action name="actionPrint" >
     <iconset>images/print.png</iconset>
    </property>
    <property name="text" >
-    <string>Print</string>
+    <string>&amp;Print</string>
    </property>
   </action>
   <action name="actionSave" >
     <iconset>images/save.png</iconset>
    </property>
    <property name="text" >
-    <string>Save</string>
+    <string>&amp;Save</string>
    </property>
   </action>
   <action name="actionConnect" >
    <property name="text" >
     <string>Label</string>
    </property>
+   <property name="toolTip" >
+    <string>Label a Volume</string>
+   </property>
+   <property name="statusTip" >
+    <string>Label a Volume</string>
+   </property>
   </action>
   <action name="actionRestore" >
    <property name="icon" >
    <property name="text" >
     <string>Restore</string>
    </property>
+   <property name="statusTip" >
+    <string>Restore Files</string>
+   </property>
+  </action>
+  <action name="actionRun" >
+   <property name="checked" >
+    <bool>false</bool>
+   </property>
+   <property name="icon" >
+    <iconset>images/run.png</iconset>
+   </property>
+   <property name="text" >
+    <string>Run Job</string>
+   </property>
+   <property name="iconText" >
+    <string>Run Job</string>
+   </property>
+   <property name="toolTip" >
+    <string>Run Job</string>
+   </property>
   </action>
  </widget>
  <resources>
index 4d50408b2fd658bf5a51e21c2d9ed54bd62efe03..b995aea71c7beb5db00e0ba6f7621777183ed736 100644 (file)
@@ -40,12 +40,17 @@ MainWin::MainWin(QWidget *parent) : QMainWindow(parent)
    mainWin = this;
    setupUi(this);                     /* Setup UI defined by main.ui (designer) */
    stackedWidget->setCurrentIndex(0);
+
+   m_console = new Console();
+
    /* Dummy message ***FIXME*** remove a bit later */
    textEdit->setPlainText("Hello Baculites\nThis is the main console window.");
    lineEdit->setFocus();
-   /* Connect command line edit to input_line */
+
+
+   /* Connect signals to slots */
    connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(input_line()));
-   connect(actionAbout_qt_console, SIGNAL(triggered()), this, SLOT(about()));
+   connect(actionAbout_bat, SIGNAL(triggered()), this, SLOT(about()));
 
    connect(treeWidget, SIGNAL(itemActivated(QTreeWidgetItem *, int)), this, 
            SLOT(treeItemClicked(QTreeWidgetItem *, int)));
@@ -53,8 +58,8 @@ MainWin::MainWin(QWidget *parent) : QMainWindow(parent)
            SLOT(treeItemClicked(QTreeWidgetItem *, int)));
    connect(treeWidget, SIGNAL(itemPressed(QTreeWidgetItem *, int)), this, 
            SLOT(treeItemClicked(QTreeWidgetItem *, int)));
-
-   m_console = new Console();
+   connect(actionQuit, SIGNAL(triggered()), app, SLOT(closeAllWindows()));
+   connect(actionConnect, SIGNAL(triggered()), m_console, SLOT(connect()));
 
 }