diff options
Diffstat (limited to 'src/main.cpp')
-rwxr-xr-x | src/main.cpp | 61 |
1 files changed, 29 insertions, 32 deletions
diff --git a/src/main.cpp b/src/main.cpp index 4e64f4b..37c3a51 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,8 +17,8 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -// -- #include "MainWindow.h" -// -- +#include "MainWindow.h" + // -- #include "UiGuiIndentServer.h" // -- #include "debugging/TSLogger.h" // -- #include "UiGuiIniFileParser.h" @@ -26,10 +26,10 @@ // -- #include "UiGuiSystemInfo.h" // -- #include "IndentHandler.h" // -- #include "SettingsPaths.h" -// -- -// -- #include <tqapplication.h> -// -- #include <tqtextcodec.h> -// -- #include <tqdebug.h> + +#include <tqapplication.h> +#include <tqtextcodec.h> +#include <tqglobal.h> // -- #include <string> // -- #include <algorithm> @@ -63,7 +63,6 @@ int main(int argc, char *argv[]) bool tclapExitExceptionThrown = false; int returnValue = 0; - return 0; // Wrap everything in a try block. Do this every time, // because exceptions will be thrown for problems. try @@ -129,15 +128,15 @@ int main(int argc, char *argv[]) return returnValue; } -// -- TQApplication app(argc, argv); + TQApplication app(argc, argv); // -- UiGuiIndentServer server; -// -- MainWindow *mainWindow = NULL; + MainWindow *mainWindow = NULL; // -- IndentHandler *indentHandler = NULL; // -- -// -- // Init and install the logger function. -// -- // Setting UTF-8 as default 8-Bit encoding to ensure that tqDebug does no false string conversion. -// -- TQTextCodec::setCodecForCStrings(TQTextCodec::codecForName("UTF-8")); -// -- TQTextCodec::setCodecForLocale(TQTextCodec::codecForName("UTF-8")); + // Init and install the logger function. + // Setting UTF-8 as default 8-Bit encoding to ensure that tqDebug does no false string conversion. + TQTextCodec::setCodecForCStrings(TQTextCodec::codecForName("UTF-8")); + TQTextCodec::setCodecForLocale(TQTextCodec::codecForName("UTF-8")); // -- // Force creation of an TSLogger instance here, to avoid recursion with SettingsPaths init function. // -- #ifdef _DEBUG // -- TSLogger::getInstance(0); @@ -148,16 +147,11 @@ int main(int argc, char *argv[]) // -- TSLogger::messageHandler(TSLoggerInfoMsg, TQString("Starting UiGUI Version %1 %2").arg(PROGRAM_VERSION_STRING).arg(PROGRAM_REVISION).toAscii()); // -- TSLogger::messageHandler(TSLoggerInfoMsg, TQString("Running on %1").arg(UiGuiSystemInfo::getOperatingSystem()).toAscii()); // -- -// -- // Set default values for all by UniversalIndentGUI used settings objects. -// -- TQCoreApplication::setOrganizationName("UniversalIndentGUI"); -// -- TQCoreApplication::setOrganizationDomain("universalindent.sf.net"); -// -- TQCoreApplication::setApplicationName("UniversalIndentGUI"); -// -- -// -- // Start normal with full gui and without server. -// -- if (!startAsPlugin && !startAsServer) { -// -- mainWindow = new MainWindow(file2OpenOnStart); -// -- mainWindow->show(); -// -- } + // Start normal with full gui and without server. + if (!startAsPlugin && !startAsServer) { + mainWindow = new MainWindow(file2OpenOnStart); + mainWindow->show(); + } // -- // Start as plugin with server. // -- else if (startAsPlugin) { // -- server.startServer(); @@ -168,20 +162,23 @@ int main(int argc, char *argv[]) // -- else if (startAsServer) { // -- server.startServer(); // -- } -// -- -// -- try { -// -- returnValue = app.exec(); -// -- } -// -- catch (std::exception &ex) { -// -- qCritical() << __LINE__ << " " << __FUNCTION__ << ": Something went terribly wrong:" << ex.what(); -// -- } + + try + { + app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit())); // TODO: remove when no longer needed + returnValue = app.exec(); + } + catch (std::exception &ex) + { + tqDebug(TQString() + __LINE__ + " " + __FUNCTION__ + ": Something went terribly wrong: " + ex.what()); + } // -- // -- if (startAsPlugin || startAsServer) // -- server.stopServer(); // -- // -- delete indentHandler; -// -- delete mainWindow; -// -- + delete mainWindow; + // -- SettingsPaths::cleanAndRemoveTempDir(); // -- TSLogger::deleteInstance(); |