void ResultsPage::initializePage() { // Register this instance as the Qt message handler. Q_ASSERT(instance == NULL); instance = this; previousMessageHandler = qInstallMessageHandler(&ResultsPage::messageHandler); // Debug log the application version information. VersionInfo versionInfo; if (versionInfo.isValid()) { qDebug() << QApplication::applicationName() << versionInfo.fileVersionString() << versionInfo.fileInfo(QLatin1String("SpecialBuild")); } // Debug log the hook version information. #ifdef Q_OS_WIN for (int index = 0; index < 2; ++index) { const QDir dir = (index == 0) ? FlowSyncHook::flowSyncDir() : FlowSyncHook::installableHookDir(); const int version = FlowSyncHook::getVersion(dir); qDebug() << QDir::toNativeSeparators(dir.absolutePath()) << "hook version" << version; } #endif // Once the application is ready, begin the processing. QTimer::singleShot(0, converter, SLOT(start())); }
int main(int argc, char *argv[]) { // Setup the primary Qt application object. QApplication app(argc, argv); app.setApplicationName(APPLICATION_NAME); app.setOrganizationName(ORGANISATION_NAME); app.setOrganizationDomain(ORGANISATION_DOMAIN); VersionInfo versionInfo; if (versionInfo.isValid()) { app.setApplicationVersion(versionInfo.fileVersionString()); } // Default to the Oxygen theme, if no other theme is configured yet. if (QIcon::themeName().isEmpty()) { QIcon::setThemeName(QLatin1String("oxygen")); } // Try to load a localised translator. QTranslator translator; if (translator.load(QLocale::system().name(),app.applicationDirPath()+QLatin1String("/../i18n"))) app.installTranslator(&translator); #ifdef Q_OS_WIN // Install the hook now, if requested via the command line. if (app.arguments().contains(QLatin1Literal("-install-hook"))) { QErrorMessage::qtHandler(); // Expose any internal errors / warnings. const QDir fromDir = FlowSyncHook::installableHookDir(); const QDir toDir = FlowSyncHook::flowSyncDir(); if (!fromDir.exists(QLatin1String("Qt5Network.dll"))) { QMessageBox::warning(NULL, QString(), app.tr("Installable hook not found.")); return 1; } if (!toDir.exists(QLatin1String("Qt5Network.dll"))) { QMessageBox::warning(NULL, QString(), app.tr("Failed to locate Polar FlowSync installation.")); return 2; } const int fromVersion = FlowSyncHook::getVersion(fromDir); const int toVersion = FlowSyncHook::getVersion(toDir); if (fromVersion > toVersion) { if (!FlowSyncHook::install(fromDir, toDir)) { QMessageBox::warning(NULL, QString(), app.tr("Failed to install hook DLL.")); return 3; } } return 0; } #endif // Instantiate the main window. MainWizard mainWizard; mainWizard.show(); return app.exec(); }