| 1 | /* | 
|---|
| 2 | * Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com) | 
|---|
| 3 | * | 
|---|
| 4 | * This program is free software: you can redistribute it and/or modify | 
|---|
| 5 | * it under the terms of the GNU General Public License as published by | 
|---|
| 6 | * the Free Software Foundation, either version 3 of the License, or | 
|---|
| 7 | * (at your option) any later version. | 
|---|
| 8 | * | 
|---|
| 9 | * This program is distributed in the hope that it will be useful, | 
|---|
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 12 | * GNU General Public License for more details. | 
|---|
| 13 | * | 
|---|
| 14 | * You should have received a copy of the GNU General Public License | 
|---|
| 15 | * along with this program.  If not, see <https://www.gnu.org/licenses/>. | 
|---|
| 16 | */ | 
|---|
| 17 | #include "settings.h" | 
|---|
| 18 | #include <QApplication> | 
|---|
| 19 | #include <QTextCodec> | 
|---|
| 20 | #include <algorithm> | 
|---|
| 21 | #include "utils.h" | 
|---|
| 22 | #include <QDir> | 
|---|
| 23 | #include "systemconsts.h" | 
|---|
| 24 | #include <QDebug> | 
|---|
| 25 | #include <QMessageBox> | 
|---|
| 26 | #include <QStandardPaths> | 
|---|
| 27 | #include <QScreen> | 
|---|
| 28 | #include <QDesktopWidget> | 
|---|
| 29 | #include <QHash> | 
|---|
| 30 |  | 
|---|
| 31 | const char ValueToChar[28] = {'0', '1', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', | 
|---|
| 32 | 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', | 
|---|
| 33 | 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}; | 
|---|
| 34 |  | 
|---|
| 35 | Settings* pSettings; | 
|---|
| 36 |  | 
|---|
| 37 | Settings::Settings(const QString &filename): | 
|---|
| 38 | mFilename(filename), | 
|---|
| 39 | mSettings(filename,QSettings::IniFormat), | 
|---|
| 40 | mDirs(this), | 
|---|
| 41 | mEditor(this), | 
|---|
| 42 | mEnvironment(this), | 
|---|
| 43 | mCompilerSets(this), | 
|---|
| 44 | mExecutor(this), | 
|---|
| 45 | mDebugger(this), | 
|---|
| 46 | mCodeCompletion(this), | 
|---|
| 47 | mCodeFormatter(this), | 
|---|
| 48 | mHistory(this), | 
|---|
| 49 | mUI(this), | 
|---|
| 50 | mVCS(this) | 
|---|
| 51 | { | 
|---|
| 52 | //load(); | 
|---|
| 53 | } | 
|---|
| 54 |  | 
|---|
| 55 | Settings::~Settings() | 
|---|
| 56 | { | 
|---|
| 57 | mEditor.save(); | 
|---|
| 58 | } | 
|---|
| 59 |  | 
|---|
| 60 | void Settings::beginGroup(const QString &group) | 
|---|
| 61 | { | 
|---|
| 62 | mSettings.beginGroup(group); | 
|---|
| 63 | } | 
|---|
| 64 |  | 
|---|
| 65 | void Settings::endGroup() | 
|---|
| 66 | { | 
|---|
| 67 | mSettings.endGroup(); | 
|---|
| 68 | } | 
|---|
| 69 |  | 
|---|
| 70 | void Settings::remove(const QString &key) | 
|---|
| 71 | { | 
|---|
| 72 | mSettings.remove(key); | 
|---|
| 73 | } | 
|---|
| 74 |  | 
|---|
| 75 | void Settings::saveValue(const QString& group, const QString &key, const QVariant &value) { | 
|---|
| 76 | mSettings.beginGroup(group); | 
|---|
| 77 | auto act = finally([this] { | 
|---|
| 78 | this->mSettings.endGroup(); | 
|---|
| 79 | }); | 
|---|
| 80 | mSettings.setValue(key,value); | 
|---|
| 81 | } | 
|---|
| 82 |  | 
|---|
| 83 | void Settings::saveValue(const QString &key, const QVariant &value) | 
|---|
| 84 | { | 
|---|
| 85 | mSettings.setValue(key,value); | 
|---|
| 86 | } | 
|---|
| 87 |  | 
|---|
| 88 | QVariant Settings::value(const QString &group, const QString &key, const QVariant &defaultValue) | 
|---|
| 89 | { | 
|---|
| 90 | mSettings.beginGroup(group); | 
|---|
| 91 | auto act = finally([this] { | 
|---|
| 92 | this->mSettings.endGroup(); | 
|---|
| 93 | }); | 
|---|
| 94 | return mSettings.value(key,defaultValue); | 
|---|
| 95 | } | 
|---|
| 96 |  | 
|---|
| 97 | QVariant Settings::value(const QString &key, const QVariant &defaultValue) | 
|---|
| 98 | { | 
|---|
| 99 | return mSettings.value(key,defaultValue); | 
|---|
| 100 | } | 
|---|
| 101 |  | 
|---|
| 102 | void Settings::load() | 
|---|
| 103 | { | 
|---|
| 104 | mCompilerSets.loadSets(); | 
|---|
| 105 | mEnvironment.load(); | 
|---|
| 106 | mEditor.load(); | 
|---|
| 107 | mExecutor.load(); | 
|---|
| 108 | mDebugger.load(); | 
|---|
| 109 | mHistory.load(); | 
|---|
| 110 | mCodeCompletion.load(); | 
|---|
| 111 | mCodeFormatter.load(); | 
|---|
| 112 | mUI.load(); | 
|---|
| 113 | mDirs.load(); | 
|---|
| 114 | mVCS.load(); | 
|---|
| 115 | } | 
|---|
| 116 |  | 
|---|
| 117 | Settings::Dirs &Settings::dirs() | 
|---|
| 118 | { | 
|---|
| 119 | return mDirs; | 
|---|
| 120 | } | 
|---|
| 121 |  | 
|---|
| 122 | Settings::Editor &Settings::editor() | 
|---|
| 123 | { | 
|---|
| 124 | return mEditor; | 
|---|
| 125 | } | 
|---|
| 126 |  | 
|---|
| 127 | Settings::CompilerSets &Settings::compilerSets() | 
|---|
| 128 | { | 
|---|
| 129 | return mCompilerSets; | 
|---|
| 130 | } | 
|---|
| 131 |  | 
|---|
| 132 | Settings::Environment &Settings::environment() | 
|---|
| 133 | { | 
|---|
| 134 | return mEnvironment; | 
|---|
| 135 | } | 
|---|
| 136 |  | 
|---|
| 137 | Settings::Executor &Settings::executor() | 
|---|
| 138 | { | 
|---|
| 139 | return mExecutor; | 
|---|
| 140 | } | 
|---|
| 141 |  | 
|---|
| 142 | QString Settings::filename() const | 
|---|
| 143 | { | 
|---|
| 144 | return mFilename; | 
|---|
| 145 | } | 
|---|
| 146 |  | 
|---|
| 147 | Settings::CodeCompletion& Settings::codeCompletion() | 
|---|
| 148 | { | 
|---|
| 149 | return mCodeCompletion; | 
|---|
| 150 | } | 
|---|
| 151 |  | 
|---|
| 152 | Settings::CodeFormatter &Settings::codeFormatter() | 
|---|
| 153 | { | 
|---|
| 154 | return mCodeFormatter; | 
|---|
| 155 | } | 
|---|
| 156 |  | 
|---|
| 157 | Settings::UI &Settings::ui() | 
|---|
| 158 | { | 
|---|
| 159 | return mUI; | 
|---|
| 160 | } | 
|---|
| 161 |  | 
|---|
| 162 | Settings::VCS &Settings::vcs() | 
|---|
| 163 | { | 
|---|
| 164 | return mVCS; | 
|---|
| 165 | } | 
|---|
| 166 |  | 
|---|
| 167 | Settings::History& Settings::history() | 
|---|
| 168 | { | 
|---|
| 169 | return mHistory; | 
|---|
| 170 | } | 
|---|
| 171 |  | 
|---|
| 172 | Settings::Debugger& Settings::debugger() | 
|---|
| 173 | { | 
|---|
| 174 | return mDebugger; | 
|---|
| 175 | } | 
|---|
| 176 |  | 
|---|
| 177 | Settings::Dirs::Dirs(Settings *settings): | 
|---|
| 178 | _Base(settings, SETTING_DIRS) | 
|---|
| 179 | { | 
|---|
| 180 | } | 
|---|
| 181 |  | 
|---|
| 182 | QString Settings::Dirs::appDir() const | 
|---|
| 183 | { | 
|---|
| 184 | return QApplication::instance()->applicationDirPath(); | 
|---|
| 185 | } | 
|---|
| 186 |  | 
|---|
| 187 | QString Settings::Dirs::appResourceDir() const | 
|---|
| 188 | { | 
|---|
| 189 | #ifdef Q_OS_WIN | 
|---|
| 190 | return appDir(); | 
|---|
| 191 | #elif defined(Q_OS_LINUX) | 
|---|
| 192 | return includeTrailingPathDelimiter(PREFIX)+ "share/"+APP_NAME; | 
|---|
| 193 | #elif defined(Q_OS_MACOS) | 
|---|
| 194 | //    return QApplication::instance()->applicationDirPath(); | 
|---|
| 195 | return ""; | 
|---|
| 196 | #endif | 
|---|
| 197 | } | 
|---|
| 198 |  | 
|---|
| 199 |  | 
|---|
| 200 | QString Settings::Dirs::appLibexecDir() const | 
|---|
| 201 | { | 
|---|
| 202 | #ifdef Q_OS_WIN | 
|---|
| 203 | return appDir(); | 
|---|
| 204 | #elif defined(Q_OS_LINUX) | 
|---|
| 205 | return includeTrailingPathDelimiter(PREFIX)+ "libexec/"+APP_NAME; | 
|---|
| 206 | #elif defined(Q_OS_MACOS) | 
|---|
| 207 | return QApplication::instance()->applicationDirPath(); | 
|---|
| 208 | #endif | 
|---|
| 209 | } | 
|---|
| 210 |  | 
|---|
| 211 | QString Settings::Dirs::projectDir() const | 
|---|
| 212 | { | 
|---|
| 213 | return mProjectDir; | 
|---|
| 214 | } | 
|---|
| 215 |  | 
|---|
| 216 | QString Settings::Dirs::data(Settings::Dirs::DataType dataType) const | 
|---|
| 217 | { | 
|---|
| 218 | using DataType = Settings::Dirs::DataType; | 
|---|
| 219 | QString dataDir = includeTrailingPathDelimiter(appDir())+ "data"; | 
|---|
| 220 | switch (dataType) { | 
|---|
| 221 | case DataType::None: | 
|---|
| 222 | return dataDir; | 
|---|
| 223 | case DataType::ColorScheme: | 
|---|
| 224 | return ":/colorschemes/colorschemes"; | 
|---|
| 225 | case DataType::IconSet: | 
|---|
| 226 | return ":/resources/iconsets"; | 
|---|
| 227 | case DataType::Theme: | 
|---|
| 228 | return ":/themes"; | 
|---|
| 229 | case DataType::Template: | 
|---|
| 230 | return includeTrailingPathDelimiter(appResourceDir()) + "templates"; | 
|---|
| 231 | } | 
|---|
| 232 | return ""; | 
|---|
| 233 | } | 
|---|
| 234 |  | 
|---|
| 235 | QString Settings::Dirs::config(Settings::Dirs::DataType dataType) const | 
|---|
| 236 | { | 
|---|
| 237 | using DataType = Settings::Dirs::DataType; | 
|---|
| 238 | QFileInfo configFile(pSettings->filename()); | 
|---|
| 239 | QString configDir = configFile.path(); | 
|---|
| 240 | switch (dataType) { | 
|---|
| 241 | case DataType::None: | 
|---|
| 242 | return configDir; | 
|---|
| 243 | case DataType::ColorScheme: | 
|---|
| 244 | return includeTrailingPathDelimiter(configDir)+ "scheme"; | 
|---|
| 245 | case DataType::IconSet: | 
|---|
| 246 | return includeTrailingPathDelimiter(configDir)+ "iconsets"; | 
|---|
| 247 | case DataType::Theme: | 
|---|
| 248 | return includeTrailingPathDelimiter(configDir)+ "themes"; | 
|---|
| 249 | case DataType::Template: | 
|---|
| 250 | return includeTrailingPathDelimiter(configDir) + "templates"; | 
|---|
| 251 | } | 
|---|
| 252 | return ""; | 
|---|
| 253 | } | 
|---|
| 254 |  | 
|---|
| 255 | QString Settings::Dirs::executable() const | 
|---|
| 256 | { | 
|---|
| 257 | QString s = QApplication::instance()->applicationFilePath(); | 
|---|
| 258 | s.replace( "/",QDir::separator()); | 
|---|
| 259 | return s; | 
|---|
| 260 | } | 
|---|
| 261 |  | 
|---|
| 262 | void Settings::Dirs::doSave() | 
|---|
| 263 | { | 
|---|
| 264 | saveValue( "projectDir",mProjectDir); | 
|---|
| 265 | } | 
|---|
| 266 |  | 
|---|
| 267 | void Settings::Dirs::doLoad() | 
|---|
| 268 | { | 
|---|
| 269 | QString defaultProjectDir; | 
|---|
| 270 | if (isGreenEdition()) { | 
|---|
| 271 | defaultProjectDir = includeTrailingPathDelimiter(appDir()) + "projects"; | 
|---|
| 272 | } else { | 
|---|
| 273 | defaultProjectDir = includeTrailingPathDelimiter(QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation)[0]) | 
|---|
| 274 | + "projects"; | 
|---|
| 275 | } | 
|---|
| 276 | mProjectDir = stringValue( "projectDir",defaultProjectDir); | 
|---|
| 277 | } | 
|---|
| 278 |  | 
|---|
| 279 | void Settings::Dirs::setProjectDir(const QString &newProjectDir) | 
|---|
| 280 | { | 
|---|
| 281 | mProjectDir = newProjectDir; | 
|---|
| 282 | } | 
|---|
| 283 |  | 
|---|
| 284 | Settings::_Base::_Base(Settings *settings, const QString &groupName): | 
|---|
| 285 | mSettings(settings), | 
|---|
| 286 | mGroup(groupName) | 
|---|
| 287 | { | 
|---|
| 288 |  | 
|---|
| 289 | } | 
|---|
| 290 |  | 
|---|
| 291 | void Settings::_Base::beginGroup() | 
|---|
| 292 | { | 
|---|
| 293 | mSettings->beginGroup(mGroup); | 
|---|
| 294 | } | 
|---|
| 295 |  | 
|---|
| 296 | void Settings::_Base::endGroup() | 
|---|
| 297 | { | 
|---|
| 298 | mSettings->endGroup(); | 
|---|
| 299 | } | 
|---|
| 300 |  | 
|---|
| 301 | void Settings::_Base::remove(const QString &key) | 
|---|
| 302 | { | 
|---|
| 303 | mSettings->remove(key); | 
|---|
| 304 | } | 
|---|
| 305 |  | 
|---|
| 306 | void Settings::_Base::saveValue(const QString &key, const QVariant &value) | 
|---|
| 307 | { | 
|---|
| 308 | mSettings->saveValue(key,value); | 
|---|
| 309 | } | 
|---|
| 310 |  | 
|---|
| 311 | QVariant Settings::_Base::value(const QString &key, const QVariant &defaultValue) | 
|---|
| 312 | { | 
|---|
| 313 | return mSettings->value(key,defaultValue); | 
|---|
| 314 | } | 
|---|
| 315 |  | 
|---|
| 316 | bool Settings::_Base::boolValue(const QString &key, bool defaultValue) | 
|---|
| 317 | { | 
|---|
| 318 | return value(key,defaultValue).toBool(); | 
|---|
| 319 | } | 
|---|
| 320 |  | 
|---|
| 321 | QSize Settings::_Base::sizeValue(const QString &key) | 
|---|
| 322 | { | 
|---|
| 323 | return value(key,QSize()).toSize(); | 
|---|
| 324 | } | 
|---|
| 325 |  | 
|---|
| 326 | int Settings::_Base::intValue(const QString &key, int defaultValue) | 
|---|
| 327 | { | 
|---|
| 328 | return value(key,defaultValue).toInt(); | 
|---|
| 329 | } | 
|---|
| 330 |  | 
|---|
| 331 | QStringList Settings::_Base::stringListValue(const QString &key, const QStringList &defaultValue) | 
|---|
| 332 | { | 
|---|
| 333 | return value(key,defaultValue).toStringList(); | 
|---|
| 334 | } | 
|---|
| 335 |  | 
|---|
| 336 | QColor Settings::_Base::colorValue(const QString &key, const QColor& defaultValue) | 
|---|
| 337 | { | 
|---|
| 338 | return value(key,defaultValue).value<QColor>(); | 
|---|
| 339 | } | 
|---|
| 340 |  | 
|---|
| 341 | QString Settings::_Base::stringValue(const QString &key, const QString& defaultValue) | 
|---|
| 342 | { | 
|---|
| 343 | return value(key,defaultValue).toString(); | 
|---|
| 344 | } | 
|---|
| 345 |  | 
|---|
| 346 | void Settings::_Base::save() | 
|---|
| 347 | { | 
|---|
| 348 | beginGroup(); | 
|---|
| 349 | doSave(); | 
|---|
| 350 | endGroup(); | 
|---|
| 351 | } | 
|---|
| 352 |  | 
|---|
| 353 | void Settings::_Base::load() | 
|---|
| 354 | { | 
|---|
| 355 | beginGroup(); | 
|---|
| 356 | doLoad(); | 
|---|
| 357 | endGroup(); | 
|---|
| 358 | } | 
|---|
| 359 |  | 
|---|
| 360 | Settings::Editor::Editor(Settings *settings): _Base(settings, SETTING_EDITOR) | 
|---|
| 361 | { | 
|---|
| 362 |  | 
|---|
| 363 | } | 
|---|
| 364 |  | 
|---|
| 365 | QByteArray Settings::Editor::defaultEncoding() | 
|---|
| 366 | { | 
|---|
| 367 | return mDefaultEncoding; | 
|---|
| 368 | } | 
|---|
| 369 |  | 
|---|
| 370 | void Settings::Editor::setDefaultEncoding(const QByteArray &value) | 
|---|
| 371 | { | 
|---|
| 372 | mDefaultEncoding = value; | 
|---|
| 373 | } | 
|---|
| 374 |  | 
|---|
| 375 | bool Settings::Editor::autoIndent() | 
|---|
| 376 | { | 
|---|
| 377 | return mAutoIndent; | 
|---|
| 378 | } | 
|---|
| 379 |  | 
|---|
| 380 | void Settings::Editor::setAutoIndent(bool value) | 
|---|
| 381 | { | 
|---|
| 382 | mAutoIndent = value; | 
|---|
| 383 | } | 
|---|
| 384 |  | 
|---|
| 385 | QColor Settings::Editor::caretColor() const | 
|---|
| 386 | { | 
|---|
| 387 | return mCaretColor; | 
|---|
| 388 | } | 
|---|
| 389 |  | 
|---|
| 390 | void Settings::Editor::setCaretColor(const QColor &caretColor) | 
|---|
| 391 | { | 
|---|
| 392 | mCaretColor = caretColor; | 
|---|
| 393 | } | 
|---|
| 394 |  | 
|---|
| 395 | bool Settings::Editor::keepCaretX() const | 
|---|
| 396 | { | 
|---|
| 397 | return mKeepCaretX; | 
|---|
| 398 | } | 
|---|
| 399 |  | 
|---|
| 400 | void Settings::Editor::setKeepCaretX(bool keepCaretX) | 
|---|
| 401 | { | 
|---|
| 402 | mKeepCaretX = keepCaretX; | 
|---|
| 403 | } | 
|---|
| 404 |  | 
|---|
| 405 | bool Settings::Editor::halfPageScroll() const | 
|---|
| 406 | { | 
|---|
| 407 | return mHalfPageScroll; | 
|---|
| 408 | } | 
|---|
| 409 |  | 
|---|
| 410 | void Settings::Editor::setHalfPageScroll(bool halfPageScroll) | 
|---|
| 411 | { | 
|---|
| 412 | mHalfPageScroll = halfPageScroll; | 
|---|
| 413 | } | 
|---|
| 414 |  | 
|---|
| 415 | bool Settings::Editor::gutterFontOnlyMonospaced() const | 
|---|
| 416 | { | 
|---|
| 417 | return mGutterFontOnlyMonospaced; | 
|---|
| 418 | } | 
|---|
| 419 |  | 
|---|
| 420 | void Settings::Editor::setGutterFontOnlyMonospaced(bool gutterFontOnlyMonospaced) | 
|---|
| 421 | { | 
|---|
| 422 | mGutterFontOnlyMonospaced = gutterFontOnlyMonospaced; | 
|---|
| 423 | } | 
|---|
| 424 |  | 
|---|
| 425 | int Settings::Editor::gutterRightOffset() const | 
|---|
| 426 | { | 
|---|
| 427 | return mGutterRightOffset; | 
|---|
| 428 | } | 
|---|
| 429 |  | 
|---|
| 430 | void Settings::Editor::setGutterRightOffset(int gutterRightOffset) | 
|---|
| 431 | { | 
|---|
| 432 | mGutterRightOffset = gutterRightOffset; | 
|---|
| 433 | } | 
|---|
| 434 |  | 
|---|
| 435 | int Settings::Editor::copyWithFormatAs() const | 
|---|
| 436 | { | 
|---|
| 437 | return mCopyWithFormatAs; | 
|---|
| 438 | } | 
|---|
| 439 |  | 
|---|
| 440 | void Settings::Editor::setCopyWithFormatAs(int copyWithFormatAs) | 
|---|
| 441 | { | 
|---|
| 442 | mCopyWithFormatAs = copyWithFormatAs; | 
|---|
| 443 | } | 
|---|
| 444 |  | 
|---|
| 445 | QString Settings::Editor::colorScheme() const | 
|---|
| 446 | { | 
|---|
| 447 | return mColorScheme; | 
|---|
| 448 | } | 
|---|
| 449 |  | 
|---|
| 450 | void Settings::Editor::setColorScheme(const QString &colorScheme) | 
|---|
| 451 | { | 
|---|
| 452 | mColorScheme = colorScheme; | 
|---|
| 453 | } | 
|---|
| 454 |  | 
|---|
| 455 | bool Settings::Editor::removeSymbolPairs() const | 
|---|
| 456 | { | 
|---|
| 457 | return mRemoveSymbolPairs; | 
|---|
| 458 | } | 
|---|
| 459 |  | 
|---|
| 460 | void Settings::Editor::setRemoveSymbolPairs(bool value) | 
|---|
| 461 | { | 
|---|
| 462 | mRemoveSymbolPairs = value; | 
|---|
| 463 | } | 
|---|
| 464 |  | 
|---|
| 465 | bool Settings::Editor::syntaxCheckWhenLineChanged() const | 
|---|
| 466 | { | 
|---|
| 467 | return mSyntaxCheckWhenLineChanged; | 
|---|
| 468 | } | 
|---|
| 469 |  | 
|---|
| 470 | void Settings::Editor::setSyntaxCheckWhenLineChanged(bool syntaxCheckWhenLineChanged) | 
|---|
| 471 | { | 
|---|
| 472 | mSyntaxCheckWhenLineChanged = syntaxCheckWhenLineChanged; | 
|---|
| 473 | } | 
|---|
| 474 |  | 
|---|
| 475 | bool Settings::Editor::() const | 
|---|
| 476 | { | 
|---|
| 477 | return mReadOnlySytemHeader; | 
|---|
| 478 | } | 
|---|
| 479 |  | 
|---|
| 480 | void Settings::Editor::(bool ) | 
|---|
| 481 | { | 
|---|
| 482 | mReadOnlySytemHeader = newReadOnlySytemHeader; | 
|---|
| 483 | } | 
|---|
| 484 |  | 
|---|
| 485 | bool Settings::Editor::defaultFileCpp() const | 
|---|
| 486 | { | 
|---|
| 487 | return mDefaultFileCpp; | 
|---|
| 488 | } | 
|---|
| 489 |  | 
|---|
| 490 | void Settings::Editor::setDefaultFileCpp(bool newDefaultFileCpp) | 
|---|
| 491 | { | 
|---|
| 492 | mDefaultFileCpp = newDefaultFileCpp; | 
|---|
| 493 | } | 
|---|
| 494 |  | 
|---|
| 495 | bool Settings::Editor::enableAutoSave() const | 
|---|
| 496 | { | 
|---|
| 497 | return mEnableAutoSave; | 
|---|
| 498 | } | 
|---|
| 499 |  | 
|---|
| 500 | void Settings::Editor::setEnableAutoSave(bool newEnableAutoSave) | 
|---|
| 501 | { | 
|---|
| 502 | mEnableAutoSave = newEnableAutoSave; | 
|---|
| 503 | } | 
|---|
| 504 |  | 
|---|
| 505 | int Settings::Editor::autoSaveInterval() const | 
|---|
| 506 | { | 
|---|
| 507 | return mAutoSaveInterval; | 
|---|
| 508 | } | 
|---|
| 509 |  | 
|---|
| 510 | void Settings::Editor::setAutoSaveInterval(int newInterval) | 
|---|
| 511 | { | 
|---|
| 512 | mAutoSaveInterval = newInterval; | 
|---|
| 513 | } | 
|---|
| 514 |  | 
|---|
| 515 | AutoSaveStrategy Settings::Editor::autoSaveStrategy() const | 
|---|
| 516 | { | 
|---|
| 517 | return mAutoSaveStrategy; | 
|---|
| 518 | } | 
|---|
| 519 |  | 
|---|
| 520 | void Settings::Editor::setAutoSaveStrategy(AutoSaveStrategy newAutoSaveStrategy) | 
|---|
| 521 | { | 
|---|
| 522 | mAutoSaveStrategy = newAutoSaveStrategy; | 
|---|
| 523 | } | 
|---|
| 524 |  | 
|---|
| 525 | bool Settings::Editor::enableAutolink() const | 
|---|
| 526 | { | 
|---|
| 527 | return mEnableAutolink; | 
|---|
| 528 | } | 
|---|
| 529 |  | 
|---|
| 530 | void Settings::Editor::setEnableAutolink(bool newEnableAutolink) | 
|---|
| 531 | { | 
|---|
| 532 | mEnableAutolink = newEnableAutolink; | 
|---|
| 533 | } | 
|---|
| 534 |  | 
|---|
| 535 | const QColor &Settings::Editor::rightEdgeLineColor() const | 
|---|
| 536 | { | 
|---|
| 537 | return mRightEdgeLineColor; | 
|---|
| 538 | } | 
|---|
| 539 |  | 
|---|
| 540 | void Settings::Editor::setRightEdgeLineColor(const QColor &newRightMarginLineColor) | 
|---|
| 541 | { | 
|---|
| 542 | mRightEdgeLineColor = newRightMarginLineColor; | 
|---|
| 543 | } | 
|---|
| 544 |  | 
|---|
| 545 | bool Settings::Editor::caretUseTextColor() const | 
|---|
| 546 | { | 
|---|
| 547 | return mCaretUseTextColor; | 
|---|
| 548 | } | 
|---|
| 549 |  | 
|---|
| 550 | void Settings::Editor::setCaretUseTextColor(bool newUseIdentifierColor) | 
|---|
| 551 | { | 
|---|
| 552 | mCaretUseTextColor = newUseIdentifierColor; | 
|---|
| 553 | } | 
|---|
| 554 |  | 
|---|
| 555 | bool Settings::Editor::rainbowParenthesis() const | 
|---|
| 556 | { | 
|---|
| 557 | return mRainbowParenthesis; | 
|---|
| 558 | } | 
|---|
| 559 |  | 
|---|
| 560 | void Settings::Editor::setRainbowParenthesis(bool newRainbowParenthesis) | 
|---|
| 561 | { | 
|---|
| 562 | mRainbowParenthesis = newRainbowParenthesis; | 
|---|
| 563 | } | 
|---|
| 564 |  | 
|---|
| 565 | bool Settings::Editor::showFunctionTips() const | 
|---|
| 566 | { | 
|---|
| 567 | return mShowFunctionTips; | 
|---|
| 568 | } | 
|---|
| 569 |  | 
|---|
| 570 | void Settings::Editor::setShowFunctionTips(bool newShowFunctionTips) | 
|---|
| 571 | { | 
|---|
| 572 | mShowFunctionTips = newShowFunctionTips; | 
|---|
| 573 | } | 
|---|
| 574 |  | 
|---|
| 575 | bool Settings::Editor::fillIndents() const | 
|---|
| 576 | { | 
|---|
| 577 | return mfillIndents; | 
|---|
| 578 | } | 
|---|
| 579 |  | 
|---|
| 580 | void Settings::Editor::setFillIndents(bool newFillIndents) | 
|---|
| 581 | { | 
|---|
| 582 | mfillIndents = newFillIndents; | 
|---|
| 583 | } | 
|---|
| 584 |  | 
|---|
| 585 | int Settings::Editor::mouseWheelScrollSpeed() const | 
|---|
| 586 | { | 
|---|
| 587 | return mMouseWheelScrollSpeed; | 
|---|
| 588 | } | 
|---|
| 589 |  | 
|---|
| 590 | void Settings::Editor::setMouseWheelScrollSpeed(int newMouseWheelScrollSpeed) | 
|---|
| 591 | { | 
|---|
| 592 | mMouseWheelScrollSpeed = newMouseWheelScrollSpeed; | 
|---|
| 593 | } | 
|---|
| 594 |  | 
|---|
| 595 | bool Settings::Editor::highlightMathingBraces() const | 
|---|
| 596 | { | 
|---|
| 597 | return mHighlightMathingBraces; | 
|---|
| 598 | } | 
|---|
| 599 |  | 
|---|
| 600 | void Settings::Editor::setHighlightMathingBraces(bool newHighlightMathingBraces) | 
|---|
| 601 | { | 
|---|
| 602 | mHighlightMathingBraces = newHighlightMathingBraces; | 
|---|
| 603 | } | 
|---|
| 604 |  | 
|---|
| 605 | bool Settings::Editor::enableLigaturesSupport() const | 
|---|
| 606 | { | 
|---|
| 607 | return mEnableLigaturesSupport; | 
|---|
| 608 | } | 
|---|
| 609 |  | 
|---|
| 610 | void Settings::Editor::setEnableLigaturesSupport(bool newEnableLigaturesSupport) | 
|---|
| 611 | { | 
|---|
| 612 | mEnableLigaturesSupport = newEnableLigaturesSupport; | 
|---|
| 613 | } | 
|---|
| 614 |  | 
|---|
| 615 | const QString &Settings::Editor::nonAsciiFontName() const | 
|---|
| 616 | { | 
|---|
| 617 | return mNonAsciiFontName; | 
|---|
| 618 | } | 
|---|
| 619 |  | 
|---|
| 620 | void Settings::Editor::setNonAsciiFontName(const QString &newNonAsciiFontName) | 
|---|
| 621 | { | 
|---|
| 622 | mNonAsciiFontName = newNonAsciiFontName; | 
|---|
| 623 | } | 
|---|
| 624 |  | 
|---|
| 625 | int Settings::Editor::mouseSelectionScrollSpeed() const | 
|---|
| 626 | { | 
|---|
| 627 | return mMouseSelectionScrollSpeed; | 
|---|
| 628 | } | 
|---|
| 629 |  | 
|---|
| 630 | void Settings::Editor::setMouseSelectionScrollSpeed(int newMouseSelectionScrollSpeed) | 
|---|
| 631 | { | 
|---|
| 632 | mMouseSelectionScrollSpeed = newMouseSelectionScrollSpeed; | 
|---|
| 633 | } | 
|---|
| 634 |  | 
|---|
| 635 | bool Settings::Editor::autoDetectFileEncoding() const | 
|---|
| 636 | { | 
|---|
| 637 | return mAutoDetectFileEncoding; | 
|---|
| 638 | } | 
|---|
| 639 |  | 
|---|
| 640 | void Settings::Editor::setAutoDetectFileEncoding(bool newAutoDetectFileEncoding) | 
|---|
| 641 | { | 
|---|
| 642 | mAutoDetectFileEncoding = newAutoDetectFileEncoding; | 
|---|
| 643 | } | 
|---|
| 644 |  | 
|---|
| 645 | int Settings::Editor::undoLimit() const | 
|---|
| 646 | { | 
|---|
| 647 | return mUndoLimit; | 
|---|
| 648 | } | 
|---|
| 649 |  | 
|---|
| 650 | void Settings::Editor::setUndoLimit(int newUndoLimit) | 
|---|
| 651 | { | 
|---|
| 652 | mUndoLimit = newUndoLimit; | 
|---|
| 653 | } | 
|---|
| 654 |  | 
|---|
| 655 | bool Settings::Editor::highlightCurrentWord() const | 
|---|
| 656 | { | 
|---|
| 657 | return mHighlightCurrentWord; | 
|---|
| 658 | } | 
|---|
| 659 |  | 
|---|
| 660 | void Settings::Editor::setHighlightCurrentWord(bool newHighlightCurrentWord) | 
|---|
| 661 | { | 
|---|
| 662 | mHighlightCurrentWord = newHighlightCurrentWord; | 
|---|
| 663 | } | 
|---|
| 664 |  | 
|---|
| 665 | bool Settings::Editor::enableTooltips() const | 
|---|
| 666 | { | 
|---|
| 667 | return mEnableTooltips; | 
|---|
| 668 | } | 
|---|
| 669 |  | 
|---|
| 670 | void Settings::Editor::setEnableTooltips(bool newEnableTooltips) | 
|---|
| 671 | { | 
|---|
| 672 | mEnableTooltips = newEnableTooltips; | 
|---|
| 673 | } | 
|---|
| 674 |  | 
|---|
| 675 | bool Settings::Editor::enableDebugTooltips() const | 
|---|
| 676 | { | 
|---|
| 677 | return mEnableDebugTooltips; | 
|---|
| 678 | } | 
|---|
| 679 |  | 
|---|
| 680 | void Settings::Editor::setEnableDebugTooltips(bool newEnableDebugTooltips) | 
|---|
| 681 | { | 
|---|
| 682 | mEnableDebugTooltips = newEnableDebugTooltips; | 
|---|
| 683 | } | 
|---|
| 684 |  | 
|---|
| 685 | bool Settings::Editor::enableIdentifierToolTips() const | 
|---|
| 686 | { | 
|---|
| 687 | return mEnableIdentifierToolTips; | 
|---|
| 688 | } | 
|---|
| 689 |  | 
|---|
| 690 | void Settings::Editor::setEnableIdentifierToolTips(bool newEnableIdentifierToolTips) | 
|---|
| 691 | { | 
|---|
| 692 | mEnableIdentifierToolTips = newEnableIdentifierToolTips; | 
|---|
| 693 | } | 
|---|
| 694 |  | 
|---|
| 695 | bool Settings::Editor::() const | 
|---|
| 696 | { | 
|---|
| 697 | return mEnableHeaderToolTips; | 
|---|
| 698 | } | 
|---|
| 699 |  | 
|---|
| 700 | void Settings::Editor::(bool ) | 
|---|
| 701 | { | 
|---|
| 702 | mEnableHeaderToolTips = newEnableHeaderToolTips; | 
|---|
| 703 | } | 
|---|
| 704 |  | 
|---|
| 705 | bool Settings::Editor::enableIssueToolTips() const | 
|---|
| 706 | { | 
|---|
| 707 | return mEnableIssueToolTips; | 
|---|
| 708 | } | 
|---|
| 709 |  | 
|---|
| 710 | void Settings::Editor::setEnableIssueToolTips(bool newEnableIssueToolTips) | 
|---|
| 711 | { | 
|---|
| 712 | mEnableIssueToolTips = newEnableIssueToolTips; | 
|---|
| 713 | } | 
|---|
| 714 |  | 
|---|
| 715 | int Settings::Editor::rightEdgeWidth() const | 
|---|
| 716 | { | 
|---|
| 717 | return mRightEdgeWidth; | 
|---|
| 718 | } | 
|---|
| 719 |  | 
|---|
| 720 | void Settings::Editor::setRightEdgeWidth(int newRightMarginWidth) | 
|---|
| 721 | { | 
|---|
| 722 | mRightEdgeWidth = newRightMarginWidth; | 
|---|
| 723 | } | 
|---|
| 724 |  | 
|---|
| 725 | bool Settings::Editor::showRightEdgeLine() const | 
|---|
| 726 | { | 
|---|
| 727 | return mShowRightEdgeLine; | 
|---|
| 728 | } | 
|---|
| 729 |  | 
|---|
| 730 | void Settings::Editor::setShowRightEdgeLine(bool newShowRightMarginLine) | 
|---|
| 731 | { | 
|---|
| 732 | mShowRightEdgeLine = newShowRightMarginLine; | 
|---|
| 733 | } | 
|---|
| 734 |  | 
|---|
| 735 | AutoSaveTarget Settings::Editor::autoSaveTarget() const | 
|---|
| 736 | { | 
|---|
| 737 | return mAutoSaveTarget; | 
|---|
| 738 | } | 
|---|
| 739 |  | 
|---|
| 740 | void Settings::Editor::setAutoSaveTarget(AutoSaveTarget newAutoSaveTarget) | 
|---|
| 741 | { | 
|---|
| 742 | mAutoSaveTarget = newAutoSaveTarget; | 
|---|
| 743 | } | 
|---|
| 744 |  | 
|---|
| 745 | bool Settings::Editor::autoLoadLastFiles() const | 
|---|
| 746 | { | 
|---|
| 747 | return mAutoLoadLastFiles; | 
|---|
| 748 | } | 
|---|
| 749 |  | 
|---|
| 750 | void Settings::Editor::setAutoLoadLastFiles(bool newAutoLoadLastFiles) | 
|---|
| 751 | { | 
|---|
| 752 | mAutoLoadLastFiles = newAutoLoadLastFiles; | 
|---|
| 753 | } | 
|---|
| 754 |  | 
|---|
| 755 | bool Settings::Editor::syntaxCheckWhenSave() const | 
|---|
| 756 | { | 
|---|
| 757 | return mSyntaxCheckWhenSave; | 
|---|
| 758 | } | 
|---|
| 759 |  | 
|---|
| 760 | void Settings::Editor::setSyntaxCheckWhenSave(bool syntaxCheckWhenSave) | 
|---|
| 761 | { | 
|---|
| 762 | mSyntaxCheckWhenSave = syntaxCheckWhenSave; | 
|---|
| 763 | } | 
|---|
| 764 |  | 
|---|
| 765 | bool Settings::Editor::syntaxCheck() const | 
|---|
| 766 | { | 
|---|
| 767 | return mSyntaxCheck; | 
|---|
| 768 | } | 
|---|
| 769 |  | 
|---|
| 770 | void Settings::Editor::setSyntaxCheck(bool syntaxCheck) | 
|---|
| 771 | { | 
|---|
| 772 | mSyntaxCheck = syntaxCheck; | 
|---|
| 773 | } | 
|---|
| 774 |  | 
|---|
| 775 | bool Settings::Editor::overwriteSymbols() const | 
|---|
| 776 | { | 
|---|
| 777 | return mOverwriteSymbols; | 
|---|
| 778 | } | 
|---|
| 779 |  | 
|---|
| 780 | void Settings::Editor::setOverwriteSymbols(bool overwriteSymbols) | 
|---|
| 781 | { | 
|---|
| 782 | mOverwriteSymbols = overwriteSymbols; | 
|---|
| 783 | } | 
|---|
| 784 |  | 
|---|
| 785 | bool Settings::Editor::completeGlobalInclude() const | 
|---|
| 786 | { | 
|---|
| 787 | return mCompleteGlobalInclude; | 
|---|
| 788 | } | 
|---|
| 789 |  | 
|---|
| 790 | void Settings::Editor::setCompleteGlobalInclude(bool completeGlobalInclude) | 
|---|
| 791 | { | 
|---|
| 792 | mCompleteGlobalInclude = completeGlobalInclude; | 
|---|
| 793 | } | 
|---|
| 794 |  | 
|---|
| 795 | bool Settings::Editor::completeDoubleQuote() const | 
|---|
| 796 | { | 
|---|
| 797 | return mCompleteDoubleQuote; | 
|---|
| 798 | } | 
|---|
| 799 |  | 
|---|
| 800 | void Settings::Editor::setCompleteDoubleQuote(bool completeDoubleQuote) | 
|---|
| 801 | { | 
|---|
| 802 | mCompleteDoubleQuote = completeDoubleQuote; | 
|---|
| 803 | } | 
|---|
| 804 |  | 
|---|
| 805 | bool Settings::Editor::completeSingleQuote() const | 
|---|
| 806 | { | 
|---|
| 807 | return mCompleteSingleQuote; | 
|---|
| 808 | } | 
|---|
| 809 |  | 
|---|
| 810 | void Settings::Editor::setCompleteSingleQuote(bool completeSingleQuote) | 
|---|
| 811 | { | 
|---|
| 812 | mCompleteSingleQuote = completeSingleQuote; | 
|---|
| 813 | } | 
|---|
| 814 |  | 
|---|
| 815 | bool Settings::Editor::() const | 
|---|
| 816 | { | 
|---|
| 817 | return mCompleteComment; | 
|---|
| 818 | } | 
|---|
| 819 |  | 
|---|
| 820 | void Settings::Editor::(bool ) | 
|---|
| 821 | { | 
|---|
| 822 | mCompleteComment = completeComment; | 
|---|
| 823 | } | 
|---|
| 824 |  | 
|---|
| 825 | bool Settings::Editor::completeBrace() const | 
|---|
| 826 | { | 
|---|
| 827 | return mCompleteBrace; | 
|---|
| 828 | } | 
|---|
| 829 |  | 
|---|
| 830 | void Settings::Editor::setCompleteBrace(bool completeBrace) | 
|---|
| 831 | { | 
|---|
| 832 | mCompleteBrace = completeBrace; | 
|---|
| 833 | } | 
|---|
| 834 |  | 
|---|
| 835 | bool Settings::Editor::completeBracket() const | 
|---|
| 836 | { | 
|---|
| 837 | return mCompleteBracket; | 
|---|
| 838 | } | 
|---|
| 839 |  | 
|---|
| 840 | void Settings::Editor::setCompleteBracket(bool completeBracket) | 
|---|
| 841 | { | 
|---|
| 842 | mCompleteBracket = completeBracket; | 
|---|
| 843 | } | 
|---|
| 844 |  | 
|---|
| 845 | bool Settings::Editor::completeParenthese() const | 
|---|
| 846 | { | 
|---|
| 847 | return mCompleteParenthese; | 
|---|
| 848 | } | 
|---|
| 849 |  | 
|---|
| 850 | void Settings::Editor::setCompleteParenthese(bool completeParenthese) | 
|---|
| 851 | { | 
|---|
| 852 | mCompleteParenthese = completeParenthese; | 
|---|
| 853 | } | 
|---|
| 854 |  | 
|---|
| 855 | bool Settings::Editor::completeSymbols() const | 
|---|
| 856 | { | 
|---|
| 857 | return mCompleteSymbols; | 
|---|
| 858 | } | 
|---|
| 859 |  | 
|---|
| 860 | void Settings::Editor::setCompleteSymbols(bool completeSymbols) | 
|---|
| 861 | { | 
|---|
| 862 | mCompleteSymbols = completeSymbols; | 
|---|
| 863 | } | 
|---|
| 864 |  | 
|---|
| 865 | QString Settings::Editor::copyHTMLColorScheme() const | 
|---|
| 866 | { | 
|---|
| 867 | return mCopyHTMLColorScheme; | 
|---|
| 868 | } | 
|---|
| 869 |  | 
|---|
| 870 | void Settings::Editor::setCopyHTMLColorScheme(const QString ©HTMLColorScheme) | 
|---|
| 871 | { | 
|---|
| 872 | mCopyHTMLColorScheme = copyHTMLColorScheme; | 
|---|
| 873 | } | 
|---|
| 874 |  | 
|---|
| 875 | bool Settings::Editor::copyHTMLUseEditorColor() const | 
|---|
| 876 | { | 
|---|
| 877 | return mCopyHTMLUseEditorColor; | 
|---|
| 878 | } | 
|---|
| 879 |  | 
|---|
| 880 | void Settings::Editor::setCopyHTMLUseEditorColor(bool copyHTMLUseEditorColor) | 
|---|
| 881 | { | 
|---|
| 882 | mCopyHTMLUseEditorColor = copyHTMLUseEditorColor; | 
|---|
| 883 | } | 
|---|
| 884 |  | 
|---|
| 885 | bool Settings::Editor::copyHTMLUseBackground() const | 
|---|
| 886 | { | 
|---|
| 887 | return mCopyHTMLUseBackground; | 
|---|
| 888 | } | 
|---|
| 889 |  | 
|---|
| 890 | void Settings::Editor::setCopyHTMLUseBackground(bool copyHTMLUseBackground) | 
|---|
| 891 | { | 
|---|
| 892 | mCopyHTMLUseBackground = copyHTMLUseBackground; | 
|---|
| 893 | } | 
|---|
| 894 |  | 
|---|
| 895 | QString Settings::Editor::copyRTFColorScheme() const | 
|---|
| 896 | { | 
|---|
| 897 | return mCopyRTFColorScheme; | 
|---|
| 898 | } | 
|---|
| 899 |  | 
|---|
| 900 | void Settings::Editor::setCopyRTFColorScheme(const QString ©RTFColorScheme) | 
|---|
| 901 | { | 
|---|
| 902 | mCopyRTFColorScheme = copyRTFColorScheme; | 
|---|
| 903 | } | 
|---|
| 904 |  | 
|---|
| 905 | bool Settings::Editor::copyRTFUseEditorColor() const | 
|---|
| 906 | { | 
|---|
| 907 | return mCopyRTFUseEditorColor; | 
|---|
| 908 | } | 
|---|
| 909 |  | 
|---|
| 910 | void Settings::Editor::setCopyRTFUseEditorColor(bool copyRTFUseEditorColor) | 
|---|
| 911 | { | 
|---|
| 912 | mCopyRTFUseEditorColor = copyRTFUseEditorColor; | 
|---|
| 913 | } | 
|---|
| 914 |  | 
|---|
| 915 | bool Settings::Editor::copyRTFUseBackground() const | 
|---|
| 916 | { | 
|---|
| 917 | return mCopyRTFUseBackground; | 
|---|
| 918 | } | 
|---|
| 919 |  | 
|---|
| 920 | void Settings::Editor::setCopyRTFUseBackground(bool copyRTFUseBackground) | 
|---|
| 921 | { | 
|---|
| 922 | mCopyRTFUseBackground = copyRTFUseBackground; | 
|---|
| 923 | } | 
|---|
| 924 |  | 
|---|
| 925 | int Settings::Editor::copyLineLimits() const | 
|---|
| 926 | { | 
|---|
| 927 | return mCopyLineLimits; | 
|---|
| 928 | } | 
|---|
| 929 |  | 
|---|
| 930 | void Settings::Editor::setCopyLineLimits(int copyLineLimits) | 
|---|
| 931 | { | 
|---|
| 932 | mCopyLineLimits = copyLineLimits; | 
|---|
| 933 | } | 
|---|
| 934 |  | 
|---|
| 935 | int Settings::Editor::copyCharLimits() const | 
|---|
| 936 | { | 
|---|
| 937 | return mCopyCharLimits; | 
|---|
| 938 | } | 
|---|
| 939 |  | 
|---|
| 940 | void Settings::Editor::setCopyCharLimits(int copyCharLimits) | 
|---|
| 941 | { | 
|---|
| 942 | mCopyCharLimits = copyCharLimits; | 
|---|
| 943 | } | 
|---|
| 944 |  | 
|---|
| 945 | bool Settings::Editor::copySizeLimit() const | 
|---|
| 946 | { | 
|---|
| 947 | return mCopySizeLimit; | 
|---|
| 948 | } | 
|---|
| 949 |  | 
|---|
| 950 | void Settings::Editor::setCopySizeLimit(bool copyLimit) | 
|---|
| 951 | { | 
|---|
| 952 | mCopySizeLimit = copyLimit; | 
|---|
| 953 | } | 
|---|
| 954 |  | 
|---|
| 955 | int Settings::Editor::gutterLeftOffset() const | 
|---|
| 956 | { | 
|---|
| 957 | return mGutterLeftOffset; | 
|---|
| 958 | } | 
|---|
| 959 |  | 
|---|
| 960 | void Settings::Editor::setGutterLeftOffset(int gutterLeftOffset) | 
|---|
| 961 | { | 
|---|
| 962 | mGutterLeftOffset = gutterLeftOffset; | 
|---|
| 963 | } | 
|---|
| 964 |  | 
|---|
| 965 | int Settings::Editor::gutterFontSize() const | 
|---|
| 966 | { | 
|---|
| 967 | return mGutterFontSize; | 
|---|
| 968 | } | 
|---|
| 969 |  | 
|---|
| 970 | void Settings::Editor::setGutterFontSize(int gutterFontSize) | 
|---|
| 971 | { | 
|---|
| 972 | mGutterFontSize = gutterFontSize; | 
|---|
| 973 | } | 
|---|
| 974 |  | 
|---|
| 975 | QString Settings::Editor::gutterFontName() const | 
|---|
| 976 | { | 
|---|
| 977 | return mGutterFontName; | 
|---|
| 978 | } | 
|---|
| 979 |  | 
|---|
| 980 | void Settings::Editor::setGutterFontName(const QString &gutterFontName) | 
|---|
| 981 | { | 
|---|
| 982 | mGutterFontName = gutterFontName; | 
|---|
| 983 | } | 
|---|
| 984 |  | 
|---|
| 985 | bool Settings::Editor::gutterUseCustomFont() const | 
|---|
| 986 | { | 
|---|
| 987 | return mGutterUseCustomFont; | 
|---|
| 988 | } | 
|---|
| 989 |  | 
|---|
| 990 | void Settings::Editor::setGutterUseCustomFont(bool gutterUseCustomFont) | 
|---|
| 991 | { | 
|---|
| 992 | mGutterUseCustomFont = gutterUseCustomFont; | 
|---|
| 993 | } | 
|---|
| 994 |  | 
|---|
| 995 | bool Settings::Editor::() const | 
|---|
| 996 | { | 
|---|
| 997 | return mGutterLineNumbersStartZero; | 
|---|
| 998 | } | 
|---|
| 999 |  | 
|---|
| 1000 | void Settings::Editor::(bool ) | 
|---|
| 1001 | { | 
|---|
| 1002 | mGutterLineNumbersStartZero = gutterLineNumbersStartZero; | 
|---|
| 1003 | } | 
|---|
| 1004 |  | 
|---|
| 1005 | bool Settings::Editor::gutterAddLeadingZero() const | 
|---|
| 1006 | { | 
|---|
| 1007 | return mGutterAddLeadingZero; | 
|---|
| 1008 | } | 
|---|
| 1009 |  | 
|---|
| 1010 | void Settings::Editor::setGutterAddLeadingZero(bool gutterAddLeadingZero) | 
|---|
| 1011 | { | 
|---|
| 1012 | mGutterAddLeadingZero = gutterAddLeadingZero; | 
|---|
| 1013 | } | 
|---|
| 1014 |  | 
|---|
| 1015 | bool Settings::Editor::gutterShowLineNumbers() const | 
|---|
| 1016 | { | 
|---|
| 1017 | return mGutterShowLineNumbers; | 
|---|
| 1018 | } | 
|---|
| 1019 |  | 
|---|
| 1020 | void Settings::Editor::setGutterShowLineNumbers(bool gutterShowLineNumbers) | 
|---|
| 1021 | { | 
|---|
| 1022 | mGutterShowLineNumbers = gutterShowLineNumbers; | 
|---|
| 1023 | } | 
|---|
| 1024 |  | 
|---|
| 1025 | int Settings::Editor::gutterDigitsCount() const | 
|---|
| 1026 | { | 
|---|
| 1027 | return mGutterDigitsCount; | 
|---|
| 1028 | } | 
|---|
| 1029 |  | 
|---|
| 1030 | void Settings::Editor::setGutterDigitsCount(int gutterDigitsCount) | 
|---|
| 1031 | { | 
|---|
| 1032 | mGutterDigitsCount = gutterDigitsCount; | 
|---|
| 1033 | } | 
|---|
| 1034 |  | 
|---|
| 1035 | bool Settings::Editor::gutterAutoSize() const | 
|---|
| 1036 | { | 
|---|
| 1037 | return mGutterAutoSize; | 
|---|
| 1038 | } | 
|---|
| 1039 |  | 
|---|
| 1040 | void Settings::Editor::setGutterAutoSize(bool gutterAutoSize) | 
|---|
| 1041 | { | 
|---|
| 1042 | mGutterAutoSize = gutterAutoSize; | 
|---|
| 1043 | } | 
|---|
| 1044 |  | 
|---|
| 1045 | bool Settings::Editor::gutterVisible() const | 
|---|
| 1046 | { | 
|---|
| 1047 | return mGutterVisible; | 
|---|
| 1048 | } | 
|---|
| 1049 |  | 
|---|
| 1050 | void Settings::Editor::setGutterVisible(bool gutterVisible) | 
|---|
| 1051 | { | 
|---|
| 1052 | mGutterVisible = gutterVisible; | 
|---|
| 1053 | } | 
|---|
| 1054 |  | 
|---|
| 1055 | bool Settings::Editor::fontOnlyMonospaced() const | 
|---|
| 1056 | { | 
|---|
| 1057 | return mFontOnlyMonospaced; | 
|---|
| 1058 | } | 
|---|
| 1059 |  | 
|---|
| 1060 | void Settings::Editor::setFontOnlyMonospaced(bool fontOnlyMonospaced) | 
|---|
| 1061 | { | 
|---|
| 1062 | mFontOnlyMonospaced = fontOnlyMonospaced; | 
|---|
| 1063 | } | 
|---|
| 1064 |  | 
|---|
| 1065 | int Settings::Editor::fontSize() const | 
|---|
| 1066 | { | 
|---|
| 1067 | return mFontSize; | 
|---|
| 1068 | } | 
|---|
| 1069 |  | 
|---|
| 1070 | void Settings::Editor::setFontSize(int fontSize) | 
|---|
| 1071 | { | 
|---|
| 1072 | mFontSize = fontSize; | 
|---|
| 1073 | } | 
|---|
| 1074 |  | 
|---|
| 1075 | QString Settings::Editor::fontName() const | 
|---|
| 1076 | { | 
|---|
| 1077 | return mFontName; | 
|---|
| 1078 | } | 
|---|
| 1079 |  | 
|---|
| 1080 | void Settings::Editor::setFontName(const QString &fontName) | 
|---|
| 1081 | { | 
|---|
| 1082 | mFontName = fontName; | 
|---|
| 1083 | } | 
|---|
| 1084 |  | 
|---|
| 1085 | bool Settings::Editor::scrollByOneLess() const | 
|---|
| 1086 | { | 
|---|
| 1087 | return mScrollByOneLess; | 
|---|
| 1088 | } | 
|---|
| 1089 |  | 
|---|
| 1090 | void Settings::Editor::setScrollByOneLess(bool scrollByOneLess) | 
|---|
| 1091 | { | 
|---|
| 1092 | mScrollByOneLess = scrollByOneLess; | 
|---|
| 1093 | } | 
|---|
| 1094 |  | 
|---|
| 1095 | bool Settings::Editor::scrollPastEol() const | 
|---|
| 1096 | { | 
|---|
| 1097 | return mScrollPastEol; | 
|---|
| 1098 | } | 
|---|
| 1099 |  | 
|---|
| 1100 | void Settings::Editor::setScrollPastEol(bool scrollPastEol) | 
|---|
| 1101 | { | 
|---|
| 1102 | mScrollPastEol = scrollPastEol; | 
|---|
| 1103 | } | 
|---|
| 1104 |  | 
|---|
| 1105 | bool Settings::Editor::scrollPastEof() const | 
|---|
| 1106 | { | 
|---|
| 1107 | return mScrollPastEof; | 
|---|
| 1108 | } | 
|---|
| 1109 |  | 
|---|
| 1110 | void Settings::Editor::setScrollPastEof(bool scrollPastEof) | 
|---|
| 1111 | { | 
|---|
| 1112 | mScrollPastEof = scrollPastEof; | 
|---|
| 1113 | } | 
|---|
| 1114 |  | 
|---|
| 1115 | bool Settings::Editor::autoHideScrollbar() const | 
|---|
| 1116 | { | 
|---|
| 1117 | return mAutoHideScrollbar; | 
|---|
| 1118 | } | 
|---|
| 1119 |  | 
|---|
| 1120 | void Settings::Editor::setAutoHideScrollbar(bool autoHideScrollbar) | 
|---|
| 1121 | { | 
|---|
| 1122 | mAutoHideScrollbar = autoHideScrollbar; | 
|---|
| 1123 | } | 
|---|
| 1124 |  | 
|---|
| 1125 | void Settings::Editor::doSave() | 
|---|
| 1126 | { | 
|---|
| 1127 |  | 
|---|
| 1128 | // indents | 
|---|
| 1129 | saveValue( "auto_indent", mAutoIndent); | 
|---|
| 1130 | saveValue( "tab_to_spaces", mTabToSpaces); | 
|---|
| 1131 | saveValue( "tab_width", mTabWidth); | 
|---|
| 1132 | saveValue( "show_indent_lines", mShowIndentLines); | 
|---|
| 1133 | saveValue( "indent_line_color",mIndentLineColor); | 
|---|
| 1134 | saveValue( "fill_indents",mfillIndents); | 
|---|
| 1135 |  | 
|---|
| 1136 | // caret | 
|---|
| 1137 | saveValue( "enhance_home_key",mEnhanceHomeKey); | 
|---|
| 1138 | saveValue( "enhance_end_key",mEnhanceEndKey); | 
|---|
| 1139 | saveValue( "keep_caret_x",mKeepCaretX); | 
|---|
| 1140 | saveValue( "caret_for_insert",static_cast<int>(mCaretForInsert)); | 
|---|
| 1141 | saveValue( "caret_for_overwrite",static_cast<int>(mCaretForOverwrite)); | 
|---|
| 1142 | saveValue( "caret_use_text_color",mCaretUseTextColor); | 
|---|
| 1143 | saveValue( "caret_color",mCaretColor); | 
|---|
| 1144 |  | 
|---|
| 1145 | //highlight | 
|---|
| 1146 | saveValue( "highlight_matching_braces",mHighlightMathingBraces); | 
|---|
| 1147 | saveValue( "highlight_current_word",mHighlightCurrentWord); | 
|---|
| 1148 |  | 
|---|
| 1149 | //scroll | 
|---|
| 1150 | saveValue( "auto_hide_scroll_bar", mAutoHideScrollbar); | 
|---|
| 1151 | saveValue( "scroll_past_eof", mScrollPastEof); | 
|---|
| 1152 | saveValue( "scroll_past_eol", mScrollPastEol); | 
|---|
| 1153 | saveValue( "scroll_by_one_less", mScrollByOneLess); | 
|---|
| 1154 | saveValue( "half_page_scroll", mHalfPageScroll); | 
|---|
| 1155 | saveValue( "mouse_wheel_scroll_speed", mMouseWheelScrollSpeed); | 
|---|
| 1156 | saveValue( "mouse_selection_scroll_speed",mMouseSelectionScrollSpeed); | 
|---|
| 1157 |  | 
|---|
| 1158 | //right edge | 
|---|
| 1159 | saveValue( "show_right_edge_line",mShowRightEdgeLine); | 
|---|
| 1160 | saveValue( "right_edge_width",mRightEdgeWidth); | 
|---|
| 1161 | saveValue( "right_edge_line_color",mRightEdgeLineColor); | 
|---|
| 1162 |  | 
|---|
| 1163 | //Font | 
|---|
| 1164 | //font | 
|---|
| 1165 | saveValue( "font_name", mFontName); | 
|---|
| 1166 | saveValue( "non_ascii_font_name", mNonAsciiFontName); | 
|---|
| 1167 | saveValue( "font_size", mFontSize); | 
|---|
| 1168 | saveValue( "font_only_monospaced", mFontOnlyMonospaced); | 
|---|
| 1169 | saveValue( "enable_ligatures_support", mEnableLigaturesSupport); | 
|---|
| 1170 |  | 
|---|
| 1171 | //gutter | 
|---|
| 1172 | saveValue( "gutter_visible", mGutterVisible); | 
|---|
| 1173 | saveValue( "gutter_auto_size", mGutterAutoSize); | 
|---|
| 1174 | saveValue( "gutter_left_offset",mGutterLeftOffset); | 
|---|
| 1175 | saveValue( "gutter_right_offset",mGutterRightOffset); | 
|---|
| 1176 | saveValue( "gutter_digits_count", mGutterDigitsCount); | 
|---|
| 1177 | saveValue( "gutter_show_line_numbers",mGutterShowLineNumbers); | 
|---|
| 1178 | saveValue( "gutter_add_leading_zero",mGutterAddLeadingZero); | 
|---|
| 1179 | saveValue( "gutter_line_numbers_start_zero",mGutterLineNumbersStartZero); | 
|---|
| 1180 | saveValue( "gutter_use_custom_font",mGutterUseCustomFont); | 
|---|
| 1181 | saveValue( "gutter_font_name",mGutterFontName); | 
|---|
| 1182 | saveValue( "gutter_font_size",mGutterFontSize); | 
|---|
| 1183 | saveValue( "gutter_font_only_monospaced",mGutterFontOnlyMonospaced); | 
|---|
| 1184 |  | 
|---|
| 1185 | //copy | 
|---|
| 1186 | saveValue( "copy_limit",mCopySizeLimit); | 
|---|
| 1187 | saveValue( "copy_char_limits",mCopyCharLimits); | 
|---|
| 1188 | saveValue( "copy_line_limits",mCopyLineLimits); | 
|---|
| 1189 | saveValue( "copy_with_format_as",mCopyWithFormatAs); | 
|---|
| 1190 | saveValue( "copy_rtf_use_background",mCopyRTFUseBackground); | 
|---|
| 1191 | saveValue( "copy_rtf_use_editor_color_scheme",mCopyRTFUseEditorColor); | 
|---|
| 1192 | saveValue( "copy_rtf_color_scheme",mCopyRTFColorScheme); | 
|---|
| 1193 | saveValue( "copy_html_use_background",mCopyHTMLUseBackground); | 
|---|
| 1194 | saveValue( "copy_html_use_editor_color_scheme",mCopyHTMLUseEditorColor); | 
|---|
| 1195 | saveValue( "copy_html_color_scheme", mCopyHTMLColorScheme); | 
|---|
| 1196 |  | 
|---|
| 1197 | //color scheme | 
|---|
| 1198 | saveValue( "color_scheme", mColorScheme); | 
|---|
| 1199 | saveValue( "rainbow_parenthesis",mRainbowParenthesis); | 
|---|
| 1200 |  | 
|---|
| 1201 | //Symbol Completion | 
|---|
| 1202 | saveValue( "complete_symbols", mCompleteSymbols); | 
|---|
| 1203 | saveValue( "complete_parenthese", mCompleteParenthese); | 
|---|
| 1204 | saveValue( "complete_bracket", mCompleteBracket); | 
|---|
| 1205 | saveValue( "complete_brace", mCompleteBrace); | 
|---|
| 1206 | saveValue( "complete_comment", mCompleteComment); | 
|---|
| 1207 | saveValue( "complete_single_quote", mCompleteSingleQuote); | 
|---|
| 1208 | saveValue( "complete_double_quote", mCompleteDoubleQuote); | 
|---|
| 1209 | saveValue( "complete_global_include", mCompleteGlobalInclude); | 
|---|
| 1210 | saveValue( "overwrite_symbols", mOverwriteSymbols); | 
|---|
| 1211 | saveValue( "remove_symbol_pairs",mRemoveSymbolPairs); | 
|---|
| 1212 |  | 
|---|
| 1213 | //Auto Syntax Check | 
|---|
| 1214 | saveValue( "check_syntax",mSyntaxCheck); | 
|---|
| 1215 | saveValue( "check_syntax_when_save",mSyntaxCheckWhenSave); | 
|---|
| 1216 | saveValue( "check_syntax_when_line_changed",mSyntaxCheckWhenLineChanged); | 
|---|
| 1217 |  | 
|---|
| 1218 | //auto save | 
|---|
| 1219 | saveValue( "enable_auto_save",mEnableAutoSave); | 
|---|
| 1220 | saveValue( "auto_save_interal",mAutoSaveInterval); | 
|---|
| 1221 | saveValue( "auto_save_target",mAutoSaveTarget); | 
|---|
| 1222 | saveValue( "auto_save_strategy",mAutoSaveStrategy); | 
|---|
| 1223 |  | 
|---|
| 1224 | //auto link | 
|---|
| 1225 | saveValue( "enable_autolink",mEnableAutolink); | 
|---|
| 1226 |  | 
|---|
| 1227 | //misc | 
|---|
| 1228 | saveValue( "default_encoding",mDefaultEncoding); | 
|---|
| 1229 | saveValue( "readonly_system_header",mReadOnlySytemHeader); | 
|---|
| 1230 | saveValue( "auto_load_last_files",mAutoLoadLastFiles); | 
|---|
| 1231 | saveValue( "default_file_cpp",mDefaultFileCpp); | 
|---|
| 1232 | saveValue( "auto_detect_file_encoding",mAutoDetectFileEncoding); | 
|---|
| 1233 | saveValue( "undo_limit",mUndoLimit); | 
|---|
| 1234 |  | 
|---|
| 1235 | //tooltips | 
|---|
| 1236 | saveValue( "enable_tooltips",mEnableTooltips); | 
|---|
| 1237 | saveValue( "enable_debug_tooltips",mEnableDebugTooltips); | 
|---|
| 1238 | saveValue( "enable_identifier_tooltips",mEnableIdentifierToolTips); | 
|---|
| 1239 | saveValue( "enable_header_tooltips",mEnableHeaderToolTips); | 
|---|
| 1240 | saveValue( "enable_issue_tooltips",mEnableIssueToolTips); | 
|---|
| 1241 | saveValue( "show_function_tips",mShowFunctionTips); | 
|---|
| 1242 | } | 
|---|
| 1243 |  | 
|---|
| 1244 | void Settings::Editor::doLoad() | 
|---|
| 1245 | { | 
|---|
| 1246 |  | 
|---|
| 1247 | // indents | 
|---|
| 1248 | mAutoIndent = boolValue( "auto_indent", true); | 
|---|
| 1249 | mTabToSpaces = boolValue( "tab_to_spaces",false); | 
|---|
| 1250 | mTabWidth = intValue( "tab_width",4); | 
|---|
| 1251 | mShowIndentLines = boolValue( "show_indent_lines",true); | 
|---|
| 1252 | mIndentLineColor = colorValue( "indent_line_color",Qt::lightGray); | 
|---|
| 1253 | mfillIndents = boolValue( "fill_indents", false); | 
|---|
| 1254 | // caret | 
|---|
| 1255 | mEnhanceHomeKey = boolValue( "enhance_home_key", true); | 
|---|
| 1256 | mEnhanceEndKey = boolValue( "enhance_end_key",true); | 
|---|
| 1257 | mKeepCaretX = boolValue( "keep_caret_x",true); | 
|---|
| 1258 | mCaretForInsert = static_cast<QSynedit::EditCaretType>( intValue( "caret_for_insert",static_cast<int>(QSynedit::EditCaretType::ctVerticalLine))); | 
|---|
| 1259 | mCaretForOverwrite = static_cast<QSynedit::EditCaretType>( intValue( "caret_for_overwrite",static_cast<int>(QSynedit::EditCaretType::ctBlock))); | 
|---|
| 1260 | mCaretUseTextColor = boolValue( "caret_use_text_color",true); | 
|---|
| 1261 | mCaretColor = colorValue( "caret_color",Qt::yellow); | 
|---|
| 1262 |  | 
|---|
| 1263 | //highlight | 
|---|
| 1264 | mHighlightMathingBraces = boolValue( "highlight_matching_braces",true); | 
|---|
| 1265 | mHighlightCurrentWord = boolValue( "highlight_current_word",true); | 
|---|
| 1266 |  | 
|---|
| 1267 | //scroll | 
|---|
| 1268 | mAutoHideScrollbar = boolValue( "auto_hide_scroll_bar", false); | 
|---|
| 1269 | mScrollPastEof = boolValue( "scroll_past_eof", true); | 
|---|
| 1270 | mScrollPastEol = boolValue( "scroll_past_eol", true); | 
|---|
| 1271 | mScrollByOneLess = boolValue( "scroll_by_one_less", false); | 
|---|
| 1272 | mHalfPageScroll = boolValue( "half_page_scroll",false); | 
|---|
| 1273 | mMouseWheelScrollSpeed = intValue( "mouse_wheel_scroll_speed", 3); | 
|---|
| 1274 | mMouseSelectionScrollSpeed = intValue( "mouse_selection_scroll_speed",1); | 
|---|
| 1275 |  | 
|---|
| 1276 |  | 
|---|
| 1277 | //right edge | 
|---|
| 1278 | mShowRightEdgeLine = boolValue( "show_right_edge_line",false); | 
|---|
| 1279 | mRightEdgeWidth = intValue( "right_edge_width",80); | 
|---|
| 1280 | mRightEdgeLineColor = colorValue( "right_edge_line_color",Qt::yellow); | 
|---|
| 1281 |  | 
|---|
| 1282 | //Editor font | 
|---|
| 1283 | #ifdef Q_OS_WIN | 
|---|
| 1284 | mFontName = stringValue( "font_name", "consolas"); | 
|---|
| 1285 | mNonAsciiFontName = stringValue( "non_ascii_font_name", "consolas"); | 
|---|
| 1286 | #elif defined(Q_OS_MACOS) | 
|---|
| 1287 | mFontName = stringValue( "font_name", "Menlo"); | 
|---|
| 1288 | mNonAsciiFontName = stringValue( "non_ascii_font_name", "PingFang SC"); | 
|---|
| 1289 | #else | 
|---|
| 1290 | mFontName = stringValue( "font_name", "Dejavu Sans Mono"); | 
|---|
| 1291 | mNonAsciiFontName = stringValue( "non_ascii_font_name", "Dejavu Sans Mono"); | 
|---|
| 1292 | #endif | 
|---|
| 1293 | mFontSize = intValue( "font_size",14); | 
|---|
| 1294 | mFontOnlyMonospaced = boolValue( "font_only_monospaced",true); | 
|---|
| 1295 | mEnableLigaturesSupport = boolValue( "enable_ligatures_support", false); | 
|---|
| 1296 |  | 
|---|
| 1297 | //gutter | 
|---|
| 1298 | mGutterVisible = boolValue( "gutter_visible",true); | 
|---|
| 1299 | mGutterAutoSize = boolValue( "gutter_auto_size",true); | 
|---|
| 1300 | mGutterLeftOffset = intValue( "gutter_left_offset",6); | 
|---|
| 1301 | mGutterRightOffset = intValue( "gutter_right_offset",24); | 
|---|
| 1302 | mGutterDigitsCount = intValue( "gutter_digits_count",1); | 
|---|
| 1303 | mGutterShowLineNumbers = boolValue( "gutter_show_line_numbers",true); | 
|---|
| 1304 | mGutterAddLeadingZero = boolValue( "gutter_add_leading_zero",true); | 
|---|
| 1305 | mGutterLineNumbersStartZero = boolValue( "gutter_line_numbers_start_zero",false); | 
|---|
| 1306 | mGutterUseCustomFont = boolValue( "gutter_use_custom_font",false); | 
|---|
| 1307 |  | 
|---|
| 1308 | #ifdef Q_OS_WIN | 
|---|
| 1309 | mGutterFontName = stringValue( "gutter_font_name", "consolas"); | 
|---|
| 1310 | #else | 
|---|
| 1311 | mGutterFontName = stringValue( "gutter_font_name", "Dejavu Sans Mono"); | 
|---|
| 1312 | #endif | 
|---|
| 1313 | mGutterFontSize = intValue( "gutter_font_size",14); | 
|---|
| 1314 | mGutterFontOnlyMonospaced = boolValue( "gutter_font_only_monospaced",true); | 
|---|
| 1315 |  | 
|---|
| 1316 | //copy | 
|---|
| 1317 | mCopySizeLimit = boolValue( "copy_limit",true); | 
|---|
| 1318 | mCopyCharLimits = intValue( "copy_char_limits",100); | 
|---|
| 1319 | mCopyLineLimits = intValue( "copy_line_limits",100000); | 
|---|
| 1320 | #ifdef Q_OS_WIN | 
|---|
| 1321 | mCopyWithFormatAs = intValue( "copy_with_format_as",1); //html | 
|---|
| 1322 | #else | 
|---|
| 1323 | mCopyWithFormatAs = intValue( "copy_with_format_as",0); //none | 
|---|
| 1324 | #endif | 
|---|
| 1325 | mCopyRTFUseBackground = boolValue( "copy_rtf_use_background",false); | 
|---|
| 1326 | mCopyRTFUseEditorColor = boolValue( "copy_rtf_use_editor_color_scheme",false); | 
|---|
| 1327 | mCopyRTFColorScheme = stringValue( "copy_rtf_color_scheme", "Intellij Classic"); | 
|---|
| 1328 | mCopyHTMLUseBackground = boolValue( "copy_html_use_background",false); | 
|---|
| 1329 | mCopyHTMLUseEditorColor = boolValue( "copy_html_use_editor_color_scheme",false); | 
|---|
| 1330 | mCopyHTMLColorScheme = stringValue( "copy_html_color_scheme", "Intellij Classic"); | 
|---|
| 1331 |  | 
|---|
| 1332 | //color | 
|---|
| 1333 | mColorScheme = stringValue( "color_scheme", "VS Code"); | 
|---|
| 1334 | mRainbowParenthesis = boolValue( "rainbow_parenthesis", true); | 
|---|
| 1335 |  | 
|---|
| 1336 | //Symbol Completion | 
|---|
| 1337 | mCompleteSymbols = boolValue( "complete_symbols",true); | 
|---|
| 1338 | mCompleteParenthese = boolValue( "complete_parenthese",true); | 
|---|
| 1339 | mCompleteBracket = boolValue( "complete_bracket",true); | 
|---|
| 1340 | mCompleteBrace = boolValue( "complete_brace",true); | 
|---|
| 1341 | mCompleteComment = boolValue( "complete_comment",true); | 
|---|
| 1342 | mCompleteSingleQuote = boolValue( "complete_single_quote",true); | 
|---|
| 1343 | mCompleteDoubleQuote = boolValue( "complete_double_quote",true); | 
|---|
| 1344 | mCompleteGlobalInclude = boolValue( "complete_global_include",true); | 
|---|
| 1345 | mOverwriteSymbols = boolValue( "overwrite_symbols",true); | 
|---|
| 1346 | mRemoveSymbolPairs = boolValue( "remove_symbol_pairs",true); | 
|---|
| 1347 |  | 
|---|
| 1348 | //Auto Syntax Check | 
|---|
| 1349 | mSyntaxCheck = boolValue( "check_syntax",true); | 
|---|
| 1350 | mSyntaxCheckWhenSave = boolValue( "check_syntax_when_save",true); | 
|---|
| 1351 | mSyntaxCheckWhenLineChanged = boolValue( "check_syntax_when_line_changed",true); | 
|---|
| 1352 |  | 
|---|
| 1353 | //auto save | 
|---|
| 1354 | mEnableAutoSave = boolValue( "enable_auto_save",false); | 
|---|
| 1355 | mAutoSaveInterval = intValue( "auto_save_interal",10); | 
|---|
| 1356 | mAutoSaveTarget = static_cast<enum AutoSaveTarget>( | 
|---|
| 1357 | intValue( "auto_save_target",AutoSaveTarget::astCurrentFile)); | 
|---|
| 1358 | mAutoSaveStrategy = static_cast<enum AutoSaveStrategy>( | 
|---|
| 1359 | intValue( "auto_save_strategy",AutoSaveStrategy::assOverwrite)); | 
|---|
| 1360 |  | 
|---|
| 1361 | //auto link | 
|---|
| 1362 | mEnableAutolink = boolValue( "enable_autolink",true); | 
|---|
| 1363 |  | 
|---|
| 1364 | //misc | 
|---|
| 1365 | mReadOnlySytemHeader = boolValue( "readonly_system_header",true); | 
|---|
| 1366 | mAutoLoadLastFiles = boolValue( "auto_load_last_files",true); | 
|---|
| 1367 | mDefaultFileCpp = boolValue( "default_file_cpp",true); | 
|---|
| 1368 | bool useUTF8ByDefault = boolValue( "use_utf8_by_default",false); | 
|---|
| 1369 | if (useUTF8ByDefault) | 
|---|
| 1370 | mDefaultEncoding = ENCODING_UTF8; | 
|---|
| 1371 | else | 
|---|
| 1372 | mDefaultEncoding = value( "default_encoding", ENCODING_UTF8).toByteArray(); | 
|---|
| 1373 | mAutoDetectFileEncoding = boolValue( "auto_detect_file_encoding",true); | 
|---|
| 1374 | mUndoLimit = intValue( "undo_limit",0); | 
|---|
| 1375 |  | 
|---|
| 1376 | //tooltips | 
|---|
| 1377 | mEnableTooltips = boolValue( "enable_tooltips",true); | 
|---|
| 1378 | mEnableDebugTooltips = boolValue( "enable_debug_tooltips",true); | 
|---|
| 1379 | mEnableIdentifierToolTips = boolValue( "enable_identifier_tooltips",true); | 
|---|
| 1380 | mEnableHeaderToolTips = boolValue( "enable_header_tooltips", true); | 
|---|
| 1381 | mEnableIssueToolTips = boolValue( "enable_issue_tooltips", true); | 
|---|
| 1382 | mShowFunctionTips = boolValue( "show_function_tips",true); | 
|---|
| 1383 | } | 
|---|
| 1384 |  | 
|---|
| 1385 | QSynedit::EditCaretType Settings::Editor::caretForOverwrite() const | 
|---|
| 1386 | { | 
|---|
| 1387 | return mCaretForOverwrite; | 
|---|
| 1388 | } | 
|---|
| 1389 |  | 
|---|
| 1390 | void Settings::Editor::setCaretForOverwrite(const QSynedit::EditCaretType &caretForOverwrite) | 
|---|
| 1391 | { | 
|---|
| 1392 | mCaretForOverwrite = caretForOverwrite; | 
|---|
| 1393 | } | 
|---|
| 1394 |  | 
|---|
| 1395 | QSynedit::EditCaretType Settings::Editor::caretForInsert() const | 
|---|
| 1396 | { | 
|---|
| 1397 | return mCaretForInsert; | 
|---|
| 1398 | } | 
|---|
| 1399 |  | 
|---|
| 1400 | void Settings::Editor::setCaretForInsert(const QSynedit::EditCaretType &caretForInsert) | 
|---|
| 1401 | { | 
|---|
| 1402 | mCaretForInsert = caretForInsert; | 
|---|
| 1403 | } | 
|---|
| 1404 |  | 
|---|
| 1405 | bool Settings::Editor::enhanceEndKey() const | 
|---|
| 1406 | { | 
|---|
| 1407 | return mEnhanceEndKey; | 
|---|
| 1408 | } | 
|---|
| 1409 |  | 
|---|
| 1410 | void Settings::Editor::setEnhanceEndKey(bool enhanceEndKey) | 
|---|
| 1411 | { | 
|---|
| 1412 | mEnhanceEndKey = enhanceEndKey; | 
|---|
| 1413 | } | 
|---|
| 1414 |  | 
|---|
| 1415 | bool Settings::Editor::enhanceHomeKey() const | 
|---|
| 1416 | { | 
|---|
| 1417 | return mEnhanceHomeKey; | 
|---|
| 1418 | } | 
|---|
| 1419 |  | 
|---|
| 1420 | void Settings::Editor::setEnhanceHomeKey(bool enhanceHomeKey) | 
|---|
| 1421 | { | 
|---|
| 1422 | mEnhanceHomeKey = enhanceHomeKey; | 
|---|
| 1423 | } | 
|---|
| 1424 |  | 
|---|
| 1425 | QColor Settings::Editor::indentLineColor() const | 
|---|
| 1426 | { | 
|---|
| 1427 | return mIndentLineColor; | 
|---|
| 1428 | } | 
|---|
| 1429 |  | 
|---|
| 1430 | void Settings::Editor::setIndentLineColor(const QColor &indentLineColor) | 
|---|
| 1431 | { | 
|---|
| 1432 | mIndentLineColor = indentLineColor; | 
|---|
| 1433 | } | 
|---|
| 1434 |  | 
|---|
| 1435 | bool Settings::Editor::showIndentLines() const | 
|---|
| 1436 | { | 
|---|
| 1437 | return mShowIndentLines; | 
|---|
| 1438 | } | 
|---|
| 1439 |  | 
|---|
| 1440 | void Settings::Editor::setShowIndentLines(bool showIndentLines) | 
|---|
| 1441 | { | 
|---|
| 1442 | mShowIndentLines = showIndentLines; | 
|---|
| 1443 | } | 
|---|
| 1444 |  | 
|---|
| 1445 | int Settings::Editor::tabWidth() const | 
|---|
| 1446 | { | 
|---|
| 1447 | return mTabWidth; | 
|---|
| 1448 | } | 
|---|
| 1449 |  | 
|---|
| 1450 | void Settings::Editor::setTabWidth(int tabWidth) | 
|---|
| 1451 | { | 
|---|
| 1452 | mTabWidth = tabWidth; | 
|---|
| 1453 | } | 
|---|
| 1454 |  | 
|---|
| 1455 | bool Settings::Editor::tabToSpaces() const | 
|---|
| 1456 | { | 
|---|
| 1457 | return mTabToSpaces; | 
|---|
| 1458 | } | 
|---|
| 1459 |  | 
|---|
| 1460 | void Settings::Editor::setTabToSpaces(bool tabToSpaces) | 
|---|
| 1461 | { | 
|---|
| 1462 | mTabToSpaces = tabToSpaces; | 
|---|
| 1463 | } | 
|---|
| 1464 |  | 
|---|
| 1465 | Settings::CompilerSet::CompilerSet(): | 
|---|
| 1466 | mFullLoaded(false), | 
|---|
| 1467 | mAutoAddCharsetParams(true), | 
|---|
| 1468 | mExecCharset(ENCODING_SYSTEM_DEFAULT), | 
|---|
| 1469 | mStaticLink(true) | 
|---|
| 1470 | { | 
|---|
| 1471 |  | 
|---|
| 1472 | } | 
|---|
| 1473 |  | 
|---|
| 1474 |  | 
|---|
| 1475 | Settings::CompilerSet::CompilerSet(const QString& compilerFolder, const QString& cc_prog): | 
|---|
| 1476 | mAutoAddCharsetParams(true), | 
|---|
| 1477 | mExecCharset(ENCODING_SYSTEM_DEFAULT), | 
|---|
| 1478 | mStaticLink(true) | 
|---|
| 1479 | { | 
|---|
| 1480 | if (QDir(compilerFolder).exists()) { | 
|---|
| 1481 | setProperties(compilerFolder, cc_prog); | 
|---|
| 1482 |  | 
|---|
| 1483 | //manually set the directories | 
|---|
| 1484 | setDirectories(compilerFolder, mCompilerType); | 
|---|
| 1485 |  | 
|---|
| 1486 | setExecutables(); | 
|---|
| 1487 |  | 
|---|
| 1488 | setUserInput(); | 
|---|
| 1489 |  | 
|---|
| 1490 | setDefines(); | 
|---|
| 1491 |  | 
|---|
| 1492 | mFullLoaded = true; | 
|---|
| 1493 | } else { | 
|---|
| 1494 | mFullLoaded = false; | 
|---|
| 1495 | } | 
|---|
| 1496 | } | 
|---|
| 1497 |  | 
|---|
| 1498 | Settings::CompilerSet::CompilerSet(const Settings::CompilerSet &set): | 
|---|
| 1499 | mFullLoaded(set.mFullLoaded), | 
|---|
| 1500 | mCCompiler(set.mCCompiler), | 
|---|
| 1501 | mCppCompiler(set.mCppCompiler), | 
|---|
| 1502 | mMake(set.mMake), | 
|---|
| 1503 | mDebugger(set.mDebugger), | 
|---|
| 1504 | mProfiler(set.mProfiler), | 
|---|
| 1505 | mResourceCompiler(set.mResourceCompiler), | 
|---|
| 1506 | mDebugServer(set.mDebugServer), | 
|---|
| 1507 |  | 
|---|
| 1508 | mBinDirs(set.mBinDirs), | 
|---|
| 1509 | mCIncludeDirs(set.mCIncludeDirs), | 
|---|
| 1510 | mCppIncludeDirs(set.mCppIncludeDirs), | 
|---|
| 1511 | mLibDirs(set.mLibDirs), | 
|---|
| 1512 | mDefaultLibDirs(set.mDefaultLibDirs), | 
|---|
| 1513 | mDefaultCIncludeDirs(set.mDefaultCIncludeDirs), | 
|---|
| 1514 | mDefaultCppIncludeDirs(set.mDefaultCppIncludeDirs), | 
|---|
| 1515 |  | 
|---|
| 1516 | mDumpMachine(set.mDumpMachine), | 
|---|
| 1517 | mVersion(set.mVersion), | 
|---|
| 1518 | mType(set.mType), | 
|---|
| 1519 | mName(set.mName), | 
|---|
| 1520 | mCppDefines(set.mCppDefines), | 
|---|
| 1521 | mCDefines(set.mCDefines), | 
|---|
| 1522 | mTarget(set.mTarget), | 
|---|
| 1523 | mCompilerType(set.mCompilerType), | 
|---|
| 1524 | mCompilerSetType(set.mCompilerSetType), | 
|---|
| 1525 |  | 
|---|
| 1526 | mUseCustomCompileParams(set.mUseCustomCompileParams), | 
|---|
| 1527 | mUseCustomLinkParams(set.mUseCustomLinkParams), | 
|---|
| 1528 | mCustomCompileParams(set.mCustomCompileParams), | 
|---|
| 1529 | mCustomLinkParams(set.mCustomLinkParams), | 
|---|
| 1530 | mAutoAddCharsetParams(set.mAutoAddCharsetParams), | 
|---|
| 1531 | mExecCharset(set.mExecCharset), | 
|---|
| 1532 | mStaticLink(set.mStaticLink), | 
|---|
| 1533 | mCompileOptions(set.mCompileOptions) | 
|---|
| 1534 | { | 
|---|
| 1535 |  | 
|---|
| 1536 | } | 
|---|
| 1537 |  | 
|---|
| 1538 | void Settings::CompilerSet::resetCompileOptionts() | 
|---|
| 1539 | { | 
|---|
| 1540 | mCompileOptions.clear(); | 
|---|
| 1541 | } | 
|---|
| 1542 |  | 
|---|
| 1543 | bool Settings::CompilerSet::setCompileOption(const QString &key, int valIndex) | 
|---|
| 1544 | { | 
|---|
| 1545 | PCompilerOption op = CompilerInfoManager::getCompilerOption(mCompilerType, key); | 
|---|
| 1546 | if (!op) | 
|---|
| 1547 | return false; | 
|---|
| 1548 | if (op->choices.isEmpty()) { | 
|---|
| 1549 | if (valIndex==1) | 
|---|
| 1550 | mCompileOptions.insert(key,COMPILER_OPTION_ON); | 
|---|
| 1551 | else | 
|---|
| 1552 | mCompileOptions.remove(key); | 
|---|
| 1553 | return true; | 
|---|
| 1554 | } else if (valIndex>0 && valIndex <= op->choices.length()) { | 
|---|
| 1555 | mCompileOptions.insert(key,op->choices[valIndex-1].second); | 
|---|
| 1556 | return true; | 
|---|
| 1557 | } else { | 
|---|
| 1558 | mCompileOptions.remove(key); | 
|---|
| 1559 | return true; | 
|---|
| 1560 | } | 
|---|
| 1561 | return false; | 
|---|
| 1562 | } | 
|---|
| 1563 |  | 
|---|
| 1564 | bool Settings::CompilerSet::setCompileOption(const QString &key, const QString &value) | 
|---|
| 1565 | { | 
|---|
| 1566 | PCompilerOption op = CompilerInfoManager::getCompilerOption(mCompilerType,key); | 
|---|
| 1567 | if (!op) | 
|---|
| 1568 | return false; | 
|---|
| 1569 | mCompileOptions.insert(key,value); | 
|---|
| 1570 | return true; | 
|---|
| 1571 | } | 
|---|
| 1572 |  | 
|---|
| 1573 | void Settings::CompilerSet::unsetCompileOption(const QString &key) | 
|---|
| 1574 | { | 
|---|
| 1575 | mCompileOptions.remove(key); | 
|---|
| 1576 | } | 
|---|
| 1577 |  | 
|---|
| 1578 | void Settings::CompilerSet::setCompileOptions(const QMap<QString, QString> options) | 
|---|
| 1579 | { | 
|---|
| 1580 | mCompileOptions=options; | 
|---|
| 1581 | } | 
|---|
| 1582 |  | 
|---|
| 1583 | QString Settings::CompilerSet::getCompileOptionValue(const QString &key) | 
|---|
| 1584 | { | 
|---|
| 1585 | return mCompileOptions.value(key,QString()); | 
|---|
| 1586 | } | 
|---|
| 1587 |  | 
|---|
| 1588 | static void checkDirs(const QStringList& dirlist, QString& gooddirs, QString& baddirs) { | 
|---|
| 1589 | gooddirs = ""; | 
|---|
| 1590 | baddirs = ""; | 
|---|
| 1591 |  | 
|---|
| 1592 | for (int i=0; i<dirlist.count();i++) { | 
|---|
| 1593 | QDir dir(dirlist[i]); | 
|---|
| 1594 | if (!dir.exists()) { | 
|---|
| 1595 | if (baddirs.isEmpty()) { | 
|---|
| 1596 | baddirs = dirlist[i]; | 
|---|
| 1597 | } else { | 
|---|
| 1598 | baddirs += ";"+ dirlist[i]; | 
|---|
| 1599 | } | 
|---|
| 1600 | } else { | 
|---|
| 1601 | if (gooddirs.isEmpty()) { | 
|---|
| 1602 | gooddirs = dirlist[i]; | 
|---|
| 1603 | } else { | 
|---|
| 1604 | gooddirs += ";"+ dirlist[i]; | 
|---|
| 1605 | } | 
|---|
| 1606 | } | 
|---|
| 1607 | } | 
|---|
| 1608 | } | 
|---|
| 1609 |  | 
|---|
| 1610 |  | 
|---|
| 1611 | bool Settings::CompilerSet::dirsValid(QString &msg) | 
|---|
| 1612 | { | 
|---|
| 1613 | QString goodbin, badbin, goodlib, badlib, goodinc, badinc, goodinccpp, badinccpp; | 
|---|
| 1614 | msg = ""; | 
|---|
| 1615 |  | 
|---|
| 1616 | if (mBinDirs.count()>0) {// we need some bin dir, so treat count=0 as an error too | 
|---|
| 1617 | checkDirs(mBinDirs,goodbin,badbin); | 
|---|
| 1618 | if (!badbin.isEmpty()) { | 
|---|
| 1619 | msg += QObject::tr( "The following %1 directories don't exist:").arg( | 
|---|
| 1620 | QObject::tr( "binary") | 
|---|
| 1621 | ); | 
|---|
| 1622 | msg += "<br />"; | 
|---|
| 1623 | msg += badbin.replace(';', "<br />"); | 
|---|
| 1624 | msg += "<br />"; | 
|---|
| 1625 | msg += "<br />"; | 
|---|
| 1626 | return false; | 
|---|
| 1627 | } | 
|---|
| 1628 | } else { | 
|---|
| 1629 | msg += QObject::tr( "No %1 directories have been specified.").arg( | 
|---|
| 1630 | QObject::tr( "binary") | 
|---|
| 1631 | ); | 
|---|
| 1632 | msg += "<br />"; | 
|---|
| 1633 | msg += "<br />"; | 
|---|
| 1634 | return false; | 
|---|
| 1635 | } | 
|---|
| 1636 | checkDirs(mCIncludeDirs,goodbin,badbin); | 
|---|
| 1637 | if (!badbin.isEmpty()) { | 
|---|
| 1638 | msg += QObject::tr( "The following %1 directories don't exist:").arg( | 
|---|
| 1639 | QObject::tr( "C include") | 
|---|
| 1640 | ); | 
|---|
| 1641 | msg += "<br />"; | 
|---|
| 1642 | msg += badbin.replace(';', "<br />"); | 
|---|
| 1643 | msg += "<br />"; | 
|---|
| 1644 | msg += "<br />"; | 
|---|
| 1645 | return false; | 
|---|
| 1646 | } | 
|---|
| 1647 |  | 
|---|
| 1648 | checkDirs(mCppIncludeDirs,goodbin,badbin); | 
|---|
| 1649 | if (!badbin.isEmpty()) { | 
|---|
| 1650 | msg += QObject::tr( "The following %1 directories don't exist:").arg( | 
|---|
| 1651 | QObject::tr( "C++ include") | 
|---|
| 1652 | ); | 
|---|
| 1653 | msg += "<br />"; | 
|---|
| 1654 | msg += badbin.replace(';', "<br />"); | 
|---|
| 1655 | msg += "<br />"; | 
|---|
| 1656 | msg += "<br />"; | 
|---|
| 1657 | return false; | 
|---|
| 1658 | } | 
|---|
| 1659 |  | 
|---|
| 1660 | checkDirs(mLibDirs,goodbin,badbin); | 
|---|
| 1661 | if (!badbin.isEmpty()) { | 
|---|
| 1662 | msg += QObject::tr( "The following %1 directories don't exist:").arg( | 
|---|
| 1663 | QObject::tr( "C++ include") | 
|---|
| 1664 | ); | 
|---|
| 1665 | msg += "<br />"; | 
|---|
| 1666 | msg += badbin.replace(';', "<br />"); | 
|---|
| 1667 | msg += "<br />"; | 
|---|
| 1668 | msg += "<br />"; | 
|---|
| 1669 | return false; | 
|---|
| 1670 | } | 
|---|
| 1671 |  | 
|---|
| 1672 | if (!msg.isEmpty()) | 
|---|
| 1673 | return false; | 
|---|
| 1674 | else | 
|---|
| 1675 | return true; | 
|---|
| 1676 | } | 
|---|
| 1677 |  | 
|---|
| 1678 | bool Settings::CompilerSet::validateExes(QString &msg) | 
|---|
| 1679 | { | 
|---|
| 1680 | msg = ""; | 
|---|
| 1681 | if (!fileExists(mCCompiler)) { | 
|---|
| 1682 | msg += QObject::tr( "Cannot find the %1 \"%2\"") | 
|---|
| 1683 | .arg(QObject::tr( "C Compiler")) | 
|---|
| 1684 | .arg(mCCompiler); | 
|---|
| 1685 | } | 
|---|
| 1686 | if (!fileExists(mCppCompiler)) { | 
|---|
| 1687 | msg += QObject::tr( "Cannot find the %1 \"%2\"") | 
|---|
| 1688 | .arg(QObject::tr( "C++ Compiler")) | 
|---|
| 1689 | .arg(mCppCompiler); | 
|---|
| 1690 | } | 
|---|
| 1691 | if (!mMake.isEmpty() && !fileExists(mMake)) { | 
|---|
| 1692 | msg += QObject::tr( "Cannot find the %1 \"%2\"") | 
|---|
| 1693 | .arg(QObject::tr( "Maker")) | 
|---|
| 1694 | .arg(mMake); | 
|---|
| 1695 | } | 
|---|
| 1696 | if (!fileExists(mDebugger)) { | 
|---|
| 1697 | msg += QObject::tr( "Cannot find the %1 \"%2\"") | 
|---|
| 1698 | .arg(QObject::tr( "Debugger")) | 
|---|
| 1699 | .arg(mDebugger); | 
|---|
| 1700 | } | 
|---|
| 1701 | if (!msg.isEmpty()) | 
|---|
| 1702 | return false; | 
|---|
| 1703 | else | 
|---|
| 1704 | return true; | 
|---|
| 1705 | } | 
|---|
| 1706 |  | 
|---|
| 1707 | const QString &Settings::CompilerSet::CCompiler() const | 
|---|
| 1708 | { | 
|---|
| 1709 | return mCCompiler; | 
|---|
| 1710 | } | 
|---|
| 1711 |  | 
|---|
| 1712 | void Settings::CompilerSet::setCCompiler(const QString &name) | 
|---|
| 1713 | { | 
|---|
| 1714 | mCCompiler = name; | 
|---|
| 1715 | } | 
|---|
| 1716 |  | 
|---|
| 1717 | const QString &Settings::CompilerSet::cppCompiler() const | 
|---|
| 1718 | { | 
|---|
| 1719 | return mCppCompiler; | 
|---|
| 1720 | } | 
|---|
| 1721 |  | 
|---|
| 1722 | void Settings::CompilerSet::setCppCompiler(const QString &name) | 
|---|
| 1723 | { | 
|---|
| 1724 | mCppCompiler = name; | 
|---|
| 1725 | } | 
|---|
| 1726 |  | 
|---|
| 1727 | const QString &Settings::CompilerSet::make() const | 
|---|
| 1728 | { | 
|---|
| 1729 | return mMake; | 
|---|
| 1730 | } | 
|---|
| 1731 |  | 
|---|
| 1732 | void Settings::CompilerSet::setMake(const QString &name) | 
|---|
| 1733 | { | 
|---|
| 1734 | mMake = name; | 
|---|
| 1735 | } | 
|---|
| 1736 |  | 
|---|
| 1737 | const QString &Settings::CompilerSet::debugger() const | 
|---|
| 1738 | { | 
|---|
| 1739 | return mDebugger; | 
|---|
| 1740 | } | 
|---|
| 1741 |  | 
|---|
| 1742 | void Settings::CompilerSet::setDebugger(const QString &name) | 
|---|
| 1743 | { | 
|---|
| 1744 | mDebugger = name; | 
|---|
| 1745 | } | 
|---|
| 1746 |  | 
|---|
| 1747 | const QString &Settings::CompilerSet::profiler() const | 
|---|
| 1748 | { | 
|---|
| 1749 | return mProfiler; | 
|---|
| 1750 | } | 
|---|
| 1751 |  | 
|---|
| 1752 | void Settings::CompilerSet::setProfiler(const QString &name) | 
|---|
| 1753 | { | 
|---|
| 1754 | mProfiler = name; | 
|---|
| 1755 | } | 
|---|
| 1756 |  | 
|---|
| 1757 | const QString &Settings::CompilerSet::resourceCompiler() const | 
|---|
| 1758 | { | 
|---|
| 1759 | return mResourceCompiler; | 
|---|
| 1760 | } | 
|---|
| 1761 |  | 
|---|
| 1762 | void Settings::CompilerSet::setResourceCompiler(const QString &name) | 
|---|
| 1763 | { | 
|---|
| 1764 | mResourceCompiler = name; | 
|---|
| 1765 | } | 
|---|
| 1766 |  | 
|---|
| 1767 | QStringList &Settings::CompilerSet::binDirs() | 
|---|
| 1768 | { | 
|---|
| 1769 | return mBinDirs; | 
|---|
| 1770 | } | 
|---|
| 1771 |  | 
|---|
| 1772 | QStringList &Settings::CompilerSet::CIncludeDirs() | 
|---|
| 1773 | { | 
|---|
| 1774 | return mCIncludeDirs; | 
|---|
| 1775 | } | 
|---|
| 1776 |  | 
|---|
| 1777 | QStringList &Settings::CompilerSet::CppIncludeDirs() | 
|---|
| 1778 | { | 
|---|
| 1779 | return mCppIncludeDirs; | 
|---|
| 1780 | } | 
|---|
| 1781 |  | 
|---|
| 1782 | QStringList &Settings::CompilerSet::libDirs() | 
|---|
| 1783 | { | 
|---|
| 1784 | return mLibDirs; | 
|---|
| 1785 | } | 
|---|
| 1786 |  | 
|---|
| 1787 | QStringList &Settings::CompilerSet::defaultCIncludeDirs() | 
|---|
| 1788 | { | 
|---|
| 1789 | if (!mFullLoaded && !binDirs().isEmpty()) { | 
|---|
| 1790 | mFullLoaded=true; | 
|---|
| 1791 | setDirectories(binDirs()[0],mCompilerType); | 
|---|
| 1792 | setDefines(); | 
|---|
| 1793 | } | 
|---|
| 1794 | return mDefaultCIncludeDirs; | 
|---|
| 1795 | } | 
|---|
| 1796 |  | 
|---|
| 1797 | QStringList &Settings::CompilerSet::defaultCppIncludeDirs() | 
|---|
| 1798 | { | 
|---|
| 1799 | if (!mFullLoaded && !binDirs().isEmpty()) { | 
|---|
| 1800 | mFullLoaded=true; | 
|---|
| 1801 | setDirectories(binDirs()[0],mCompilerType); | 
|---|
| 1802 | setDefines(); | 
|---|
| 1803 | } | 
|---|
| 1804 | return mDefaultCppIncludeDirs; | 
|---|
| 1805 | } | 
|---|
| 1806 |  | 
|---|
| 1807 | QStringList &Settings::CompilerSet::defaultLibDirs() | 
|---|
| 1808 | { | 
|---|
| 1809 | if (!mFullLoaded && !binDirs().isEmpty()) { | 
|---|
| 1810 | mFullLoaded=true; | 
|---|
| 1811 | setDirectories(binDirs()[0],mCompilerType); | 
|---|
| 1812 | setDefines(); | 
|---|
| 1813 | } | 
|---|
| 1814 | return mLibDirs; | 
|---|
| 1815 | } | 
|---|
| 1816 |  | 
|---|
| 1817 | const QString &Settings::CompilerSet::dumpMachine() const | 
|---|
| 1818 | { | 
|---|
| 1819 | return mDumpMachine; | 
|---|
| 1820 | } | 
|---|
| 1821 |  | 
|---|
| 1822 | void Settings::CompilerSet::setDumpMachine(const QString &value) | 
|---|
| 1823 | { | 
|---|
| 1824 | mDumpMachine = value; | 
|---|
| 1825 | } | 
|---|
| 1826 |  | 
|---|
| 1827 | const QString &Settings::CompilerSet::version() const | 
|---|
| 1828 | { | 
|---|
| 1829 | return mVersion; | 
|---|
| 1830 | } | 
|---|
| 1831 |  | 
|---|
| 1832 | void Settings::CompilerSet::setVersion(const QString &value) | 
|---|
| 1833 | { | 
|---|
| 1834 | mVersion = value; | 
|---|
| 1835 | } | 
|---|
| 1836 |  | 
|---|
| 1837 | const QString &Settings::CompilerSet::type() const | 
|---|
| 1838 | { | 
|---|
| 1839 | return mType; | 
|---|
| 1840 | } | 
|---|
| 1841 |  | 
|---|
| 1842 | void Settings::CompilerSet::setType(const QString& value) | 
|---|
| 1843 | { | 
|---|
| 1844 | mType = value; | 
|---|
| 1845 | } | 
|---|
| 1846 |  | 
|---|
| 1847 | const QString &Settings::CompilerSet::name() const | 
|---|
| 1848 | { | 
|---|
| 1849 | return mName; | 
|---|
| 1850 | } | 
|---|
| 1851 |  | 
|---|
| 1852 | void Settings::CompilerSet::setName(const QString &value) | 
|---|
| 1853 | { | 
|---|
| 1854 | mName = value; | 
|---|
| 1855 | } | 
|---|
| 1856 |  | 
|---|
| 1857 | const QStringList& Settings::CompilerSet::CDefines() | 
|---|
| 1858 | { | 
|---|
| 1859 | if (!mFullLoaded && !binDirs().isEmpty()) { | 
|---|
| 1860 | mFullLoaded=true; | 
|---|
| 1861 | setDirectories(binDirs()[0],mCompilerType); | 
|---|
| 1862 | setDefines(); | 
|---|
| 1863 | } | 
|---|
| 1864 | return mCDefines; | 
|---|
| 1865 | } | 
|---|
| 1866 |  | 
|---|
| 1867 | const QStringList &Settings::CompilerSet::CppDefines() | 
|---|
| 1868 | { | 
|---|
| 1869 | if (!mFullLoaded && !binDirs().isEmpty()) { | 
|---|
| 1870 | mFullLoaded=true; | 
|---|
| 1871 | setDirectories(binDirs()[0],mCompilerType); | 
|---|
| 1872 | setDefines(); | 
|---|
| 1873 | } | 
|---|
| 1874 | return mCppDefines; | 
|---|
| 1875 |  | 
|---|
| 1876 | } | 
|---|
| 1877 |  | 
|---|
| 1878 | const QString &Settings::CompilerSet::target() const | 
|---|
| 1879 | { | 
|---|
| 1880 | return mTarget; | 
|---|
| 1881 | } | 
|---|
| 1882 |  | 
|---|
| 1883 | void Settings::CompilerSet::setTarget(const QString &value) | 
|---|
| 1884 | { | 
|---|
| 1885 | mTarget = value; | 
|---|
| 1886 | } | 
|---|
| 1887 |  | 
|---|
| 1888 | void Settings::CompilerSet::setUseCustomCompileParams(bool value) | 
|---|
| 1889 | { | 
|---|
| 1890 | mUseCustomCompileParams = value; | 
|---|
| 1891 | } | 
|---|
| 1892 |  | 
|---|
| 1893 | bool Settings::CompilerSet::useCustomLinkParams() const | 
|---|
| 1894 | { | 
|---|
| 1895 | return mUseCustomLinkParams; | 
|---|
| 1896 | } | 
|---|
| 1897 |  | 
|---|
| 1898 | void Settings::CompilerSet::setUseCustomLinkParams(bool value) | 
|---|
| 1899 | { | 
|---|
| 1900 | mUseCustomLinkParams = value; | 
|---|
| 1901 | } | 
|---|
| 1902 |  | 
|---|
| 1903 | const QString &Settings::CompilerSet::customCompileParams() const | 
|---|
| 1904 | { | 
|---|
| 1905 | return mCustomCompileParams; | 
|---|
| 1906 | } | 
|---|
| 1907 |  | 
|---|
| 1908 | void Settings::CompilerSet::setCustomCompileParams(const QString &value) | 
|---|
| 1909 | { | 
|---|
| 1910 | mCustomCompileParams = value; | 
|---|
| 1911 | } | 
|---|
| 1912 |  | 
|---|
| 1913 | const QString &Settings::CompilerSet::customLinkParams() const | 
|---|
| 1914 | { | 
|---|
| 1915 | return mCustomLinkParams; | 
|---|
| 1916 | } | 
|---|
| 1917 |  | 
|---|
| 1918 | void Settings::CompilerSet::setCustomLinkParams(const QString &value) | 
|---|
| 1919 | { | 
|---|
| 1920 | mCustomLinkParams = value; | 
|---|
| 1921 | } | 
|---|
| 1922 |  | 
|---|
| 1923 | bool Settings::CompilerSet::autoAddCharsetParams() const | 
|---|
| 1924 | { | 
|---|
| 1925 | return mAutoAddCharsetParams; | 
|---|
| 1926 | } | 
|---|
| 1927 |  | 
|---|
| 1928 | void Settings::CompilerSet::setAutoAddCharsetParams(bool value) | 
|---|
| 1929 | { | 
|---|
| 1930 | mAutoAddCharsetParams = value; | 
|---|
| 1931 | } | 
|---|
| 1932 |  | 
|---|
| 1933 | int Settings::CompilerSet::charToValue(char valueChar) | 
|---|
| 1934 | { | 
|---|
| 1935 | if (valueChar == '1') { | 
|---|
| 1936 | return 1; | 
|---|
| 1937 | } else if ( (valueChar>='a') && (valueChar<='z')) { | 
|---|
| 1938 | return (valueChar-'a')+2; | 
|---|
| 1939 | } else { | 
|---|
| 1940 | return 0; | 
|---|
| 1941 | } | 
|---|
| 1942 | } | 
|---|
| 1943 |  | 
|---|
| 1944 | char Settings::CompilerSet::valueToChar(int val) | 
|---|
| 1945 | { | 
|---|
| 1946 | return ValueToChar[val]; | 
|---|
| 1947 | } | 
|---|
| 1948 |  | 
|---|
| 1949 | static void addExistingDirectory(QStringList& dirs, const QString& directory) { | 
|---|
| 1950 | if (!directoryExists(directory)) | 
|---|
| 1951 | return; | 
|---|
| 1952 | QFileInfo dirInfo(directory); | 
|---|
| 1953 | QString dirPath = dirInfo.absoluteFilePath(); | 
|---|
| 1954 | if (dirs.contains(dirPath)) | 
|---|
| 1955 | return; | 
|---|
| 1956 | dirs.append(dirPath); | 
|---|
| 1957 | } | 
|---|
| 1958 |  | 
|---|
| 1959 | void Settings::CompilerSet::setProperties(const QString &binDir, const QString& cc_prog) | 
|---|
| 1960 | { | 
|---|
| 1961 | if (cc_prog.isEmpty()) | 
|---|
| 1962 | return; | 
|---|
| 1963 | //    QString cc_prog; | 
|---|
| 1964 | //    if (fileExists(binDir, CLANG_PROGRAM)) | 
|---|
| 1965 | //        cc_prog = CLANG_PROGRAM; | 
|---|
| 1966 | //    else  if (fileExists(binDir,GCC_PROGRAM)) | 
|---|
| 1967 | //        cc_prog = GCC_PROGRAM; | 
|---|
| 1968 | //    else | 
|---|
| 1969 | //        return; | 
|---|
| 1970 | // Obtain version number and compiler distro etc | 
|---|
| 1971 | QStringList arguments; | 
|---|
| 1972 | arguments.append( "-v"); | 
|---|
| 1973 | QByteArray output = getCompilerOutput(binDir,cc_prog,arguments); | 
|---|
| 1974 |  | 
|---|
| 1975 | //Target | 
|---|
| 1976 | QByteArray targetStr = "Target: "; | 
|---|
| 1977 | int delimPos1 = output.indexOf(targetStr); | 
|---|
| 1978 | if (delimPos1<0) | 
|---|
| 1979 | return; // unknown binary | 
|---|
| 1980 | delimPos1+=strlen(targetStr); | 
|---|
| 1981 | int delimPos2 = delimPos1; | 
|---|
| 1982 | while (delimPos2<output.length() && !isNonPrintableAsciiChar(output[delimPos2])) | 
|---|
| 1983 | delimPos2++; | 
|---|
| 1984 | mTarget = output.mid(delimPos1,delimPos2-delimPos1); | 
|---|
| 1985 |  | 
|---|
| 1986 | if (mTarget.contains( "x86_64")) | 
|---|
| 1987 | mTarget = "x86_64"; | 
|---|
| 1988 | else | 
|---|
| 1989 | mTarget = "i686"; | 
|---|
| 1990 |  | 
|---|
| 1991 | //Find version number | 
|---|
| 1992 | targetStr = "clang version "; | 
|---|
| 1993 | delimPos1 = output.indexOf(targetStr); | 
|---|
| 1994 | if (delimPos1>=0) { | 
|---|
| 1995 | mCompilerType = COMPILER_CLANG; | 
|---|
| 1996 | delimPos1+=strlen(targetStr); | 
|---|
| 1997 | delimPos2 = delimPos1; | 
|---|
| 1998 | while (delimPos2<output.length() && !isNonPrintableAsciiChar(output[delimPos2])) | 
|---|
| 1999 | delimPos2++; | 
|---|
| 2000 | mVersion = output.mid(delimPos1,delimPos2-delimPos1); | 
|---|
| 2001 |  | 
|---|
| 2002 | mName = "Clang "+ mVersion; | 
|---|
| 2003 | } else { | 
|---|
| 2004 | mCompilerType = COMPILER_GCC; | 
|---|
| 2005 | targetStr = "gcc version "; | 
|---|
| 2006 | delimPos1 = output.indexOf(targetStr); | 
|---|
| 2007 | if (delimPos1<0) | 
|---|
| 2008 | return; // unknown binary | 
|---|
| 2009 | delimPos1+=strlen(targetStr); | 
|---|
| 2010 | delimPos2 = delimPos1; | 
|---|
| 2011 | while (delimPos2<output.length() && !isNonPrintableAsciiChar(output[delimPos2])) | 
|---|
| 2012 | delimPos2++; | 
|---|
| 2013 | mVersion = output.mid(delimPos1,delimPos2-delimPos1); | 
|---|
| 2014 |  | 
|---|
| 2015 | //        //fix for mingw64 gcc | 
|---|
| 2016 | //        double versionValue; | 
|---|
| 2017 | //        bool ok; | 
|---|
| 2018 | //        versionValue = mVersion.toDouble(&ok); | 
|---|
| 2019 | //        if (ok && versionValue>=12) { | 
|---|
| 2020 | //            mCompilerType=COMPILER_GCC_UTF8; | 
|---|
| 2021 | //        } | 
|---|
| 2022 |  | 
|---|
| 2023 | // Find compiler builder | 
|---|
| 2024 | delimPos1 = delimPos2; | 
|---|
| 2025 | while ((delimPos1 < output.length()) && !(output[delimPos1] == '(')) | 
|---|
| 2026 | delimPos1++; | 
|---|
| 2027 | while ((delimPos2 < output.length()) && !(output[delimPos2] == ')')) | 
|---|
| 2028 | delimPos2++; | 
|---|
| 2029 | mType = output.mid(delimPos1 + 1, delimPos2 - delimPos1 - 1); | 
|---|
| 2030 |  | 
|---|
| 2031 | // Assemble user friendly name if we don't have one yet | 
|---|
| 2032 | if (mName == "") { | 
|---|
| 2033 | if (mType.contains( "tdm64")) { | 
|---|
| 2034 | mName = "TDM-GCC "+ mVersion; | 
|---|
| 2035 | } else if (mType.contains( "tdm")) { | 
|---|
| 2036 | mName = "TDM-GCC "+ mVersion; | 
|---|
| 2037 | } else if (mType.contains( "MSYS2")) { | 
|---|
| 2038 | mName = "MinGW-w64 GCC "+ mVersion; | 
|---|
| 2039 | } else if (mType.contains( "GCC")) { | 
|---|
| 2040 | #ifdef Q_OS_WIN | 
|---|
| 2041 | mName = "MinGW GCC "+ mVersion; | 
|---|
| 2042 | #else | 
|---|
| 2043 | mName = "GCC "+ mVersion; | 
|---|
| 2044 | #endif | 
|---|
| 2045 | } else { | 
|---|
| 2046 | #ifdef Q_OS_WIN | 
|---|
| 2047 | mName = "MinGW GCC "+ mVersion; | 
|---|
| 2048 | #else | 
|---|
| 2049 | mName = "GCC "+ mVersion; | 
|---|
| 2050 | #endif | 
|---|
| 2051 | } | 
|---|
| 2052 | } | 
|---|
| 2053 | } | 
|---|
| 2054 |  | 
|---|
| 2055 | // Set compiler folder | 
|---|
| 2056 | QDir tmpDir(binDir); | 
|---|
| 2057 | tmpDir.cdUp(); | 
|---|
| 2058 | QString folder = tmpDir.path(); | 
|---|
| 2059 |  | 
|---|
| 2060 | // Obtain compiler target | 
|---|
| 2061 | arguments.clear(); | 
|---|
| 2062 | arguments.append( "-dumpmachine"); | 
|---|
| 2063 | mDumpMachine = getCompilerOutput(binDir, cc_prog, arguments); | 
|---|
| 2064 |  | 
|---|
| 2065 | // Add the default directories | 
|---|
| 2066 | addExistingDirectory(mBinDirs, includeTrailingPathDelimiter(folder) + "bin"); | 
|---|
| 2067 | //    addExistingDirectory(mDefaultLibDirs, includeTrailingPathDelimiter(folder) + "lib"); | 
|---|
| 2068 | //    addExistingDirectory(mDefaultCIncludeDirs, includeTrailingPathDelimiter(folder) + "include"); | 
|---|
| 2069 | //    addExistingDirectory(mDefaultCppIncludeDirs, includeTrailingPathDelimiter(folder) + "include"); | 
|---|
| 2070 |  | 
|---|
| 2071 | if (!mDumpMachine.isEmpty()) { | 
|---|
| 2072 | //mingw-w64 bin folder | 
|---|
| 2073 | addExistingDirectory(mBinDirs, | 
|---|
| 2074 | includeTrailingPathDelimiter(folder) + "lib/" | 
|---|
| 2075 | "gcc/"+ mDumpMachine | 
|---|
| 2076 | + "/"+ mVersion); | 
|---|
| 2077 | } | 
|---|
| 2078 | } | 
|---|
| 2079 |  | 
|---|
| 2080 | void Settings::CompilerSet::setDefines() { | 
|---|
| 2081 | // get default defines | 
|---|
| 2082 | QStringList arguments; | 
|---|
| 2083 | arguments.append( "-dM"); | 
|---|
| 2084 | arguments.append( "-E"); | 
|---|
| 2085 | arguments.append( "-x"); | 
|---|
| 2086 | arguments.append( "c++"); | 
|---|
| 2087 | arguments.append( "-std=c++17"); | 
|---|
| 2088 | arguments.append(NULL_FILE); | 
|---|
| 2089 | QFileInfo ccompiler(mCCompiler); | 
|---|
| 2090 | QByteArray output = getCompilerOutput(ccompiler.absolutePath(),ccompiler.fileName(),arguments); | 
|---|
| 2091 | // 'cpp.exe -dM -E -x c++ -std=c++17 NUL' | 
|---|
| 2092 |  | 
|---|
| 2093 | mCppDefines.clear(); | 
|---|
| 2094 | QList<QByteArray> lines = output.split('\n'); | 
|---|
| 2095 | for (QByteArray& line:lines) { | 
|---|
| 2096 | QByteArray trimmedLine = line.trimmed(); | 
|---|
| 2097 | if (!trimmedLine.isEmpty()) { | 
|---|
| 2098 | mCppDefines.append(trimmedLine); | 
|---|
| 2099 | } | 
|---|
| 2100 | } | 
|---|
| 2101 |  | 
|---|
| 2102 | arguments.clear(); | 
|---|
| 2103 | arguments.append( "-dM"); | 
|---|
| 2104 | arguments.append( "-E"); | 
|---|
| 2105 | arguments.append( "-x"); | 
|---|
| 2106 | arguments.append( "c"); | 
|---|
| 2107 | arguments.append(NULL_FILE); | 
|---|
| 2108 | output = getCompilerOutput(ccompiler.absolutePath(),ccompiler.fileName(),arguments); | 
|---|
| 2109 | // 'cpp.exe -dM -E -x c NUL' | 
|---|
| 2110 |  | 
|---|
| 2111 | mCDefines.clear(); | 
|---|
| 2112 | lines = output.split('\n'); | 
|---|
| 2113 | for (QByteArray& line:lines) { | 
|---|
| 2114 | QByteArray trimmedLine = line.trimmed(); | 
|---|
| 2115 | if (!trimmedLine.isEmpty()) { | 
|---|
| 2116 | mCDefines.append(trimmedLine); | 
|---|
| 2117 | } | 
|---|
| 2118 | } | 
|---|
| 2119 |  | 
|---|
| 2120 | } | 
|---|
| 2121 |  | 
|---|
| 2122 | void Settings::CompilerSet::setExecutables() | 
|---|
| 2123 | { | 
|---|
| 2124 | if (mCompilerType == COMPILER_CLANG) { | 
|---|
| 2125 | mCCompiler =  findProgramInBinDirs(CLANG_PROGRAM); | 
|---|
| 2126 | mCppCompiler = findProgramInBinDirs(CLANG_CPP_PROGRAM); | 
|---|
| 2127 | mDebugger = findProgramInBinDirs(GDB_PROGRAM); | 
|---|
| 2128 | mDebugServer = findProgramInBinDirs(GDB_SERVER_PROGRAM); | 
|---|
| 2129 | if (mCCompiler.isEmpty()) | 
|---|
| 2130 | mCCompiler =  findProgramInBinDirs(GCC_PROGRAM); | 
|---|
| 2131 | if (mCppCompiler.isEmpty()) | 
|---|
| 2132 | mCppCompiler = findProgramInBinDirs(GPP_PROGRAM); | 
|---|
| 2133 | //        if (mDebugger.isEmpty()) | 
|---|
| 2134 | //            mDebugger = findProgramInBinDirs(GDB_PROGRAM); | 
|---|
| 2135 | //        if (mDebugServer.isEmpty()) | 
|---|
| 2136 | //            mDebugServer = findProgramInBinDirs(GDB_SERVER_PROGRAM); | 
|---|
| 2137 | } else { | 
|---|
| 2138 | mCCompiler =  findProgramInBinDirs(GCC_PROGRAM); | 
|---|
| 2139 | mCppCompiler = findProgramInBinDirs(GPP_PROGRAM); | 
|---|
| 2140 | mDebugger = findProgramInBinDirs(GDB_PROGRAM); | 
|---|
| 2141 | mDebugServer = findProgramInBinDirs(GDB_SERVER_PROGRAM); | 
|---|
| 2142 | } | 
|---|
| 2143 | mMake = findProgramInBinDirs(MAKE_PROGRAM); | 
|---|
| 2144 | mResourceCompiler = findProgramInBinDirs(WINDRES_PROGRAM); | 
|---|
| 2145 | mProfiler = findProgramInBinDirs(GPROF_PROGRAM); | 
|---|
| 2146 | } | 
|---|
| 2147 |  | 
|---|
| 2148 | void Settings::CompilerSet::setDirectories(const QString& binDir,const QString& compilerType) | 
|---|
| 2149 | { | 
|---|
| 2150 | QString folder = QFileInfo(binDir).absolutePath(); | 
|---|
| 2151 | QString cc_prog; | 
|---|
| 2152 | if (compilerType==COMPILER_CLANG) | 
|---|
| 2153 | cc_prog = CLANG_PROGRAM; | 
|---|
| 2154 | else | 
|---|
| 2155 | cc_prog = GCC_PROGRAM; | 
|---|
| 2156 | // Find default directories | 
|---|
| 2157 | // C include dirs | 
|---|
| 2158 | QStringList arguments; | 
|---|
| 2159 | arguments.clear(); | 
|---|
| 2160 | arguments.append( "-xc"); | 
|---|
| 2161 | arguments.append( "-v"); | 
|---|
| 2162 | arguments.append( "-E"); | 
|---|
| 2163 | arguments.append(NULL_FILE); | 
|---|
| 2164 | QByteArray output = getCompilerOutput(binDir,cc_prog,arguments); | 
|---|
| 2165 |  | 
|---|
| 2166 | int delimPos1 = output.indexOf( "#include <...> search starts here:"); | 
|---|
| 2167 | int delimPos2 = output.indexOf( "End of search list."); | 
|---|
| 2168 | if (delimPos1 >0 && delimPos2>0 ) { | 
|---|
| 2169 | delimPos1 += QByteArray( "#include <...> search starts here:").length(); | 
|---|
| 2170 | QList<QByteArray> lines = output.mid(delimPos1, delimPos2-delimPos1).split('\n'); | 
|---|
| 2171 | for (QByteArray& line:lines) { | 
|---|
| 2172 | QByteArray trimmedLine = line.trimmed(); | 
|---|
| 2173 | if (!trimmedLine.isEmpty()) { | 
|---|
| 2174 | addExistingDirectory(mDefaultCIncludeDirs,trimmedLine); | 
|---|
| 2175 | } | 
|---|
| 2176 | } | 
|---|
| 2177 | } | 
|---|
| 2178 |  | 
|---|
| 2179 | // Find default directories | 
|---|
| 2180 | // C++ include dirs | 
|---|
| 2181 | arguments.clear(); | 
|---|
| 2182 | arguments.append( "-xc++"); | 
|---|
| 2183 | arguments.append( "-E"); | 
|---|
| 2184 | arguments.append( "-v"); | 
|---|
| 2185 | arguments.append(NULL_FILE); | 
|---|
| 2186 | output = getCompilerOutput(binDir,cc_prog,arguments); | 
|---|
| 2187 | //gcc -xc++ -E -v NUL | 
|---|
| 2188 |  | 
|---|
| 2189 | delimPos1 = output.indexOf( "#include <...> search starts here:"); | 
|---|
| 2190 | delimPos2 = output.indexOf( "End of search list."); | 
|---|
| 2191 | if (delimPos1 >0 && delimPos2>0 ) { | 
|---|
| 2192 | delimPos1 += QByteArray( "#include <...> search starts here:").length(); | 
|---|
| 2193 | QList<QByteArray> lines = output.mid(delimPos1, delimPos2-delimPos1).split('\n'); | 
|---|
| 2194 | for (QByteArray& line:lines) { | 
|---|
| 2195 | QByteArray trimmedLine = line.trimmed(); | 
|---|
| 2196 | if (!trimmedLine.isEmpty()) { | 
|---|
| 2197 | addExistingDirectory(mDefaultCppIncludeDirs,trimmedLine); | 
|---|
| 2198 | } | 
|---|
| 2199 | } | 
|---|
| 2200 | } | 
|---|
| 2201 |  | 
|---|
| 2202 | // Find default directories | 
|---|
| 2203 | arguments.clear(); | 
|---|
| 2204 | arguments.append( "-print-search-dirs"); | 
|---|
| 2205 | arguments.append(NULL_FILE); | 
|---|
| 2206 | output = getCompilerOutput(binDir,cc_prog,arguments); | 
|---|
| 2207 | // bin dirs | 
|---|
| 2208 | QByteArray targetStr = QByteArray( "programs: ="); | 
|---|
| 2209 | delimPos1 = output.indexOf(targetStr); | 
|---|
| 2210 | if (delimPos1>=0) { | 
|---|
| 2211 | delimPos1+=targetStr.length(); | 
|---|
| 2212 | delimPos2 = delimPos1; | 
|---|
| 2213 | while (delimPos2 < output.length() && output[delimPos2]!='\n') | 
|---|
| 2214 | delimPos2+=1; | 
|---|
| 2215 | QList<QByteArray> lines = output.mid(delimPos1,delimPos2-delimPos1).split(';'); | 
|---|
| 2216 | for (QByteArray& line:lines) { | 
|---|
| 2217 | QByteArray trimmedLine = line.trimmed(); | 
|---|
| 2218 | if (!trimmedLine.isEmpty()) | 
|---|
| 2219 | addExistingDirectory(mBinDirs,trimmedLine); | 
|---|
| 2220 | } | 
|---|
| 2221 | } | 
|---|
| 2222 | // lib dirs | 
|---|
| 2223 | targetStr = QByteArray( "libraries: ="); | 
|---|
| 2224 | delimPos1 = output.indexOf(targetStr); | 
|---|
| 2225 | if (delimPos1>=0) { | 
|---|
| 2226 | delimPos1+=targetStr.length(); | 
|---|
| 2227 | delimPos2 = delimPos1; | 
|---|
| 2228 | while (delimPos2 < output.length() && output[delimPos2]!='\n') | 
|---|
| 2229 | delimPos2+=1; | 
|---|
| 2230 | QList<QByteArray> lines = output.mid(delimPos1,delimPos2-delimPos1).split(';'); | 
|---|
| 2231 | for (QByteArray& line:lines) { | 
|---|
| 2232 | QByteArray trimmedLine = line.trimmed(); | 
|---|
| 2233 | if (!trimmedLine.isEmpty()) | 
|---|
| 2234 | addExistingDirectory(mDefaultLibDirs,trimmedLine); | 
|---|
| 2235 | } | 
|---|
| 2236 | } | 
|---|
| 2237 |  | 
|---|
| 2238 | // Try to obtain our target/autoconf folder | 
|---|
| 2239 | if (!mDumpMachine.isEmpty()) { | 
|---|
| 2240 | //mingw-w64 bin folder | 
|---|
| 2241 | addExistingDirectory(mBinDirs, | 
|---|
| 2242 | includeTrailingPathDelimiter(folder) + "lib/" | 
|---|
| 2243 | "gcc/"+ mDumpMachine | 
|---|
| 2244 | + "/"+ mVersion); | 
|---|
| 2245 |  | 
|---|
| 2246 | // Regular include folder | 
|---|
| 2247 | addExistingDirectory(mDefaultCIncludeDirs, includeTrailingPathDelimiter(folder) + mDumpMachine + "/include"); | 
|---|
| 2248 | addExistingDirectory(mDefaultCppIncludeDirs, includeTrailingPathDelimiter(folder)+ mDumpMachine + "/include"); | 
|---|
| 2249 |  | 
|---|
| 2250 | // Other include folder? | 
|---|
| 2251 | addExistingDirectory(mDefaultCIncludeDirs, | 
|---|
| 2252 | includeTrailingPathDelimiter(folder) + "lib/gcc/" | 
|---|
| 2253 | + mDumpMachine + "/"+ mVersion + "/include"); | 
|---|
| 2254 | addExistingDirectory(mDefaultCppIncludeDirs, | 
|---|
| 2255 | includeTrailingPathDelimiter(folder) + "lib/gcc/" | 
|---|
| 2256 | + mDumpMachine + "/"+ mVersion + "/include"); | 
|---|
| 2257 |  | 
|---|
| 2258 | addExistingDirectory(mDefaultCIncludeDirs, | 
|---|
| 2259 | includeTrailingPathDelimiter(folder) + "lib/gcc/" | 
|---|
| 2260 | + mDumpMachine + "/"+ mVersion + "/include-fixed"); | 
|---|
| 2261 | addExistingDirectory(mDefaultCppIncludeDirs, | 
|---|
| 2262 | includeTrailingPathDelimiter(folder) + "lib/gcc/" | 
|---|
| 2263 | + mDumpMachine + "/"+ mVersion + "/include-fixed"); | 
|---|
| 2264 |  | 
|---|
| 2265 | // C++ only folder (mingw.org) | 
|---|
| 2266 | addExistingDirectory(mDefaultCppIncludeDirs, | 
|---|
| 2267 | includeTrailingPathDelimiter(folder)  + "lib/gcc/" | 
|---|
| 2268 | + mDumpMachine + "/"+ mVersion + "/include/c++"); | 
|---|
| 2269 | addExistingDirectory(mDefaultCppIncludeDirs, | 
|---|
| 2270 | includeTrailingPathDelimiter(folder)  + "lib/gcc/" | 
|---|
| 2271 | + mDumpMachine + "/"+ mVersion + "/include/c++/" | 
|---|
| 2272 | + mDumpMachine); | 
|---|
| 2273 | addExistingDirectory(mDefaultCppIncludeDirs, | 
|---|
| 2274 | includeTrailingPathDelimiter(folder)  + "lib/gcc/" | 
|---|
| 2275 | + mDumpMachine + "/"+ mVersion + "/include/c++/backward"); | 
|---|
| 2276 |  | 
|---|
| 2277 | // C++ only folder (Mingw-w64) | 
|---|
| 2278 | addExistingDirectory(mDefaultCppIncludeDirs, | 
|---|
| 2279 | includeTrailingPathDelimiter(folder)  + "include/c++/" | 
|---|
| 2280 | + mVersion ); | 
|---|
| 2281 | addExistingDirectory(mDefaultCppIncludeDirs, | 
|---|
| 2282 | includeTrailingPathDelimiter(folder)  + "include/c++/" | 
|---|
| 2283 | + mVersion + "/backward"); | 
|---|
| 2284 | addExistingDirectory(mDefaultCppIncludeDirs, | 
|---|
| 2285 | includeTrailingPathDelimiter(folder)  + "include/c++/" | 
|---|
| 2286 | + mVersion + "/"+ mDumpMachine); | 
|---|
| 2287 | } | 
|---|
| 2288 | } | 
|---|
| 2289 |  | 
|---|
| 2290 | int Settings::CompilerSet::mainVersion() | 
|---|
| 2291 | { | 
|---|
| 2292 | int i = mVersion.indexOf('.'); | 
|---|
| 2293 | if (i<0) | 
|---|
| 2294 | return -1; | 
|---|
| 2295 | bool ok; | 
|---|
| 2296 | int num = mVersion.left(i).toInt(&ok); | 
|---|
| 2297 | if (!ok) | 
|---|
| 2298 | return -1; | 
|---|
| 2299 | return num; | 
|---|
| 2300 |  | 
|---|
| 2301 | } | 
|---|
| 2302 |  | 
|---|
| 2303 | void Settings::CompilerSet::setUserInput() | 
|---|
| 2304 | { | 
|---|
| 2305 | mUseCustomCompileParams = false; | 
|---|
| 2306 | mUseCustomLinkParams = false; | 
|---|
| 2307 | mAutoAddCharsetParams = true; | 
|---|
| 2308 | mStaticLink = true; | 
|---|
| 2309 | } | 
|---|
| 2310 |  | 
|---|
| 2311 |  | 
|---|
| 2312 | QString Settings::CompilerSet::findProgramInBinDirs(const QString name) | 
|---|
| 2313 | { | 
|---|
| 2314 | for (const QString& dir : mBinDirs) { | 
|---|
| 2315 | QFileInfo f(includeTrailingPathDelimiter(dir) + name); | 
|---|
| 2316 | if (f.exists() && f.isExecutable()) { | 
|---|
| 2317 | return f.absoluteFilePath(); | 
|---|
| 2318 | } | 
|---|
| 2319 | } | 
|---|
| 2320 | return QString(); | 
|---|
| 2321 | } | 
|---|
| 2322 |  | 
|---|
| 2323 | void Settings::CompilerSet::setIniOptions(const QByteArray &value) | 
|---|
| 2324 | { | 
|---|
| 2325 | if (value.isEmpty()) | 
|---|
| 2326 | return; | 
|---|
| 2327 | mCompileOptions.clear(); | 
|---|
| 2328 | for (int i=0;i<value.length();i++) { | 
|---|
| 2329 | QString key = pSettings->compilerSets().getKeyFromCompilerCompatibleIndex(i); | 
|---|
| 2330 | setCompileOption(key,charToValue(value[i])); | 
|---|
| 2331 | } | 
|---|
| 2332 | } | 
|---|
| 2333 |  | 
|---|
| 2334 | QByteArray Settings::CompilerSet::getCompilerOutput(const QString &binDir, const QString &binFile, const QStringList &arguments) | 
|---|
| 2335 | { | 
|---|
| 2336 | QProcessEnvironment env; | 
|---|
| 2337 | env.insert( "LANG", "en"); | 
|---|
| 2338 | QByteArray result = runAndGetOutput( | 
|---|
| 2339 | includeTrailingPathDelimiter(binDir)+binFile, | 
|---|
| 2340 | binDir, | 
|---|
| 2341 | arguments, | 
|---|
| 2342 | QByteArray(), | 
|---|
| 2343 | false, | 
|---|
| 2344 | env); | 
|---|
| 2345 | return result.trimmed(); | 
|---|
| 2346 | } | 
|---|
| 2347 |  | 
|---|
| 2348 | const QMap<QString, QString> &Settings::CompilerSet::compileOptions() const | 
|---|
| 2349 | { | 
|---|
| 2350 | return mCompileOptions; | 
|---|
| 2351 | } | 
|---|
| 2352 |  | 
|---|
| 2353 | const QString &Settings::CompilerSet::execCharset() const | 
|---|
| 2354 | { | 
|---|
| 2355 | return mExecCharset; | 
|---|
| 2356 | } | 
|---|
| 2357 |  | 
|---|
| 2358 | void Settings::CompilerSet::setExecCharset(const QString &newExecCharset) | 
|---|
| 2359 | { | 
|---|
| 2360 | mExecCharset = newExecCharset; | 
|---|
| 2361 | } | 
|---|
| 2362 |  | 
|---|
| 2363 | const QString &Settings::CompilerSet::debugServer() const | 
|---|
| 2364 | { | 
|---|
| 2365 | return mDebugServer; | 
|---|
| 2366 | } | 
|---|
| 2367 |  | 
|---|
| 2368 | void Settings::CompilerSet::setDebugServer(const QString &newDebugServer) | 
|---|
| 2369 | { | 
|---|
| 2370 | mDebugServer = newDebugServer; | 
|---|
| 2371 | } | 
|---|
| 2372 |  | 
|---|
| 2373 | int Settings::CompilerSet::compilerSetType() const | 
|---|
| 2374 | { | 
|---|
| 2375 | return mCompilerSetType; | 
|---|
| 2376 | } | 
|---|
| 2377 |  | 
|---|
| 2378 | void Settings::CompilerSet::setCompilerSetType(int newCompilerSetType) | 
|---|
| 2379 | { | 
|---|
| 2380 | mCompilerSetType = newCompilerSetType; | 
|---|
| 2381 | } | 
|---|
| 2382 |  | 
|---|
| 2383 | void Settings::CompilerSet::setCompilerType(const QString &newCompilerType) | 
|---|
| 2384 | { | 
|---|
| 2385 | mCompilerType = newCompilerType; | 
|---|
| 2386 | } | 
|---|
| 2387 |  | 
|---|
| 2388 | const QString &Settings::CompilerSet::compilerType() const | 
|---|
| 2389 | { | 
|---|
| 2390 | return mCompilerType; | 
|---|
| 2391 | } | 
|---|
| 2392 |  | 
|---|
| 2393 | bool Settings::CompilerSet::staticLink() const | 
|---|
| 2394 | { | 
|---|
| 2395 | return mStaticLink; | 
|---|
| 2396 | } | 
|---|
| 2397 |  | 
|---|
| 2398 | void Settings::CompilerSet::setStaticLink(bool newStaticLink) | 
|---|
| 2399 | { | 
|---|
| 2400 | mStaticLink = newStaticLink; | 
|---|
| 2401 | } | 
|---|
| 2402 |  | 
|---|
| 2403 | bool Settings::CompilerSet::useCustomCompileParams() const | 
|---|
| 2404 | { | 
|---|
| 2405 | return mUseCustomCompileParams; | 
|---|
| 2406 | } | 
|---|
| 2407 |  | 
|---|
| 2408 | Settings::CompilerSets::CompilerSets(Settings *settings): | 
|---|
| 2409 | mDefaultIndex(-1), | 
|---|
| 2410 | mSettings(settings) | 
|---|
| 2411 | { | 
|---|
| 2412 | prepareCompatibleIndex(); | 
|---|
| 2413 | } | 
|---|
| 2414 |  | 
|---|
| 2415 | Settings::PCompilerSet Settings::CompilerSets::addSet() | 
|---|
| 2416 | { | 
|---|
| 2417 | PCompilerSet p=std::make_shared<CompilerSet>(); | 
|---|
| 2418 | mList.push_back(p); | 
|---|
| 2419 | return p; | 
|---|
| 2420 | } | 
|---|
| 2421 |  | 
|---|
| 2422 | Settings::PCompilerSet Settings::CompilerSets::addSet(const QString &folder, const QString& cc_prog) | 
|---|
| 2423 | { | 
|---|
| 2424 | PCompilerSet p=std::make_shared<CompilerSet>(folder,cc_prog); | 
|---|
| 2425 | if (cc_prog==GCC_PROGRAM && p->compilerType()==COMPILER_CLANG) | 
|---|
| 2426 | return PCompilerSet(); | 
|---|
| 2427 | mList.push_back(p); | 
|---|
| 2428 | return p; | 
|---|
| 2429 | } | 
|---|
| 2430 |  | 
|---|
| 2431 | Settings::PCompilerSet Settings::CompilerSets::addSet(const PCompilerSet &pSet) | 
|---|
| 2432 | { | 
|---|
| 2433 | PCompilerSet p=std::make_shared<CompilerSet>(*pSet); | 
|---|
| 2434 | mList.push_back(p); | 
|---|
| 2435 | return p; | 
|---|
| 2436 | } | 
|---|
| 2437 |  | 
|---|
| 2438 | static void set64_32Options(Settings::PCompilerSet pSet) { | 
|---|
| 2439 | pSet->setCompileOption(CC_CMD_OPT_POINTER_SIZE, "32"); | 
|---|
| 2440 | } | 
|---|
| 2441 |  | 
|---|
| 2442 | static void setReleaseOptions(Settings::PCompilerSet pSet) { | 
|---|
| 2443 | pSet->setCompileOption(CC_CMD_OPT_OPTIMIZE, "2"); | 
|---|
| 2444 | pSet->setCompileOption(LINK_CMD_OPT_STRIP_EXE, COMPILER_OPTION_ON); | 
|---|
| 2445 | pSet->setCompileOption(CC_CMD_OPT_USE_PIPE, COMPILER_OPTION_ON); | 
|---|
| 2446 | pSet->setStaticLink(true); | 
|---|
| 2447 | } | 
|---|
| 2448 |  | 
|---|
| 2449 | static void setDebugOptions(Settings::PCompilerSet pSet) { | 
|---|
| 2450 | pSet->setCompileOption(CC_CMD_OPT_DEBUG_INFO, COMPILER_OPTION_ON); | 
|---|
| 2451 | pSet->setCompileOption(CC_CMD_OPT_WARNING_ALL, COMPILER_OPTION_ON); | 
|---|
| 2452 | pSet->setCompileOption(CC_CMD_OPT_WARNING_EXTRA, COMPILER_OPTION_ON); | 
|---|
| 2453 | pSet->setCompileOption(CC_CMD_OPT_USE_PIPE, COMPILER_OPTION_ON); | 
|---|
| 2454 |  | 
|---|
| 2455 | #ifdef Q_OS_LINUX | 
|---|
| 2456 | pSet->setCustomCompileParams( "-fsanitize=address"); | 
|---|
| 2457 | pSet->setUseCustomCompileParams(true); | 
|---|
| 2458 | pSet->setCustomLinkParams( "-fsanitize=address"); | 
|---|
| 2459 | pSet->setUseCustomLinkParams(true); | 
|---|
| 2460 | #endif | 
|---|
| 2461 |  | 
|---|
| 2462 | pSet->setStaticLink(false); | 
|---|
| 2463 | } | 
|---|
| 2464 |  | 
|---|
| 2465 | bool Settings::CompilerSets::addSets(const QString &folder, const QString& cc_prog) { | 
|---|
| 2466 | // Default, release profile | 
|---|
| 2467 | PCompilerSet baseSet = addSet(folder,cc_prog); | 
|---|
| 2468 | if (!baseSet) | 
|---|
| 2469 | return false; | 
|---|
| 2470 | QString baseName = baseSet->name(); | 
|---|
| 2471 | QString platformName; | 
|---|
| 2472 | if (baseSet->target() == "x86_64") { | 
|---|
| 2473 | if (baseName.startsWith( "TDM-GCC ")) { | 
|---|
| 2474 | PCompilerSet set= addSet(baseSet); | 
|---|
| 2475 | platformName = "32-bit"; | 
|---|
| 2476 | set->setName(baseName + " "+ platformName + " Release"); | 
|---|
| 2477 | set->setCompilerSetType(CompilerSetType::CST_RELEASE); | 
|---|
| 2478 | set64_32Options(set); | 
|---|
| 2479 | setReleaseOptions(set); | 
|---|
| 2480 |  | 
|---|
| 2481 | set = addSet(baseSet); | 
|---|
| 2482 | set->setName(baseName + " "+ platformName + " Debug"); | 
|---|
| 2483 | set->setCompilerSetType(CompilerSetType::CST_DEBUG); | 
|---|
| 2484 | set64_32Options(set); | 
|---|
| 2485 | setDebugOptions(set); | 
|---|
| 2486 | } | 
|---|
| 2487 | platformName = "64-bit"; | 
|---|
| 2488 | } else { | 
|---|
| 2489 | platformName = "32-bit"; | 
|---|
| 2490 | } | 
|---|
| 2491 |  | 
|---|
| 2492 |  | 
|---|
| 2493 | PCompilerSet set = addSet(baseSet); | 
|---|
| 2494 | set->setName(baseName + " "+ platformName + " Debug"); | 
|---|
| 2495 | set->setCompilerSetType(CompilerSetType::CST_DEBUG); | 
|---|
| 2496 | setDebugOptions(set); | 
|---|
| 2497 |  | 
|---|
| 2498 | baseSet->setName(baseName + " "+ platformName + " Release"); | 
|---|
| 2499 | baseSet->setCompilerSetType(CompilerSetType::CST_RELEASE); | 
|---|
| 2500 | setReleaseOptions(baseSet); | 
|---|
| 2501 |  | 
|---|
| 2502 | //    baseSet = addSet(folder); | 
|---|
| 2503 | //    baseSet->setName(baseName + " " + platformName + " Profiling"); | 
|---|
| 2504 | //    baseSet->setCompilerSetType(CompilerSetType::CST_PROFILING); | 
|---|
| 2505 | //    setProfileOptions(baseSet); | 
|---|
| 2506 |  | 
|---|
| 2507 | mDefaultIndex = (int)mList.size() - 1; | 
|---|
| 2508 | return true; | 
|---|
| 2509 |  | 
|---|
| 2510 | } | 
|---|
| 2511 |  | 
|---|
| 2512 | bool Settings::CompilerSets::addSets(const QString &folder) | 
|---|
| 2513 | { | 
|---|
| 2514 | if (!directoryExists(folder)) | 
|---|
| 2515 | return false; | 
|---|
| 2516 | if (!fileExists(folder, GCC_PROGRAM) && !fileExists(folder, CLANG_PROGRAM)) { | 
|---|
| 2517 | return false; | 
|---|
| 2518 | } | 
|---|
| 2519 | if (fileExists(folder, GCC_PROGRAM)) { | 
|---|
| 2520 | addSets(folder,GCC_PROGRAM); | 
|---|
| 2521 | } | 
|---|
| 2522 | if (fileExists(folder, CLANG_PROGRAM)) { | 
|---|
| 2523 | addSets(folder,CLANG_PROGRAM); | 
|---|
| 2524 | } | 
|---|
| 2525 | return true; | 
|---|
| 2526 |  | 
|---|
| 2527 | } | 
|---|
| 2528 |  | 
|---|
| 2529 | void Settings::CompilerSets::clearSets() | 
|---|
| 2530 | { | 
|---|
| 2531 | for (size_t i=0;i<mList.size();i++) { | 
|---|
| 2532 | mSettings->mSettings.beginGroup(QString(SETTING_COMPILTER_SET).arg(i)); | 
|---|
| 2533 | mSettings->mSettings.remove( ""); | 
|---|
| 2534 | mSettings->mSettings.endGroup(); | 
|---|
| 2535 | } | 
|---|
| 2536 | mList.clear(); | 
|---|
| 2537 | mDefaultIndex = -1; | 
|---|
| 2538 | } | 
|---|
| 2539 |  | 
|---|
| 2540 | void Settings::CompilerSets::findSets() | 
|---|
| 2541 | { | 
|---|
| 2542 | clearSets(); | 
|---|
| 2543 | QSet<QString> searched; | 
|---|
| 2544 |  | 
|---|
| 2545 | QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); | 
|---|
| 2546 | QString path = env.value( "PATH"); | 
|---|
| 2547 | QStringList pathList = path.split(PATH_SEPARATOR); | 
|---|
| 2548 | QString folder; | 
|---|
| 2549 | for (int i=pathList.count()-1;i>=0;i--) { | 
|---|
| 2550 | folder = pathList[i]; | 
|---|
| 2551 | if (searched.contains(folder)) | 
|---|
| 2552 | continue; | 
|---|
| 2553 | searched.insert(folder); | 
|---|
| 2554 | if (folder!= "/bin") { // /bin/gcc is symbolic link to /usr/bin/gcc | 
|---|
| 2555 | addSets(folder); | 
|---|
| 2556 | } | 
|---|
| 2557 | } | 
|---|
| 2558 |  | 
|---|
| 2559 | #ifdef Q_OS_WIN | 
|---|
| 2560 | folder = includeTrailingPathDelimiter(mSettings->dirs().appDir())+ "MinGW32"+QDir::separator()+ "bin"; | 
|---|
| 2561 | if (!searched.contains(folder)) { | 
|---|
| 2562 | addSets(folder); | 
|---|
| 2563 | searched.insert(folder); | 
|---|
| 2564 | } | 
|---|
| 2565 | folder = includeTrailingPathDelimiter(mSettings->dirs().appDir())+ "MinGW64"+QDir::separator()+ "bin"; | 
|---|
| 2566 | if (!searched.contains(folder)) { | 
|---|
| 2567 | addSets(folder); | 
|---|
| 2568 | searched.insert(folder); | 
|---|
| 2569 | } | 
|---|
| 2570 | folder = includeTrailingPathDelimiter(mSettings->dirs().appDir())+ "Clang64"+QDir::separator()+ "bin"; | 
|---|
| 2571 | if (!searched.contains(folder)) { | 
|---|
| 2572 | addSets(folder); | 
|---|
| 2573 | searched.insert(folder); | 
|---|
| 2574 | } | 
|---|
| 2575 | #endif | 
|---|
| 2576 |  | 
|---|
| 2577 | } | 
|---|
| 2578 |  | 
|---|
| 2579 | void Settings::CompilerSets::saveSets() | 
|---|
| 2580 | { | 
|---|
| 2581 | for (size_t i=0;i<mList.size();i++) { | 
|---|
| 2582 | saveSet(i); | 
|---|
| 2583 | } | 
|---|
| 2584 | if (mDefaultIndex>=(int)mList.size()) { | 
|---|
| 2585 | mDefaultIndex = mList.size()-1; | 
|---|
| 2586 | } | 
|---|
| 2587 | mSettings->mSettings.beginGroup(SETTING_COMPILTER_SETS); | 
|---|
| 2588 | mSettings->mSettings.setValue(SETTING_COMPILTER_SETS_DEFAULT_INDEX,mDefaultIndex); | 
|---|
| 2589 | mSettings->mSettings.setValue(SETTING_COMPILTER_SETS_COUNT,(int)mList.size()); | 
|---|
| 2590 | mSettings->mSettings.endGroup(); | 
|---|
| 2591 | } | 
|---|
| 2592 |  | 
|---|
| 2593 | void Settings::CompilerSets::loadSets() | 
|---|
| 2594 | { | 
|---|
| 2595 | mList.clear(); | 
|---|
| 2596 | mSettings->mSettings.beginGroup(SETTING_COMPILTER_SETS); | 
|---|
| 2597 | mDefaultIndex =mSettings->mSettings.value(SETTING_COMPILTER_SETS_DEFAULT_INDEX,-1).toInt(); | 
|---|
| 2598 | int listSize = mSettings->mSettings.value(SETTING_COMPILTER_SETS_COUNT,0).toInt(); | 
|---|
| 2599 | mSettings->mSettings.endGroup(); | 
|---|
| 2600 | bool loadError = false; | 
|---|
| 2601 | for (int i=0;i<listSize;i++) { | 
|---|
| 2602 | PCompilerSet pSet=loadSet(i); | 
|---|
| 2603 | if (!pSet) { | 
|---|
| 2604 | loadError = true; | 
|---|
| 2605 | break; | 
|---|
| 2606 | } | 
|---|
| 2607 | mList.push_back(pSet); | 
|---|
| 2608 | } | 
|---|
| 2609 | if (loadError) { | 
|---|
| 2610 | mList.clear(); | 
|---|
| 2611 | mDefaultIndex = -1; | 
|---|
| 2612 | } | 
|---|
| 2613 | PCompilerSet pCurrentSet = defaultSet(); | 
|---|
| 2614 | if (pCurrentSet) { | 
|---|
| 2615 | QString msg; | 
|---|
| 2616 | if (!pCurrentSet->dirsValid(msg) || !pCurrentSet->validateExes(msg)) { | 
|---|
| 2617 | if (QMessageBox::warning(nullptr,QObject::tr( "Confirm"), | 
|---|
| 2618 | QObject::tr( "The following problems were found during validation of compiler set \"%1\":") | 
|---|
| 2619 | .arg(pCurrentSet->name()) | 
|---|
| 2620 | + "<br /><br />" | 
|---|
| 2621 | +msg | 
|---|
| 2622 | + "<br /><br />" | 
|---|
| 2623 | +QObject::tr( "Leaving those directories will lead to problems during compilation.") | 
|---|
| 2624 | + "<br /><br />" | 
|---|
| 2625 | +QObject::tr( "Would you like Red Panda C++ to remove them for you and add the default paths to the valid paths?") | 
|---|
| 2626 | , | 
|---|
| 2627 | QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) { | 
|---|
| 2628 | return; | 
|---|
| 2629 | } | 
|---|
| 2630 | findSets(); | 
|---|
| 2631 | if ( (int)mList.size() <= mDefaultIndex) | 
|---|
| 2632 | mDefaultIndex =  mList.size()-1; | 
|---|
| 2633 | pCurrentSet = defaultSet(); | 
|---|
| 2634 | if (!pCurrentSet) { | 
|---|
| 2635 | mList.clear(); | 
|---|
| 2636 | mDefaultIndex = -1; | 
|---|
| 2637 | saveSets(); | 
|---|
| 2638 | return; | 
|---|
| 2639 | } | 
|---|
| 2640 | saveSets(); | 
|---|
| 2641 | if (pCurrentSet->binDirs().count()>0) { | 
|---|
| 2642 | pCurrentSet->setProperties(pCurrentSet->binDirs()[0],pCurrentSet->CCompiler()); | 
|---|
| 2643 | } | 
|---|
| 2644 | } else { | 
|---|
| 2645 | return; | 
|---|
| 2646 | } | 
|---|
| 2647 | } else { | 
|---|
| 2648 | #ifdef Q_OS_WIN | 
|---|
| 2649 | QString msg = QObject::tr( "Compiler set not configuared.") | 
|---|
| 2650 | + "<br /><br />" | 
|---|
| 2651 | +QObject::tr( "Would you like Red Panda C++ to search for compilers in the following locations: <BR />'%1'<BR />'%2'? ") | 
|---|
| 2652 | .arg(includeTrailingPathDelimiter(pSettings->dirs().appDir()) + "MinGW32") | 
|---|
| 2653 | .arg(includeTrailingPathDelimiter(pSettings->dirs().appDir()) + "MinGW64"); | 
|---|
| 2654 | #else | 
|---|
| 2655 | QString msg = QObject::tr( "Compiler set not configuared.") | 
|---|
| 2656 | + "<br /><br />" | 
|---|
| 2657 | +QObject::tr( "Would you like Red Panda C++ to search for compilers in PATH?"); | 
|---|
| 2658 | #endif | 
|---|
| 2659 | if (QMessageBox::warning(nullptr,QObject::tr( "Confirm"), | 
|---|
| 2660 | msg, | 
|---|
| 2661 | QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) { | 
|---|
| 2662 | return; | 
|---|
| 2663 | } | 
|---|
| 2664 | clearSets(); | 
|---|
| 2665 | findSets(); | 
|---|
| 2666 | pCurrentSet = defaultSet(); | 
|---|
| 2667 | if (!pCurrentSet) { | 
|---|
| 2668 | mList.clear(); | 
|---|
| 2669 | mDefaultIndex = -1; | 
|---|
| 2670 | saveSets(); | 
|---|
| 2671 | return; | 
|---|
| 2672 | } | 
|---|
| 2673 | saveSets(); | 
|---|
| 2674 | } | 
|---|
| 2675 |  | 
|---|
| 2676 | } | 
|---|
| 2677 |  | 
|---|
| 2678 | void Settings::CompilerSets::saveDefaultIndex() | 
|---|
| 2679 | { | 
|---|
| 2680 | mSettings->mSettings.beginGroup(SETTING_COMPILTER_SETS); | 
|---|
| 2681 | mSettings->mSettings.setValue(SETTING_COMPILTER_SETS_DEFAULT_INDEX,mDefaultIndex); | 
|---|
| 2682 | mSettings->mSettings.endGroup(); | 
|---|
| 2683 | } | 
|---|
| 2684 |  | 
|---|
| 2685 | void Settings::CompilerSets::deleteSet(int index) | 
|---|
| 2686 | { | 
|---|
| 2687 | // Erase all sections at and above from disk | 
|---|
| 2688 | for (size_t i=index;i<mList.size();i++) { | 
|---|
| 2689 | mSettings->mSettings.beginGroup(QString(SETTING_COMPILTER_SET).arg(i)); | 
|---|
| 2690 | mSettings->mSettings.remove( ""); | 
|---|
| 2691 | mSettings->mSettings.endGroup(); | 
|---|
| 2692 | } | 
|---|
| 2693 | mList.erase(std::begin(mList)+index); | 
|---|
| 2694 | if (mDefaultIndex>=(int)mList.size()) { | 
|---|
| 2695 | mDefaultIndex = mList.size()-1; | 
|---|
| 2696 | } | 
|---|
| 2697 | saveSets(); | 
|---|
| 2698 | } | 
|---|
| 2699 |  | 
|---|
| 2700 | size_t Settings::CompilerSets::size() const | 
|---|
| 2701 | { | 
|---|
| 2702 | return mList.size(); | 
|---|
| 2703 | } | 
|---|
| 2704 |  | 
|---|
| 2705 | int Settings::CompilerSets::defaultIndex() const | 
|---|
| 2706 | { | 
|---|
| 2707 | return mDefaultIndex; | 
|---|
| 2708 | } | 
|---|
| 2709 |  | 
|---|
| 2710 | void Settings::CompilerSets::setDefaultIndex(int value) | 
|---|
| 2711 | { | 
|---|
| 2712 | mDefaultIndex = value; | 
|---|
| 2713 | } | 
|---|
| 2714 |  | 
|---|
| 2715 | Settings::PCompilerSet Settings::CompilerSets::defaultSet() | 
|---|
| 2716 | { | 
|---|
| 2717 | return getSet(mDefaultIndex); | 
|---|
| 2718 | } | 
|---|
| 2719 |  | 
|---|
| 2720 | Settings::PCompilerSet Settings::CompilerSets::getSet(int index) | 
|---|
| 2721 | { | 
|---|
| 2722 | if (index>=0 && index<(int)mList.size()) { | 
|---|
| 2723 | return mList[index]; | 
|---|
| 2724 | } | 
|---|
| 2725 | return PCompilerSet(); | 
|---|
| 2726 | } | 
|---|
| 2727 |  | 
|---|
| 2728 | void Settings::CompilerSets::savePath(const QString& name, const QString& path) { | 
|---|
| 2729 | QString s; | 
|---|
| 2730 | QString prefix1 = excludeTrailingPathDelimiter(mSettings->mDirs.appDir()) + "/"; | 
|---|
| 2731 | QString prefix2 = excludeTrailingPathDelimiter(mSettings->mDirs.appDir()) + QDir::separator(); | 
|---|
| 2732 | if (path.startsWith(prefix1, PATH_SENSITIVITY)) { | 
|---|
| 2733 | s = "%AppPath%/"+ path.mid(prefix1.length()); | 
|---|
| 2734 | } else if (path.startsWith(prefix2, PATH_SENSITIVITY)) { | 
|---|
| 2735 | s = "%AppPath%/"+ path.mid(prefix2.length()); | 
|---|
| 2736 | } else { | 
|---|
| 2737 | s= path; | 
|---|
| 2738 | } | 
|---|
| 2739 | mSettings->mSettings.setValue(name,s); | 
|---|
| 2740 | } | 
|---|
| 2741 |  | 
|---|
| 2742 | void Settings::CompilerSets::savePathList(const QString& name, const QStringList& pathList) { | 
|---|
| 2743 | QStringList sl; | 
|---|
| 2744 | for (const QString& path: pathList) { | 
|---|
| 2745 | QString s; | 
|---|
| 2746 | QString prefix1 = excludeTrailingPathDelimiter(mSettings->mDirs.appDir()) + "/"; | 
|---|
| 2747 | QString prefix2 = excludeTrailingPathDelimiter(mSettings->mDirs.appDir()) + QDir::separator(); | 
|---|
| 2748 | if (path.startsWith(prefix1, PATH_SENSITIVITY)) { | 
|---|
| 2749 | s = "%AppPath%/"+ path.mid(prefix1.length()); | 
|---|
| 2750 | } else if (path.startsWith(prefix2, PATH_SENSITIVITY)) { | 
|---|
| 2751 | s = "%AppPath%/"+ path.mid(prefix2.length()); | 
|---|
| 2752 | } else { | 
|---|
| 2753 | s= path; | 
|---|
| 2754 | } | 
|---|
| 2755 | sl.append(s); | 
|---|
| 2756 | } | 
|---|
| 2757 | mSettings->mSettings.setValue(name,sl); | 
|---|
| 2758 | } | 
|---|
| 2759 |  | 
|---|
| 2760 | void Settings::CompilerSets::saveSet(int index) | 
|---|
| 2761 | { | 
|---|
| 2762 | PCompilerSet pSet = mList[index]; | 
|---|
| 2763 | mSettings->mSettings.beginGroup(QString(SETTING_COMPILTER_SET).arg(index)); | 
|---|
| 2764 |  | 
|---|
| 2765 | savePath( "ccompiler", pSet->CCompiler()); | 
|---|
| 2766 | savePath( "cppcompiler", pSet->cppCompiler()); | 
|---|
| 2767 | savePath( "debugger", pSet->debugger()); | 
|---|
| 2768 | savePath( "debug_server", pSet->debugServer()); | 
|---|
| 2769 | savePath( "make", pSet->make()); | 
|---|
| 2770 | savePath( "windres", pSet->resourceCompiler()); | 
|---|
| 2771 | savePath( "profiler", pSet->profiler()); | 
|---|
| 2772 |  | 
|---|
| 2773 | mSettings->mSettings.remove( "Options"); | 
|---|
| 2774 | foreach(const PCompilerOption& option, CompilerInfoManager::getInstance()->getCompilerOptions(pSet->compilerType())) { | 
|---|
| 2775 | mSettings->mSettings.remove(option->key); | 
|---|
| 2776 | } | 
|---|
| 2777 | // Save option string | 
|---|
| 2778 | for (const QString& optionKey : pSet->compileOptions().keys()) { | 
|---|
| 2779 | mSettings->mSettings.setValue(optionKey, pSet->compileOptions().value(optionKey)); | 
|---|
| 2780 | } | 
|---|
| 2781 |  | 
|---|
| 2782 | // Save extra 'general' options | 
|---|
| 2783 | mSettings->mSettings.setValue( "useCustomCompileParams", pSet->useCustomCompileParams()); | 
|---|
| 2784 | mSettings->mSettings.setValue( "customCompileParams", pSet->customCompileParams()); | 
|---|
| 2785 | mSettings->mSettings.setValue( "useCustomLinkParams", pSet->useCustomLinkParams()); | 
|---|
| 2786 | mSettings->mSettings.setValue( "customLinkParams", pSet->customLinkParams()); | 
|---|
| 2787 | mSettings->mSettings.setValue( "AddCharset", pSet->autoAddCharsetParams()); | 
|---|
| 2788 | mSettings->mSettings.setValue( "StaticLink", pSet->staticLink()); | 
|---|
| 2789 | mSettings->mSettings.setValue( "ExecCharset", pSet->execCharset()); | 
|---|
| 2790 |  | 
|---|
| 2791 | // Misc. properties | 
|---|
| 2792 | mSettings->mSettings.setValue( "DumpMachine", pSet->dumpMachine()); | 
|---|
| 2793 | mSettings->mSettings.setValue( "Version", pSet->version()); | 
|---|
| 2794 | mSettings->mSettings.setValue( "Type", pSet->type()); | 
|---|
| 2795 | mSettings->mSettings.setValue( "Name", pSet->name()); | 
|---|
| 2796 | mSettings->mSettings.setValue( "Target", pSet->target()); | 
|---|
| 2797 | mSettings->mSettings.setValue( "CompilerType", pSet->compilerType()); | 
|---|
| 2798 | mSettings->mSettings.setValue( "CompilerSetType", pSet->compilerSetType()); | 
|---|
| 2799 |  | 
|---|
| 2800 | // Paths | 
|---|
| 2801 | savePathList( "Bins",pSet->binDirs()); | 
|---|
| 2802 | savePathList( "C",pSet->CIncludeDirs()); | 
|---|
| 2803 | savePathList( "Cpp",pSet->CppIncludeDirs()); | 
|---|
| 2804 | savePathList( "Libs",pSet->libDirs()); | 
|---|
| 2805 |  | 
|---|
| 2806 | mSettings->mSettings.endGroup(); | 
|---|
| 2807 | } | 
|---|
| 2808 |  | 
|---|
| 2809 | QString Settings::CompilerSets::loadPath(const QString &name) | 
|---|
| 2810 | { | 
|---|
| 2811 | QString s =  mSettings->mSettings.value(name).toString(); | 
|---|
| 2812 | QString prefix = "%AppPath%/"; | 
|---|
| 2813 | if (s.startsWith(prefix)) { | 
|---|
| 2814 | s = includeTrailingPathDelimiter(mSettings->mDirs.appDir()) + s.mid(prefix.length()); | 
|---|
| 2815 | } | 
|---|
| 2816 | return QFileInfo(s).absoluteFilePath(); | 
|---|
| 2817 | } | 
|---|
| 2818 |  | 
|---|
| 2819 | void Settings::CompilerSets::loadPathList(const QString &name, QStringList& list) | 
|---|
| 2820 | { | 
|---|
| 2821 | list.clear(); | 
|---|
| 2822 | QStringList sl = mSettings->mSettings.value(name).toStringList(); | 
|---|
| 2823 | QString prefix = "%AppPath%/"; | 
|---|
| 2824 | for (QString& s:sl) { | 
|---|
| 2825 | if (s.startsWith(prefix)) { | 
|---|
| 2826 | s = includeTrailingPathDelimiter(mSettings->mDirs.appDir()) + s.mid(prefix.length()); | 
|---|
| 2827 | } | 
|---|
| 2828 | list.append(QFileInfo(s).absoluteFilePath()); | 
|---|
| 2829 | } | 
|---|
| 2830 | } | 
|---|
| 2831 |  | 
|---|
| 2832 | Settings::PCompilerSet Settings::CompilerSets::loadSet(int index) | 
|---|
| 2833 | { | 
|---|
| 2834 | PCompilerSet pSet = std::make_shared<CompilerSet>(); | 
|---|
| 2835 | mSettings->mSettings.beginGroup(QString(SETTING_COMPILTER_SET).arg(index)); | 
|---|
| 2836 |  | 
|---|
| 2837 | pSet->setCCompiler(loadPath( "ccompiler")); | 
|---|
| 2838 | pSet->setCppCompiler(loadPath( "cppcompiler")); | 
|---|
| 2839 | pSet->setDebugger(loadPath( "debugger")); | 
|---|
| 2840 | pSet->setDebugServer(loadPath( "debug_server")); | 
|---|
| 2841 | pSet->setMake(loadPath( "make")); | 
|---|
| 2842 | pSet->setResourceCompiler(loadPath( "windres")); | 
|---|
| 2843 | pSet->setProfiler(loadPath( "profiler")); | 
|---|
| 2844 |  | 
|---|
| 2845 | pSet->setDumpMachine(mSettings->mSettings.value( "DumpMachine").toString()); | 
|---|
| 2846 | pSet->setVersion(mSettings->mSettings.value( "Version").toString()); | 
|---|
| 2847 | pSet->setType(mSettings->mSettings.value( "Type").toString()); | 
|---|
| 2848 | pSet->setName(mSettings->mSettings.value( "Name").toString()); | 
|---|
| 2849 | pSet->setTarget(mSettings->mSettings.value( "Target").toString()); | 
|---|
| 2850 | pSet->setCompilerType(mSettings->mSettings.value( "CompilerType").toString()); | 
|---|
| 2851 | pSet->setCompilerSetType(mSettings->mSettings.value( "CompilerSetType").toInt()); | 
|---|
| 2852 |  | 
|---|
| 2853 | // Load extra 'general' options | 
|---|
| 2854 | pSet->setUseCustomCompileParams(mSettings->mSettings.value( "useCustomCompileParams", false).toBool()); | 
|---|
| 2855 | pSet->setCustomCompileParams(mSettings->mSettings.value( "customCompileParams").toString()); | 
|---|
| 2856 | pSet->setUseCustomLinkParams(mSettings->mSettings.value( "useCustomLinkParams", false).toBool()); | 
|---|
| 2857 | pSet->setCustomLinkParams(mSettings->mSettings.value( "customLinkParams").toString()); | 
|---|
| 2858 | pSet->setAutoAddCharsetParams(mSettings->mSettings.value( "AddCharset", true).toBool()); | 
|---|
| 2859 | pSet->setStaticLink(mSettings->mSettings.value( "StaticLink", false).toBool()); | 
|---|
| 2860 | pSet->setExecCharset(mSettings->mSettings.value( "ExecCharset", ENCODING_SYSTEM_DEFAULT).toString()); | 
|---|
| 2861 | if (pSet->execCharset().isEmpty()) { | 
|---|
| 2862 | pSet->setExecCharset(ENCODING_SYSTEM_DEFAULT); | 
|---|
| 2863 | } | 
|---|
| 2864 |  | 
|---|
| 2865 | // Load options | 
|---|
| 2866 | QByteArray iniOptions = mSettings->mSettings.value( "Options", "").toByteArray(); | 
|---|
| 2867 | if (!iniOptions.isEmpty()) | 
|---|
| 2868 | pSet->setIniOptions(iniOptions); | 
|---|
| 2869 | else { | 
|---|
| 2870 | foreach (const QString &optionKey, mSettings->mSettings.allKeys()) { | 
|---|
| 2871 | if (CompilerInfoManager::hasCompilerOption(pSet->compilerType(),optionKey)) { | 
|---|
| 2872 | pSet->setCompileOption(optionKey, mSettings->mSettings.value(optionKey).toString()); | 
|---|
| 2873 | } | 
|---|
| 2874 | } | 
|---|
| 2875 | } | 
|---|
| 2876 |  | 
|---|
| 2877 | // Paths | 
|---|
| 2878 | loadPathList( "Bins",pSet->binDirs()); | 
|---|
| 2879 | loadPathList( "C",pSet->CIncludeDirs()); | 
|---|
| 2880 | loadPathList( "Cpp",pSet->CppIncludeDirs()); | 
|---|
| 2881 | loadPathList( "Libs",pSet->libDirs()); | 
|---|
| 2882 |  | 
|---|
| 2883 | mSettings->mSettings.endGroup(); | 
|---|
| 2884 |  | 
|---|
| 2885 | if (pSet->binDirs().isEmpty()) | 
|---|
| 2886 | return PCompilerSet(); | 
|---|
| 2887 |  | 
|---|
| 2888 | return pSet; | 
|---|
| 2889 | } | 
|---|
| 2890 |  | 
|---|
| 2891 | void Settings::CompilerSets::prepareCompatibleIndex() | 
|---|
| 2892 | { | 
|---|
| 2893 |  | 
|---|
| 2894 | //old settings compatibility, don't reorder, add or remove items | 
|---|
| 2895 | mCompilerCompatibleIndex.append(CC_CMD_OPT_ANSI); | 
|---|
| 2896 | mCompilerCompatibleIndex.append(CC_CMD_OPT_NO_ASM); | 
|---|
| 2897 | mCompilerCompatibleIndex.append(CC_CMD_OPT_TRADITIONAL_CPP); | 
|---|
| 2898 |  | 
|---|
| 2899 | mCompilerCompatibleIndex.append(CC_CMD_OPT_ARCH); | 
|---|
| 2900 | mCompilerCompatibleIndex.append(CC_CMD_OPT_TUNE); | 
|---|
| 2901 | mCompilerCompatibleIndex.append(CC_CMD_OPT_INSTRUCTION); | 
|---|
| 2902 | mCompilerCompatibleIndex.append(CC_CMD_OPT_OPTIMIZE); | 
|---|
| 2903 | mCompilerCompatibleIndex.append(CC_CMD_OPT_POINTER_SIZE); | 
|---|
| 2904 | mCompilerCompatibleIndex.append(CC_CMD_OPT_STD); | 
|---|
| 2905 |  | 
|---|
| 2906 | mCompilerCompatibleIndex.append(CC_CMD_OPT_INHIBIT_ALL_WARNING); | 
|---|
| 2907 | mCompilerCompatibleIndex.append(CC_CMD_OPT_WARNING_ALL); | 
|---|
| 2908 | mCompilerCompatibleIndex.append(CC_CMD_OPT_WARNING_EXTRA); | 
|---|
| 2909 | mCompilerCompatibleIndex.append(CC_CMD_OPT_CHECK_ISO_CONFORMANCE); | 
|---|
| 2910 | mCompilerCompatibleIndex.append(CC_CMD_OPT_SYNTAX_ONLY); | 
|---|
| 2911 | mCompilerCompatibleIndex.append(CC_CMD_OPT_WARNING_AS_ERROR); | 
|---|
| 2912 | mCompilerCompatibleIndex.append(CC_CMD_OPT_ABORT_ON_ERROR); | 
|---|
| 2913 |  | 
|---|
| 2914 | mCompilerCompatibleIndex.append(CC_CMD_OPT_PROFILE_INFO); | 
|---|
| 2915 |  | 
|---|
| 2916 | mCompilerCompatibleIndex.append(LINK_CMD_OPT_LINK_OBJC); | 
|---|
| 2917 | mCompilerCompatibleIndex.append(LINK_CMD_OPT_NO_LINK_STDLIB); | 
|---|
| 2918 | mCompilerCompatibleIndex.append(LINK_CMD_OPT_NO_CONSOLE); | 
|---|
| 2919 | mCompilerCompatibleIndex.append(LINK_CMD_OPT_STRIP_EXE); | 
|---|
| 2920 | mCompilerCompatibleIndex.append(CC_CMD_OPT_DEBUG_INFO); | 
|---|
| 2921 |  | 
|---|
| 2922 | mCompilerCompatibleIndex.append(CC_CMD_OPT_VERBOSE_ASM); | 
|---|
| 2923 | mCompilerCompatibleIndex.append(CC_CMD_OPT_ONLY_GEN_ASM_CODE); | 
|---|
| 2924 | mCompilerCompatibleIndex.append(CC_CMD_OPT_USE_PIPE); | 
|---|
| 2925 | } | 
|---|
| 2926 |  | 
|---|
| 2927 | QString Settings::CompilerSets::getKeyFromCompilerCompatibleIndex(int idx) const | 
|---|
| 2928 | { | 
|---|
| 2929 | if (idx<0 || idx >= mCompilerCompatibleIndex.length()) | 
|---|
| 2930 | return QString(); | 
|---|
| 2931 | return mCompilerCompatibleIndex[idx]; | 
|---|
| 2932 | } | 
|---|
| 2933 |  | 
|---|
| 2934 | Settings::Environment::Environment(Settings *settings):_Base(settings, SETTING_ENVIRONMENT) | 
|---|
| 2935 | { | 
|---|
| 2936 |  | 
|---|
| 2937 | } | 
|---|
| 2938 |  | 
|---|
| 2939 | void Settings::Environment::doLoad() | 
|---|
| 2940 | { | 
|---|
| 2941 | //Appearence | 
|---|
| 2942 | mTheme = stringValue( "theme", "dark"); | 
|---|
| 2943 | QString defaultFontName = "Segoe UI"; | 
|---|
| 2944 | QString defaultLocaleName = QLocale::system().name(); | 
|---|
| 2945 | if (defaultLocaleName == "zh_CN") { | 
|---|
| 2946 | QString fontName; | 
|---|
| 2947 | #ifdef Q_OS_WINDOWS | 
|---|
| 2948 | fontName = "Microsoft Yahei"; | 
|---|
| 2949 | #elif defined(Q_OS_MACOS) | 
|---|
| 2950 | fontName = "PingFang SC"; | 
|---|
| 2951 | #elif defined(Q_OS_LINUX) | 
|---|
| 2952 | fontName = "Noto Sans CJK"; | 
|---|
| 2953 | #endif | 
|---|
| 2954 | QFont font(fontName); | 
|---|
| 2955 | if (font.exactMatch()) { | 
|---|
| 2956 | defaultFontName = fontName; | 
|---|
| 2957 | } | 
|---|
| 2958 | } | 
|---|
| 2959 | mInterfaceFont = stringValue( "interface_font",defaultFontName); | 
|---|
| 2960 | mInterfaceFontSize = intValue( "interface_font_size",12); | 
|---|
| 2961 | mLanguage = stringValue( "language", defaultLocaleName); | 
|---|
| 2962 | mIconSet = stringValue( "icon_set", "contrast"); | 
|---|
| 2963 | mUseCustomIconSet = boolValue( "use_custom_icon_set", false); | 
|---|
| 2964 | mUseCustomTheme = boolValue( "use_custom_theme", false); | 
|---|
| 2965 |  | 
|---|
| 2966 | mCurrentFolder = stringValue( "current_folder",QDir::currentPath()); | 
|---|
| 2967 | if (!fileExists(mCurrentFolder)) { | 
|---|
| 2968 | mCurrentFolder = QDir::currentPath(); | 
|---|
| 2969 | } | 
|---|
| 2970 | mDefaultOpenFolder = stringValue( "default_open_folder",QDir::currentPath()); | 
|---|
| 2971 | if (!fileExists(mDefaultOpenFolder)) { | 
|---|
| 2972 | mDefaultOpenFolder = QDir::currentPath(); | 
|---|
| 2973 | } | 
|---|
| 2974 | #ifdef Q_OS_LINUX | 
|---|
| 2975 | //use qterminal by default | 
|---|
| 2976 | mTerminalPath = stringValue( "terminal_path", "/usr/bin/qterminal"); | 
|---|
| 2977 | if (mTerminalPath.isEmpty()) | 
|---|
| 2978 | mTerminalPath = stringValue( "terminal_path", "/usr/bin/konsole"); | 
|---|
| 2979 | if (mTerminalPath.isEmpty()) | 
|---|
| 2980 | mTerminalPath = stringValue( "terminal_path", "/usr/bin/x-terminal-emulator"); | 
|---|
| 2981 | mAStylePath = includeTrailingPathDelimiter(pSettings->dirs().appLibexecDir())+ "astyle"; | 
|---|
| 2982 | #elif defined(Q_OS_MACOS) | 
|---|
| 2983 | mTerminalPath = stringValue( "terminal_path", | 
|---|
| 2984 | "/System/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal"); | 
|---|
| 2985 | mAStylePath = includeTrailingPathDelimiter(pSettings->dirs().appLibexecDir())+ "astyle"; | 
|---|
| 2986 | #endif | 
|---|
| 2987 | mHideNonSupportFilesInFileView=boolValue( "hide_non_support_files_file_view",true); | 
|---|
| 2988 | mOpenFilesInSingleInstance = boolValue( "open_files_in_single_instance",false); | 
|---|
| 2989 | } | 
|---|
| 2990 |  | 
|---|
| 2991 | int Settings::Environment::interfaceFontSize() const | 
|---|
| 2992 | { | 
|---|
| 2993 | return mInterfaceFontSize; | 
|---|
| 2994 | } | 
|---|
| 2995 |  | 
|---|
| 2996 | void Settings::Environment::setInterfaceFontSize(int interfaceFontSize) | 
|---|
| 2997 | { | 
|---|
| 2998 | mInterfaceFontSize = interfaceFontSize; | 
|---|
| 2999 | } | 
|---|
| 3000 |  | 
|---|
| 3001 | QString Settings::Environment::language() const | 
|---|
| 3002 | { | 
|---|
| 3003 | return mLanguage; | 
|---|
| 3004 | } | 
|---|
| 3005 |  | 
|---|
| 3006 | void Settings::Environment::setLanguage(const QString &language) | 
|---|
| 3007 | { | 
|---|
| 3008 | mLanguage = language; | 
|---|
| 3009 | } | 
|---|
| 3010 |  | 
|---|
| 3011 | const QString &Settings::Environment::currentFolder() const | 
|---|
| 3012 | { | 
|---|
| 3013 | return mCurrentFolder; | 
|---|
| 3014 | } | 
|---|
| 3015 |  | 
|---|
| 3016 | void Settings::Environment::setCurrentFolder(const QString &newCurrentFolder) | 
|---|
| 3017 | { | 
|---|
| 3018 | mCurrentFolder = newCurrentFolder; | 
|---|
| 3019 | } | 
|---|
| 3020 |  | 
|---|
| 3021 | const QString &Settings::Environment::defaultOpenFolder() const | 
|---|
| 3022 | { | 
|---|
| 3023 | return mDefaultOpenFolder; | 
|---|
| 3024 | } | 
|---|
| 3025 |  | 
|---|
| 3026 | void Settings::Environment::setDefaultOpenFolder(const QString &newDefaultOpenFolder) | 
|---|
| 3027 | { | 
|---|
| 3028 | mDefaultOpenFolder = newDefaultOpenFolder; | 
|---|
| 3029 | } | 
|---|
| 3030 |  | 
|---|
| 3031 | const QString &Settings::Environment::iconSet() const | 
|---|
| 3032 | { | 
|---|
| 3033 | return mIconSet; | 
|---|
| 3034 | } | 
|---|
| 3035 |  | 
|---|
| 3036 | void Settings::Environment::setIconSet(const QString &newIconSet) | 
|---|
| 3037 | { | 
|---|
| 3038 | mIconSet = newIconSet; | 
|---|
| 3039 | } | 
|---|
| 3040 |  | 
|---|
| 3041 | QString Settings::Environment::terminalPath() const | 
|---|
| 3042 | { | 
|---|
| 3043 | return mTerminalPath; | 
|---|
| 3044 | } | 
|---|
| 3045 |  | 
|---|
| 3046 | void Settings::Environment::setTerminalPath(const QString &terminalPath) | 
|---|
| 3047 | { | 
|---|
| 3048 | mTerminalPath = terminalPath; | 
|---|
| 3049 | } | 
|---|
| 3050 |  | 
|---|
| 3051 | QString Settings::Environment::AStylePath() const | 
|---|
| 3052 | { | 
|---|
| 3053 | return mAStylePath; | 
|---|
| 3054 | } | 
|---|
| 3055 |  | 
|---|
| 3056 | void Settings::Environment::setAStylePath(const QString &aStylePath) | 
|---|
| 3057 | { | 
|---|
| 3058 | mAStylePath = aStylePath; | 
|---|
| 3059 | } | 
|---|
| 3060 |  | 
|---|
| 3061 | bool Settings::Environment::useCustomIconSet() const | 
|---|
| 3062 | { | 
|---|
| 3063 | return mUseCustomIconSet; | 
|---|
| 3064 | } | 
|---|
| 3065 |  | 
|---|
| 3066 | void Settings::Environment::setUseCustomIconSet(bool newUseCustomIconSet) | 
|---|
| 3067 | { | 
|---|
| 3068 | mUseCustomIconSet = newUseCustomIconSet; | 
|---|
| 3069 | } | 
|---|
| 3070 |  | 
|---|
| 3071 | bool Settings::Environment::useCustomTheme() const | 
|---|
| 3072 | { | 
|---|
| 3073 | return mUseCustomTheme; | 
|---|
| 3074 | } | 
|---|
| 3075 |  | 
|---|
| 3076 | void Settings::Environment::setUseCustomTheme(bool newUseCustomTheme) | 
|---|
| 3077 | { | 
|---|
| 3078 | mUseCustomTheme = newUseCustomTheme; | 
|---|
| 3079 | } | 
|---|
| 3080 |  | 
|---|
| 3081 | bool Settings::Environment::hideNonSupportFilesInFileView() const | 
|---|
| 3082 | { | 
|---|
| 3083 | return mHideNonSupportFilesInFileView; | 
|---|
| 3084 | } | 
|---|
| 3085 |  | 
|---|
| 3086 | void Settings::Environment::setHideNonSupportFilesInFileView(bool newHideNonSupportFilesInFileView) | 
|---|
| 3087 | { | 
|---|
| 3088 | mHideNonSupportFilesInFileView = newHideNonSupportFilesInFileView; | 
|---|
| 3089 | } | 
|---|
| 3090 |  | 
|---|
| 3091 | bool Settings::Environment::openFilesInSingleInstance() const | 
|---|
| 3092 | { | 
|---|
| 3093 | return mOpenFilesInSingleInstance; | 
|---|
| 3094 | } | 
|---|
| 3095 |  | 
|---|
| 3096 | void Settings::Environment::setOpenFilesInSingleInstance(bool newOpenFilesInSingleInstance) | 
|---|
| 3097 | { | 
|---|
| 3098 | mOpenFilesInSingleInstance = newOpenFilesInSingleInstance; | 
|---|
| 3099 | } | 
|---|
| 3100 |  | 
|---|
| 3101 | void Settings::Environment::doSave() | 
|---|
| 3102 | { | 
|---|
| 3103 | //Appearence | 
|---|
| 3104 | saveValue( "theme", mTheme); | 
|---|
| 3105 | saveValue( "interface_font", mInterfaceFont); | 
|---|
| 3106 | saveValue( "interface_font_size", mInterfaceFontSize); | 
|---|
| 3107 | saveValue( "language", mLanguage); | 
|---|
| 3108 | saveValue( "icon_set",mIconSet); | 
|---|
| 3109 | saveValue( "use_custom_icon_set", mUseCustomIconSet); | 
|---|
| 3110 | saveValue( "use_custom_theme", mUseCustomTheme); | 
|---|
| 3111 |  | 
|---|
| 3112 | saveValue( "current_folder",mCurrentFolder); | 
|---|
| 3113 | saveValue( "default_open_folder",mDefaultOpenFolder); | 
|---|
| 3114 | #ifndef Q_OS_WIN | 
|---|
| 3115 | saveValue( "terminal_path",mTerminalPath); | 
|---|
| 3116 | saveValue( "asyle_path",mAStylePath); | 
|---|
| 3117 | #endif | 
|---|
| 3118 |  | 
|---|
| 3119 | saveValue( "hide_non_support_files_file_view",mHideNonSupportFilesInFileView); | 
|---|
| 3120 | saveValue( "open_files_in_single_instance",mOpenFilesInSingleInstance); | 
|---|
| 3121 | } | 
|---|
| 3122 |  | 
|---|
| 3123 | QString Settings::Environment::interfaceFont() const | 
|---|
| 3124 | { | 
|---|
| 3125 | return mInterfaceFont; | 
|---|
| 3126 | } | 
|---|
| 3127 |  | 
|---|
| 3128 | void Settings::Environment::setInterfaceFont(const QString &interfaceFont) | 
|---|
| 3129 | { | 
|---|
| 3130 | mInterfaceFont = interfaceFont; | 
|---|
| 3131 | } | 
|---|
| 3132 |  | 
|---|
| 3133 | QString Settings::Environment::theme() const | 
|---|
| 3134 | { | 
|---|
| 3135 | return mTheme; | 
|---|
| 3136 | } | 
|---|
| 3137 |  | 
|---|
| 3138 | void Settings::Environment::setTheme(const QString &theme) | 
|---|
| 3139 | { | 
|---|
| 3140 | mTheme = theme; | 
|---|
| 3141 | } | 
|---|
| 3142 |  | 
|---|
| 3143 | Settings::Executor::Executor(Settings *settings):_Base(settings, SETTING_EXECUTOR) | 
|---|
| 3144 | { | 
|---|
| 3145 |  | 
|---|
| 3146 | } | 
|---|
| 3147 |  | 
|---|
| 3148 | bool Settings::Executor::minimizeOnRun() const | 
|---|
| 3149 | { | 
|---|
| 3150 | return mMinimizeOnRun; | 
|---|
| 3151 | } | 
|---|
| 3152 |  | 
|---|
| 3153 | void Settings::Executor::setMinimizeOnRun(bool minimizeOnRun) | 
|---|
| 3154 | { | 
|---|
| 3155 | mMinimizeOnRun = minimizeOnRun; | 
|---|
| 3156 | } | 
|---|
| 3157 |  | 
|---|
| 3158 | bool Settings::Executor::useParams() const | 
|---|
| 3159 | { | 
|---|
| 3160 | return mUseParams; | 
|---|
| 3161 | } | 
|---|
| 3162 |  | 
|---|
| 3163 | void Settings::Executor::setUseParams(bool newUseParams) | 
|---|
| 3164 | { | 
|---|
| 3165 | mUseParams = newUseParams; | 
|---|
| 3166 | } | 
|---|
| 3167 |  | 
|---|
| 3168 | const QString &Settings::Executor::params() const | 
|---|
| 3169 | { | 
|---|
| 3170 | return mParams; | 
|---|
| 3171 | } | 
|---|
| 3172 |  | 
|---|
| 3173 | void Settings::Executor::setParams(const QString &newParams) | 
|---|
| 3174 | { | 
|---|
| 3175 | mParams = newParams; | 
|---|
| 3176 | } | 
|---|
| 3177 |  | 
|---|
| 3178 | bool Settings::Executor::redirectInput() const | 
|---|
| 3179 | { | 
|---|
| 3180 | return mRedirectInput; | 
|---|
| 3181 | } | 
|---|
| 3182 |  | 
|---|
| 3183 | void Settings::Executor::setRedirectInput(bool newRedirectInput) | 
|---|
| 3184 | { | 
|---|
| 3185 | mRedirectInput = newRedirectInput; | 
|---|
| 3186 | } | 
|---|
| 3187 |  | 
|---|
| 3188 | const QString &Settings::Executor::inputFilename() const | 
|---|
| 3189 | { | 
|---|
| 3190 | return mInputFilename; | 
|---|
| 3191 | } | 
|---|
| 3192 |  | 
|---|
| 3193 | void Settings::Executor::setInputFilename(const QString &newInputFilename) | 
|---|
| 3194 | { | 
|---|
| 3195 | mInputFilename = newInputFilename; | 
|---|
| 3196 | } | 
|---|
| 3197 |  | 
|---|
| 3198 | int Settings::Executor::competivieCompanionPort() const | 
|---|
| 3199 | { | 
|---|
| 3200 | return mCompetivieCompanionPort; | 
|---|
| 3201 | } | 
|---|
| 3202 |  | 
|---|
| 3203 | void Settings::Executor::setCompetivieCompanionPort(int newCompetivieCompanionPort) | 
|---|
| 3204 | { | 
|---|
| 3205 | mCompetivieCompanionPort = newCompetivieCompanionPort; | 
|---|
| 3206 | } | 
|---|
| 3207 |  | 
|---|
| 3208 | bool Settings::Executor::ignoreSpacesWhenValidatingCases() const | 
|---|
| 3209 | { | 
|---|
| 3210 | return mIgnoreSpacesWhenValidatingCases; | 
|---|
| 3211 | } | 
|---|
| 3212 |  | 
|---|
| 3213 | void Settings::Executor::setIgnoreSpacesWhenValidatingCases(bool newIgnoreSpacesWhenValidatingCases) | 
|---|
| 3214 | { | 
|---|
| 3215 | mIgnoreSpacesWhenValidatingCases = newIgnoreSpacesWhenValidatingCases; | 
|---|
| 3216 | } | 
|---|
| 3217 |  | 
|---|
| 3218 | bool Settings::Executor::caseEditorFontOnlyMonospaced() const | 
|---|
| 3219 | { | 
|---|
| 3220 | return mCaseEditorFontOnlyMonospaced; | 
|---|
| 3221 | } | 
|---|
| 3222 |  | 
|---|
| 3223 | void Settings::Executor::setCaseEditorFontOnlyMonospaced(bool newCaseEditorFontOnlyMonospaced) | 
|---|
| 3224 | { | 
|---|
| 3225 | mCaseEditorFontOnlyMonospaced = newCaseEditorFontOnlyMonospaced; | 
|---|
| 3226 | } | 
|---|
| 3227 |  | 
|---|
| 3228 | int Settings::Executor::caseTimeout() const | 
|---|
| 3229 | { | 
|---|
| 3230 | return mCaseTimeout; | 
|---|
| 3231 | } | 
|---|
| 3232 |  | 
|---|
| 3233 | void Settings::Executor::setCaseTimeout(int newCaseTimeout) | 
|---|
| 3234 | { | 
|---|
| 3235 | mCaseTimeout = newCaseTimeout; | 
|---|
| 3236 | } | 
|---|
| 3237 |  | 
|---|
| 3238 | bool Settings::Executor::enableCaseTimeout() const | 
|---|
| 3239 | { | 
|---|
| 3240 | return mEnableCaseTimeout; | 
|---|
| 3241 | } | 
|---|
| 3242 |  | 
|---|
| 3243 | void Settings::Executor::setEnableCaseTimeout(bool newEnableCaseTimeout) | 
|---|
| 3244 | { | 
|---|
| 3245 | mEnableCaseTimeout = newEnableCaseTimeout; | 
|---|
| 3246 | } | 
|---|
| 3247 |  | 
|---|
| 3248 | int Settings::Executor::caseEditorFontSize() const | 
|---|
| 3249 | { | 
|---|
| 3250 | return mCaseEditorFontSize; | 
|---|
| 3251 | } | 
|---|
| 3252 |  | 
|---|
| 3253 | void Settings::Executor::setCaseEditorFontSize(int newCaseEditorFontSize) | 
|---|
| 3254 | { | 
|---|
| 3255 | mCaseEditorFontSize = newCaseEditorFontSize; | 
|---|
| 3256 | } | 
|---|
| 3257 |  | 
|---|
| 3258 | const QString &Settings::Executor::caseEditorFontName() const | 
|---|
| 3259 | { | 
|---|
| 3260 | return mCaseEditorFontName; | 
|---|
| 3261 | } | 
|---|
| 3262 |  | 
|---|
| 3263 | void Settings::Executor::setCaseEditorFontName(const QString &newCaseEditorFontName) | 
|---|
| 3264 | { | 
|---|
| 3265 | mCaseEditorFontName = newCaseEditorFontName; | 
|---|
| 3266 | } | 
|---|
| 3267 |  | 
|---|
| 3268 | bool Settings::Executor::enableCompetitiveCompanion() const | 
|---|
| 3269 | { | 
|---|
| 3270 | return mEnableCompetitiveCompanion; | 
|---|
| 3271 | } | 
|---|
| 3272 |  | 
|---|
| 3273 | void Settings::Executor::setEnableCompetitiveCompanion(bool newEnableCompetitiveCompanion) | 
|---|
| 3274 | { | 
|---|
| 3275 | mEnableCompetitiveCompanion = newEnableCompetitiveCompanion; | 
|---|
| 3276 | } | 
|---|
| 3277 |  | 
|---|
| 3278 | bool Settings::Executor::enableProblemSet() const | 
|---|
| 3279 | { | 
|---|
| 3280 | return mEnableProblemSet; | 
|---|
| 3281 | } | 
|---|
| 3282 |  | 
|---|
| 3283 | void Settings::Executor::setEnableProblemSet(bool newEnableProblemSet) | 
|---|
| 3284 | { | 
|---|
| 3285 | mEnableProblemSet = newEnableProblemSet; | 
|---|
| 3286 | } | 
|---|
| 3287 |  | 
|---|
| 3288 | void Settings::Executor::doSave() | 
|---|
| 3289 | { | 
|---|
| 3290 | saveValue( "pause_console", mPauseConsole); | 
|---|
| 3291 | saveValue( "minimize_on_run", mMinimizeOnRun); | 
|---|
| 3292 | saveValue( "use_params",mUseParams); | 
|---|
| 3293 | saveValue( "params",mParams); | 
|---|
| 3294 | saveValue( "redirect_input",mRedirectInput); | 
|---|
| 3295 | saveValue( "input_filename",mInputFilename); | 
|---|
| 3296 | //problem set | 
|---|
| 3297 | saveValue( "enable_proble_set", mEnableProblemSet); | 
|---|
| 3298 | saveValue( "enable_competivie_companion", mEnableCompetitiveCompanion); | 
|---|
| 3299 | saveValue( "competitive_companion_port", mCompetivieCompanionPort); | 
|---|
| 3300 | saveValue( "ignore_spaces_when_validating_cases", mIgnoreSpacesWhenValidatingCases); | 
|---|
| 3301 | saveValue( "case_editor_font_name",mCaseEditorFontName); | 
|---|
| 3302 | saveValue( "case_editor_font_size",mCaseEditorFontSize); | 
|---|
| 3303 | saveValue( "case_editor_font_only_monospaced",mCaseEditorFontOnlyMonospaced); | 
|---|
| 3304 | saveValue( "case_timeout_ms", mCaseTimeout); | 
|---|
| 3305 | remove( "case_timeout"); | 
|---|
| 3306 | saveValue( "enable_case_timeout", mEnableCaseTimeout); | 
|---|
| 3307 | } | 
|---|
| 3308 |  | 
|---|
| 3309 | bool Settings::Executor::pauseConsole() const | 
|---|
| 3310 | { | 
|---|
| 3311 | return mPauseConsole; | 
|---|
| 3312 | } | 
|---|
| 3313 |  | 
|---|
| 3314 | void Settings::Executor::setPauseConsole(bool pauseConsole) | 
|---|
| 3315 | { | 
|---|
| 3316 | mPauseConsole = pauseConsole; | 
|---|
| 3317 | } | 
|---|
| 3318 |  | 
|---|
| 3319 | void Settings::Executor::doLoad() | 
|---|
| 3320 | { | 
|---|
| 3321 | mPauseConsole = boolValue( "pause_console",true); | 
|---|
| 3322 | mMinimizeOnRun = boolValue( "minimize_on_run",false); | 
|---|
| 3323 | mUseParams = boolValue( "use_params",false); | 
|---|
| 3324 | mParams = stringValue( "params", ""); | 
|---|
| 3325 | mRedirectInput = boolValue( "redirect_input",false); | 
|---|
| 3326 | mInputFilename = stringValue( "input_filename", ""); | 
|---|
| 3327 |  | 
|---|
| 3328 | mEnableProblemSet = boolValue( "enable_proble_set",true); | 
|---|
| 3329 | mEnableCompetitiveCompanion = boolValue( "enable_competivie_companion",true); | 
|---|
| 3330 | mCompetivieCompanionPort = intValue( "competitive_companion_port",10045); | 
|---|
| 3331 | mIgnoreSpacesWhenValidatingCases = boolValue( "ignore_spaces_when_validating_cases",false); | 
|---|
| 3332 | #ifdef Q_OS_WIN | 
|---|
| 3333 | mCaseEditorFontName = stringValue( "case_editor_font_name", "consolas"); | 
|---|
| 3334 | #elif defined(Q_OS_MACOS) | 
|---|
| 3335 | mCaseEditorFontName = stringValue( "case_editor_font_name", "Menlo"); | 
|---|
| 3336 | #else | 
|---|
| 3337 | mCaseEditorFontName = stringValue( "case_editor_font_name", "Dejavu Sans Mono"); | 
|---|
| 3338 | #endif | 
|---|
| 3339 | mCaseEditorFontSize = intValue( "case_editor_font_size",12); | 
|---|
| 3340 | mCaseEditorFontOnlyMonospaced = boolValue( "case_editor_font_only_monospaced",true); | 
|---|
| 3341 | int case_timeout = intValue( "case_timeout", -1); | 
|---|
| 3342 | if (case_timeout>0) | 
|---|
| 3343 | mCaseTimeout = case_timeout*1000; | 
|---|
| 3344 | else | 
|---|
| 3345 | mCaseTimeout = intValue( "case_timeout_ms", 2000); | 
|---|
| 3346 | mEnableCaseTimeout = boolValue( "enable_case_timeout", true); | 
|---|
| 3347 | } | 
|---|
| 3348 |  | 
|---|
| 3349 |  | 
|---|
| 3350 | Settings::Debugger::Debugger(Settings *settings):_Base(settings, SETTING_DEBUGGER) | 
|---|
| 3351 | { | 
|---|
| 3352 |  | 
|---|
| 3353 | } | 
|---|
| 3354 |  | 
|---|
| 3355 | bool Settings::Debugger::enableDebugConsole() const | 
|---|
| 3356 | { | 
|---|
| 3357 | return mEnableDebugConsole; | 
|---|
| 3358 | } | 
|---|
| 3359 |  | 
|---|
| 3360 | void Settings::Debugger::setEnableDebugConsole(bool showCommandLog) | 
|---|
| 3361 | { | 
|---|
| 3362 | mEnableDebugConsole = showCommandLog; | 
|---|
| 3363 | } | 
|---|
| 3364 |  | 
|---|
| 3365 | bool Settings::Debugger::showDetailLog() const | 
|---|
| 3366 | { | 
|---|
| 3367 | return mShowDetailLog; | 
|---|
| 3368 | } | 
|---|
| 3369 |  | 
|---|
| 3370 | void Settings::Debugger::setShowDetailLog(bool showAnnotations) | 
|---|
| 3371 | { | 
|---|
| 3372 | mShowDetailLog = showAnnotations; | 
|---|
| 3373 | } | 
|---|
| 3374 |  | 
|---|
| 3375 | QString Settings::Debugger::fontName() const | 
|---|
| 3376 | { | 
|---|
| 3377 | return mFontName; | 
|---|
| 3378 | } | 
|---|
| 3379 |  | 
|---|
| 3380 | void Settings::Debugger::setFontName(const QString &fontName) | 
|---|
| 3381 | { | 
|---|
| 3382 | mFontName = fontName; | 
|---|
| 3383 | } | 
|---|
| 3384 |  | 
|---|
| 3385 | bool Settings::Debugger::blendMode() const | 
|---|
| 3386 | { | 
|---|
| 3387 | return mBlendMode; | 
|---|
| 3388 | } | 
|---|
| 3389 |  | 
|---|
| 3390 | void Settings::Debugger::setBlendMode(bool blendMode) | 
|---|
| 3391 | { | 
|---|
| 3392 | mBlendMode = blendMode; | 
|---|
| 3393 | } | 
|---|
| 3394 |  | 
|---|
| 3395 | bool Settings::Debugger::skipSystemLibraries() const | 
|---|
| 3396 | { | 
|---|
| 3397 | return mSkipSystemLibraries; | 
|---|
| 3398 | } | 
|---|
| 3399 |  | 
|---|
| 3400 | void Settings::Debugger::setSkipSystemLibraries(bool newSkipSystemLibraries) | 
|---|
| 3401 | { | 
|---|
| 3402 | mSkipSystemLibraries = newSkipSystemLibraries; | 
|---|
| 3403 | } | 
|---|
| 3404 |  | 
|---|
| 3405 | bool Settings::Debugger::skipProjectLibraries() const | 
|---|
| 3406 | { | 
|---|
| 3407 | return mSkipProjectLibraries; | 
|---|
| 3408 | } | 
|---|
| 3409 |  | 
|---|
| 3410 | void Settings::Debugger::setSkipProjectLibraries(bool newSkipProjectLibraries) | 
|---|
| 3411 | { | 
|---|
| 3412 | mSkipProjectLibraries = newSkipProjectLibraries; | 
|---|
| 3413 | } | 
|---|
| 3414 |  | 
|---|
| 3415 | bool Settings::Debugger::skipCustomLibraries() const | 
|---|
| 3416 | { | 
|---|
| 3417 | return mSkipCustomLibraries; | 
|---|
| 3418 | } | 
|---|
| 3419 |  | 
|---|
| 3420 | void Settings::Debugger::setSkipCustomLibraries(bool newSkipCustomLibraries) | 
|---|
| 3421 | { | 
|---|
| 3422 | mSkipCustomLibraries = newSkipCustomLibraries; | 
|---|
| 3423 | } | 
|---|
| 3424 |  | 
|---|
| 3425 | bool Settings::Debugger::autosaveWatches() const | 
|---|
| 3426 | { | 
|---|
| 3427 | return mAutosaveWatches; | 
|---|
| 3428 | } | 
|---|
| 3429 |  | 
|---|
| 3430 | void Settings::Debugger::setAutosaveWatches(bool newAutosaveWatches) | 
|---|
| 3431 | { | 
|---|
| 3432 | mAutosaveWatches = newAutosaveWatches; | 
|---|
| 3433 | } | 
|---|
| 3434 |  | 
|---|
| 3435 | bool Settings::Debugger::openCPUInfoWhenSignaled() const | 
|---|
| 3436 | { | 
|---|
| 3437 | return mOpenCPUInfoWhenSignaled; | 
|---|
| 3438 | } | 
|---|
| 3439 |  | 
|---|
| 3440 | void Settings::Debugger::setOpenCPUInfoWhenSignaled(bool newOpenCPUInfoWhenSignaled) | 
|---|
| 3441 | { | 
|---|
| 3442 | mOpenCPUInfoWhenSignaled = newOpenCPUInfoWhenSignaled; | 
|---|
| 3443 | } | 
|---|
| 3444 |  | 
|---|
| 3445 | bool Settings::Debugger::useGDBServer() const | 
|---|
| 3446 | { | 
|---|
| 3447 | return mUseGDBServer; | 
|---|
| 3448 | } | 
|---|
| 3449 |  | 
|---|
| 3450 | void Settings::Debugger::setUseGDBServer(bool newUseGDBServer) | 
|---|
| 3451 | { | 
|---|
| 3452 | mUseGDBServer = newUseGDBServer; | 
|---|
| 3453 | } | 
|---|
| 3454 |  | 
|---|
| 3455 | int Settings::Debugger::GDBServerPort() const | 
|---|
| 3456 | { | 
|---|
| 3457 | return mGDBServerPort; | 
|---|
| 3458 | } | 
|---|
| 3459 |  | 
|---|
| 3460 | void Settings::Debugger::setGDBServerPort(int newGDBServerPort) | 
|---|
| 3461 | { | 
|---|
| 3462 | mGDBServerPort = newGDBServerPort; | 
|---|
| 3463 | } | 
|---|
| 3464 |  | 
|---|
| 3465 | int Settings::Debugger::memoryViewRows() const | 
|---|
| 3466 | { | 
|---|
| 3467 | return mMemoryViewRows; | 
|---|
| 3468 | } | 
|---|
| 3469 |  | 
|---|
| 3470 | void Settings::Debugger::setMemoryViewRows(int newMemoryViewRows) | 
|---|
| 3471 | { | 
|---|
| 3472 | mMemoryViewRows = newMemoryViewRows; | 
|---|
| 3473 | } | 
|---|
| 3474 |  | 
|---|
| 3475 | int Settings::Debugger::memoryViewColumns() const | 
|---|
| 3476 | { | 
|---|
| 3477 | return mMemoryViewColumns; | 
|---|
| 3478 | } | 
|---|
| 3479 |  | 
|---|
| 3480 | void Settings::Debugger::setMemoryViewColumns(int newMemoryViewColumns) | 
|---|
| 3481 | { | 
|---|
| 3482 | mMemoryViewColumns = newMemoryViewColumns; | 
|---|
| 3483 | } | 
|---|
| 3484 |  | 
|---|
| 3485 | bool Settings::Debugger::autosaveBreakpoints() const | 
|---|
| 3486 | { | 
|---|
| 3487 | return mAutosaveBreakpoints; | 
|---|
| 3488 | } | 
|---|
| 3489 |  | 
|---|
| 3490 | void Settings::Debugger::setAutosaveBreakpoints(bool newAutosaveBreakpoints) | 
|---|
| 3491 | { | 
|---|
| 3492 | mAutosaveBreakpoints = newAutosaveBreakpoints; | 
|---|
| 3493 | } | 
|---|
| 3494 |  | 
|---|
| 3495 | bool Settings::Debugger::useIntelStyle() const | 
|---|
| 3496 | { | 
|---|
| 3497 | return mUseIntelStyle; | 
|---|
| 3498 | } | 
|---|
| 3499 |  | 
|---|
| 3500 | void Settings::Debugger::setUseIntelStyle(bool useIntelStyle) | 
|---|
| 3501 | { | 
|---|
| 3502 | mUseIntelStyle = useIntelStyle; | 
|---|
| 3503 | } | 
|---|
| 3504 |  | 
|---|
| 3505 | int Settings::Debugger::fontSize() const | 
|---|
| 3506 | { | 
|---|
| 3507 | return mFontSize; | 
|---|
| 3508 | } | 
|---|
| 3509 |  | 
|---|
| 3510 | void Settings::Debugger::setFontSize(int fontSize) | 
|---|
| 3511 | { | 
|---|
| 3512 | mFontSize = fontSize; | 
|---|
| 3513 | } | 
|---|
| 3514 |  | 
|---|
| 3515 | bool Settings::Debugger::onlyShowMono() const | 
|---|
| 3516 | { | 
|---|
| 3517 | return mOnlyShowMono; | 
|---|
| 3518 | } | 
|---|
| 3519 |  | 
|---|
| 3520 | void Settings::Debugger::setOnlyShowMono(bool onlyShowMono) | 
|---|
| 3521 | { | 
|---|
| 3522 | mOnlyShowMono = onlyShowMono; | 
|---|
| 3523 | } | 
|---|
| 3524 |  | 
|---|
| 3525 | void Settings::Debugger::doSave() | 
|---|
| 3526 | { | 
|---|
| 3527 | saveValue( "enable_debug_console", mEnableDebugConsole); | 
|---|
| 3528 | saveValue( "show_detail_log", mShowDetailLog); | 
|---|
| 3529 | saveValue( "font_name",mFontName); | 
|---|
| 3530 | saveValue( "only_show_mono",mOnlyShowMono); | 
|---|
| 3531 | saveValue( "font_size",mFontSize); | 
|---|
| 3532 | saveValue( "use_intel_style",mUseIntelStyle); | 
|---|
| 3533 | saveValue( "blend_mode",mBlendMode); | 
|---|
| 3534 | saveValue( "skip_system_lib", mSkipSystemLibraries); | 
|---|
| 3535 | saveValue( "skip_project_lib", mSkipProjectLibraries); | 
|---|
| 3536 | saveValue( "skip_custom_lib", mSkipCustomLibraries); | 
|---|
| 3537 | saveValue( "autosave_breakpoints",mAutosaveBreakpoints); | 
|---|
| 3538 | saveValue( "autosave_watches",mAutosaveWatches); | 
|---|
| 3539 | saveValue( "open_cpu_info_when_signaled",mOpenCPUInfoWhenSignaled); | 
|---|
| 3540 | saveValue( "use_gdb_server", mUseGDBServer); | 
|---|
| 3541 | saveValue( "gdb_server_port",mGDBServerPort); | 
|---|
| 3542 | saveValue( "memory_view_rows",mMemoryViewRows); | 
|---|
| 3543 | saveValue( "memory_view_columns",mMemoryViewColumns); | 
|---|
| 3544 |  | 
|---|
| 3545 | } | 
|---|
| 3546 |  | 
|---|
| 3547 | void Settings::Debugger::doLoad() | 
|---|
| 3548 | { | 
|---|
| 3549 | mEnableDebugConsole = boolValue( "enable_debug_console",true); | 
|---|
| 3550 | mShowDetailLog = boolValue( "show_detail_log",false); | 
|---|
| 3551 | #ifdef Q_OS_WIN | 
|---|
| 3552 | mFontName = stringValue( "font_name", "Consolas"); | 
|---|
| 3553 | #else | 
|---|
| 3554 | mFontName = stringValue( "font_name", "Dejavu Sans Mono"); | 
|---|
| 3555 | #endif | 
|---|
| 3556 | mOnlyShowMono = boolValue( "only_show_mono",true); | 
|---|
| 3557 | mFontSize = intValue( "font_size",12); | 
|---|
| 3558 | mUseIntelStyle = boolValue( "use_intel_style",true); | 
|---|
| 3559 | mBlendMode = boolValue( "blend_mode",true); | 
|---|
| 3560 | mSkipSystemLibraries = boolValue( "skip_system_lib",true); | 
|---|
| 3561 | mSkipProjectLibraries = boolValue( "skip_project_lib",true); | 
|---|
| 3562 | mSkipCustomLibraries = boolValue( "skip_custom_lib",false); | 
|---|
| 3563 | mAutosaveBreakpoints = boolValue( "autosave_breakpoints",true); | 
|---|
| 3564 | mAutosaveWatches = boolValue( "autosave_watches",true); | 
|---|
| 3565 | mOpenCPUInfoWhenSignaled = boolValue( "open_cpu_info_when_signaled",true); | 
|---|
| 3566 | #ifdef Q_OS_WIN | 
|---|
| 3567 | mUseGDBServer = boolValue( "use_gdb_server", false); | 
|---|
| 3568 | #else | 
|---|
| 3569 | mUseGDBServer = boolValue( "use_gdb_server", true); | 
|---|
| 3570 | #endif | 
|---|
| 3571 | mGDBServerPort = intValue( "gdb_server_port",41234); | 
|---|
| 3572 | mMemoryViewRows = intValue( "memory_view_rows",8); | 
|---|
| 3573 | mMemoryViewColumns = intValue( "memory_view_columns",8); | 
|---|
| 3574 | } | 
|---|
| 3575 |  | 
|---|
| 3576 | Settings::History::History(Settings *settings):_Base(settings, SETTING_HISTORY) | 
|---|
| 3577 | { | 
|---|
| 3578 |  | 
|---|
| 3579 | } | 
|---|
| 3580 |  | 
|---|
| 3581 | const QStringList &Settings::History::opennedFiles() const | 
|---|
| 3582 | { | 
|---|
| 3583 | return mOpenedFiles; | 
|---|
| 3584 | } | 
|---|
| 3585 |  | 
|---|
| 3586 | const QStringList &Settings::History::opennedProjects() const | 
|---|
| 3587 | { | 
|---|
| 3588 | return mOpenedProjects; | 
|---|
| 3589 | } | 
|---|
| 3590 |  | 
|---|
| 3591 | void Settings::History::clearOpennedFiles() | 
|---|
| 3592 | { | 
|---|
| 3593 | mOpenedFiles.clear(); | 
|---|
| 3594 | } | 
|---|
| 3595 |  | 
|---|
| 3596 | void Settings::History::clearOpennedProjects() | 
|---|
| 3597 | { | 
|---|
| 3598 | mOpenedProjects.clear(); | 
|---|
| 3599 | } | 
|---|
| 3600 |  | 
|---|
| 3601 | bool Settings::History::addToOpenedFiles(const QString &filename) | 
|---|
| 3602 | { | 
|---|
| 3603 | if (!QFile(filename).exists()) | 
|---|
| 3604 | return false; | 
|---|
| 3605 | int index = mOpenedFiles.indexOf(filename); | 
|---|
| 3606 | if (index>=0) { | 
|---|
| 3607 | mOpenedFiles.removeAt(index); | 
|---|
| 3608 | } | 
|---|
| 3609 | if (mOpenedFiles.size()>=15) { | 
|---|
| 3610 | mOpenedFiles.pop_back(); | 
|---|
| 3611 | } | 
|---|
| 3612 | mOpenedFiles.push_front(filename); | 
|---|
| 3613 | save(); | 
|---|
| 3614 | return true; | 
|---|
| 3615 |  | 
|---|
| 3616 | } | 
|---|
| 3617 |  | 
|---|
| 3618 | void Settings::History::removeFile(const QString &filename) | 
|---|
| 3619 | { | 
|---|
| 3620 | int index = mOpenedFiles.indexOf(filename); | 
|---|
| 3621 | if (index>=0) { | 
|---|
| 3622 | mOpenedFiles.removeAt(index); | 
|---|
| 3623 | } | 
|---|
| 3624 | save(); | 
|---|
| 3625 | return; | 
|---|
| 3626 | } | 
|---|
| 3627 |  | 
|---|
| 3628 | bool Settings::History::addToOpenedProjects(const QString &filename) | 
|---|
| 3629 | { | 
|---|
| 3630 | if (!QFile(filename).exists()) | 
|---|
| 3631 | return false; | 
|---|
| 3632 | int index = mOpenedProjects.indexOf(filename); | 
|---|
| 3633 | if (index>=0) { | 
|---|
| 3634 | mOpenedProjects.removeAt(index); | 
|---|
| 3635 | } | 
|---|
| 3636 | if (mOpenedProjects.size()>=15) { | 
|---|
| 3637 | mOpenedProjects.pop_back(); | 
|---|
| 3638 | } | 
|---|
| 3639 | mOpenedProjects.push_front(filename); | 
|---|
| 3640 | save(); | 
|---|
| 3641 | return true; | 
|---|
| 3642 | } | 
|---|
| 3643 |  | 
|---|
| 3644 | void Settings::History::removeProject(const QString &filename) | 
|---|
| 3645 | { | 
|---|
| 3646 | int index = mOpenedProjects.indexOf(filename); | 
|---|
| 3647 | if (index>=0) { | 
|---|
| 3648 | mOpenedProjects.removeAt(index); | 
|---|
| 3649 | } | 
|---|
| 3650 | save(); | 
|---|
| 3651 | return; | 
|---|
| 3652 | } | 
|---|
| 3653 |  | 
|---|
| 3654 | void Settings::History::doSave() | 
|---|
| 3655 | { | 
|---|
| 3656 | saveValue( "opened_files", mOpenedFiles); | 
|---|
| 3657 | saveValue( "opened_projects", mOpenedProjects); | 
|---|
| 3658 | } | 
|---|
| 3659 |  | 
|---|
| 3660 | static QStringList filterValidPathes(const QStringList& files) { | 
|---|
| 3661 | QStringList lst; | 
|---|
| 3662 | foreach (const QString& filePath, files) { | 
|---|
| 3663 | if (fileExists(filePath)) { | 
|---|
| 3664 | lst.append(QFileInfo(filePath).absoluteFilePath()); | 
|---|
| 3665 | } | 
|---|
| 3666 | } | 
|---|
| 3667 | return lst; | 
|---|
| 3668 | } | 
|---|
| 3669 |  | 
|---|
| 3670 | void Settings::History::doLoad() | 
|---|
| 3671 | { | 
|---|
| 3672 | mOpenedFiles = filterValidPathes(stringListValue( "opened_files")); | 
|---|
| 3673 | mOpenedProjects = filterValidPathes(stringListValue( "opened_projects")); | 
|---|
| 3674 | } | 
|---|
| 3675 |  | 
|---|
| 3676 | Settings::CodeCompletion::CodeCompletion(Settings *settings):_Base(settings, SETTING_CODE_COMPLETION) | 
|---|
| 3677 | { | 
|---|
| 3678 |  | 
|---|
| 3679 | } | 
|---|
| 3680 |  | 
|---|
| 3681 | bool Settings::CodeCompletion::showCodeIns() const | 
|---|
| 3682 | { | 
|---|
| 3683 | return mShowCodeIns; | 
|---|
| 3684 | } | 
|---|
| 3685 |  | 
|---|
| 3686 | void Settings::CodeCompletion::setShowCodeIns(bool newShowCodeIns) | 
|---|
| 3687 | { | 
|---|
| 3688 | mShowCodeIns = newShowCodeIns; | 
|---|
| 3689 | } | 
|---|
| 3690 |  | 
|---|
| 3691 | bool Settings::CodeCompletion::clearWhenEditorHidden() const | 
|---|
| 3692 | { | 
|---|
| 3693 | return mClearWhenEditorHidden; | 
|---|
| 3694 | } | 
|---|
| 3695 |  | 
|---|
| 3696 | void Settings::CodeCompletion::setClearWhenEditorHidden(bool newClearWhenEditorHidden) | 
|---|
| 3697 | { | 
|---|
| 3698 | mClearWhenEditorHidden = newClearWhenEditorHidden; | 
|---|
| 3699 | } | 
|---|
| 3700 |  | 
|---|
| 3701 | int Settings::CodeCompletion::minCharRequired() const | 
|---|
| 3702 | { | 
|---|
| 3703 | return mMinCharRequired; | 
|---|
| 3704 | } | 
|---|
| 3705 |  | 
|---|
| 3706 | void Settings::CodeCompletion::setMinCharRequired(int newMinCharRequired) | 
|---|
| 3707 | { | 
|---|
| 3708 | mMinCharRequired = newMinCharRequired; | 
|---|
| 3709 | } | 
|---|
| 3710 |  | 
|---|
| 3711 | bool Settings::CodeCompletion::hideSymbolsStartsWithTwoUnderLine() const | 
|---|
| 3712 | { | 
|---|
| 3713 | return mHideSymbolsStartsWithTwoUnderLine; | 
|---|
| 3714 | } | 
|---|
| 3715 |  | 
|---|
| 3716 | void Settings::CodeCompletion::setHideSymbolsStartsWithTwoUnderLine(bool newHideSymbolsStartsWithTwoUnderLine) | 
|---|
| 3717 | { | 
|---|
| 3718 | mHideSymbolsStartsWithTwoUnderLine = newHideSymbolsStartsWithTwoUnderLine; | 
|---|
| 3719 | } | 
|---|
| 3720 |  | 
|---|
| 3721 | bool Settings::CodeCompletion::hideSymbolsStartsWithUnderLine() const | 
|---|
| 3722 | { | 
|---|
| 3723 | return mHideSymbolsStartsWithUnderLine; | 
|---|
| 3724 | } | 
|---|
| 3725 |  | 
|---|
| 3726 | void Settings::CodeCompletion::setHideSymbolsStartsWithUnderLine(bool newHideSymbolsStartsWithOneUnderLine) | 
|---|
| 3727 | { | 
|---|
| 3728 | mHideSymbolsStartsWithUnderLine = newHideSymbolsStartsWithOneUnderLine; | 
|---|
| 3729 | } | 
|---|
| 3730 |  | 
|---|
| 3731 | bool Settings::CodeCompletion::appendFunc() const | 
|---|
| 3732 | { | 
|---|
| 3733 | return mAppendFunc; | 
|---|
| 3734 | } | 
|---|
| 3735 |  | 
|---|
| 3736 | void Settings::CodeCompletion::setAppendFunc(bool newAppendFunc) | 
|---|
| 3737 | { | 
|---|
| 3738 | mAppendFunc = newAppendFunc; | 
|---|
| 3739 | } | 
|---|
| 3740 |  | 
|---|
| 3741 | bool Settings::CodeCompletion::ignoreCase() const | 
|---|
| 3742 | { | 
|---|
| 3743 | return mIgnoreCase; | 
|---|
| 3744 | } | 
|---|
| 3745 |  | 
|---|
| 3746 | void Settings::CodeCompletion::setIgnoreCase(bool newIgnoreCase) | 
|---|
| 3747 | { | 
|---|
| 3748 | mIgnoreCase = newIgnoreCase; | 
|---|
| 3749 | } | 
|---|
| 3750 |  | 
|---|
| 3751 | bool Settings::CodeCompletion::showKeywords() const | 
|---|
| 3752 | { | 
|---|
| 3753 | return mShowKeywords; | 
|---|
| 3754 | } | 
|---|
| 3755 |  | 
|---|
| 3756 | void Settings::CodeCompletion::setShowKeywords(bool newShowKeywords) | 
|---|
| 3757 | { | 
|---|
| 3758 | mShowKeywords = newShowKeywords; | 
|---|
| 3759 | } | 
|---|
| 3760 |  | 
|---|
| 3761 | bool Settings::CodeCompletion::sortByScope() const | 
|---|
| 3762 | { | 
|---|
| 3763 | return mSortByScope; | 
|---|
| 3764 | } | 
|---|
| 3765 |  | 
|---|
| 3766 | void Settings::CodeCompletion::setSortByScope(bool newSortByScope) | 
|---|
| 3767 | { | 
|---|
| 3768 | mSortByScope = newSortByScope; | 
|---|
| 3769 | } | 
|---|
| 3770 |  | 
|---|
| 3771 | bool Settings::CodeCompletion::recordUsage() const | 
|---|
| 3772 | { | 
|---|
| 3773 | return mRecordUsage; | 
|---|
| 3774 | } | 
|---|
| 3775 |  | 
|---|
| 3776 | void Settings::CodeCompletion::setRecordUsage(bool newRecordUsage) | 
|---|
| 3777 | { | 
|---|
| 3778 | mRecordUsage = newRecordUsage; | 
|---|
| 3779 | } | 
|---|
| 3780 |  | 
|---|
| 3781 | bool Settings::CodeCompletion::showCompletionWhileInput() const | 
|---|
| 3782 | { | 
|---|
| 3783 | return mShowCompletionWhileInput; | 
|---|
| 3784 | } | 
|---|
| 3785 |  | 
|---|
| 3786 | void Settings::CodeCompletion::setShowCompletionWhileInput(bool newShowCompletionWhileInput) | 
|---|
| 3787 | { | 
|---|
| 3788 | mShowCompletionWhileInput = newShowCompletionWhileInput; | 
|---|
| 3789 | } | 
|---|
| 3790 |  | 
|---|
| 3791 | bool Settings::CodeCompletion::() const | 
|---|
| 3792 | { | 
|---|
| 3793 | return mParseGlobalHeaders; | 
|---|
| 3794 | } | 
|---|
| 3795 |  | 
|---|
| 3796 | void Settings::CodeCompletion::(bool ) | 
|---|
| 3797 | { | 
|---|
| 3798 | mParseGlobalHeaders = newParseGlobalHeaders; | 
|---|
| 3799 | } | 
|---|
| 3800 |  | 
|---|
| 3801 | bool Settings::CodeCompletion::() const | 
|---|
| 3802 | { | 
|---|
| 3803 | return mParseLocalHeaders; | 
|---|
| 3804 | } | 
|---|
| 3805 |  | 
|---|
| 3806 | void Settings::CodeCompletion::(bool ) | 
|---|
| 3807 | { | 
|---|
| 3808 | mParseLocalHeaders = newParseLocalHeaders; | 
|---|
| 3809 | } | 
|---|
| 3810 |  | 
|---|
| 3811 | bool Settings::CodeCompletion::enabled() const | 
|---|
| 3812 | { | 
|---|
| 3813 | return mEnabled; | 
|---|
| 3814 | } | 
|---|
| 3815 |  | 
|---|
| 3816 | void Settings::CodeCompletion::setEnabled(bool newEnabled) | 
|---|
| 3817 | { | 
|---|
| 3818 | mEnabled = newEnabled; | 
|---|
| 3819 | } | 
|---|
| 3820 |  | 
|---|
| 3821 | int Settings::CodeCompletion::height() const | 
|---|
| 3822 | { | 
|---|
| 3823 | return mHeight; | 
|---|
| 3824 | } | 
|---|
| 3825 |  | 
|---|
| 3826 | void Settings::CodeCompletion::setHeight(int newHeight) | 
|---|
| 3827 | { | 
|---|
| 3828 | mHeight = newHeight; | 
|---|
| 3829 | } | 
|---|
| 3830 |  | 
|---|
| 3831 | int Settings::CodeCompletion::width() const | 
|---|
| 3832 | { | 
|---|
| 3833 | return mWidth; | 
|---|
| 3834 | } | 
|---|
| 3835 |  | 
|---|
| 3836 | void Settings::CodeCompletion::setWidth(int newWidth) | 
|---|
| 3837 | { | 
|---|
| 3838 | mWidth = newWidth; | 
|---|
| 3839 | } | 
|---|
| 3840 |  | 
|---|
| 3841 | void Settings::CodeCompletion::doSave() | 
|---|
| 3842 | { | 
|---|
| 3843 | saveValue( "width",mWidth); | 
|---|
| 3844 | saveValue( "height",mHeight); | 
|---|
| 3845 | saveValue( "enabled",mEnabled); | 
|---|
| 3846 | saveValue( "parse_local_headers",mParseLocalHeaders); | 
|---|
| 3847 | saveValue( "parse_global_headers",mParseGlobalHeaders); | 
|---|
| 3848 | saveValue( "show_completion_while_input",mShowCompletionWhileInput); | 
|---|
| 3849 | saveValue( "record_usage",mRecordUsage); | 
|---|
| 3850 | saveValue( "sort_by_scope",mSortByScope); | 
|---|
| 3851 | saveValue( "show_keywords",mShowKeywords); | 
|---|
| 3852 | saveValue( "ignore_case",mIgnoreCase); | 
|---|
| 3853 | saveValue( "append_func",mAppendFunc); | 
|---|
| 3854 | saveValue( "show_code_ins",mShowCodeIns); | 
|---|
| 3855 | saveValue( "clear_when_editor_hidden",mClearWhenEditorHidden); | 
|---|
| 3856 | saveValue( "min_char_required",mMinCharRequired); | 
|---|
| 3857 | saveValue( "hide_symbols_start_with_two_underline", mHideSymbolsStartsWithTwoUnderLine); | 
|---|
| 3858 | saveValue( "hide_symbols_start_with_underline", mHideSymbolsStartsWithUnderLine); | 
|---|
| 3859 | } | 
|---|
| 3860 |  | 
|---|
| 3861 |  | 
|---|
| 3862 | void Settings::CodeCompletion::doLoad() | 
|---|
| 3863 | { | 
|---|
| 3864 | //Appearence | 
|---|
| 3865 | mWidth = intValue( "width",700); | 
|---|
| 3866 | mHeight = intValue( "height",400); | 
|---|
| 3867 | mEnabled = boolValue( "enabled",true); | 
|---|
| 3868 | mParseLocalHeaders = boolValue( "parse_local_headers",true); | 
|---|
| 3869 | mParseGlobalHeaders = boolValue( "parse_global_headers",true); | 
|---|
| 3870 | mShowCompletionWhileInput = boolValue( "show_completion_while_input",true); | 
|---|
| 3871 | mRecordUsage = boolValue( "record_usage",true); | 
|---|
| 3872 | mSortByScope = boolValue( "sort_by_scope",true); | 
|---|
| 3873 | mShowKeywords = boolValue( "show_keywords",true); | 
|---|
| 3874 | mIgnoreCase = boolValue( "ignore_case",true); | 
|---|
| 3875 | mAppendFunc = boolValue( "append_func",true); | 
|---|
| 3876 | mShowCodeIns = boolValue( "show_code_ins",true); | 
|---|
| 3877 | mMinCharRequired = intValue( "min_char_required",1); | 
|---|
| 3878 | mHideSymbolsStartsWithTwoUnderLine = boolValue( "hide_symbols_start_with_two_underline", true); | 
|---|
| 3879 | mHideSymbolsStartsWithUnderLine = boolValue( "hide_symbols_start_with_underline", false); | 
|---|
| 3880 |  | 
|---|
| 3881 | bool doClear = true; | 
|---|
| 3882 |  | 
|---|
| 3883 | #ifdef Q_OS_WIN | 
|---|
| 3884 | MEMORYSTATUSEX statex; | 
|---|
| 3885 |  | 
|---|
| 3886 | statex.dwLength = sizeof (statex); | 
|---|
| 3887 |  | 
|---|
| 3888 | GlobalMemoryStatusEx (&statex); | 
|---|
| 3889 | if (statex.ullAvailPhys > (long long int)10*1024*1024*1024) { | 
|---|
| 3890 | doClear = false; | 
|---|
| 3891 | } | 
|---|
| 3892 | #endif | 
|---|
| 3893 |  | 
|---|
| 3894 | mClearWhenEditorHidden = boolValue( "clear_when_editor_hidden",doClear); | 
|---|
| 3895 |  | 
|---|
| 3896 | #ifdef Q_OS_WIN | 
|---|
| 3897 | if (statex.ullAvailPhys < (long long int)1024*1024*1024) { | 
|---|
| 3898 | mClearWhenEditorHidden = true; | 
|---|
| 3899 | } | 
|---|
| 3900 | #endif | 
|---|
| 3901 | } | 
|---|
| 3902 |  | 
|---|
| 3903 | Settings::CodeFormatter::CodeFormatter(Settings *settings): | 
|---|
| 3904 | _Base(settings,SETTING_CODE_FORMATTER) | 
|---|
| 3905 | { | 
|---|
| 3906 |  | 
|---|
| 3907 | } | 
|---|
| 3908 |  | 
|---|
| 3909 | QStringList Settings::CodeFormatter::getArguments() | 
|---|
| 3910 | { | 
|---|
| 3911 | QStringList result; | 
|---|
| 3912 | switch(mBraceStyle) { | 
|---|
| 3913 | case FormatterBraceStyle::fbsDefault: | 
|---|
| 3914 | break; | 
|---|
| 3915 | case FormatterBraceStyle::fbsAllman: | 
|---|
| 3916 | result.append( "--style=allman"); | 
|---|
| 3917 | break; | 
|---|
| 3918 | case FormatterBraceStyle::fbsJava: | 
|---|
| 3919 | result.append( "--style=java"); | 
|---|
| 3920 | break; | 
|---|
| 3921 | case FormatterBraceStyle::fbsKR: | 
|---|
| 3922 | result.append( "--style=kr"); | 
|---|
| 3923 | break; | 
|---|
| 3924 | case FormatterBraceStyle::fbsStroustrup: | 
|---|
| 3925 | result.append( "--style=stroustrup"); | 
|---|
| 3926 | break; | 
|---|
| 3927 | case FormatterBraceStyle::fbsWitesmith: | 
|---|
| 3928 | result.append( "--style=whitesmith"); | 
|---|
| 3929 | break; | 
|---|
| 3930 | case FormatterBraceStyle::fbsVtk: | 
|---|
| 3931 | result.append( "--style=vtk"); | 
|---|
| 3932 | break; | 
|---|
| 3933 | case FormatterBraceStyle::fbsRatliff: | 
|---|
| 3934 | result.append( "--style=ratliff"); | 
|---|
| 3935 | break; | 
|---|
| 3936 | case FormatterBraceStyle::fbsGNU: | 
|---|
| 3937 | result.append( "--style=gnu"); | 
|---|
| 3938 | break; | 
|---|
| 3939 | case FormatterBraceStyle::fbsLinux: | 
|---|
| 3940 | result.append( "--style=linux"); | 
|---|
| 3941 | break; | 
|---|
| 3942 | case FormatterBraceStyle::fbsHorstmann: | 
|---|
| 3943 | result.append( "--style=horstmann"); | 
|---|
| 3944 | break; | 
|---|
| 3945 | case FormatterBraceStyle::fbs1TBS: | 
|---|
| 3946 | result.append( "--style=1tbs"); | 
|---|
| 3947 | break; | 
|---|
| 3948 | case FormatterBraceStyle::fbsGoogle: | 
|---|
| 3949 | result.append( "--style=google"); | 
|---|
| 3950 | break; | 
|---|
| 3951 | case FormatterBraceStyle::fbsMozilla: | 
|---|
| 3952 | result.append( "--style=mozilla"); | 
|---|
| 3953 | break; | 
|---|
| 3954 | case FormatterBraceStyle::fbsWebkit: | 
|---|
| 3955 | result.append( "--style=webkit"); | 
|---|
| 3956 | break; | 
|---|
| 3957 | case FormatterBraceStyle::fbsPico: | 
|---|
| 3958 | result.append( "--style=pico"); | 
|---|
| 3959 | break; | 
|---|
| 3960 | case FormatterBraceStyle::fbsLisp: | 
|---|
| 3961 | result.append( "--style=lisp"); | 
|---|
| 3962 | break; | 
|---|
| 3963 | }; | 
|---|
| 3964 | switch(mIndentStyle) { | 
|---|
| 3965 | case FormatterIndentType::fitTab: | 
|---|
| 3966 | result.append(QString( "--indent=tab=%1").arg(mTabWidth)); | 
|---|
| 3967 | break; | 
|---|
| 3968 | case FormatterIndentType::fitSpace: | 
|---|
| 3969 | result.append(QString( "--indent=spaces=%1").arg(mTabWidth)); | 
|---|
| 3970 | break; | 
|---|
| 3971 | } | 
|---|
| 3972 | if (mAttachNamespaces) | 
|---|
| 3973 | result.append( "--attach-namespaces"); | 
|---|
| 3974 | if (mAttachClasses) | 
|---|
| 3975 | result.append( "--attach-classes"); | 
|---|
| 3976 | if (mAttachInlines) | 
|---|
| 3977 | result.append( "--attach-inlines"); | 
|---|
| 3978 | if (mAttachExternC) | 
|---|
| 3979 | result.append( "--attach-extern-c"); | 
|---|
| 3980 | if (mAttachClosingWhile) | 
|---|
| 3981 | result.append( "--attach-closing-while"); | 
|---|
| 3982 | if (mIndentClasses) | 
|---|
| 3983 | result.append( "--indent-classes"); | 
|---|
| 3984 | if (mIndentModifiers) | 
|---|
| 3985 | result.append( "--indent-modifiers"); | 
|---|
| 3986 | if (mIndentSwitches) | 
|---|
| 3987 | result.append( "--indent-switches"); | 
|---|
| 3988 | if (mIndentCases) | 
|---|
| 3989 | result.append( "--indent-cases"); | 
|---|
| 3990 | if (mIndentNamespaces) | 
|---|
| 3991 | result.append( "--indent-namespaces"); | 
|---|
| 3992 | if (mIndentAfterParens) | 
|---|
| 3993 | result.append( "--indent-after-parens"); | 
|---|
| 3994 | if (mIndentContinuation!=1) | 
|---|
| 3995 | result.append(QString( "--indent-continuation=%1").arg(mIndentContinuation)); | 
|---|
| 3996 | if (mIndentLabels) | 
|---|
| 3997 | result.append( "--indent-labels"); | 
|---|
| 3998 | if (mIndentPreprocBlock) | 
|---|
| 3999 | result.append( "--indent-preproc-block"); | 
|---|
| 4000 | if (mIndentPreprocCond) | 
|---|
| 4001 | result.append( "--indent-preproc-cond"); | 
|---|
| 4002 | if (mIndentPreprocDefine) | 
|---|
| 4003 | result.append( "--indent-preproc-define"); | 
|---|
| 4004 | if (mIndentCol1Comments) | 
|---|
| 4005 | result.append( "--indent-col1-comments"); | 
|---|
| 4006 | if (mMinConditionalIndent!=2) | 
|---|
| 4007 | result.append(QString( "--min-conditional-indent=%1").arg(mMinConditionalIndent)); | 
|---|
| 4008 | if (mMaxContinuationIndent!=40) | 
|---|
| 4009 | result.append(QString( "--max-continuation-indent=%1").arg(mMaxContinuationIndent)); | 
|---|
| 4010 | if (mBreakBlocks) | 
|---|
| 4011 | result.append( "--break-blocks"); | 
|---|
| 4012 | if (mBreakBlocksAll) | 
|---|
| 4013 | result.append( "--break-blocks=all"); | 
|---|
| 4014 | if (mPadOper) | 
|---|
| 4015 | result.append( "--pad-oper"); | 
|---|
| 4016 | if (mPadComma) | 
|---|
| 4017 | result.append( "--pad-comma"); | 
|---|
| 4018 | if (mPadParen) | 
|---|
| 4019 | result.append( "--pad-paren"); | 
|---|
| 4020 | if (mPadParenOut) | 
|---|
| 4021 | result.append( "--pad-paren-out"); | 
|---|
| 4022 | if (mPadFirstParenOut) | 
|---|
| 4023 | result.append( "--pad-first-paren-out"); | 
|---|
| 4024 | if (mPadParenIn) | 
|---|
| 4025 | result.append( "--pad-paren-in"); | 
|---|
| 4026 | if (mPadHeader) | 
|---|
| 4027 | result.append( "--pad-header"); | 
|---|
| 4028 | if (mUnpadParen) | 
|---|
| 4029 | result.append( "--unpad-paren"); | 
|---|
| 4030 | if (mDeleteEmptyLines) | 
|---|
| 4031 | result.append( "--delete-empty-lines"); | 
|---|
| 4032 | if (mDeleteMultipleEmptyLines) | 
|---|
| 4033 | result.append( "--delete-multiple-empty-lines"); | 
|---|
| 4034 | if (mFillEmptyLines) | 
|---|
| 4035 | result.append( "--fill-empty-lines"); | 
|---|
| 4036 | switch(mAlignPointerStyle) { | 
|---|
| 4037 | case FormatterOperatorAlign::foaNone: | 
|---|
| 4038 | break; | 
|---|
| 4039 | case FormatterOperatorAlign::foaType: | 
|---|
| 4040 | result.append( "--align-pointer=type"); | 
|---|
| 4041 | break; | 
|---|
| 4042 | case FormatterOperatorAlign::foaMiddle: | 
|---|
| 4043 | result.append( "--align-pointer=middle"); | 
|---|
| 4044 | break; | 
|---|
| 4045 | case FormatterOperatorAlign::foaName: | 
|---|
| 4046 | result.append( "--align-pointer=name"); | 
|---|
| 4047 | break; | 
|---|
| 4048 | } | 
|---|
| 4049 | switch(mAlignReferenceStyle) { | 
|---|
| 4050 | case FormatterOperatorAlign::foaNone: | 
|---|
| 4051 | break; | 
|---|
| 4052 | case FormatterOperatorAlign::foaType: | 
|---|
| 4053 | result.append( "--align-reference=type"); | 
|---|
| 4054 | break; | 
|---|
| 4055 | case FormatterOperatorAlign::foaMiddle: | 
|---|
| 4056 | result.append( "--align-reference=middle"); | 
|---|
| 4057 | break; | 
|---|
| 4058 | case FormatterOperatorAlign::foaName: | 
|---|
| 4059 | result.append( "--align-reference=name"); | 
|---|
| 4060 | break; | 
|---|
| 4061 | } | 
|---|
| 4062 |  | 
|---|
| 4063 | if (mBreakClosingBraces) | 
|---|
| 4064 | result.append( "--break-closing-braces"); | 
|---|
| 4065 | if (mBreakElseIf) | 
|---|
| 4066 | result.append( "--break-elseifs"); | 
|---|
| 4067 | if (mBreakOneLineHeaders) | 
|---|
| 4068 | result.append( "--break-one-line-headers"); | 
|---|
| 4069 | if (mAddBraces) | 
|---|
| 4070 | result.append( "--add-braces"); | 
|---|
| 4071 | if (mAddOneLineBraces) | 
|---|
| 4072 | result.append( "--add-one-line-braces"); | 
|---|
| 4073 | if (mRemoveBraces) | 
|---|
| 4074 | result.append( "--remove-braces"); | 
|---|
| 4075 | if (mBreakReturnType) | 
|---|
| 4076 | result.append( "--break-return-type"); | 
|---|
| 4077 | if (mBreakReturnTypeDecl) | 
|---|
| 4078 | result.append( "--break-return-type-decl"); | 
|---|
| 4079 | if (mAttachReturnType) | 
|---|
| 4080 | result.append( "--attach-return-type"); | 
|---|
| 4081 | if (mAttachReturnTypeDecl) | 
|---|
| 4082 | result.append( "--attach-return-type-decl"); | 
|---|
| 4083 | if (mKeepOneLineBlocks) | 
|---|
| 4084 | result.append( "--keep-one-line-blocks"); | 
|---|
| 4085 | if (mKeepOneLineStatements) | 
|---|
| 4086 | result.append( "--keep-one-line-statements"); | 
|---|
| 4087 | if (mConvertTabs) | 
|---|
| 4088 | result.append( "--convert-tabs"); | 
|---|
| 4089 | if (mCloseTemplates) | 
|---|
| 4090 | result.append( "--close-templates"); | 
|---|
| 4091 | if (mRemoveCommentPrefix) | 
|---|
| 4092 | result.append( "--remove-comment-prefix"); | 
|---|
| 4093 | if (mBreakMaxCodeLength) { | 
|---|
| 4094 | result.append(QString( "--max-code-length=%1").arg(mMaxCodeLength)); | 
|---|
| 4095 | if (mBreakAfterLogical) | 
|---|
| 4096 | result.append( "--break-after-logical"); | 
|---|
| 4097 | } | 
|---|
| 4098 |  | 
|---|
| 4099 | return result; | 
|---|
| 4100 | } | 
|---|
| 4101 |  | 
|---|
| 4102 | int Settings::CodeFormatter::indentStyle() const | 
|---|
| 4103 | { | 
|---|
| 4104 | return mIndentStyle; | 
|---|
| 4105 | } | 
|---|
| 4106 |  | 
|---|
| 4107 | void Settings::CodeFormatter::setIndentStyle(int newIndentStyle) | 
|---|
| 4108 | { | 
|---|
| 4109 | mIndentStyle = newIndentStyle; | 
|---|
| 4110 | } | 
|---|
| 4111 |  | 
|---|
| 4112 | int Settings::CodeFormatter::tabWidth() const | 
|---|
| 4113 | { | 
|---|
| 4114 | return mTabWidth; | 
|---|
| 4115 | } | 
|---|
| 4116 |  | 
|---|
| 4117 | void Settings::CodeFormatter::setTabWidth(int newTabWidth) | 
|---|
| 4118 | { | 
|---|
| 4119 | mTabWidth = newTabWidth; | 
|---|
| 4120 | } | 
|---|
| 4121 |  | 
|---|
| 4122 | bool Settings::CodeFormatter::attachNamespaces() const | 
|---|
| 4123 | { | 
|---|
| 4124 | return mAttachNamespaces; | 
|---|
| 4125 | } | 
|---|
| 4126 |  | 
|---|
| 4127 | void Settings::CodeFormatter::setAttachNamespaces(bool newAttachNamespaces) | 
|---|
| 4128 | { | 
|---|
| 4129 | mAttachNamespaces = newAttachNamespaces; | 
|---|
| 4130 | } | 
|---|
| 4131 |  | 
|---|
| 4132 | bool Settings::CodeFormatter::attachClasses() const | 
|---|
| 4133 | { | 
|---|
| 4134 | return mAttachClasses; | 
|---|
| 4135 | } | 
|---|
| 4136 |  | 
|---|
| 4137 | void Settings::CodeFormatter::setAttachClasses(bool newAttachClasses) | 
|---|
| 4138 | { | 
|---|
| 4139 | mAttachClasses = newAttachClasses; | 
|---|
| 4140 | } | 
|---|
| 4141 |  | 
|---|
| 4142 | bool Settings::CodeFormatter::attachInlines() const | 
|---|
| 4143 | { | 
|---|
| 4144 | return mAttachInlines; | 
|---|
| 4145 | } | 
|---|
| 4146 |  | 
|---|
| 4147 | void Settings::CodeFormatter::setAttachInlines(bool newAttachInlines) | 
|---|
| 4148 | { | 
|---|
| 4149 | mAttachInlines = newAttachInlines; | 
|---|
| 4150 | } | 
|---|
| 4151 |  | 
|---|
| 4152 | bool Settings::CodeFormatter::attachExternC() const | 
|---|
| 4153 | { | 
|---|
| 4154 | return mAttachExternC; | 
|---|
| 4155 | } | 
|---|
| 4156 |  | 
|---|
| 4157 | void Settings::CodeFormatter::setAttachExternC(bool newAttachExternC) | 
|---|
| 4158 | { | 
|---|
| 4159 | mAttachExternC = newAttachExternC; | 
|---|
| 4160 | } | 
|---|
| 4161 |  | 
|---|
| 4162 | bool Settings::CodeFormatter::attachClosingWhile() const | 
|---|
| 4163 | { | 
|---|
| 4164 | return mAttachClosingWhile; | 
|---|
| 4165 | } | 
|---|
| 4166 |  | 
|---|
| 4167 | void Settings::CodeFormatter::setAttachClosingWhile(bool newAttachClosingWhile) | 
|---|
| 4168 | { | 
|---|
| 4169 | mAttachClosingWhile = newAttachClosingWhile; | 
|---|
| 4170 | } | 
|---|
| 4171 |  | 
|---|
| 4172 | bool Settings::CodeFormatter::indentClasses() const | 
|---|
| 4173 | { | 
|---|
| 4174 | return mIndentClasses; | 
|---|
| 4175 | } | 
|---|
| 4176 |  | 
|---|
| 4177 | void Settings::CodeFormatter::setIndentClasses(bool newIndentClasses) | 
|---|
| 4178 | { | 
|---|
| 4179 | mIndentClasses = newIndentClasses; | 
|---|
| 4180 | } | 
|---|
| 4181 |  | 
|---|
| 4182 | bool Settings::CodeFormatter::indentModifiers() const | 
|---|
| 4183 | { | 
|---|
| 4184 | return mIndentModifiers; | 
|---|
| 4185 | } | 
|---|
| 4186 |  | 
|---|
| 4187 | void Settings::CodeFormatter::setIndentModifiers(bool newIndentModifiers) | 
|---|
| 4188 | { | 
|---|
| 4189 | mIndentModifiers = newIndentModifiers; | 
|---|
| 4190 | } | 
|---|
| 4191 |  | 
|---|
| 4192 | bool Settings::CodeFormatter::indentCases() const | 
|---|
| 4193 | { | 
|---|
| 4194 | return mIndentCases; | 
|---|
| 4195 | } | 
|---|
| 4196 |  | 
|---|
| 4197 | void Settings::CodeFormatter::setIndentCases(bool newIndentCases) | 
|---|
| 4198 | { | 
|---|
| 4199 | mIndentCases = newIndentCases; | 
|---|
| 4200 | } | 
|---|
| 4201 |  | 
|---|
| 4202 | bool Settings::CodeFormatter::indentNamespaces() const | 
|---|
| 4203 | { | 
|---|
| 4204 | return mIndentNamespaces; | 
|---|
| 4205 | } | 
|---|
| 4206 |  | 
|---|
| 4207 | void Settings::CodeFormatter::setIndentNamespaces(bool newIndentNamespaces) | 
|---|
| 4208 | { | 
|---|
| 4209 | mIndentNamespaces = newIndentNamespaces; | 
|---|
| 4210 | } | 
|---|
| 4211 |  | 
|---|
| 4212 | int Settings::CodeFormatter::indentContinuation() const | 
|---|
| 4213 | { | 
|---|
| 4214 | return mIndentContinuation; | 
|---|
| 4215 | } | 
|---|
| 4216 |  | 
|---|
| 4217 | void Settings::CodeFormatter::setIndentContinuation(int newIndentContinuation) | 
|---|
| 4218 | { | 
|---|
| 4219 | mIndentContinuation = newIndentContinuation; | 
|---|
| 4220 | } | 
|---|
| 4221 |  | 
|---|
| 4222 | bool Settings::CodeFormatter::indentLabels() const | 
|---|
| 4223 | { | 
|---|
| 4224 | return mIndentLabels; | 
|---|
| 4225 | } | 
|---|
| 4226 |  | 
|---|
| 4227 | void Settings::CodeFormatter::setIndentLabels(bool newIndentLabels) | 
|---|
| 4228 | { | 
|---|
| 4229 | mIndentLabels = newIndentLabels; | 
|---|
| 4230 | } | 
|---|
| 4231 |  | 
|---|
| 4232 | bool Settings::CodeFormatter::indentPreprocBlock() const | 
|---|
| 4233 | { | 
|---|
| 4234 | return mIndentPreprocBlock; | 
|---|
| 4235 | } | 
|---|
| 4236 |  | 
|---|
| 4237 | void Settings::CodeFormatter::setIndentPreprocBlock(bool newIndentPreprocBlock) | 
|---|
| 4238 | { | 
|---|
| 4239 | mIndentPreprocBlock = newIndentPreprocBlock; | 
|---|
| 4240 | } | 
|---|
| 4241 |  | 
|---|
| 4242 | bool Settings::CodeFormatter::indentPreprocCond() const | 
|---|
| 4243 | { | 
|---|
| 4244 | return mIndentPreprocCond; | 
|---|
| 4245 | } | 
|---|
| 4246 |  | 
|---|
| 4247 | void Settings::CodeFormatter::setIndentPreprocCond(bool newIndentPreprocCond) | 
|---|
| 4248 | { | 
|---|
| 4249 | mIndentPreprocCond = newIndentPreprocCond; | 
|---|
| 4250 | } | 
|---|
| 4251 |  | 
|---|
| 4252 | bool Settings::CodeFormatter::indentPreprocDefine() const | 
|---|
| 4253 | { | 
|---|
| 4254 | return mIndentPreprocDefine; | 
|---|
| 4255 | } | 
|---|
| 4256 |  | 
|---|
| 4257 | void Settings::CodeFormatter::setIndentPreprocDefine(bool newIndentPreprocDefine) | 
|---|
| 4258 | { | 
|---|
| 4259 | mIndentPreprocDefine = newIndentPreprocDefine; | 
|---|
| 4260 | } | 
|---|
| 4261 |  | 
|---|
| 4262 | bool Settings::CodeFormatter::() const | 
|---|
| 4263 | { | 
|---|
| 4264 | return mIndentCol1Comments; | 
|---|
| 4265 | } | 
|---|
| 4266 |  | 
|---|
| 4267 | void Settings::CodeFormatter::(bool ) | 
|---|
| 4268 | { | 
|---|
| 4269 | mIndentCol1Comments = newIndentCol1Comments; | 
|---|
| 4270 | } | 
|---|
| 4271 |  | 
|---|
| 4272 | int Settings::CodeFormatter::minConditionalIndent() const | 
|---|
| 4273 | { | 
|---|
| 4274 | return mMinConditionalIndent; | 
|---|
| 4275 | } | 
|---|
| 4276 |  | 
|---|
| 4277 | void Settings::CodeFormatter::setMinConditionalIndent(int newMinConditionalIndent) | 
|---|
| 4278 | { | 
|---|
| 4279 | mMinConditionalIndent = newMinConditionalIndent; | 
|---|
| 4280 | } | 
|---|
| 4281 |  | 
|---|
| 4282 | int Settings::CodeFormatter::maxContinuationIndent() const | 
|---|
| 4283 | { | 
|---|
| 4284 | return mMaxContinuationIndent; | 
|---|
| 4285 | } | 
|---|
| 4286 |  | 
|---|
| 4287 | void Settings::CodeFormatter::setMaxContinuationIndent(int newMaxContinuationIndent) | 
|---|
| 4288 | { | 
|---|
| 4289 | mMaxContinuationIndent = newMaxContinuationIndent; | 
|---|
| 4290 | } | 
|---|
| 4291 |  | 
|---|
| 4292 | bool Settings::CodeFormatter::breakBlocks() const | 
|---|
| 4293 | { | 
|---|
| 4294 | return mBreakBlocks; | 
|---|
| 4295 | } | 
|---|
| 4296 |  | 
|---|
| 4297 | void Settings::CodeFormatter::setBreakBlocks(bool newBreakBlocks) | 
|---|
| 4298 | { | 
|---|
| 4299 | mBreakBlocks = newBreakBlocks; | 
|---|
| 4300 | } | 
|---|
| 4301 |  | 
|---|
| 4302 | bool Settings::CodeFormatter::breakBlocksAll() const | 
|---|
| 4303 | { | 
|---|
| 4304 | return mBreakBlocksAll; | 
|---|
| 4305 | } | 
|---|
| 4306 |  | 
|---|
| 4307 | void Settings::CodeFormatter::setBreakBlocksAll(bool newBreakBlocksAll) | 
|---|
| 4308 | { | 
|---|
| 4309 | mBreakBlocksAll = newBreakBlocksAll; | 
|---|
| 4310 | } | 
|---|
| 4311 |  | 
|---|
| 4312 | bool Settings::CodeFormatter::padOper() const | 
|---|
| 4313 | { | 
|---|
| 4314 | return mPadOper; | 
|---|
| 4315 | } | 
|---|
| 4316 |  | 
|---|
| 4317 | void Settings::CodeFormatter::setPadOper(bool newPadOper) | 
|---|
| 4318 | { | 
|---|
| 4319 | mPadOper = newPadOper; | 
|---|
| 4320 | } | 
|---|
| 4321 |  | 
|---|
| 4322 | bool Settings::CodeFormatter::padComma() const | 
|---|
| 4323 | { | 
|---|
| 4324 | return mPadComma; | 
|---|
| 4325 | } | 
|---|
| 4326 |  | 
|---|
| 4327 | void Settings::CodeFormatter::setPadComma(bool newPadComma) | 
|---|
| 4328 | { | 
|---|
| 4329 | mPadComma = newPadComma; | 
|---|
| 4330 | } | 
|---|
| 4331 |  | 
|---|
| 4332 | bool Settings::CodeFormatter::padParen() const | 
|---|
| 4333 | { | 
|---|
| 4334 | return mPadParen; | 
|---|
| 4335 | } | 
|---|
| 4336 |  | 
|---|
| 4337 | void Settings::CodeFormatter::setPadParen(bool newPadParen) | 
|---|
| 4338 | { | 
|---|
| 4339 | mPadParen = newPadParen; | 
|---|
| 4340 | } | 
|---|
| 4341 |  | 
|---|
| 4342 | bool Settings::CodeFormatter::padParenOut() const | 
|---|
| 4343 | { | 
|---|
| 4344 | return mPadParenOut; | 
|---|
| 4345 | } | 
|---|
| 4346 |  | 
|---|
| 4347 | void Settings::CodeFormatter::setPadParenOut(bool newPadParenOut) | 
|---|
| 4348 | { | 
|---|
| 4349 | mPadParenOut = newPadParenOut; | 
|---|
| 4350 | } | 
|---|
| 4351 |  | 
|---|
| 4352 | bool Settings::CodeFormatter::padFirstParenOut() const | 
|---|
| 4353 | { | 
|---|
| 4354 | return mPadFirstParenOut; | 
|---|
| 4355 | } | 
|---|
| 4356 |  | 
|---|
| 4357 | void Settings::CodeFormatter::setPadFirstParenOut(bool newPadFirstParenOut) | 
|---|
| 4358 | { | 
|---|
| 4359 | mPadFirstParenOut = newPadFirstParenOut; | 
|---|
| 4360 | } | 
|---|
| 4361 |  | 
|---|
| 4362 | bool Settings::CodeFormatter::padParenIn() const | 
|---|
| 4363 | { | 
|---|
| 4364 | return mPadParenIn; | 
|---|
| 4365 | } | 
|---|
| 4366 |  | 
|---|
| 4367 | void Settings::CodeFormatter::setPadParenIn(bool newPadParenIn) | 
|---|
| 4368 | { | 
|---|
| 4369 | mPadParenIn = newPadParenIn; | 
|---|
| 4370 | } | 
|---|
| 4371 |  | 
|---|
| 4372 | bool Settings::CodeFormatter::() const | 
|---|
| 4373 | { | 
|---|
| 4374 | return mPadHeader; | 
|---|
| 4375 | } | 
|---|
| 4376 |  | 
|---|
| 4377 | void Settings::CodeFormatter::(bool ) | 
|---|
| 4378 | { | 
|---|
| 4379 | mPadHeader = newPadHeader; | 
|---|
| 4380 | } | 
|---|
| 4381 |  | 
|---|
| 4382 | bool Settings::CodeFormatter::unpadParen() const | 
|---|
| 4383 | { | 
|---|
| 4384 | return mUnpadParen; | 
|---|
| 4385 | } | 
|---|
| 4386 |  | 
|---|
| 4387 | void Settings::CodeFormatter::setUnpadParen(bool newUnpadParen) | 
|---|
| 4388 | { | 
|---|
| 4389 | mUnpadParen = newUnpadParen; | 
|---|
| 4390 | } | 
|---|
| 4391 |  | 
|---|
| 4392 | bool Settings::CodeFormatter::deleteEmptyLines() const | 
|---|
| 4393 | { | 
|---|
| 4394 | return mDeleteEmptyLines; | 
|---|
| 4395 | } | 
|---|
| 4396 |  | 
|---|
| 4397 | void Settings::CodeFormatter::setDeleteEmptyLines(bool newDeleteEmptyLines) | 
|---|
| 4398 | { | 
|---|
| 4399 | mDeleteEmptyLines = newDeleteEmptyLines; | 
|---|
| 4400 | } | 
|---|
| 4401 |  | 
|---|
| 4402 | bool Settings::CodeFormatter::deleteMultipleEmptyLines() const | 
|---|
| 4403 | { | 
|---|
| 4404 | return mDeleteMultipleEmptyLines; | 
|---|
| 4405 | } | 
|---|
| 4406 |  | 
|---|
| 4407 | void Settings::CodeFormatter::setDeleteMultipleEmptyLines(bool newDeleteMultipleEmptyLines) | 
|---|
| 4408 | { | 
|---|
| 4409 | mDeleteMultipleEmptyLines = newDeleteMultipleEmptyLines; | 
|---|
| 4410 | } | 
|---|
| 4411 |  | 
|---|
| 4412 | bool Settings::CodeFormatter::fillEmptyLines() const | 
|---|
| 4413 | { | 
|---|
| 4414 | return mFillEmptyLines; | 
|---|
| 4415 | } | 
|---|
| 4416 |  | 
|---|
| 4417 | void Settings::CodeFormatter::setFillEmptyLines(bool newFillEmptyLines) | 
|---|
| 4418 | { | 
|---|
| 4419 | mFillEmptyLines = newFillEmptyLines; | 
|---|
| 4420 | } | 
|---|
| 4421 |  | 
|---|
| 4422 | int Settings::CodeFormatter::alignPointerStyle() const | 
|---|
| 4423 | { | 
|---|
| 4424 | return mAlignPointerStyle; | 
|---|
| 4425 | } | 
|---|
| 4426 |  | 
|---|
| 4427 | void Settings::CodeFormatter::setAlignPointerStyle(int newAlignPointerStyle) | 
|---|
| 4428 | { | 
|---|
| 4429 | mAlignPointerStyle = newAlignPointerStyle; | 
|---|
| 4430 | } | 
|---|
| 4431 |  | 
|---|
| 4432 | int Settings::CodeFormatter::alignReferenceStyle() const | 
|---|
| 4433 | { | 
|---|
| 4434 | return mAlignReferenceStyle; | 
|---|
| 4435 | } | 
|---|
| 4436 |  | 
|---|
| 4437 | void Settings::CodeFormatter::setAlignReferenceStyle(int newAlignReferenceStyle) | 
|---|
| 4438 | { | 
|---|
| 4439 | mAlignReferenceStyle = newAlignReferenceStyle; | 
|---|
| 4440 | } | 
|---|
| 4441 |  | 
|---|
| 4442 | bool Settings::CodeFormatter::breakClosingBraces() const | 
|---|
| 4443 | { | 
|---|
| 4444 | return mBreakClosingBraces; | 
|---|
| 4445 | } | 
|---|
| 4446 |  | 
|---|
| 4447 | void Settings::CodeFormatter::setBreakClosingBraces(bool newBreakClosingBraces) | 
|---|
| 4448 | { | 
|---|
| 4449 | mBreakClosingBraces = newBreakClosingBraces; | 
|---|
| 4450 | } | 
|---|
| 4451 |  | 
|---|
| 4452 | bool Settings::CodeFormatter::breakElseIf() const | 
|---|
| 4453 | { | 
|---|
| 4454 | return mBreakElseIf; | 
|---|
| 4455 | } | 
|---|
| 4456 |  | 
|---|
| 4457 | void Settings::CodeFormatter::setBreakElseIf(bool newBreakElseIf) | 
|---|
| 4458 | { | 
|---|
| 4459 | mBreakElseIf = newBreakElseIf; | 
|---|
| 4460 | } | 
|---|
| 4461 |  | 
|---|
| 4462 | bool Settings::CodeFormatter::() const | 
|---|
| 4463 | { | 
|---|
| 4464 | return mBreakOneLineHeaders; | 
|---|
| 4465 | } | 
|---|
| 4466 |  | 
|---|
| 4467 | void Settings::CodeFormatter::(bool ) | 
|---|
| 4468 | { | 
|---|
| 4469 | mBreakOneLineHeaders = newBreakOneLineHeaders; | 
|---|
| 4470 | } | 
|---|
| 4471 |  | 
|---|
| 4472 | bool Settings::CodeFormatter::addBraces() const | 
|---|
| 4473 | { | 
|---|
| 4474 | return mAddBraces; | 
|---|
| 4475 | } | 
|---|
| 4476 |  | 
|---|
| 4477 | void Settings::CodeFormatter::setAddBraces(bool newAddBraces) | 
|---|
| 4478 | { | 
|---|
| 4479 | mAddBraces = newAddBraces; | 
|---|
| 4480 | } | 
|---|
| 4481 |  | 
|---|
| 4482 | bool Settings::CodeFormatter::addOneLineBraces() const | 
|---|
| 4483 | { | 
|---|
| 4484 | return mAddOneLineBraces; | 
|---|
| 4485 | } | 
|---|
| 4486 |  | 
|---|
| 4487 | void Settings::CodeFormatter::setAddOneLineBraces(bool newAddOneLineBraces) | 
|---|
| 4488 | { | 
|---|
| 4489 | mAddOneLineBraces = newAddOneLineBraces; | 
|---|
| 4490 | } | 
|---|
| 4491 |  | 
|---|
| 4492 | bool Settings::CodeFormatter::removeBraces() const | 
|---|
| 4493 | { | 
|---|
| 4494 | return mRemoveBraces; | 
|---|
| 4495 | } | 
|---|
| 4496 |  | 
|---|
| 4497 | void Settings::CodeFormatter::setRemoveBraces(bool newRemoveBraces) | 
|---|
| 4498 | { | 
|---|
| 4499 | mRemoveBraces = newRemoveBraces; | 
|---|
| 4500 | } | 
|---|
| 4501 |  | 
|---|
| 4502 | bool Settings::CodeFormatter::breakReturnTypeDecl() const | 
|---|
| 4503 | { | 
|---|
| 4504 | return mBreakReturnTypeDecl; | 
|---|
| 4505 | } | 
|---|
| 4506 |  | 
|---|
| 4507 | void Settings::CodeFormatter::setBreakReturnTypeDecl(bool newBreakReturnTypeDecl) | 
|---|
| 4508 | { | 
|---|
| 4509 | mBreakReturnTypeDecl = newBreakReturnTypeDecl; | 
|---|
| 4510 | } | 
|---|
| 4511 |  | 
|---|
| 4512 | bool Settings::CodeFormatter::attachReturnType() const | 
|---|
| 4513 | { | 
|---|
| 4514 | return mAttachReturnType; | 
|---|
| 4515 | } | 
|---|
| 4516 |  | 
|---|
| 4517 | void Settings::CodeFormatter::setAttachReturnType(bool newAttachReturnType) | 
|---|
| 4518 | { | 
|---|
| 4519 | mAttachReturnType = newAttachReturnType; | 
|---|
| 4520 | } | 
|---|
| 4521 |  | 
|---|
| 4522 | bool Settings::CodeFormatter::attachReturnTypeDecl() const | 
|---|
| 4523 | { | 
|---|
| 4524 | return mAttachReturnTypeDecl; | 
|---|
| 4525 | } | 
|---|
| 4526 |  | 
|---|
| 4527 | void Settings::CodeFormatter::setAttachReturnTypeDecl(bool newAttachReturnTypeDecl) | 
|---|
| 4528 | { | 
|---|
| 4529 | mAttachReturnTypeDecl = newAttachReturnTypeDecl; | 
|---|
| 4530 | } | 
|---|
| 4531 |  | 
|---|
| 4532 | bool Settings::CodeFormatter::keepOneLineBlocks() const | 
|---|
| 4533 | { | 
|---|
| 4534 | return mKeepOneLineBlocks; | 
|---|
| 4535 | } | 
|---|
| 4536 |  | 
|---|
| 4537 | void Settings::CodeFormatter::setKeepOneLineBlocks(bool newKeepOneLineBlocks) | 
|---|
| 4538 | { | 
|---|
| 4539 | mKeepOneLineBlocks = newKeepOneLineBlocks; | 
|---|
| 4540 | } | 
|---|
| 4541 |  | 
|---|
| 4542 | bool Settings::CodeFormatter::keepOneLineStatements() const | 
|---|
| 4543 | { | 
|---|
| 4544 | return mKeepOneLineStatements; | 
|---|
| 4545 | } | 
|---|
| 4546 |  | 
|---|
| 4547 | void Settings::CodeFormatter::setKeepOneLineStatements(bool newKeepOneLineStatements) | 
|---|
| 4548 | { | 
|---|
| 4549 | mKeepOneLineStatements = newKeepOneLineStatements; | 
|---|
| 4550 | } | 
|---|
| 4551 |  | 
|---|
| 4552 | bool Settings::CodeFormatter::convertTabs() const | 
|---|
| 4553 | { | 
|---|
| 4554 | return mConvertTabs; | 
|---|
| 4555 | } | 
|---|
| 4556 |  | 
|---|
| 4557 | void Settings::CodeFormatter::setConvertTabs(bool newConvertTabs) | 
|---|
| 4558 | { | 
|---|
| 4559 | mConvertTabs = newConvertTabs; | 
|---|
| 4560 | } | 
|---|
| 4561 |  | 
|---|
| 4562 | bool Settings::CodeFormatter::closeTemplates() const | 
|---|
| 4563 | { | 
|---|
| 4564 | return mCloseTemplates; | 
|---|
| 4565 | } | 
|---|
| 4566 |  | 
|---|
| 4567 | void Settings::CodeFormatter::setCloseTemplates(bool newCloseTemplates) | 
|---|
| 4568 | { | 
|---|
| 4569 | mCloseTemplates = newCloseTemplates; | 
|---|
| 4570 | } | 
|---|
| 4571 |  | 
|---|
| 4572 | bool Settings::CodeFormatter::() const | 
|---|
| 4573 | { | 
|---|
| 4574 | return mRemoveCommentPrefix; | 
|---|
| 4575 | } | 
|---|
| 4576 |  | 
|---|
| 4577 | void Settings::CodeFormatter::(bool ) | 
|---|
| 4578 | { | 
|---|
| 4579 | mRemoveCommentPrefix = newRemoveCommentPrefix; | 
|---|
| 4580 | } | 
|---|
| 4581 |  | 
|---|
| 4582 | int Settings::CodeFormatter::maxCodeLength() const | 
|---|
| 4583 | { | 
|---|
| 4584 | return mMaxCodeLength; | 
|---|
| 4585 | } | 
|---|
| 4586 |  | 
|---|
| 4587 | void Settings::CodeFormatter::setMaxCodeLength(int newMaxCodeLength) | 
|---|
| 4588 | { | 
|---|
| 4589 | mMaxCodeLength = newMaxCodeLength; | 
|---|
| 4590 | } | 
|---|
| 4591 |  | 
|---|
| 4592 | bool Settings::CodeFormatter::breakAfterLogical() const | 
|---|
| 4593 | { | 
|---|
| 4594 | return mBreakAfterLogical; | 
|---|
| 4595 | } | 
|---|
| 4596 |  | 
|---|
| 4597 | void Settings::CodeFormatter::setBreakAfterLogical(bool newBreakAfterLogical) | 
|---|
| 4598 | { | 
|---|
| 4599 | mBreakAfterLogical = newBreakAfterLogical; | 
|---|
| 4600 | } | 
|---|
| 4601 |  | 
|---|
| 4602 | bool Settings::CodeFormatter::breakReturnType() const | 
|---|
| 4603 | { | 
|---|
| 4604 | return mBreakReturnType; | 
|---|
| 4605 | } | 
|---|
| 4606 |  | 
|---|
| 4607 | void Settings::CodeFormatter::setBreakReturnType(bool newBreakReturnType) | 
|---|
| 4608 | { | 
|---|
| 4609 | mBreakReturnType = newBreakReturnType; | 
|---|
| 4610 | } | 
|---|
| 4611 |  | 
|---|
| 4612 | bool Settings::CodeFormatter::breakMaxCodeLength() const | 
|---|
| 4613 | { | 
|---|
| 4614 | return mBreakMaxCodeLength; | 
|---|
| 4615 | } | 
|---|
| 4616 |  | 
|---|
| 4617 | void Settings::CodeFormatter::setBreakMaxCodeLength(bool newBreakMaxCodeLength) | 
|---|
| 4618 | { | 
|---|
| 4619 | mBreakMaxCodeLength = newBreakMaxCodeLength; | 
|---|
| 4620 | } | 
|---|
| 4621 |  | 
|---|
| 4622 | bool Settings::CodeFormatter::indentAfterParens() const | 
|---|
| 4623 | { | 
|---|
| 4624 | return mIndentAfterParens; | 
|---|
| 4625 | } | 
|---|
| 4626 |  | 
|---|
| 4627 | void Settings::CodeFormatter::setIndentAfterParens(bool newIndentAfterParens) | 
|---|
| 4628 | { | 
|---|
| 4629 | mIndentAfterParens = newIndentAfterParens; | 
|---|
| 4630 | } | 
|---|
| 4631 |  | 
|---|
| 4632 | bool Settings::CodeFormatter::indentSwitches() const | 
|---|
| 4633 | { | 
|---|
| 4634 | return mIndentSwitches; | 
|---|
| 4635 | } | 
|---|
| 4636 |  | 
|---|
| 4637 | void Settings::CodeFormatter::setIndentSwitches(bool newIndentSwitches) | 
|---|
| 4638 | { | 
|---|
| 4639 | mIndentSwitches = newIndentSwitches; | 
|---|
| 4640 | } | 
|---|
| 4641 |  | 
|---|
| 4642 | void Settings::CodeFormatter::doSave() | 
|---|
| 4643 | { | 
|---|
| 4644 | saveValue( "brace_style",mBraceStyle); | 
|---|
| 4645 | saveValue( "indent_style",mIndentStyle); | 
|---|
| 4646 | saveValue( "tab_width",mTabWidth); | 
|---|
| 4647 | saveValue( "attach_namespaces",mAttachNamespaces); | 
|---|
| 4648 | saveValue( "attach_classes",mAttachClasses); | 
|---|
| 4649 | saveValue( "attach_inlines",mAttachInlines); | 
|---|
| 4650 | saveValue( "attach_extern_c",mAttachExternC); | 
|---|
| 4651 | saveValue( "attach_closing_while",mAttachClosingWhile); | 
|---|
| 4652 | saveValue( "indent_classes",mIndentClasses); | 
|---|
| 4653 | saveValue( "indent_modifiers",mIndentModifiers); | 
|---|
| 4654 | saveValue( "indent_switches",mIndentSwitches); | 
|---|
| 4655 | saveValue( "indent_cases",mIndentCases); | 
|---|
| 4656 | saveValue( "indent_namespaces",mIndentNamespaces); | 
|---|
| 4657 | saveValue( "indent_after_parents",mIndentAfterParens); | 
|---|
| 4658 | saveValue( "indent_continuation",mIndentContinuation); | 
|---|
| 4659 | saveValue( "indent_labels",mIndentLabels); | 
|---|
| 4660 | saveValue( "indent_preproc_block",mIndentPreprocBlock); | 
|---|
| 4661 | saveValue( "indent_preproc_cond",mIndentPreprocCond); | 
|---|
| 4662 | saveValue( "indent_preproc_define",mIndentPreprocDefine); | 
|---|
| 4663 | saveValue( "indent_col1_comments",mIndentCol1Comments); | 
|---|
| 4664 | saveValue( "min_conditional_indent",mMinConditionalIndent); | 
|---|
| 4665 | saveValue( "max_continuation_indent",mMaxContinuationIndent); | 
|---|
| 4666 | saveValue( "break_blocks",mBreakBlocks); | 
|---|
| 4667 | saveValue( "break_blocks_all",mBreakBlocksAll); | 
|---|
| 4668 | saveValue( "pad_oper",mPadOper); | 
|---|
| 4669 | saveValue( "pad_comma",mPadComma); | 
|---|
| 4670 | saveValue( "pad_paren",mPadParen); | 
|---|
| 4671 | saveValue( "pad_paren_out",mPadParenOut); | 
|---|
| 4672 | saveValue( "pad_first_paren_out",mPadFirstParenOut); | 
|---|
| 4673 | saveValue( "pad_parent_in",mPadParenIn); | 
|---|
| 4674 | saveValue( "pad_header",mPadHeader); | 
|---|
| 4675 | saveValue( "unpad_paren",mUnpadParen); | 
|---|
| 4676 | saveValue( "delete_empty_lines",mDeleteEmptyLines); | 
|---|
| 4677 | saveValue( "delete_multiple_empty_lines",mDeleteMultipleEmptyLines); | 
|---|
| 4678 | saveValue( "fill_empty_lines",mFillEmptyLines); | 
|---|
| 4679 | saveValue( "align_pointer_style",mAlignPointerStyle); | 
|---|
| 4680 | saveValue( "align_reference_style",mAlignReferenceStyle); | 
|---|
| 4681 | saveValue( "break_closing_braces",mBreakClosingBraces); | 
|---|
| 4682 | saveValue( "break_else_if",mBreakElseIf); | 
|---|
| 4683 | saveValue( "break_one_line_headers",mBreakOneLineHeaders); | 
|---|
| 4684 | saveValue( "add_braces",mAddBraces); | 
|---|
| 4685 | saveValue( "add_one_line_braces",mAddOneLineBraces); | 
|---|
| 4686 | saveValue( "remove_braces",mRemoveBraces); | 
|---|
| 4687 | saveValue( "break_return_type",mBreakReturnType); | 
|---|
| 4688 | saveValue( "break_return_type_decl",mBreakReturnTypeDecl); | 
|---|
| 4689 | saveValue( "attach_return_type",mAttachReturnType); | 
|---|
| 4690 | saveValue( "attach_return_type_decl",mAttachReturnTypeDecl); | 
|---|
| 4691 | saveValue( "keep_one_line_blocks",mKeepOneLineBlocks); | 
|---|
| 4692 | saveValue( "keep_one_line_statements",mKeepOneLineStatements); | 
|---|
| 4693 | saveValue( "convert_tabs",mConvertTabs); | 
|---|
| 4694 | saveValue( "close_templates",mCloseTemplates); | 
|---|
| 4695 | saveValue( "remove_comment_prefix",mRemoveCommentPrefix); | 
|---|
| 4696 | saveValue( "break_max_code_length",mBreakMaxCodeLength); | 
|---|
| 4697 | saveValue( "max_code_length",mMaxCodeLength); | 
|---|
| 4698 | saveValue( "break_after_logical",mBreakAfterLogical); | 
|---|
| 4699 | } | 
|---|
| 4700 |  | 
|---|
| 4701 | void Settings::CodeFormatter::doLoad() | 
|---|
| 4702 | { | 
|---|
| 4703 | mBraceStyle = intValue( "brace_style", FormatterBraceStyle::fbsJava); | 
|---|
| 4704 | mIndentStyle = intValue( "indent_style",FormatterIndentType::fitTab); // 0 isspaces, 1 is tab | 
|---|
| 4705 | mTabWidth = intValue( "tab_width",4); | 
|---|
| 4706 | mAttachNamespaces = boolValue( "attach_namespaces",false); | 
|---|
| 4707 | mAttachClasses = boolValue( "attach_classes",false); | 
|---|
| 4708 | mAttachInlines = boolValue( "attach_inlines",false); | 
|---|
| 4709 | mAttachExternC = boolValue( "attach_extern_c",false); | 
|---|
| 4710 | mAttachClosingWhile = boolValue( "attach_closing_while",false); | 
|---|
| 4711 | mIndentClasses = boolValue( "indent_classes",true); | 
|---|
| 4712 | mIndentModifiers = boolValue( "indent_modifiers",false); | 
|---|
| 4713 | mIndentSwitches = boolValue( "indent_switches",true); | 
|---|
| 4714 | mIndentCases = boolValue( "indent_cases",false); | 
|---|
| 4715 | mIndentNamespaces = boolValue( "indent_namespaces",true); | 
|---|
| 4716 | mIndentAfterParens = boolValue( "indent_after_parents",false); | 
|---|
| 4717 | mIndentContinuation = boolValue( "indent_continuation",false); | 
|---|
| 4718 | mIndentLabels = boolValue( "indent_labels",false); | 
|---|
| 4719 | mIndentPreprocBlock = boolValue( "indent_preproc_block",true); | 
|---|
| 4720 | mIndentPreprocCond = boolValue( "indent_preproc_cond",false); | 
|---|
| 4721 | mIndentPreprocDefine = boolValue( "indent_preproc_define",false); | 
|---|
| 4722 | mIndentCol1Comments = boolValue( "indent_col1_comments",false); | 
|---|
| 4723 | mMinConditionalIndent = intValue( "min_conditional_indent",1); | 
|---|
| 4724 | mMaxContinuationIndent = intValue( "max_continuation_indent",40); | 
|---|
| 4725 | mBreakBlocks = boolValue( "break_blocks",false); | 
|---|
| 4726 | mBreakBlocksAll = boolValue( "break_blocks_all",false); | 
|---|
| 4727 | mPadOper = boolValue( "pad_oper",true); | 
|---|
| 4728 | mPadComma = boolValue( "pad_comma",true); | 
|---|
| 4729 | mPadParen = boolValue( "pad_paren",false); | 
|---|
| 4730 | mPadParenOut = boolValue( "pad_paren_out",false); | 
|---|
| 4731 | mPadFirstParenOut = boolValue( "pad_first_paren_out",false); | 
|---|
| 4732 | mPadParenIn = boolValue( "pad_parent_in",false); | 
|---|
| 4733 | mPadHeader = boolValue( "pad_header",true); | 
|---|
| 4734 | mUnpadParen = boolValue( "unpad_paren",false); | 
|---|
| 4735 | mDeleteEmptyLines = boolValue( "delete_empty_lines",false); | 
|---|
| 4736 | mDeleteMultipleEmptyLines = boolValue( "delete_multiple_empty_lines",false); | 
|---|
| 4737 | mFillEmptyLines = boolValue( "fill_empty_lines",false); | 
|---|
| 4738 | mAlignPointerStyle = intValue( "align_pointer_style", FormatterOperatorAlign::foaNone); | 
|---|
| 4739 | mAlignReferenceStyle = intValue( "align_reference_style", FormatterOperatorAlign::foaNone); | 
|---|
| 4740 | mBreakClosingBraces = boolValue( "break_closing_braces",false); | 
|---|
| 4741 | mBreakElseIf = boolValue( "break_else_if",false); | 
|---|
| 4742 | mBreakOneLineHeaders = boolValue( "break_one_line_headers",false); | 
|---|
| 4743 | mAddBraces = boolValue( "add_braces",false); | 
|---|
| 4744 | mAddOneLineBraces = boolValue( "add_one_line_braces",false); | 
|---|
| 4745 | mRemoveBraces = boolValue( "remove_braces",false); | 
|---|
| 4746 | mBreakReturnType = boolValue( "break_return_type",false); | 
|---|
| 4747 | mBreakReturnTypeDecl = boolValue( "break_return_type_decl",false); | 
|---|
| 4748 | mAttachReturnType = boolValue( "attach_return_type",false); | 
|---|
| 4749 | mAttachReturnTypeDecl = boolValue( "attach_return_type_decl",false); | 
|---|
| 4750 | mKeepOneLineBlocks = boolValue( "keep_one_line_blocks",false); | 
|---|
| 4751 | mKeepOneLineStatements = boolValue( "keep_one_line_statements",false); | 
|---|
| 4752 | mConvertTabs = boolValue( "convert_tabs",false); | 
|---|
| 4753 | mCloseTemplates = boolValue( "close_templates",false); | 
|---|
| 4754 | mRemoveCommentPrefix = boolValue( "remove_comment_prefix",false); | 
|---|
| 4755 | mBreakMaxCodeLength = boolValue( "break_max_code_length",false); | 
|---|
| 4756 | mMaxCodeLength = intValue( "max_code_length",80); | 
|---|
| 4757 | mBreakAfterLogical = boolValue( "break_after_logical",false); | 
|---|
| 4758 | } | 
|---|
| 4759 |  | 
|---|
| 4760 | int Settings::CodeFormatter::braceStyle() const | 
|---|
| 4761 | { | 
|---|
| 4762 | return mBraceStyle; | 
|---|
| 4763 | } | 
|---|
| 4764 |  | 
|---|
| 4765 | void Settings::CodeFormatter::setBraceStyle(int newBraceStyle) | 
|---|
| 4766 | { | 
|---|
| 4767 | mBraceStyle = newBraceStyle; | 
|---|
| 4768 | } | 
|---|
| 4769 |  | 
|---|
| 4770 | Settings::UI::UI(Settings *settings):_Base(settings,SETTING_UI) | 
|---|
| 4771 | { | 
|---|
| 4772 |  | 
|---|
| 4773 | } | 
|---|
| 4774 |  | 
|---|
| 4775 | const QByteArray &Settings::UI::mainWindowGeometry() const | 
|---|
| 4776 | { | 
|---|
| 4777 | return mMainWindowGeometry; | 
|---|
| 4778 | } | 
|---|
| 4779 |  | 
|---|
| 4780 | void Settings::UI::setMainWindowGeometry(const QByteArray &newMainWindowGeometry) | 
|---|
| 4781 | { | 
|---|
| 4782 | mMainWindowGeometry = newMainWindowGeometry; | 
|---|
| 4783 | } | 
|---|
| 4784 |  | 
|---|
| 4785 | int Settings::UI::bottomPanelIndex() const | 
|---|
| 4786 | { | 
|---|
| 4787 | return mBottomPanelIndex; | 
|---|
| 4788 | } | 
|---|
| 4789 |  | 
|---|
| 4790 | void Settings::UI::setBottomPanelIndex(int newBottomPanelIndex) | 
|---|
| 4791 | { | 
|---|
| 4792 | mBottomPanelIndex = newBottomPanelIndex; | 
|---|
| 4793 | } | 
|---|
| 4794 |  | 
|---|
| 4795 | int Settings::UI::leftPanelIndex() const | 
|---|
| 4796 | { | 
|---|
| 4797 | return mLeftPanelIndex; | 
|---|
| 4798 | } | 
|---|
| 4799 |  | 
|---|
| 4800 | void Settings::UI::setLeftPanelIndex(int newLeftPanelIndex) | 
|---|
| 4801 | { | 
|---|
| 4802 | mLeftPanelIndex = newLeftPanelIndex; | 
|---|
| 4803 | } | 
|---|
| 4804 |  | 
|---|
| 4805 | bool Settings::UI::classBrowserShowInherited() const | 
|---|
| 4806 | { | 
|---|
| 4807 | return mClassBrowserShowInherited; | 
|---|
| 4808 | } | 
|---|
| 4809 |  | 
|---|
| 4810 | void Settings::UI::setClassBrowserShowInherited(bool newClassBrowserShowInherited) | 
|---|
| 4811 | { | 
|---|
| 4812 | mClassBrowserShowInherited = newClassBrowserShowInherited; | 
|---|
| 4813 | } | 
|---|
| 4814 |  | 
|---|
| 4815 | bool Settings::UI::showProblem() const | 
|---|
| 4816 | { | 
|---|
| 4817 | return mShowProblem; | 
|---|
| 4818 | } | 
|---|
| 4819 |  | 
|---|
| 4820 | void Settings::UI::setShowProblem(bool newShowProblem) | 
|---|
| 4821 | { | 
|---|
| 4822 | mShowProblem = newShowProblem; | 
|---|
| 4823 | } | 
|---|
| 4824 |  | 
|---|
| 4825 | int Settings::UI::settingsDialogSplitterPos() const | 
|---|
| 4826 | { | 
|---|
| 4827 | return mSettingsDialogSplitterPos; | 
|---|
| 4828 | } | 
|---|
| 4829 |  | 
|---|
| 4830 | void Settings::UI::setSettingsDialogSplitterPos(int newSettingsDialogSplitterPos) | 
|---|
| 4831 | { | 
|---|
| 4832 | mSettingsDialogSplitterPos = newSettingsDialogSplitterPos; | 
|---|
| 4833 | } | 
|---|
| 4834 |  | 
|---|
| 4835 | int Settings::UI::newProjectDialogWidth() const | 
|---|
| 4836 | { | 
|---|
| 4837 | return mNewProjectDialogWidth; | 
|---|
| 4838 | } | 
|---|
| 4839 |  | 
|---|
| 4840 | void Settings::UI::setNewProjectDialogWidth(int newNewProjectDialogWidth) | 
|---|
| 4841 | { | 
|---|
| 4842 | mNewProjectDialogWidth = newNewProjectDialogWidth; | 
|---|
| 4843 | } | 
|---|
| 4844 |  | 
|---|
| 4845 | int Settings::UI::newProjectDialogHeight() const | 
|---|
| 4846 | { | 
|---|
| 4847 | return mNewProjectDialogHeight; | 
|---|
| 4848 | } | 
|---|
| 4849 |  | 
|---|
| 4850 | void Settings::UI::setNewProjectDialogHeight(int newNewProjectDialogHeight) | 
|---|
| 4851 | { | 
|---|
| 4852 | mNewProjectDialogHeight = newNewProjectDialogHeight; | 
|---|
| 4853 | } | 
|---|
| 4854 |  | 
|---|
| 4855 | int Settings::UI::newClassDialogWidth() const | 
|---|
| 4856 | { | 
|---|
| 4857 | return mNewClassDialogWidth; | 
|---|
| 4858 | } | 
|---|
| 4859 |  | 
|---|
| 4860 | void Settings::UI::setNewClassDialogWidth(int newNewClassDialogWidth) | 
|---|
| 4861 | { | 
|---|
| 4862 | mNewClassDialogWidth = newNewClassDialogWidth; | 
|---|
| 4863 | } | 
|---|
| 4864 |  | 
|---|
| 4865 | int Settings::UI::newClassDialogHeight() const | 
|---|
| 4866 | { | 
|---|
| 4867 | return mNewClassDialogHeight; | 
|---|
| 4868 | } | 
|---|
| 4869 |  | 
|---|
| 4870 | void Settings::UI::setNewClassDialogHeight(int newNewClassDialogHeight) | 
|---|
| 4871 | { | 
|---|
| 4872 | mNewClassDialogHeight = newNewClassDialogHeight; | 
|---|
| 4873 | } | 
|---|
| 4874 |  | 
|---|
| 4875 | int  Settings::UI::() const | 
|---|
| 4876 | { | 
|---|
| 4877 | return mNewHeaderDialogHeight; | 
|---|
| 4878 | } | 
|---|
| 4879 |  | 
|---|
| 4880 | void  Settings::UI::(int newNewFileDialogHeight) | 
|---|
| 4881 | { | 
|---|
| 4882 | mNewHeaderDialogHeight = newNewFileDialogHeight; | 
|---|
| 4883 | } | 
|---|
| 4884 |  | 
|---|
| 4885 | const QSize &Settings::UI::messagesTabsSize() const | 
|---|
| 4886 | { | 
|---|
| 4887 | return mMessagesTabsSize; | 
|---|
| 4888 | } | 
|---|
| 4889 |  | 
|---|
| 4890 | void Settings::UI::setMessagesTabsSize(const QSize &newMessagesTabsSize) | 
|---|
| 4891 | { | 
|---|
| 4892 | mMessagesTabsSize = newMessagesTabsSize; | 
|---|
| 4893 | } | 
|---|
| 4894 |  | 
|---|
| 4895 | const QSize &Settings::UI::explorerTabsSize() const | 
|---|
| 4896 | { | 
|---|
| 4897 | return mExplorerTabsSize; | 
|---|
| 4898 | } | 
|---|
| 4899 |  | 
|---|
| 4900 | void Settings::UI::setExplorerTabsSize(const QSize &newExplorerTabsSize) | 
|---|
| 4901 | { | 
|---|
| 4902 | mExplorerTabsSize = newExplorerTabsSize; | 
|---|
| 4903 | } | 
|---|
| 4904 |  | 
|---|
| 4905 | bool Settings::UI::shrinkMessagesTabs() const | 
|---|
| 4906 | { | 
|---|
| 4907 | return mShrinkMessagesTabs; | 
|---|
| 4908 | } | 
|---|
| 4909 |  | 
|---|
| 4910 | void Settings::UI::setShrinkMessagesTabs(bool newShrinkMessagesTabs) | 
|---|
| 4911 | { | 
|---|
| 4912 | mShrinkMessagesTabs = newShrinkMessagesTabs; | 
|---|
| 4913 | } | 
|---|
| 4914 |  | 
|---|
| 4915 | bool Settings::UI::shrinkExplorerTabs() const | 
|---|
| 4916 | { | 
|---|
| 4917 | return mShrinkExplorerTabs; | 
|---|
| 4918 | } | 
|---|
| 4919 |  | 
|---|
| 4920 | void Settings::UI::setShrinkExplorerTabs(bool newShrinkExplorerTabs) | 
|---|
| 4921 | { | 
|---|
| 4922 | mShrinkExplorerTabs = newShrinkExplorerTabs; | 
|---|
| 4923 | } | 
|---|
| 4924 |  | 
|---|
| 4925 | int  Settings::UI::() const | 
|---|
| 4926 | { | 
|---|
| 4927 | return mNewHeaderDialogWidth; | 
|---|
| 4928 | } | 
|---|
| 4929 |  | 
|---|
| 4930 | void  Settings::UI::(int newNewFileDialogWidth) | 
|---|
| 4931 | { | 
|---|
| 4932 | mNewHeaderDialogWidth = newNewFileDialogWidth; | 
|---|
| 4933 | } | 
|---|
| 4934 |  | 
|---|
| 4935 | int Settings::UI::settingsDialogHeight() const | 
|---|
| 4936 | { | 
|---|
| 4937 | return mSettingsDialogHeight; | 
|---|
| 4938 | } | 
|---|
| 4939 |  | 
|---|
| 4940 | void Settings::UI::setSettingsDialogHeight(int newSettingsDialogHeight) | 
|---|
| 4941 | { | 
|---|
| 4942 | mSettingsDialogHeight = newSettingsDialogHeight; | 
|---|
| 4943 | } | 
|---|
| 4944 |  | 
|---|
| 4945 | int Settings::UI::settingsDialogWidth() const | 
|---|
| 4946 | { | 
|---|
| 4947 | return mSettingsDialogWidth; | 
|---|
| 4948 | } | 
|---|
| 4949 |  | 
|---|
| 4950 | void Settings::UI::setSettingsDialogWidth(int newSettingsDialogWidth) | 
|---|
| 4951 | { | 
|---|
| 4952 | mSettingsDialogWidth = newSettingsDialogWidth; | 
|---|
| 4953 | } | 
|---|
| 4954 |  | 
|---|
| 4955 | int Settings::UI::CPUDialogSplitterPos() const | 
|---|
| 4956 | { | 
|---|
| 4957 | return mCPUDialogSplitterPos; | 
|---|
| 4958 | } | 
|---|
| 4959 |  | 
|---|
| 4960 | void Settings::UI::setCPUDialogSplitterPos(int newCPUDialogSplitterPos) | 
|---|
| 4961 | { | 
|---|
| 4962 | mCPUDialogSplitterPos = newCPUDialogSplitterPos; | 
|---|
| 4963 | } | 
|---|
| 4964 |  | 
|---|
| 4965 | int Settings::UI::CPUDialogHeight() const | 
|---|
| 4966 | { | 
|---|
| 4967 | return mCPUDialogHeight; | 
|---|
| 4968 | } | 
|---|
| 4969 |  | 
|---|
| 4970 | void Settings::UI::setCPUDialogHeight(int newCPUDialogHeight) | 
|---|
| 4971 | { | 
|---|
| 4972 | mCPUDialogHeight = newCPUDialogHeight; | 
|---|
| 4973 | } | 
|---|
| 4974 |  | 
|---|
| 4975 | int Settings::UI::CPUDialogWidth() const | 
|---|
| 4976 | { | 
|---|
| 4977 | return mCPUDialogWidth; | 
|---|
| 4978 | } | 
|---|
| 4979 |  | 
|---|
| 4980 | void Settings::UI::setCPUDialogWidth(int newCPUDialogWidth) | 
|---|
| 4981 | { | 
|---|
| 4982 | mCPUDialogWidth = newCPUDialogWidth; | 
|---|
| 4983 | } | 
|---|
| 4984 |  | 
|---|
| 4985 | bool Settings::UI::showBookmark() const | 
|---|
| 4986 | { | 
|---|
| 4987 | return mShowBookmark; | 
|---|
| 4988 | } | 
|---|
| 4989 |  | 
|---|
| 4990 | void Settings::UI::setShowBookmark(bool newShowBookmark) | 
|---|
| 4991 | { | 
|---|
| 4992 | mShowBookmark = newShowBookmark; | 
|---|
| 4993 | } | 
|---|
| 4994 |  | 
|---|
| 4995 | bool Settings::UI::showTODO() const | 
|---|
| 4996 | { | 
|---|
| 4997 | return mShowTODO; | 
|---|
| 4998 | } | 
|---|
| 4999 |  | 
|---|
| 5000 | void Settings::UI::setShowTODO(bool newShowTODO) | 
|---|
| 5001 | { | 
|---|
| 5002 | mShowTODO = newShowTODO; | 
|---|
| 5003 | } | 
|---|
| 5004 |  | 
|---|
| 5005 | bool Settings::UI::showSearch() const | 
|---|
| 5006 | { | 
|---|
| 5007 | return mShowSearch; | 
|---|
| 5008 | } | 
|---|
| 5009 |  | 
|---|
| 5010 | void Settings::UI::setShowSearch(bool newShowSearch) | 
|---|
| 5011 | { | 
|---|
| 5012 | mShowSearch = newShowSearch; | 
|---|
| 5013 | } | 
|---|
| 5014 |  | 
|---|
| 5015 | bool Settings::UI::showDebug() const | 
|---|
| 5016 | { | 
|---|
| 5017 | return mShowDebug; | 
|---|
| 5018 | } | 
|---|
| 5019 |  | 
|---|
| 5020 | void Settings::UI::setShowDebug(bool newShowDebug) | 
|---|
| 5021 | { | 
|---|
| 5022 | mShowDebug = newShowDebug; | 
|---|
| 5023 | } | 
|---|
| 5024 |  | 
|---|
| 5025 | bool Settings::UI::showCompileLog() const | 
|---|
| 5026 | { | 
|---|
| 5027 | return mShowCompileLog; | 
|---|
| 5028 | } | 
|---|
| 5029 |  | 
|---|
| 5030 | void Settings::UI::setShowCompileLog(bool newShowCompileLog) | 
|---|
| 5031 | { | 
|---|
| 5032 | mShowCompileLog = newShowCompileLog; | 
|---|
| 5033 | } | 
|---|
| 5034 |  | 
|---|
| 5035 | bool Settings::UI::showIssues() const | 
|---|
| 5036 | { | 
|---|
| 5037 | return mShowIssues; | 
|---|
| 5038 | } | 
|---|
| 5039 |  | 
|---|
| 5040 | void Settings::UI::setShowIssues(bool newShowIssues) | 
|---|
| 5041 | { | 
|---|
| 5042 | mShowIssues = newShowIssues; | 
|---|
| 5043 | } | 
|---|
| 5044 |  | 
|---|
| 5045 | bool Settings::UI::showProblemSet() const | 
|---|
| 5046 | { | 
|---|
| 5047 | return mShowProblemSet; | 
|---|
| 5048 | } | 
|---|
| 5049 |  | 
|---|
| 5050 | void Settings::UI::setShowProblemSet(bool newShowProblemSet) | 
|---|
| 5051 | { | 
|---|
| 5052 | mShowProblemSet = newShowProblemSet; | 
|---|
| 5053 | } | 
|---|
| 5054 |  | 
|---|
| 5055 | bool Settings::UI::showFiles() const | 
|---|
| 5056 | { | 
|---|
| 5057 | return mShowFiles; | 
|---|
| 5058 | } | 
|---|
| 5059 |  | 
|---|
| 5060 | void Settings::UI::setShowFiles(bool newShowFiles) | 
|---|
| 5061 | { | 
|---|
| 5062 | mShowFiles = newShowFiles; | 
|---|
| 5063 | } | 
|---|
| 5064 |  | 
|---|
| 5065 | bool Settings::UI::showStructure() const | 
|---|
| 5066 | { | 
|---|
| 5067 | return mShowStructure; | 
|---|
| 5068 | } | 
|---|
| 5069 |  | 
|---|
| 5070 | void Settings::UI::setShowStructure(bool newShowStructure) | 
|---|
| 5071 | { | 
|---|
| 5072 | mShowStructure = newShowStructure; | 
|---|
| 5073 | } | 
|---|
| 5074 |  | 
|---|
| 5075 | bool Settings::UI::showWatch() const | 
|---|
| 5076 | { | 
|---|
| 5077 | return mShowWatch; | 
|---|
| 5078 | } | 
|---|
| 5079 |  | 
|---|
| 5080 | void Settings::UI::setShowWatch(bool newShowWatch) | 
|---|
| 5081 | { | 
|---|
| 5082 | mShowWatch = newShowWatch; | 
|---|
| 5083 | } | 
|---|
| 5084 |  | 
|---|
| 5085 | bool Settings::UI::showProject() const | 
|---|
| 5086 | { | 
|---|
| 5087 | return mShowProject; | 
|---|
| 5088 | } | 
|---|
| 5089 |  | 
|---|
| 5090 | void Settings::UI::setShowProject(bool newShowProject) | 
|---|
| 5091 | { | 
|---|
| 5092 | mShowProject = newShowProject; | 
|---|
| 5093 | } | 
|---|
| 5094 |  | 
|---|
| 5095 | bool Settings::UI::showToolWindowBars() const | 
|---|
| 5096 | { | 
|---|
| 5097 | return mShowToolWindowBars; | 
|---|
| 5098 | } | 
|---|
| 5099 |  | 
|---|
| 5100 | void Settings::UI::setShowToolWindowBars(bool newShowToolWindowBars) | 
|---|
| 5101 | { | 
|---|
| 5102 | mShowToolWindowBars = newShowToolWindowBars; | 
|---|
| 5103 | } | 
|---|
| 5104 |  | 
|---|
| 5105 | bool Settings::UI::showStatusBar() const | 
|---|
| 5106 | { | 
|---|
| 5107 | return mShowStatusBar; | 
|---|
| 5108 | } | 
|---|
| 5109 |  | 
|---|
| 5110 | void Settings::UI::setShowStatusBar(bool newShowStatusBar) | 
|---|
| 5111 | { | 
|---|
| 5112 | mShowStatusBar = newShowStatusBar; | 
|---|
| 5113 | } | 
|---|
| 5114 |  | 
|---|
| 5115 | bool Settings::UI::showToolbar() const | 
|---|
| 5116 | { | 
|---|
| 5117 | return mShowToolbar; | 
|---|
| 5118 | } | 
|---|
| 5119 |  | 
|---|
| 5120 | void Settings::UI::setShowToolbar(bool newShowToolbar) | 
|---|
| 5121 | { | 
|---|
| 5122 | mShowToolbar = newShowToolbar; | 
|---|
| 5123 | } | 
|---|
| 5124 |  | 
|---|
| 5125 | bool Settings::UI::classBrowserSortType() const | 
|---|
| 5126 | { | 
|---|
| 5127 | return mClassBrowserSortType; | 
|---|
| 5128 | } | 
|---|
| 5129 |  | 
|---|
| 5130 | void Settings::UI::setClassBrowserSortType(bool newClassBrowserSortType) | 
|---|
| 5131 | { | 
|---|
| 5132 | mClassBrowserSortType = newClassBrowserSortType; | 
|---|
| 5133 | } | 
|---|
| 5134 |  | 
|---|
| 5135 | bool Settings::UI::classBrowserSortAlpha() const | 
|---|
| 5136 | { | 
|---|
| 5137 | return mClassBrowserSortAlpha; | 
|---|
| 5138 | } | 
|---|
| 5139 |  | 
|---|
| 5140 | void Settings::UI::setClassBrowserSortAlpha(bool newClassBrowserSortAlpha) | 
|---|
| 5141 | { | 
|---|
| 5142 | mClassBrowserSortAlpha = newClassBrowserSortAlpha; | 
|---|
| 5143 | } | 
|---|
| 5144 |  | 
|---|
| 5145 | const QByteArray &Settings::UI::mainWindowState() const | 
|---|
| 5146 | { | 
|---|
| 5147 | return mMainWindowState; | 
|---|
| 5148 | } | 
|---|
| 5149 |  | 
|---|
| 5150 | void Settings::UI::setMainWindowState(const QByteArray &newMainWindowState) | 
|---|
| 5151 | { | 
|---|
| 5152 | mMainWindowState = newMainWindowState; | 
|---|
| 5153 | } | 
|---|
| 5154 |  | 
|---|
| 5155 | void Settings::UI::doSave() | 
|---|
| 5156 | { | 
|---|
| 5157 | saveValue( "main_window_state",mMainWindowState); | 
|---|
| 5158 | saveValue( "main_window_geometry",mMainWindowGeometry); | 
|---|
| 5159 | saveValue( "bottom_panel_index",mBottomPanelIndex); | 
|---|
| 5160 | saveValue( "left_panel_index",mLeftPanelIndex); | 
|---|
| 5161 | saveValue( "class_browser_sort_alphabetically",mClassBrowserSortAlpha); | 
|---|
| 5162 | saveValue( "class_browser_sort_by_type",mClassBrowserSortType); | 
|---|
| 5163 | saveValue( "class_browser_show_inherited",mClassBrowserShowInherited); | 
|---|
| 5164 |  | 
|---|
| 5165 | saveValue( "shrink_explorer_tabs",mShrinkExplorerTabs); | 
|---|
| 5166 | saveValue( "shrink_messages_tabs",mShrinkMessagesTabs); | 
|---|
| 5167 | saveValue( "explorer_tabs_size", mExplorerTabsSize); | 
|---|
| 5168 | saveValue( "messages_tabs_size",mMessagesTabsSize); | 
|---|
| 5169 |  | 
|---|
| 5170 | //view | 
|---|
| 5171 | saveValue( "show_toolbar", mShowToolbar); | 
|---|
| 5172 | saveValue( "show_statusbar", mShowStatusBar); | 
|---|
| 5173 | saveValue( "show_tool_windowbars", mShowToolWindowBars); | 
|---|
| 5174 |  | 
|---|
| 5175 | saveValue( "show_project", mShowProject); | 
|---|
| 5176 | saveValue( "show_watch", mShowWatch); | 
|---|
| 5177 | saveValue( "show_structure", mShowStructure); | 
|---|
| 5178 | saveValue( "show_file", mShowFiles); | 
|---|
| 5179 | saveValue( "show_problem_set", mShowProblemSet); | 
|---|
| 5180 |  | 
|---|
| 5181 | saveValue( "show_issues", mShowIssues); | 
|---|
| 5182 | saveValue( "show_compile_log", mShowCompileLog); | 
|---|
| 5183 | saveValue( "show_debug", mShowDebug); | 
|---|
| 5184 | saveValue( "show_search", mShowSearch); | 
|---|
| 5185 | saveValue( "show_todo", mShowTODO); | 
|---|
| 5186 | saveValue( "show_bookmark", mShowBookmark); | 
|---|
| 5187 | saveValue( "show_problem", mShowProblem); | 
|---|
| 5188 |  | 
|---|
| 5189 | //dialogs | 
|---|
| 5190 | saveValue( "cpu_dialog_width", mCPUDialogWidth); | 
|---|
| 5191 | saveValue( "cpu_dialog_height", mCPUDialogHeight); | 
|---|
| 5192 | saveValue( "cpu_dialog_splitter", mCPUDialogSplitterPos); | 
|---|
| 5193 | saveValue( "settings_dialog_width", mSettingsDialogWidth); | 
|---|
| 5194 | saveValue( "settings_dialog_height", mSettingsDialogHeight); | 
|---|
| 5195 | saveValue( "settings_dialog_splitter", mSettingsDialogSplitterPos); | 
|---|
| 5196 | saveValue( "new_project_dialog_width", mNewProjectDialogWidth); | 
|---|
| 5197 | saveValue( "new_project_dialog_height", mNewProjectDialogHeight); | 
|---|
| 5198 | saveValue( "new_class_dialog_width", mNewClassDialogWidth); | 
|---|
| 5199 | saveValue( "new_class_dialog_height", mNewClassDialogHeight); | 
|---|
| 5200 | saveValue( "new_header_dialog_width", mNewHeaderDialogWidth); | 
|---|
| 5201 | saveValue( "new_header_dialog_height", mNewHeaderDialogHeight); | 
|---|
| 5202 | } | 
|---|
| 5203 |  | 
|---|
| 5204 | void Settings::UI::doLoad() | 
|---|
| 5205 | { | 
|---|
| 5206 | mMainWindowState = value( "main_window_state",QByteArray()).toByteArray(); | 
|---|
| 5207 | mMainWindowGeometry = value( "main_window_geometry",QByteArray()).toByteArray(); | 
|---|
| 5208 | mBottomPanelIndex = intValue( "bottom_panel_index",0); | 
|---|
| 5209 | mLeftPanelIndex = intValue( "left_panel_index",0); | 
|---|
| 5210 | mClassBrowserSortAlpha = boolValue( "class_browser_sort_alphabetically",true); | 
|---|
| 5211 | mClassBrowserSortType = boolValue( "class_browser_sort_by_type",true); | 
|---|
| 5212 | mClassBrowserShowInherited = boolValue( "class_browser_show_inherited",true); | 
|---|
| 5213 |  | 
|---|
| 5214 | mShrinkExplorerTabs = boolValue( "shrink_explorer_tabs",false); | 
|---|
| 5215 | mShrinkMessagesTabs = boolValue( "shrink_messages_tabs",false); | 
|---|
| 5216 | mExplorerTabsSize = sizeValue( "explorer_tabs_size"); | 
|---|
| 5217 | mMessagesTabsSize = sizeValue( "messages_tabs_size"); | 
|---|
| 5218 |  | 
|---|
| 5219 | //view | 
|---|
| 5220 | mShowToolbar = boolValue( "show_toolbar",true); | 
|---|
| 5221 | mShowStatusBar = boolValue( "show_statusbar",true); | 
|---|
| 5222 | mShowToolWindowBars = boolValue( "show_tool_windowbars",true); | 
|---|
| 5223 |  | 
|---|
| 5224 | mShowProject = boolValue( "show_project",true); | 
|---|
| 5225 | mShowWatch = boolValue( "show_watch",true); | 
|---|
| 5226 | mShowStructure = boolValue( "show_structure",true); | 
|---|
| 5227 | mShowFiles = boolValue( "show_file",true); | 
|---|
| 5228 | mShowProblemSet = boolValue( "show_problem_set",true); | 
|---|
| 5229 |  | 
|---|
| 5230 | mShowIssues = boolValue( "show_issues",true); | 
|---|
| 5231 | mShowCompileLog = boolValue( "show_compile_log",true); | 
|---|
| 5232 | mShowDebug = boolValue( "show_debug",true); | 
|---|
| 5233 | mShowSearch = boolValue( "show_search",true); | 
|---|
| 5234 | mShowTODO = boolValue( "show_todo",true); | 
|---|
| 5235 | mShowBookmark = boolValue( "show_bookmark",true); | 
|---|
| 5236 | mShowProblem = boolValue( "show_problem",true); | 
|---|
| 5237 |  | 
|---|
| 5238 | //dialogs | 
|---|
| 5239 | mCPUDialogWidth = intValue( "cpu_dialog_width",977*qApp->desktop()->width()/1920); | 
|---|
| 5240 | mCPUDialogHeight = intValue( "cpu_dialog_height",622*qApp->desktop()->height()/1080); | 
|---|
| 5241 | mCPUDialogSplitterPos = intValue( "cpu_dialog_splitter",500*qApp->desktop()->width()/1920); | 
|---|
| 5242 | mSettingsDialogWidth = intValue( "settings_dialog_width",977*qApp->desktop()->width()/1920); | 
|---|
| 5243 | mSettingsDialogHeight = intValue( "settings_dialog_height",622*qApp->desktop()->height()/1080); | 
|---|
| 5244 | mSettingsDialogSplitterPos = intValue( "settings_dialog_splitter",300*qApp->desktop()->width()/1920); | 
|---|
| 5245 |  | 
|---|
| 5246 | mNewProjectDialogWidth = intValue( "new_project_dialog_width", 900*qApp->desktop()->width()/1920); | 
|---|
| 5247 | mNewProjectDialogHeight = intValue( "new_project_dialog_height", 600*qApp->desktop()->height()/1080); | 
|---|
| 5248 | mNewClassDialogWidth = intValue( "new_class_dialog_width", 642*qApp->desktop()->width()/1920); | 
|---|
| 5249 | mNewClassDialogHeight = intValue( "new_class_dialog_height", 300*qApp->desktop()->height()/1080); | 
|---|
| 5250 | mNewHeaderDialogWidth = intValue( "new_header_dialog_width", 642*qApp->desktop()->width()/1920); | 
|---|
| 5251 | mNewHeaderDialogHeight = intValue( "new_header_dialog_height", 300*qApp->desktop()->height()/1080); | 
|---|
| 5252 | } | 
|---|
| 5253 |  | 
|---|
| 5254 | Settings::VCS::VCS(Settings *settings):_Base(settings,SETTING_VCS), | 
|---|
| 5255 | mGitOk(false) | 
|---|
| 5256 | { | 
|---|
| 5257 | } | 
|---|
| 5258 |  | 
|---|
| 5259 | void Settings::VCS::doSave() | 
|---|
| 5260 | { | 
|---|
| 5261 | saveValue( "git_path",mGitPath); | 
|---|
| 5262 | } | 
|---|
| 5263 |  | 
|---|
| 5264 | void Settings::VCS::doLoad() | 
|---|
| 5265 | { | 
|---|
| 5266 | setGitPath(stringValue( "git_path", "")); | 
|---|
| 5267 | } | 
|---|
| 5268 |  | 
|---|
| 5269 | const QString &Settings::VCS::gitPath() const | 
|---|
| 5270 | { | 
|---|
| 5271 | return mGitPath; | 
|---|
| 5272 | } | 
|---|
| 5273 |  | 
|---|
| 5274 | void Settings::VCS::setGitPath(const QString &newGitPath) | 
|---|
| 5275 | { | 
|---|
| 5276 | if (mGitPath!=newGitPath) { | 
|---|
| 5277 | mGitPath = newGitPath; | 
|---|
| 5278 | validateGit(); | 
|---|
| 5279 | } | 
|---|
| 5280 | } | 
|---|
| 5281 |  | 
|---|
| 5282 | void Settings::VCS::validateGit() | 
|---|
| 5283 | { | 
|---|
| 5284 | mGitOk = false; | 
|---|
| 5285 | QFileInfo fileInfo(mGitPath); | 
|---|
| 5286 | if (!fileInfo.exists()) { | 
|---|
| 5287 | return; | 
|---|
| 5288 | } | 
|---|
| 5289 | mGitOk=true; | 
|---|
| 5290 | //    QStringList args; | 
|---|
| 5291 | //    args.append("--version"); | 
|---|
| 5292 | //    QString output = runAndGetOutput( | 
|---|
| 5293 | //                fileInfo.fileName(), | 
|---|
| 5294 | //                fileInfo.absolutePath(), | 
|---|
| 5295 | //                args); | 
|---|
| 5296 | //    mGitOk = output.startsWith("git version"); | 
|---|
| 5297 | } | 
|---|
| 5298 |  | 
|---|
| 5299 | bool Settings::VCS::gitOk() const | 
|---|
| 5300 | { | 
|---|
| 5301 | return mGitOk; | 
|---|
| 5302 | } | 
|---|
| 5303 |  | 
|---|
| 5304 | void Settings::VCS::detectGitInPath() | 
|---|
| 5305 | { | 
|---|
| 5306 | QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); | 
|---|
| 5307 | QString path = env.value( "PATH"); | 
|---|
| 5308 | QStringList pathList = path.split(PATH_SEPARATOR); | 
|---|
| 5309 | QSet<QString> searched; | 
|---|
| 5310 | foreach (const QString& s, pathList){ | 
|---|
| 5311 | if (searched.contains(s)) | 
|---|
| 5312 | continue;; | 
|---|
| 5313 | searched.insert(s); | 
|---|
| 5314 | QDir dir(s); | 
|---|
| 5315 | if (dir.exists(GIT_PROGRAM)) { | 
|---|
| 5316 | QString oldPath = mGitPath; | 
|---|
| 5317 | setGitPath(dir.filePath(GIT_PROGRAM)); | 
|---|
| 5318 | validateGit(); | 
|---|
| 5319 | if (mGitOk) { | 
|---|
| 5320 | save(); | 
|---|
| 5321 | return; | 
|---|
| 5322 | } else { | 
|---|
| 5323 | mGitPath = oldPath; | 
|---|
| 5324 | } | 
|---|
| 5325 | } | 
|---|
| 5326 |  | 
|---|
| 5327 | } | 
|---|
| 5328 | } | 
|---|
| 5329 |  | 
|---|