QTreeWidgetItem *item, *topItem;
QTreeWidget *treeWidget = mainWin->treeWidget;
+ m_sock = NULL;
m_textEdit = mainWin->textEdit; /* our console screen */
/* Just take the first Director */
* 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));
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 */
*/
set_status(_(" Connected"));
- return true;
+ set_text("Connected\n");
+
+ return;
}
void Console::set_textf(const char *fmt, ...)
void Console::set_status(const char *buf)
{
mainWin->statusBar()->showMessage(buf);
+ set_text(buf);
// ready = false;
}
</property>
<widget class="QMenu" name="menuHelp" >
<property name="title" >
- <string>Help</string>
+ <string>&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>&Edit</string>
</property>
<addaction name="actionCopy" />
<addaction name="actionCut" />
</widget>
<widget class="QMenu" name="menuFile" >
<property name="title" >
- <string>File</string>
+ <string>&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>&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>&About bat</string>
</property>
</action>
<action name="actionCopy" >
<iconset>images/copy.png</iconset>
</property>
<property name="text" >
- <string>Copy</string>
+ <string>&Copy</string>
</property>
</action>
<action name="actionCut" >
<iconset>images/cut.png</iconset>
</property>
<property name="text" >
- <string>Cut</string>
+ <string>Cu&t</string>
</property>
</action>
<action name="actionNew" >
<iconset>images/paste.png</iconset>
</property>
<property name="text" >
- <string>Paste</string>
+ <string>&Paste</string>
</property>
</action>
<action name="actionPrint" >
<iconset>images/print.png</iconset>
</property>
<property name="text" >
- <string>Print</string>
+ <string>&Print</string>
</property>
</action>
<action name="actionSave" >
<iconset>images/save.png</iconset>
</property>
<property name="text" >
- <string>Save</string>
+ <string>&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>
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)));
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()));
}