diff options
author | dos-reis <gdr@axiomatics.org> | 2013-04-08 01:02:39 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2013-04-08 01:02:39 +0000 |
commit | 8e96ce961790badae55c859eaa1aca9b8b140a54 (patch) | |
tree | 65a890f0b87b116c0fccf2667973cba5b4b704ae /src/gui | |
parent | ed865861aaecdba0375daa3a6a509ac55a57fe2e (diff) | |
download | open-axiom-8e96ce961790badae55c859eaa1aca9b8b140a54.tar.gz |
Remove QTabWidget intermediary
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; }; } |