- All signal/slots are connected by explict code (most all are
done in the MainWin constructor), rather than using designer.
+Major projects:
+- Implement a restore page that does a directory tree restore selection
+ much like wx-console does.
+- Implement other restore interfaces such as brestore ...
+- Implement a database browser
+- Implement graphical commands that allow updating most aspects of
+ the database (i.e. commands for label, update Volume, ...)
+- Implement a resource (conf file) browser
+- Implement a reports page -- e.g. something similar to bweb
+- Implement Qt plugins to add new functionality to bat
+- Implement a GUI configuration file editor (something like JBacula).
+...
mainWin->set_status("Connection failed");
return;
} else {
+ /* Update page selector to green to indicate that Console is connected */
mainWin->actionConnect->setIcon(QIcon(QString::fromUtf8("images/connected.png")));
QBrush greenBrush(Qt::green);
m_consoleItem->setForeground(0, greenBrush);
}
-
jcr.dir_bsock = m_sock;
if (!authenticate_director(&jcr, m_dir, cons)) {
mainWin->set_status(_(" Connected"));
return;
}
-#ifdef xxx
- QByteArray bytes = m_Bash->readAllStandardOutput();
- QStringList lines = QString(bytes).split("\n");
- foreach (QString line, lines) {
- m_Logw->append(line);
- }
-#endif
+
+void Console::status_dir()
+{
+ write_dir("status dir\n");
+}
void Console::set_textf(const char *fmt, ...)
{
{
m_cursor->movePosition(QTextCursor::End);
m_cursor->insertText(buf);
- m_textEdit->moveCursor(QTextCursor::End);
- m_textEdit->ensureCursorVisible();
}
{
m_cursor->movePosition(QTextCursor::End);
m_cursor->insertText(buf);
+}
+
+/* Position cursor to end of screen */
+void Console::update_cursor()
+{
+ QApplication::restoreOverrideCursor();
m_textEdit->moveCursor(QTextCursor::End);
m_textEdit->ensureCursorVisible();
}
+/* Send a command to the Director */
void Console::write_dir(const char *msg)
{
if (m_sock) {
}
}
+/* Called by signal when the Director has output for us */
void Console::read_dir(int fd)
{
int stat;
if (m_sock->msglen == BNET_PROMPT) {
m_at_prompt = true;
mainWin->set_status(_(" At prompt waiting for input ..."));
- QApplication::restoreOverrideCursor();
+ update_cursor();
}
if (m_sock->msglen == BNET_EOD) {
mainWin->set_status_ready();
- QApplication::restoreOverrideCursor();
+ update_cursor();
}
return;
}
void set_text(const char *buf);
void set_text(const QString buf);
void set_textf(const char *fmt, ...);
+ void update_cursor(void);
void write_dir(const char *buf);
bool authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons);
bool is_connected() { return m_sock != NULL; };
public slots:
- void connect();
+ void connect(void);
void read_dir(int fd);
+ void status_dir(void);
private:
QTextEdit *m_textEdit;
<height>16777215</height>
</size>
</property>
+ <property name="windowTitle" >
+ <string>Page Selector</string>
+ </property>
<widget class="QWidget" name="dockWidgetContents" >
<layout class="QGridLayout" >
<property name="margin" >
<property name="whatsThis" >
<string comment="Console Window" />
</property>
+ <property name="horizontalScrollBarPolicy" >
+ <enum>Qt::ScrollBarAsNeeded</enum>
+ </property>
<property name="documentTitle" >
<string comment="Console Window" />
</property>
<addaction name="actionConnect" />
<addaction name="actionSave" />
<addaction name="actionPrint" />
+ <addaction name="actionStatusDir" />
<addaction name="actionLabel" />
<addaction name="actionRestore" />
<addaction name="actionRun" />
<string>Run a Job</string>
</property>
</action>
+ <action name="actionStatusDir" >
+ <property name="icon" >
+ <iconset>images/status.png</iconset>
+ </property>
+ <property name="text" >
+ <string>StatusDir</string>
+ </property>
+ <property name="toolTip" >
+ <string>status dir</string>
+ </property>
+ <property name="statusTip" >
+ <string>Status of Director</string>
+ </property>
+ </action>
</widget>
<resources>
<include location="main.qrc" />
SLOT(treeItemClicked(QTreeWidgetItem *, int)));
connect(treeWidget, SIGNAL(itemPressed(QTreeWidgetItem *, int)), this,
SLOT(treeItemClicked(QTreeWidgetItem *, int)));
+ connect(treeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this,
+ SLOT(treeItemDoubleClicked(QTreeWidgetItem *, int)));
+
connect(actionQuit, SIGNAL(triggered()), app, SLOT(closeAllWindows()));
connect(actionConnect, SIGNAL(triggered()), m_console, SLOT(connect()));
-
+ connect(actionStatusDir, SIGNAL(triggered()), m_console, SLOT(status_dir()));
}
void MainWin::treeItemClicked(QTreeWidgetItem *item, int column)
}
}
+/*
+ * ***FIXME***
+ * If item is a Console, then connect it
+ */
+void MainWin::treeItemDoubleClicked(QTreeWidgetItem *item, int column)
+{
+ (void)column;
+ int index = item->text(1).toInt();
+ /* ***FIXME**** make this automatic */
+ if (index >= 0 && index < 2) {
+ stackedWidget->setCurrentIndex(index);
+ }
+}
+
+
/*
* The user just finished typing a line in the command line edit box
void input_line();
void about();
void treeItemClicked(QTreeWidgetItem *item, int column);
+ void treeItemDoubleClicked(QTreeWidgetItem *item, int column);
private:
QString m_UserInput;