--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/scala/guinterpreter/guinterpreter.scala Fri May 09 23:00:39 2008 +0100
@@ -0,0 +1,70 @@
+package guinterpreter;
+
+import com.trolltech.qt.gui._;
+import com.trolltech.qt.core._;
+import scala.tools.nsc._;
+
+object Main{
+ def main(args : Array[String]){
+ QApplication.initialize(args);
+ QApplication.setQuitOnLastWindowClosed(true);
+
+ val mainWindow = new QMainWindow()
+
+ val stuff = new Ui_MainWindow();
+
+ stuff.setupUi(mainWindow);
+
+ import stuff._;
+
+ actionQuit.triggered.connect(() => QCoreApplication.exit(), "apply()")
+
+ mainWindow.show();
+
+ import java.io._
+
+ val stringy = new StringWriter()
+
+ val contents = stringy.getBuffer();
+
+ val fuckOffJava = new ByteArrayOutputStream();
+
+ System.setOut(new PrintStream(fuckOffJava));
+
+ val int = new Interpreter(new Settings(), new PrintWriter(stringy));
+
+ def interpret(line : String) = {
+ val result = int.interpret(line);
+
+ Output.append(fuckOffJava.toString());
+ Output.append(contents.toString());
+ fuckOffJava.reset();
+ contents.setLength(0);
+ result;
+ }
+
+ actionOpen.triggered.connect(() => {
+ val name = QFileDialog.getOpenFileName();
+
+ if (name != null && name.length() > 0){
+ val reader = new BufferedReader(new FileReader(name));
+ var line : String = null;
+ while ( {line = reader.readLine(); line != null}){
+ interpret(line);
+ }
+
+ reader.close();
+// int.interpretAllFrom(name);
+ }
+ }, "apply()");
+
+ run.clicked.connect(() => {
+ interpret(input.toPlainText()) match {
+ case InterpreterResults.Success => input.clear();
+ case _ => ();
+ }
+ }, "apply()");
+
+ QApplication.exec();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/scala/guinterpreter/mainwindow.jui Fri May 09 23:00:39 2008 +0100
@@ -0,0 +1,109 @@
+<ui version="4.0" language="jambi" >
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>636</width>
+ <height>1020</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>MainWindow</string>
+ </property>
+ <widget class="QWidget" name="centralwidget" >
+ <widget class="QTextEdit" name="input" >
+ <property name="geometry" >
+ <rect>
+ <x>10</x>
+ <y>870</y>
+ <width>541</width>
+ <height>94</height>
+ </rect>
+ </property>
+ <property name="focusPolicy" >
+ <enum>com.trolltech.qt.core.Qt.FocusPolicy.WheelFocus</enum>
+ </property>
+ <property name="acceptRichText" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="run" >
+ <property name="geometry" >
+ <rect>
+ <x>560</x>
+ <y>870</y>
+ <width>75</width>
+ <height>91</height>
+ </rect>
+ </property>
+ <property name="focusPolicy" >
+ <enum>com.trolltech.qt.core.Qt.FocusPolicy.StrongFocus</enum>
+ </property>
+ <property name="text" >
+ <string>Run</string>
+ </property>
+ <property name="shortcut" >
+ <string>Ctrl+Return</string>
+ </property>
+ </widget>
+ <widget class="QTextEdit" name="Output" >
+ <property name="geometry" >
+ <rect>
+ <x>10</x>
+ <y>10</y>
+ <width>621</width>
+ <height>851</height>
+ </rect>
+ </property>
+ <property name="focusPolicy" >
+ <enum>com.trolltech.qt.core.Qt.FocusPolicy.WheelFocus</enum>
+ </property>
+ <property name="readOnly" >
+ <bool>true</bool>
+ </property>
+ <property name="acceptRichText" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </widget>
+ <widget class="QMenuBar" name="menubar" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>636</width>
+ <height>30</height>
+ </rect>
+ </property>
+ <widget class="QMenu" name="menuFile" >
+ <property name="title" >
+ <string>&File</string>
+ </property>
+ <addaction name="actionOpen" />
+ <addaction name="separator" />
+ <addaction name="actionQuit" />
+ </widget>
+ <addaction name="menuFile" />
+ </widget>
+ <widget class="QStatusBar" name="statusbar" />
+ <action name="actionOpen" >
+ <property name="text" >
+ <string>&Open</string>
+ </property>
+ </action>
+ <action name="actionSave" >
+ <property name="text" >
+ <string>&Save</string>
+ </property>
+ </action>
+ <action name="actionQuit" >
+ <property name="text" >
+ <string>&Quit</string>
+ </property>
+ </action>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>