| 142 | |
| 143 | |
| 144 | IDE::IDE(int& argc, char* argv[]) : QApplication(argc,argv) { |
| 145 | setApplicationVersion(MINIZINC_IDE_VERSION); |
| 146 | setOrganizationName("MiniZinc"); |
| 147 | setOrganizationDomain("minizinc.org"); |
| 148 | #ifdef MINIZINC_IDE_TESTING |
| 149 | setApplicationName("MiniZinc IDE Test Suite"); |
| 150 | TestMocker::resetSettings(); |
| 151 | #elif MINIZINC_IDE_BUNDLED |
| 152 | setApplicationName("MiniZinc IDE (bundled)"); |
| 153 | #else |
| 154 | setApplicationName("MiniZinc IDE"); |
| 155 | #endif |
| 156 | |
| 157 | networkManager = new QNetworkAccessManager(this); |
| 158 | |
| 159 | setAttribute(Qt::AA_UseHighDpiPixmaps); |
| 160 | |
| 161 | QSettings settings; |
| 162 | settings.sync(); |
| 163 | settings.beginGroup("ide"); |
| 164 | if (settings.value("lastCheck21",QString()).toString().isEmpty()) { |
| 165 | settings.setValue("uuid", QUuid::createUuid().toString()); |
| 166 | |
| 167 | CheckUpdateDialog cud; |
| 168 | int result = cud.exec(); |
| 169 | |
| 170 | settings.setValue("lastCheck21",QDate::currentDate().addDays(-2).toString()); |
| 171 | settings.setValue("checkforupdates21",result==QDialog::Accepted); |
| 172 | settings.sync(); |
| 173 | } |
| 174 | bool wordWrap = settings.value("wordWrap", true).toBool(); |
| 175 | settings.endGroup(); |
| 176 | settings.beginGroup("Recent"); |
| 177 | recentFiles = settings.value("files",QStringList()).toStringList(); |
| 178 | recentProjects = settings.value("projects",QStringList()).toStringList(); |
| 179 | settings.endGroup(); |
| 180 | |
| 181 | stats.init(settings.value("statistics")); |
| 182 | |
| 183 | lastDefaultProject = nullptr; |
| 184 | |
| 185 | darkModeNotifier = new DarkModeNotifier(this); |
| 186 | themeManager = new ThemeManager(this); |
| 187 | |
| 188 | { // Load cheat sheet |
| 189 | QString fileContents; |
| 190 | QFile file(":/cheat_sheet.mzn"); |
| 191 | if (file.open(QFile::ReadOnly)) { |
| 192 | fileContents = file.readAll(); |
| 193 | } else { |
| 194 | qDebug() << "internal error: cannot open cheat sheet."; |
| 195 | } |
| 196 | |
| 197 | QSettings settings; |
| 198 | settings.beginGroup("MainWindow"); |
| 199 | |
| 200 | QFont defaultFont; |
| 201 | defaultFont.setFamily("Menlo"); |