mirror of
https://github.com/rizinorg/cutter.git
synced 2025-02-27 17:04:44 +00:00

* init commit * bug fix * call slot of null object bug fix * delete extra disconnect() func * change api and add doc * run astyle * some improvements * memory leak fix * add check on start checkbox * add checkbox to about page * serve version check reply using lambda instead of slot * fix grammar mistakes * more docs * save some lines * change button text * astyle * change message text * dont use QApplication pointer as a parent for network manager * proper deletion of QNetworkReply* * VersionChecker -> UpdateWorker * windows dll hack * after rebase fix * some improvements * better determination of arch * more docs * improvements * add UpdateWorker::showUpdateDialog * remove odd condition * more improvements * fix windows bug * make dialog non-blocking * change text in download progress dialog * bug fix * remove debug conditions * change docs format
55 lines
1.7 KiB
C++
55 lines
1.7 KiB
C++
|
|
#include "CutterApplication.h"
|
|
#include "core/MainWindow.h"
|
|
#include "common/UpdateWorker.h"
|
|
#include "CutterConfig.h"
|
|
|
|
/**
|
|
* @brief Migrate Settings used before Cutter 1.8
|
|
*/
|
|
static void migrateSettings(QSettings &newSettings)
|
|
{
|
|
QSettings oldSettings(QSettings::NativeFormat, QSettings::Scope::UserScope, "Cutter", "Cutter");
|
|
for (const QString &key : oldSettings.allKeys()) {
|
|
newSettings.setValue(key, oldSettings.value(key));
|
|
}
|
|
oldSettings.clear();
|
|
QFile settingsFile(oldSettings.fileName());
|
|
settingsFile.remove();
|
|
}
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
qRegisterMetaType<QList<StringDescription>>();
|
|
qRegisterMetaType<QList<FunctionDescription>>();
|
|
|
|
QCoreApplication::setOrganizationName("RadareOrg");
|
|
QCoreApplication::setApplicationName("Cutter");
|
|
QSettings::setDefaultFormat(QSettings::IniFormat);
|
|
|
|
QSettings settings;
|
|
if (!settings.value("settings_migrated", false).toBool()) {
|
|
qInfo() << "Settings have not been migrated before, trying to migrate from pre-1.8 if possible.";
|
|
migrateSettings(settings);
|
|
settings.setValue("settings_migrated", true);
|
|
}
|
|
|
|
CutterApplication a(argc, argv);
|
|
|
|
if (Config()->getAutoUpdateEnabled()) {
|
|
UpdateWorker *updateWorker = new UpdateWorker;
|
|
QObject::connect(updateWorker, &UpdateWorker::checkComplete,
|
|
[=](const QString & version, const QString & error) {
|
|
if (error == "" && version != CUTTER_VERSION_FULL) {
|
|
updateWorker->showUpdateDialog(true);
|
|
}
|
|
updateWorker->deleteLater();
|
|
});
|
|
updateWorker->checkCurrentVersion(7000);
|
|
}
|
|
|
|
int ret = a.exec();
|
|
|
|
return ret;
|
|
}
|