00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <signal.h>
00025 #include <QApplication>
00026 #include <QTextCodec>
00027 #include <QTranslator>
00028 #include <QString>
00029 #include <QLocale>
00030 #include <QLibraryInfo>
00031 #include <iostream>
00032 #include <stdexcept>
00033 #include "MainWindow.h"
00034
00039 int main(int argc, char *argv[])
00040 {
00041 QApplication app(argc, argv);
00042
00043 QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
00044 QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
00045
00046
00047 signal(SIGTERM, SIG_DFL);
00048 signal(SIGINT, SIG_DFL);
00049
00050 QString commandLineTarget;
00051 for (int i = 1; i < argc; ++i)
00052 {
00053 if (argv[i][0] != '-')
00054 {
00055 commandLineTarget = argv[i];
00056 break;
00057 }
00058 }
00059
00060 QTranslator qtTranslator;
00061 qtTranslator.load("qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
00062 app.installTranslator(&qtTranslator);
00063
00064 QTranslator translator;
00065 translator.load(QString(":/asebastudio_") + QLocale::system().name());
00066 app.installTranslator(&translator);
00067
00068 try
00069 {
00070 QVector<QTranslator*> translators;
00071 translators.push_back(&qtTranslator);
00072 translators.push_back(&translator);
00073 Aseba::MainWindow window(translators, commandLineTarget);
00074 window.show();
00075 return app.exec();
00076 }
00077 catch (std::runtime_error e)
00078 {
00079 std::cerr << "Program terminated with runtime error: " << e.what() << std::endl;
00080 return -1;
00081 }
00082 }
00083
00084