From b5ef39f0f52945c1d465b9fb0e1c014355ffc713 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Fri, 3 Jun 2011 16:26:34 +0000 Subject: Enable the new GUI interface as default driver on Windows platforms with QT available. --- src/gui/debate.cc | 14 +++++++------- src/gui/debate.h | 3 ++- src/gui/gui.pro.in | 5 +++-- src/gui/main-window.cc | 4 ++-- src/gui/main-window.h | 3 ++- src/gui/main.cc | 11 ++++++++++- 6 files changed, 26 insertions(+), 14 deletions(-) (limited to 'src/gui') diff --git a/src/gui/debate.cc b/src/gui/debate.cc index 35740c37..101dae1d 100644 --- a/src/gui/debate.cc +++ b/src/gui/debate.cc @@ -32,23 +32,23 @@ #include #include #include "debate.h" -#include -#include "open-axiom.h" namespace OpenAxiom { static void - start_interpreter(Conversation* conv) { + start_interpreter(Conversation* conv, Command& cmd) { QStringList args; - args << "--no-server" << "--role=server"; - conv->oracle()->start("open-axiom",args); + args << "--" << "--role=server"; + for (int i = 0; i < cmd.rt_args.size(); ++i) + args << cmd.rt_args[i]; + conv->oracle()->start(make_path_for(cmd.root_dir, core_driver), args); // When invoked in a --role=server mode, OpenAxiom would // wait to be pinged before displayed a prompt. This is // an unfortunate result of a rather awkward hack. conv->submit_query(""); } - Debate::Debate(QWidget* parent) + Debate::Debate(QWidget* parent, Command& cmd) : QScrollArea(parent), conv(*this) { setWidget(&conv); setViewportMargins(0, 0, 0, 0); @@ -57,7 +57,7 @@ namespace OpenAxiom { setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); adjustSize(); - start_interpreter(exchanges()); + start_interpreter(exchanges(), cmd); connect(conv.oracle(), SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(done(int))); diff --git a/src/gui/debate.h b/src/gui/debate.h index fa7116bc..fa875c5b 100644 --- a/src/gui/debate.h +++ b/src/gui/debate.h @@ -36,6 +36,7 @@ #include #include #include +#include "open-axiom.h" #include "conversation.h" namespace OpenAxiom { @@ -43,7 +44,7 @@ namespace OpenAxiom { class Debate : public QScrollArea { Q_OBJECT; public: - explicit Debate(QWidget*); + explicit Debate(QWidget*, Command&); ~Debate(); Conversation* exchanges() { return &conv; } diff --git a/src/gui/gui.pro.in b/src/gui/gui.pro.in index eb293f5a..fe160438 100644 --- a/src/gui/gui.pro.in +++ b/src/gui/gui.pro.in @@ -3,7 +3,7 @@ ## Written by Gabriel Dos Reis. OA_INC = -OA_LIB = +OA_LIB = -L@top_builddir@/@target@/lib -lOpenAxiom ## We build in release mode. CONFIG += release @@ -12,7 +12,8 @@ CONFIG += release TEMPLATE = app ## Put the executable directly in the staged bin directory. -TARGET = @top_builddir@/@target@/bin/gui +DESTDIR = @top_builddir@/@target@/bin +TARGET = gui ## Tell QT that sources are not in the build directory VPATH += @srcdir@ diff --git a/src/gui/main-window.cc b/src/gui/main-window.cc index 9cb219bf..c429d753 100644 --- a/src/gui/main-window.cc +++ b/src/gui/main-window.cc @@ -55,9 +55,9 @@ namespace OpenAxiom { w->resize(w->size() + diff); } - MainWindow::MainWindow() : tabs(this) { + MainWindow::MainWindow(Command& cmd) : tabs(this) { setCentralWidget(&tabs); - Debate* debate = new Debate(&tabs); + Debate* debate = new Debate(&tabs, cmd); tabs.addTab(debate, "Main Frame"); QMenu* file = menuBar()->addMenu(tr("&File")); QAction* action = new QAction(tr("Quit"), this); diff --git a/src/gui/main-window.h b/src/gui/main-window.h index 1d94e3ea..5d270df3 100644 --- a/src/gui/main-window.h +++ b/src/gui/main-window.h @@ -34,13 +34,14 @@ #include #include +#include "open-axiom.h" namespace OpenAxiom { // -- Main application window -- class MainWindow : public QMainWindow { Q_OBJECT; public: - MainWindow(); + MainWindow(Command&); ~MainWindow(); private: diff --git a/src/gui/main.cc b/src/gui/main.cc index 3f05c12e..621f4c28 100644 --- a/src/gui/main.cc +++ b/src/gui/main.cc @@ -32,11 +32,20 @@ #include #include "main-window.h" + int main(int argc, char* argv[]) { using namespace OpenAxiom; + Command command; + // The toplevel driver may be have called us with the + // path to the gui interface (argv[0]) and the full name + // of the toplevel driver itself (argv[1].) Skip. + preprocess_arguments(&command, argc - 1, argv + 1); QApplication app(argc, argv); - MainWindow main_win; + QApplication::setApplicationName("OpenAxiom"); + QApplication::setOrganizationDomain("www.open-axiom.org"); + MainWindow main_win(command); + main_win.setWindowTitle("OpenAxiom"); main_win.show(); return app.exec(); } -- cgit v1.2.3