changeset 535:f7df458fe781

Since the console output doesn't seem to work always, prefer to use message boxes for important notices to the user. git-svn-id: svn://svn.code.sf.net/p/universalindent/code/trunk@775 59b1889a-e5ac-428c-b0c7-476e01d41282
author thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
date Thu, 25 Sep 2008 14:10:56 +0000
parents 74f7df15f00b
children c35bb20e9f3f
files src/main.cpp src/mainwindow.cpp
diffstat 2 files changed, 24 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/main.cpp	Wed Sep 24 15:00:55 2008 +0000
+++ b/src/main.cpp	Thu Sep 25 14:10:56 2008 +0000
@@ -53,6 +53,7 @@
         if ( currentArg == "-f" || currentArg == "--file" ) {
             // Test whether a parameter follows the file parameter.
             if ( i + 1 >= argc ) {
+                QMessageBox::information( NULL, "Need additional parameter", "The parameter -f / --file needs a following parameter defining the file to be opened at start." );
                 fprintf(stderr, "The parameter -f / --file needs a following parameter defining the file to be opened at start.");
                 exit(1);
             } 
@@ -69,6 +70,13 @@
             startAsServer = true;
         }
         else {
+            QString message = "Invalid parameter found. Allowed parameters are:\n" \
+                "No parameters starts without server and full gui.\n" \
+                "-f filename --file filename   : Opens the by filename defined file on start.\n" \
+                "-p --plugin  : Run as plugin. Server will be startet with a simplified gui.\n" \
+                "-s --server  : Run as server only without gui.\n"
+                "If -p and -s are set, -p will be used.";
+            QMessageBox::information( NULL, "Invalid parameter", message );
             fprintf(stderr, "Invalid parameter found. Allowed parameters are...");
             exit(1);
         }
--- a/src/mainwindow.cpp	Wed Sep 24 15:00:55 2008 +0000
+++ b/src/mainwindow.cpp	Thu Sep 25 14:10:56 2008 +0000
@@ -202,8 +202,23 @@
     \brief Create and initialize the text editor component. It uses the QScintilla widget.
  */
 void MainWindow::initTextEditor() {
+
+    QMessageBox infoQScintillaLoad(NULL);
+    infoQScintillaLoad.setWindowTitle("Loading QScintilla...");
+    infoQScintillaLoad.setText("Trying to load QScintilla library.\nIf anything fails during loading, it might be possible that the debug and release version of QScintilla are mixed.");
+    infoQScintillaLoad.show();
     // Create the QScintilla widget and add it to the layout.
-    txtedSourceCode = new QsciScintilla(this);
+    // Try and catch doesn't seem to catch the runtime error when starting UiGUI release with QScintilla debug lib and the other way around.
+    try {
+        txtedSourceCode = new QsciScintilla(this);
+    }
+    catch (...) {
+        QMessageBox::critical(this, "Error creating QScintilla text editor component!", 
+            "During trying to create the text editor component, that is based on QScintilla, an error occurred. Please make sure that you have installed QScintilla and not mixed release and debug versions." );
+        exit(1);
+    }
+    infoQScintillaLoad.hide();
+
 	hboxLayout1->addWidget(txtedSourceCode);
 
     // Make some settings for the QScintilla widget.