aboutsummaryrefslogtreecommitdiff
path: root/src/gui/main-window.cc
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2013-04-07 12:37:06 +0000
committerdos-reis <gdr@axiomatics.org>2013-04-07 12:37:06 +0000
commitb5d890ae837ea35d9f5077cf260bf85922259be9 (patch)
treecc5e1cd591a2cae525392c46464a4f9c57049644 /src/gui/main-window.cc
parenta4633748286e4701f9430991b27a0ffa4fb49bb6 (diff)
downloadopen-axiom-b5d890ae837ea35d9f5077cf260bf85922259be9.tar.gz
gui: misc cleanup
Diffstat (limited to 'src/gui/main-window.cc')
-rw-r--r--src/gui/main-window.cc48
1 files changed, 26 insertions, 22 deletions
diff --git a/src/gui/main-window.cc b/src/gui/main-window.cc
index 9912bf41..b3063638 100644
--- a/src/gui/main-window.cc
+++ b/src/gui/main-window.cc
@@ -31,42 +31,46 @@
#include <QMenuBar>
#include <QAction>
+#include <QApplication>
+#include <QMessageBox>
#include "debate.h"
#include "main-window.h"
namespace OpenAxiom {
-
- // Attempt to resize the main window so that on the first exposure
- // the exchanges in this debate have the preferred geometry and the
- // horizontal scroll bar is not needed.
- static void
- try_to_honor_widget_size(MainWindow* w, Debate* debate) {
- // Force a show first, to provoke conversation size.
- // That helps getting the sizes right. On the other hand, it
- // makes for several resize event roundring leading to
- // an awkward looking brief window showing. FIXME.
- w->show();
- QSize diff = debate->exchanges()->size() - debate->viewport()->size();
- if (diff.width() < 0)
- diff.setWidth(0);
- if (diff.height() < 0)
- diff.setHeight(0);
- w->resize(w->size() + diff);
- }
-
- MainWindow::MainWindow(Command& cmd) : fs(cmd.root_dir), srv(cmd), tabs(this) {
+ MainWindow::MainWindow(Command& cmd) : srv(cmd), tabs(this) {
setCentralWidget(&tabs);
- Debate* debate = new Debate(&tabs, cmd);
+ Debate* debate = new Debate(&tabs);
tabs.addTab(debate, "Main Frame");
QMenu* file = menuBar()->addMenu(tr("&File"));
QAction* action = new QAction(tr("Quit"), this);
file->addAction(action);
action->setShortcut(tr("Ctrl+Q"));
connect(action, SIGNAL(triggered()), this, SLOT(close()));
- try_to_honor_widget_size(this, debate);
+
+ connect(server(), SIGNAL(finished(int, QProcess::ExitStatus)),
+ this, SLOT(done(int, QProcess::ExitStatus)));
+ connect(server(), SIGNAL(readyReadStandardError()),
+ this, SLOT(display_error()));
+
+ server()->launch();
+ // When invoked in a --role=server mode, OpenAxiom would
+ // wait to be pinged before displaying a prompt. This is
+ // an unfortunate result of a rather awkward hack.
+ server()->input("");
}
MainWindow::~MainWindow() {
}
+
+ void MainWindow::done(int s, QProcess::ExitStatus) {
+ // For the time being, shut done the whole application
+ // if the interpreter quits. FIXME.
+ QApplication::exit(s);
+ }
+
+ void MainWindow::display_error() {
+ auto s = server()->readAllStandardError();
+ QMessageBox::critical(this, tr("System error"), QString(s));
+ }
}