diff options
author | dos-reis <gdr@axiomatics.org> | 2011-06-03 16:26:34 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2011-06-03 16:26:34 +0000 |
commit | b5ef39f0f52945c1d465b9fb0e1c014355ffc713 (patch) | |
tree | d901f72e35dcfc1757b55a28e839a8c388109c4f | |
parent | 91ac879b87e3fdf5c796b65d4b2a259397b18002 (diff) | |
download | open-axiom-b5ef39f0f52945c1d465b9fb0e1c014355ffc713.tar.gz |
Enable the new GUI interface as default driver
on Windows platforms with QT available.
-rw-r--r-- | src/driver/main.cc | 1 | ||||
-rw-r--r-- | src/gui/debate.cc | 14 | ||||
-rw-r--r-- | src/gui/debate.h | 3 | ||||
-rw-r--r-- | src/gui/gui.pro.in | 5 | ||||
-rw-r--r-- | src/gui/main-window.cc | 4 | ||||
-rw-r--r-- | src/gui/main-window.h | 3 | ||||
-rw-r--r-- | src/gui/main.cc | 11 |
7 files changed, 27 insertions, 14 deletions
diff --git a/src/driver/main.cc b/src/driver/main.cc index 2621e1be..96b4a007 100644 --- a/src/driver/main.cc +++ b/src/driver/main.cc @@ -132,6 +132,7 @@ main(int argc, char* argv[]) case compiler_driver: case translator_driver: case linker_driver: + case gui_driver: putenv("LC_ALL=C"); setlocale(LC_ALL, ""); return execute_core(&command, driver); 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 <QApplication> #include <QScrollBar> #include "debate.h" -#include <iostream> -#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 <QFontMetrics> #include <QScrollArea> #include <QResizeEvent> +#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 <QMainWindow> #include <QTabWidget> +#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 <QApplication> #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(); } |