2 Bacula® - The Network Backup Solution
4 Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
6 The main author of Bacula is Kern Sibbald, with contributions from
7 many others, a complete list can be found in the file AUTHORS.
8 This program is Free Software; you can redistribute it and/or
9 modify it under the terms of version two of the GNU General Public
10 License as published by the Free Software Foundation plus additions
11 that are listed in the file LICENSE.
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 Bacula® is a registered trademark of John Walker.
24 The licensor of Bacula is the Free Software Foundation Europe
25 (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
26 Switzerland, email:ftf@fsfeurope.org.
30 * Main Window control for bat (qt-console)
32 * Kern Sibbald, January MMVI
38 MainWin::MainWin(QWidget *parent) : QMainWindow(parent)
41 setupUi(this); /* Setup UI defined by main.ui (designer) */
42 stackedWidget->setCurrentIndex(0);
43 /* Dummy message ***FIXME*** remove a bit later */
44 textEdit->setPlainText("Hello Baculites\nThis is the main console window.");
46 /* Connect command line edit to input_line */
47 connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(input_line()));
48 connect(actionAbout_qt_console, SIGNAL(triggered()), this, SLOT(about()));
50 connect(treeWidget, SIGNAL(itemActivated(QTreeWidgetItem *, int)), this,
51 SLOT(treeItemClicked(QTreeWidgetItem *, int)));
52 connect(treeWidget, SIGNAL(itemClicked(QTreeWidgetItem *, int)), this,
53 SLOT(treeItemClicked(QTreeWidgetItem *, int)));
54 connect(treeWidget, SIGNAL(itemPressed(QTreeWidgetItem *, int)), this,
55 SLOT(treeItemClicked(QTreeWidgetItem *, int)));
57 m_console = new Console();
61 void MainWin::treeItemClicked(QTreeWidgetItem *item, int column)
64 int index = item->text(1).toInt();
65 if (index >= 0 && index < 2) {
66 stackedWidget->setCurrentIndex(index);
72 * The user just finished typing a line in the command line edit box
74 void MainWin::input_line()
76 QString cmdStr = lineEdit->text(); /* Get the text */
77 lineEdit->clear(); /* clear the lineEdit box */
78 textEdit->append(cmdStr); /* append text on screen */
82 QMessageBox::about(this, tr("About bat"),
84 "<p>Copyright © " BYEAR " Free Software Foundation Europe e.V."
85 "<p>The <b>bat</b> is an administrative console"
86 " interface to the Director."));
89 void set_textf(const char *fmt, ...)
94 va_start(arg_ptr, fmt);
95 len = bvsnprintf(buf, sizeof(buf), fmt, arg_ptr);
97 mainWin->textEdit->append(buf);
100 void set_text(const char *buf)
102 mainWin->textEdit->append(buf);
105 void set_statusf(const char *fmt, ...)
110 va_start(arg_ptr, fmt);
111 len = bvsnprintf(buf, sizeof(buf), fmt, arg_ptr);
113 // gtk_label_set_text(GTK_LABEL(status1), buf);
114 // set_scroll_bar_to_end();
118 void set_status_ready()
120 mainWin->statusBar()->showMessage("Ready");
122 // set_scroll_bar_to_end();
125 void set_status(const char *buf)
127 mainWin->statusBar()->showMessage(buf);