finish: redesign compiler command line arguments
This commit is contained in:
parent
58b7c55cd6
commit
086dfd0865
|
@ -385,7 +385,6 @@ FORMS += \
|
||||||
settingsdialog/executorgeneralwidget.ui \
|
settingsdialog/executorgeneralwidget.ui \
|
||||||
settingsdialog/settingsdialog.ui \
|
settingsdialog/settingsdialog.ui \
|
||||||
widgets/custommakefileinfodialog.ui \
|
widgets/custommakefileinfodialog.ui \
|
||||||
widgets/compileargumentswidget.ui \
|
|
||||||
widgets/filepropertiesdialog.ui \
|
widgets/filepropertiesdialog.ui \
|
||||||
widgets/infomessagebox.ui \
|
widgets/infomessagebox.ui \
|
||||||
widgets/newclassdialog.ui \
|
widgets/newclassdialog.ui \
|
||||||
|
@ -456,40 +455,40 @@ RESOURCES += \
|
||||||
RC_ICONS = images/devcpp.ico images/associations/c.ico images/associations/cpp.ico images/associations/dev.ico images/associations/c.ico images/associations/cpp.ico images/associations/h.ico images/associations/hpp.ico
|
RC_ICONS = images/devcpp.ico images/associations/c.ico images/associations/cpp.ico images/associations/dev.ico images/associations/c.ico images/associations/cpp.ico images/associations/h.ico images/associations/hpp.ico
|
||||||
|
|
||||||
# fixed lrelease.prf
|
# fixed lrelease.prf
|
||||||
#qtPrepareTool(QMAKE_LRELEASE, lrelease)
|
qtPrepareTool(QMAKE_LRELEASE, lrelease)
|
||||||
|
|
||||||
#isEmpty(LRELEASE_DIR): LRELEASE_DIR = .qm
|
isEmpty(LRELEASE_DIR): LRELEASE_DIR = .qm
|
||||||
#isEmpty(QM_FILES_RESOURCE_PREFIX): QM_FILES_RESOURCE_PREFIX = i18n
|
isEmpty(QM_FILES_RESOURCE_PREFIX): QM_FILES_RESOURCE_PREFIX = i18n
|
||||||
|
|
||||||
#lrelease.name = lrelease
|
lrelease.name = lrelease
|
||||||
#lrelease.input = TRANSLATIONS EXTRA_TRANSLATIONS
|
lrelease.input = TRANSLATIONS EXTRA_TRANSLATIONS
|
||||||
#lrelease.output = $$LRELEASE_DIR/${QMAKE_FILE_IN_BASE}.qm
|
lrelease.output = $$LRELEASE_DIR/${QMAKE_FILE_IN_BASE}.qm
|
||||||
#lrelease.commands = $$QMAKE_LRELEASE ${QMAKE_FILE_IN} $$QMAKE_LRELEASE_FLAGS -qm ${QMAKE_FILE_OUT}
|
lrelease.commands = $$QMAKE_LRELEASE ${QMAKE_FILE_IN} $$QMAKE_LRELEASE_FLAGS -qm ${QMAKE_FILE_OUT}
|
||||||
#silent: lrelease.commands = @echo lrelease ${QMAKE_FILE_IN} && $$lrelease.commands
|
silent: lrelease.commands = @echo lrelease ${QMAKE_FILE_IN} && $$lrelease.commands
|
||||||
#lrelease.CONFIG = no_link target_predeps
|
lrelease.CONFIG = no_link target_predeps
|
||||||
#QMAKE_EXTRA_COMPILERS += lrelease
|
QMAKE_EXTRA_COMPILERS += lrelease
|
||||||
|
|
||||||
#all_translations = $$TRANSLATIONS $$EXTRA_TRANSLATIONS
|
all_translations = $$TRANSLATIONS $$EXTRA_TRANSLATIONS
|
||||||
#for (translation, all_translations) {
|
for (translation, all_translations) {
|
||||||
# # mirrors $$LRELEASE_DIR/${QMAKE_FILE_IN_BASE}.qm above
|
# mirrors $$LRELEASE_DIR/${QMAKE_FILE_IN_BASE}.qm above
|
||||||
# translation = $$basename(translation)
|
translation = $$basename(translation)
|
||||||
# QM_FILES += $$OUT_PWD/$$LRELEASE_DIR/$$replace(translation, \\..*$, .qm)
|
QM_FILES += $$OUT_PWD/$$LRELEASE_DIR/$$replace(translation, \\..*$, .qm)
|
||||||
#}
|
}
|
||||||
|
|
||||||
#qmake_qm_files.files = $$QM_FILES
|
qmake_qm_files.files = $$QM_FILES
|
||||||
#qmake_qm_files.base = $$OUT_PWD/$$LRELEASE_DIR
|
qmake_qm_files.base = $$OUT_PWD/$$LRELEASE_DIR
|
||||||
#qmake_qm_files.prefix = $$QM_FILES_RESOURCE_PREFIX
|
qmake_qm_files.prefix = $$QM_FILES_RESOURCE_PREFIX
|
||||||
|
|
||||||
#iconsets_files.files += $$files(resources/iconsets/*.svg, true)
|
iconsets_files.files += $$files(resources/iconsets/*.svg, true)
|
||||||
#iconsets_files.files += $$files(resources/iconsets/*.json, true)
|
iconsets_files.files += $$files(resources/iconsets/*.json, true)
|
||||||
|
|
||||||
#theme_files.files += $$files(themes/*.json, false)
|
theme_files.files += $$files(themes/*.json, false)
|
||||||
#theme_files.files += $$files(themes/*.png, false)
|
theme_files.files += $$files(themes/*.png, false)
|
||||||
|
|
||||||
#colorscheme_files.files += $$files(colorschemes/*.scheme, false)
|
colorscheme_files.files += $$files(colorschemes/*.scheme, false)
|
||||||
#colorscheme_files.prefix = /colorschemes
|
colorscheme_files.prefix = /colorschemes
|
||||||
|
|
||||||
#RESOURCES += qmake_qm_files
|
RESOURCES += qmake_qm_files
|
||||||
#RESOURCES += iconsets_files
|
RESOURCES += iconsets_files
|
||||||
#RESOURCES += theme_files
|
RESOURCES += theme_files
|
||||||
#RESOURCES += colorscheme_files
|
RESOURCES += colorscheme_files
|
||||||
|
|
|
@ -341,15 +341,20 @@ QString Compiler::getCCompileArguments(bool checkSyntax)
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<QString, QString> compileOptions;
|
QMap<QString, QString> compileOptions;
|
||||||
if (mProject) {
|
if (mProject && !mProject->options().compilerOptions.isEmpty()) {
|
||||||
compileOptions = mProject->options().compilerOptions;
|
compileOptions = mProject->options().compilerOptions;
|
||||||
} else {
|
} else {
|
||||||
compileOptions = compilerSet()->compileOptions();
|
compileOptions = compilerSet()->compileOptions();
|
||||||
}
|
}
|
||||||
foreach (const QString& key, compilerSet()->compileOptions()) {
|
foreach (const QString& key, compileOptions.keys()) {
|
||||||
PCompilerOption pOption = CompilerInfoManager::getCompilerOption(compilerSet()->CCompiler(), key);
|
if (compileOptions[key]=="")
|
||||||
|
continue;
|
||||||
|
PCompilerOption pOption = CompilerInfoManager::getCompilerOption(compilerSet()->compilerType(), key);
|
||||||
if (pOption && pOption->isC && !pOption->isLinker) {
|
if (pOption && pOption->isC && !pOption->isLinker) {
|
||||||
result += " " + pOption->setting + compilerSet()->getCompileOptionValue(key);
|
if (pOption->choices.isEmpty())
|
||||||
|
result += " " + pOption->setting;
|
||||||
|
else
|
||||||
|
result += " " + pOption->setting + compilerSet()->getCompileOptionValue(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -374,18 +379,22 @@ QString Compiler::getCppCompileArguments(bool checkSyntax)
|
||||||
result += " -fsyntax-only";
|
result += " -fsyntax-only";
|
||||||
}
|
}
|
||||||
QMap<QString, QString> compileOptions;
|
QMap<QString, QString> compileOptions;
|
||||||
if (mProject) {
|
if (mProject && !mProject->options().compilerOptions.isEmpty()) {
|
||||||
compileOptions = mProject->options().compilerOptions;
|
compileOptions = mProject->options().compilerOptions;
|
||||||
} else {
|
} else {
|
||||||
compileOptions = compilerSet()->compileOptions();
|
compileOptions = compilerSet()->compileOptions();
|
||||||
}
|
}
|
||||||
foreach (const QString& key, compilerSet()->compileOptions()) {
|
foreach (const QString& key, compileOptions.keys()) {
|
||||||
PCompilerOption pOption = CompilerInfoManager::getCompilerOption(compilerSet()->CCompiler(), key);
|
if (compileOptions[key]=="")
|
||||||
|
continue;
|
||||||
|
PCompilerOption pOption = CompilerInfoManager::getCompilerOption(compilerSet()->compilerType(), key);
|
||||||
if (pOption && pOption->isCpp && !pOption->isLinker) {
|
if (pOption && pOption->isCpp && !pOption->isLinker) {
|
||||||
result += " " + pOption->setting + compilerSet()->getCompileOptionValue(key);
|
if (pOption->choices.isEmpty())
|
||||||
|
result += " " + pOption->setting;
|
||||||
|
else
|
||||||
|
result += " " + pOption->setting + compilerSet()->getCompileOptionValue(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compilerSet()->useCustomCompileParams() && !compilerSet()->customCompileParams().isEmpty()) {
|
if (compilerSet()->useCustomCompileParams() && !compilerSet()->customCompileParams().isEmpty()) {
|
||||||
result += " "+ parseMacros(compilerSet()->customCompileParams());
|
result += " "+ parseMacros(compilerSet()->customCompileParams());
|
||||||
}
|
}
|
||||||
|
@ -478,18 +487,24 @@ QString Compiler::getLibraryArguments(FileType fileType)
|
||||||
//add compiler set link options
|
//add compiler set link options
|
||||||
//options like "-static" must be added after "-lxxx"
|
//options like "-static" must be added after "-lxxx"
|
||||||
QMap<QString, QString> compileOptions;
|
QMap<QString, QString> compileOptions;
|
||||||
if (mProject) {
|
if (mProject && !mProject->options().compilerOptions.isEmpty()) {
|
||||||
compileOptions = mProject->options().compilerOptions;
|
compileOptions = mProject->options().compilerOptions;
|
||||||
} else {
|
} else {
|
||||||
compileOptions = compilerSet()->compileOptions();
|
compileOptions = compilerSet()->compileOptions();
|
||||||
}
|
}
|
||||||
foreach (const QString& key, compilerSet()->compileOptions()) {
|
foreach (const QString& key, compileOptions.keys()) {
|
||||||
PCompilerOption pOption = CompilerInfoManager::getCompilerOption(compilerSet()->CCompiler(), key);
|
if (compileOptions[key]=="")
|
||||||
if (pOption->isLinker) {
|
continue;
|
||||||
result += " " + pOption->setting + compilerSet()->getCompileOptionValue(key);
|
PCompilerOption pOption = CompilerInfoManager::getCompilerOption(compilerSet()->compilerType(), key);
|
||||||
|
if (pOption && pOption->isLinker) {
|
||||||
|
if (pOption->choices.isEmpty())
|
||||||
|
result += " " + pOption->setting;
|
||||||
|
else
|
||||||
|
result += " " + pOption->setting + compilerSet()->getCompileOptionValue(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Add global compiler linker extras
|
// Add global compiler linker extras
|
||||||
if (compilerSet()->useCustomLinkParams() && !compilerSet()->customLinkParams().isEmpty()) {
|
if (compilerSet()->useCustomLinkParams() && !compilerSet()->customLinkParams().isEmpty()) {
|
||||||
result += " "+compilerSet()->customLinkParams();
|
result += " "+compilerSet()->customLinkParams();
|
||||||
|
|
|
@ -4,12 +4,12 @@
|
||||||
CompilerInfo::CompilerInfo(const QString &name):
|
CompilerInfo::CompilerInfo(const QString &name):
|
||||||
mName(name)
|
mName(name)
|
||||||
{
|
{
|
||||||
prepareCompilerOptions();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
const CompilerOptionMap &CompilerInfo::compilerOptions() const
|
const QList<PCompilerOption> &CompilerInfo::compilerOptions() const
|
||||||
{
|
{
|
||||||
return mCompilerOptions;
|
return mCompilerOptionList;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &CompilerInfo::name() const
|
const QString &CompilerInfo::name() const
|
||||||
|
@ -22,6 +22,11 @@ PCompilerOption CompilerInfo::getCompilerOption(const QString &key) const
|
||||||
return mCompilerOptions.value(key,PCompilerOption());
|
return mCompilerOptions.value(key,PCompilerOption());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CompilerInfo::hasCompilerOption(const QString &key) const
|
||||||
|
{
|
||||||
|
return mCompilerOptions.contains(key);
|
||||||
|
}
|
||||||
|
|
||||||
void CompilerInfo::addOption(const QString &key, const QString &name, const QString section, bool isC, bool isCpp, bool isLinker, const QString &setting, const CompileOptionChoiceList &choices)
|
void CompilerInfo::addOption(const QString &key, const QString &name, const QString section, bool isC, bool isCpp, bool isLinker, const QString &setting, const CompileOptionChoiceList &choices)
|
||||||
{
|
{
|
||||||
PCompilerOption pOption = std::make_shared<CompilerOption>();
|
PCompilerOption pOption = std::make_shared<CompilerOption>();
|
||||||
|
@ -34,6 +39,12 @@ void CompilerInfo::addOption(const QString &key, const QString &name, const QStr
|
||||||
pOption->setting= setting;
|
pOption->setting= setting;
|
||||||
pOption->choices = choices;
|
pOption->choices = choices;
|
||||||
mCompilerOptions.insert(key,pOption);
|
mCompilerOptions.insert(key,pOption);
|
||||||
|
mCompilerOptionList.append(pOption);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CompilerInfo::init()
|
||||||
|
{
|
||||||
|
prepareCompilerOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompilerInfo::prepareCompilerOptions()
|
void CompilerInfo::prepareCompilerOptions()
|
||||||
|
@ -73,8 +84,8 @@ void CompilerInfo::prepareCompilerOptions()
|
||||||
sl.append(QPair<QString,QString>("K8 Rev.E","k8-sse3"));
|
sl.append(QPair<QString,QString>("K8 Rev.E","k8-sse3"));
|
||||||
sl.append(QPair<QString,QString>("K10","barcelona"));
|
sl.append(QPair<QString,QString>("K10","barcelona"));
|
||||||
sl.append(QPair<QString,QString>("Bulldozer","bdver1"));
|
sl.append(QPair<QString,QString>("Bulldozer","bdver1"));
|
||||||
addOption("gcc_cmd_opt_arch", QObject::tr("Optimize for the following machine (-march)"), groupName, true, true, false, "-march=", sl);
|
addOption(CC_CMD_OPT_ARCH, QObject::tr("Optimize for the following machine (-march)"), groupName, true, true, false, "-march=", sl);
|
||||||
addOption("gcc_cmd_opt_tune", QObject::tr("Optimize less, while maintaining full compatibility (-tune)"), groupName, true, true, false, "-mtune=", sl);
|
addOption(CC_CMD_OPT_TUNE, QObject::tr("Optimize less, while maintaining full compatibility (-tune)"), groupName, true, true, false, "-mtune=", sl);
|
||||||
|
|
||||||
// Enable use of the specific instructions
|
// Enable use of the specific instructions
|
||||||
sl.clear();
|
sl.clear();
|
||||||
|
@ -93,7 +104,7 @@ void CompilerInfo::prepareCompilerOptions()
|
||||||
sl.append(QPair<QString,QString>("FMA4","fma4"));
|
sl.append(QPair<QString,QString>("FMA4","fma4"));
|
||||||
sl.append(QPair<QString,QString>("XOP","xop"));
|
sl.append(QPair<QString,QString>("XOP","xop"));
|
||||||
sl.append(QPair<QString,QString>("AES","aes"));
|
sl.append(QPair<QString,QString>("AES","aes"));
|
||||||
addOption("gcc_cmd_opt_instruction",QObject::tr("Enable use of specific instructions (-mx)"), groupName, true, true, false, "-m", sl);
|
addOption(CC_CMD_OPT_INSTRUCTION,QObject::tr("Enable use of specific instructions (-mx)"), groupName, true, true, false, "-m", sl);
|
||||||
|
|
||||||
// Optimization
|
// Optimization
|
||||||
sl.clear();
|
sl.clear();
|
||||||
|
@ -103,13 +114,13 @@ void CompilerInfo::prepareCompilerOptions()
|
||||||
sl.append(QPair<QString,QString>("Highest (fast)","fast"));
|
sl.append(QPair<QString,QString>("Highest (fast)","fast"));
|
||||||
sl.append(QPair<QString,QString>("Size (s)","s"));
|
sl.append(QPair<QString,QString>("Size (s)","s"));
|
||||||
sl.append(QPair<QString,QString>("Debug (g)","g"));
|
sl.append(QPair<QString,QString>("Debug (g)","g"));
|
||||||
addOption("gcc_cmd_opt_optimize", QObject::tr("Optimization level (-Ox)"), groupName, true, true, false, "-O", sl);
|
addOption(CC_CMD_OPT_OPTIMIZE, QObject::tr("Optimization level (-Ox)"), groupName, true, true, false, "-O", sl);
|
||||||
|
|
||||||
// 32bit/64bit
|
// 32bit/64bit
|
||||||
sl.clear();
|
sl.clear();
|
||||||
sl.append(QPair<QString,QString>("32bit","32"));
|
sl.append(QPair<QString,QString>("32bit","32"));
|
||||||
sl.append(QPair<QString,QString>("64bit","64"));
|
sl.append(QPair<QString,QString>("64bit","64"));
|
||||||
addOption("gcc_cmd_opt_pointer_size", QObject::tr("Compile with the following pointer size (-mx)"), groupName, true, true, true, "-m", sl);
|
addOption(CC_CMD_OPT_POINTER_SIZE, QObject::tr("Compile with the following pointer size (-mx)"), groupName, true, true, true, "-m", sl);
|
||||||
|
|
||||||
// Language Standards
|
// Language Standards
|
||||||
sl.clear();
|
sl.clear();
|
||||||
|
@ -131,38 +142,44 @@ void CompilerInfo::prepareCompilerOptions()
|
||||||
sl.append(QPair<QString,QString>("GNU C++14","gnu++14"));
|
sl.append(QPair<QString,QString>("GNU C++14","gnu++14"));
|
||||||
sl.append(QPair<QString,QString>("GNU C++17","gnu++17"));
|
sl.append(QPair<QString,QString>("GNU C++17","gnu++17"));
|
||||||
sl.append(QPair<QString,QString>("GNU C++20","gnu++2a"));
|
sl.append(QPair<QString,QString>("GNU C++20","gnu++2a"));
|
||||||
addOption("gcc_cmd_opt_std", QObject::tr("Language standard (-std)"), groupName, true, true, false, "-std=", sl);
|
addOption(CC_CMD_OPT_STD, QObject::tr("Language standard (-std)"), groupName, true, true, false, "-std=", sl);
|
||||||
|
|
||||||
// Warnings
|
// Warnings
|
||||||
groupName = QObject::tr("Warnings");
|
groupName = QObject::tr("Warnings");
|
||||||
addOption("gcc_cmd_opt_inhibit_all_warning", QObject::tr("Inhibit all warning messages (-w)"), groupName, true, true, false, "-w");
|
addOption(CC_CMD_OPT_INHIBIT_ALL_WARNING, QObject::tr("Inhibit all warning messages (-w)"), groupName, true, true, false, "-w");
|
||||||
addOption("gcc_cmd_opt_warning_all",QObject::tr("Show most warnings (-Wall)"), groupName, true, true, false, "-Wall");
|
addOption(CC_CMD_OPT_WARNING_ALL,QObject::tr("Show most warnings (-Wall)"), groupName, true, true, false, "-Wall");
|
||||||
addOption("gcc_cmd_opt_warning_extra",QObject::tr("Show some more warnings (-Wextra)"), groupName, true, true, false, "-Wextra");
|
addOption(CC_CMD_OPT_WARNING_EXTRA,QObject::tr("Show some more warnings (-Wextra)"), groupName, true, true, false, "-Wextra");
|
||||||
addOption("gcc_cmd_opt_check_iso_conformance", QObject::tr("Check ISO C/C++/C++0x conformance (-pedantic)"), groupName, true, true, false, "-pedantic");
|
addOption(CC_CMD_OPT_CHECK_ISO_CONFORMANCE, QObject::tr("Check ISO C/C++/C++0x conformance (-pedantic)"), groupName, true, true, false, "-pedantic");
|
||||||
addOption("gcc_cmd_opt_syntax_only", QObject::tr("Only check the code for syntax errors (-fsyntax-only)"), groupName, true, true, false, "-fsyntax-only");
|
addOption(CC_CMD_OPT_SYNTAX_ONLY, QObject::tr("Only check the code for syntax errors (-fsyntax-only)"), groupName, true, true, false, "-fsyntax-only");
|
||||||
addOption("gcc_cmd_opt_warning_as_error", QObject::tr("Make all warnings into errors (-Werror)"), groupName, true, true, false, "-Werror");
|
addOption(CC_CMD_OPT_WARNING_AS_ERROR, QObject::tr("Make all warnings into errors (-Werror)"), groupName, true, true, false, "-Werror");
|
||||||
addOption("gcc_cmd_opt_abort_on_error", QObject::tr("Abort compilation on first error (-Wfatal-errors)"), groupName, true, true, false, "-Wfatal-errors");
|
addOption(CC_CMD_OPT_ABORT_ON_ERROR , QObject::tr("Abort compilation on first error (-Wfatal-errors)"), groupName, true, true, false, "-Wfatal-errors");
|
||||||
|
|
||||||
// Profile
|
// Profile
|
||||||
groupName = QObject::tr("Profile");
|
groupName = QObject::tr("Profile");
|
||||||
addOption("gcc_cmd_opt_profile_info",QObject::tr("Generate profiling info for analysis (-pg)"), groupName, true, true, true, "-pg");
|
addOption(CC_CMD_OPT_PROFILE_INFO, QObject::tr("Generate profiling info for analysis (-pg)"), groupName, true, true, true, "-pg");
|
||||||
|
|
||||||
// Linker
|
// Linker
|
||||||
groupName = QObject::tr("Linker");
|
groupName = QObject::tr("Linker");
|
||||||
addOption("linker_cmd_opt_link_objc", QObject::tr("Link an Objective C program (-lobjc)"), groupName, false, false, true, "-lobjc");
|
addOption(LINK_CMD_OPT_LINK_OBJC, QObject::tr("Link an Objective C program (-lobjc)"), groupName, false, false, true, "-lobjc");
|
||||||
addOption("linker_cmd_opt_no_link_stdlib",QObject::tr("Do not use standard system libraries (-nostdlib)"), groupName, false, false, true, "-nostdlib");
|
addOption(LINK_CMD_OPT_NO_LINK_STDLIB,QObject::tr("Do not use standard system libraries (-nostdlib)"), groupName, false, false, true, "-nostdlib");
|
||||||
addOption("linker_cmd_opt_no_console", QObject::tr("Do not create a console window (-mwindows)"), groupName,false, false, true, "-mwindows");
|
addOption(LINK_CMD_OPT_NO_CONSOLE, QObject::tr("Do not create a console window (-mwindows)"), groupName,false, false, true, "-mwindows");
|
||||||
addOption("linker_cmd_opt_strip_exe", QObject::tr("Strip executable (-s)"), groupName, false, false, true, "-s");
|
addOption(LINK_CMD_OPT_STRIP_EXE, QObject::tr("Strip executable (-s)"), groupName, false, false, true, "-s");
|
||||||
addOption("cc_cmd_opt_debug_info", QObject::tr("Generate debugging information (-g3)"), groupName, true, true, false, "-g3");
|
addOption(CC_CMD_OPT_DEBUG_INFO, QObject::tr("Generate debugging information (-g3)"), groupName, true, true, false, "-g3");
|
||||||
|
|
||||||
// Output
|
// Output
|
||||||
groupName = QObject::tr("Output");
|
groupName = QObject::tr("Output");
|
||||||
addOption("cc_cmd_opt_verbose_asm", QObject::tr("Put comments in generated assembly code (-fverbose-asm)"), groupName, true, true, false, "-fverbose-asm");
|
addOption(CC_CMD_OPT_VERBOSE_ASM, QObject::tr("Put comments in generated assembly code (-fverbose-asm)"), groupName, true, true, false, "-fverbose-asm");
|
||||||
addOption("cc_cmd_opt_only_gen_asm_code", QObject::tr("Do not assemble, compile and generate the assemble code (-S)"), groupName, true, true, false, "-S");
|
addOption(CC_CMD_OPT_ONLY_GEN_ASM_CODE, QObject::tr("Do not assemble, compile and generate the assemble code (-S)"), groupName, true, true, false, "-S");
|
||||||
addOption("cc_cmd_opt_use_pipe", QObject::tr("Use pipes instead of temporary files during compilation (-pipe)"), groupName, true, true, false, "-pipe");
|
addOption(CC_CMD_OPT_USE_PIPE, QObject::tr("Use pipes instead of temporary files during compilation (-pipe)"), groupName, true, true, false, "-pipe");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CompilerInfoManager::CompilerInfoManager()
|
||||||
|
{
|
||||||
|
mInfos.insert(COMPILER_CLANG, std::make_shared<ClangCompilerInfo>());
|
||||||
|
mInfos.insert(COMPILER_GCC, std::make_shared<GCCCompilerInfo>());
|
||||||
|
}
|
||||||
|
|
||||||
PCompilerInfo CompilerInfoManager::getInfo(const QString &compilerType)
|
PCompilerInfo CompilerInfoManager::getInfo(const QString &compilerType)
|
||||||
{
|
{
|
||||||
return getInstance()->mInfos.value(compilerType,PCompilerInfo());
|
return getInstance()->mInfos.value(compilerType,PCompilerInfo());
|
||||||
|
@ -173,7 +190,7 @@ bool CompilerInfoManager::hasCompilerOption(const QString &compilerType, const Q
|
||||||
PCompilerInfo pInfo = getInfo(compilerType);
|
PCompilerInfo pInfo = getInfo(compilerType);
|
||||||
if (!pInfo)
|
if (!pInfo)
|
||||||
return false;
|
return false;
|
||||||
return pInfo->compilerOptions().contains(optKey);
|
return pInfo->hasCompilerOption(optKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
PCompilerOption CompilerInfoManager::getCompilerOption(const QString &compilerType, const QString &optKey)
|
PCompilerOption CompilerInfoManager::getCompilerOption(const QString &compilerType, const QString &optKey)
|
||||||
|
@ -181,14 +198,14 @@ PCompilerOption CompilerInfoManager::getCompilerOption(const QString &compilerTy
|
||||||
PCompilerInfo pInfo = getInfo(compilerType);
|
PCompilerInfo pInfo = getInfo(compilerType);
|
||||||
if (!pInfo)
|
if (!pInfo)
|
||||||
return PCompilerOption();
|
return PCompilerOption();
|
||||||
return pInfo->compilerOptions().value(optKey,PCompilerOption());
|
return pInfo->getCompilerOption(optKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
CompilerOptionMap CompilerInfoManager::getCompilerOptions(const QString &compilerType)
|
QList<PCompilerOption> CompilerInfoManager::getCompilerOptions(const QString &compilerType)
|
||||||
{
|
{
|
||||||
PCompilerInfo pInfo = getInfo(compilerType);
|
PCompilerInfo pInfo = getInfo(compilerType);
|
||||||
if (!pInfo)
|
if (!pInfo)
|
||||||
return CompilerOptionMap();
|
return QList<PCompilerOption>();
|
||||||
return pInfo->compilerOptions();
|
return pInfo->compilerOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -200,6 +217,8 @@ bool CompilerInfoManager::supportCovertingCharset(const QString &compilerType)
|
||||||
return pInfo->supportConvertingCharset();
|
return pInfo->supportConvertingCharset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PCompilerInfoManager CompilerInfoManager::instance;
|
||||||
|
|
||||||
PCompilerInfoManager CompilerInfoManager::getInstance()
|
PCompilerInfoManager CompilerInfoManager::getInstance()
|
||||||
{
|
{
|
||||||
if (!instance) {
|
if (!instance) {
|
||||||
|
@ -215,7 +234,6 @@ void CompilerInfoManager::addInfo(const QString &name, PCompilerInfo info)
|
||||||
|
|
||||||
ClangCompilerInfo::ClangCompilerInfo():CompilerInfo(COMPILER_CLANG)
|
ClangCompilerInfo::ClangCompilerInfo():CompilerInfo(COMPILER_CLANG)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClangCompilerInfo::supportConvertingCharset()
|
bool ClangCompilerInfo::supportConvertingCharset()
|
||||||
|
@ -225,7 +243,6 @@ bool ClangCompilerInfo::supportConvertingCharset()
|
||||||
|
|
||||||
GCCCompilerInfo::GCCCompilerInfo():CompilerInfo(COMPILER_GCC)
|
GCCCompilerInfo::GCCCompilerInfo():CompilerInfo(COMPILER_GCC)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GCCCompilerInfo::supportConvertingCharset()
|
bool GCCCompilerInfo::supportConvertingCharset()
|
||||||
|
|
|
@ -56,15 +56,16 @@ typedef struct {
|
||||||
|
|
||||||
using PCompilerOption = std::shared_ptr<CompilerOption>;
|
using PCompilerOption = std::shared_ptr<CompilerOption>;
|
||||||
|
|
||||||
using CompilerOptionMap=QMap<QString,std::shared_ptr<CompilerOption>>;
|
using CompilerOptionMap=QMap<QString,PCompilerOption>;
|
||||||
|
|
||||||
class CompilerInfo
|
class CompilerInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CompilerInfo(const QString& name);
|
CompilerInfo(const QString& name);
|
||||||
const CompilerOptionMap &compilerOptions() const;
|
const QList<PCompilerOption> &compilerOptions() const;
|
||||||
const QString &name() const;
|
const QString &name() const;
|
||||||
PCompilerOption getCompilerOption(const QString& key) const;
|
PCompilerOption getCompilerOption(const QString& key) const;
|
||||||
|
bool hasCompilerOption(const QString& key) const;
|
||||||
|
|
||||||
virtual bool supportConvertingCharset()=0;
|
virtual bool supportConvertingCharset()=0;
|
||||||
protected:
|
protected:
|
||||||
|
@ -76,10 +77,11 @@ protected:
|
||||||
bool isLinker,
|
bool isLinker,
|
||||||
const QString& setting,
|
const QString& setting,
|
||||||
const CompileOptionChoiceList& choices = CompileOptionChoiceList());
|
const CompileOptionChoiceList& choices = CompileOptionChoiceList());
|
||||||
|
void init();
|
||||||
virtual void prepareCompilerOptions();
|
virtual void prepareCompilerOptions();
|
||||||
protected:
|
protected:
|
||||||
CompilerOptionMap mCompilerOptions;
|
CompilerOptionMap mCompilerOptions;
|
||||||
|
QList<PCompilerOption> mCompilerOptionList;
|
||||||
QString mName;
|
QString mName;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -90,15 +92,15 @@ using PCompilerInfoManager = std::shared_ptr<CompilerInfoManager>;
|
||||||
|
|
||||||
class CompilerInfoManager {
|
class CompilerInfoManager {
|
||||||
public:
|
public:
|
||||||
|
CompilerInfoManager();
|
||||||
static PCompilerInfo getInfo(const QString& compilerType);
|
static PCompilerInfo getInfo(const QString& compilerType);
|
||||||
static bool hasCompilerOption(const QString& compilerType, const QString& optKey);
|
static bool hasCompilerOption(const QString& compilerType, const QString& optKey);
|
||||||
static PCompilerOption getCompilerOption(const QString& compilerType, const QString& optKey);
|
static PCompilerOption getCompilerOption(const QString& compilerType, const QString& optKey);
|
||||||
static CompilerOptionMap getCompilerOptions(const QString& compilerType);
|
static QList<PCompilerOption> getCompilerOptions(const QString& compilerType);
|
||||||
static bool supportCovertingCharset(const QString& compilerType);
|
static bool supportCovertingCharset(const QString& compilerType);
|
||||||
static PCompilerInfoManager getInstance();
|
static PCompilerInfoManager getInstance();
|
||||||
static void addInfo(const QString& name, PCompilerInfo info);
|
static void addInfo(const QString& name, PCompilerInfo info);
|
||||||
private:
|
private:
|
||||||
CompilerInfoManager();
|
|
||||||
static PCompilerInfoManager instance;
|
static PCompilerInfoManager instance;
|
||||||
QMap<QString,PCompilerInfo> mInfos;
|
QMap<QString,PCompilerInfo> mInfos;
|
||||||
};
|
};
|
||||||
|
@ -108,21 +110,13 @@ extern PCompilerInfoManager pCompilerInfoManager;
|
||||||
class ClangCompilerInfo: public CompilerInfo{
|
class ClangCompilerInfo: public CompilerInfo{
|
||||||
public:
|
public:
|
||||||
ClangCompilerInfo();
|
ClangCompilerInfo();
|
||||||
|
bool supportConvertingCharset() override;
|
||||||
// CompilerInfo interface
|
|
||||||
protected:
|
|
||||||
void prepareCompilerOptions() Q_DECL_OVERRIDE;
|
|
||||||
bool supportConvertingCharset() Q_DECL_OVERRIDE;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class GCCCompilerInfo: public CompilerInfo{
|
class GCCCompilerInfo: public CompilerInfo{
|
||||||
public:
|
public:
|
||||||
GCCCompilerInfo();
|
GCCCompilerInfo();
|
||||||
|
bool supportConvertingCharset() override;
|
||||||
// CompilerInfo interface
|
|
||||||
protected:
|
|
||||||
void prepareCompilerOptions() Q_DECL_OVERRIDE;
|
|
||||||
bool supportConvertingCharset() Q_DECL_OVERRIDE;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1649,8 +1649,8 @@ void MainWindow::debug()
|
||||||
switch(getCompileTarget()) {
|
switch(getCompileTarget()) {
|
||||||
case CompileTarget::Project:
|
case CompileTarget::Project:
|
||||||
// Check if we enabled proper options
|
// Check if we enabled proper options
|
||||||
debugEnabled = mProject->getCompilerOption("-g3")!='0';
|
debugEnabled = mProject->getCompileOption(CC_CMD_OPT_DEBUG_INFO) == COMPILER_OPTION_ON;
|
||||||
stripEnabled = mProject->getCompilerOption("-s")!='0';
|
stripEnabled = mProject->getCompileOption(LINK_CMD_OPT_STRIP_EXE) == COMPILER_OPTION_ON;
|
||||||
// Ask the user if he wants to enable debugging...
|
// Ask the user if he wants to enable debugging...
|
||||||
if (((!debugEnabled) || stripEnabled) &&
|
if (((!debugEnabled) || stripEnabled) &&
|
||||||
(QMessageBox::question(this,
|
(QMessageBox::question(this,
|
||||||
|
@ -1658,8 +1658,8 @@ void MainWindow::debug()
|
||||||
tr("You have not enabled debugging info (-g3) and/or stripped it from the executable (-s) in Compiler Options.<BR /><BR />Do you want to correct this now?")
|
tr("You have not enabled debugging info (-g3) and/or stripped it from the executable (-s) in Compiler Options.<BR /><BR />Do you want to correct this now?")
|
||||||
) == QMessageBox::Yes)) {
|
) == QMessageBox::Yes)) {
|
||||||
// Enable debugging, disable stripping
|
// Enable debugging, disable stripping
|
||||||
mProject->setCompilerOption("-g3",'1');
|
mProject->setCompileOption(CC_CMD_OPT_DEBUG_INFO,COMPILER_OPTION_ON);
|
||||||
mProject->setCompilerOption("-s",'0');
|
mProject->setCompileOption(LINK_CMD_OPT_STRIP_EXE,"");
|
||||||
|
|
||||||
// Save changes to compiler set
|
// Save changes to compiler set
|
||||||
mProject->saveOptions();
|
mProject->saveOptions();
|
||||||
|
@ -1739,8 +1739,8 @@ void MainWindow::debug()
|
||||||
break;
|
break;
|
||||||
case CompileTarget::File: {
|
case CompileTarget::File: {
|
||||||
// Check if we enabled proper options
|
// Check if we enabled proper options
|
||||||
debugEnabled = compilerSet->getOptionValue("-g3")!='0';
|
debugEnabled = compilerSet->getCompileOptionValue(CC_CMD_OPT_DEBUG_INFO) == COMPILER_OPTION_ON;
|
||||||
stripEnabled = compilerSet->getOptionValue("-s")!='0';
|
stripEnabled = compilerSet->getCompileOptionValue(LINK_CMD_OPT_STRIP_EXE) == COMPILER_OPTION_ON;
|
||||||
// Ask the user if he wants to enable debugging...
|
// Ask the user if he wants to enable debugging...
|
||||||
if (((!debugEnabled) || stripEnabled) &&
|
if (((!debugEnabled) || stripEnabled) &&
|
||||||
(QMessageBox::question(this,
|
(QMessageBox::question(this,
|
||||||
|
@ -1748,8 +1748,8 @@ void MainWindow::debug()
|
||||||
tr("You have not enabled debugging info (-g3) and/or stripped it from the executable (-s) in Compiler Options.<BR /><BR />Do you want to correct this now?")
|
tr("You have not enabled debugging info (-g3) and/or stripped it from the executable (-s) in Compiler Options.<BR /><BR />Do you want to correct this now?")
|
||||||
) == QMessageBox::Yes)) {
|
) == QMessageBox::Yes)) {
|
||||||
// Enable debugging, disable stripping
|
// Enable debugging, disable stripping
|
||||||
compilerSet->setOption("-g3",'1');
|
compilerSet->setCompileOption(CC_CMD_OPT_DEBUG_INFO,COMPILER_OPTION_ON);
|
||||||
compilerSet->setOption("-s",'0');
|
compilerSet->unsetCompileOption(LINK_CMD_OPT_STRIP_EXE);
|
||||||
|
|
||||||
// Save changes to compiler set
|
// Save changes to compiler set
|
||||||
pSettings->compilerSets().saveSet(pSettings->compilerSets().defaultIndex());
|
pSettings->compilerSets().saveSet(pSettings->compilerSets().defaultIndex());
|
||||||
|
|
|
@ -726,6 +726,11 @@ bool Project::setCompileOption(const QString &key, const QString &value)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString Project::getCompileOption(const QString &key) const
|
||||||
|
{
|
||||||
|
return mOptions.compilerOptions.value(key,"");
|
||||||
|
}
|
||||||
|
|
||||||
void Project::updateFolders()
|
void Project::updateFolders()
|
||||||
{
|
{
|
||||||
mFolders.clear();
|
mFolders.clear();
|
||||||
|
|
|
@ -212,6 +212,7 @@ public:
|
||||||
void associateEditorToUnit(Editor* editor, PProjectUnit unit);
|
void associateEditorToUnit(Editor* editor, PProjectUnit unit);
|
||||||
// bool setCompileOption(const QString &key, int valIndex);
|
// bool setCompileOption(const QString &key, int valIndex);
|
||||||
bool setCompileOption(const QString &key, const QString &value);
|
bool setCompileOption(const QString &key, const QString &value);
|
||||||
|
QString getCompileOption(const QString &key) const;
|
||||||
|
|
||||||
void updateFolders();
|
void updateFolders();
|
||||||
void updateNodeIndexes();
|
void updateNodeIndexes();
|
||||||
|
|
|
@ -1527,6 +1527,11 @@ void Settings::CompilerSet::unsetCompileOption(const QString &key)
|
||||||
mCompileOptions.remove(key);
|
mCompileOptions.remove(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Settings::CompilerSet::setCompileOptions(const QMap<QString, QString> options)
|
||||||
|
{
|
||||||
|
mCompileOptions=options;
|
||||||
|
}
|
||||||
|
|
||||||
QString Settings::CompilerSet::getCompileOptionValue(const QString &key)
|
QString Settings::CompilerSet::getCompileOptionValue(const QString &key)
|
||||||
{
|
{
|
||||||
return mCompileOptions.value(key,QString());
|
return mCompileOptions.value(key,QString());
|
||||||
|
@ -2721,19 +2726,15 @@ Settings::PCompilerSet Settings::CompilerSets::loadSet(int index)
|
||||||
pSet->setResourceCompiler(loadPath("windres"));
|
pSet->setResourceCompiler(loadPath("windres"));
|
||||||
pSet->setProfiler(loadPath("profiler"));
|
pSet->setProfiler(loadPath("profiler"));
|
||||||
|
|
||||||
// Save option string
|
pSet->setDumpMachine(mSettings->mSettings.value("DumpMachine").toString());
|
||||||
QByteArray iniOptions = mSettings->mSettings.value("Options","").toByteArray();
|
pSet->setVersion(mSettings->mSettings.value("Version").toString());
|
||||||
if (!iniOptions.isEmpty())
|
pSet->setType(mSettings->mSettings.value("Type").toString());
|
||||||
pSet->setIniOptions(iniOptions);
|
pSet->setName(mSettings->mSettings.value("Name").toString());
|
||||||
else {
|
pSet->setTarget(mSettings->mSettings.value("Target").toString());
|
||||||
foreach (const QString &optionKey, mSettings->mSettings.allKeys()) {
|
pSet->setCompilerType(mSettings->mSettings.value("CompilerType").toString());
|
||||||
if (CompilerInfoManager::hasCompilerOption(pSet->compilerType(),optionKey)) {
|
pSet->setCompilerSetType(mSettings->mSettings.value("CompilerSetType").toInt());
|
||||||
pSet->setCompileOption(optionKey, mSettings->mSettings.value(optionKey).toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save extra 'general' options
|
// Load extra 'general' options
|
||||||
pSet->setUseCustomCompileParams(mSettings->mSettings.value("useCustomCompileParams", false).toBool());
|
pSet->setUseCustomCompileParams(mSettings->mSettings.value("useCustomCompileParams", false).toBool());
|
||||||
pSet->setCustomCompileParams(mSettings->mSettings.value("customCompileParams").toString());
|
pSet->setCustomCompileParams(mSettings->mSettings.value("customCompileParams").toString());
|
||||||
pSet->setUseCustomLinkParams(mSettings->mSettings.value("useCustomLinkParams", false).toBool());
|
pSet->setUseCustomLinkParams(mSettings->mSettings.value("useCustomLinkParams", false).toBool());
|
||||||
|
@ -2745,13 +2746,17 @@ Settings::PCompilerSet Settings::CompilerSets::loadSet(int index)
|
||||||
pSet->setExecCharset(ENCODING_SYSTEM_DEFAULT);
|
pSet->setExecCharset(ENCODING_SYSTEM_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
pSet->setDumpMachine(mSettings->mSettings.value("DumpMachine").toString());
|
// Load options
|
||||||
pSet->setVersion(mSettings->mSettings.value("Version").toString());
|
QByteArray iniOptions = mSettings->mSettings.value("Options","").toByteArray();
|
||||||
pSet->setType(mSettings->mSettings.value("Type").toString());
|
if (!iniOptions.isEmpty())
|
||||||
pSet->setName(mSettings->mSettings.value("Name").toString());
|
pSet->setIniOptions(iniOptions);
|
||||||
pSet->setTarget(mSettings->mSettings.value("Target").toString());
|
else {
|
||||||
pSet->setCompilerType(mSettings->mSettings.value("CompilerType").toString());
|
foreach (const QString &optionKey, mSettings->mSettings.allKeys()) {
|
||||||
pSet->setCompilerSetType(mSettings->mSettings.value("CompilerSetType").toInt());
|
if (CompilerInfoManager::hasCompilerOption(pSet->compilerType(),optionKey)) {
|
||||||
|
pSet->setCompileOption(optionKey, mSettings->mSettings.value(optionKey).toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Paths
|
// Paths
|
||||||
loadPathList("Bins",pSet->binDirs());
|
loadPathList("Bins",pSet->binDirs());
|
||||||
|
@ -2773,37 +2778,36 @@ void Settings::CompilerSets::prepareCompatibleIndex()
|
||||||
{
|
{
|
||||||
|
|
||||||
//old settings compatibility, don't reorder, add or remove items
|
//old settings compatibility, don't reorder, add or remove items
|
||||||
mCompilerCompatibleIndex.append("gcc_cmd_opt_ansi");
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_ANSI);
|
||||||
mCompilerCompatibleIndex.append("gcc_cmd_opt_no_asm");
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_NO_ASM "gcc_cmd_opt_no_asm");
|
||||||
mCompilerCompatibleIndex.append("gcc_cmd_opt_traditional_cpp");
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_TRADITIONAL_CPP);
|
||||||
|
|
||||||
mCompilerCompatibleIndex.append("gcc_cmd_opt_arch");
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_ARCH);
|
||||||
mCompilerCompatibleIndex.append("gcc_cmd_opt_tune");
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_TUNE);
|
||||||
mCompilerCompatibleIndex.append("gcc_cmd_opt_instruction");
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_INSTRUCTION);
|
||||||
mCompilerCompatibleIndex.append("gcc_cmd_opt_optimize");
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_OPTIMIZE);
|
||||||
mCompilerCompatibleIndex.append("gcc_cmd_opt_pointer_size");
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_POINTER_SIZE);
|
||||||
mCompilerCompatibleIndex.append("gcc_cmd_opt_std");
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_STD);
|
||||||
|
|
||||||
mCompilerCompatibleIndex.append("gcc_cmd_opt_inhibit_all_warning");
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_INHIBIT_ALL_WARNING);
|
||||||
mCompilerCompatibleIndex.append("gcc_cmd_opt_warning_all");
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_WARNING_ALL);
|
||||||
mCompilerCompatibleIndex.append("gcc_cmd_opt_warning_extra");
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_WARNING_EXTRA);
|
||||||
mCompilerCompatibleIndex.append("gcc_cmd_opt_check_iso_conformance");
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_CHECK_ISO_CONFORMANCE);
|
||||||
mCompilerCompatibleIndex.append("gcc_cmd_opt_syntax_only");
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_SYNTAX_ONLY);
|
||||||
mCompilerCompatibleIndex.append("gcc_cmd_opt_warning_as_error");
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_WARNING_AS_ERROR);
|
||||||
mCompilerCompatibleIndex.append("gcc_cmd_opt_abort_on_error");
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_ABORT_ON_ERROR);
|
||||||
|
|
||||||
mCompilerCompatibleIndex.append("gcc_cmd_opt_profile_info");
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_PROFILE_INFO);
|
||||||
|
|
||||||
mCompilerCompatibleIndex.append("linker_cmd_opt_link_objc");
|
mCompilerCompatibleIndex.append(LINK_CMD_OPT_LINK_OBJC);
|
||||||
mCompilerCompatibleIndex.append("linker_cmd_opt_no_link_stdlib");
|
mCompilerCompatibleIndex.append(LINK_CMD_OPT_NO_LINK_STDLIB);
|
||||||
mCompilerCompatibleIndex.append("linker_cmd_opt_no_console");
|
mCompilerCompatibleIndex.append(LINK_CMD_OPT_NO_CONSOLE);
|
||||||
mCompilerCompatibleIndex.append("linker_cmd_opt_strip_exe");
|
mCompilerCompatibleIndex.append(LINK_CMD_OPT_STRIP_EXE);
|
||||||
mCompilerCompatibleIndex.append("cc_cmd_opt_debug_info");
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_DEBUG_INFO);
|
||||||
|
|
||||||
mCompilerCompatibleIndex.append("cc_cmd_opt_verbose_asm");
|
|
||||||
mCompilerCompatibleIndex.append("cc_cmd_opt_only_gen_asm_code");
|
|
||||||
mCompilerCompatibleIndex.append("cc_cmd_opt_use_pipe");
|
|
||||||
|
|
||||||
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_VERBOSE_ASM);
|
||||||
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_ONLY_GEN_ASM_CODE);
|
||||||
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_USE_PIPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Settings::CompilerSets::getKeyFromCompilerCompatibleIndex(int idx) const
|
QString Settings::CompilerSets::getKeyFromCompilerCompatibleIndex(int idx) const
|
||||||
|
|
|
@ -1164,6 +1164,7 @@ public:
|
||||||
bool setCompileOption(const QString& key, int valIndex);
|
bool setCompileOption(const QString& key, int valIndex);
|
||||||
bool setCompileOption(const QString& key, const QString& value);
|
bool setCompileOption(const QString& key, const QString& value);
|
||||||
void unsetCompileOption(const QString& key);
|
void unsetCompileOption(const QString& key);
|
||||||
|
void setCompileOptions(const QMap<QString, QString> options);
|
||||||
|
|
||||||
QString getCompileOptionValue(const QString& key);
|
QString getCompileOptionValue(const QString& key);
|
||||||
|
|
||||||
|
@ -1220,7 +1221,7 @@ public:
|
||||||
bool autoAddCharsetParams() const;
|
bool autoAddCharsetParams() const;
|
||||||
void setAutoAddCharsetParams(bool value);
|
void setAutoAddCharsetParams(bool value);
|
||||||
|
|
||||||
//Converts options to and from memory format
|
//Converts options to and from memory format ( for old settings compatibility)
|
||||||
void setIniOptions(const QByteArray& value);
|
void setIniOptions(const QByteArray& value);
|
||||||
|
|
||||||
//load hard defines
|
//load hard defines
|
||||||
|
|
|
@ -69,61 +69,6 @@ void CompilerSetOptionWidget::init()
|
||||||
SettingsWidget::init();
|
SettingsWidget::init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetOptionTabs(Settings::PCompilerSet pSet,QTabWidget* pTab)
|
|
||||||
{
|
|
||||||
while (pTab->count()>0) {
|
|
||||||
QWidget* p=pTab->widget(0);
|
|
||||||
if (p!=nullptr) {
|
|
||||||
pTab->removeTab(0);
|
|
||||||
p->setParent(nullptr);
|
|
||||||
delete p;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (PCompilerOption pOption, pSettings->compilerSets().compilerOptions().values()) {
|
|
||||||
QWidget* pWidget = nullptr;
|
|
||||||
for (int i=0;i<pTab->count();i++) {
|
|
||||||
if (pOption->section == pTab->tabText(i)) {
|
|
||||||
pWidget = pTab->widget(i);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (pWidget == nullptr) {
|
|
||||||
pWidget = new QWidget();
|
|
||||||
pTab->addTab(pWidget,pOption->section);
|
|
||||||
pWidget->setLayout(new QGridLayout());
|
|
||||||
}
|
|
||||||
QGridLayout *pLayout = static_cast<QGridLayout*>(pWidget->layout());
|
|
||||||
int row = pLayout->rowCount();
|
|
||||||
QLabel* keyLabel = new QLabel(pOption->key,pWidget);
|
|
||||||
keyLabel->setVisible(false);
|
|
||||||
pLayout->addWidget(keyLabel,row,0);
|
|
||||||
if (pOption->choices.isEmpty()) {
|
|
||||||
QCheckBox* pCheckbox = new QCheckBox(pWidget);
|
|
||||||
pCheckbox->setText(pOption->name);
|
|
||||||
pCheckbox->setChecked(!pSet->getCompileOptionValue(pOption->key).isEmpty());
|
|
||||||
pLayout->addWidget(pCheckbox,row,1);
|
|
||||||
} else {
|
|
||||||
pLayout->addWidget(new QLabel(pOption->name,pWidget),row,1);
|
|
||||||
QComboBox* pCombo = new QComboBox(pWidget);
|
|
||||||
pCombo->addItem("","");
|
|
||||||
for (int i=0;i<pOption->choices.length();i++) {
|
|
||||||
const QPair<QString,QString> &choice = pOption->choices[i];
|
|
||||||
pCombo->addItem(choice.first,choice.second);
|
|
||||||
if (pSet->getCompileOptionValue(pOption->key) == choice.second)
|
|
||||||
pCombo->setCurrentIndex(i);
|
|
||||||
}
|
|
||||||
pLayout->addWidget(pCombo,row,2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (int i=0;i<pTab->count();i++) {
|
|
||||||
QWidget* pWidget = pTab->widget(i);
|
|
||||||
QGridLayout *pLayout = static_cast<QGridLayout*>(pWidget->layout());
|
|
||||||
int row = pLayout->rowCount();
|
|
||||||
QSpacerItem* horizontalSpacer = new QSpacerItem(10, 100, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
|
||||||
pLayout->addItem(horizontalSpacer,row,0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void loadCompilerSetSettings(Settings::PCompilerSet pSet, Ui::CompilerSetOptionWidget* ui) {
|
static void loadCompilerSetSettings(Settings::PCompilerSet pSet, Ui::CompilerSetOptionWidget* ui) {
|
||||||
ui->chkAutoAddCharset->setEnabled(pSet->compilerType() != COMPILER_CLANG);
|
ui->chkAutoAddCharset->setEnabled(pSet->compilerType() != COMPILER_CLANG);
|
||||||
|
@ -142,7 +87,8 @@ static void loadCompilerSetSettings(Settings::PCompilerSet pSet, Ui::CompilerSet
|
||||||
ui->chkAutoAddCharset->setChecked(pSet->autoAddCharsetParams());
|
ui->chkAutoAddCharset->setChecked(pSet->autoAddCharsetParams());
|
||||||
ui->chkStaticLink->setChecked(pSet->staticLink());
|
ui->chkStaticLink->setChecked(pSet->staticLink());
|
||||||
//rest tabs in the options widget
|
//rest tabs in the options widget
|
||||||
resetOptionTabs(pSet,ui->optionTabs);
|
|
||||||
|
ui->optionTabs->resetUI(pSet,pSet->compileOptions());
|
||||||
|
|
||||||
ui->txtCCompiler->setText(pSet->CCompiler());
|
ui->txtCCompiler->setText(pSet->CCompiler());
|
||||||
ui->txtCppCompiler->setText(pSet->cppCompiler());
|
ui->txtCppCompiler->setText(pSet->cppCompiler());
|
||||||
|
@ -260,35 +206,8 @@ void CompilerSetOptionWidget::saveCurrentCompilerSet()
|
||||||
}
|
}
|
||||||
|
|
||||||
//read values in the options widget
|
//read values in the options widget
|
||||||
QTabWidget* pTab = ui->optionTabs;
|
pSet->setCompileOptions(ui->optionTabs->arguments(false));
|
||||||
for (int i=0;i<pTab->count();i++) {
|
|
||||||
QString section = pTab->tabText(i);
|
|
||||||
QWidget* pWidget = pTab->widget(i);
|
|
||||||
QGridLayout* pLayout = static_cast<QGridLayout*>(pWidget->layout());
|
|
||||||
if (pLayout != nullptr) {
|
|
||||||
for (int j=1;j<pLayout->rowCount()-1;j++) {
|
|
||||||
QString key = static_cast<QLabel *>(pLayout->itemAtPosition(j,0)->widget())->text();
|
|
||||||
PCompilerOption pOption = pSettings->compilerSets().getCompilerOption(key);
|
|
||||||
if (!pOption)
|
|
||||||
continue;
|
|
||||||
if (pOption->choices.isEmpty()) {
|
|
||||||
QCheckBox* pCheckbox = static_cast<QCheckBox *>(pLayout->itemAtPosition(j,1)->widget());
|
|
||||||
if (pCheckbox->isChecked()) {
|
|
||||||
pSet->setCompileOption(key,"");
|
|
||||||
} else {
|
|
||||||
pSet->unsetCompileOption(key);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
QComboBox* pCombo = static_cast<QComboBox *>(pLayout->itemAtPosition(j,2)->widget());
|
|
||||||
if (!pCombo->currentData().toString().isEmpty()) {
|
|
||||||
pSet->setCompileOption(key,pCombo->currentData().toString());
|
|
||||||
} else {
|
|
||||||
pSet->unsetCompileOption(key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompilerSetOptionWidget::on_btnFindCompilers_pressed()
|
void CompilerSetOptionWidget::on_btnFindCompilers_pressed()
|
||||||
|
|
|
@ -198,7 +198,7 @@
|
||||||
<number>2</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="optionTabs">
|
<widget class="CompileArgumentsWidget" name="optionTabs">
|
||||||
<property name="documentMode">
|
<property name="documentMode">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
@ -455,6 +455,14 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>CompileArgumentsWidget</class>
|
||||||
|
<extends>QTabWidget</extends>
|
||||||
|
<header location="global">widgets/compileargumentswidget.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../icons.qrc"/>
|
<include location="../icons.qrc"/>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -39,67 +39,11 @@ void ProjectCompilerWidget::refreshOptions()
|
||||||
return;
|
return;
|
||||||
ui->chkAddCharset->setVisible(pSet->compilerType()!=COMPILER_CLANG);
|
ui->chkAddCharset->setVisible(pSet->compilerType()!=COMPILER_CLANG);
|
||||||
ui->chkAddCharset->setEnabled(pSet->compilerType()!=COMPILER_CLANG);
|
ui->chkAddCharset->setEnabled(pSet->compilerType()!=COMPILER_CLANG);
|
||||||
mOptions = pMainWindow->project().options().compilerOptions;
|
mOptions = pMainWindow->project()->options().compilerOptions;
|
||||||
if (mOptions.isEmpty())
|
if (mOptions.isEmpty())
|
||||||
mOptions = pSet->compileOptions();
|
mOptions = pSet->compileOptions();
|
||||||
QTabWidget* pTab = ui->tabOptions;
|
|
||||||
while (pTab->count()>0) {
|
|
||||||
QWidget* p=pTab->widget(0);
|
|
||||||
if (p!=nullptr) {
|
|
||||||
pTab->removeTab(0);
|
|
||||||
p->setParent(nullptr);
|
|
||||||
delete p;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int index=0; index< pSet->options().count();index++){
|
ui->tabOptions->resetUI(pSet,mOptions);
|
||||||
PCompilerOption pOption =pSet->options()[index];
|
|
||||||
QWidget* pWidget = nullptr;
|
|
||||||
for (int i=0;i<pTab->count();i++) {
|
|
||||||
if (pOption->section == pTab->tabText(i)) {
|
|
||||||
pWidget = pTab->widget(i);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (pWidget == nullptr) {
|
|
||||||
pWidget = new QWidget();
|
|
||||||
pTab->addTab(pWidget,pOption->section);
|
|
||||||
pWidget->setLayout(new QGridLayout());
|
|
||||||
}
|
|
||||||
QGridLayout *pLayout = static_cast<QGridLayout*>(pWidget->layout());
|
|
||||||
int row = pLayout->rowCount();
|
|
||||||
pLayout->addWidget(new QLabel(pOption->name),row,0);
|
|
||||||
QComboBox* pCombo = new QComboBox();
|
|
||||||
if (pOption->choices.count()>0) {
|
|
||||||
for (int i=0;i<pOption->choices.count();i++) {
|
|
||||||
QString choice = pOption->choices[i];
|
|
||||||
QStringList valueName=choice.split("=");
|
|
||||||
if (valueName.length()<2) {
|
|
||||||
pCombo->addItem("");
|
|
||||||
} else {
|
|
||||||
pCombo->addItem(valueName[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
pCombo->addItem(QObject::tr("No"));
|
|
||||||
pCombo->addItem(QObject::tr("Yes"));
|
|
||||||
}
|
|
||||||
int value;
|
|
||||||
if (index<mOptions.length()) {
|
|
||||||
value = pSet->charToValue(mOptions[index]);
|
|
||||||
} else {
|
|
||||||
value = pOption->value;
|
|
||||||
}
|
|
||||||
pCombo->setCurrentIndex(value);
|
|
||||||
pLayout->addWidget(pCombo,row,1);
|
|
||||||
}
|
|
||||||
for (int i=0;i<pTab->count();i++) {
|
|
||||||
QWidget* pWidget = pTab->widget(i);
|
|
||||||
QGridLayout *pLayout = static_cast<QGridLayout*>(pWidget->layout());
|
|
||||||
int row = pLayout->rowCount();
|
|
||||||
QSpacerItem* horizontalSpacer = new QSpacerItem(10, 100, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
|
||||||
pLayout->addItem(horizontalSpacer,row,0);
|
|
||||||
}
|
|
||||||
|
|
||||||
ui->chkStaticLink->setChecked(pSet->staticLink());
|
ui->chkStaticLink->setChecked(pSet->staticLink());
|
||||||
}
|
}
|
||||||
|
@ -118,29 +62,9 @@ void ProjectCompilerWidget::doSave()
|
||||||
Settings::PCompilerSet pSet = pSettings->compilerSets().getSet(ui->cbCompilerSet->currentIndex());
|
Settings::PCompilerSet pSet = pSettings->compilerSets().getSet(ui->cbCompilerSet->currentIndex());
|
||||||
if (!pSet)
|
if (!pSet)
|
||||||
return;
|
return;
|
||||||
//read values in the options widget
|
|
||||||
QTabWidget* pTab = ui->tabOptions;
|
|
||||||
mOptions.clear();
|
|
||||||
for (int i=0;i<pTab->count();i++) {
|
|
||||||
QString section = pTab->tabText(i);
|
|
||||||
QWidget* pWidget = pTab->widget(i);
|
|
||||||
QGridLayout* pLayout = static_cast<QGridLayout*>(pWidget->layout());
|
|
||||||
if (pLayout != nullptr) {
|
|
||||||
for (int j=1;j<pLayout->rowCount()-1;j++) {
|
|
||||||
QString name = static_cast<QLabel *>(pLayout->itemAtPosition(j,0)->widget())->text();
|
|
||||||
QComboBox* pCombo = static_cast<QComboBox *>(pLayout->itemAtPosition(j,1)->widget());
|
|
||||||
for (int index=0;index<pSet->options().count();index++) {
|
|
||||||
PCompilerOption pOption = pSet->options()[index];
|
|
||||||
if (pOption->section == section && pOption->name == name) {
|
|
||||||
char val = pSet->valueToChar( pCombo->currentIndex());
|
|
||||||
mOptions.append(val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pMainWindow->project()->setCompilerSet(ui->cbCompilerSet->currentIndex());
|
pMainWindow->project()->setCompilerSet(ui->cbCompilerSet->currentIndex());
|
||||||
pMainWindow->project()->options().compilerOptions = mOptions;
|
pMainWindow->project()->options().compilerOptions = ui->tabOptions->arguments(true);
|
||||||
if (pSet->compilerType()!=COMPILER_CLANG)
|
if (pSet->compilerType()!=COMPILER_CLANG)
|
||||||
pMainWindow->project()->options().addCharset = ui->chkAddCharset->isChecked();
|
pMainWindow->project()->options().addCharset = ui->chkAddCharset->isChecked();
|
||||||
pMainWindow->project()->options().staticLink = ui->chkStaticLink->isChecked();
|
pMainWindow->project()->options().staticLink = ui->chkStaticLink->isChecked();
|
||||||
|
|
|
@ -14,9 +14,6 @@
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="6" column="0" colspan="3">
|
|
||||||
<widget class="QWidget" name="widget" native="true"/>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
<item row="0" column="2">
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -30,21 +27,17 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="6" column="0" colspan="3">
|
||||||
|
<widget class="QWidget" name="widget" native="true"/>
|
||||||
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QComboBox" name="cbCompilerSet"/>
|
<widget class="QComboBox" name="cbCompilerSet"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0" colspan="3">
|
<item row="2" column="0" colspan="3">
|
||||||
<widget class="QTabWidget" name="tabOptions">
|
<widget class="QCheckBox" name="chkStaticLink">
|
||||||
<widget class="QWidget" name="tab">
|
<property name="text">
|
||||||
<attribute name="title">
|
<string>Statically link libraries</string>
|
||||||
<string>Tab 1</string>
|
</property>
|
||||||
</attribute>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="tab_2">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Tab 2</string>
|
|
||||||
</attribute>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
|
@ -54,20 +47,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>Customize (apply to this project only):</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0" colspan="3">
|
|
||||||
<widget class="QCheckBox" name="chkStaticLink">
|
|
||||||
<property name="text">
|
|
||||||
<string>Statically link libraries</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QCheckBox" name="chkAddCharset">
|
<widget class="QCheckBox" name="chkAddCharset">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -75,8 +54,30 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Customize (apply to this project only):</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0" colspan="3">
|
||||||
|
<widget class="CompileArgumentsWidget" name="tabOptions">
|
||||||
|
<property name="documentMode">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>CompileArgumentsWidget</class>
|
||||||
|
<extends>QTabWidget</extends>
|
||||||
|
<header location="global">widgets/compileargumentswidget.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
@ -1,26 +1,24 @@
|
||||||
#include "compileargumentswidget.h"
|
#include "compileargumentswidget.h"
|
||||||
#include "ui_compileargumentswidget.h"
|
|
||||||
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
#include <QGridLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
|
||||||
CompileArgumentsWidget::CompileArgumentsWidget(QWidget *parent) :
|
CompileArgumentsWidget::CompileArgumentsWidget(QWidget *parent) :
|
||||||
QWidget(parent),
|
QTabWidget(parent)
|
||||||
ui(new Ui::CompileArgumentsWidget)
|
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CompileArgumentsWidget::~CompileArgumentsWidget()
|
CompileArgumentsWidget::~CompileArgumentsWidget()
|
||||||
{
|
{
|
||||||
delete ui;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap<QString, QString> CompileArgumentsWidget::options() const
|
QMap<QString, QString> CompileArgumentsWidget::arguments( bool includeUnset) const
|
||||||
{
|
{
|
||||||
QMap
|
QMap<QString, QString> args;
|
||||||
QTabWidget* pTab = ui->tabArguments;
|
const QTabWidget* pTab = this;
|
||||||
for (int i=0;i<pTab->count();i++) {
|
for (int i=0;i<pTab->count();i++) {
|
||||||
QString section = pTab->tabText(i);
|
QString section = pTab->tabText(i);
|
||||||
QWidget* pWidget = pTab->widget(i);
|
QWidget* pWidget = pTab->widget(i);
|
||||||
|
@ -34,27 +32,33 @@ QMap<QString, QString> CompileArgumentsWidget::options() const
|
||||||
if (pOption->choices.isEmpty()) {
|
if (pOption->choices.isEmpty()) {
|
||||||
QCheckBox* pCheckbox = static_cast<QCheckBox *>(pLayout->itemAtPosition(j,1)->widget());
|
QCheckBox* pCheckbox = static_cast<QCheckBox *>(pLayout->itemAtPosition(j,1)->widget());
|
||||||
if (pCheckbox->isChecked()) {
|
if (pCheckbox->isChecked()) {
|
||||||
|
args.insert(key,COMPILER_OPTION_ON);
|
||||||
pSet->setCompileOption(key,"");
|
|
||||||
} else {
|
} else {
|
||||||
pSet->unsetCompileOption(key);
|
if (includeUnset)
|
||||||
|
args.insert(key,"");
|
||||||
|
else
|
||||||
|
args.remove(key);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
QComboBox* pCombo = static_cast<QComboBox *>(pLayout->itemAtPosition(j,2)->widget());
|
QComboBox* pCombo = static_cast<QComboBox *>(pLayout->itemAtPosition(j,2)->widget());
|
||||||
if (!pCombo->currentData().toString().isEmpty()) {
|
if (!pCombo->currentData().toString().isEmpty()) {
|
||||||
pSet->setCompileOption(key,pCombo->currentData().toString());
|
args.insert(key,pCombo->currentData().toString());
|
||||||
} else {
|
} else {
|
||||||
pSet->unsetCompileOption(key);
|
if (includeUnset)
|
||||||
|
args.insert(key,"");
|
||||||
|
else
|
||||||
|
args.remove(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return args;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompileArgumentsWidget::resetUI(Settings::PCompilerSet pSet, const QMap<QString,QString>& options)
|
void CompileArgumentsWidget::resetUI(Settings::PCompilerSet pSet, const QMap<QString,QString>& options)
|
||||||
{
|
{
|
||||||
QTabWidget* pTab = ui->tabArguments;
|
QTabWidget* pTab = this;
|
||||||
while (pTab->count()>0) {
|
while (pTab->count()>0) {
|
||||||
QWidget* p=pTab->widget(0);
|
QWidget* p=pTab->widget(0);
|
||||||
if (p!=nullptr) {
|
if (p!=nullptr) {
|
||||||
|
@ -67,7 +71,7 @@ void CompileArgumentsWidget::resetUI(Settings::PCompilerSet pSet, const QMap<QSt
|
||||||
return;
|
return;
|
||||||
mCompilerType = pSet->compilerType();
|
mCompilerType = pSet->compilerType();
|
||||||
|
|
||||||
foreach (PCompilerOption pOption, CompilerInfoManager::getCompilerOptions(mCompilerType).values()) {
|
foreach (PCompilerOption pOption, CompilerInfoManager::getCompilerOptions(mCompilerType)) {
|
||||||
QWidget* pWidget = nullptr;
|
QWidget* pWidget = nullptr;
|
||||||
for (int i=0;i<pTab->count();i++) {
|
for (int i=0;i<pTab->count();i++) {
|
||||||
if (pOption->section == pTab->tabText(i)) {
|
if (pOption->section == pTab->tabText(i)) {
|
||||||
|
|
|
@ -2,14 +2,14 @@
|
||||||
#define COMPILEARGUMENTSWIDGET_H
|
#define COMPILEARGUMENTSWIDGET_H
|
||||||
|
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QWidget>
|
#include <QTabWidget>
|
||||||
#include "../settings.h"
|
#include "../settings.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class CompileArgumentsWidget;
|
class CompileArgumentsWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
class CompileArgumentsWidget : public QWidget
|
class CompileArgumentsWidget : public QTabWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -17,12 +17,11 @@ public:
|
||||||
explicit CompileArgumentsWidget(QWidget *parent = nullptr);
|
explicit CompileArgumentsWidget(QWidget *parent = nullptr);
|
||||||
~CompileArgumentsWidget();
|
~CompileArgumentsWidget();
|
||||||
|
|
||||||
QMap<QString, QString> options() const;
|
QMap<QString, QString> arguments(bool includeUnset) const;
|
||||||
|
|
||||||
void resetUI(Settings::PCompilerSet pSet, const QMap<QString,QString>& options);
|
void resetUI(Settings::PCompilerSet pSet, const QMap<QString,QString>& options);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::CompileArgumentsWidget *ui;
|
|
||||||
QString mCompilerType;
|
QString mCompilerType;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>CompileArgumentsWidget</class>
|
|
||||||
<widget class="QWidget" name="CompileArgumentsWidget">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>400</width>
|
|
||||||
<height>300</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Form</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QTabWidget" name="tabArguments">
|
|
||||||
<widget class="QWidget" name="tab">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Tab 1</string>
|
|
||||||
</attribute>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="tab_2">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Tab 2</string>
|
|
||||||
</attribute>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
Loading…
Reference in New Issue