2021-04-08 10:29:21 +08:00
|
|
|
#ifndef SETTINGS_H
|
|
|
|
#define SETTINGS_H
|
|
|
|
|
|
|
|
#include <QSettings>
|
2021-04-13 22:17:18 +08:00
|
|
|
#include <vector>
|
|
|
|
#include <memory>
|
2021-06-07 11:02:03 +08:00
|
|
|
#include <QColor>
|
|
|
|
#include "qsynedit/SynEdit.h"
|
2021-04-08 10:29:21 +08:00
|
|
|
|
2021-04-15 11:18:14 +08:00
|
|
|
/**
|
|
|
|
* use the following command to get gcc's default bin/library folders:
|
|
|
|
* gcc -print-search-dirs
|
|
|
|
*/
|
|
|
|
|
2021-04-15 21:32:45 +08:00
|
|
|
#define SETTING_DIRS "Dirs"
|
|
|
|
#define SETTING_EDITOR "Editor"
|
2021-06-18 21:48:40 +08:00
|
|
|
#define SETTING_ENVIRONMENT "Environment"
|
2021-07-01 19:44:38 +08:00
|
|
|
#define SETTING_EXECUTOR "Executor"
|
2021-04-15 21:32:45 +08:00
|
|
|
#define SETTING_COMPILTER_SETS "CompilerSets"
|
|
|
|
#define SETTING_COMPILTER_SETS_DEFAULT_INDEX "defaultIndex"
|
|
|
|
#define SETTING_COMPILTER_SETS_COUNT "count"
|
|
|
|
#define SETTING_COMPILTER_SET "CompilerSet_%1"
|
2021-04-13 11:23:37 +08:00
|
|
|
#define SETTING_EDITOR_DEFAULT_ENCODING "default_encoding"
|
|
|
|
#define SETTING_EDITOR_AUTO_INDENT "default_auto_indent"
|
2021-04-09 17:48:25 +08:00
|
|
|
|
2021-04-15 11:18:14 +08:00
|
|
|
|
|
|
|
extern const char ValueToChar[28];
|
|
|
|
|
2021-04-13 22:17:18 +08:00
|
|
|
class Settings;
|
|
|
|
|
|
|
|
typedef struct {
|
2021-04-15 11:18:14 +08:00
|
|
|
QString name; // language table index of "Generate debugging info"
|
|
|
|
QString section; // language table index of "C options"
|
2021-04-13 22:17:18 +08:00
|
|
|
bool isC;
|
|
|
|
bool isCpp; // True (C++ option?) - can be both C and C++ option...
|
|
|
|
bool isLinker; // Is it a linker param
|
|
|
|
int value; // True
|
2021-04-15 11:18:14 +08:00
|
|
|
QString setting; // "-g3"
|
|
|
|
QStringList choices; // replaces "Yes/No" standard choices (max 30 different choices)
|
|
|
|
} CompilerOption;
|
|
|
|
|
|
|
|
using PCompilerOption = std::shared_ptr<CompilerOption>;
|
|
|
|
|
|
|
|
using CompilerOptionList=std::vector<std::shared_ptr<CompilerOption>>;
|
2021-04-08 10:29:21 +08:00
|
|
|
|
|
|
|
class Settings
|
|
|
|
{
|
2021-04-13 11:23:37 +08:00
|
|
|
private:
|
2021-04-15 11:18:14 +08:00
|
|
|
|
2021-04-13 11:23:37 +08:00
|
|
|
class _Base {
|
|
|
|
public:
|
|
|
|
explicit _Base(Settings* settings, const QString& groupName);
|
2021-06-07 11:02:03 +08:00
|
|
|
void beginGroup();
|
|
|
|
void endGroup();
|
|
|
|
void saveValue(const QString &key, const QVariant &value);
|
|
|
|
QVariant value(const QString &key, const QVariant& defaultValue);
|
|
|
|
bool boolValue(const QString &key, bool defaultValue);
|
|
|
|
int intValue(const QString &key, int defaultValue);
|
|
|
|
QColor colorValue(const QString &key, const QColor& defaultValue);
|
|
|
|
QString stringValue(const QString &key, const QString& defaultValue);
|
|
|
|
void save();
|
|
|
|
void load();
|
|
|
|
protected:
|
|
|
|
virtual void doSave() = 0;
|
|
|
|
virtual void doLoad() = 0;
|
2021-04-13 11:23:37 +08:00
|
|
|
protected:
|
|
|
|
Settings* mSettings;
|
|
|
|
QString mGroup;
|
|
|
|
};
|
2021-04-08 10:29:21 +08:00
|
|
|
|
2021-04-13 11:23:37 +08:00
|
|
|
public:
|
|
|
|
class Dirs: public _Base {
|
|
|
|
public:
|
2021-06-17 10:39:46 +08:00
|
|
|
enum class DataType {
|
|
|
|
None,
|
|
|
|
ColorSheme
|
|
|
|
};
|
2021-04-13 11:23:37 +08:00
|
|
|
explicit Dirs(Settings * settings);
|
2021-04-17 14:52:47 +08:00
|
|
|
QString app() const;
|
2021-06-17 10:39:46 +08:00
|
|
|
QString data(DataType dataType = DataType::None) const;
|
|
|
|
QString config(DataType dataType = DataType::None) const;
|
2021-06-07 11:02:03 +08:00
|
|
|
|
|
|
|
// _Base interface
|
|
|
|
protected:
|
|
|
|
void doSave() override;
|
|
|
|
void doLoad() override;
|
2021-04-13 11:23:37 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class Editor: public _Base {
|
|
|
|
public:
|
|
|
|
explicit Editor(Settings * settings);
|
|
|
|
QByteArray defaultEncoding();
|
2021-06-07 11:02:03 +08:00
|
|
|
void setDefaultEncoding(const QByteArray& value);
|
2021-04-13 11:23:37 +08:00
|
|
|
bool autoIndent();
|
2021-06-07 11:02:03 +08:00
|
|
|
void setAutoIndent(bool value);
|
|
|
|
bool addIndent() const;
|
|
|
|
void setAddIndent(bool addIndent);
|
|
|
|
|
|
|
|
bool tabToSpaces() const;
|
|
|
|
void setTabToSpaces(bool tabToSpaces);
|
|
|
|
|
|
|
|
int tabWidth() const;
|
|
|
|
void setTabWidth(int tabWidth);
|
|
|
|
|
|
|
|
bool showIndentLines() const;
|
|
|
|
void setShowIndentLines(bool showIndentLines);
|
|
|
|
|
|
|
|
QColor indentLineColor() const;
|
|
|
|
void setIndentLineColor(const QColor &indentLineColor);
|
|
|
|
|
|
|
|
bool enhanceHomeKey() const;
|
|
|
|
void setEnhanceHomeKey(bool enhanceHomeKey);
|
|
|
|
|
|
|
|
bool enhanceEndKey() const;
|
|
|
|
void setEnhanceEndKey(bool enhanceEndKey);
|
|
|
|
|
|
|
|
SynEditCaretType caretForInsert() const;
|
|
|
|
void setCaretForInsert(const SynEditCaretType &caretForInsert);
|
|
|
|
|
|
|
|
SynEditCaretType caretForOverwrite() const;
|
|
|
|
void setCaretForOverwrite(const SynEditCaretType &caretForOverwrite);
|
|
|
|
|
|
|
|
QColor caretColor() const;
|
|
|
|
void setCaretColor(const QColor &caretColor);
|
|
|
|
|
|
|
|
bool keepCaretX() const;
|
|
|
|
void setKeepCaretX(bool keepCaretX);
|
|
|
|
|
2021-06-08 21:41:42 +08:00
|
|
|
bool autoHideScrollbar() const;
|
|
|
|
void setAutoHideScrollbar(bool autoHideScrollbar);
|
|
|
|
|
|
|
|
bool scrollPastEof() const;
|
|
|
|
void setScrollPastEof(bool scrollPastEof);
|
|
|
|
|
|
|
|
bool scrollPastEol() const;
|
|
|
|
void setScrollPastEol(bool scrollPastEol);
|
|
|
|
|
|
|
|
bool scrollByOneLess() const;
|
|
|
|
void setScrollByOneLess(bool scrollByOneLess);
|
|
|
|
|
|
|
|
bool halfPageScroll() const;
|
|
|
|
void setHalfPageScroll(bool halfPageScroll);
|
|
|
|
|
2021-06-09 17:12:23 +08:00
|
|
|
QString fontName() const;
|
|
|
|
void setFontName(const QString &fontName);
|
|
|
|
|
|
|
|
int fontSize() const;
|
|
|
|
void setFontSize(int fontSize);
|
|
|
|
|
|
|
|
bool fontOnlyMonospaced() const;
|
|
|
|
void setFontOnlyMonospaced(bool fontOnlyMonospaced);
|
|
|
|
|
|
|
|
bool gutterVisible() const;
|
|
|
|
void setGutterVisible(bool gutterVisible);
|
|
|
|
|
|
|
|
bool gutterAutoSize() const;
|
|
|
|
void setGutterAutoSize(bool gutterAutoSize);
|
|
|
|
|
|
|
|
int gutterDigitsCount() const;
|
|
|
|
void setGutterDigitsCount(int gutterDigitsCount);
|
|
|
|
|
|
|
|
bool gutterShowLineNumbers() const;
|
|
|
|
void setGutterShowLineNumbers(bool gutterShowLineNumbers);
|
|
|
|
|
|
|
|
bool gutterAddLeadingZero() const;
|
|
|
|
void setGutterAddLeadingZero(bool gutterAddLeadingZero);
|
|
|
|
|
|
|
|
bool gutterLineNumbersStartZero() const;
|
|
|
|
void setGutterLineNumbersStartZero(bool gutterLineNumbersStartZero);
|
|
|
|
|
|
|
|
bool gutterUseCustomFont() const;
|
|
|
|
void setGutterUseCustomFont(bool gutterUseCustomFont);
|
|
|
|
|
|
|
|
QString gutterFontName() const;
|
|
|
|
void setGutterFontName(const QString &gutterFontName);
|
|
|
|
|
|
|
|
int gutterFontSize() const;
|
|
|
|
void setGutterFontSize(int gutterFontSize);
|
|
|
|
|
|
|
|
bool gutterFontOnlyMonospaced() const;
|
|
|
|
void setGutterFontOnlyMonospaced(bool gutterFontOnlyMonospaced);
|
|
|
|
|
|
|
|
int gutterLeftOffset() const;
|
|
|
|
void setGutterLeftOffset(int gutterLeftOffset);
|
|
|
|
|
|
|
|
int gutterRightOffset() const;
|
|
|
|
void setGutterRightOffset(int gutterRightOffset);
|
|
|
|
|
2021-06-12 22:36:23 +08:00
|
|
|
bool copySizeLimit() const;
|
|
|
|
void setCopySizeLimit(bool copyLimit);
|
|
|
|
|
|
|
|
int copyCharLimits() const;
|
|
|
|
void setCopyCharLimits(int copyCharLimits);
|
|
|
|
|
|
|
|
int copyLineLimits() const;
|
|
|
|
void setCopyLineLimits(int copyLineLimits);
|
|
|
|
|
|
|
|
bool copyRTFUseBackground() const;
|
|
|
|
void setCopyRTFUseBackground(bool copyRTFUseBackground);
|
|
|
|
|
|
|
|
bool copyRTFUseEditorColor() const;
|
|
|
|
void setCopyRTFUseEditorColor(bool copyRTFUseEditorColor);
|
|
|
|
|
2021-06-20 14:30:47 +08:00
|
|
|
QString copyRTFColorScheme() const;
|
|
|
|
void setCopyRTFColorScheme(const QString ©RTFColorScheme);
|
2021-06-12 22:36:23 +08:00
|
|
|
|
|
|
|
bool copyHTMLUseBackground() const;
|
|
|
|
void setCopyHTMLUseBackground(bool copyHTMLUseBackground);
|
|
|
|
|
|
|
|
bool copyHTMLUseEditorColor() const;
|
|
|
|
void setCopyHTMLUseEditorColor(bool copyHTMLUseEditorColor);
|
|
|
|
|
2021-06-20 14:30:47 +08:00
|
|
|
QString copyHTMLColorScheme() const;
|
|
|
|
void setCopyHTMLColorScheme(const QString ©HTMLColorScheme);
|
2021-06-12 22:36:23 +08:00
|
|
|
|
|
|
|
int copyWithFormatAs() const;
|
|
|
|
void setCopyWithFormatAs(int copyWithFormatAs);
|
|
|
|
|
2021-06-20 14:30:47 +08:00
|
|
|
QString colorScheme() const;
|
|
|
|
void setColorScheme(const QString &colorScheme);
|
|
|
|
|
2021-06-21 16:25:21 +08:00
|
|
|
bool completeSymbols() const;
|
|
|
|
void setCompleteSymbols(bool completeSymbols);
|
|
|
|
|
|
|
|
bool completeParenthese() const;
|
|
|
|
void setCompleteParenthese(bool completeParenthese);
|
|
|
|
|
|
|
|
bool completeBracket() const;
|
|
|
|
void setCompleteBracket(bool completeBracket);
|
|
|
|
|
|
|
|
bool completeBrace() const;
|
|
|
|
void setCompleteBrace(bool completeBrace);
|
|
|
|
|
|
|
|
bool completeComment() const;
|
|
|
|
void setCompleteComment(bool completeComment);
|
|
|
|
|
|
|
|
bool completeSingleQuote() const;
|
|
|
|
void setCompleteSingleQuote(bool completeSingleQuote);
|
|
|
|
|
|
|
|
bool completeDoubleQuote() const;
|
|
|
|
void setCompleteDoubleQuote(bool completeDoubleQuote);
|
|
|
|
|
|
|
|
bool completeGlobalInclude() const;
|
|
|
|
void setCompleteGlobalInclude(bool completeGlobalInclude);
|
|
|
|
|
|
|
|
bool overwriteSymbols() const;
|
|
|
|
void setOverwriteSymbols(bool overwriteSymbols);
|
|
|
|
|
2021-06-23 08:55:56 +08:00
|
|
|
bool removeSymbolPairs() const;
|
|
|
|
void setRemoveSymbolPairs(bool value);
|
2021-06-21 16:25:21 +08:00
|
|
|
|
2021-06-25 12:40:11 +08:00
|
|
|
bool syntaxCheck() const;
|
|
|
|
void setSyntaxCheck(bool syntaxCheck);
|
|
|
|
|
|
|
|
bool syntaxCheckWhenSave() const;
|
|
|
|
void setSyntaxCheckWhenSave(bool syntaxCheckWhenSave);
|
|
|
|
|
|
|
|
bool syntaxCheckWhenLineChanged() const;
|
|
|
|
void setSyntaxCheckWhenLineChanged(bool syntaxCheckWhenLineChanged);
|
|
|
|
|
2021-06-07 11:02:03 +08:00
|
|
|
private:
|
|
|
|
QByteArray mDefaultEncoding;
|
2021-06-09 17:12:23 +08:00
|
|
|
//General
|
2021-06-07 11:02:03 +08:00
|
|
|
// indents
|
|
|
|
bool mAutoIndent;
|
|
|
|
bool mAddIndent;
|
|
|
|
bool mTabToSpaces;
|
|
|
|
int mTabWidth;
|
|
|
|
bool mShowIndentLines;
|
|
|
|
QColor mIndentLineColor;
|
|
|
|
// caret
|
|
|
|
bool mEnhanceHomeKey;
|
|
|
|
bool mEnhanceEndKey;
|
|
|
|
bool mKeepCaretX;
|
|
|
|
SynEditCaretType mCaretForInsert;
|
|
|
|
SynEditCaretType mCaretForOverwrite;
|
|
|
|
QColor mCaretColor;
|
2021-06-08 21:41:42 +08:00
|
|
|
//scroll
|
|
|
|
bool mAutoHideScrollbar;
|
|
|
|
bool mScrollPastEof;
|
|
|
|
bool mScrollPastEol;
|
|
|
|
bool mScrollByOneLess;
|
|
|
|
bool mHalfPageScroll;
|
2021-06-07 11:02:03 +08:00
|
|
|
|
2021-06-09 17:12:23 +08:00
|
|
|
//Font
|
|
|
|
//font
|
|
|
|
QString mFontName;
|
|
|
|
int mFontSize;
|
|
|
|
bool mFontOnlyMonospaced;
|
|
|
|
|
|
|
|
//gutter
|
|
|
|
bool mGutterVisible;
|
|
|
|
bool mGutterAutoSize;
|
|
|
|
int mGutterLeftOffset;
|
|
|
|
int mGutterRightOffset;
|
|
|
|
int mGutterDigitsCount;
|
|
|
|
bool mGutterShowLineNumbers;
|
|
|
|
bool mGutterAddLeadingZero;
|
|
|
|
bool mGutterLineNumbersStartZero;
|
|
|
|
bool mGutterUseCustomFont;
|
|
|
|
QString mGutterFontName;
|
|
|
|
int mGutterFontSize;
|
|
|
|
bool mGutterFontOnlyMonospaced;
|
|
|
|
|
2021-06-12 22:36:23 +08:00
|
|
|
//copy
|
|
|
|
bool mCopySizeLimit;
|
|
|
|
int mCopyCharLimits;
|
|
|
|
int mCopyLineLimits;
|
|
|
|
int mCopyWithFormatAs;
|
|
|
|
bool mCopyRTFUseBackground;
|
|
|
|
bool mCopyRTFUseEditorColor;
|
2021-06-20 14:30:47 +08:00
|
|
|
QString mCopyRTFColorScheme;
|
2021-06-12 22:36:23 +08:00
|
|
|
bool mCopyHTMLUseBackground;
|
|
|
|
bool mCopyHTMLUseEditorColor;
|
2021-06-20 14:30:47 +08:00
|
|
|
QString mCopyHTMLColorScheme;
|
|
|
|
|
|
|
|
//Color
|
|
|
|
QString mColorScheme;
|
2021-06-12 22:36:23 +08:00
|
|
|
|
2021-06-21 16:25:21 +08:00
|
|
|
//Symbol Completion
|
|
|
|
bool mCompleteSymbols;
|
|
|
|
bool mCompleteParenthese;
|
|
|
|
bool mCompleteBracket;
|
|
|
|
bool mCompleteBrace;
|
|
|
|
bool mCompleteComment;
|
|
|
|
bool mCompleteSingleQuote;
|
|
|
|
bool mCompleteDoubleQuote;
|
|
|
|
bool mCompleteGlobalInclude;
|
|
|
|
bool mOverwriteSymbols;
|
2021-06-23 08:55:56 +08:00
|
|
|
bool mRemoveSymbolPairs;
|
2021-06-21 16:25:21 +08:00
|
|
|
|
2021-06-25 12:40:11 +08:00
|
|
|
//Auto Syntax Check
|
|
|
|
bool mSyntaxCheck;
|
|
|
|
bool mSyntaxCheckWhenSave;
|
|
|
|
bool mSyntaxCheckWhenLineChanged;
|
|
|
|
|
2021-06-07 11:02:03 +08:00
|
|
|
// _Base interface
|
|
|
|
protected:
|
|
|
|
void doSave() override;
|
|
|
|
void doLoad() override;
|
2021-04-13 11:23:37 +08:00
|
|
|
};
|
2021-04-08 10:29:21 +08:00
|
|
|
|
2021-06-18 21:48:40 +08:00
|
|
|
class Environment: public _Base {
|
|
|
|
public:
|
|
|
|
explicit Environment(Settings * settings);
|
|
|
|
QString theme() const;
|
|
|
|
void setTheme(const QString &theme);
|
|
|
|
|
|
|
|
QString interfaceFont() const;
|
|
|
|
void setInterfaceFont(const QString &interfaceFont);
|
|
|
|
|
|
|
|
int interfaceFontSize() const;
|
|
|
|
void setInterfaceFontSize(int interfaceFontSize);
|
|
|
|
|
2021-06-20 09:27:37 +08:00
|
|
|
QString language() const;
|
|
|
|
void setLanguage(const QString &language);
|
|
|
|
|
2021-06-18 21:48:40 +08:00
|
|
|
private:
|
|
|
|
|
|
|
|
//Appearence
|
|
|
|
QString mTheme;
|
|
|
|
QString mInterfaceFont;
|
|
|
|
int mInterfaceFontSize;
|
2021-06-20 09:27:37 +08:00
|
|
|
QString mLanguage;
|
2021-06-18 21:48:40 +08:00
|
|
|
// _Base interface
|
|
|
|
protected:
|
|
|
|
void doSave() override;
|
|
|
|
void doLoad() override;
|
|
|
|
};
|
|
|
|
|
2021-07-01 19:44:38 +08:00
|
|
|
class Executor: public _Base {
|
|
|
|
public:
|
|
|
|
explicit Executor(Settings * settings);
|
|
|
|
|
|
|
|
bool pauseConsole() const;
|
|
|
|
void setPauseConsole(bool pauseConsole);
|
|
|
|
|
|
|
|
bool minimizeOnRun() const;
|
|
|
|
void setMinimizeOnRun(bool minimizeOnRun);
|
|
|
|
|
|
|
|
private:
|
|
|
|
// general
|
|
|
|
bool mPauseConsole;
|
|
|
|
bool mMinimizeOnRun;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void doSave() override;
|
|
|
|
void doLoad() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2021-04-15 11:18:14 +08:00
|
|
|
class CompilerSet {
|
2021-04-13 22:17:18 +08:00
|
|
|
public:
|
2021-04-15 11:18:14 +08:00
|
|
|
explicit CompilerSet(const QString& compilerFolder = QString());
|
|
|
|
explicit CompilerSet(const CompilerSet& set);
|
|
|
|
|
|
|
|
CompilerSet& operator= (const CompilerSet& ) = delete;
|
|
|
|
CompilerSet& operator= (const CompilerSet&& ) = delete;
|
|
|
|
|
2021-04-16 22:04:48 +08:00
|
|
|
|
2021-04-15 11:18:14 +08:00
|
|
|
void addOption(const QString& name, const QString section, bool isC,
|
|
|
|
bool isCpp, bool isLinker,
|
|
|
|
int value, const QString& setting,
|
|
|
|
const QStringList& choices = QStringList());
|
2021-04-15 21:32:45 +08:00
|
|
|
PCompilerOption findOption(const QString& setting);
|
2021-04-15 11:18:14 +08:00
|
|
|
char getOptionValue(const QString& setting);
|
|
|
|
void setOption(const QString& setting, char valueChar);
|
|
|
|
void setOption(PCompilerOption& option, char valueChar);
|
2021-06-24 16:05:19 +08:00
|
|
|
void setProperties(const QString& binDir);
|
2021-04-15 11:18:14 +08:00
|
|
|
|
2021-04-16 22:04:48 +08:00
|
|
|
bool dirsValid(QString& msg);
|
2021-06-24 16:05:19 +08:00
|
|
|
bool validateExes(QString& msg);
|
2021-04-16 22:04:48 +08:00
|
|
|
//properties
|
2021-04-17 14:52:47 +08:00
|
|
|
const QString& CCompiler() const;
|
|
|
|
void setCCompiler(const QString& name);
|
|
|
|
const QString& cppCompiler() const;
|
|
|
|
void setCppCompiler(const QString& name);
|
|
|
|
const QString& make() const;
|
|
|
|
void setMake(const QString& name);
|
|
|
|
const QString& debugger() const;
|
|
|
|
void setDebugger(const QString& name);
|
|
|
|
const QString& profiler() const;
|
|
|
|
void setProfiler(const QString& name);
|
|
|
|
const QString& resourceCompiler() const;
|
|
|
|
void setResourceCompiler(const QString& name);
|
2021-04-15 11:18:14 +08:00
|
|
|
|
|
|
|
QStringList& binDirs();
|
|
|
|
QStringList& CIncludeDirs();
|
|
|
|
QStringList& CppIncludeDirs();
|
2021-04-17 22:38:46 +08:00
|
|
|
QStringList& libDirs();
|
2021-04-15 11:18:14 +08:00
|
|
|
|
|
|
|
const QString& dumpMachine();
|
|
|
|
void setDumpMachine(const QString& value);
|
|
|
|
const QString& version();
|
|
|
|
void setVersion(const QString& value);
|
|
|
|
const QString& type();
|
|
|
|
void setType(const QString& value);
|
2021-04-15 21:32:45 +08:00
|
|
|
const QString& name();
|
|
|
|
void setName(const QString& value);
|
2021-04-15 11:18:14 +08:00
|
|
|
QStringList& defines();
|
|
|
|
const QString& target();
|
|
|
|
void setTarget(const QString& value);
|
|
|
|
|
|
|
|
bool useCustomCompileParams();
|
|
|
|
void setUseCustomCompileParams(bool value);
|
|
|
|
bool useCustomLinkParams();
|
|
|
|
void setUseCustomLinkParams(bool value);
|
|
|
|
const QString& customCompileParams();
|
|
|
|
void setCustomCompileParams(const QString& value);
|
|
|
|
const QString& customLinkParams();
|
|
|
|
void setCustomLinkParams(const QString& value);
|
|
|
|
bool autoAddCharsetParams();
|
|
|
|
void setAutoAddCharsetParams(bool value);
|
|
|
|
|
|
|
|
CompilerOptionList& options();
|
|
|
|
|
2021-04-15 21:32:45 +08:00
|
|
|
//Converts options to and from memory format
|
|
|
|
QByteArray iniOptions() const;
|
|
|
|
void setIniOptions(const QByteArray& value);
|
|
|
|
|
2021-04-17 14:52:47 +08:00
|
|
|
//load hard defines
|
|
|
|
void setDefines();
|
|
|
|
|
2021-04-15 11:18:14 +08:00
|
|
|
private:
|
|
|
|
int charToValue(char valueChar);
|
|
|
|
|
|
|
|
// Initialization
|
|
|
|
void setExecutables();
|
2021-04-17 14:52:47 +08:00
|
|
|
void setDirectories(const QString& folder);
|
2021-04-15 11:18:14 +08:00
|
|
|
void setUserInput();
|
|
|
|
void setOptions();
|
|
|
|
|
2021-04-17 14:52:47 +08:00
|
|
|
QString findProgramInBinDirs(const QString name);
|
|
|
|
|
2021-04-15 11:18:14 +08:00
|
|
|
QByteArray getCompilerOutput(const QString& binDir, const QString& binFile,
|
|
|
|
const QStringList& arguments);
|
2021-04-13 22:17:18 +08:00
|
|
|
private:
|
|
|
|
// Executables, most are hardcoded
|
2021-04-17 14:52:47 +08:00
|
|
|
QString mCCompiler;
|
|
|
|
QString mCppCompiler;
|
|
|
|
QString mMake;
|
|
|
|
QString mDebugger;
|
|
|
|
QString mProfiler;
|
|
|
|
QString mResourceCompiler;
|
2021-04-13 22:17:18 +08:00
|
|
|
|
|
|
|
// Directories, mostly hardcoded too
|
|
|
|
QStringList mBinDirs;
|
|
|
|
QStringList mCIncludeDirs;
|
2021-04-15 11:18:14 +08:00
|
|
|
QStringList mCppIncludeDirs;
|
2021-04-13 22:17:18 +08:00
|
|
|
QStringList mLibDirs;
|
|
|
|
|
|
|
|
// Misc. properties
|
|
|
|
QString mDumpMachine; // "x86_64-w64-mingw32", "mingw32" etc
|
|
|
|
QString mVersion; // "4.7.1"
|
|
|
|
QString mType; // "TDM-GCC", "MinGW"
|
|
|
|
QString mName; // "TDM-GCC 4.7.1 Release"
|
2021-04-15 11:18:14 +08:00
|
|
|
QStringList mDefines; // list of predefined constants
|
2021-04-13 22:17:18 +08:00
|
|
|
QString mTarget; // 'X86_64' / 'i686'
|
|
|
|
|
|
|
|
// User settings
|
2021-04-15 11:18:14 +08:00
|
|
|
bool mUseCustomCompileParams;
|
|
|
|
bool mUseCustomLinkParams;
|
2021-04-13 22:17:18 +08:00
|
|
|
QString mCustomCompileParams;
|
|
|
|
QString mCustomLinkParams;
|
2021-04-15 11:18:14 +08:00
|
|
|
bool mAutoAddCharsetParams;
|
2021-04-13 22:17:18 +08:00
|
|
|
|
|
|
|
// Options
|
2021-04-15 11:18:14 +08:00
|
|
|
CompilerOptionList mOptions;
|
2021-04-13 22:17:18 +08:00
|
|
|
};
|
|
|
|
|
2021-04-15 21:32:45 +08:00
|
|
|
typedef std::shared_ptr<CompilerSet> PCompilerSet;
|
|
|
|
typedef std::vector<PCompilerSet> CompilerSetList;
|
|
|
|
|
|
|
|
class CompilerSets {
|
|
|
|
public:
|
|
|
|
explicit CompilerSets(Settings* settings);
|
|
|
|
|
|
|
|
PCompilerSet addSet(const CompilerSet& set);
|
|
|
|
PCompilerSet addSet(const QString& folder=QString());
|
|
|
|
|
|
|
|
void addSets(const QString& folder);
|
|
|
|
void clearSets();
|
|
|
|
void findSets();
|
|
|
|
void saveSets();
|
|
|
|
void loadSets();
|
2021-04-18 11:41:41 +08:00
|
|
|
void saveDefaultIndex();
|
2021-04-16 22:04:48 +08:00
|
|
|
void deleteSet(int index);
|
2021-07-23 13:22:05 +08:00
|
|
|
void saveSet(int index);
|
2021-04-15 21:32:45 +08:00
|
|
|
//properties
|
|
|
|
CompilerSetList& list();
|
|
|
|
int size() const;
|
|
|
|
int defaultIndex() const;
|
|
|
|
void setDefaultIndex(int value);
|
2021-04-16 22:04:48 +08:00
|
|
|
PCompilerSet defaultSet();
|
2021-04-15 21:32:45 +08:00
|
|
|
private:
|
2021-04-17 14:52:47 +08:00
|
|
|
void savePath(const QString& name, const QString& path);
|
|
|
|
void savePathList(const QString& name, const QStringList& pathList);
|
2021-07-23 13:22:05 +08:00
|
|
|
|
2021-04-17 14:52:47 +08:00
|
|
|
QString loadPath(const QString& name);
|
|
|
|
void loadPathList(const QString& name, QStringList& list);
|
2021-04-15 21:32:45 +08:00
|
|
|
PCompilerSet loadSet(int index);
|
|
|
|
CompilerSetList mList;
|
|
|
|
int mDefaultIndex;
|
|
|
|
Settings* mSettings;
|
|
|
|
};
|
|
|
|
|
2021-04-08 10:29:21 +08:00
|
|
|
public:
|
2021-04-13 22:17:18 +08:00
|
|
|
explicit Settings(const QString& filename);
|
|
|
|
explicit Settings(Settings&& settings) = delete;
|
|
|
|
explicit Settings(const Settings& settings) = delete;
|
2021-06-12 22:36:23 +08:00
|
|
|
~Settings();
|
2021-04-08 10:29:21 +08:00
|
|
|
|
2021-04-13 22:17:18 +08:00
|
|
|
Settings& operator= (const Settings& settings) = delete;
|
|
|
|
Settings& operator= (const Settings&& settings) = delete;
|
2021-06-07 11:02:03 +08:00
|
|
|
void beginGroup(const QString& group);
|
|
|
|
void endGroup();
|
|
|
|
void saveValue(const QString& group, const QString &key, const QVariant &value);
|
|
|
|
void saveValue(const QString &key, const QVariant &value);
|
|
|
|
QVariant value(const QString& group, const QString &key, const QVariant& defaultValue);
|
|
|
|
QVariant value(const QString &key, const QVariant& defaultValue);
|
2021-04-13 11:23:37 +08:00
|
|
|
|
|
|
|
Dirs& dirs();
|
|
|
|
Editor& editor();
|
2021-04-15 21:32:45 +08:00
|
|
|
CompilerSets& compilerSets();
|
2021-06-18 21:48:40 +08:00
|
|
|
Environment& environment();
|
2021-07-01 19:44:38 +08:00
|
|
|
Executor& executor();
|
2021-06-17 10:39:46 +08:00
|
|
|
QString filename() const;
|
|
|
|
|
2021-04-08 10:29:21 +08:00
|
|
|
private:
|
2021-06-17 10:39:46 +08:00
|
|
|
QString mFilename;
|
2021-04-08 10:29:21 +08:00
|
|
|
QSettings mSettings;
|
2021-04-13 11:23:37 +08:00
|
|
|
Dirs mDirs;
|
|
|
|
Editor mEditor;
|
2021-06-18 21:48:40 +08:00
|
|
|
Environment mEnvironment;
|
2021-04-15 21:32:45 +08:00
|
|
|
CompilerSets mCompilerSets;
|
2021-07-01 19:44:38 +08:00
|
|
|
Executor mExecutor;
|
2021-04-08 10:29:21 +08:00
|
|
|
};
|
|
|
|
|
2021-04-13 11:23:37 +08:00
|
|
|
|
2021-04-08 10:29:21 +08:00
|
|
|
extern Settings* pSettings;
|
|
|
|
|
|
|
|
#endif // SETTINGS_H
|