Browse Source

Implement Program Output dialog.
Fix off-by-one in A68k error column parsing.


git-svn-id: file:///var/svn/tigccpp/trunk@646 9552661e-59e3-4036-b4f2-dbe53926924f

kevinkofler 18 years ago
parent
commit
bfdac8087f
4 changed files with 121 additions and 5 deletions
  1. 2 1
      ktigcc/KTIGCC.prj
  2. 2 1
      ktigcc/ktigcc.pro
  3. 14 3
      ktigcc/mainform.ui.h
  4. 103 0
      ktigcc/programoutput.ui

+ 2 - 1
ktigcc/KTIGCC.prj

@@ -91,7 +91,8 @@ module.source.files=\
 	configure\
 	fedora/ktigcc.spec\
 	srcfilewin.ui\
-	errorlist.ui
+	errorlist.ui\
+	programoutput.ui
 
 module.pixmap.name=.
 module.pixmap.type=

+ 2 - 1
ktigcc/ktigcc.pro

@@ -19,7 +19,8 @@ FORMS	= srcfilewin.ui \
 	programoptions.ui \
 	preferencesdlg.ui \
 	mainform.ui \
-	errorlist.ui
+	errorlist.ui \
+	programoutput.ui
 
 IMAGES	= images/00 \
 	images/01 \

+ 14 - 3
ktigcc/mainform.ui.h

@@ -68,6 +68,7 @@
 #include <kiconloader.h>
 #include <kprocio.h>
 #include <kshell.h>
+#include <ktextbrowser.h>
 #include <cstdio>
 #include <cstdlib>
 #include "ktigcc.h"
@@ -76,6 +77,7 @@
 #include "preferences.h"
 #include "projectoptions.h"
 #include "errorlist.h"
+#include "programoutput.h"
 
 using std::puts;
 using std::exit;
@@ -357,6 +359,7 @@ static QPopupMenu *te_popup;
 static QDockWindow *errorListDock;
 static ErrorList *errorList;
 static unsigned errorCountTotal=0,errorCountErrors=0,errorCountWarnings=0;
+static QString programOutput;
 QAssistantClient *assistant;
 static unsigned fileCount=0, hFileCount=0, cFileCount=0, sFileCount=0, asmFileCount=0, qllFileCount=0, oFileCount=0, aFileCount=0, txtFileCount=0, othFileCount=0;
 tprSettings settings;
@@ -1208,6 +1211,8 @@ void MainForm::clearProject()
   // error list each time, and I'd have to clear the list at the end anyway
   // because an error might not have a source file assigned.
   errorList->errorListView->clear();
+  programOutput=QString::null;
+  projectProgramOutputAction->setEnabled(FALSE);
   QListViewItem *f, *next;
   for (f=hFilesListItem->firstChild();f;f=next) {
     next=f->nextSibling();
@@ -3147,6 +3152,8 @@ void MainForm::startCompiling()
   deletableObjectFiles.clear();
   deletableAsmFiles.clear();
   errorList->errorListView->clear();
+  programOutput=QString::null;
+  projectProgramOutputAction->setEnabled(FALSE);
   procio=static_cast<KProcIO *>(NULL);
   // Write all the headers and incbin files to the temporary directory.
   QListViewItemIterator lvit(hFilesListItem);
@@ -3253,7 +3260,9 @@ void MainForm::procio_readReady()
   static QString errorFile;
   QString line;
   while (procio->readln(line)>=0) {
-    // TODO: This needs to be stored for the Program Output dialog.
+    programOutput.append(line);
+    programOutput.append('\n');
+    projectProgramOutputAction->setEnabled(TRUE);
     if (line.isEmpty()) continue;
     // Parse the error message
     switch (a68kErrorLine) {
@@ -3385,7 +3394,7 @@ void MainForm::procio_readReady()
         if (line.contains(QRegExp("^\\s*\\^"))) {
           int caretPos=line.find('^');
           if (errorLine>=0 && errorColumn<0)
-            errorColumn=caretPos-2; // there's an extra tab at the beginning
+            errorColumn=caretPos-1; // there's an extra tab at the beginning
           QString errorMessage=line.mid(caretPos+2);
           if (!errorMessage.endsWith("."))
             errorMessage.append('.');
@@ -3732,7 +3741,9 @@ void MainForm::projectErrorsAndWarnings(bool on)
 
 void MainForm::projectProgramOutput()
 {
-  
+  ProgramOutput programOutputDialog;
+  programOutputDialog.textBrowser->setText(programOutput);
+  programOutputDialog.exec();
 }
 
 void MainForm::projectOptions()

+ 103 - 0
ktigcc/programoutput.ui

@@ -0,0 +1,103 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>ProgramOutput</class>
+<widget class="QDialog">
+    <property name="name">
+        <cstring>ProgramOutput</cstring>
+    </property>
+    <property name="geometry">
+        <rect>
+            <x>0</x>
+            <y>0</y>
+            <width>763</width>
+            <height>622</height>
+        </rect>
+    </property>
+    <property name="caption">
+        <string>Program Output</string>
+    </property>
+    <vbox>
+        <property name="name">
+            <cstring>unnamed</cstring>
+        </property>
+        <widget class="KTextBrowser">
+            <property name="name">
+                <cstring>textBrowser</cstring>
+            </property>
+            <property name="font">
+                <font>
+                    <family>Monospace</family>
+                </font>
+            </property>
+            <property name="textFormat">
+                <enum>PlainText</enum>
+            </property>
+            <property name="autoFormatting">
+                <set>AutoNone</set>
+            </property>
+        </widget>
+        <widget class="QLayoutWidget">
+            <property name="name">
+                <cstring>Layout1</cstring>
+            </property>
+            <hbox>
+                <property name="name">
+                    <cstring>unnamed</cstring>
+                </property>
+                <property name="margin">
+                    <number>0</number>
+                </property>
+                <property name="spacing">
+                    <number>6</number>
+                </property>
+                <spacer>
+                    <property name="name">
+                        <cstring>Horizontal Spacing2</cstring>
+                    </property>
+                    <property name="orientation">
+                        <enum>Horizontal</enum>
+                    </property>
+                    <property name="sizeType">
+                        <enum>Expanding</enum>
+                    </property>
+                    <property name="sizeHint">
+                        <size>
+                            <width>20</width>
+                            <height>20</height>
+                        </size>
+                    </property>
+                </spacer>
+                <widget class="KPushButton">
+                    <property name="name">
+                        <cstring>buttonClose</cstring>
+                    </property>
+                    <property name="text">
+                        <string>&amp;Close</string>
+                    </property>
+                    <property name="accel">
+                        <string>Alt+C</string>
+                    </property>
+                    <property name="autoDefault">
+                        <bool>true</bool>
+                    </property>
+                    <property name="default">
+                        <bool>true</bool>
+                    </property>
+                </widget>
+            </hbox>
+        </widget>
+    </vbox>
+</widget>
+<connections>
+    <connection>
+        <sender>buttonClose</sender>
+        <signal>clicked()</signal>
+        <receiver>ProgramOutput</receiver>
+        <slot>close()</slot>
+    </connection>
+</connections>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+    <includehint>ktextbrowser.h</includehint>
+    <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>