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 | #ifndef SETTINGS_H |
18 | #define SETTINGS_H |
19 | |
20 | #include <QSettings> |
21 | #include <vector> |
22 | #include <memory> |
23 | #include <QColor> |
24 | #include <QString> |
25 | #include <QPair> |
26 | #include "qsynedit/SynEdit.h" |
27 | #include "compiler/compilerinfo.h" |
28 | #include "utils.h" |
29 | |
30 | /** |
31 | * use the following command to get gcc's default bin/library folders: |
32 | * gcc -print-search-dirs |
33 | */ |
34 | |
35 | #define SETTING_DIRS "Dirs" |
36 | #define SETTING_EDITOR "Editor" |
37 | #define SETTING_ENVIRONMENT "Environment" |
38 | #define SETTING_EXECUTOR "Executor" |
39 | #define SETTING_DEBUGGER "Debugger" |
40 | #define SETTING_HISTORY "History" |
41 | #define SETTING_UI "UI" |
42 | #define SETTING_VCS "VCS" |
43 | #define SETTING_CODE_COMPLETION "CodeCompletion" |
44 | #define SETTING_CODE_FORMATTER "CodeFormatter" |
45 | #define SETTING_COMPILTER_SETS "CompilerSets" |
46 | #define SETTING_COMPILTER_SETS_DEFAULT_INDEX "defaultIndex" |
47 | #define SETTING_COMPILTER_SETS_COUNT "count" |
48 | #define SETTING_COMPILTER_SET "CompilerSet_%1" |
49 | #define SETTING_EDITOR_DEFAULT_ENCODING "default_encoding" |
50 | #define SETTING_EDITOR_AUTO_INDENT "default_auto_indent" |
51 | |
52 | extern const char ValueToChar[28]; |
53 | |
54 | class Settings; |
55 | |
56 | enum CompilerSetType { |
57 | CST_RELEASE, |
58 | CST_DEBUG, |
59 | CST_PROFILING |
60 | }; |
61 | |
62 | class Settings |
63 | { |
64 | private: |
65 | |
66 | class _Base { |
67 | public: |
68 | explicit _Base(Settings* settings, const QString& groupName); |
69 | void beginGroup(); |
70 | void endGroup(); |
71 | void remove(const QString &key); |
72 | void saveValue(const QString &key, const QVariant &value); |
73 | QVariant value(const QString &key, const QVariant& defaultValue); |
74 | bool boolValue(const QString &key, bool defaultValue); |
75 | QSize sizeValue(const QString &key); |
76 | int intValue(const QString &key, int defaultValue); |
77 | QStringList stringListValue(const QString &key, const QStringList& defaultValue=QStringList()); |
78 | QColor colorValue(const QString &key, const QColor& defaultValue); |
79 | QString stringValue(const QString &key, const QString& defaultValue); |
80 | void save(); |
81 | void load(); |
82 | protected: |
83 | virtual void doSave() = 0; |
84 | virtual void doLoad() = 0; |
85 | protected: |
86 | Settings* mSettings; |
87 | QString mGroup; |
88 | }; |
89 | |
90 | public: |
91 | class Dirs: public _Base { |
92 | public: |
93 | enum class DataType { |
94 | None, |
95 | ColorScheme, |
96 | IconSet, |
97 | Theme, |
98 | Template |
99 | }; |
100 | explicit Dirs(Settings * settings); |
101 | QString appDir() const; |
102 | QString appResourceDir() const; |
103 | QString appLibexecDir() const; |
104 | QString projectDir() const; |
105 | QString data(DataType dataType = DataType::None) const; |
106 | QString config(DataType dataType = DataType::None) const; |
107 | QString executable() const; |
108 | |
109 | void setProjectDir(const QString &newProjectDir); |
110 | |
111 | protected: |
112 | void doSave() override; |
113 | void doLoad() override; |
114 | private: |
115 | QString mProjectDir; |
116 | }; |
117 | |
118 | class Editor: public _Base { |
119 | public: |
120 | explicit Editor(Settings * settings); |
121 | QByteArray defaultEncoding(); |
122 | void setDefaultEncoding(const QByteArray& value); |
123 | bool autoIndent(); |
124 | void setAutoIndent(bool value); |
125 | bool addIndent() const; |
126 | void setAddIndent(bool addIndent); |
127 | |
128 | bool tabToSpaces() const; |
129 | void setTabToSpaces(bool tabToSpaces); |
130 | |
131 | int tabWidth() const; |
132 | void setTabWidth(int tabWidth); |
133 | |
134 | bool showIndentLines() const; |
135 | void setShowIndentLines(bool showIndentLines); |
136 | |
137 | QColor indentLineColor() const; |
138 | void setIndentLineColor(const QColor &indentLineColor); |
139 | |
140 | bool enhanceHomeKey() const; |
141 | void setEnhanceHomeKey(bool enhanceHomeKey); |
142 | |
143 | bool enhanceEndKey() const; |
144 | void setEnhanceEndKey(bool enhanceEndKey); |
145 | |
146 | QSynedit::EditCaretType caretForInsert() const; |
147 | void setCaretForInsert(const QSynedit::EditCaretType &caretForInsert); |
148 | |
149 | QSynedit::EditCaretType caretForOverwrite() const; |
150 | void setCaretForOverwrite(const QSynedit::EditCaretType &caretForOverwrite); |
151 | |
152 | QColor caretColor() const; |
153 | void setCaretColor(const QColor &caretColor); |
154 | |
155 | bool keepCaretX() const; |
156 | void setKeepCaretX(bool keepCaretX); |
157 | |
158 | bool autoHideScrollbar() const; |
159 | void setAutoHideScrollbar(bool autoHideScrollbar); |
160 | |
161 | bool scrollPastEof() const; |
162 | void setScrollPastEof(bool scrollPastEof); |
163 | |
164 | bool scrollPastEol() const; |
165 | void setScrollPastEol(bool scrollPastEol); |
166 | |
167 | bool scrollByOneLess() const; |
168 | void setScrollByOneLess(bool scrollByOneLess); |
169 | |
170 | bool halfPageScroll() const; |
171 | void setHalfPageScroll(bool halfPageScroll); |
172 | |
173 | QString fontName() const; |
174 | void setFontName(const QString &fontName); |
175 | |
176 | int fontSize() const; |
177 | void setFontSize(int fontSize); |
178 | |
179 | bool fontOnlyMonospaced() const; |
180 | void setFontOnlyMonospaced(bool fontOnlyMonospaced); |
181 | |
182 | bool gutterVisible() const; |
183 | void setGutterVisible(bool gutterVisible); |
184 | |
185 | bool gutterAutoSize() const; |
186 | void setGutterAutoSize(bool gutterAutoSize); |
187 | |
188 | int gutterDigitsCount() const; |
189 | void setGutterDigitsCount(int gutterDigitsCount); |
190 | |
191 | bool gutterShowLineNumbers() const; |
192 | void setGutterShowLineNumbers(bool gutterShowLineNumbers); |
193 | |
194 | bool gutterAddLeadingZero() const; |
195 | void setGutterAddLeadingZero(bool gutterAddLeadingZero); |
196 | |
197 | bool () const; |
198 | void (bool ); |
199 | |
200 | bool gutterUseCustomFont() const; |
201 | void setGutterUseCustomFont(bool gutterUseCustomFont); |
202 | |
203 | QString gutterFontName() const; |
204 | void setGutterFontName(const QString &gutterFontName); |
205 | |
206 | int gutterFontSize() const; |
207 | void setGutterFontSize(int gutterFontSize); |
208 | |
209 | bool gutterFontOnlyMonospaced() const; |
210 | void setGutterFontOnlyMonospaced(bool gutterFontOnlyMonospaced); |
211 | |
212 | int gutterLeftOffset() const; |
213 | void setGutterLeftOffset(int gutterLeftOffset); |
214 | |
215 | int gutterRightOffset() const; |
216 | void setGutterRightOffset(int gutterRightOffset); |
217 | |
218 | bool copySizeLimit() const; |
219 | void setCopySizeLimit(bool copyLimit); |
220 | |
221 | int copyCharLimits() const; |
222 | void setCopyCharLimits(int copyCharLimits); |
223 | |
224 | int copyLineLimits() const; |
225 | void setCopyLineLimits(int copyLineLimits); |
226 | |
227 | bool copyRTFUseBackground() const; |
228 | void setCopyRTFUseBackground(bool copyRTFUseBackground); |
229 | |
230 | bool copyRTFUseEditorColor() const; |
231 | void setCopyRTFUseEditorColor(bool copyRTFUseEditorColor); |
232 | |
233 | QString copyRTFColorScheme() const; |
234 | void setCopyRTFColorScheme(const QString ©RTFColorScheme); |
235 | |
236 | bool copyHTMLUseBackground() const; |
237 | void setCopyHTMLUseBackground(bool copyHTMLUseBackground); |
238 | |
239 | bool copyHTMLUseEditorColor() const; |
240 | void setCopyHTMLUseEditorColor(bool copyHTMLUseEditorColor); |
241 | |
242 | QString copyHTMLColorScheme() const; |
243 | void setCopyHTMLColorScheme(const QString ©HTMLColorScheme); |
244 | |
245 | int copyWithFormatAs() const; |
246 | void setCopyWithFormatAs(int copyWithFormatAs); |
247 | |
248 | QString colorScheme() const; |
249 | void setColorScheme(const QString &colorScheme); |
250 | |
251 | bool completeSymbols() const; |
252 | void setCompleteSymbols(bool completeSymbols); |
253 | |
254 | bool completeParenthese() const; |
255 | void setCompleteParenthese(bool completeParenthese); |
256 | |
257 | bool completeBracket() const; |
258 | void setCompleteBracket(bool completeBracket); |
259 | |
260 | bool completeBrace() const; |
261 | void setCompleteBrace(bool completeBrace); |
262 | |
263 | bool () const; |
264 | void (bool ); |
265 | |
266 | bool completeSingleQuote() const; |
267 | void setCompleteSingleQuote(bool completeSingleQuote); |
268 | |
269 | bool completeDoubleQuote() const; |
270 | void setCompleteDoubleQuote(bool completeDoubleQuote); |
271 | |
272 | bool completeGlobalInclude() const; |
273 | void setCompleteGlobalInclude(bool completeGlobalInclude); |
274 | |
275 | bool overwriteSymbols() const; |
276 | void setOverwriteSymbols(bool overwriteSymbols); |
277 | |
278 | bool removeSymbolPairs() const; |
279 | void setRemoveSymbolPairs(bool value); |
280 | |
281 | bool syntaxCheck() const; |
282 | void setSyntaxCheck(bool syntaxCheck); |
283 | |
284 | bool syntaxCheckWhenSave() const; |
285 | void setSyntaxCheckWhenSave(bool syntaxCheckWhenSave); |
286 | |
287 | bool syntaxCheckWhenLineChanged() const; |
288 | void setSyntaxCheckWhenLineChanged(bool syntaxCheckWhenLineChanged); |
289 | |
290 | bool () const; |
291 | void (bool ); |
292 | |
293 | bool autoLoadLastFiles() const; |
294 | void setAutoLoadLastFiles(bool newAutoLoadLastFiles); |
295 | |
296 | bool defaultFileCpp() const; |
297 | void setDefaultFileCpp(bool newDefaultFileCpp); |
298 | |
299 | bool enableAutoSave() const; |
300 | void setEnableAutoSave(bool newEnableAutoSave); |
301 | |
302 | int autoSaveInterval() const; |
303 | void setAutoSaveInterval(int newInterval); |
304 | |
305 | AutoSaveTarget autoSaveTarget() const; |
306 | void setAutoSaveTarget(AutoSaveTarget newAutoSaveTarget); |
307 | |
308 | AutoSaveStrategy autoSaveStrategy() const; |
309 | void setAutoSaveStrategy(AutoSaveStrategy newAutoSaveStrategy); |
310 | |
311 | bool enableAutolink() const; |
312 | void setEnableAutolink(bool newEnableAutolink); |
313 | |
314 | bool showRightEdgeLine() const; |
315 | void setShowRightEdgeLine(bool newShowRightMarginLine); |
316 | |
317 | int rightEdgeWidth() const; |
318 | void setRightEdgeWidth(int newRightMarginWidth); |
319 | |
320 | const QColor &rightEdgeLineColor() const; |
321 | void setRightEdgeLineColor(const QColor &newRightMarginLineColor); |
322 | |
323 | bool caretUseTextColor() const; |
324 | void setCaretUseTextColor(bool newUseIdentifierColor); |
325 | |
326 | bool rainbowParenthesis() const; |
327 | void setRainbowParenthesis(bool newRainbowParenthesis); |
328 | |
329 | bool enableTooltips() const; |
330 | void setEnableTooltips(bool newEnableTooltips); |
331 | bool enableDebugTooltips() const; |
332 | void setEnableDebugTooltips(bool newEnableDebugTooltips); |
333 | bool enableIdentifierToolTips() const; |
334 | void setEnableIdentifierToolTips(bool newEnableIdentifierToolTips); |
335 | bool () const; |
336 | void (bool ); |
337 | bool enableIssueToolTips() const; |
338 | void setEnableIssueToolTips(bool newEnableIssueToolTips); |
339 | |
340 | bool showFunctionTips() const; |
341 | void setShowFunctionTips(bool newShowFunctionTips); |
342 | |
343 | bool fillIndents() const; |
344 | void setFillIndents(bool newFillIndents); |
345 | |
346 | int mouseWheelScrollSpeed() const; |
347 | void setMouseWheelScrollSpeed(int newMouseWheelScrollSpeed); |
348 | |
349 | bool highlightCurrentWord() const; |
350 | void setHighlightCurrentWord(bool newHighlightCurrentWord); |
351 | |
352 | bool highlightMathingBraces() const; |
353 | void setHighlightMathingBraces(bool newHighlightMathingBraces); |
354 | |
355 | bool enableLigaturesSupport() const; |
356 | void setEnableLigaturesSupport(bool newEnableLigaturesSupport); |
357 | |
358 | const QString &nonAsciiFontName() const; |
359 | void setNonAsciiFontName(const QString &newNonAsciiFontName); |
360 | |
361 | int mouseSelectionScrollSpeed() const; |
362 | void setMouseSelectionScrollSpeed(int newMouseSelectionScrollSpeed); |
363 | |
364 | bool autoDetectFileEncoding() const; |
365 | void setAutoDetectFileEncoding(bool newAutoDetectFileEncoding); |
366 | |
367 | int undoLimit() const; |
368 | void setUndoLimit(int newUndoLimit); |
369 | |
370 | private: |
371 | //General |
372 | // indents |
373 | bool mAutoIndent; |
374 | bool mTabToSpaces; |
375 | int mTabWidth; |
376 | bool mShowIndentLines; |
377 | QColor mIndentLineColor; |
378 | bool mfillIndents; |
379 | // caret |
380 | bool mEnhanceHomeKey; |
381 | bool mEnhanceEndKey; |
382 | bool mKeepCaretX; |
383 | QSynedit::EditCaretType mCaretForInsert; |
384 | QSynedit::EditCaretType mCaretForOverwrite; |
385 | bool mCaretUseTextColor; |
386 | QColor mCaretColor; |
387 | |
388 | //highlights |
389 | bool mHighlightCurrentWord; |
390 | bool mHighlightMathingBraces; |
391 | |
392 | //scroll |
393 | bool mAutoHideScrollbar; |
394 | bool mScrollPastEof; |
395 | bool mScrollPastEol; |
396 | bool mScrollByOneLess; |
397 | bool mHalfPageScroll; |
398 | int mMouseWheelScrollSpeed; |
399 | int mMouseSelectionScrollSpeed; |
400 | |
401 | //right margin |
402 | bool mShowRightEdgeLine; |
403 | int mRightEdgeWidth; |
404 | QColor mRightEdgeLineColor; |
405 | bool mEnableLigaturesSupport; |
406 | |
407 | //Font |
408 | //font |
409 | QString mFontName; |
410 | QString mNonAsciiFontName; |
411 | int mFontSize; |
412 | bool mFontOnlyMonospaced; |
413 | |
414 | //gutter |
415 | bool mGutterVisible; |
416 | bool mGutterAutoSize; |
417 | int mGutterLeftOffset; |
418 | int mGutterRightOffset; |
419 | int mGutterDigitsCount; |
420 | bool mGutterShowLineNumbers; |
421 | bool mGutterAddLeadingZero; |
422 | bool ; |
423 | bool mGutterUseCustomFont; |
424 | QString mGutterFontName; |
425 | int mGutterFontSize; |
426 | bool mGutterFontOnlyMonospaced; |
427 | |
428 | //copy |
429 | bool mCopySizeLimit; |
430 | int mCopyCharLimits; |
431 | int mCopyLineLimits; |
432 | int mCopyWithFormatAs; |
433 | bool mCopyRTFUseBackground; |
434 | bool mCopyRTFUseEditorColor; |
435 | QString mCopyRTFColorScheme; |
436 | bool mCopyHTMLUseBackground; |
437 | bool mCopyHTMLUseEditorColor; |
438 | QString mCopyHTMLColorScheme; |
439 | |
440 | //Color |
441 | QString mColorScheme; |
442 | bool mRainbowParenthesis; |
443 | |
444 | //Symbol Completion |
445 | bool mCompleteSymbols; |
446 | bool mCompleteParenthese; |
447 | bool mCompleteBracket; |
448 | bool mCompleteBrace; |
449 | bool ; |
450 | bool mCompleteSingleQuote; |
451 | bool mCompleteDoubleQuote; |
452 | bool mCompleteGlobalInclude; |
453 | bool mOverwriteSymbols; |
454 | bool mRemoveSymbolPairs; |
455 | |
456 | //Auto Syntax Check |
457 | bool mSyntaxCheck; |
458 | bool mSyntaxCheckWhenSave; |
459 | bool mSyntaxCheckWhenLineChanged; |
460 | |
461 | //auto save |
462 | bool mEnableAutoSave; |
463 | int mAutoSaveInterval; |
464 | enum AutoSaveTarget mAutoSaveTarget; |
465 | enum AutoSaveStrategy mAutoSaveStrategy; |
466 | |
467 | //auto link |
468 | bool mEnableAutolink; |
469 | |
470 | //Misc |
471 | QByteArray mDefaultEncoding; |
472 | bool mAutoDetectFileEncoding; |
473 | bool ; |
474 | bool mAutoLoadLastFiles; |
475 | bool mDefaultFileCpp; |
476 | int mUndoLimit; |
477 | |
478 | |
479 | //hints tooltip |
480 | bool mEnableTooltips; |
481 | bool mEnableDebugTooltips; |
482 | bool mEnableIdentifierToolTips; |
483 | bool ; |
484 | bool mEnableIssueToolTips; |
485 | bool mShowFunctionTips; |
486 | |
487 | // _Base interface |
488 | protected: |
489 | void doSave() override; |
490 | void doLoad() override; |
491 | }; |
492 | |
493 | class Environment: public _Base { |
494 | public: |
495 | explicit Environment(Settings * settings); |
496 | QString theme() const; |
497 | void setTheme(const QString &theme); |
498 | |
499 | QString interfaceFont() const; |
500 | void setInterfaceFont(const QString &interfaceFont); |
501 | |
502 | int interfaceFontSize() const; |
503 | void setInterfaceFontSize(int interfaceFontSize); |
504 | |
505 | QString language() const; |
506 | void setLanguage(const QString &language); |
507 | |
508 | const QString ¤tFolder() const; |
509 | void setCurrentFolder(const QString &newCurrentFolder); |
510 | |
511 | const QString &defaultOpenFolder() const; |
512 | void setDefaultOpenFolder(const QString &newDefaultOpenFolder); |
513 | |
514 | const QString &iconSet() const; |
515 | void setIconSet(const QString &newIconSet); |
516 | |
517 | QString terminalPath() const; |
518 | void setTerminalPath(const QString &terminalPath); |
519 | |
520 | QString AStylePath() const; |
521 | void setAStylePath(const QString &aStylePath); |
522 | |
523 | bool useCustomIconSet() const; |
524 | void setUseCustomIconSet(bool newUseCustomIconSet); |
525 | |
526 | bool useCustomTheme() const; |
527 | void setUseCustomTheme(bool newUseCustomTheme); |
528 | |
529 | bool hideNonSupportFilesInFileView() const; |
530 | void setHideNonSupportFilesInFileView(bool newHideNonSupportFilesInFileView); |
531 | |
532 | bool openFilesInSingleInstance() const; |
533 | void setOpenFilesInSingleInstance(bool newOpenFilesInSingleInstance); |
534 | |
535 | private: |
536 | |
537 | //Appearence |
538 | QString mTheme; |
539 | QString mInterfaceFont; |
540 | int mInterfaceFontSize; |
541 | QString mLanguage; |
542 | QString mCurrentFolder; |
543 | QString mIconSet; |
544 | bool mUseCustomIconSet; |
545 | bool mUseCustomTheme; |
546 | |
547 | QString mDefaultOpenFolder; |
548 | QString mTerminalPath; |
549 | QString mAStylePath; |
550 | bool mHideNonSupportFilesInFileView; |
551 | bool mOpenFilesInSingleInstance; |
552 | // _Base interface |
553 | protected: |
554 | void doSave() override; |
555 | void doLoad() override; |
556 | }; |
557 | |
558 | class CodeCompletion: public _Base { |
559 | public: |
560 | explicit CodeCompletion(Settings *settings); |
561 | int width() const; |
562 | void setWidth(int newWidth); |
563 | |
564 | int height() const; |
565 | void setHeight(int newHeight); |
566 | |
567 | bool enabled() const; |
568 | void setEnabled(bool newEnabled); |
569 | |
570 | bool () const; |
571 | void (bool ); |
572 | |
573 | bool () const; |
574 | void (bool ); |
575 | |
576 | bool showCompletionWhileInput() const; |
577 | void setShowCompletionWhileInput(bool newShowCompletionWhileInput); |
578 | |
579 | bool recordUsage() const; |
580 | void setRecordUsage(bool newRecordUsage); |
581 | |
582 | bool sortByScope() const; |
583 | void setSortByScope(bool newSortByScope); |
584 | |
585 | bool showKeywords() const; |
586 | void setShowKeywords(bool newShowKeywords); |
587 | |
588 | bool ignoreCase() const; |
589 | void setIgnoreCase(bool newIgnoreCase); |
590 | |
591 | bool appendFunc() const; |
592 | void setAppendFunc(bool newAppendFunc); |
593 | |
594 | bool showCodeIns() const; |
595 | void setShowCodeIns(bool newShowCodeIns); |
596 | |
597 | bool clearWhenEditorHidden() const; |
598 | void setClearWhenEditorHidden(bool newClearWhenEditorHidden); |
599 | |
600 | int minCharRequired() const; |
601 | void setMinCharRequired(int newMinCharRequired); |
602 | |
603 | bool hideSymbolsStartsWithUnderLine() const; |
604 | void setHideSymbolsStartsWithUnderLine(bool newHideSymbolsStartsWithOneUnderLine); |
605 | |
606 | bool hideSymbolsStartsWithTwoUnderLine() const; |
607 | void setHideSymbolsStartsWithTwoUnderLine(bool newHideSymbolsStartsWithTwoUnderLine); |
608 | |
609 | private: |
610 | int mWidth; |
611 | int mHeight; |
612 | bool mEnabled; |
613 | bool ; |
614 | bool ; |
615 | bool mShowCompletionWhileInput; |
616 | bool mRecordUsage; |
617 | bool mSortByScope; |
618 | bool mShowKeywords; |
619 | bool mIgnoreCase; |
620 | bool mAppendFunc; |
621 | bool mShowCodeIns; |
622 | bool mClearWhenEditorHidden; |
623 | int mMinCharRequired; |
624 | bool mHideSymbolsStartsWithTwoUnderLine; |
625 | bool mHideSymbolsStartsWithUnderLine; |
626 | |
627 | // _Base interface |
628 | protected: |
629 | void doSave() override; |
630 | void doLoad() override; |
631 | |
632 | }; |
633 | |
634 | class CodeFormatter: public _Base { |
635 | public: |
636 | explicit CodeFormatter(Settings* settings); |
637 | QStringList getArguments(); |
638 | int braceStyle() const; |
639 | void setBraceStyle(int newBraceStyle); |
640 | |
641 | int indentStyle() const; |
642 | void setIndentStyle(int newIndentStyle); |
643 | int tabWidth() const; |
644 | void setTabWidth(int newTabWidth); |
645 | bool attachNamespaces() const; |
646 | void setAttachNamespaces(bool newAttachNamespaces); |
647 | bool attachClasses() const; |
648 | void setAttachClasses(bool newAttachClasses); |
649 | bool attachInlines() const; |
650 | void setAttachInlines(bool newAttachInlines); |
651 | bool attachExternC() const; |
652 | void setAttachExternC(bool newAttachExternC); |
653 | bool attachClosingWhile() const; |
654 | void setAttachClosingWhile(bool newAttachClosingWhile); |
655 | bool indentClasses() const; |
656 | void setIndentClasses(bool newIndentClasses); |
657 | bool indentModifiers() const; |
658 | void setIndentModifiers(bool newIndentModifiers); |
659 | bool indentCases() const; |
660 | void setIndentCases(bool newIndentCases); |
661 | bool indentNamespaces() const; |
662 | void setIndentNamespaces(bool newIndentNamespaces); |
663 | int indentContinuation() const; |
664 | void setIndentContinuation(int newIndentContinuation); |
665 | bool indentLabels() const; |
666 | void setIndentLabels(bool newIndentLabels); |
667 | bool indentPreprocBlock() const; |
668 | void setIndentPreprocBlock(bool newIndentPreprocBlock); |
669 | bool indentPreprocCond() const; |
670 | void setIndentPreprocCond(bool newIndentPreprocCond); |
671 | bool indentPreprocDefine() const; |
672 | void setIndentPreprocDefine(bool newIndentPreprocDefine); |
673 | bool () const; |
674 | void (bool ); |
675 | int minConditionalIndent() const; |
676 | void setMinConditionalIndent(int newMinConditionalIndent); |
677 | int maxContinuationIndent() const; |
678 | void setMaxContinuationIndent(int newMaxContinuationIndent); |
679 | bool breakBlocks() const; |
680 | void setBreakBlocks(bool newBreakBlocks); |
681 | bool breakBlocksAll() const; |
682 | void setBreakBlocksAll(bool newBreakBlocksAll); |
683 | bool padOper() const; |
684 | void setPadOper(bool newPadOper); |
685 | bool padComma() const; |
686 | void setPadComma(bool newPadComma); |
687 | bool padParen() const; |
688 | void setPadParen(bool newPadParen); |
689 | bool padParenOut() const; |
690 | void setPadParenOut(bool newPadParenOut); |
691 | bool padFirstParenOut() const; |
692 | void setPadFirstParenOut(bool newPadFirstParenOut); |
693 | bool padParenIn() const; |
694 | void setPadParenIn(bool newPadParenIn); |
695 | bool () const; |
696 | void (bool ); |
697 | bool unpadParen() const; |
698 | void setUnpadParen(bool newUnpadParen); |
699 | bool deleteEmptyLines() const; |
700 | void setDeleteEmptyLines(bool newDeleteEmptyLines); |
701 | bool deleteMultipleEmptyLines() const; |
702 | void setDeleteMultipleEmptyLines(bool newDeleteMultipleEmptyLines); |
703 | bool fillEmptyLines() const; |
704 | void setFillEmptyLines(bool newFillEmptyLines); |
705 | int alignPointerStyle() const; |
706 | void setAlignPointerStyle(int newAlignPointerStyle); |
707 | int alignReferenceStyle() const; |
708 | void setAlignReferenceStyle(int newAlignReferenceStyle); |
709 | bool breakClosingBraces() const; |
710 | void setBreakClosingBraces(bool newBreakClosingBraces); |
711 | bool breakElseIf() const; |
712 | void setBreakElseIf(bool newBreakElseIf); |
713 | bool () const; |
714 | void (bool ); |
715 | bool addBraces() const; |
716 | void setAddBraces(bool newAddBraces); |
717 | bool addOneLineBraces() const; |
718 | void setAddOneLineBraces(bool newAddOneLineBraces); |
719 | bool removeBraces() const; |
720 | void setRemoveBraces(bool newRemoveBraces); |
721 | bool breakReturnTypeDecl() const; |
722 | void setBreakReturnTypeDecl(bool newBreakReturnTypeDecl); |
723 | bool attachReturnType() const; |
724 | void setAttachReturnType(bool newAttachReturnType); |
725 | bool attachReturnTypeDecl() const; |
726 | void setAttachReturnTypeDecl(bool newAttachReturnTypeDecl); |
727 | bool keepOneLineBlocks() const; |
728 | void setKeepOneLineBlocks(bool newKeepOneLineBlocks); |
729 | bool keepOneLineStatements() const; |
730 | void setKeepOneLineStatements(bool newKeepOneLineStatements); |
731 | bool convertTabs() const; |
732 | void setConvertTabs(bool newConvertTabs); |
733 | bool closeTemplates() const; |
734 | void setCloseTemplates(bool newCloseTemplates); |
735 | bool () const; |
736 | void (bool ); |
737 | int maxCodeLength() const; |
738 | void setMaxCodeLength(int newMaxCodeLength); |
739 | bool breakAfterLogical() const; |
740 | void setBreakAfterLogical(bool newBreakAfterLogical); |
741 | |
742 | bool breakReturnType() const; |
743 | void setBreakReturnType(bool newBreakReturnType); |
744 | |
745 | bool breakMaxCodeLength() const; |
746 | void setBreakMaxCodeLength(bool newBreakMaxCodeLength); |
747 | |
748 | bool indentSwitches() const; |
749 | void setIndentSwitches(bool newIndentSwitches); |
750 | |
751 | bool indentAfterParens() const; |
752 | void setIndentAfterParens(bool newIndentAfterParens); |
753 | |
754 | private: |
755 | int mBraceStyle; |
756 | int mIndentStyle; |
757 | int mTabWidth; |
758 | bool mAttachNamespaces; |
759 | bool mAttachClasses; |
760 | bool mAttachInlines; |
761 | bool mAttachExternC; |
762 | bool mAttachClosingWhile; |
763 | bool mIndentClasses; |
764 | bool mIndentModifiers; |
765 | bool mIndentSwitches; |
766 | bool mIndentCases; |
767 | bool mIndentNamespaces; |
768 | bool mIndentAfterParens; |
769 | int mIndentContinuation; |
770 | bool mIndentLabels; |
771 | bool mIndentPreprocBlock; |
772 | bool mIndentPreprocCond; |
773 | bool mIndentPreprocDefine; |
774 | bool ; |
775 | int mMinConditionalIndent; |
776 | int mMaxContinuationIndent; |
777 | bool mBreakBlocks; |
778 | bool mBreakBlocksAll; |
779 | bool mPadOper; |
780 | bool mPadComma; |
781 | bool mPadParen; |
782 | bool mPadParenOut; |
783 | bool mPadFirstParenOut; |
784 | bool mPadParenIn; |
785 | bool ; |
786 | bool mUnpadParen; |
787 | bool mDeleteEmptyLines; |
788 | bool mDeleteMultipleEmptyLines; |
789 | bool mFillEmptyLines; |
790 | int mAlignPointerStyle; |
791 | int mAlignReferenceStyle; |
792 | bool mBreakClosingBraces; |
793 | bool mBreakElseIf; |
794 | bool ; |
795 | bool mAddBraces; |
796 | bool mAddOneLineBraces; |
797 | bool mRemoveBraces; |
798 | bool mBreakReturnType; |
799 | bool mBreakReturnTypeDecl; |
800 | bool mAttachReturnType; |
801 | bool mAttachReturnTypeDecl; |
802 | bool mKeepOneLineBlocks; |
803 | bool mKeepOneLineStatements; |
804 | bool mConvertTabs; |
805 | bool mCloseTemplates; |
806 | bool ; |
807 | bool mBreakMaxCodeLength; |
808 | int mMaxCodeLength; |
809 | bool mBreakAfterLogical; |
810 | // _Base interface |
811 | protected: |
812 | void doSave() override; |
813 | void doLoad() override; |
814 | }; |
815 | |
816 | class History: public _Base { |
817 | public: |
818 | explicit History(Settings *settings); |
819 | |
820 | const QStringList& opennedFiles() const; |
821 | const QStringList& opennedProjects() const; |
822 | void clearOpennedFiles(); |
823 | void clearOpennedProjects(); |
824 | bool addToOpenedFiles(const QString& filename); |
825 | void removeFile(const QString& filename); |
826 | bool addToOpenedProjects(const QString& filename); |
827 | void removeProject(const QString& filename); |
828 | private: |
829 | QStringList mOpenedFiles; |
830 | QStringList mOpenedProjects; |
831 | |
832 | // _Base interface |
833 | protected: |
834 | void doSave() override; |
835 | void doLoad() override; |
836 | }; |
837 | |
838 | class Executor: public _Base { |
839 | public: |
840 | explicit Executor(Settings * settings); |
841 | |
842 | bool pauseConsole() const; |
843 | void setPauseConsole(bool pauseConsole); |
844 | |
845 | bool minimizeOnRun() const; |
846 | void setMinimizeOnRun(bool minimizeOnRun); |
847 | |
848 | bool useParams() const; |
849 | void setUseParams(bool newUseParams); |
850 | const QString ¶ms() const; |
851 | void setParams(const QString &newParams); |
852 | bool redirectInput() const; |
853 | void setRedirectInput(bool newRedirectInput); |
854 | const QString &inputFilename() const; |
855 | void setInputFilename(const QString &newInputFilename); |
856 | |
857 | bool enableProblemSet() const; |
858 | void setEnableProblemSet(bool newEnableProblemSet); |
859 | |
860 | bool enableCompetitiveCompanion() const; |
861 | void setEnableCompetitiveCompanion(bool newEnableCompetitiveCompanion); |
862 | |
863 | int competivieCompanionPort() const; |
864 | void setCompetivieCompanionPort(int newCompetivieCompanionPort); |
865 | |
866 | bool ignoreSpacesWhenValidatingCases() const; |
867 | void setIgnoreSpacesWhenValidatingCases(bool newIgnoreSpacesWhenValidatingCases); |
868 | |
869 | const QString &caseEditorFontName() const; |
870 | void setCaseEditorFontName(const QString &newCaseEditorFontName); |
871 | |
872 | int caseEditorFontSize() const; |
873 | void setCaseEditorFontSize(int newCaseEditorFontSize); |
874 | |
875 | bool caseEditorFontOnlyMonospaced() const; |
876 | void setCaseEditorFontOnlyMonospaced(bool newCaseEditorFontOnlyMonospaced); |
877 | |
878 | bool enableCaseTimeout() const; |
879 | void setEnableCaseTimeout(bool newEnableCaseTimeout); |
880 | |
881 | int caseTimeout() const; |
882 | void setCaseTimeout(int newCaseTimeout); |
883 | |
884 | private: |
885 | // general |
886 | bool mPauseConsole; |
887 | bool mMinimizeOnRun; |
888 | bool mUseParams; |
889 | QString mParams; |
890 | bool mRedirectInput; |
891 | QString mInputFilename; |
892 | |
893 | //Problem Set |
894 | bool mEnableProblemSet; |
895 | bool mEnableCompetitiveCompanion; |
896 | int mCompetivieCompanionPort; |
897 | bool mIgnoreSpacesWhenValidatingCases; |
898 | QString mCaseEditorFontName; |
899 | int mCaseEditorFontSize; |
900 | bool mCaseEditorFontOnlyMonospaced; |
901 | bool mEnableCaseTimeout; |
902 | int mCaseTimeout; |
903 | |
904 | protected: |
905 | void doSave() override; |
906 | void doLoad() override; |
907 | }; |
908 | |
909 | class VCS: public _Base { |
910 | public: |
911 | explicit VCS(Settings *settings); |
912 | const QString &gitPath() const; |
913 | void setGitPath(const QString &newGitPath); |
914 | bool gitOk() const; |
915 | void detectGitInPath(); |
916 | private: |
917 | void validateGit(); |
918 | private: |
919 | QString mGitPath; |
920 | bool mGitOk; |
921 | protected: |
922 | void doSave() override; |
923 | void doLoad() override; |
924 | }; |
925 | |
926 | class UI: public _Base { |
927 | public: |
928 | explicit UI(Settings *settings); |
929 | |
930 | const QByteArray &mainWindowState() const; |
931 | void setMainWindowState(const QByteArray &newMainWindowState); |
932 | |
933 | const QByteArray &mainWindowGeometry() const; |
934 | void setMainWindowGeometry(const QByteArray &newMainWindowGeometry); |
935 | |
936 | int bottomPanelIndex() const; |
937 | void setBottomPanelIndex(int newBottomPanelIndex); |
938 | int leftPanelIndex() const; |
939 | void setLeftPanelIndex(int newLeftPanelIndex); |
940 | |
941 | bool classBrowserSortAlpha() const; |
942 | void setClassBrowserSortAlpha(bool newClassBrowserSortAlpha); |
943 | |
944 | bool classBrowserSortType() const; |
945 | void setClassBrowserSortType(bool newClassBrowserSortType); |
946 | |
947 | bool classBrowserShowInherited() const; |
948 | void setClassBrowserShowInherited(bool newClassBrowserShowInherited); |
949 | |
950 | bool showToolbar() const; |
951 | void setShowToolbar(bool newShowToolbar); |
952 | |
953 | bool showStatusBar() const; |
954 | void setShowStatusBar(bool newShowStatusBar); |
955 | |
956 | bool showToolWindowBars() const; |
957 | void setShowToolWindowBars(bool newShowToolWindowBars); |
958 | |
959 | bool showProject() const; |
960 | void setShowProject(bool newShowProject); |
961 | |
962 | bool showWatch() const; |
963 | void setShowWatch(bool newShowWatch); |
964 | |
965 | bool showStructure() const; |
966 | void setShowStructure(bool newShowStructure); |
967 | |
968 | bool showFiles() const; |
969 | void setShowFiles(bool newShowFiles); |
970 | |
971 | bool showProblemSet() const; |
972 | void setShowProblemSet(bool newShowProblemSet); |
973 | |
974 | bool showIssues() const; |
975 | void setShowIssues(bool newShowIssues); |
976 | |
977 | bool showCompileLog() const; |
978 | void setShowCompileLog(bool newShowCompileLog); |
979 | |
980 | bool showDebug() const; |
981 | void setShowDebug(bool newShowDebug); |
982 | |
983 | bool showSearch() const; |
984 | void setShowSearch(bool newShowSearch); |
985 | |
986 | bool showTODO() const; |
987 | void setShowTODO(bool newShowTODO); |
988 | |
989 | bool showBookmark() const; |
990 | void setShowBookmark(bool newShowBookmark); |
991 | |
992 | bool showProblem() const; |
993 | void setShowProblem(bool newShowProblem); |
994 | |
995 | int CPUDialogWidth() const; |
996 | void setCPUDialogWidth(int newCPUDialogWidth); |
997 | |
998 | int CPUDialogHeight() const; |
999 | void setCPUDialogHeight(int newCPUDialogHeight); |
1000 | |
1001 | int CPUDialogSplitterPos() const; |
1002 | void setCPUDialogSplitterPos(int newCPUDialogSplitterPos); |
1003 | |
1004 | int settingsDialogWidth() const; |
1005 | void setSettingsDialogWidth(int newSettingsDialogWidth); |
1006 | |
1007 | int settingsDialogHeight() const; |
1008 | void setSettingsDialogHeight(int newSettingsDialogHeight); |
1009 | |
1010 | int settingsDialogSplitterPos() const; |
1011 | void setSettingsDialogSplitterPos(int newSettingsDialogSplitterPos); |
1012 | |
1013 | int newProjectDialogWidth() const; |
1014 | void setNewProjectDialogWidth(int newNewProjectDialogWidth); |
1015 | |
1016 | int newProjectDialogHeight() const; |
1017 | void setNewProjectDialogHeight(int newNewProjectDialogHeight); |
1018 | |
1019 | int newClassDialogWidth() const; |
1020 | void setNewClassDialogWidth(int newNewClassDialogWidth); |
1021 | |
1022 | int newClassDialogHeight() const; |
1023 | void setNewClassDialogHeight(int newNewClassDialogHeight); |
1024 | |
1025 | int () const; |
1026 | void (int newNewFileDialogWidth); |
1027 | |
1028 | int () const; |
1029 | void (int newNewFileDialogHeight); |
1030 | |
1031 | bool shrinkExplorerTabs() const; |
1032 | void setShrinkExplorerTabs(bool newShrinkExplorerTabs); |
1033 | |
1034 | bool shrinkMessagesTabs() const; |
1035 | void setShrinkMessagesTabs(bool newShrinkMessagesTabs); |
1036 | |
1037 | const QSize &explorerTabsSize() const; |
1038 | void setExplorerTabsSize(const QSize &newExplorerTabsSize); |
1039 | |
1040 | const QSize &messagesTabsSize() const; |
1041 | void setMessagesTabsSize(const QSize &newMessagesTabsSize); |
1042 | |
1043 | private: |
1044 | QByteArray mMainWindowState; |
1045 | QByteArray mMainWindowGeometry; |
1046 | int mBottomPanelIndex; |
1047 | int mLeftPanelIndex; |
1048 | bool mClassBrowserSortAlpha; |
1049 | bool mClassBrowserSortType; |
1050 | bool mClassBrowserShowInherited; |
1051 | |
1052 | bool mShrinkExplorerTabs; |
1053 | bool mShrinkMessagesTabs; |
1054 | QSize mExplorerTabsSize; |
1055 | QSize mMessagesTabsSize; |
1056 | //view |
1057 | bool mShowToolbar; |
1058 | bool mShowStatusBar; |
1059 | bool mShowToolWindowBars; |
1060 | |
1061 | bool mShowProject; |
1062 | bool mShowWatch; |
1063 | bool mShowStructure; |
1064 | bool mShowFiles; |
1065 | bool mShowProblemSet; |
1066 | |
1067 | bool mShowIssues; |
1068 | bool mShowCompileLog; |
1069 | bool mShowDebug; |
1070 | bool mShowSearch; |
1071 | bool mShowTODO; |
1072 | bool mShowBookmark; |
1073 | bool mShowProblem; |
1074 | |
1075 | //dialogs |
1076 | int mCPUDialogWidth; |
1077 | int mCPUDialogHeight; |
1078 | int mCPUDialogSplitterPos; |
1079 | int mSettingsDialogWidth; |
1080 | int mSettingsDialogHeight; |
1081 | int mSettingsDialogSplitterPos; |
1082 | int mNewProjectDialogWidth; |
1083 | int mNewProjectDialogHeight; |
1084 | int mNewClassDialogWidth; |
1085 | int mNewClassDialogHeight; |
1086 | int ; |
1087 | int ; |
1088 | |
1089 | protected: |
1090 | void doSave() override; |
1091 | void doLoad() override; |
1092 | }; |
1093 | |
1094 | class Debugger: public _Base { |
1095 | public: |
1096 | explicit Debugger(Settings* settings); |
1097 | bool enableDebugConsole() const; |
1098 | void setEnableDebugConsole(bool showCommandLog); |
1099 | |
1100 | bool showDetailLog() const; |
1101 | void setShowDetailLog(bool showAnnotations); |
1102 | |
1103 | bool onlyShowMono() const; |
1104 | void setOnlyShowMono(bool onlyShowMono); |
1105 | |
1106 | int fontSize() const; |
1107 | void setFontSize(int fontSize); |
1108 | |
1109 | bool useIntelStyle() const; |
1110 | void setUseIntelStyle(bool useIntelStyle); |
1111 | |
1112 | QString fontName() const; |
1113 | void setFontName(const QString &fontName); |
1114 | |
1115 | bool blendMode() const; |
1116 | void setBlendMode(bool blendMode); |
1117 | |
1118 | bool skipSystemLibraries() const; |
1119 | void setSkipSystemLibraries(bool newSkipSystemLibraries); |
1120 | bool skipProjectLibraries() const; |
1121 | void setSkipProjectLibraries(bool newSkipProjectLibraries); |
1122 | bool skipCustomLibraries() const; |
1123 | void setSkipCustomLibraries(bool newSkipCustomLibraries); |
1124 | |
1125 | bool autosaveBreakpoints() const; |
1126 | void setAutosaveBreakpoints(bool newAutosaveBreakpoints); |
1127 | |
1128 | bool autosaveWatches() const; |
1129 | void setAutosaveWatches(bool newAutosaveWatches); |
1130 | |
1131 | bool openCPUInfoWhenSignaled() const; |
1132 | void setOpenCPUInfoWhenSignaled(bool newOpenCPUInfoWhenSignaled); |
1133 | |
1134 | bool useGDBServer() const; |
1135 | void setUseGDBServer(bool newUseGDBServer); |
1136 | int GDBServerPort() const; |
1137 | void setGDBServerPort(int newGDBServerPort); |
1138 | |
1139 | int memoryViewRows() const; |
1140 | void setMemoryViewRows(int newMemoryViewRows); |
1141 | |
1142 | int memoryViewColumns() const; |
1143 | void setMemoryViewColumns(int newMemoryViewColumns); |
1144 | |
1145 | private: |
1146 | bool mEnableDebugConsole; |
1147 | bool mShowDetailLog; |
1148 | QString mFontName; |
1149 | bool mOnlyShowMono; |
1150 | int mFontSize; |
1151 | bool mUseIntelStyle; |
1152 | bool mBlendMode; |
1153 | bool mSkipSystemLibraries; |
1154 | bool mSkipProjectLibraries; |
1155 | bool mSkipCustomLibraries; |
1156 | bool mAutosaveBreakpoints; |
1157 | bool mAutosaveWatches; |
1158 | bool mOpenCPUInfoWhenSignaled; |
1159 | bool mUseGDBServer; |
1160 | int mGDBServerPort; |
1161 | int mMemoryViewRows; |
1162 | int mMemoryViewColumns; |
1163 | |
1164 | // _Base interface |
1165 | protected: |
1166 | void doSave() override; |
1167 | void doLoad() override; |
1168 | }; |
1169 | |
1170 | |
1171 | class CompilerSet { |
1172 | public: |
1173 | explicit CompilerSet(); |
1174 | explicit CompilerSet(const QString& compilerFolder, const QString& cc_prog); |
1175 | explicit CompilerSet(const CompilerSet& set); |
1176 | |
1177 | CompilerSet& operator= (const CompilerSet& ) = delete; |
1178 | CompilerSet& operator= (const CompilerSet&& ) = delete; |
1179 | |
1180 | // Initialization |
1181 | void setProperties(const QString& binDir, const QString& cc_prog); |
1182 | |
1183 | void resetCompileOptionts(); |
1184 | bool setCompileOption(const QString& key, int valIndex); |
1185 | bool setCompileOption(const QString& key, const QString& value); |
1186 | void unsetCompileOption(const QString& key); |
1187 | void setCompileOptions(const QMap<QString, QString> options); |
1188 | |
1189 | QString getCompileOptionValue(const QString& key); |
1190 | |
1191 | int mainVersion(); |
1192 | |
1193 | bool dirsValid(QString& msg); |
1194 | bool validateExes(QString& msg); |
1195 | //properties |
1196 | const QString& CCompiler() const; |
1197 | void setCCompiler(const QString& name); |
1198 | const QString& cppCompiler() const; |
1199 | void setCppCompiler(const QString& name); |
1200 | const QString& make() const; |
1201 | void setMake(const QString& name); |
1202 | const QString& debugger() const; |
1203 | void setDebugger(const QString& name); |
1204 | const QString& profiler() const; |
1205 | void setProfiler(const QString& name); |
1206 | const QString& resourceCompiler() const; |
1207 | void setResourceCompiler(const QString& name); |
1208 | const QString &debugServer() const; |
1209 | void setDebugServer(const QString &newDebugServer); |
1210 | |
1211 | QStringList& binDirs(); |
1212 | QStringList& CIncludeDirs(); |
1213 | QStringList& CppIncludeDirs(); |
1214 | QStringList& libDirs(); |
1215 | QStringList& defaultCIncludeDirs(); |
1216 | QStringList& defaultCppIncludeDirs(); |
1217 | QStringList& defaultLibDirs(); |
1218 | |
1219 | const QString& dumpMachine() const; |
1220 | void setDumpMachine(const QString& value); |
1221 | const QString& version() const; |
1222 | void setVersion(const QString& value); |
1223 | const QString& type() const; |
1224 | void setType(const QString& value); |
1225 | const QString& name() const; |
1226 | void setName(const QString& value); |
1227 | const QStringList& CppDefines(); |
1228 | const QStringList& CDefines(); |
1229 | const QString& target() const; |
1230 | void setTarget(const QString& value); |
1231 | |
1232 | bool useCustomCompileParams() const; |
1233 | void setUseCustomCompileParams(bool value); |
1234 | bool useCustomLinkParams() const; |
1235 | void setUseCustomLinkParams(bool value); |
1236 | const QString& customCompileParams() const; |
1237 | void setCustomCompileParams(const QString& value); |
1238 | const QString& customLinkParams() const; |
1239 | void setCustomLinkParams(const QString& value); |
1240 | bool autoAddCharsetParams() const; |
1241 | void setAutoAddCharsetParams(bool value); |
1242 | |
1243 | //Converts options to and from memory format ( for old settings compatibility) |
1244 | void setIniOptions(const QByteArray& value); |
1245 | |
1246 | bool staticLink() const; |
1247 | void setStaticLink(bool newStaticLink); |
1248 | |
1249 | |
1250 | static int charToValue(char valueChar); |
1251 | static char valueToChar(int val); |
1252 | const QString &compilerType() const; |
1253 | |
1254 | void setCompilerType(const QString &newCompilerType); |
1255 | |
1256 | int compilerSetType() const; |
1257 | void setCompilerSetType(int newCompilerSetType); |
1258 | |
1259 | const QString &execCharset() const; |
1260 | void setExecCharset(const QString &newExecCharset); |
1261 | |
1262 | const QMap<QString, QString> &compileOptions() const; |
1263 | |
1264 | private: |
1265 | void setDirectories(const QString& binDir, const QString& mCompilerType); |
1266 | //load hard defines |
1267 | void setDefines(); |
1268 | void setExecutables(); |
1269 | void setUserInput(); |
1270 | |
1271 | QString findProgramInBinDirs(const QString name); |
1272 | |
1273 | QByteArray getCompilerOutput(const QString& binDir, const QString& binFile, |
1274 | const QStringList& arguments); |
1275 | private: |
1276 | bool mFullLoaded; |
1277 | // Executables, most are hardcoded |
1278 | QString mCCompiler; |
1279 | QString mCppCompiler; |
1280 | QString mMake; |
1281 | QString mDebugger; |
1282 | QString mProfiler; |
1283 | QString mResourceCompiler; |
1284 | QString mDebugServer; |
1285 | |
1286 | // Directories, mostly hardcoded too |
1287 | QStringList mBinDirs; |
1288 | QStringList mCIncludeDirs; |
1289 | QStringList mCppIncludeDirs; |
1290 | QStringList mLibDirs; |
1291 | QStringList mDefaultLibDirs; |
1292 | QStringList mDefaultCIncludeDirs; |
1293 | QStringList mDefaultCppIncludeDirs; |
1294 | |
1295 | // Misc. properties |
1296 | QString mDumpMachine; // "x86_64-w64-mingw32", "mingw32" etc |
1297 | QString mVersion; // "4.7.1" |
1298 | QString mType; // "TDM-GCC", "MinGW" |
1299 | QString mName; // "TDM-GCC 4.7.1 Release" |
1300 | QStringList mCppDefines; // list of predefined constants |
1301 | QStringList mCDefines; // list of predefined constants |
1302 | QString mTarget; // 'X86_64' / 'i686' |
1303 | QString mCompilerType; // 'Clang' / 'GCC' |
1304 | int mCompilerSetType; // RELEASE/ DEBUG/ Profile |
1305 | |
1306 | // User settings |
1307 | bool mUseCustomCompileParams; |
1308 | bool mUseCustomLinkParams; |
1309 | QString mCustomCompileParams; |
1310 | QString mCustomLinkParams; |
1311 | bool mAutoAddCharsetParams; |
1312 | QString mExecCharset; |
1313 | bool mStaticLink; |
1314 | |
1315 | // Options |
1316 | QMap<QString,QString> mCompileOptions; |
1317 | }; |
1318 | |
1319 | typedef std::shared_ptr<CompilerSet> PCompilerSet; |
1320 | typedef std::vector<PCompilerSet> CompilerSetList; |
1321 | |
1322 | class CompilerSets { |
1323 | public: |
1324 | explicit CompilerSets(Settings* settings); |
1325 | PCompilerSet addSet(); |
1326 | bool addSets(const QString& folder); |
1327 | void clearSets(); |
1328 | void findSets(); |
1329 | void saveSets(); |
1330 | void loadSets(); |
1331 | void saveDefaultIndex(); |
1332 | void deleteSet(int index); |
1333 | void saveSet(int index); |
1334 | size_t size() const; |
1335 | int defaultIndex() const; |
1336 | void setDefaultIndex(int value); |
1337 | PCompilerSet defaultSet(); |
1338 | PCompilerSet getSet(int index); |
1339 | |
1340 | QString getKeyFromCompilerCompatibleIndex(int idx) const; |
1341 | |
1342 | private: |
1343 | PCompilerSet addSet(const QString& folder, const QString& cc_prog); |
1344 | PCompilerSet addSet(const PCompilerSet &pSet); |
1345 | bool addSets(const QString& folder, const QString& cc_prog); |
1346 | void savePath(const QString& name, const QString& path); |
1347 | void savePathList(const QString& name, const QStringList& pathList); |
1348 | |
1349 | QString loadPath(const QString& name); |
1350 | void loadPathList(const QString& name, QStringList& list); |
1351 | PCompilerSet loadSet(int index); |
1352 | void prepareCompatibleIndex(); |
1353 | private: |
1354 | CompilerSetList mList; |
1355 | int mDefaultIndex; |
1356 | Settings* mSettings; |
1357 | QStringList mCompilerCompatibleIndex; // index for old settings compatibility |
1358 | }; |
1359 | |
1360 | public: |
1361 | explicit Settings(const QString& filename); |
1362 | explicit Settings(Settings&& settings) = delete; |
1363 | explicit Settings(const Settings& settings) = delete; |
1364 | ~Settings(); |
1365 | |
1366 | Settings& operator= (const Settings& settings) = delete; |
1367 | Settings& operator= (const Settings&& settings) = delete; |
1368 | void beginGroup(const QString& group); |
1369 | void endGroup(); |
1370 | void remove(const QString &key); |
1371 | void saveValue(const QString& group, const QString &key, const QVariant &value); |
1372 | void saveValue(const QString &key, const QVariant &value); |
1373 | QVariant value(const QString& group, const QString &key, const QVariant& defaultValue); |
1374 | QVariant value(const QString &key, const QVariant& defaultValue); |
1375 | void load(); |
1376 | |
1377 | Dirs& dirs(); |
1378 | Editor& editor(); |
1379 | CompilerSets& compilerSets(); |
1380 | Environment& environment(); |
1381 | Executor& executor(); |
1382 | Debugger& debugger(); |
1383 | History& history(); |
1384 | CodeCompletion &codeCompletion(); |
1385 | CodeFormatter &codeFormatter(); |
1386 | UI &ui(); |
1387 | VCS &vcs(); |
1388 | QString filename() const; |
1389 | |
1390 | private: |
1391 | QString mFilename; |
1392 | QSettings mSettings; |
1393 | Dirs mDirs; |
1394 | Editor mEditor; |
1395 | Environment mEnvironment; |
1396 | CompilerSets mCompilerSets; |
1397 | Executor mExecutor; |
1398 | Debugger mDebugger; |
1399 | CodeCompletion mCodeCompletion; |
1400 | CodeFormatter mCodeFormatter; |
1401 | History mHistory; |
1402 | UI mUI; |
1403 | VCS mVCS; |
1404 | }; |
1405 | |
1406 | |
1407 | extern Settings* pSettings; |
1408 | |
1409 | #endif // SETTINGS_H |
1410 | |