#include <QDir>
#include <QFileInfo>
#include <QFontDatabase>
+#include <QWebSettings>
+#include <QMessageBox>
#include <boost/scoped_ptr.hpp>
#include "MainWindow.hh"
#include "PythonPublisher.hh"
return QSize();
return QSize(coords[0].toInt(), coords[1].toInt());
}
+
+ void showPlatformError(char const * reason)
+ {
+ QMessageBox msgBox;
+ msgBox.setText("Es ist ein interner Fehler bei der Initialisierung"
+ " aufgetreten. Bitte notieren sie die folgende"
+ " Fehlermeldung und wenden sie sich an den technischen"
+ " Support.");
+ msgBox.setDetailedText(reason);
+ msgBox.setInformativeText(QString("%1 wird beendet.").arg(QApplication::applicationName()));
+ msgBox.setWindowTitle(QApplication::applicationName());
+ msgBox.exec();
+ }
}
int main(int argc, char *argv[])
{
+ QApplication app (argc, argv);
try {
- QApplication app (argc, argv);
-
QSettings settings ("pykit.ini", QSettings::IniFormat);
QStringList arguments (app.arguments());
settings.beginGroup("AppData");
QString url (settings.value("home").toString());
if (arguments.size()>1)
url = arguments.at(1);
+
+ if (settings.value("debug").toBool())
+ QWebSettings::globalSettings()->setAttribute(
+ QWebSettings::DeveloperExtrasEnabled, true);
pykit::MainWindow window (QUrl(url), &publisher);
window.setWindowTitle(app.applicationName());
if (!iconPath.isEmpty())
return app.exec();
}
- catch (std::exception & ex) {
+ catch (std::exception const & ex) {
std::cerr << "Exception:\n" << ex.what() << "\n";
- throw;
+ showPlatformError(ex.what());
+ return 1;
+ }
+ catch (...) {
+ std::cerr << "Exception: <undefined>\n";
+ showPlatformError("undefined error condition");
+ return 1;
}
}