From 24a5e9412a19397de1e8906afe9e5238b36490f0 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 3 Feb 2007 11:33:09 +0000 Subject: [PATCH] Separate console ui from main.ui git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4091 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/qt-console/Makefile | 13 ++-- bacula/src/qt-console/bat.pro | 1 + bacula/src/qt-console/console/console.cpp | 8 +- bacula/src/qt-console/console/console.h | 5 +- bacula/src/qt-console/console/console.ui | 91 ++++++++++++++++++++++ bacula/src/qt-console/main.ui | 92 +---------------------- bacula/src/qt-console/mainwin.cpp | 4 +- 7 files changed, 111 insertions(+), 103 deletions(-) create mode 100644 bacula/src/qt-console/console/console.ui diff --git a/bacula/src/qt-console/Makefile b/bacula/src/qt-console/Makefile index f3ed7a0990..a15efb5ef1 100644 --- a/bacula/src/qt-console/Makefile +++ b/bacula/src/qt-console/Makefile @@ -1,6 +1,6 @@ ############################################################################# # Makefile for building: bat -# Generated by qmake (2.01a) (Qt 4.2.1) on: Thu Feb 1 11:50:08 2007 +# Generated by qmake (2.01a) (Qt 4.2.1) on: Sat Feb 3 11:19:57 2007 # Project: bat.pro # Template: app # Command: /usr/bin/qmake -unix -o Makefile bat.pro @@ -105,7 +105,7 @@ first: all all: Makefile $(TARGET) -$(TARGET): ui_main.h ui_label.h $(OBJECTS) +$(TARGET): ui_main.h ui_label.h ui_console.h $(OBJECTS) $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) Makefile: bat.pro /usr/share/qt4/mkspecs/default/qmake.conf /usr/share/qt4/mkspecs/common/unix.conf \ @@ -150,7 +150,7 @@ qmake: FORCE dist: @$(CHK_DIR_EXISTS) .tmp/bat1.0.0 || $(MKDIR) .tmp/bat1.0.0 - $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/bat1.0.0/ && $(COPY_FILE) --parents mainwin.h bat.h bat_conf.h console/console.h .tmp/bat1.0.0/ && $(COPY_FILE) --parents main.qrc .tmp/bat1.0.0/ && $(COPY_FILE) --parents main.cpp bat_conf.cpp mainwin.cpp console/authenticate.cpp console/console.cpp .tmp/bat1.0.0/ && $(COPY_FILE) --parents main.ui label.ui .tmp/bat1.0.0/ && (cd `dirname .tmp/bat1.0.0` && $(TAR) bat1.0.0.tar bat1.0.0 && $(COMPRESS) bat1.0.0.tar) && $(MOVE) `dirname .tmp/bat1.0.0`/bat1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/bat1.0.0 + $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/bat1.0.0/ && $(COPY_FILE) --parents mainwin.h bat.h bat_conf.h console/console.h .tmp/bat1.0.0/ && $(COPY_FILE) --parents main.qrc .tmp/bat1.0.0/ && $(COPY_FILE) --parents main.cpp bat_conf.cpp mainwin.cpp console/authenticate.cpp console/console.cpp .tmp/bat1.0.0/ && $(COPY_FILE) --parents main.ui label.ui console/console.ui .tmp/bat1.0.0/ && (cd `dirname .tmp/bat1.0.0` && $(TAR) bat1.0.0.tar bat1.0.0 && $(COMPRESS) bat1.0.0.tar) && $(MOVE) `dirname .tmp/bat1.0.0`/bat1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/bat1.0.0 yaccclean: @@ -212,15 +212,18 @@ compiler_image_collection_clean: -$(DEL_FILE) qmake_image_collection.cpp compiler_moc_source_make_all: compiler_moc_source_clean: -compiler_uic_make_all: ui_main.h ui_label.h +compiler_uic_make_all: ui_main.h ui_label.h ui_console.h compiler_uic_clean: - -$(DEL_FILE) ui_main.h ui_label.h + -$(DEL_FILE) ui_main.h ui_label.h ui_console.h ui_main.h: main.ui /usr/bin/uic main.ui -o ui_main.h ui_label.h: label.ui /usr/bin/uic label.ui -o ui_label.h +ui_console.h: console/console.ui + /usr/bin/uic console/console.ui -o ui_console.h + compiler_clean: compiler_moc_header_clean compiler_rcc_clean compiler_image_collection_clean compiler_moc_source_clean compiler_uic_clean ####### Compile diff --git a/bacula/src/qt-console/bat.pro b/bacula/src/qt-console/bat.pro index a4daac1384..57f9454e26 100644 --- a/bacula/src/qt-console/bat.pro +++ b/bacula/src/qt-console/bat.pro @@ -16,6 +16,7 @@ RESOURCES = main.qrc FORMS += main.ui # Label dialog FORMS += label.ui +FORMS += console/console.ui HEADERS += mainwin.h bat.h bat_conf.h diff --git a/bacula/src/qt-console/console/console.cpp b/bacula/src/qt-console/console/console.cpp index 6590d28355..4e210998d9 100644 --- a/bacula/src/qt-console/console/console.cpp +++ b/bacula/src/qt-console/console/console.cpp @@ -37,15 +37,17 @@ #include "bat.h" #include "console.h" -Console::Console() +Console::Console(QStackedWidget *parent) { QFont font; QTreeWidgetItem *item, *topItem; QTreeWidget *treeWidget = mainWin->treeWidget; + setupUi(this); + parent->addWidget(this); m_sock = NULL; m_at_prompt = false; - m_textEdit = mainWin->textEdit; /* our console screen */ + m_textEdit = textEdit; /* our console screen */ m_cursor = new QTextCursor(m_textEdit->document()); mainWin->actionConnect->setIcon(QIcon(QString::fromUtf8("images/disconnected.png"))); @@ -85,7 +87,7 @@ void Console::connect() { JCR jcr; - m_textEdit = mainWin->textEdit; /* our console screen */ + m_textEdit = textEdit; /* our console screen */ if (!m_dir) { mainWin->set_status("No Director found."); diff --git a/bacula/src/qt-console/console/console.h b/bacula/src/qt-console/console/console.h index 921b1f9245..924c728a3d 100644 --- a/bacula/src/qt-console/console/console.h +++ b/bacula/src/qt-console/console/console.h @@ -3,18 +3,19 @@ #define _CONSOLE_H_ #include +#include "ui_console.h" class DIRRES; class BSOCK; class JCR; class CONRES; -class Console : public QWidget +class Console : public QWidget, public Ui::ConsoleForm { Q_OBJECT public: - Console(); + Console(QStackedWidget *parent); void set_text(const char *buf); void set_text(const QString buf); void set_textf(const char *fmt, ...); diff --git a/bacula/src/qt-console/console/console.ui b/bacula/src/qt-console/console/console.ui new file mode 100644 index 0000000000..7386c26073 --- /dev/null +++ b/bacula/src/qt-console/console/console.ui @@ -0,0 +1,91 @@ + + ConsoleForm + + + + 0 + 0 + 432 + 422 + + + + Console + + + + 9 + + + 6 + + + + + + + 9 + + + 6 + + + + + + 7 + 7 + 200 + 0 + + + + + 0 + 0 + + + + + 1 + 0 + + + + Qt::NoFocus + + + false + + + + + + + + + + + + Qt::ScrollBarAsNeeded + + + + + + QTextEdit::NoWrap + + + true + + + + + + + + + + + + diff --git a/bacula/src/qt-console/main.ui b/bacula/src/qt-console/main.ui index 606e7ffcc0..747b73ae34 100644 --- a/bacula/src/qt-console/main.ui +++ b/bacula/src/qt-console/main.ui @@ -110,96 +110,8 @@ - 0 + -1 - - - - 9 - - - 6 - - - - - - 7 - 7 - 200 - 0 - - - - - 0 - 0 - - - - - 1 - 0 - - - - Qt::NoFocus - - - false - - - - - - - - - - - - Qt::ScrollBarAsNeeded - - - - - - QTextEdit::NoWrap - - - true - - - - - - - - - 9 - - - 6 - - - - - 0 - - - - Restore 1 - - - - - Restore 2 - - - - - - @@ -292,8 +204,6 @@ 4 - - diff --git a/bacula/src/qt-console/mainwin.cpp b/bacula/src/qt-console/mainwin.cpp index db26d49de2..69eb2ac96c 100644 --- a/bacula/src/qt-console/mainwin.cpp +++ b/bacula/src/qt-console/mainwin.cpp @@ -39,11 +39,11 @@ MainWin::MainWin(QWidget *parent) : QMainWindow(parent) { mainWin = this; setupUi(this); /* Setup UI defined by main.ui (designer) */ - stackedWidget->setCurrentIndex(0); statusBar()->showMessage("Director not connected. Click on connect button."); - m_console = new Console(); + m_console = new Console(stackedWidget); + stackedWidget->setCurrentIndex(0); lineEdit->setFocus(); -- 2.39.5