diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/conversation.h | 2 | ||||
-rw-r--r-- | src/gui/debate.cc | 10 | ||||
-rw-r--r-- | src/gui/debate.h | 9 | ||||
-rw-r--r-- | src/gui/main-window.cc | 6 | ||||
-rw-r--r-- | src/gui/main-window.h | 4 |
5 files changed, 17 insertions, 14 deletions
diff --git a/src/gui/conversation.h b/src/gui/conversation.h index b9f27e0c..d25960a1 100644 --- a/src/gui/conversation.h +++ b/src/gui/conversation.h @@ -53,6 +53,8 @@ namespace OpenAxiom { class Question; class Answer; + class MainWindow; + // -------------------- // -- OutputTextArea -- // -------------------- diff --git a/src/gui/debate.cc b/src/gui/debate.cc index 022f8454..bd5a593e 100644 --- a/src/gui/debate.cc +++ b/src/gui/debate.cc @@ -32,11 +32,12 @@ #include <QApplication> #include <QScrollBar> #include "debate.h" +#include "main-window.h" namespace OpenAxiom { - Debate::Debate(MainWindow* win, QTabWidget* tab) - : QScrollArea(tab), main_win(win), conv(this) { + Debate::Debate(MainWindow* win) + : super(win), conv(this) { setWidget(&conv); setViewportMargins(0, 0, 0, 0); viewport()->setAutoFillBackground(true); @@ -48,6 +49,11 @@ namespace OpenAxiom { Debate::~Debate() { } + Server* + Debate::server() const { + return parent()->server(); + } + void Debate::resizeEvent(QResizeEvent* e) { QScrollArea::resizeEvent(e); if (conv.length() != 0) diff --git a/src/gui/debate.h b/src/gui/debate.h index b2339d76..c7fa930e 100644 --- a/src/gui/debate.h +++ b/src/gui/debate.h @@ -39,25 +39,22 @@ #include "open-axiom.h" #include "widget.h" #include "conversation.h" -#include "main-window.h" namespace OpenAxiom { - class Debate : public QScrollArea { + class Debate : public managed_by<QScrollArea, MainWindow> { Q_OBJECT; public: - explicit Debate(MainWindow*, QTabWidget*); + explicit Debate(MainWindow*); ~Debate(); Conversation* exchanges() { return &conv; } - MainWindow* main_window() const { return main_win; } - Server* server() const { return main_window()->server(); } + Server* server() const; protected: void resizeEvent(QResizeEvent*); private: - MainWindow* const main_win; Conversation conv; }; } diff --git a/src/gui/main-window.cc b/src/gui/main-window.cc index c58c86e5..836f56d1 100644 --- a/src/gui/main-window.cc +++ b/src/gui/main-window.cc @@ -39,11 +39,9 @@ namespace OpenAxiom { MainWindow::MainWindow(int argc, char* argv[]) - : srv(argc, argv), tabs(this) { - setCentralWidget(&tabs); + : srv(argc, argv), debate(this) { + setCentralWidget(&debate); setWindowTitle("OpenAxiom"); - Debate* debate = new Debate(this, &tabs); - tabs.addTab(debate, "Main Frame"); QMenu* file = menuBar()->addMenu(tr("&File")); QAction* action = new QAction(tr("Quit"), this); file->addAction(action); diff --git a/src/gui/main-window.h b/src/gui/main-window.h index eb6e6988..6eee627e 100644 --- a/src/gui/main-window.h +++ b/src/gui/main-window.h @@ -33,9 +33,9 @@ #define OPENAXIOM_GUI_MAIN_WINDOW_INCLUDED #include <QMainWindow> -#include <QTabWidget> #include "open-axiom.h" #include "server.h" +#include "debate.h" namespace OpenAxiom { // -- Main application window -- @@ -53,7 +53,7 @@ namespace OpenAxiom { private: Server srv; - QTabWidget tabs; + Debate debate; }; } |