From 39d05c01abb8c5fb71bd903f033f579c77d1d437 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Fri, 26 Jan 2007 14:56:34 +0000 Subject: [PATCH] Add more qt-console functionality git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4047 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/qt-console/Makefile | 19 ++++++++--- bacula/src/qt-console/README | 21 ++++++++++++ bacula/src/qt-console/main.cpp | 1 + bacula/src/qt-console/main.ui | 2 +- bacula/src/qt-console/mainwindow.cpp | 51 ++++++++++++++++++++++++++-- bacula/src/qt-console/mainwindow.h | 42 +++++++++++++++++++++++ bacula/src/qt-console/qt-console.pro | 1 + 7 files changed, 130 insertions(+), 7 deletions(-) create mode 100644 bacula/src/qt-console/README diff --git a/bacula/src/qt-console/Makefile b/bacula/src/qt-console/Makefile index 5481fbd1fd..1c63a41fb7 100644 --- a/bacula/src/qt-console/Makefile +++ b/bacula/src/qt-console/Makefile @@ -1,6 +1,6 @@ ############################################################################# # Makefile for building: qt-console -# Generated by qmake (2.01a) (Qt 4.2.1) on: Fri Jan 26 14:25:07 2007 +# Generated by qmake (2.01a) (Qt 4.2.1) on: Fri Jan 26 15:30:33 2007 # Project: qt-console.pro # Template: app # Command: /usr/bin/qmake -unix -o Makefile qt-console.pro @@ -46,9 +46,11 @@ OBJECTS_DIR = ./ ####### Files SOURCES = main.cpp \ - mainwindow.cpp qrc_main.cpp + mainwindow.cpp moc_mainwindow.cpp \ + qrc_main.cpp OBJECTS = main.o \ mainwindow.o \ + moc_mainwindow.o \ qrc_main.o DIST = /usr/share/qt4/mkspecs/common/unix.conf \ /usr/share/qt4/mkspecs/common/g++.conf \ @@ -140,7 +142,7 @@ qmake: FORCE dist: @$(CHK_DIR_EXISTS) .tmp/qt-console1.0.0 || $(MKDIR) .tmp/qt-console1.0.0 - $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/qt-console1.0.0/ && $(COPY_FILE) --parents main.qrc .tmp/qt-console1.0.0/ && $(COPY_FILE) --parents main.cpp mainwindow.cpp .tmp/qt-console1.0.0/ && $(COPY_FILE) --parents main.ui .tmp/qt-console1.0.0/ && (cd `dirname .tmp/qt-console1.0.0` && $(TAR) qt-console1.0.0.tar qt-console1.0.0 && $(COMPRESS) qt-console1.0.0.tar) && $(MOVE) `dirname .tmp/qt-console1.0.0`/qt-console1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/qt-console1.0.0 + $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/qt-console1.0.0/ && $(COPY_FILE) --parents mainwindow.h .tmp/qt-console1.0.0/ && $(COPY_FILE) --parents main.qrc .tmp/qt-console1.0.0/ && $(COPY_FILE) --parents main.cpp mainwindow.cpp .tmp/qt-console1.0.0/ && $(COPY_FILE) --parents main.ui .tmp/qt-console1.0.0/ && (cd `dirname .tmp/qt-console1.0.0` && $(TAR) qt-console1.0.0.tar qt-console1.0.0 && $(COMPRESS) qt-console1.0.0.tar) && $(MOVE) `dirname .tmp/qt-console1.0.0`/qt-console1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/qt-console1.0.0 yaccclean: @@ -164,8 +166,14 @@ mocclean: compiler_moc_header_clean compiler_moc_source_clean mocables: compiler_moc_header_make_all compiler_moc_source_make_all -compiler_moc_header_make_all: +compiler_moc_header_make_all: moc_mainwindow.cpp compiler_moc_header_clean: + -$(DEL_FILE) moc_mainwindow.cpp +moc_mainwindow.cpp: ui_main.h \ + mainwindow.h \ + /usr/bin/moc + /usr/bin/moc $(DEFINES) $(INCPATH) mainwindow.h -o moc_mainwindow.cpp + compiler_rcc_make_all: qrc_main.cpp compiler_rcc_clean: -$(DEL_FILE) qrc_main.cpp @@ -202,6 +210,9 @@ mainwindow.o: mainwindow.cpp mainwindow.h \ ui_main.h $(CXX) -c $(CXXFLAGS) $(INCPATH) -o mainwindow.o mainwindow.cpp +moc_mainwindow.o: moc_mainwindow.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_mainwindow.o moc_mainwindow.cpp + qrc_main.o: qrc_main.cpp $(CXX) -c $(CXXFLAGS) $(INCPATH) -o qrc_main.o qrc_main.cpp diff --git a/bacula/src/qt-console/README b/bacula/src/qt-console/README new file mode 100644 index 0000000000..fd97dde850 --- /dev/null +++ b/bacula/src/qt-console/README @@ -0,0 +1,21 @@ + +At the current time, the contents of this directory are under +development. If you want to help, please contact Kern directly. +If you want to build it, you need Qt4 loaded and setup as your +default Qt or with the appropriate Qt Environment variables set. + +To build the qt-console, you simply enter: + + qmake + make + +then to execute it + + ./qt-console + +The qmake command needs to be entered only if you add a new file, in +which case, you should edit qt-console.pro and add the new filename +in the appropriate place. In running qmake, it will build a new +Makefile, and there after, you simply use "make". + + diff --git a/bacula/src/qt-console/main.cpp b/bacula/src/qt-console/main.cpp index f0d73b8015..93ea84ec51 100644 --- a/bacula/src/qt-console/main.cpp +++ b/bacula/src/qt-console/main.cpp @@ -28,6 +28,7 @@ #include "mainwindow.h" +#include int main(int argc, char *argv[]) { diff --git a/bacula/src/qt-console/main.ui b/bacula/src/qt-console/main.ui index b4804a62bf..e29f43f4c8 100644 --- a/bacula/src/qt-console/main.ui +++ b/bacula/src/qt-console/main.ui @@ -104,7 +104,7 @@ - 1 + 0 diff --git a/bacula/src/qt-console/mainwindow.cpp b/bacula/src/qt-console/mainwindow.cpp index 3e886018e2..6a60c52bc2 100644 --- a/bacula/src/qt-console/mainwindow.cpp +++ b/bacula/src/qt-console/mainwindow.cpp @@ -1,10 +1,57 @@ +/* + Bacula® - The Network Backup Solution -#include "mainwindow.h" + Copyright (C) 2000-2007 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. + This program is Free Software; you can redistribute it and/or + modify it under the terms of version two of the GNU General Public + License as published by the Free Software Foundation plus additions + that are listed in the file LICENSE. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula® is a registered trademark of John Walker. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ +/* + * Main Window control for qt-console + * + * Kern Sibbald, January MMVI + * + */ + +#include "mainwindow.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { - setupUi(this); + setupUi(this); /* Setup UI defined by main.ui (designer) */ stackedWidget->setCurrentIndex(0); + /* Dummy message ***FIXME*** remove a bit later */ textEdit->setPlainText("Hello Baculites\nThis is the main console window."); + /* Connect command line edit to input_line */ + connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(input_line())); + lineEdit->setFocus(); +} + +/* + * The user just finished typing a line in the command line edit box + */ +void MainWindow::input_line() +{ + QString cmdStr = lineEdit->text(); /* Get the text */ + lineEdit->clear(); /* clear the lineEdit box */ + textEdit->append(cmdStr); /* append text on screen */ } diff --git a/bacula/src/qt-console/mainwindow.h b/bacula/src/qt-console/mainwindow.h index 50522277a1..415ab8f2e4 100644 --- a/bacula/src/qt-console/mainwindow.h +++ b/bacula/src/qt-console/mainwindow.h @@ -1,9 +1,51 @@ +/* + Bacula® - The Network Backup Solution + + Copyright (C) 2000-2007 Free Software Foundation Europe e.V. + + The main author of Bacula is Kern Sibbald, with contributions from + many others, a complete list can be found in the file AUTHORS. + This program is Free Software; you can redistribute it and/or + modify it under the terms of version two of the GNU General Public + License as published by the Free Software Foundation plus additions + that are listed in the file LICENSE. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. + + Bacula® is a registered trademark of John Walker. + The licensor of Bacula is the Free Software Foundation Europe + (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich, + Switzerland, email:ftf@fsfeurope.org. +*/ + +/* + * qt-console main window class definition. + * + * Written by Kern Sibbald, January MMVI + */ + + #include #include "ui_main.h" class MainWindow : public QMainWindow, public Ui::MainForm { + Q_OBJECT public: MainWindow(QWidget *parent = 0); + +public slots: + void input_line(); + +private: + QString m_UserInput; }; diff --git a/bacula/src/qt-console/qt-console.pro b/bacula/src/qt-console/qt-console.pro index f51422bd13..5fe8daed77 100644 --- a/bacula/src/qt-console/qt-console.pro +++ b/bacula/src/qt-console/qt-console.pro @@ -10,5 +10,6 @@ RESOURCES = main.qrc # Input FORMS += main.ui +HEADERS += mainwindow.h SOURCES += main.cpp SOURCES += mainwindow.cpp -- 2.39.5