diff options
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/src/main.cpp b/src/main.cpp index ee669d6..bf8aff7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -39,8 +39,7 @@ using namespace util::filesystem; -bool showDebugMessages = false; -BibleTime* bibletime_ptr = 0; +bool showDebugMessages; void myMessageOutput( QtMsgType type, const char *msg ) { //we use this messagehandler to switch debugging off in final releases @@ -168,46 +167,34 @@ int main(int argc, char* argv[]) { // This is the QT4 version, will only work if main App is QApplication // A binary option (on / off) - if (app.QCoreApplication::arguments().contains("--debug")) - { - showDebugMessages = true; - app.setProperty("--debug", true); - } - else - { - app.setProperty("--debug", false); - } + showDebugMessages = QCoreApplication::arguments().contains("--debug"); + app.setProperty("--debug", showDebugMessages); //Migrate configuration data, if neccessary util::MigrationUtil::checkMigration(); // setSignalHandler(signalHandler); - bibletime_ptr = new BibleTime(); + BibleTime bibleTime; // a new BibleTime version was installed (maybe a completely new installation) - if (CBTConfig::get(CBTConfig::bibletimeVersion) != BT_VERSION) { - + if (CBTConfig::get(CBTConfig::bibletimeVersion) != BT_VERSION) + { CBTConfig::set(CBTConfig::bibletimeVersion, BT_VERSION); - //TODO: unabled temporarily - //bibletime_ptr->slotSettingsOptions(); - bibletime_ptr->slotSettingsOptions(); + bibleTime.saveConfigSettings(); } // restore the workspace and process command line options //app.setMainWidget(bibletime_ptr); //no longer used in qt4 (QApplication) - bibletime_ptr->show(); - bibletime_ptr->processCommandline(); //must be done after the bibletime window is visible + bibleTime.show(); + bibleTime.processCommandline(); //must be done after the bibletime window is visible #ifndef NO_DBUS - new BibleTimeDBusAdaptor(bibletime_ptr); + new BibleTimeDBusAdaptor(&bibleTime); // connect to D-Bus and register as an object: - QDBusConnection::sessionBus().registerObject("/BibleTime", bibletime_ptr); + QDBusConnection::sessionBus().registerObject("/BibleTime", &bibleTime); #endif - const int ret = app.exec(); - - delete bibletime_ptr; - return ret; + return app.exec(); } |