2021-12-26 23:18:28 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2021-04-08 10:29:21 +08:00
|
|
|
#include "settings.h"
|
2021-04-13 11:23:37 +08:00
|
|
|
#include <QApplication>
|
2021-04-08 10:29:21 +08:00
|
|
|
#include <QTextCodec>
|
2021-04-15 11:18:14 +08:00
|
|
|
#include <algorithm>
|
2021-04-13 11:23:37 +08:00
|
|
|
#include "utils.h"
|
2021-04-15 11:18:14 +08:00
|
|
|
#include <QDir>
|
|
|
|
#include "systemconsts.h"
|
2021-04-17 14:52:47 +08:00
|
|
|
#include <QDebug>
|
2021-06-24 16:05:19 +08:00
|
|
|
#include <QMessageBox>
|
2021-11-05 11:48:46 +08:00
|
|
|
#include <QStandardPaths>
|
2021-11-06 19:31:16 +08:00
|
|
|
#include <QScreen>
|
2021-12-16 19:14:14 +08:00
|
|
|
#include <QDesktopWidget>
|
2022-11-23 11:41:16 +08:00
|
|
|
#ifdef Q_OS_LINUX
|
|
|
|
#include <sys/sysinfo.h>
|
|
|
|
#endif
|
2021-04-15 11:18:14 +08:00
|
|
|
|
|
|
|
const char ValueToChar[28] = {'0', '1', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
|
|
|
|
'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
|
|
|
|
's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
|
|
|
|
|
2021-04-08 10:29:21 +08:00
|
|
|
Settings* pSettings;
|
|
|
|
|
2021-04-13 22:17:18 +08:00
|
|
|
Settings::Settings(const QString &filename):
|
2021-06-20 14:30:47 +08:00
|
|
|
mFilename(filename),
|
2021-04-13 22:17:18 +08:00
|
|
|
mSettings(filename,QSettings::IniFormat),
|
2021-04-13 11:23:37 +08:00
|
|
|
mDirs(this),
|
2021-04-15 21:32:45 +08:00
|
|
|
mEditor(this),
|
2021-06-18 21:48:40 +08:00
|
|
|
mEnvironment(this),
|
2021-07-01 19:44:38 +08:00
|
|
|
mCompilerSets(this),
|
2021-07-26 18:22:09 +08:00
|
|
|
mExecutor(this),
|
2021-08-02 10:08:25 +08:00
|
|
|
mDebugger(this),
|
2021-08-30 16:59:08 +08:00
|
|
|
mCodeCompletion(this),
|
2021-09-01 00:05:46 +08:00
|
|
|
mCodeFormatter(this),
|
2022-02-08 23:38:29 +08:00
|
|
|
mUI(this),
|
2023-02-16 22:27:04 +08:00
|
|
|
mVCS(this),
|
|
|
|
mExtTools(this)
|
2021-04-08 10:29:21 +08:00
|
|
|
{
|
2022-02-23 13:17:57 +08:00
|
|
|
//load();
|
2021-04-08 10:29:21 +08:00
|
|
|
}
|
|
|
|
|
2021-06-12 22:36:23 +08:00
|
|
|
Settings::~Settings()
|
|
|
|
{
|
|
|
|
mEditor.save();
|
|
|
|
}
|
|
|
|
|
2021-06-07 11:02:03 +08:00
|
|
|
void Settings::beginGroup(const QString &group)
|
|
|
|
{
|
2021-04-13 11:23:37 +08:00
|
|
|
mSettings.beginGroup(group);
|
2021-04-08 10:29:21 +08:00
|
|
|
}
|
|
|
|
|
2021-06-07 11:02:03 +08:00
|
|
|
void Settings::endGroup()
|
|
|
|
{
|
|
|
|
mSettings.endGroup();
|
|
|
|
}
|
|
|
|
|
2022-05-21 10:44:39 +08:00
|
|
|
void Settings::remove(const QString &key)
|
|
|
|
{
|
|
|
|
mSettings.remove(key);
|
|
|
|
}
|
|
|
|
|
2021-06-07 11:02:03 +08:00
|
|
|
void Settings::saveValue(const QString& group, const QString &key, const QVariant &value) {
|
2021-04-13 11:23:37 +08:00
|
|
|
mSettings.beginGroup(group);
|
|
|
|
auto act = finally([this] {
|
|
|
|
this->mSettings.endGroup();
|
|
|
|
});
|
2021-04-08 10:29:21 +08:00
|
|
|
mSettings.setValue(key,value);
|
|
|
|
}
|
|
|
|
|
2021-06-07 11:02:03 +08:00
|
|
|
void Settings::saveValue(const QString &key, const QVariant &value)
|
2021-04-17 14:52:47 +08:00
|
|
|
{
|
|
|
|
mSettings.setValue(key,value);
|
|
|
|
}
|
|
|
|
|
2021-06-07 11:02:03 +08:00
|
|
|
QVariant Settings::value(const QString &group, const QString &key, const QVariant &defaultValue)
|
|
|
|
{
|
2021-04-13 11:23:37 +08:00
|
|
|
mSettings.beginGroup(group);
|
|
|
|
auto act = finally([this] {
|
|
|
|
this->mSettings.endGroup();
|
|
|
|
});
|
2021-06-07 11:02:03 +08:00
|
|
|
return mSettings.value(key,defaultValue);
|
2021-04-08 10:29:21 +08:00
|
|
|
}
|
2021-04-13 11:23:37 +08:00
|
|
|
|
2021-06-07 11:02:03 +08:00
|
|
|
QVariant Settings::value(const QString &key, const QVariant &defaultValue)
|
2021-04-17 14:52:47 +08:00
|
|
|
{
|
2021-06-07 11:02:03 +08:00
|
|
|
return mSettings.value(key,defaultValue);
|
2021-04-17 14:52:47 +08:00
|
|
|
}
|
|
|
|
|
2021-08-07 14:08:51 +08:00
|
|
|
void Settings::load()
|
|
|
|
{
|
2021-08-30 18:07:55 +08:00
|
|
|
mCompilerSets.loadSets();
|
2021-08-07 14:08:51 +08:00
|
|
|
mEnvironment.load();
|
|
|
|
mEditor.load();
|
|
|
|
mExecutor.load();
|
|
|
|
mDebugger.load();
|
2021-08-30 16:59:08 +08:00
|
|
|
mCodeCompletion.load();
|
2021-09-01 00:05:46 +08:00
|
|
|
mCodeFormatter.load();
|
2021-09-02 16:35:28 +08:00
|
|
|
mUI.load();
|
2021-11-18 21:25:28 +08:00
|
|
|
mDirs.load();
|
2022-02-08 23:38:29 +08:00
|
|
|
mVCS.load();
|
2023-02-16 22:27:04 +08:00
|
|
|
mExtTools.load();
|
2021-08-07 14:08:51 +08:00
|
|
|
}
|
|
|
|
|
2021-04-13 11:23:37 +08:00
|
|
|
Settings::Dirs &Settings::dirs()
|
|
|
|
{
|
|
|
|
return mDirs;
|
|
|
|
}
|
|
|
|
|
|
|
|
Settings::Editor &Settings::editor()
|
|
|
|
{
|
|
|
|
return mEditor;
|
|
|
|
}
|
|
|
|
|
2021-04-15 21:32:45 +08:00
|
|
|
Settings::CompilerSets &Settings::compilerSets()
|
|
|
|
{
|
|
|
|
return mCompilerSets;
|
|
|
|
}
|
|
|
|
|
2021-06-18 21:48:40 +08:00
|
|
|
Settings::Environment &Settings::environment()
|
|
|
|
{
|
|
|
|
return mEnvironment;
|
|
|
|
}
|
|
|
|
|
2021-07-02 10:32:29 +08:00
|
|
|
Settings::Executor &Settings::executor()
|
|
|
|
{
|
|
|
|
return mExecutor;
|
|
|
|
}
|
|
|
|
|
2021-06-17 10:39:46 +08:00
|
|
|
QString Settings::filename() const
|
|
|
|
{
|
|
|
|
return mFilename;
|
|
|
|
}
|
|
|
|
|
2023-02-16 22:27:04 +08:00
|
|
|
Settings::ExtTools &Settings::extTools()
|
|
|
|
{
|
|
|
|
return mExtTools;
|
|
|
|
}
|
|
|
|
|
2021-08-30 16:59:08 +08:00
|
|
|
Settings::CodeCompletion& Settings::codeCompletion()
|
|
|
|
{
|
|
|
|
return mCodeCompletion;
|
|
|
|
}
|
|
|
|
|
2021-09-01 00:05:46 +08:00
|
|
|
Settings::CodeFormatter &Settings::codeFormatter()
|
|
|
|
{
|
|
|
|
return mCodeFormatter;
|
|
|
|
}
|
|
|
|
|
2021-09-02 16:35:28 +08:00
|
|
|
Settings::UI &Settings::ui()
|
|
|
|
{
|
|
|
|
return mUI;
|
|
|
|
}
|
|
|
|
|
2022-02-08 23:38:29 +08:00
|
|
|
Settings::VCS &Settings::vcs()
|
|
|
|
{
|
|
|
|
return mVCS;
|
|
|
|
}
|
|
|
|
|
2021-07-26 18:22:09 +08:00
|
|
|
Settings::Debugger& Settings::debugger()
|
2021-07-26 11:47:54 +08:00
|
|
|
{
|
|
|
|
return mDebugger;
|
|
|
|
}
|
|
|
|
|
2021-04-13 11:23:37 +08:00
|
|
|
Settings::Dirs::Dirs(Settings *settings):
|
|
|
|
_Base(settings, SETTING_DIRS)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-12-26 15:08:54 +08:00
|
|
|
QString Settings::Dirs::appDir() const
|
2021-04-13 11:23:37 +08:00
|
|
|
{
|
2021-04-17 14:52:47 +08:00
|
|
|
return QApplication::instance()->applicationDirPath();
|
2021-04-13 11:23:37 +08:00
|
|
|
}
|
|
|
|
|
2022-01-05 09:08:44 +08:00
|
|
|
QString Settings::Dirs::appResourceDir() const
|
2021-12-26 15:08:54 +08:00
|
|
|
{
|
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
return appDir();
|
|
|
|
#elif defined(Q_OS_LINUX)
|
2023-01-03 12:18:02 +08:00
|
|
|
// in AppImage PREFIX is not true, resolve from relative path
|
|
|
|
const static QString absoluteResourceDir(QDir(appDir()).absoluteFilePath("../share/" APP_NAME));
|
|
|
|
return absoluteResourceDir;
|
2022-05-23 01:34:38 +08:00
|
|
|
#elif defined(Q_OS_MACOS)
|
2022-05-28 21:19:29 +08:00
|
|
|
// return QApplication::instance()->applicationDirPath();
|
2022-05-23 01:34:38 +08:00
|
|
|
return "";
|
2022-01-05 09:08:44 +08:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2022-05-23 01:34:38 +08:00
|
|
|
|
2022-01-05 09:08:44 +08:00
|
|
|
QString Settings::Dirs::appLibexecDir() const
|
|
|
|
{
|
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
return appDir();
|
|
|
|
#elif defined(Q_OS_LINUX)
|
2023-01-03 12:18:02 +08:00
|
|
|
// in AppImage LIBEXECDIR is not true, resolve from relative path
|
|
|
|
const static QString relativeLibExecDir(QDir(PREFIX "/bin").relativeFilePath(LIBEXECDIR "/" APP_NAME));
|
|
|
|
const static QString absoluteLibExecDir(QDir(appDir()).absoluteFilePath(relativeLibExecDir));
|
|
|
|
return absoluteLibExecDir;
|
2022-05-23 01:34:38 +08:00
|
|
|
#elif defined(Q_OS_MACOS)
|
2022-05-28 21:19:29 +08:00
|
|
|
return QApplication::instance()->applicationDirPath();
|
2021-12-26 15:08:54 +08:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2021-09-16 12:03:10 +08:00
|
|
|
QString Settings::Dirs::projectDir() const
|
|
|
|
{
|
2021-11-18 21:25:28 +08:00
|
|
|
return mProjectDir;
|
2021-09-16 12:03:10 +08:00
|
|
|
}
|
|
|
|
|
2021-06-17 10:39:46 +08:00
|
|
|
QString Settings::Dirs::data(Settings::Dirs::DataType dataType) const
|
|
|
|
{
|
|
|
|
using DataType = Settings::Dirs::DataType;
|
2021-12-26 15:08:54 +08:00
|
|
|
QString dataDir = includeTrailingPathDelimiter(appDir())+"data";
|
2021-06-17 10:39:46 +08:00
|
|
|
switch (dataType) {
|
|
|
|
case DataType::None:
|
|
|
|
return dataDir;
|
2022-01-28 16:13:20 +08:00
|
|
|
case DataType::ColorScheme:
|
2021-06-18 22:57:19 +08:00
|
|
|
return ":/colorschemes/colorschemes";
|
2022-01-27 20:31:44 +08:00
|
|
|
case DataType::IconSet:
|
|
|
|
return ":/resources/iconsets";
|
2022-01-28 16:13:20 +08:00
|
|
|
case DataType::Theme:
|
|
|
|
return ":/themes";
|
2022-08-07 12:09:22 +08:00
|
|
|
case DataType::Template:
|
|
|
|
return includeTrailingPathDelimiter(appResourceDir()) + "templates";
|
2021-06-17 10:39:46 +08:00
|
|
|
}
|
2021-06-19 09:20:12 +08:00
|
|
|
return "";
|
2021-06-17 10:39:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
QString Settings::Dirs::config(Settings::Dirs::DataType dataType) const
|
|
|
|
{
|
|
|
|
using DataType = Settings::Dirs::DataType;
|
|
|
|
QFileInfo configFile(pSettings->filename());
|
|
|
|
QString configDir = configFile.path();
|
|
|
|
switch (dataType) {
|
|
|
|
case DataType::None:
|
|
|
|
return configDir;
|
2022-01-28 16:13:20 +08:00
|
|
|
case DataType::ColorScheme:
|
2021-06-17 10:39:46 +08:00
|
|
|
return includeTrailingPathDelimiter(configDir)+"scheme";
|
2022-01-27 12:08:57 +08:00
|
|
|
case DataType::IconSet:
|
|
|
|
return includeTrailingPathDelimiter(configDir)+"iconsets";
|
2022-01-28 16:13:20 +08:00
|
|
|
case DataType::Theme:
|
|
|
|
return includeTrailingPathDelimiter(configDir)+"themes";
|
2022-08-07 12:09:22 +08:00
|
|
|
case DataType::Template:
|
|
|
|
return includeTrailingPathDelimiter(configDir) + "templates";
|
2021-06-17 10:39:46 +08:00
|
|
|
}
|
2021-06-19 09:20:12 +08:00
|
|
|
return "";
|
2021-06-17 10:39:46 +08:00
|
|
|
}
|
|
|
|
|
2021-10-04 19:23:52 +08:00
|
|
|
QString Settings::Dirs::executable() const
|
|
|
|
{
|
2021-10-04 20:05:24 +08:00
|
|
|
QString s = QApplication::instance()->applicationFilePath();
|
|
|
|
s.replace("/",QDir::separator());
|
|
|
|
return s;
|
2021-10-04 19:23:52 +08:00
|
|
|
}
|
|
|
|
|
2021-06-07 11:02:03 +08:00
|
|
|
void Settings::Dirs::doSave()
|
|
|
|
{
|
2021-11-18 21:25:28 +08:00
|
|
|
saveValue("projectDir",mProjectDir);
|
2021-06-07 11:02:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Dirs::doLoad()
|
|
|
|
{
|
2021-11-18 21:25:28 +08:00
|
|
|
QString defaultProjectDir;
|
|
|
|
if (isGreenEdition()) {
|
2021-12-26 15:08:54 +08:00
|
|
|
defaultProjectDir = includeTrailingPathDelimiter(appDir()) + "projects";
|
2021-11-18 21:25:28 +08:00
|
|
|
} else {
|
|
|
|
defaultProjectDir = includeTrailingPathDelimiter(QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation)[0])
|
|
|
|
+ "projects";
|
|
|
|
}
|
|
|
|
mProjectDir = stringValue("projectDir",defaultProjectDir);
|
|
|
|
}
|
2021-06-07 11:02:03 +08:00
|
|
|
|
2021-11-18 21:25:28 +08:00
|
|
|
void Settings::Dirs::setProjectDir(const QString &newProjectDir)
|
|
|
|
{
|
|
|
|
mProjectDir = newProjectDir;
|
2021-06-07 11:02:03 +08:00
|
|
|
}
|
|
|
|
|
2021-04-13 11:23:37 +08:00
|
|
|
Settings::_Base::_Base(Settings *settings, const QString &groupName):
|
|
|
|
mSettings(settings),
|
|
|
|
mGroup(groupName)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-06-07 11:02:03 +08:00
|
|
|
void Settings::_Base::beginGroup()
|
|
|
|
{
|
|
|
|
mSettings->beginGroup(mGroup);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::_Base::endGroup()
|
|
|
|
{
|
|
|
|
mSettings->endGroup();
|
|
|
|
}
|
|
|
|
|
2022-05-21 10:44:39 +08:00
|
|
|
void Settings::_Base::remove(const QString &key)
|
|
|
|
{
|
|
|
|
mSettings->remove(key);
|
|
|
|
}
|
|
|
|
|
2021-06-07 11:02:03 +08:00
|
|
|
void Settings::_Base::saveValue(const QString &key, const QVariant &value)
|
2021-04-13 11:23:37 +08:00
|
|
|
{
|
2021-06-07 11:02:03 +08:00
|
|
|
mSettings->saveValue(key,value);
|
2021-04-13 11:23:37 +08:00
|
|
|
}
|
|
|
|
|
2022-11-22 15:14:05 +08:00
|
|
|
void Settings::_Base::saveValue(const QString &key, const QSet<QString> &set)
|
|
|
|
{
|
|
|
|
QStringList val;
|
|
|
|
foreach(const QString& s,set) {
|
|
|
|
val.append(s);
|
|
|
|
}
|
|
|
|
mSettings->saveValue(key,val);
|
|
|
|
}
|
|
|
|
|
2021-06-07 11:02:03 +08:00
|
|
|
QVariant Settings::_Base::value(const QString &key, const QVariant &defaultValue)
|
2021-04-13 11:23:37 +08:00
|
|
|
{
|
2021-06-07 11:02:03 +08:00
|
|
|
return mSettings->value(key,defaultValue);
|
2021-04-13 11:23:37 +08:00
|
|
|
}
|
|
|
|
|
2021-06-07 11:02:03 +08:00
|
|
|
bool Settings::_Base::boolValue(const QString &key, bool defaultValue)
|
2021-04-13 11:23:37 +08:00
|
|
|
{
|
2021-06-07 11:02:03 +08:00
|
|
|
return value(key,defaultValue).toBool();
|
|
|
|
}
|
|
|
|
|
2022-05-22 14:31:13 +08:00
|
|
|
QSize Settings::_Base::sizeValue(const QString &key)
|
|
|
|
{
|
|
|
|
return value(key,QSize()).toSize();
|
|
|
|
}
|
|
|
|
|
2021-06-07 11:02:03 +08:00
|
|
|
int Settings::_Base::intValue(const QString &key, int defaultValue)
|
|
|
|
{
|
|
|
|
return value(key,defaultValue).toInt();
|
|
|
|
}
|
|
|
|
|
2022-12-20 11:01:04 +08:00
|
|
|
double Settings::_Base::doubleValue(const QString &key, double defaultValue)
|
|
|
|
{
|
|
|
|
return value(key,defaultValue).toDouble();
|
|
|
|
}
|
|
|
|
|
2022-12-13 08:49:20 +08:00
|
|
|
unsigned int Settings::_Base::uintValue(const QString &key, unsigned int defaultValue)
|
|
|
|
{
|
|
|
|
return value(key,defaultValue).toUInt();
|
|
|
|
}
|
|
|
|
|
2021-08-01 23:24:37 +08:00
|
|
|
QStringList Settings::_Base::stringListValue(const QString &key, const QStringList &defaultValue)
|
|
|
|
{
|
|
|
|
return value(key,defaultValue).toStringList();
|
|
|
|
}
|
|
|
|
|
2022-11-22 15:14:05 +08:00
|
|
|
QSet<QString> Settings::_Base::stringSetValue(const QString &key)
|
|
|
|
{
|
|
|
|
QStringList lst=value(key,QStringList()).toStringList();
|
|
|
|
QSet<QString> result;
|
|
|
|
foreach(const QString& s, lst)
|
|
|
|
result.insert(s);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2021-06-07 11:02:03 +08:00
|
|
|
QColor Settings::_Base::colorValue(const QString &key, const QColor& defaultValue)
|
|
|
|
{
|
|
|
|
return value(key,defaultValue).value<QColor>();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString Settings::_Base::stringValue(const QString &key, const QString& defaultValue)
|
|
|
|
{
|
|
|
|
return value(key,defaultValue).toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::_Base::save()
|
|
|
|
{
|
|
|
|
beginGroup();
|
|
|
|
doSave();
|
|
|
|
endGroup();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::_Base::load()
|
|
|
|
{
|
|
|
|
beginGroup();
|
|
|
|
doLoad();
|
|
|
|
endGroup();
|
2021-04-13 11:23:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
Settings::Editor::Editor(Settings *settings): _Base(settings, SETTING_EDITOR)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
QByteArray Settings::Editor::defaultEncoding()
|
|
|
|
{
|
2021-06-07 11:02:03 +08:00
|
|
|
return mDefaultEncoding;
|
2021-04-13 11:23:37 +08:00
|
|
|
}
|
|
|
|
|
2021-06-07 11:02:03 +08:00
|
|
|
void Settings::Editor::setDefaultEncoding(const QByteArray &value)
|
2021-04-13 11:23:37 +08:00
|
|
|
{
|
2021-06-07 11:02:03 +08:00
|
|
|
mDefaultEncoding = value;
|
2021-04-13 11:23:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::autoIndent()
|
|
|
|
{
|
2021-06-07 11:02:03 +08:00
|
|
|
return mAutoIndent;
|
2021-04-13 11:23:37 +08:00
|
|
|
}
|
|
|
|
|
2021-06-07 11:02:03 +08:00
|
|
|
void Settings::Editor::setAutoIndent(bool value)
|
2021-04-13 11:23:37 +08:00
|
|
|
{
|
2021-06-07 11:02:03 +08:00
|
|
|
mAutoIndent = value;
|
2021-04-13 11:23:37 +08:00
|
|
|
}
|
|
|
|
|
2021-06-07 11:02:03 +08:00
|
|
|
QColor Settings::Editor::caretColor() const
|
|
|
|
{
|
|
|
|
return mCaretColor;
|
|
|
|
}
|
2021-04-13 11:23:37 +08:00
|
|
|
|
2021-06-07 11:02:03 +08:00
|
|
|
void Settings::Editor::setCaretColor(const QColor &caretColor)
|
|
|
|
{
|
|
|
|
mCaretColor = caretColor;
|
|
|
|
}
|
|
|
|
|
2021-06-08 21:41:42 +08:00
|
|
|
bool Settings::Editor::keepCaretX() const
|
2021-06-07 11:02:03 +08:00
|
|
|
{
|
|
|
|
return mKeepCaretX;
|
|
|
|
}
|
|
|
|
|
2021-06-08 21:41:42 +08:00
|
|
|
void Settings::Editor::setKeepCaretX(bool keepCaretX)
|
2021-06-07 11:02:03 +08:00
|
|
|
{
|
|
|
|
mKeepCaretX = keepCaretX;
|
|
|
|
}
|
|
|
|
|
2021-06-08 21:41:42 +08:00
|
|
|
bool Settings::Editor::halfPageScroll() const
|
|
|
|
{
|
|
|
|
return mHalfPageScroll;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setHalfPageScroll(bool halfPageScroll)
|
|
|
|
{
|
|
|
|
mHalfPageScroll = halfPageScroll;
|
|
|
|
}
|
|
|
|
|
2021-06-09 17:12:23 +08:00
|
|
|
bool Settings::Editor::gutterFontOnlyMonospaced() const
|
|
|
|
{
|
|
|
|
return mGutterFontOnlyMonospaced;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setGutterFontOnlyMonospaced(bool gutterFontOnlyMonospaced)
|
|
|
|
{
|
|
|
|
mGutterFontOnlyMonospaced = gutterFontOnlyMonospaced;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::Editor::gutterRightOffset() const
|
|
|
|
{
|
|
|
|
return mGutterRightOffset;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setGutterRightOffset(int gutterRightOffset)
|
|
|
|
{
|
|
|
|
mGutterRightOffset = gutterRightOffset;
|
|
|
|
}
|
|
|
|
|
2021-06-12 22:36:23 +08:00
|
|
|
int Settings::Editor::copyWithFormatAs() const
|
|
|
|
{
|
|
|
|
return mCopyWithFormatAs;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setCopyWithFormatAs(int copyWithFormatAs)
|
|
|
|
{
|
|
|
|
mCopyWithFormatAs = copyWithFormatAs;
|
|
|
|
}
|
|
|
|
|
2021-06-20 14:30:47 +08:00
|
|
|
QString Settings::Editor::colorScheme() const
|
2021-06-12 22:36:23 +08:00
|
|
|
{
|
2021-06-20 14:30:47 +08:00
|
|
|
return mColorScheme;
|
2021-06-12 22:36:23 +08:00
|
|
|
}
|
|
|
|
|
2021-06-20 14:30:47 +08:00
|
|
|
void Settings::Editor::setColorScheme(const QString &colorScheme)
|
2021-06-12 22:36:23 +08:00
|
|
|
{
|
2021-06-20 14:30:47 +08:00
|
|
|
mColorScheme = colorScheme;
|
|
|
|
}
|
|
|
|
|
2021-06-23 08:55:56 +08:00
|
|
|
bool Settings::Editor::removeSymbolPairs() const
|
2021-06-21 16:25:21 +08:00
|
|
|
{
|
2021-06-23 08:55:56 +08:00
|
|
|
return mRemoveSymbolPairs;
|
2021-06-21 16:25:21 +08:00
|
|
|
}
|
|
|
|
|
2021-06-23 08:55:56 +08:00
|
|
|
void Settings::Editor::setRemoveSymbolPairs(bool value)
|
2021-06-21 16:25:21 +08:00
|
|
|
{
|
2021-06-23 08:55:56 +08:00
|
|
|
mRemoveSymbolPairs = value;
|
2021-06-21 16:25:21 +08:00
|
|
|
}
|
|
|
|
|
2021-06-25 12:40:11 +08:00
|
|
|
bool Settings::Editor::syntaxCheckWhenLineChanged() const
|
|
|
|
{
|
|
|
|
return mSyntaxCheckWhenLineChanged;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setSyntaxCheckWhenLineChanged(bool syntaxCheckWhenLineChanged)
|
|
|
|
{
|
|
|
|
mSyntaxCheckWhenLineChanged = syntaxCheckWhenLineChanged;
|
|
|
|
}
|
|
|
|
|
2021-08-30 13:30:42 +08:00
|
|
|
bool Settings::Editor::readOnlySytemHeader() const
|
|
|
|
{
|
|
|
|
return mReadOnlySytemHeader;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setReadOnlySytemHeader(bool newReadOnlySytemHeader)
|
|
|
|
{
|
|
|
|
mReadOnlySytemHeader = newReadOnlySytemHeader;
|
|
|
|
}
|
|
|
|
|
2021-08-30 18:36:44 +08:00
|
|
|
bool Settings::Editor::defaultFileCpp() const
|
|
|
|
{
|
|
|
|
return mDefaultFileCpp;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setDefaultFileCpp(bool newDefaultFileCpp)
|
|
|
|
{
|
|
|
|
mDefaultFileCpp = newDefaultFileCpp;
|
|
|
|
}
|
|
|
|
|
2021-08-30 22:05:45 +08:00
|
|
|
bool Settings::Editor::enableAutoSave() const
|
|
|
|
{
|
|
|
|
return mEnableAutoSave;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setEnableAutoSave(bool newEnableAutoSave)
|
|
|
|
{
|
|
|
|
mEnableAutoSave = newEnableAutoSave;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::Editor::autoSaveInterval() const
|
|
|
|
{
|
|
|
|
return mAutoSaveInterval;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setAutoSaveInterval(int newInterval)
|
|
|
|
{
|
|
|
|
mAutoSaveInterval = newInterval;
|
|
|
|
}
|
|
|
|
|
|
|
|
AutoSaveStrategy Settings::Editor::autoSaveStrategy() const
|
|
|
|
{
|
|
|
|
return mAutoSaveStrategy;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setAutoSaveStrategy(AutoSaveStrategy newAutoSaveStrategy)
|
|
|
|
{
|
|
|
|
mAutoSaveStrategy = newAutoSaveStrategy;
|
|
|
|
}
|
|
|
|
|
2021-09-04 16:34:14 +08:00
|
|
|
bool Settings::Editor::enableAutolink() const
|
|
|
|
{
|
|
|
|
return mEnableAutolink;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setEnableAutolink(bool newEnableAutolink)
|
|
|
|
{
|
|
|
|
mEnableAutolink = newEnableAutolink;
|
|
|
|
}
|
|
|
|
|
2021-09-04 19:27:44 +08:00
|
|
|
const QColor &Settings::Editor::rightEdgeLineColor() const
|
|
|
|
{
|
|
|
|
return mRightEdgeLineColor;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setRightEdgeLineColor(const QColor &newRightMarginLineColor)
|
|
|
|
{
|
|
|
|
mRightEdgeLineColor = newRightMarginLineColor;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::caretUseTextColor() const
|
|
|
|
{
|
|
|
|
return mCaretUseTextColor;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setCaretUseTextColor(bool newUseIdentifierColor)
|
|
|
|
{
|
|
|
|
mCaretUseTextColor = newUseIdentifierColor;
|
|
|
|
}
|
|
|
|
|
2021-09-19 17:59:03 +08:00
|
|
|
bool Settings::Editor::rainbowParenthesis() const
|
|
|
|
{
|
|
|
|
return mRainbowParenthesis;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setRainbowParenthesis(bool newRainbowParenthesis)
|
|
|
|
{
|
|
|
|
mRainbowParenthesis = newRainbowParenthesis;
|
|
|
|
}
|
|
|
|
|
2021-09-21 20:41:17 +08:00
|
|
|
bool Settings::Editor::showFunctionTips() const
|
2021-09-21 20:36:43 +08:00
|
|
|
{
|
|
|
|
return mShowFunctionTips;
|
|
|
|
}
|
|
|
|
|
2021-09-21 20:41:17 +08:00
|
|
|
void Settings::Editor::setShowFunctionTips(bool newShowFunctionTips)
|
2021-09-21 20:36:43 +08:00
|
|
|
{
|
|
|
|
mShowFunctionTips = newShowFunctionTips;
|
|
|
|
}
|
|
|
|
|
2021-10-20 11:14:49 +08:00
|
|
|
bool Settings::Editor::fillIndents() const
|
|
|
|
{
|
|
|
|
return mfillIndents;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setFillIndents(bool newFillIndents)
|
|
|
|
{
|
|
|
|
mfillIndents = newFillIndents;
|
|
|
|
}
|
|
|
|
|
2021-10-20 12:27:44 +08:00
|
|
|
int Settings::Editor::mouseWheelScrollSpeed() const
|
|
|
|
{
|
|
|
|
return mMouseWheelScrollSpeed;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setMouseWheelScrollSpeed(int newMouseWheelScrollSpeed)
|
|
|
|
{
|
|
|
|
mMouseWheelScrollSpeed = newMouseWheelScrollSpeed;
|
|
|
|
}
|
|
|
|
|
2021-11-18 21:25:28 +08:00
|
|
|
bool Settings::Editor::highlightMathingBraces() const
|
|
|
|
{
|
|
|
|
return mHighlightMathingBraces;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setHighlightMathingBraces(bool newHighlightMathingBraces)
|
|
|
|
{
|
|
|
|
mHighlightMathingBraces = newHighlightMathingBraces;
|
|
|
|
}
|
|
|
|
|
2022-01-10 20:16:26 +08:00
|
|
|
bool Settings::Editor::enableLigaturesSupport() const
|
|
|
|
{
|
|
|
|
return mEnableLigaturesSupport;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setEnableLigaturesSupport(bool newEnableLigaturesSupport)
|
|
|
|
{
|
|
|
|
mEnableLigaturesSupport = newEnableLigaturesSupport;
|
|
|
|
}
|
|
|
|
|
2022-01-26 14:31:26 +08:00
|
|
|
const QString &Settings::Editor::nonAsciiFontName() const
|
|
|
|
{
|
|
|
|
return mNonAsciiFontName;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setNonAsciiFontName(const QString &newNonAsciiFontName)
|
|
|
|
{
|
|
|
|
mNonAsciiFontName = newNonAsciiFontName;
|
|
|
|
}
|
|
|
|
|
2022-03-04 19:04:45 +08:00
|
|
|
int Settings::Editor::mouseSelectionScrollSpeed() const
|
|
|
|
{
|
|
|
|
return mMouseSelectionScrollSpeed;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setMouseSelectionScrollSpeed(int newMouseSelectionScrollSpeed)
|
|
|
|
{
|
|
|
|
mMouseSelectionScrollSpeed = newMouseSelectionScrollSpeed;
|
|
|
|
}
|
|
|
|
|
2022-03-12 17:37:53 +08:00
|
|
|
bool Settings::Editor::autoDetectFileEncoding() const
|
|
|
|
{
|
|
|
|
return mAutoDetectFileEncoding;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setAutoDetectFileEncoding(bool newAutoDetectFileEncoding)
|
|
|
|
{
|
|
|
|
mAutoDetectFileEncoding = newAutoDetectFileEncoding;
|
|
|
|
}
|
|
|
|
|
2022-03-20 18:10:53 +08:00
|
|
|
int Settings::Editor::undoLimit() const
|
|
|
|
{
|
|
|
|
return mUndoLimit;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setUndoLimit(int newUndoLimit)
|
|
|
|
{
|
|
|
|
mUndoLimit = newUndoLimit;
|
|
|
|
}
|
|
|
|
|
2022-10-11 22:33:09 +08:00
|
|
|
int Settings::Editor::undoMemoryUsage() const
|
|
|
|
{
|
|
|
|
return mUndoMemoryUsage;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setUndoMemoryUsage(int newUndoMemoryUsage)
|
|
|
|
{
|
|
|
|
mUndoMemoryUsage = newUndoMemoryUsage;
|
|
|
|
}
|
|
|
|
|
2022-10-25 10:13:51 +08:00
|
|
|
bool Settings::Editor::autoFormatWhenSaved() const
|
|
|
|
{
|
|
|
|
return mAutoFormatWhenSaved;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setAutoFormatWhenSaved(bool newAutoFormatWhenSaved)
|
|
|
|
{
|
|
|
|
mAutoFormatWhenSaved = newAutoFormatWhenSaved;
|
|
|
|
}
|
|
|
|
|
2022-11-07 21:44:12 +08:00
|
|
|
bool Settings::Editor::parseTodos() const
|
|
|
|
{
|
|
|
|
return mParseTodos;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setParseTodos(bool newParseTodos)
|
|
|
|
{
|
|
|
|
mParseTodos = newParseTodos;
|
|
|
|
}
|
|
|
|
|
2022-11-22 15:14:05 +08:00
|
|
|
const QStringList &Settings::Editor::customCTypeKeywords() const
|
|
|
|
{
|
|
|
|
return mCustomCTypeKeywords;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setCustomCTypeKeywords(const QStringList &newCustomTypeKeywords)
|
|
|
|
{
|
|
|
|
mCustomCTypeKeywords = newCustomTypeKeywords;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::enableCustomCTypeKeywords() const
|
|
|
|
{
|
|
|
|
return mEnableCustomCTypeKeywords;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setEnableCustomCTypeKeywords(bool newEnableCustomCTypeKeywords)
|
|
|
|
{
|
|
|
|
mEnableCustomCTypeKeywords = newEnableCustomCTypeKeywords;
|
|
|
|
}
|
|
|
|
|
2022-12-16 01:03:57 +08:00
|
|
|
bool Settings::Editor::removeTrailingSpacesWhenSaved() const
|
|
|
|
{
|
|
|
|
return mRemoveTrailingSpacesWhenSaved;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setRemoveTrailingSpacesWhenSaved(bool newRemoveTrailingSpacesWhenSaved)
|
|
|
|
{
|
|
|
|
mRemoveTrailingSpacesWhenSaved = newRemoveTrailingSpacesWhenSaved;
|
|
|
|
}
|
|
|
|
|
2022-12-20 20:38:02 +08:00
|
|
|
double Settings::Editor::lineSpacing() const
|
2022-12-16 11:10:46 +08:00
|
|
|
{
|
2022-12-20 20:38:02 +08:00
|
|
|
return mLineSpacing;
|
2022-12-16 11:10:46 +08:00
|
|
|
}
|
|
|
|
|
2022-12-20 20:38:02 +08:00
|
|
|
void Settings::Editor::setLineSpacing(double newLineSpacing)
|
2022-12-16 11:10:46 +08:00
|
|
|
{
|
2022-12-20 20:38:02 +08:00
|
|
|
mLineSpacing = newLineSpacing;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::showLeadingSpaces() const
|
|
|
|
{
|
|
|
|
return mShowLeadingSpaces;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setShowLeadingSpaces(bool newShowStartSpaces)
|
|
|
|
{
|
|
|
|
mShowLeadingSpaces = newShowStartSpaces;
|
|
|
|
}
|
|
|
|
|
2023-01-15 13:32:33 +08:00
|
|
|
bool Settings::Editor::enableEditTempBackup() const
|
|
|
|
{
|
|
|
|
return mEnableEditTempBackup;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setEnableEditTempBackup(bool newEnableEditTempBackup)
|
|
|
|
{
|
|
|
|
mEnableEditTempBackup = newEnableEditTempBackup;
|
|
|
|
}
|
|
|
|
|
2023-02-17 09:03:35 +08:00
|
|
|
int Settings::Editor::tipsDelay() const
|
|
|
|
{
|
|
|
|
return mTipsDelay;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setTipsDelay(int newTipsDelay)
|
|
|
|
{
|
|
|
|
mTipsDelay = newTipsDelay;
|
|
|
|
}
|
|
|
|
|
2022-12-20 20:38:02 +08:00
|
|
|
bool Settings::Editor::showTrailingSpaces() const
|
|
|
|
{
|
|
|
|
return mShowTrailingSpaces;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setShowTrailingSpaces(bool newShowEndSpaces)
|
|
|
|
{
|
|
|
|
mShowTrailingSpaces = newShowEndSpaces;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::showInnerSpaces() const
|
|
|
|
{
|
|
|
|
return mShowInnerSpaces;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setShowInnerSpaces(bool newShowMiddleSpaces)
|
|
|
|
{
|
|
|
|
mShowInnerSpaces = newShowMiddleSpaces;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::showLineBreaks() const
|
|
|
|
{
|
|
|
|
return mShowLineBreaks;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setShowLineBreaks(bool newShowLineBreaks)
|
|
|
|
{
|
|
|
|
mShowLineBreaks = newShowLineBreaks;
|
2022-12-16 11:10:46 +08:00
|
|
|
}
|
|
|
|
|
2021-11-18 21:25:28 +08:00
|
|
|
bool Settings::Editor::highlightCurrentWord() const
|
|
|
|
{
|
|
|
|
return mHighlightCurrentWord;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setHighlightCurrentWord(bool newHighlightCurrentWord)
|
|
|
|
{
|
|
|
|
mHighlightCurrentWord = newHighlightCurrentWord;
|
|
|
|
}
|
|
|
|
|
2021-09-21 20:41:17 +08:00
|
|
|
bool Settings::Editor::enableTooltips() const
|
2021-09-21 20:36:43 +08:00
|
|
|
{
|
|
|
|
return mEnableTooltips;
|
|
|
|
}
|
|
|
|
|
2021-09-21 20:41:17 +08:00
|
|
|
void Settings::Editor::setEnableTooltips(bool newEnableTooltips)
|
2021-09-21 20:36:43 +08:00
|
|
|
{
|
|
|
|
mEnableTooltips = newEnableTooltips;
|
|
|
|
}
|
|
|
|
|
2021-09-21 20:41:17 +08:00
|
|
|
bool Settings::Editor::enableDebugTooltips() const
|
2021-09-21 20:36:43 +08:00
|
|
|
{
|
|
|
|
return mEnableDebugTooltips;
|
|
|
|
}
|
|
|
|
|
2021-09-21 20:41:17 +08:00
|
|
|
void Settings::Editor::setEnableDebugTooltips(bool newEnableDebugTooltips)
|
2021-09-21 20:36:43 +08:00
|
|
|
{
|
|
|
|
mEnableDebugTooltips = newEnableDebugTooltips;
|
|
|
|
}
|
|
|
|
|
2021-09-21 20:41:17 +08:00
|
|
|
bool Settings::Editor::enableIdentifierToolTips() const
|
2021-09-21 20:36:43 +08:00
|
|
|
{
|
|
|
|
return mEnableIdentifierToolTips;
|
|
|
|
}
|
|
|
|
|
2021-09-21 20:41:17 +08:00
|
|
|
void Settings::Editor::setEnableIdentifierToolTips(bool newEnableIdentifierToolTips)
|
2021-09-21 20:36:43 +08:00
|
|
|
{
|
|
|
|
mEnableIdentifierToolTips = newEnableIdentifierToolTips;
|
|
|
|
}
|
|
|
|
|
2021-09-21 20:41:17 +08:00
|
|
|
bool Settings::Editor::enableHeaderToolTips() const
|
2021-09-21 20:36:43 +08:00
|
|
|
{
|
|
|
|
return mEnableHeaderToolTips;
|
|
|
|
}
|
|
|
|
|
2021-09-21 20:41:17 +08:00
|
|
|
void Settings::Editor::setEnableHeaderToolTips(bool newEnableHeaderToolTips)
|
2021-09-21 20:36:43 +08:00
|
|
|
{
|
|
|
|
mEnableHeaderToolTips = newEnableHeaderToolTips;
|
|
|
|
}
|
|
|
|
|
2021-09-21 20:41:17 +08:00
|
|
|
bool Settings::Editor::enableIssueToolTips() const
|
2021-09-21 20:36:43 +08:00
|
|
|
{
|
|
|
|
return mEnableIssueToolTips;
|
|
|
|
}
|
|
|
|
|
2021-09-21 20:41:17 +08:00
|
|
|
void Settings::Editor::setEnableIssueToolTips(bool newEnableIssueToolTips)
|
2021-09-21 20:36:43 +08:00
|
|
|
{
|
|
|
|
mEnableIssueToolTips = newEnableIssueToolTips;
|
|
|
|
}
|
|
|
|
|
2021-09-04 19:27:44 +08:00
|
|
|
int Settings::Editor::rightEdgeWidth() const
|
|
|
|
{
|
|
|
|
return mRightEdgeWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setRightEdgeWidth(int newRightMarginWidth)
|
|
|
|
{
|
|
|
|
mRightEdgeWidth = newRightMarginWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::showRightEdgeLine() const
|
|
|
|
{
|
|
|
|
return mShowRightEdgeLine;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setShowRightEdgeLine(bool newShowRightMarginLine)
|
|
|
|
{
|
|
|
|
mShowRightEdgeLine = newShowRightMarginLine;
|
|
|
|
}
|
|
|
|
|
2021-08-30 22:05:45 +08:00
|
|
|
AutoSaveTarget Settings::Editor::autoSaveTarget() const
|
|
|
|
{
|
|
|
|
return mAutoSaveTarget;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setAutoSaveTarget(AutoSaveTarget newAutoSaveTarget)
|
|
|
|
{
|
|
|
|
mAutoSaveTarget = newAutoSaveTarget;
|
|
|
|
}
|
|
|
|
|
2021-08-30 18:36:44 +08:00
|
|
|
bool Settings::Editor::autoLoadLastFiles() const
|
|
|
|
{
|
|
|
|
return mAutoLoadLastFiles;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setAutoLoadLastFiles(bool newAutoLoadLastFiles)
|
|
|
|
{
|
|
|
|
mAutoLoadLastFiles = newAutoLoadLastFiles;
|
|
|
|
}
|
|
|
|
|
2021-06-25 12:40:11 +08:00
|
|
|
bool Settings::Editor::syntaxCheckWhenSave() const
|
|
|
|
{
|
|
|
|
return mSyntaxCheckWhenSave;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setSyntaxCheckWhenSave(bool syntaxCheckWhenSave)
|
|
|
|
{
|
|
|
|
mSyntaxCheckWhenSave = syntaxCheckWhenSave;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::syntaxCheck() const
|
|
|
|
{
|
|
|
|
return mSyntaxCheck;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setSyntaxCheck(bool syntaxCheck)
|
|
|
|
{
|
|
|
|
mSyntaxCheck = syntaxCheck;
|
|
|
|
}
|
|
|
|
|
2021-06-21 16:25:21 +08:00
|
|
|
bool Settings::Editor::overwriteSymbols() const
|
|
|
|
{
|
|
|
|
return mOverwriteSymbols;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setOverwriteSymbols(bool overwriteSymbols)
|
|
|
|
{
|
|
|
|
mOverwriteSymbols = overwriteSymbols;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::completeGlobalInclude() const
|
|
|
|
{
|
|
|
|
return mCompleteGlobalInclude;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setCompleteGlobalInclude(bool completeGlobalInclude)
|
|
|
|
{
|
|
|
|
mCompleteGlobalInclude = completeGlobalInclude;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::completeDoubleQuote() const
|
|
|
|
{
|
|
|
|
return mCompleteDoubleQuote;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setCompleteDoubleQuote(bool completeDoubleQuote)
|
|
|
|
{
|
|
|
|
mCompleteDoubleQuote = completeDoubleQuote;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::completeSingleQuote() const
|
|
|
|
{
|
|
|
|
return mCompleteSingleQuote;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setCompleteSingleQuote(bool completeSingleQuote)
|
|
|
|
{
|
|
|
|
mCompleteSingleQuote = completeSingleQuote;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::completeComment() const
|
|
|
|
{
|
|
|
|
return mCompleteComment;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setCompleteComment(bool completeComment)
|
|
|
|
{
|
|
|
|
mCompleteComment = completeComment;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::completeBrace() const
|
|
|
|
{
|
|
|
|
return mCompleteBrace;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setCompleteBrace(bool completeBrace)
|
|
|
|
{
|
|
|
|
mCompleteBrace = completeBrace;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::completeBracket() const
|
|
|
|
{
|
|
|
|
return mCompleteBracket;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setCompleteBracket(bool completeBracket)
|
|
|
|
{
|
|
|
|
mCompleteBracket = completeBracket;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::completeParenthese() const
|
|
|
|
{
|
|
|
|
return mCompleteParenthese;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setCompleteParenthese(bool completeParenthese)
|
|
|
|
{
|
|
|
|
mCompleteParenthese = completeParenthese;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::completeSymbols() const
|
|
|
|
{
|
|
|
|
return mCompleteSymbols;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setCompleteSymbols(bool completeSymbols)
|
|
|
|
{
|
|
|
|
mCompleteSymbols = completeSymbols;
|
|
|
|
}
|
|
|
|
|
2021-06-20 14:30:47 +08:00
|
|
|
QString Settings::Editor::copyHTMLColorScheme() const
|
|
|
|
{
|
|
|
|
return mCopyHTMLColorScheme;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setCopyHTMLColorScheme(const QString ©HTMLColorScheme)
|
|
|
|
{
|
|
|
|
mCopyHTMLColorScheme = copyHTMLColorScheme;
|
2021-06-12 22:36:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::copyHTMLUseEditorColor() const
|
|
|
|
{
|
|
|
|
return mCopyHTMLUseEditorColor;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setCopyHTMLUseEditorColor(bool copyHTMLUseEditorColor)
|
|
|
|
{
|
|
|
|
mCopyHTMLUseEditorColor = copyHTMLUseEditorColor;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::copyHTMLUseBackground() const
|
|
|
|
{
|
|
|
|
return mCopyHTMLUseBackground;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setCopyHTMLUseBackground(bool copyHTMLUseBackground)
|
|
|
|
{
|
|
|
|
mCopyHTMLUseBackground = copyHTMLUseBackground;
|
|
|
|
}
|
|
|
|
|
2021-06-20 14:30:47 +08:00
|
|
|
QString Settings::Editor::copyRTFColorScheme() const
|
2021-06-12 22:36:23 +08:00
|
|
|
{
|
2021-06-20 14:30:47 +08:00
|
|
|
return mCopyRTFColorScheme;
|
2021-06-12 22:36:23 +08:00
|
|
|
}
|
|
|
|
|
2021-06-20 14:30:47 +08:00
|
|
|
void Settings::Editor::setCopyRTFColorScheme(const QString ©RTFColorScheme)
|
2021-06-12 22:36:23 +08:00
|
|
|
{
|
2021-06-20 14:30:47 +08:00
|
|
|
mCopyRTFColorScheme = copyRTFColorScheme;
|
2021-06-12 22:36:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::copyRTFUseEditorColor() const
|
|
|
|
{
|
|
|
|
return mCopyRTFUseEditorColor;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setCopyRTFUseEditorColor(bool copyRTFUseEditorColor)
|
|
|
|
{
|
|
|
|
mCopyRTFUseEditorColor = copyRTFUseEditorColor;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::copyRTFUseBackground() const
|
|
|
|
{
|
|
|
|
return mCopyRTFUseBackground;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setCopyRTFUseBackground(bool copyRTFUseBackground)
|
|
|
|
{
|
|
|
|
mCopyRTFUseBackground = copyRTFUseBackground;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::Editor::copyLineLimits() const
|
|
|
|
{
|
|
|
|
return mCopyLineLimits;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setCopyLineLimits(int copyLineLimits)
|
|
|
|
{
|
|
|
|
mCopyLineLimits = copyLineLimits;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::Editor::copyCharLimits() const
|
|
|
|
{
|
|
|
|
return mCopyCharLimits;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setCopyCharLimits(int copyCharLimits)
|
|
|
|
{
|
|
|
|
mCopyCharLimits = copyCharLimits;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::copySizeLimit() const
|
|
|
|
{
|
|
|
|
return mCopySizeLimit;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setCopySizeLimit(bool copyLimit)
|
|
|
|
{
|
|
|
|
mCopySizeLimit = copyLimit;
|
|
|
|
}
|
|
|
|
|
2021-06-09 17:12:23 +08:00
|
|
|
int Settings::Editor::gutterLeftOffset() const
|
|
|
|
{
|
|
|
|
return mGutterLeftOffset;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setGutterLeftOffset(int gutterLeftOffset)
|
|
|
|
{
|
|
|
|
mGutterLeftOffset = gutterLeftOffset;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::Editor::gutterFontSize() const
|
|
|
|
{
|
|
|
|
return mGutterFontSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setGutterFontSize(int gutterFontSize)
|
|
|
|
{
|
|
|
|
mGutterFontSize = gutterFontSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString Settings::Editor::gutterFontName() const
|
|
|
|
{
|
|
|
|
return mGutterFontName;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setGutterFontName(const QString &gutterFontName)
|
|
|
|
{
|
|
|
|
mGutterFontName = gutterFontName;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::gutterUseCustomFont() const
|
|
|
|
{
|
|
|
|
return mGutterUseCustomFont;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setGutterUseCustomFont(bool gutterUseCustomFont)
|
|
|
|
{
|
|
|
|
mGutterUseCustomFont = gutterUseCustomFont;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::gutterLineNumbersStartZero() const
|
|
|
|
{
|
|
|
|
return mGutterLineNumbersStartZero;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setGutterLineNumbersStartZero(bool gutterLineNumbersStartZero)
|
|
|
|
{
|
|
|
|
mGutterLineNumbersStartZero = gutterLineNumbersStartZero;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::gutterAddLeadingZero() const
|
|
|
|
{
|
|
|
|
return mGutterAddLeadingZero;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setGutterAddLeadingZero(bool gutterAddLeadingZero)
|
|
|
|
{
|
|
|
|
mGutterAddLeadingZero = gutterAddLeadingZero;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::gutterShowLineNumbers() const
|
|
|
|
{
|
|
|
|
return mGutterShowLineNumbers;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setGutterShowLineNumbers(bool gutterShowLineNumbers)
|
|
|
|
{
|
|
|
|
mGutterShowLineNumbers = gutterShowLineNumbers;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::Editor::gutterDigitsCount() const
|
|
|
|
{
|
|
|
|
return mGutterDigitsCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setGutterDigitsCount(int gutterDigitsCount)
|
|
|
|
{
|
|
|
|
mGutterDigitsCount = gutterDigitsCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::gutterAutoSize() const
|
|
|
|
{
|
|
|
|
return mGutterAutoSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setGutterAutoSize(bool gutterAutoSize)
|
|
|
|
{
|
|
|
|
mGutterAutoSize = gutterAutoSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::gutterVisible() const
|
|
|
|
{
|
|
|
|
return mGutterVisible;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setGutterVisible(bool gutterVisible)
|
|
|
|
{
|
|
|
|
mGutterVisible = gutterVisible;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::fontOnlyMonospaced() const
|
|
|
|
{
|
|
|
|
return mFontOnlyMonospaced;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setFontOnlyMonospaced(bool fontOnlyMonospaced)
|
|
|
|
{
|
|
|
|
mFontOnlyMonospaced = fontOnlyMonospaced;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::Editor::fontSize() const
|
|
|
|
{
|
|
|
|
return mFontSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setFontSize(int fontSize)
|
|
|
|
{
|
|
|
|
mFontSize = fontSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString Settings::Editor::fontName() const
|
|
|
|
{
|
|
|
|
return mFontName;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setFontName(const QString &fontName)
|
|
|
|
{
|
|
|
|
mFontName = fontName;
|
|
|
|
}
|
|
|
|
|
2021-06-08 21:41:42 +08:00
|
|
|
bool Settings::Editor::scrollByOneLess() const
|
|
|
|
{
|
|
|
|
return mScrollByOneLess;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setScrollByOneLess(bool scrollByOneLess)
|
|
|
|
{
|
|
|
|
mScrollByOneLess = scrollByOneLess;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::scrollPastEol() const
|
|
|
|
{
|
|
|
|
return mScrollPastEol;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setScrollPastEol(bool scrollPastEol)
|
|
|
|
{
|
|
|
|
mScrollPastEol = scrollPastEol;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::scrollPastEof() const
|
|
|
|
{
|
|
|
|
return mScrollPastEof;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setScrollPastEof(bool scrollPastEof)
|
|
|
|
{
|
|
|
|
mScrollPastEof = scrollPastEof;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::autoHideScrollbar() const
|
|
|
|
{
|
|
|
|
return mAutoHideScrollbar;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setAutoHideScrollbar(bool autoHideScrollbar)
|
|
|
|
{
|
|
|
|
mAutoHideScrollbar = autoHideScrollbar;
|
|
|
|
}
|
|
|
|
|
2021-06-07 11:02:03 +08:00
|
|
|
void Settings::Editor::doSave()
|
|
|
|
{
|
2021-08-30 18:36:44 +08:00
|
|
|
|
2021-06-07 11:02:03 +08:00
|
|
|
// indents
|
|
|
|
saveValue("auto_indent", mAutoIndent);
|
|
|
|
saveValue("tab_to_spaces", mTabToSpaces);
|
|
|
|
saveValue("tab_width", mTabWidth);
|
|
|
|
saveValue("show_indent_lines", mShowIndentLines);
|
|
|
|
saveValue("indent_line_color",mIndentLineColor);
|
2021-10-20 11:14:49 +08:00
|
|
|
saveValue("fill_indents",mfillIndents);
|
2021-11-18 21:25:28 +08:00
|
|
|
|
2021-06-07 11:02:03 +08:00
|
|
|
// caret
|
|
|
|
saveValue("enhance_home_key",mEnhanceHomeKey);
|
|
|
|
saveValue("enhance_end_key",mEnhanceEndKey);
|
|
|
|
saveValue("keep_caret_x",mKeepCaretX);
|
|
|
|
saveValue("caret_for_insert",static_cast<int>(mCaretForInsert));
|
|
|
|
saveValue("caret_for_overwrite",static_cast<int>(mCaretForOverwrite));
|
2021-09-04 19:27:44 +08:00
|
|
|
saveValue("caret_use_text_color",mCaretUseTextColor);
|
2021-06-07 11:02:03 +08:00
|
|
|
saveValue("caret_color",mCaretColor);
|
2021-06-08 21:41:42 +08:00
|
|
|
|
2021-11-18 21:25:28 +08:00
|
|
|
//highlight
|
|
|
|
saveValue("highlight_matching_braces",mHighlightMathingBraces);
|
|
|
|
saveValue("highlight_current_word",mHighlightCurrentWord);
|
|
|
|
|
2021-06-08 21:41:42 +08:00
|
|
|
//scroll
|
|
|
|
saveValue("auto_hide_scroll_bar", mAutoHideScrollbar);
|
|
|
|
saveValue("scroll_past_eof", mScrollPastEof);
|
|
|
|
saveValue("scroll_past_eol", mScrollPastEol);
|
|
|
|
saveValue("scroll_by_one_less", mScrollByOneLess);
|
|
|
|
saveValue("half_page_scroll", mHalfPageScroll);
|
2021-10-20 12:27:44 +08:00
|
|
|
saveValue("mouse_wheel_scroll_speed", mMouseWheelScrollSpeed);
|
2022-03-04 19:04:45 +08:00
|
|
|
saveValue("mouse_selection_scroll_speed",mMouseSelectionScrollSpeed);
|
2021-06-09 17:12:23 +08:00
|
|
|
|
2021-09-04 19:27:44 +08:00
|
|
|
//right edge
|
|
|
|
saveValue("show_right_edge_line",mShowRightEdgeLine);
|
|
|
|
saveValue("right_edge_width",mRightEdgeWidth);
|
|
|
|
saveValue("right_edge_line_color",mRightEdgeLineColor);
|
|
|
|
|
2021-06-09 17:12:23 +08:00
|
|
|
//Font
|
|
|
|
//font
|
2022-01-26 14:31:26 +08:00
|
|
|
saveValue("font_name", mFontName);
|
|
|
|
saveValue("non_ascii_font_name", mNonAsciiFontName);
|
2021-06-09 17:12:23 +08:00
|
|
|
saveValue("font_size", mFontSize);
|
2022-01-26 14:31:26 +08:00
|
|
|
saveValue("font_only_monospaced", mFontOnlyMonospaced);
|
2022-12-20 20:38:02 +08:00
|
|
|
saveValue("line_spacing",mLineSpacing);
|
2022-01-10 20:16:26 +08:00
|
|
|
saveValue("enable_ligatures_support", mEnableLigaturesSupport);
|
2021-06-09 17:12:23 +08:00
|
|
|
|
2022-12-20 20:38:02 +08:00
|
|
|
saveValue("show_leading_spaces", mShowLeadingSpaces);
|
|
|
|
saveValue("show_trailing_spaces", mShowTrailingSpaces);
|
|
|
|
saveValue("show_inner_spaces", mShowInnerSpaces);
|
|
|
|
saveValue("show_line_breaks", mShowLineBreaks);
|
|
|
|
|
2021-06-09 17:12:23 +08:00
|
|
|
//gutter
|
|
|
|
saveValue("gutter_visible", mGutterVisible);
|
|
|
|
saveValue("gutter_auto_size", mGutterAutoSize);
|
2021-12-20 09:36:18 +08:00
|
|
|
saveValue("gutter_left_offset",mGutterLeftOffset);
|
|
|
|
saveValue("gutter_right_offset",mGutterRightOffset);
|
2021-06-09 17:12:23 +08:00
|
|
|
saveValue("gutter_digits_count", mGutterDigitsCount);
|
|
|
|
saveValue("gutter_show_line_numbers",mGutterShowLineNumbers);
|
|
|
|
saveValue("gutter_add_leading_zero",mGutterAddLeadingZero);
|
|
|
|
saveValue("gutter_line_numbers_start_zero",mGutterLineNumbersStartZero);
|
|
|
|
saveValue("gutter_use_custom_font",mGutterUseCustomFont);
|
|
|
|
saveValue("gutter_font_name",mGutterFontName);
|
|
|
|
saveValue("gutter_font_size",mGutterFontSize);
|
|
|
|
saveValue("gutter_font_only_monospaced",mGutterFontOnlyMonospaced);
|
2021-06-12 22:36:23 +08:00
|
|
|
|
|
|
|
//copy
|
|
|
|
saveValue("copy_limit",mCopySizeLimit);
|
|
|
|
saveValue("copy_char_limits",mCopyCharLimits);
|
|
|
|
saveValue("copy_line_limits",mCopyLineLimits);
|
|
|
|
saveValue("copy_with_format_as",mCopyWithFormatAs);
|
|
|
|
saveValue("copy_rtf_use_background",mCopyRTFUseBackground);
|
2021-06-20 14:30:47 +08:00
|
|
|
saveValue("copy_rtf_use_editor_color_scheme",mCopyRTFUseEditorColor);
|
|
|
|
saveValue("copy_rtf_color_scheme",mCopyRTFColorScheme);
|
2021-06-12 22:36:23 +08:00
|
|
|
saveValue("copy_html_use_background",mCopyHTMLUseBackground);
|
2021-06-20 14:30:47 +08:00
|
|
|
saveValue("copy_html_use_editor_color_scheme",mCopyHTMLUseEditorColor);
|
|
|
|
saveValue("copy_html_color_scheme", mCopyHTMLColorScheme);
|
|
|
|
|
|
|
|
//color scheme
|
|
|
|
saveValue("color_scheme", mColorScheme);
|
2021-09-19 17:59:03 +08:00
|
|
|
saveValue("rainbow_parenthesis",mRainbowParenthesis);
|
2021-06-21 16:25:21 +08:00
|
|
|
|
|
|
|
//Symbol Completion
|
|
|
|
saveValue("complete_symbols", mCompleteSymbols);
|
|
|
|
saveValue("complete_parenthese", mCompleteParenthese);
|
|
|
|
saveValue("complete_bracket", mCompleteBracket);
|
|
|
|
saveValue("complete_brace", mCompleteBrace);
|
|
|
|
saveValue("complete_comment", mCompleteComment);
|
|
|
|
saveValue("complete_single_quote", mCompleteSingleQuote);
|
|
|
|
saveValue("complete_double_quote", mCompleteDoubleQuote);
|
|
|
|
saveValue("complete_global_include", mCompleteGlobalInclude);
|
|
|
|
saveValue("overwrite_symbols", mOverwriteSymbols);
|
2021-06-23 08:55:56 +08:00
|
|
|
saveValue("remove_symbol_pairs",mRemoveSymbolPairs);
|
2021-06-25 12:40:11 +08:00
|
|
|
|
|
|
|
//Auto Syntax Check
|
|
|
|
saveValue("check_syntax",mSyntaxCheck);
|
|
|
|
saveValue("check_syntax_when_save",mSyntaxCheckWhenSave);
|
|
|
|
saveValue("check_syntax_when_line_changed",mSyntaxCheckWhenLineChanged);
|
2021-08-30 18:36:44 +08:00
|
|
|
|
2021-08-30 22:05:45 +08:00
|
|
|
//auto save
|
2023-01-15 13:32:33 +08:00
|
|
|
saveValue("enable_edit_temp_backup",mEnableEditTempBackup);
|
2021-08-30 22:05:45 +08:00
|
|
|
saveValue("enable_auto_save",mEnableAutoSave);
|
|
|
|
saveValue("auto_save_interal",mAutoSaveInterval);
|
|
|
|
saveValue("auto_save_target",mAutoSaveTarget);
|
|
|
|
saveValue("auto_save_strategy",mAutoSaveStrategy);
|
|
|
|
|
2021-09-04 16:34:14 +08:00
|
|
|
//auto link
|
|
|
|
saveValue("enable_autolink",mEnableAutolink);
|
|
|
|
|
2021-08-30 18:36:44 +08:00
|
|
|
//misc
|
|
|
|
saveValue("default_encoding",mDefaultEncoding);
|
|
|
|
saveValue("readonly_system_header",mReadOnlySytemHeader);
|
|
|
|
saveValue("auto_load_last_files",mAutoLoadLastFiles);
|
|
|
|
saveValue("default_file_cpp",mDefaultFileCpp);
|
2022-03-12 17:37:53 +08:00
|
|
|
saveValue("auto_detect_file_encoding",mAutoDetectFileEncoding);
|
2022-03-20 18:10:53 +08:00
|
|
|
saveValue("undo_limit",mUndoLimit);
|
2022-10-11 22:33:09 +08:00
|
|
|
saveValue("undo_memory_usage", mUndoMemoryUsage);
|
2022-10-25 10:13:51 +08:00
|
|
|
saveValue("auto_format_when_saved", mAutoFormatWhenSaved);
|
2022-12-16 01:03:57 +08:00
|
|
|
saveValue("remove_trailing_spaces_when_saved",mRemoveTrailingSpacesWhenSaved);
|
2022-11-07 21:44:12 +08:00
|
|
|
saveValue("parse_todos",mParseTodos);
|
2021-09-21 20:36:43 +08:00
|
|
|
|
2022-11-22 15:14:05 +08:00
|
|
|
saveValue("custom_c_type_keywords", mCustomCTypeKeywords);
|
|
|
|
saveValue("enable_custom_c_type_keywords",mEnableCustomCTypeKeywords);
|
|
|
|
|
2021-09-21 20:36:43 +08:00
|
|
|
//tooltips
|
|
|
|
saveValue("enable_tooltips",mEnableTooltips);
|
|
|
|
saveValue("enable_debug_tooltips",mEnableDebugTooltips);
|
|
|
|
saveValue("enable_identifier_tooltips",mEnableIdentifierToolTips);
|
|
|
|
saveValue("enable_header_tooltips",mEnableHeaderToolTips);
|
|
|
|
saveValue("enable_issue_tooltips",mEnableIssueToolTips);
|
|
|
|
saveValue("show_function_tips",mShowFunctionTips);
|
2023-02-17 09:03:35 +08:00
|
|
|
saveValue("tips_delay",mTipsDelay);
|
2021-06-07 11:02:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::doLoad()
|
|
|
|
{
|
2021-08-30 18:36:44 +08:00
|
|
|
|
2021-06-07 11:02:03 +08:00
|
|
|
// indents
|
|
|
|
mAutoIndent = boolValue("auto_indent", true);
|
|
|
|
mTabToSpaces = boolValue("tab_to_spaces",false);
|
|
|
|
mTabWidth = intValue("tab_width",4);
|
|
|
|
mShowIndentLines = boolValue("show_indent_lines",true);
|
2022-01-04 16:50:54 +08:00
|
|
|
mIndentLineColor = colorValue("indent_line_color",Qt::lightGray);
|
2021-10-20 11:14:49 +08:00
|
|
|
mfillIndents = boolValue("fill_indents", false);
|
2021-06-07 11:02:03 +08:00
|
|
|
// caret
|
|
|
|
mEnhanceHomeKey = boolValue("enhance_home_key", true);
|
|
|
|
mEnhanceEndKey = boolValue("enhance_end_key",true);
|
|
|
|
mKeepCaretX = boolValue("keep_caret_x",true);
|
2022-09-27 14:01:38 +08:00
|
|
|
mCaretForInsert = static_cast<QSynedit::EditCaretType>( intValue("caret_for_insert",static_cast<int>(QSynedit::EditCaretType::ctVerticalLine)));
|
|
|
|
mCaretForOverwrite = static_cast<QSynedit::EditCaretType>( intValue("caret_for_overwrite",static_cast<int>(QSynedit::EditCaretType::ctBlock)));
|
2021-09-04 19:27:44 +08:00
|
|
|
mCaretUseTextColor = boolValue("caret_use_text_color",true);
|
2022-01-04 16:50:54 +08:00
|
|
|
mCaretColor = colorValue("caret_color",Qt::yellow);
|
2021-06-08 21:41:42 +08:00
|
|
|
|
2021-11-18 21:25:28 +08:00
|
|
|
//highlight
|
|
|
|
mHighlightMathingBraces = boolValue("highlight_matching_braces",true);
|
|
|
|
mHighlightCurrentWord = boolValue("highlight_current_word",true);
|
|
|
|
|
2021-06-08 21:41:42 +08:00
|
|
|
//scroll
|
|
|
|
mAutoHideScrollbar = boolValue("auto_hide_scroll_bar", false);
|
|
|
|
mScrollPastEof = boolValue("scroll_past_eof", true);
|
|
|
|
mScrollPastEol = boolValue("scroll_past_eol", true);
|
|
|
|
mScrollByOneLess = boolValue("scroll_by_one_less", false);
|
|
|
|
mHalfPageScroll = boolValue("half_page_scroll",false);
|
2021-10-20 12:27:44 +08:00
|
|
|
mMouseWheelScrollSpeed = intValue("mouse_wheel_scroll_speed", 3);
|
2022-03-04 19:04:45 +08:00
|
|
|
mMouseSelectionScrollSpeed = intValue("mouse_selection_scroll_speed",1);
|
2021-10-20 12:27:44 +08:00
|
|
|
|
2021-09-04 19:27:44 +08:00
|
|
|
|
|
|
|
//right edge
|
|
|
|
mShowRightEdgeLine = boolValue("show_right_edge_line",false);
|
|
|
|
mRightEdgeWidth = intValue("right_edge_width",80);
|
2022-01-04 16:50:54 +08:00
|
|
|
mRightEdgeLineColor = colorValue("right_edge_line_color",Qt::yellow);
|
2021-06-09 17:12:23 +08:00
|
|
|
|
2022-05-30 17:10:10 +08:00
|
|
|
//Editor font
|
2021-12-25 18:09:50 +08:00
|
|
|
#ifdef Q_OS_WIN
|
2021-06-09 17:12:23 +08:00
|
|
|
mFontName = stringValue("font_name","consolas");
|
2022-01-26 14:31:26 +08:00
|
|
|
mNonAsciiFontName = stringValue("non_ascii_font_name","consolas");
|
2022-05-30 17:10:10 +08:00
|
|
|
#elif defined(Q_OS_MACOS)
|
|
|
|
mFontName = stringValue("font_name","Menlo");
|
|
|
|
mNonAsciiFontName = stringValue("non_ascii_font_name","PingFang SC");
|
2021-12-25 08:23:52 +08:00
|
|
|
#else
|
|
|
|
mFontName = stringValue("font_name","Dejavu Sans Mono");
|
2022-01-26 14:31:26 +08:00
|
|
|
mNonAsciiFontName = stringValue("non_ascii_font_name","Dejavu Sans Mono");
|
2021-12-25 08:23:52 +08:00
|
|
|
#endif
|
2022-11-12 10:56:57 +08:00
|
|
|
mFontSize = intValue("font_size",12);
|
2021-06-09 17:12:23 +08:00
|
|
|
mFontOnlyMonospaced = boolValue("font_only_monospaced",true);
|
2022-12-20 20:38:02 +08:00
|
|
|
mLineSpacing = doubleValue("line_spacing",1.0);
|
2022-01-10 20:16:26 +08:00
|
|
|
mEnableLigaturesSupport = boolValue("enable_ligatures_support", false);
|
2021-06-09 17:12:23 +08:00
|
|
|
|
2022-12-20 20:38:02 +08:00
|
|
|
mShowLeadingSpaces = boolValue("show_leading_spaces", false);
|
|
|
|
mShowTrailingSpaces = boolValue("show_trailing_spaces", false);
|
|
|
|
mShowInnerSpaces = boolValue("show_inner_spaces", false);
|
|
|
|
mShowLineBreaks = boolValue("show_line_breaks", false);
|
|
|
|
|
2021-06-09 17:12:23 +08:00
|
|
|
//gutter
|
|
|
|
mGutterVisible = boolValue("gutter_visible",true);
|
|
|
|
mGutterAutoSize = boolValue("gutter_auto_size",true);
|
2021-12-20 09:36:18 +08:00
|
|
|
mGutterLeftOffset = intValue("gutter_left_offset",6);
|
2021-06-09 17:12:23 +08:00
|
|
|
mGutterRightOffset = intValue("gutter_right_offset",24);
|
|
|
|
mGutterDigitsCount = intValue("gutter_digits_count",1);
|
|
|
|
mGutterShowLineNumbers = boolValue("gutter_show_line_numbers",true);
|
2022-11-12 10:56:57 +08:00
|
|
|
mGutterAddLeadingZero = boolValue("gutter_add_leading_zero",false);
|
2021-06-09 17:12:23 +08:00
|
|
|
mGutterLineNumbersStartZero = boolValue("gutter_line_numbers_start_zero",false);
|
|
|
|
mGutterUseCustomFont = boolValue("gutter_use_custom_font",false);
|
2021-12-25 08:23:52 +08:00
|
|
|
|
2021-12-25 18:09:50 +08:00
|
|
|
#ifdef Q_OS_WIN
|
2021-06-09 17:12:23 +08:00
|
|
|
mGutterFontName = stringValue("gutter_font_name","consolas");
|
2021-12-25 08:23:52 +08:00
|
|
|
#else
|
|
|
|
mGutterFontName = stringValue("gutter_font_name","Dejavu Sans Mono");
|
|
|
|
#endif
|
2022-11-12 10:56:57 +08:00
|
|
|
mGutterFontSize = intValue("gutter_font_size",12);
|
2021-06-09 17:12:23 +08:00
|
|
|
mGutterFontOnlyMonospaced = boolValue("gutter_font_only_monospaced",true);
|
2021-06-12 22:36:23 +08:00
|
|
|
|
|
|
|
//copy
|
2022-12-18 12:31:19 +08:00
|
|
|
mCopySizeLimit = boolValue("copy_limit",false);
|
2021-06-12 22:36:23 +08:00
|
|
|
mCopyCharLimits = intValue("copy_char_limits",100);
|
|
|
|
mCopyLineLimits = intValue("copy_line_limits",100000);
|
2021-12-25 23:46:12 +08:00
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
mCopyWithFormatAs = intValue("copy_with_format_as",1); //html
|
|
|
|
#else
|
|
|
|
mCopyWithFormatAs = intValue("copy_with_format_as",0); //none
|
|
|
|
#endif
|
2021-06-12 22:36:23 +08:00
|
|
|
mCopyRTFUseBackground = boolValue("copy_rtf_use_background",false);
|
2021-10-10 22:19:48 +08:00
|
|
|
mCopyRTFUseEditorColor = boolValue("copy_rtf_use_editor_color_scheme",false);
|
2021-06-21 16:25:21 +08:00
|
|
|
mCopyRTFColorScheme = stringValue("copy_rtf_color_scheme","Intellij Classic");
|
2021-06-12 22:36:23 +08:00
|
|
|
mCopyHTMLUseBackground = boolValue("copy_html_use_background",false);
|
2021-10-10 22:19:48 +08:00
|
|
|
mCopyHTMLUseEditorColor = boolValue("copy_html_use_editor_color_scheme",false);
|
2021-06-21 16:25:21 +08:00
|
|
|
mCopyHTMLColorScheme = stringValue("copy_html_color_scheme","Intellij Classic");
|
2021-06-12 22:36:23 +08:00
|
|
|
|
2021-06-20 14:30:47 +08:00
|
|
|
//color
|
|
|
|
mColorScheme = stringValue("color_scheme", "VS Code");
|
2021-09-19 17:59:03 +08:00
|
|
|
mRainbowParenthesis = boolValue("rainbow_parenthesis", true);
|
2021-06-21 16:25:21 +08:00
|
|
|
|
|
|
|
//Symbol Completion
|
|
|
|
mCompleteSymbols = boolValue("complete_symbols",true);
|
|
|
|
mCompleteParenthese = boolValue("complete_parenthese",true);
|
|
|
|
mCompleteBracket = boolValue("complete_bracket",true);
|
|
|
|
mCompleteBrace = boolValue("complete_brace",true);
|
|
|
|
mCompleteComment = boolValue("complete_comment",true);
|
|
|
|
mCompleteSingleQuote = boolValue("complete_single_quote",true);
|
|
|
|
mCompleteDoubleQuote = boolValue("complete_double_quote",true);
|
|
|
|
mCompleteGlobalInclude = boolValue("complete_global_include",true);
|
|
|
|
mOverwriteSymbols = boolValue("overwrite_symbols",true);
|
2021-06-23 08:55:56 +08:00
|
|
|
mRemoveSymbolPairs = boolValue("remove_symbol_pairs",true);
|
2021-06-25 12:40:11 +08:00
|
|
|
|
|
|
|
//Auto Syntax Check
|
|
|
|
mSyntaxCheck = boolValue("check_syntax",true);
|
|
|
|
mSyntaxCheckWhenSave = boolValue("check_syntax_when_save",true);
|
|
|
|
mSyntaxCheckWhenLineChanged = boolValue("check_syntax_when_line_changed",true);
|
2021-08-30 18:36:44 +08:00
|
|
|
|
2021-08-30 22:05:45 +08:00
|
|
|
//auto save
|
2023-01-15 15:57:48 +08:00
|
|
|
mEnableEditTempBackup = boolValue("enable_edit_temp_backup", false);
|
2021-08-30 22:05:45 +08:00
|
|
|
mEnableAutoSave = boolValue("enable_auto_save",false);
|
|
|
|
mAutoSaveInterval = intValue("auto_save_interal",10);
|
|
|
|
mAutoSaveTarget = static_cast<enum AutoSaveTarget>(
|
|
|
|
intValue("auto_save_target",AutoSaveTarget::astCurrentFile));
|
|
|
|
mAutoSaveStrategy = static_cast<enum AutoSaveStrategy>(
|
|
|
|
intValue("auto_save_strategy",AutoSaveStrategy::assOverwrite));
|
|
|
|
|
2021-09-04 16:34:14 +08:00
|
|
|
//auto link
|
|
|
|
mEnableAutolink = boolValue("enable_autolink",true);
|
|
|
|
|
2021-08-30 18:36:44 +08:00
|
|
|
//misc
|
|
|
|
mReadOnlySytemHeader = boolValue("readonly_system_header",true);
|
|
|
|
mAutoLoadLastFiles = boolValue("auto_load_last_files",true);
|
|
|
|
mDefaultFileCpp = boolValue("default_file_cpp",true);
|
2022-03-12 17:37:53 +08:00
|
|
|
bool useUTF8ByDefault = boolValue("use_utf8_by_default",false);
|
|
|
|
if (useUTF8ByDefault)
|
|
|
|
mDefaultEncoding = ENCODING_UTF8;
|
|
|
|
else
|
2022-03-26 19:10:14 +08:00
|
|
|
mDefaultEncoding = value("default_encoding", ENCODING_UTF8).toByteArray();
|
2022-03-12 17:37:53 +08:00
|
|
|
mAutoDetectFileEncoding = boolValue("auto_detect_file_encoding",true);
|
2022-10-12 19:48:35 +08:00
|
|
|
mUndoLimit = intValue("undo_limit",0);
|
2023-01-06 11:59:21 +08:00
|
|
|
mUndoMemoryUsage = intValue("undo_memory_usage", 0);
|
2022-10-25 10:13:51 +08:00
|
|
|
mAutoFormatWhenSaved = boolValue("auto_format_when_saved", false);
|
2022-12-16 01:03:57 +08:00
|
|
|
mRemoveTrailingSpacesWhenSaved = boolValue("remove_trailing_spaces_when_saved",false);
|
2022-11-07 21:44:12 +08:00
|
|
|
mParseTodos = boolValue("parse_todos",true);
|
|
|
|
|
2022-11-22 15:14:05 +08:00
|
|
|
mCustomCTypeKeywords = stringListValue("custom_c_type_keywords");
|
|
|
|
mEnableCustomCTypeKeywords = boolValue("enable_custom_c_type_keywords",false);
|
2022-03-20 18:10:53 +08:00
|
|
|
|
2021-09-21 20:36:43 +08:00
|
|
|
//tooltips
|
|
|
|
mEnableTooltips = boolValue("enable_tooltips",true);
|
|
|
|
mEnableDebugTooltips = boolValue("enable_debug_tooltips",true);
|
|
|
|
mEnableIdentifierToolTips = boolValue("enable_identifier_tooltips",true);
|
|
|
|
mEnableHeaderToolTips = boolValue("enable_header_tooltips", true);
|
|
|
|
mEnableIssueToolTips = boolValue("enable_issue_tooltips", true);
|
|
|
|
mShowFunctionTips = boolValue("show_function_tips",true);
|
2023-02-17 09:03:35 +08:00
|
|
|
mTipsDelay = intValue("tips_delay",500);
|
2021-06-07 11:02:03 +08:00
|
|
|
}
|
|
|
|
|
2022-09-27 14:01:38 +08:00
|
|
|
QSynedit::EditCaretType Settings::Editor::caretForOverwrite() const
|
2021-06-07 11:02:03 +08:00
|
|
|
{
|
|
|
|
return mCaretForOverwrite;
|
|
|
|
}
|
|
|
|
|
2022-09-27 14:01:38 +08:00
|
|
|
void Settings::Editor::setCaretForOverwrite(const QSynedit::EditCaretType &caretForOverwrite)
|
2021-06-07 11:02:03 +08:00
|
|
|
{
|
|
|
|
mCaretForOverwrite = caretForOverwrite;
|
|
|
|
}
|
|
|
|
|
2022-09-27 14:01:38 +08:00
|
|
|
QSynedit::EditCaretType Settings::Editor::caretForInsert() const
|
2021-06-07 11:02:03 +08:00
|
|
|
{
|
|
|
|
return mCaretForInsert;
|
|
|
|
}
|
|
|
|
|
2022-09-27 14:01:38 +08:00
|
|
|
void Settings::Editor::setCaretForInsert(const QSynedit::EditCaretType &caretForInsert)
|
2021-06-07 11:02:03 +08:00
|
|
|
{
|
|
|
|
mCaretForInsert = caretForInsert;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::enhanceEndKey() const
|
|
|
|
{
|
|
|
|
return mEnhanceEndKey;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setEnhanceEndKey(bool enhanceEndKey)
|
|
|
|
{
|
|
|
|
mEnhanceEndKey = enhanceEndKey;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::enhanceHomeKey() const
|
|
|
|
{
|
|
|
|
return mEnhanceHomeKey;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setEnhanceHomeKey(bool enhanceHomeKey)
|
|
|
|
{
|
|
|
|
mEnhanceHomeKey = enhanceHomeKey;
|
|
|
|
}
|
|
|
|
|
|
|
|
QColor Settings::Editor::indentLineColor() const
|
|
|
|
{
|
|
|
|
return mIndentLineColor;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setIndentLineColor(const QColor &indentLineColor)
|
|
|
|
{
|
|
|
|
mIndentLineColor = indentLineColor;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::showIndentLines() const
|
|
|
|
{
|
|
|
|
return mShowIndentLines;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setShowIndentLines(bool showIndentLines)
|
|
|
|
{
|
|
|
|
mShowIndentLines = showIndentLines;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::Editor::tabWidth() const
|
|
|
|
{
|
|
|
|
return mTabWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setTabWidth(int tabWidth)
|
|
|
|
{
|
|
|
|
mTabWidth = tabWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Editor::tabToSpaces() const
|
|
|
|
{
|
|
|
|
return mTabToSpaces;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Editor::setTabToSpaces(bool tabToSpaces)
|
|
|
|
{
|
|
|
|
mTabToSpaces = tabToSpaces;
|
|
|
|
}
|
|
|
|
|
2022-07-24 18:24:21 +08:00
|
|
|
Settings::CompilerSet::CompilerSet():
|
2022-07-24 19:08:09 +08:00
|
|
|
mFullLoaded(false),
|
2022-12-13 15:58:27 +08:00
|
|
|
mCompilerType(CompilerType::Unknown),
|
|
|
|
mCompilerSetType(CompilerSetType::RELEASE),
|
|
|
|
mAutoAddCharsetParams(false),
|
2022-07-24 18:24:21 +08:00
|
|
|
mExecCharset(ENCODING_SYSTEM_DEFAULT),
|
2022-12-13 15:58:27 +08:00
|
|
|
mStaticLink(false),
|
2022-10-12 19:48:35 +08:00
|
|
|
mPreprocessingSuffix(DEFAULT_PREPROCESSING_SUFFIX),
|
|
|
|
mCompilationProperSuffix(DEFAULT_COMPILATION_SUFFIX),
|
|
|
|
mAssemblingSuffix(DEFAULT_ASSEMBLING_SUFFIX),
|
|
|
|
mExecutableSuffix(DEFAULT_EXECUTABLE_SUFFIX),
|
|
|
|
mCompilationStage(Settings::CompilerSet::CompilationStage::GenerateExecutable)
|
2022-07-24 18:24:21 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-12-13 12:40:54 +08:00
|
|
|
Settings::CompilerSet::CompilerSet(const QString& compilerFolder, const QString& c_prog):
|
2021-09-03 20:55:14 +08:00
|
|
|
mAutoAddCharsetParams(true),
|
2022-01-24 11:23:30 +08:00
|
|
|
mExecCharset(ENCODING_SYSTEM_DEFAULT),
|
2022-10-12 19:48:35 +08:00
|
|
|
mStaticLink(true),
|
|
|
|
mPreprocessingSuffix(DEFAULT_PREPROCESSING_SUFFIX),
|
|
|
|
mCompilationProperSuffix(DEFAULT_COMPILATION_SUFFIX),
|
|
|
|
mAssemblingSuffix(DEFAULT_ASSEMBLING_SUFFIX),
|
|
|
|
mExecutableSuffix(DEFAULT_EXECUTABLE_SUFFIX),
|
|
|
|
mCompilationStage(Settings::CompilerSet::CompilationStage::GenerateExecutable)
|
2021-04-15 11:18:14 +08:00
|
|
|
{
|
2022-12-16 11:10:46 +08:00
|
|
|
QDir dir(compilerFolder);
|
|
|
|
if (dir.exists(c_prog)) {
|
|
|
|
|
2022-12-16 16:36:59 +08:00
|
|
|
setProperties(compilerFolder,c_prog);
|
2021-04-15 11:18:14 +08:00
|
|
|
|
|
|
|
//manually set the directories
|
2022-07-24 19:08:09 +08:00
|
|
|
setDirectories(compilerFolder, mCompilerType);
|
2021-04-17 14:52:47 +08:00
|
|
|
|
|
|
|
setExecutables();
|
2021-04-15 11:18:14 +08:00
|
|
|
|
|
|
|
setUserInput();
|
2021-04-17 14:52:47 +08:00
|
|
|
|
2022-03-11 20:51:33 +08:00
|
|
|
mFullLoaded = true;
|
|
|
|
} else {
|
|
|
|
mFullLoaded = false;
|
2021-04-15 11:18:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Settings::CompilerSet::CompilerSet(const Settings::CompilerSet &set):
|
2022-07-04 11:39:06 +08:00
|
|
|
mFullLoaded(set.mFullLoaded),
|
2021-04-17 14:52:47 +08:00
|
|
|
mCCompiler(set.mCCompiler),
|
|
|
|
mCppCompiler(set.mCppCompiler),
|
|
|
|
mMake(set.mMake),
|
|
|
|
mDebugger(set.mDebugger),
|
|
|
|
mResourceCompiler(set.mResourceCompiler),
|
2022-07-24 19:08:09 +08:00
|
|
|
mDebugServer(set.mDebugServer),
|
2023-02-08 21:07:41 +08:00
|
|
|
mAssembler(set.assembler()),
|
2022-07-24 19:08:09 +08:00
|
|
|
|
2021-04-15 11:18:14 +08:00
|
|
|
mBinDirs(set.mBinDirs),
|
|
|
|
mCIncludeDirs(set.mCIncludeDirs),
|
|
|
|
mCppIncludeDirs(set.mCppIncludeDirs),
|
|
|
|
mLibDirs(set.mLibDirs),
|
2022-07-24 19:08:09 +08:00
|
|
|
mDefaultLibDirs(set.mDefaultLibDirs),
|
|
|
|
mDefaultCIncludeDirs(set.mDefaultCIncludeDirs),
|
|
|
|
mDefaultCppIncludeDirs(set.mDefaultCppIncludeDirs),
|
|
|
|
|
2021-04-15 11:18:14 +08:00
|
|
|
mDumpMachine(set.mDumpMachine),
|
|
|
|
mVersion(set.mVersion),
|
|
|
|
mType(set.mType),
|
|
|
|
mName(set.mName),
|
|
|
|
mTarget(set.mTarget),
|
2021-10-03 23:46:40 +08:00
|
|
|
mCompilerType(set.mCompilerType),
|
2022-07-24 19:08:09 +08:00
|
|
|
mCompilerSetType(set.mCompilerSetType),
|
|
|
|
|
2021-04-15 11:18:14 +08:00
|
|
|
mUseCustomCompileParams(set.mUseCustomCompileParams),
|
|
|
|
mUseCustomLinkParams(set.mUseCustomLinkParams),
|
|
|
|
mCustomCompileParams(set.mCustomCompileParams),
|
|
|
|
mCustomLinkParams(set.mCustomLinkParams),
|
2022-03-11 20:51:33 +08:00
|
|
|
mAutoAddCharsetParams(set.mAutoAddCharsetParams),
|
2022-07-24 19:08:09 +08:00
|
|
|
mExecCharset(set.mExecCharset),
|
|
|
|
mStaticLink(set.mStaticLink),
|
2022-10-12 19:48:35 +08:00
|
|
|
mPreprocessingSuffix(set.mPreprocessingSuffix),
|
|
|
|
mCompilationProperSuffix(set.mCompilationProperSuffix),
|
|
|
|
mAssemblingSuffix(set.mAssemblingSuffix),
|
|
|
|
mExecutableSuffix(set.mExecutableSuffix),
|
|
|
|
mCompilationStage(set.mCompilationStage),
|
2022-07-04 11:39:06 +08:00
|
|
|
mCompileOptions(set.mCompileOptions)
|
2021-04-15 11:18:14 +08:00
|
|
|
{
|
2021-04-13 22:17:18 +08:00
|
|
|
|
2021-04-15 11:18:14 +08:00
|
|
|
}
|
2021-04-13 22:17:18 +08:00
|
|
|
|
2022-07-24 19:08:09 +08:00
|
|
|
void Settings::CompilerSet::resetCompileOptionts()
|
|
|
|
{
|
|
|
|
mCompileOptions.clear();
|
|
|
|
}
|
|
|
|
|
2022-05-12 15:28:08 +08:00
|
|
|
bool Settings::CompilerSet::setCompileOption(const QString &key, int valIndex)
|
2021-04-15 11:18:14 +08:00
|
|
|
{
|
2022-05-13 20:22:16 +08:00
|
|
|
PCompilerOption op = CompilerInfoManager::getCompilerOption(mCompilerType, key);
|
2022-05-12 22:42:19 +08:00
|
|
|
if (!op)
|
|
|
|
return false;
|
|
|
|
if (op->choices.isEmpty()) {
|
|
|
|
if (valIndex==1)
|
2022-05-13 20:22:16 +08:00
|
|
|
mCompileOptions.insert(key,COMPILER_OPTION_ON);
|
|
|
|
else
|
|
|
|
mCompileOptions.remove(key);
|
2022-05-12 22:42:19 +08:00
|
|
|
return true;
|
|
|
|
} else if (valIndex>0 && valIndex <= op->choices.length()) {
|
2022-05-13 20:22:16 +08:00
|
|
|
mCompileOptions.insert(key,op->choices[valIndex-1].second);
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
mCompileOptions.remove(key);
|
2022-05-12 15:28:08 +08:00
|
|
|
return true;
|
2021-09-09 11:47:04 +08:00
|
|
|
}
|
2022-05-12 15:28:08 +08:00
|
|
|
return false;
|
2021-09-09 11:47:04 +08:00
|
|
|
}
|
|
|
|
|
2022-05-12 15:28:08 +08:00
|
|
|
bool Settings::CompilerSet::setCompileOption(const QString &key, const QString &value)
|
2021-04-15 11:18:14 +08:00
|
|
|
{
|
2022-05-13 20:22:16 +08:00
|
|
|
PCompilerOption op = CompilerInfoManager::getCompilerOption(mCompilerType,key);
|
2022-05-12 15:28:08 +08:00
|
|
|
if (!op)
|
|
|
|
return false;
|
|
|
|
mCompileOptions.insert(key,value);
|
|
|
|
return true;
|
2021-04-15 11:18:14 +08:00
|
|
|
}
|
|
|
|
|
2022-05-12 15:28:08 +08:00
|
|
|
void Settings::CompilerSet::unsetCompileOption(const QString &key)
|
2021-04-15 11:18:14 +08:00
|
|
|
{
|
2022-05-12 15:28:08 +08:00
|
|
|
mCompileOptions.remove(key);
|
2021-04-15 11:18:14 +08:00
|
|
|
}
|
|
|
|
|
2022-05-14 11:21:59 +08:00
|
|
|
void Settings::CompilerSet::setCompileOptions(const QMap<QString, QString> options)
|
|
|
|
{
|
|
|
|
mCompileOptions=options;
|
|
|
|
}
|
|
|
|
|
2022-05-12 15:28:08 +08:00
|
|
|
QString Settings::CompilerSet::getCompileOptionValue(const QString &key)
|
2021-04-15 11:18:14 +08:00
|
|
|
{
|
2022-05-12 15:28:08 +08:00
|
|
|
return mCompileOptions.value(key,QString());
|
2021-04-15 11:18:14 +08:00
|
|
|
}
|
|
|
|
|
2022-12-20 20:38:02 +08:00
|
|
|
//static void checkDirs(const QStringList& dirlist, QString& gooddirs, QString& baddirs) {
|
|
|
|
// gooddirs = "";
|
|
|
|
// baddirs = "";
|
|
|
|
|
|
|
|
// for (int i=0; i<dirlist.count();i++) {
|
|
|
|
// QDir dir(dirlist[i]);
|
|
|
|
// if (!dir.exists()) {
|
|
|
|
// if (baddirs.isEmpty()) {
|
|
|
|
// baddirs = dirlist[i];
|
|
|
|
// } else {
|
|
|
|
// baddirs += ";" + dirlist[i];
|
|
|
|
// }
|
|
|
|
// } else {
|
|
|
|
// if (gooddirs.isEmpty()) {
|
|
|
|
// gooddirs = dirlist[i];
|
|
|
|
// } else {
|
|
|
|
// gooddirs += ";" + dirlist[i];
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//}
|
2021-06-24 16:05:19 +08:00
|
|
|
|
|
|
|
|
2022-12-16 11:10:46 +08:00
|
|
|
//bool Settings::CompilerSet::dirsValid(QString &msg)
|
|
|
|
//{
|
|
|
|
// QString goodbin, badbin, goodlib, badlib, goodinc, badinc, goodinccpp, badinccpp;
|
|
|
|
// msg = "";
|
|
|
|
|
|
|
|
// if (mBinDirs.count()>0) {// we need some bin dir, so treat count=0 as an error too
|
|
|
|
// checkDirs(mBinDirs,goodbin,badbin);
|
|
|
|
// if (!badbin.isEmpty()) {
|
|
|
|
// msg += QObject::tr("The following %1 directories don't exist:").arg(
|
|
|
|
// QObject::tr("binary")
|
|
|
|
// );
|
|
|
|
// msg += "<br />";
|
|
|
|
// msg += badbin.replace(';',"<br />");
|
|
|
|
// msg += "<br />";
|
|
|
|
// msg += "<br />";
|
|
|
|
// return false;
|
|
|
|
// }
|
|
|
|
// } else {
|
|
|
|
// msg += QObject::tr("No %1 directories have been specified.").arg(
|
|
|
|
// QObject::tr("binary")
|
|
|
|
// );
|
|
|
|
// msg += "<br />";
|
|
|
|
// msg += "<br />";
|
|
|
|
// return false;
|
|
|
|
// }
|
|
|
|
// checkDirs(mCIncludeDirs,goodbin,badbin);
|
|
|
|
// if (!badbin.isEmpty()) {
|
|
|
|
// msg += QObject::tr("The following %1 directories don't exist:").arg(
|
|
|
|
// QObject::tr("C include")
|
|
|
|
// );
|
|
|
|
// msg += "<br />";
|
|
|
|
// msg += badbin.replace(';',"<br />");
|
|
|
|
// msg += "<br />";
|
|
|
|
// msg += "<br />";
|
|
|
|
// return false;
|
|
|
|
// }
|
2021-06-24 16:05:19 +08:00
|
|
|
|
2022-12-16 11:10:46 +08:00
|
|
|
// checkDirs(mCppIncludeDirs,goodbin,badbin);
|
|
|
|
// if (!badbin.isEmpty()) {
|
|
|
|
// msg += QObject::tr("The following %1 directories don't exist:").arg(
|
|
|
|
// QObject::tr("C++ include")
|
|
|
|
// );
|
|
|
|
// msg += "<br />";
|
|
|
|
// msg += badbin.replace(';',"<br />");
|
|
|
|
// msg += "<br />";
|
|
|
|
// msg += "<br />";
|
|
|
|
// return false;
|
|
|
|
// }
|
2021-06-24 16:05:19 +08:00
|
|
|
|
2022-12-16 11:10:46 +08:00
|
|
|
// checkDirs(mLibDirs,goodbin,badbin);
|
|
|
|
// if (!badbin.isEmpty()) {
|
|
|
|
// msg += QObject::tr("The following %1 directories don't exist:").arg(
|
|
|
|
// QObject::tr("C++ include")
|
|
|
|
// );
|
|
|
|
// msg += "<br />";
|
|
|
|
// msg += badbin.replace(';',"<br />");
|
|
|
|
// msg += "<br />";
|
|
|
|
// msg += "<br />";
|
|
|
|
// return false;
|
|
|
|
// }
|
2021-06-24 16:05:19 +08:00
|
|
|
|
2022-12-16 11:10:46 +08:00
|
|
|
// if (!msg.isEmpty())
|
|
|
|
// return false;
|
|
|
|
// else
|
|
|
|
// return true;
|
|
|
|
//}
|
2021-06-24 16:05:19 +08:00
|
|
|
|
2022-12-13 15:58:27 +08:00
|
|
|
//bool Settings::CompilerSet::validateExes(QString &msg)
|
|
|
|
//{
|
|
|
|
// msg ="";
|
|
|
|
// if (!fileExists(mCCompiler)) {
|
|
|
|
// msg += QObject::tr("Cannot find the %1 \"%2\"")
|
|
|
|
// .arg(QObject::tr("C Compiler"))
|
|
|
|
// .arg(mCCompiler);
|
|
|
|
// }
|
|
|
|
// if (!fileExists(mCppCompiler)) {
|
|
|
|
// msg += QObject::tr("Cannot find the %1 \"%2\"")
|
|
|
|
// .arg(QObject::tr("C++ Compiler"))
|
|
|
|
// .arg(mCppCompiler);
|
|
|
|
// }
|
|
|
|
// if (!mMake.isEmpty() && !fileExists(mMake)) {
|
|
|
|
// msg += QObject::tr("Cannot find the %1 \"%2\"")
|
|
|
|
// .arg(QObject::tr("Maker"))
|
|
|
|
// .arg(mMake);
|
|
|
|
// }
|
|
|
|
// if (!fileExists(mDebugger)) {
|
|
|
|
// msg += QObject::tr("Cannot find the %1 \"%2\"")
|
|
|
|
// .arg(QObject::tr("Debugger"))
|
|
|
|
// .arg(mDebugger);
|
|
|
|
// }
|
|
|
|
// if (!msg.isEmpty())
|
|
|
|
// return false;
|
|
|
|
// else
|
|
|
|
// return true;
|
|
|
|
//}
|
2021-04-16 22:04:48 +08:00
|
|
|
|
2021-04-17 14:52:47 +08:00
|
|
|
const QString &Settings::CompilerSet::CCompiler() const
|
2021-04-15 11:18:14 +08:00
|
|
|
{
|
2021-04-17 14:52:47 +08:00
|
|
|
return mCCompiler;
|
2021-04-15 11:18:14 +08:00
|
|
|
}
|
|
|
|
|
2021-04-17 14:52:47 +08:00
|
|
|
void Settings::CompilerSet::setCCompiler(const QString &name)
|
2021-04-15 11:18:14 +08:00
|
|
|
{
|
2022-12-13 15:58:27 +08:00
|
|
|
if (mCCompiler!=name) {
|
|
|
|
mCCompiler = name;
|
|
|
|
if (mCompilerType == CompilerType::Unknown) {
|
|
|
|
QString temp=extractFileName(mCCompiler);
|
|
|
|
if (temp == CLANG_PROGRAM) {
|
|
|
|
setCompilerType(CompilerType::Clang);
|
|
|
|
} else if (temp == GCC_PROGRAM) {
|
|
|
|
setCompilerType(CompilerType::GCC);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-04-15 11:18:14 +08:00
|
|
|
}
|
|
|
|
|
2021-04-17 14:52:47 +08:00
|
|
|
const QString &Settings::CompilerSet::cppCompiler() const
|
2021-04-15 11:18:14 +08:00
|
|
|
{
|
2021-04-17 14:52:47 +08:00
|
|
|
return mCppCompiler;
|
2021-04-15 11:18:14 +08:00
|
|
|
}
|
|
|
|
|
2021-04-17 14:52:47 +08:00
|
|
|
void Settings::CompilerSet::setCppCompiler(const QString &name)
|
2021-04-15 11:18:14 +08:00
|
|
|
{
|
2021-04-17 14:52:47 +08:00
|
|
|
mCppCompiler = name;
|
2021-04-15 11:18:14 +08:00
|
|
|
}
|
|
|
|
|
2021-04-17 14:52:47 +08:00
|
|
|
const QString &Settings::CompilerSet::make() const
|
2021-04-15 11:18:14 +08:00
|
|
|
{
|
2021-04-17 14:52:47 +08:00
|
|
|
return mMake;
|
2021-04-15 11:18:14 +08:00
|
|
|
}
|
|
|
|
|
2021-04-17 14:52:47 +08:00
|
|
|
void Settings::CompilerSet::setMake(const QString &name)
|
2021-04-15 11:18:14 +08:00
|
|
|
{
|
2021-04-17 14:52:47 +08:00
|
|
|
mMake = name;
|
2021-04-15 11:18:14 +08:00
|
|
|
}
|
|
|
|
|
2021-04-17 14:52:47 +08:00
|
|
|
const QString &Settings::CompilerSet::debugger() const
|
2021-04-15 11:18:14 +08:00
|
|
|
{
|
2021-04-17 14:52:47 +08:00
|
|
|
return mDebugger;
|
2021-04-15 11:18:14 +08:00
|
|
|
}
|
|
|
|
|
2021-04-17 14:52:47 +08:00
|
|
|
void Settings::CompilerSet::setDebugger(const QString &name)
|
2021-04-15 11:18:14 +08:00
|
|
|
{
|
2021-04-17 14:52:47 +08:00
|
|
|
mDebugger = name;
|
2021-04-15 11:18:14 +08:00
|
|
|
}
|
|
|
|
|
2021-04-17 14:52:47 +08:00
|
|
|
const QString &Settings::CompilerSet::resourceCompiler() const
|
2021-04-15 21:32:45 +08:00
|
|
|
{
|
2021-04-17 14:52:47 +08:00
|
|
|
return mResourceCompiler;
|
2021-04-15 21:32:45 +08:00
|
|
|
}
|
|
|
|
|
2021-04-17 14:52:47 +08:00
|
|
|
void Settings::CompilerSet::setResourceCompiler(const QString &name)
|
2021-04-15 21:32:45 +08:00
|
|
|
{
|
2021-04-17 14:52:47 +08:00
|
|
|
mResourceCompiler = name;
|
2021-04-15 21:32:45 +08:00
|
|
|
}
|
|
|
|
|
2021-04-15 11:18:14 +08:00
|
|
|
QStringList &Settings::CompilerSet::binDirs()
|
|
|
|
{
|
|
|
|
return mBinDirs;
|
|
|
|
}
|
|
|
|
|
|
|
|
QStringList &Settings::CompilerSet::CIncludeDirs()
|
|
|
|
{
|
|
|
|
return mCIncludeDirs;
|
|
|
|
}
|
|
|
|
|
|
|
|
QStringList &Settings::CompilerSet::CppIncludeDirs()
|
|
|
|
{
|
|
|
|
return mCppIncludeDirs;
|
|
|
|
}
|
|
|
|
|
2021-04-17 22:38:46 +08:00
|
|
|
QStringList &Settings::CompilerSet::libDirs()
|
2021-04-15 11:18:14 +08:00
|
|
|
{
|
|
|
|
return mLibDirs;
|
|
|
|
}
|
|
|
|
|
2021-09-04 20:49:44 +08:00
|
|
|
QStringList &Settings::CompilerSet::defaultCIncludeDirs()
|
|
|
|
{
|
2022-03-11 20:51:33 +08:00
|
|
|
if (!mFullLoaded && !binDirs().isEmpty()) {
|
|
|
|
mFullLoaded=true;
|
2022-07-24 19:08:09 +08:00
|
|
|
setDirectories(binDirs()[0],mCompilerType);
|
2022-03-11 20:51:33 +08:00
|
|
|
}
|
2021-09-04 20:49:44 +08:00
|
|
|
return mDefaultCIncludeDirs;
|
|
|
|
}
|
|
|
|
|
|
|
|
QStringList &Settings::CompilerSet::defaultCppIncludeDirs()
|
|
|
|
{
|
2022-03-11 20:51:33 +08:00
|
|
|
if (!mFullLoaded && !binDirs().isEmpty()) {
|
|
|
|
mFullLoaded=true;
|
2022-07-24 19:08:09 +08:00
|
|
|
setDirectories(binDirs()[0],mCompilerType);
|
2022-03-11 20:51:33 +08:00
|
|
|
}
|
2021-09-04 20:49:44 +08:00
|
|
|
return mDefaultCppIncludeDirs;
|
|
|
|
}
|
|
|
|
|
|
|
|
QStringList &Settings::CompilerSet::defaultLibDirs()
|
|
|
|
{
|
2022-03-11 20:51:33 +08:00
|
|
|
if (!mFullLoaded && !binDirs().isEmpty()) {
|
|
|
|
mFullLoaded=true;
|
2022-07-24 19:08:09 +08:00
|
|
|
setDirectories(binDirs()[0],mCompilerType);
|
2022-03-11 20:51:33 +08:00
|
|
|
}
|
2021-09-04 20:49:44 +08:00
|
|
|
return mLibDirs;
|
|
|
|
}
|
|
|
|
|
2021-08-29 10:14:07 +08:00
|
|
|
const QString &Settings::CompilerSet::dumpMachine() const
|
2021-04-15 11:18:14 +08:00
|
|
|
{
|
|
|
|
return mDumpMachine;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CompilerSet::setDumpMachine(const QString &value)
|
|
|
|
{
|
|
|
|
mDumpMachine = value;
|
|
|
|
}
|
|
|
|
|
2021-08-29 10:14:07 +08:00
|
|
|
const QString &Settings::CompilerSet::version() const
|
2021-04-15 11:18:14 +08:00
|
|
|
{
|
|
|
|
return mVersion;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CompilerSet::setVersion(const QString &value)
|
|
|
|
{
|
|
|
|
mVersion = value;
|
|
|
|
}
|
|
|
|
|
2021-08-29 10:14:07 +08:00
|
|
|
const QString &Settings::CompilerSet::type() const
|
2021-04-15 11:18:14 +08:00
|
|
|
{
|
|
|
|
return mType;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CompilerSet::setType(const QString& value)
|
|
|
|
{
|
|
|
|
mType = value;
|
|
|
|
}
|
|
|
|
|
2021-08-29 10:14:07 +08:00
|
|
|
const QString &Settings::CompilerSet::name() const
|
2021-04-15 21:32:45 +08:00
|
|
|
{
|
|
|
|
return mName;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CompilerSet::setName(const QString &value)
|
|
|
|
{
|
|
|
|
mName = value;
|
|
|
|
}
|
|
|
|
|
2021-08-29 10:14:07 +08:00
|
|
|
const QString &Settings::CompilerSet::target() const
|
2021-04-15 11:18:14 +08:00
|
|
|
{
|
|
|
|
return mTarget;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CompilerSet::setTarget(const QString &value)
|
|
|
|
{
|
|
|
|
mTarget = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CompilerSet::setUseCustomCompileParams(bool value)
|
|
|
|
{
|
|
|
|
mUseCustomCompileParams = value;
|
|
|
|
}
|
|
|
|
|
2021-08-29 10:14:07 +08:00
|
|
|
bool Settings::CompilerSet::useCustomLinkParams() const
|
2021-04-15 11:18:14 +08:00
|
|
|
{
|
|
|
|
return mUseCustomLinkParams;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CompilerSet::setUseCustomLinkParams(bool value)
|
|
|
|
{
|
|
|
|
mUseCustomLinkParams = value;
|
|
|
|
}
|
|
|
|
|
2021-08-29 10:14:07 +08:00
|
|
|
const QString &Settings::CompilerSet::customCompileParams() const
|
2021-04-15 11:18:14 +08:00
|
|
|
{
|
|
|
|
return mCustomCompileParams;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CompilerSet::setCustomCompileParams(const QString &value)
|
|
|
|
{
|
|
|
|
mCustomCompileParams = value;
|
|
|
|
}
|
|
|
|
|
2021-08-29 10:14:07 +08:00
|
|
|
const QString &Settings::CompilerSet::customLinkParams() const
|
2021-04-15 11:18:14 +08:00
|
|
|
{
|
|
|
|
return mCustomLinkParams;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CompilerSet::setCustomLinkParams(const QString &value)
|
|
|
|
{
|
|
|
|
mCustomLinkParams = value;
|
|
|
|
}
|
|
|
|
|
2021-08-29 10:14:07 +08:00
|
|
|
bool Settings::CompilerSet::autoAddCharsetParams() const
|
2021-04-15 11:18:14 +08:00
|
|
|
{
|
|
|
|
return mAutoAddCharsetParams;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CompilerSet::setAutoAddCharsetParams(bool value)
|
|
|
|
{
|
|
|
|
mAutoAddCharsetParams = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::CompilerSet::charToValue(char valueChar)
|
|
|
|
{
|
|
|
|
if (valueChar == '1') {
|
|
|
|
return 1;
|
|
|
|
} else if ( (valueChar>='a') && (valueChar<='z')) {
|
|
|
|
return (valueChar-'a')+2;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-15 11:23:42 +08:00
|
|
|
char Settings::CompilerSet::valueToChar(int val)
|
|
|
|
{
|
|
|
|
return ValueToChar[val];
|
|
|
|
}
|
|
|
|
|
2021-04-15 11:18:14 +08:00
|
|
|
static void addExistingDirectory(QStringList& dirs, const QString& directory) {
|
|
|
|
if (!directoryExists(directory))
|
|
|
|
return;
|
|
|
|
QFileInfo dirInfo(directory);
|
|
|
|
QString dirPath = dirInfo.absoluteFilePath();
|
|
|
|
if (dirs.contains(dirPath))
|
|
|
|
return;
|
|
|
|
dirs.append(dirPath);
|
|
|
|
}
|
|
|
|
|
2022-12-16 16:36:59 +08:00
|
|
|
void Settings::CompilerSet::setProperties(const QString& binDir, const QString& c_prog)
|
2021-04-15 11:18:14 +08:00
|
|
|
{
|
2022-12-16 16:36:59 +08:00
|
|
|
// We have tested before the call
|
|
|
|
// if (!fileExists(c_prog))
|
|
|
|
// return;
|
2021-04-15 11:18:14 +08:00
|
|
|
// Obtain version number and compiler distro etc
|
|
|
|
QStringList arguments;
|
|
|
|
arguments.append("-v");
|
2022-12-16 16:36:59 +08:00
|
|
|
QByteArray output = getCompilerOutput(binDir, c_prog,arguments);
|
2021-04-15 11:18:14 +08:00
|
|
|
|
|
|
|
//Target
|
|
|
|
QByteArray targetStr = "Target: ";
|
|
|
|
int delimPos1 = output.indexOf(targetStr);
|
|
|
|
if (delimPos1<0)
|
|
|
|
return; // unknown binary
|
|
|
|
delimPos1+=strlen(targetStr);
|
|
|
|
int delimPos2 = delimPos1;
|
|
|
|
while (delimPos2<output.length() && !isNonPrintableAsciiChar(output[delimPos2]))
|
|
|
|
delimPos2++;
|
2022-12-10 12:00:57 +08:00
|
|
|
QString triplet = output.mid(delimPos1,delimPos2-delimPos1);
|
2021-04-15 11:18:14 +08:00
|
|
|
|
2022-12-10 12:00:57 +08:00
|
|
|
int tripletDelimPos1 = triplet.indexOf('-');
|
|
|
|
mTarget = triplet.mid(0, tripletDelimPos1);
|
2021-04-15 11:18:14 +08:00
|
|
|
|
|
|
|
//Find version number
|
2021-10-03 23:46:40 +08:00
|
|
|
targetStr = "clang version ";
|
2021-04-15 11:18:14 +08:00
|
|
|
delimPos1 = output.indexOf(targetStr);
|
2021-10-03 23:46:40 +08:00
|
|
|
if (delimPos1>=0) {
|
2022-10-30 11:58:42 +08:00
|
|
|
mCompilerType = CompilerType::Clang;
|
2021-10-03 23:46:40 +08:00
|
|
|
delimPos1+=strlen(targetStr);
|
|
|
|
delimPos2 = delimPos1;
|
|
|
|
while (delimPos2<output.length() && !isNonPrintableAsciiChar(output[delimPos2]))
|
|
|
|
delimPos2++;
|
|
|
|
mVersion = output.mid(delimPos1,delimPos2-delimPos1);
|
2021-04-15 11:18:14 +08:00
|
|
|
|
2021-10-03 23:46:40 +08:00
|
|
|
mName = "Clang " + mVersion;
|
|
|
|
} else {
|
2022-10-30 11:58:42 +08:00
|
|
|
mCompilerType = CompilerType::GCC;
|
2021-10-03 23:46:40 +08:00
|
|
|
targetStr = "gcc version ";
|
|
|
|
delimPos1 = output.indexOf(targetStr);
|
|
|
|
if (delimPos1<0)
|
|
|
|
return; // unknown binary
|
|
|
|
delimPos1+=strlen(targetStr);
|
|
|
|
delimPos2 = delimPos1;
|
|
|
|
while (delimPos2<output.length() && !isNonPrintableAsciiChar(output[delimPos2]))
|
|
|
|
delimPos2++;
|
|
|
|
mVersion = output.mid(delimPos1,delimPos2-delimPos1);
|
|
|
|
|
2022-10-30 11:58:42 +08:00
|
|
|
int majorVersion;
|
|
|
|
if (mVersion.indexOf('.')>0) {
|
|
|
|
bool ok;
|
|
|
|
majorVersion=mVersion.left(mVersion.indexOf('.')).toInt(&ok);
|
|
|
|
if (!ok)
|
|
|
|
majorVersion=-1;
|
|
|
|
} else {
|
|
|
|
bool ok;
|
|
|
|
majorVersion=mVersion.toInt(&ok);
|
|
|
|
if (!ok)
|
|
|
|
majorVersion=-1;
|
|
|
|
}
|
2022-07-21 15:28:07 +08:00
|
|
|
// //fix for mingw64 gcc
|
|
|
|
// double versionValue;
|
|
|
|
// bool ok;
|
|
|
|
// versionValue = mVersion.toDouble(&ok);
|
|
|
|
// if (ok && versionValue>=12) {
|
|
|
|
// mCompilerType=COMPILER_GCC_UTF8;
|
|
|
|
// }
|
|
|
|
|
2021-10-03 23:46:40 +08:00
|
|
|
// Find compiler builder
|
|
|
|
delimPos1 = delimPos2;
|
|
|
|
while ((delimPos1 < output.length()) && !(output[delimPos1] == '('))
|
|
|
|
delimPos1++;
|
|
|
|
while ((delimPos2 < output.length()) && !(output[delimPos2] == ')'))
|
|
|
|
delimPos2++;
|
|
|
|
mType = output.mid(delimPos1 + 1, delimPos2 - delimPos1 - 1);
|
|
|
|
|
2022-10-30 11:58:42 +08:00
|
|
|
if (majorVersion>=12 && mType.contains("MSYS2"))
|
|
|
|
mCompilerType = CompilerType::GCC_UTF8;
|
2021-10-03 23:46:40 +08:00
|
|
|
// Assemble user friendly name if we don't have one yet
|
|
|
|
if (mName == "") {
|
2022-11-25 10:01:10 +08:00
|
|
|
if (mType.contains("tdm64",Qt::CaseInsensitive)) {
|
2021-10-03 23:46:40 +08:00
|
|
|
mName = "TDM-GCC " + mVersion;
|
2022-11-25 10:01:10 +08:00
|
|
|
} else if (mType.contains("tdm",Qt::CaseInsensitive)) {
|
2021-10-03 23:46:40 +08:00
|
|
|
mName = "TDM-GCC " + mVersion;
|
2022-11-25 10:01:10 +08:00
|
|
|
} else if (mType.contains("MSYS2",Qt::CaseInsensitive)) {
|
2021-10-03 23:46:40 +08:00
|
|
|
mName = "MinGW-w64 GCC " + mVersion;
|
2022-11-25 10:01:10 +08:00
|
|
|
} else if (mType.contains("MinGW-W64",Qt::CaseInsensitive)) {
|
|
|
|
mName = "MinGW-w64 GCC " + mVersion;
|
|
|
|
} else if (mType.contains("GCC",Qt::CaseInsensitive)) {
|
2022-04-25 21:48:04 +08:00
|
|
|
#ifdef Q_OS_WIN
|
2021-10-03 23:46:40 +08:00
|
|
|
mName = "MinGW GCC " + mVersion;
|
2022-04-25 21:48:04 +08:00
|
|
|
#else
|
|
|
|
mName = "GCC " + mVersion;
|
|
|
|
#endif
|
2021-10-03 23:46:40 +08:00
|
|
|
} else {
|
2022-04-25 21:48:04 +08:00
|
|
|
#ifdef Q_OS_WIN
|
2021-10-03 23:46:40 +08:00
|
|
|
mName = "MinGW GCC " + mVersion;
|
2022-04-25 21:48:04 +08:00
|
|
|
#else
|
|
|
|
mName = "GCC " + mVersion;
|
|
|
|
#endif
|
2021-10-03 23:46:40 +08:00
|
|
|
}
|
2021-04-15 11:18:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set compiler folder
|
|
|
|
QDir tmpDir(binDir);
|
|
|
|
tmpDir.cdUp();
|
2021-04-17 14:52:47 +08:00
|
|
|
QString folder = tmpDir.path();
|
2021-04-15 11:18:14 +08:00
|
|
|
|
|
|
|
// Obtain compiler target
|
|
|
|
arguments.clear();
|
|
|
|
arguments.append("-dumpmachine");
|
2022-12-13 12:40:54 +08:00
|
|
|
mDumpMachine = getCompilerOutput(binDir, c_prog, arguments);
|
2021-04-15 11:18:14 +08:00
|
|
|
|
|
|
|
// Add the default directories
|
2021-04-20 22:24:33 +08:00
|
|
|
addExistingDirectory(mBinDirs, includeTrailingPathDelimiter(folder) + "bin");
|
2021-09-04 21:20:30 +08:00
|
|
|
// addExistingDirectory(mDefaultLibDirs, includeTrailingPathDelimiter(folder) + "lib");
|
|
|
|
// addExistingDirectory(mDefaultCIncludeDirs, includeTrailingPathDelimiter(folder) + "include");
|
|
|
|
// addExistingDirectory(mDefaultCppIncludeDirs, includeTrailingPathDelimiter(folder) + "include");
|
2021-04-15 11:18:14 +08:00
|
|
|
|
2021-09-04 21:20:30 +08:00
|
|
|
if (!mDumpMachine.isEmpty()) {
|
|
|
|
//mingw-w64 bin folder
|
|
|
|
addExistingDirectory(mBinDirs,
|
|
|
|
includeTrailingPathDelimiter(folder) + "lib/"
|
|
|
|
"gcc/" + mDumpMachine
|
|
|
|
+ "/" + mVersion);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-19 11:08:32 +08:00
|
|
|
QStringList Settings::CompilerSet::defines(bool isCpp) {
|
2021-09-04 21:20:30 +08:00
|
|
|
// get default defines
|
|
|
|
QStringList arguments;
|
|
|
|
arguments.append("-dM");
|
|
|
|
arguments.append("-E");
|
|
|
|
arguments.append("-x");
|
2023-01-19 11:08:32 +08:00
|
|
|
QString key;
|
|
|
|
if (isCpp) {
|
|
|
|
arguments.append("c++");
|
|
|
|
key=CC_CMD_OPT_STD;
|
|
|
|
} else {
|
|
|
|
arguments.append("c");
|
|
|
|
key=C_CMD_OPT_STD;
|
|
|
|
}
|
|
|
|
//language standard
|
|
|
|
PCompilerOption pOption = CompilerInfoManager::getCompilerOption(compilerType(), key);
|
|
|
|
if (pOption) {
|
|
|
|
if (!mCompileOptions[key].isEmpty())
|
|
|
|
arguments.append(pOption->setting + mCompileOptions[key]);
|
|
|
|
}
|
|
|
|
|
2021-09-04 21:20:30 +08:00
|
|
|
arguments.append(NULL_FILE);
|
2023-01-19 20:08:22 +08:00
|
|
|
//qDebug()<<arguments;
|
2021-09-04 21:20:30 +08:00
|
|
|
QFileInfo ccompiler(mCCompiler);
|
|
|
|
QByteArray output = getCompilerOutput(ccompiler.absolutePath(),ccompiler.fileName(),arguments);
|
|
|
|
// 'cpp.exe -dM -E -x c++ -std=c++17 NUL'
|
|
|
|
|
2023-01-19 11:08:32 +08:00
|
|
|
QStringList result;
|
2021-09-04 21:20:30 +08:00
|
|
|
QList<QByteArray> lines = output.split('\n');
|
|
|
|
for (QByteArray& line:lines) {
|
|
|
|
QByteArray trimmedLine = line.trimmed();
|
|
|
|
if (!trimmedLine.isEmpty()) {
|
2023-01-19 11:08:32 +08:00
|
|
|
result.append(trimmedLine);
|
2022-07-28 13:51:38 +08:00
|
|
|
}
|
|
|
|
}
|
2023-01-19 11:08:32 +08:00
|
|
|
return result;
|
2021-09-04 21:20:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CompilerSet::setExecutables()
|
|
|
|
{
|
2022-10-30 11:58:42 +08:00
|
|
|
if (mCompilerType == CompilerType::Clang) {
|
2022-04-27 11:24:40 +08:00
|
|
|
mCCompiler = findProgramInBinDirs(CLANG_PROGRAM);
|
|
|
|
mCppCompiler = findProgramInBinDirs(CLANG_CPP_PROGRAM);
|
2023-01-23 19:34:09 +08:00
|
|
|
mDebugger = findProgramInBinDirs(GDB_PROGRAM);
|
2023-01-22 22:19:19 +08:00
|
|
|
if (mDebugger.isEmpty()) {
|
2023-01-23 19:34:09 +08:00
|
|
|
mDebugger = findProgramInBinDirs(LLDB_MI_PROGRAM);
|
2023-01-22 22:19:19 +08:00
|
|
|
mDebugServer = findProgramInBinDirs(LLDB_SERVER_PROGRAM);
|
2023-01-23 19:34:09 +08:00
|
|
|
} else {
|
|
|
|
mDebugServer = findProgramInBinDirs(GDB_SERVER_PROGRAM);
|
2023-01-22 22:19:19 +08:00
|
|
|
}
|
2022-04-27 11:24:40 +08:00
|
|
|
if (mCCompiler.isEmpty())
|
|
|
|
mCCompiler = findProgramInBinDirs(GCC_PROGRAM);
|
|
|
|
if (mCppCompiler.isEmpty())
|
|
|
|
mCppCompiler = findProgramInBinDirs(GPP_PROGRAM);
|
2022-04-27 15:26:13 +08:00
|
|
|
// if (mDebugger.isEmpty())
|
|
|
|
// mDebugger = findProgramInBinDirs(GDB_PROGRAM);
|
|
|
|
// if (mDebugServer.isEmpty())
|
|
|
|
// mDebugServer = findProgramInBinDirs(GDB_SERVER_PROGRAM);
|
2022-04-27 11:24:40 +08:00
|
|
|
} else {
|
|
|
|
mCCompiler = findProgramInBinDirs(GCC_PROGRAM);
|
|
|
|
mCppCompiler = findProgramInBinDirs(GPP_PROGRAM);
|
|
|
|
mDebugger = findProgramInBinDirs(GDB_PROGRAM);
|
|
|
|
mDebugServer = findProgramInBinDirs(GDB_SERVER_PROGRAM);
|
|
|
|
}
|
2021-09-04 21:20:30 +08:00
|
|
|
mMake = findProgramInBinDirs(MAKE_PROGRAM);
|
|
|
|
mResourceCompiler = findProgramInBinDirs(WINDRES_PROGRAM);
|
2023-02-08 21:07:41 +08:00
|
|
|
mAssembler = findProgramInBinDirs(ASSEMBLER);
|
2021-09-04 21:20:30 +08:00
|
|
|
}
|
|
|
|
|
2022-10-30 11:58:42 +08:00
|
|
|
void Settings::CompilerSet::setDirectories(const QString& binDir,CompilerType compilerType)
|
2021-09-04 21:20:30 +08:00
|
|
|
{
|
|
|
|
QString folder = QFileInfo(binDir).absolutePath();
|
2022-12-13 12:40:54 +08:00
|
|
|
QString c_prog;
|
2022-10-30 11:58:42 +08:00
|
|
|
if (compilerType==CompilerType::Clang)
|
2022-12-13 12:40:54 +08:00
|
|
|
c_prog = CLANG_PROGRAM;
|
2022-07-24 19:08:09 +08:00
|
|
|
else
|
2022-12-13 12:40:54 +08:00
|
|
|
c_prog = GCC_PROGRAM;
|
2021-04-15 11:18:14 +08:00
|
|
|
// Find default directories
|
2021-06-22 23:00:34 +08:00
|
|
|
// C include dirs
|
2021-09-04 21:20:30 +08:00
|
|
|
QStringList arguments;
|
2021-04-15 11:18:14 +08:00
|
|
|
arguments.clear();
|
|
|
|
arguments.append("-xc");
|
|
|
|
arguments.append("-v");
|
|
|
|
arguments.append("-E");
|
|
|
|
arguments.append(NULL_FILE);
|
2022-12-13 12:40:54 +08:00
|
|
|
QByteArray output = getCompilerOutput(binDir,c_prog,arguments);
|
2021-06-22 23:00:34 +08:00
|
|
|
|
2021-09-04 21:20:30 +08:00
|
|
|
int delimPos1 = output.indexOf("#include <...> search starts here:");
|
|
|
|
int delimPos2 = output.indexOf("End of search list.");
|
2021-04-15 11:18:14 +08:00
|
|
|
if (delimPos1 >0 && delimPos2>0 ) {
|
|
|
|
delimPos1 += QByteArray("#include <...> search starts here:").length();
|
|
|
|
QList<QByteArray> lines = output.mid(delimPos1, delimPos2-delimPos1).split('\n');
|
|
|
|
for (QByteArray& line:lines) {
|
|
|
|
QByteArray trimmedLine = line.trimmed();
|
|
|
|
if (!trimmedLine.isEmpty()) {
|
2021-09-04 20:49:44 +08:00
|
|
|
addExistingDirectory(mDefaultCIncludeDirs,trimmedLine);
|
2021-04-15 11:18:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-06-22 23:00:34 +08:00
|
|
|
|
|
|
|
// Find default directories
|
|
|
|
// C++ include dirs
|
|
|
|
arguments.clear();
|
|
|
|
arguments.append("-xc++");
|
|
|
|
arguments.append("-E");
|
|
|
|
arguments.append("-v");
|
|
|
|
arguments.append(NULL_FILE);
|
2022-12-13 12:40:54 +08:00
|
|
|
output = getCompilerOutput(binDir,c_prog,arguments);
|
2021-06-22 23:00:34 +08:00
|
|
|
//gcc -xc++ -E -v NUL
|
|
|
|
|
|
|
|
delimPos1 = output.indexOf("#include <...> search starts here:");
|
|
|
|
delimPos2 = output.indexOf("End of search list.");
|
|
|
|
if (delimPos1 >0 && delimPos2>0 ) {
|
|
|
|
delimPos1 += QByteArray("#include <...> search starts here:").length();
|
|
|
|
QList<QByteArray> lines = output.mid(delimPos1, delimPos2-delimPos1).split('\n');
|
|
|
|
for (QByteArray& line:lines) {
|
|
|
|
QByteArray trimmedLine = line.trimmed();
|
|
|
|
if (!trimmedLine.isEmpty()) {
|
2021-09-04 20:49:44 +08:00
|
|
|
addExistingDirectory(mDefaultCppIncludeDirs,trimmedLine);
|
2021-06-22 23:00:34 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Find default directories
|
|
|
|
arguments.clear();
|
|
|
|
arguments.append("-print-search-dirs");
|
|
|
|
arguments.append(NULL_FILE);
|
2022-12-13 12:40:54 +08:00
|
|
|
output = getCompilerOutput(binDir,c_prog,arguments);
|
2021-04-15 11:18:14 +08:00
|
|
|
// bin dirs
|
2021-09-04 21:20:30 +08:00
|
|
|
QByteArray targetStr = QByteArray("programs: =");
|
2021-04-15 11:18:14 +08:00
|
|
|
delimPos1 = output.indexOf(targetStr);
|
|
|
|
if (delimPos1>=0) {
|
|
|
|
delimPos1+=targetStr.length();
|
|
|
|
delimPos2 = delimPos1;
|
|
|
|
while (delimPos2 < output.length() && output[delimPos2]!='\n')
|
|
|
|
delimPos2+=1;
|
|
|
|
QList<QByteArray> lines = output.mid(delimPos1,delimPos2-delimPos1).split(';');
|
|
|
|
for (QByteArray& line:lines) {
|
|
|
|
QByteArray trimmedLine = line.trimmed();
|
2021-06-22 23:00:34 +08:00
|
|
|
if (!trimmedLine.isEmpty())
|
|
|
|
addExistingDirectory(mBinDirs,trimmedLine);
|
2021-04-15 11:18:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// lib dirs
|
2021-06-22 23:00:34 +08:00
|
|
|
targetStr = QByteArray("libraries: =");
|
2021-04-15 11:18:14 +08:00
|
|
|
delimPos1 = output.indexOf(targetStr);
|
|
|
|
if (delimPos1>=0) {
|
|
|
|
delimPos1+=targetStr.length();
|
|
|
|
delimPos2 = delimPos1;
|
|
|
|
while (delimPos2 < output.length() && output[delimPos2]!='\n')
|
|
|
|
delimPos2+=1;
|
|
|
|
QList<QByteArray> lines = output.mid(delimPos1,delimPos2-delimPos1).split(';');
|
|
|
|
for (QByteArray& line:lines) {
|
|
|
|
QByteArray trimmedLine = line.trimmed();
|
2021-06-22 23:00:34 +08:00
|
|
|
if (!trimmedLine.isEmpty())
|
2021-09-04 20:49:44 +08:00
|
|
|
addExistingDirectory(mDefaultLibDirs,trimmedLine);
|
2021-04-15 11:18:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Try to obtain our target/autoconf folder
|
|
|
|
if (!mDumpMachine.isEmpty()) {
|
|
|
|
//mingw-w64 bin folder
|
|
|
|
addExistingDirectory(mBinDirs,
|
2021-04-20 22:24:33 +08:00
|
|
|
includeTrailingPathDelimiter(folder) + "lib/"
|
|
|
|
"gcc/" + mDumpMachine
|
|
|
|
+ "/" + mVersion);
|
2021-04-15 11:18:14 +08:00
|
|
|
|
|
|
|
// Regular include folder
|
2021-09-04 20:49:44 +08:00
|
|
|
addExistingDirectory(mDefaultCIncludeDirs, includeTrailingPathDelimiter(folder) + mDumpMachine + "/include");
|
|
|
|
addExistingDirectory(mDefaultCppIncludeDirs, includeTrailingPathDelimiter(folder)+ mDumpMachine + "/include");
|
2021-04-15 11:18:14 +08:00
|
|
|
|
|
|
|
// Other include folder?
|
2021-09-04 20:49:44 +08:00
|
|
|
addExistingDirectory(mDefaultCIncludeDirs,
|
2021-04-20 22:24:33 +08:00
|
|
|
includeTrailingPathDelimiter(folder) + "lib/gcc/"
|
|
|
|
+ mDumpMachine + "/" + mVersion + "/include");
|
2021-09-04 20:49:44 +08:00
|
|
|
addExistingDirectory(mDefaultCppIncludeDirs,
|
2021-04-20 22:24:33 +08:00
|
|
|
includeTrailingPathDelimiter(folder) + "lib/gcc/"
|
|
|
|
+ mDumpMachine + "/" + mVersion + "/include");
|
2021-04-15 11:18:14 +08:00
|
|
|
|
2021-09-04 20:49:44 +08:00
|
|
|
addExistingDirectory(mDefaultCIncludeDirs,
|
2021-04-20 22:24:33 +08:00
|
|
|
includeTrailingPathDelimiter(folder) + "lib/gcc/"
|
|
|
|
+ mDumpMachine + "/" + mVersion + "/include-fixed");
|
2021-09-04 20:49:44 +08:00
|
|
|
addExistingDirectory(mDefaultCppIncludeDirs,
|
2021-04-20 22:24:33 +08:00
|
|
|
includeTrailingPathDelimiter(folder) + "lib/gcc/"
|
|
|
|
+ mDumpMachine + "/" + mVersion + "/include-fixed");
|
2021-04-15 11:18:14 +08:00
|
|
|
|
|
|
|
// C++ only folder (mingw.org)
|
2021-09-04 20:49:44 +08:00
|
|
|
addExistingDirectory(mDefaultCppIncludeDirs,
|
2021-04-20 22:24:33 +08:00
|
|
|
includeTrailingPathDelimiter(folder) + "lib/gcc/"
|
|
|
|
+ mDumpMachine + "/" + mVersion + "/include/c++");
|
2021-09-04 20:49:44 +08:00
|
|
|
addExistingDirectory(mDefaultCppIncludeDirs,
|
2021-04-20 22:24:33 +08:00
|
|
|
includeTrailingPathDelimiter(folder) + "lib/gcc/"
|
|
|
|
+ mDumpMachine + "/" + mVersion + "/include/c++/"
|
|
|
|
+ mDumpMachine);
|
2021-09-04 20:49:44 +08:00
|
|
|
addExistingDirectory(mDefaultCppIncludeDirs,
|
2021-04-20 22:24:33 +08:00
|
|
|
includeTrailingPathDelimiter(folder) + "lib/gcc/"
|
|
|
|
+ mDumpMachine + "/" + mVersion + "/include/c++/backward");
|
2021-04-15 11:18:14 +08:00
|
|
|
|
|
|
|
// C++ only folder (Mingw-w64)
|
2021-09-04 20:49:44 +08:00
|
|
|
addExistingDirectory(mDefaultCppIncludeDirs,
|
2021-04-20 22:24:33 +08:00
|
|
|
includeTrailingPathDelimiter(folder) + "include/c++/"
|
|
|
|
+ mVersion );
|
2021-09-04 20:49:44 +08:00
|
|
|
addExistingDirectory(mDefaultCppIncludeDirs,
|
2021-04-20 22:24:33 +08:00
|
|
|
includeTrailingPathDelimiter(folder) + "include/c++/"
|
|
|
|
+ mVersion + "/backward");
|
2021-09-04 20:49:44 +08:00
|
|
|
addExistingDirectory(mDefaultCppIncludeDirs,
|
2021-04-20 22:24:33 +08:00
|
|
|
includeTrailingPathDelimiter(folder) + "include/c++/"
|
|
|
|
+ mVersion + "/" + mDumpMachine);
|
2021-04-15 11:18:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-12 19:39:24 +08:00
|
|
|
int Settings::CompilerSet::mainVersion()
|
|
|
|
{
|
|
|
|
int i = mVersion.indexOf('.');
|
|
|
|
if (i<0)
|
|
|
|
return -1;
|
|
|
|
bool ok;
|
|
|
|
int num = mVersion.left(i).toInt(&ok);
|
|
|
|
if (!ok)
|
|
|
|
return -1;
|
|
|
|
return num;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2022-12-13 15:58:27 +08:00
|
|
|
bool Settings::CompilerSet::canCompileC()
|
|
|
|
{
|
|
|
|
return fileExists(mCCompiler);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CompilerSet::canCompileCPP()
|
|
|
|
{
|
|
|
|
return fileExists(mCppCompiler);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CompilerSet::canMake()
|
|
|
|
{
|
|
|
|
return fileExists(mMake);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CompilerSet::canDebug()
|
|
|
|
{
|
|
|
|
return fileExists(mDebugger);
|
|
|
|
}
|
|
|
|
|
2023-02-08 21:07:41 +08:00
|
|
|
bool Settings::CompilerSet::canAssemble()
|
|
|
|
{
|
|
|
|
return fileExists(mAssembler);
|
|
|
|
}
|
|
|
|
|
2021-04-15 11:18:14 +08:00
|
|
|
void Settings::CompilerSet::setUserInput()
|
|
|
|
{
|
|
|
|
mUseCustomCompileParams = false;
|
|
|
|
mUseCustomLinkParams = false;
|
|
|
|
mAutoAddCharsetParams = true;
|
2021-09-03 20:55:14 +08:00
|
|
|
mStaticLink = true;
|
2021-04-15 11:18:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-04-17 14:52:47 +08:00
|
|
|
QString Settings::CompilerSet::findProgramInBinDirs(const QString name)
|
|
|
|
{
|
|
|
|
for (const QString& dir : mBinDirs) {
|
|
|
|
QFileInfo f(includeTrailingPathDelimiter(dir) + name);
|
|
|
|
if (f.exists() && f.isExecutable()) {
|
|
|
|
return f.absoluteFilePath();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return QString();
|
|
|
|
}
|
|
|
|
|
2021-04-15 11:18:14 +08:00
|
|
|
void Settings::CompilerSet::setIniOptions(const QByteArray &value)
|
|
|
|
{
|
2022-05-12 15:28:08 +08:00
|
|
|
if (value.isEmpty())
|
|
|
|
return;
|
|
|
|
mCompileOptions.clear();
|
|
|
|
for (int i=0;i<value.length();i++) {
|
|
|
|
QString key = pSettings->compilerSets().getKeyFromCompilerCompatibleIndex(i);
|
2022-05-12 22:42:19 +08:00
|
|
|
setCompileOption(key,charToValue(value[i]));
|
2021-04-15 11:18:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QByteArray Settings::CompilerSet::getCompilerOutput(const QString &binDir, const QString &binFile, const QStringList &arguments)
|
|
|
|
{
|
2021-12-16 11:36:52 +08:00
|
|
|
QProcessEnvironment env;
|
|
|
|
env.insert("LANG","en");
|
|
|
|
QByteArray result = runAndGetOutput(
|
|
|
|
includeTrailingPathDelimiter(binDir)+binFile,
|
|
|
|
binDir,
|
|
|
|
arguments,
|
|
|
|
QByteArray(),
|
|
|
|
false,
|
|
|
|
env);
|
2021-04-15 11:18:14 +08:00
|
|
|
return result.trimmed();
|
|
|
|
}
|
|
|
|
|
2023-02-08 21:07:41 +08:00
|
|
|
const QString &Settings::CompilerSet::assembler() const
|
|
|
|
{
|
|
|
|
return mAssembler;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CompilerSet::setAssembler(const QString &newAssembler)
|
|
|
|
{
|
|
|
|
mAssembler = newAssembler;
|
|
|
|
}
|
|
|
|
|
2022-10-12 19:48:35 +08:00
|
|
|
Settings::CompilerSet::CompilationStage Settings::CompilerSet::compilationStage() const
|
|
|
|
{
|
|
|
|
return mCompilationStage;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CompilerSet::setCompilationStage(CompilationStage newCompilationStage)
|
|
|
|
{
|
|
|
|
mCompilationStage = newCompilationStage;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString Settings::CompilerSet::getOutputFilename(const QString &sourceFilename)
|
|
|
|
{
|
2022-12-01 22:10:44 +08:00
|
|
|
return getOutputFilename(sourceFilename, compilationStage());
|
|
|
|
}
|
|
|
|
|
|
|
|
QString Settings::CompilerSet::getOutputFilename(const QString &sourceFilename, CompilationStage stage)
|
|
|
|
{
|
|
|
|
switch(stage) {
|
2022-10-12 19:48:35 +08:00
|
|
|
case Settings::CompilerSet::CompilationStage::PreprocessingOnly:
|
|
|
|
return changeFileExt(sourceFilename, preprocessingSuffix());
|
|
|
|
case Settings::CompilerSet::CompilationStage::CompilationProperOnly:
|
|
|
|
return changeFileExt(sourceFilename, compilationProperSuffix());
|
|
|
|
case Settings::CompilerSet::CompilationStage::AssemblingOnly:
|
|
|
|
return changeFileExt(sourceFilename, assemblingSuffix());
|
|
|
|
case Settings::CompilerSet::CompilationStage::GenerateExecutable:
|
|
|
|
return changeFileExt(sourceFilename, executableSuffix());
|
|
|
|
}
|
|
|
|
return changeFileExt(sourceFilename,DEFAULT_EXECUTABLE_SUFFIX);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CompilerSet::isOutputExecutable()
|
|
|
|
{
|
2022-12-01 22:10:44 +08:00
|
|
|
return isOutputExecutable(mCompilationStage);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CompilerSet::isOutputExecutable(CompilationStage stage)
|
|
|
|
{
|
|
|
|
return stage == CompilationStage::GenerateExecutable;
|
2022-10-12 19:48:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const QString &Settings::CompilerSet::assemblingSuffix() const
|
|
|
|
{
|
|
|
|
return mAssemblingSuffix;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CompilerSet::setAssemblingSuffix(const QString &newAssemblingSuffix)
|
|
|
|
{
|
|
|
|
mAssemblingSuffix = newAssemblingSuffix;
|
|
|
|
}
|
|
|
|
|
|
|
|
const QString &Settings::CompilerSet::compilationProperSuffix() const
|
|
|
|
{
|
|
|
|
return mCompilationProperSuffix;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CompilerSet::setCompilationProperSuffix(const QString &newCompilationProperSuffix)
|
|
|
|
{
|
|
|
|
mCompilationProperSuffix = newCompilationProperSuffix;
|
|
|
|
}
|
|
|
|
|
|
|
|
const QString &Settings::CompilerSet::preprocessingSuffix() const
|
|
|
|
{
|
|
|
|
return mPreprocessingSuffix;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CompilerSet::setPreprocessingSuffix(const QString &newPreprocessingSuffix)
|
|
|
|
{
|
|
|
|
mPreprocessingSuffix = newPreprocessingSuffix;
|
|
|
|
}
|
|
|
|
|
|
|
|
const QString &Settings::CompilerSet::executableSuffix() const
|
|
|
|
{
|
|
|
|
return mExecutableSuffix;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CompilerSet::setExecutableSuffix(const QString &newExecutableSuffix)
|
|
|
|
{
|
|
|
|
mExecutableSuffix = newExecutableSuffix;
|
|
|
|
}
|
|
|
|
|
2022-05-12 15:28:08 +08:00
|
|
|
const QMap<QString, QString> &Settings::CompilerSet::compileOptions() const
|
|
|
|
{
|
|
|
|
return mCompileOptions;
|
|
|
|
}
|
|
|
|
|
2022-01-24 11:23:30 +08:00
|
|
|
const QString &Settings::CompilerSet::execCharset() const
|
2022-01-24 01:08:47 +08:00
|
|
|
{
|
2022-01-24 11:23:30 +08:00
|
|
|
return mExecCharset;
|
2022-01-24 01:08:47 +08:00
|
|
|
}
|
|
|
|
|
2022-01-24 11:23:30 +08:00
|
|
|
void Settings::CompilerSet::setExecCharset(const QString &newExecCharset)
|
2022-01-24 01:08:47 +08:00
|
|
|
{
|
2022-01-24 11:23:30 +08:00
|
|
|
mExecCharset = newExecCharset;
|
2022-01-24 01:08:47 +08:00
|
|
|
}
|
|
|
|
|
2021-12-25 18:09:50 +08:00
|
|
|
const QString &Settings::CompilerSet::debugServer() const
|
|
|
|
{
|
|
|
|
return mDebugServer;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CompilerSet::setDebugServer(const QString &newDebugServer)
|
|
|
|
{
|
|
|
|
mDebugServer = newDebugServer;
|
|
|
|
}
|
|
|
|
|
2022-10-30 11:58:42 +08:00
|
|
|
CompilerSetType Settings::CompilerSet::compilerSetType() const
|
2021-10-25 21:36:23 +08:00
|
|
|
{
|
|
|
|
return mCompilerSetType;
|
|
|
|
}
|
|
|
|
|
2022-10-30 11:58:42 +08:00
|
|
|
void Settings::CompilerSet::setCompilerSetType(CompilerSetType newCompilerSetType)
|
2021-10-25 21:36:23 +08:00
|
|
|
{
|
|
|
|
mCompilerSetType = newCompilerSetType;
|
|
|
|
}
|
|
|
|
|
2022-10-30 11:58:42 +08:00
|
|
|
void Settings::CompilerSet::setCompilerType(CompilerType newCompilerType)
|
2021-10-03 23:46:40 +08:00
|
|
|
{
|
|
|
|
mCompilerType = newCompilerType;
|
|
|
|
}
|
|
|
|
|
2022-10-30 11:58:42 +08:00
|
|
|
CompilerType Settings::CompilerSet::compilerType() const
|
2021-10-03 23:46:40 +08:00
|
|
|
{
|
|
|
|
return mCompilerType;
|
|
|
|
}
|
|
|
|
|
2021-09-02 21:08:31 +08:00
|
|
|
bool Settings::CompilerSet::staticLink() const
|
2021-09-02 21:01:23 +08:00
|
|
|
{
|
|
|
|
return mStaticLink;
|
|
|
|
}
|
|
|
|
|
2021-09-02 21:08:31 +08:00
|
|
|
void Settings::CompilerSet::setStaticLink(bool newStaticLink)
|
2021-09-02 21:01:23 +08:00
|
|
|
{
|
|
|
|
mStaticLink = newStaticLink;
|
|
|
|
}
|
|
|
|
|
2021-08-29 10:14:07 +08:00
|
|
|
bool Settings::CompilerSet::useCustomCompileParams() const
|
2021-04-15 11:18:14 +08:00
|
|
|
{
|
|
|
|
return mUseCustomCompileParams;
|
2021-04-13 22:17:18 +08:00
|
|
|
}
|
2021-04-15 21:32:45 +08:00
|
|
|
|
|
|
|
Settings::CompilerSets::CompilerSets(Settings *settings):
|
2021-08-29 10:14:07 +08:00
|
|
|
mDefaultIndex(-1),
|
|
|
|
mSettings(settings)
|
2021-04-15 21:32:45 +08:00
|
|
|
{
|
2022-05-13 20:22:16 +08:00
|
|
|
prepareCompatibleIndex();
|
2021-04-15 21:32:45 +08:00
|
|
|
}
|
|
|
|
|
2022-07-24 18:24:21 +08:00
|
|
|
Settings::PCompilerSet Settings::CompilerSets::addSet()
|
2021-04-15 21:32:45 +08:00
|
|
|
{
|
2022-07-24 18:24:21 +08:00
|
|
|
PCompilerSet p=std::make_shared<CompilerSet>();
|
2021-04-15 21:32:45 +08:00
|
|
|
mList.push_back(p);
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
2022-12-13 12:40:54 +08:00
|
|
|
Settings::PCompilerSet Settings::CompilerSets::addSet(const QString &folder, const QString& c_prog)
|
2021-04-15 21:32:45 +08:00
|
|
|
{
|
2022-12-13 12:40:54 +08:00
|
|
|
PCompilerSet p=std::make_shared<CompilerSet>(folder,c_prog);
|
|
|
|
if (c_prog==GCC_PROGRAM && p->compilerType()==CompilerType::Clang)
|
2022-07-24 18:24:21 +08:00
|
|
|
return PCompilerSet();
|
2021-04-15 21:32:45 +08:00
|
|
|
mList.push_back(p);
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
2022-07-24 19:08:09 +08:00
|
|
|
Settings::PCompilerSet Settings::CompilerSets::addSet(const PCompilerSet &pSet)
|
|
|
|
{
|
|
|
|
PCompilerSet p=std::make_shared<CompilerSet>(*pSet);
|
|
|
|
mList.push_back(p);
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
2021-12-16 11:36:52 +08:00
|
|
|
static void set64_32Options(Settings::PCompilerSet pSet) {
|
2022-05-12 15:28:08 +08:00
|
|
|
pSet->setCompileOption(CC_CMD_OPT_POINTER_SIZE,"32");
|
2021-12-16 11:36:52 +08:00
|
|
|
}
|
|
|
|
|
2021-04-17 22:38:46 +08:00
|
|
|
static void setReleaseOptions(Settings::PCompilerSet pSet) {
|
2022-05-12 15:28:08 +08:00
|
|
|
pSet->setCompileOption(CC_CMD_OPT_OPTIMIZE,"2");
|
2022-05-13 20:22:16 +08:00
|
|
|
pSet->setCompileOption(LINK_CMD_OPT_STRIP_EXE, COMPILER_OPTION_ON);
|
|
|
|
pSet->setCompileOption(CC_CMD_OPT_USE_PIPE, COMPILER_OPTION_ON);
|
2021-10-09 11:33:23 +08:00
|
|
|
pSet->setStaticLink(true);
|
2021-04-15 21:32:45 +08:00
|
|
|
}
|
|
|
|
|
2022-12-21 19:35:38 +08:00
|
|
|
static void setDebugOptions(Settings::PCompilerSet pSet, bool enableAsan = false) {
|
2022-05-13 20:22:16 +08:00
|
|
|
pSet->setCompileOption(CC_CMD_OPT_DEBUG_INFO, COMPILER_OPTION_ON);
|
|
|
|
pSet->setCompileOption(CC_CMD_OPT_WARNING_ALL, COMPILER_OPTION_ON);
|
2022-10-29 20:51:31 +08:00
|
|
|
//pSet->setCompileOption(CC_CMD_OPT_WARNING_EXTRA, COMPILER_OPTION_ON);
|
2022-05-13 20:22:16 +08:00
|
|
|
pSet->setCompileOption(CC_CMD_OPT_USE_PIPE, COMPILER_OPTION_ON);
|
2022-12-21 19:35:38 +08:00
|
|
|
if (enableAsan) {
|
|
|
|
pSet->setCustomCompileParams("-fsanitize=address");
|
|
|
|
pSet->setUseCustomCompileParams(true);
|
|
|
|
pSet->setCustomLinkParams("-fsanitize=address");
|
|
|
|
pSet->setUseCustomLinkParams(true);
|
|
|
|
}
|
2021-10-09 11:33:23 +08:00
|
|
|
pSet->setStaticLink(false);
|
2021-04-15 21:32:45 +08:00
|
|
|
}
|
|
|
|
|
2022-12-13 12:40:54 +08:00
|
|
|
bool Settings::CompilerSets::addSets(const QString &folder, const QString& c_prog) {
|
2022-11-28 08:22:48 +08:00
|
|
|
foreach (const PCompilerSet& set, mList) {
|
2022-12-13 12:40:54 +08:00
|
|
|
if (set->binDirs().contains(folder) && extractFileName(set->CCompiler())==c_prog)
|
|
|
|
return false;
|
2022-11-28 08:22:48 +08:00
|
|
|
}
|
2021-04-15 21:32:45 +08:00
|
|
|
// Default, release profile
|
2022-12-13 12:40:54 +08:00
|
|
|
PCompilerSet baseSet = addSet(folder,c_prog);
|
2022-07-24 18:24:21 +08:00
|
|
|
if (!baseSet)
|
|
|
|
return false;
|
2021-04-15 21:32:45 +08:00
|
|
|
QString baseName = baseSet->name();
|
|
|
|
QString platformName;
|
2022-12-11 18:22:44 +08:00
|
|
|
if (isTarget64Bit(baseSet->target())) {
|
2021-12-16 11:36:52 +08:00
|
|
|
if (baseName.startsWith("TDM-GCC ")) {
|
2022-07-24 19:08:09 +08:00
|
|
|
PCompilerSet set= addSet(baseSet);
|
2021-12-16 11:36:52 +08:00
|
|
|
platformName = "32-bit";
|
2022-07-24 19:08:09 +08:00
|
|
|
set->setName(baseName + " " + platformName + " Release");
|
2022-10-30 11:58:42 +08:00
|
|
|
set->setCompilerSetType(CompilerSetType::RELEASE);
|
2022-07-24 19:08:09 +08:00
|
|
|
set64_32Options(set);
|
|
|
|
setReleaseOptions(set);
|
|
|
|
|
|
|
|
set = addSet(baseSet);
|
|
|
|
set->setName(baseName + " " + platformName + " Debug");
|
2022-10-30 11:58:42 +08:00
|
|
|
set->setCompilerSetType(CompilerSetType::DEBUG);
|
2022-07-24 19:08:09 +08:00
|
|
|
set64_32Options(set);
|
|
|
|
setDebugOptions(set);
|
2021-12-16 11:36:52 +08:00
|
|
|
}
|
2021-04-15 21:32:45 +08:00
|
|
|
platformName = "64-bit";
|
|
|
|
} else {
|
|
|
|
platformName = "32-bit";
|
|
|
|
}
|
2022-07-24 19:08:09 +08:00
|
|
|
|
|
|
|
|
2022-12-21 19:35:38 +08:00
|
|
|
PCompilerSet debugSet = addSet(baseSet);
|
|
|
|
debugSet->setName(baseName + " " + platformName + " Debug");
|
|
|
|
debugSet->setCompilerSetType(CompilerSetType::DEBUG);
|
|
|
|
setDebugOptions(debugSet);
|
|
|
|
|
|
|
|
// Enable ASan compiler set if it is supported and gdb works with ASan.
|
|
|
|
#ifdef Q_OS_LINUX
|
|
|
|
PCompilerSet debugAsanSet = addSet(baseSet);
|
|
|
|
debugAsanSet->setName(baseName + " " + platformName + " Debug with ASan");
|
|
|
|
debugAsanSet->setCompilerSetType(CompilerSetType::DEBUG);
|
|
|
|
setDebugOptions(debugAsanSet, true);
|
|
|
|
#endif
|
2022-07-24 19:08:09 +08:00
|
|
|
|
2021-04-15 21:32:45 +08:00
|
|
|
baseSet->setName(baseName + " " + platformName + " Release");
|
2022-10-30 11:58:42 +08:00
|
|
|
baseSet->setCompilerSetType(CompilerSetType::RELEASE);
|
2021-04-15 21:32:45 +08:00
|
|
|
setReleaseOptions(baseSet);
|
|
|
|
|
2022-05-09 17:17:01 +08:00
|
|
|
// baseSet = addSet(folder);
|
|
|
|
// baseSet->setName(baseName + " " + platformName + " Profiling");
|
|
|
|
// baseSet->setCompilerSetType(CompilerSetType::CST_PROFILING);
|
|
|
|
// setProfileOptions(baseSet);
|
2021-04-15 21:32:45 +08:00
|
|
|
|
2022-12-21 19:35:38 +08:00
|
|
|
#ifdef Q_OS_LINUX
|
|
|
|
# if defined(__x86_64__) || __SIZEOF_POINTER__ == 4
|
|
|
|
mDefaultIndex = (int)mList.size() - 1; // x86-64 Linux or 32-bit Unix, default to "debug with ASan"
|
|
|
|
# else
|
|
|
|
mDefaultIndex = (int)mList.size() - 2; // other Unix, where ASan can be very slow, default to "debug"
|
|
|
|
# endif
|
|
|
|
#else
|
2022-07-24 18:24:21 +08:00
|
|
|
mDefaultIndex = (int)mList.size() - 1;
|
2022-12-21 19:35:38 +08:00
|
|
|
#endif
|
|
|
|
|
2021-12-25 18:09:50 +08:00
|
|
|
return true;
|
2022-07-24 18:24:21 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CompilerSets::addSets(const QString &folder)
|
|
|
|
{
|
|
|
|
if (!directoryExists(folder))
|
|
|
|
return false;
|
|
|
|
if (!fileExists(folder, GCC_PROGRAM) && !fileExists(folder, CLANG_PROGRAM)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (fileExists(folder, GCC_PROGRAM)) {
|
|
|
|
addSets(folder,GCC_PROGRAM);
|
|
|
|
}
|
|
|
|
if (fileExists(folder, CLANG_PROGRAM)) {
|
|
|
|
addSets(folder,CLANG_PROGRAM);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
|
2021-04-15 21:32:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CompilerSets::clearSets()
|
|
|
|
{
|
2021-08-29 10:14:07 +08:00
|
|
|
for (size_t i=0;i<mList.size();i++) {
|
2021-04-15 21:32:45 +08:00
|
|
|
mSettings->mSettings.beginGroup(QString(SETTING_COMPILTER_SET).arg(i));
|
|
|
|
mSettings->mSettings.remove("");
|
|
|
|
mSettings->mSettings.endGroup();
|
|
|
|
}
|
|
|
|
mList.clear();
|
2021-04-17 22:38:46 +08:00
|
|
|
mDefaultIndex = -1;
|
2021-04-15 21:32:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CompilerSets::findSets()
|
|
|
|
{
|
2021-04-17 14:52:47 +08:00
|
|
|
clearSets();
|
2022-01-24 16:45:43 +08:00
|
|
|
QSet<QString> searched;
|
|
|
|
|
2021-12-24 09:17:28 +08:00
|
|
|
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
|
|
|
QString path = env.value("PATH");
|
|
|
|
QStringList pathList = path.split(PATH_SEPARATOR);
|
2022-02-15 17:01:36 +08:00
|
|
|
QString folder;
|
|
|
|
for (int i=pathList.count()-1;i>=0;i--) {
|
|
|
|
folder = pathList[i];
|
|
|
|
if (searched.contains(folder))
|
|
|
|
continue;
|
|
|
|
searched.insert(folder);
|
|
|
|
if (folder!="/bin") { // /bin/gcc is symbolic link to /usr/bin/gcc
|
|
|
|
addSets(folder);
|
2022-01-24 16:45:43 +08:00
|
|
|
}
|
2021-12-24 09:17:28 +08:00
|
|
|
}
|
2022-01-24 16:45:43 +08:00
|
|
|
|
2022-02-15 17:01:36 +08:00
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
folder = includeTrailingPathDelimiter(mSettings->dirs().appDir())+"MinGW32"+QDir::separator()+"bin";
|
|
|
|
if (!searched.contains(folder)) {
|
|
|
|
addSets(folder);
|
|
|
|
searched.insert(folder);
|
|
|
|
}
|
|
|
|
folder = includeTrailingPathDelimiter(mSettings->dirs().appDir())+"MinGW64"+QDir::separator()+"bin";
|
|
|
|
if (!searched.contains(folder)) {
|
|
|
|
addSets(folder);
|
|
|
|
searched.insert(folder);
|
|
|
|
}
|
2022-04-25 22:13:33 +08:00
|
|
|
folder = includeTrailingPathDelimiter(mSettings->dirs().appDir())+"Clang64"+QDir::separator()+"bin";
|
|
|
|
if (!searched.contains(folder)) {
|
|
|
|
addSets(folder);
|
|
|
|
searched.insert(folder);
|
|
|
|
}
|
2022-02-15 17:01:36 +08:00
|
|
|
#endif
|
|
|
|
|
2021-04-15 21:32:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CompilerSets::saveSets()
|
|
|
|
{
|
2021-08-29 10:14:07 +08:00
|
|
|
for (size_t i=0;i<mList.size();i++) {
|
2021-04-15 21:32:45 +08:00
|
|
|
saveSet(i);
|
|
|
|
}
|
2022-07-04 11:39:06 +08:00
|
|
|
if (mDefaultIndex>=(int)mList.size()) {
|
2021-06-24 20:43:09 +08:00
|
|
|
mDefaultIndex = mList.size()-1;
|
|
|
|
}
|
2021-04-15 21:32:45 +08:00
|
|
|
mSettings->mSettings.beginGroup(SETTING_COMPILTER_SETS);
|
|
|
|
mSettings->mSettings.setValue(SETTING_COMPILTER_SETS_DEFAULT_INDEX,mDefaultIndex);
|
2021-12-24 23:18:20 +08:00
|
|
|
mSettings->mSettings.setValue(SETTING_COMPILTER_SETS_COUNT,(int)mList.size());
|
2021-04-15 21:32:45 +08:00
|
|
|
mSettings->mSettings.endGroup();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CompilerSets::loadSets()
|
|
|
|
{
|
|
|
|
mList.clear();
|
|
|
|
mSettings->mSettings.beginGroup(SETTING_COMPILTER_SETS);
|
|
|
|
mDefaultIndex =mSettings->mSettings.value(SETTING_COMPILTER_SETS_DEFAULT_INDEX,-1).toInt();
|
|
|
|
int listSize = mSettings->mSettings.value(SETTING_COMPILTER_SETS_COUNT,0).toInt();
|
|
|
|
mSettings->mSettings.endGroup();
|
2021-11-18 10:42:41 +08:00
|
|
|
bool loadError = false;
|
2021-04-15 21:32:45 +08:00
|
|
|
for (int i=0;i<listSize;i++) {
|
|
|
|
PCompilerSet pSet=loadSet(i);
|
2021-11-18 10:42:41 +08:00
|
|
|
if (!pSet) {
|
|
|
|
loadError = true;
|
|
|
|
break;
|
|
|
|
}
|
2021-04-15 21:32:45 +08:00
|
|
|
mList.push_back(pSet);
|
|
|
|
}
|
2021-11-18 10:42:41 +08:00
|
|
|
if (loadError) {
|
|
|
|
mList.clear();
|
|
|
|
mDefaultIndex = -1;
|
|
|
|
}
|
2021-04-16 22:04:48 +08:00
|
|
|
PCompilerSet pCurrentSet = defaultSet();
|
|
|
|
if (pCurrentSet) {
|
|
|
|
QString msg;
|
2022-12-16 11:10:46 +08:00
|
|
|
// if (!pCurrentSet->dirsValid(msg)) {
|
|
|
|
// if (QMessageBox::warning(nullptr,QObject::tr("Confirm"),
|
|
|
|
// QObject::tr("The following problems were found during validation of compiler set \"%1\":")
|
|
|
|
// .arg(pCurrentSet->name())
|
|
|
|
// +"<br /><br />"
|
|
|
|
// +msg
|
|
|
|
// +"<br /><br />"
|
|
|
|
// +QObject::tr("Leaving those directories will lead to problems during compilation.")
|
|
|
|
// +"<br /><br />"
|
|
|
|
// +QObject::tr("Would you like Red Panda C++ to remove them for you and add the default paths to the valid paths?")
|
|
|
|
// ,
|
|
|
|
// QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) {
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
// findSets();
|
|
|
|
// if ( (int)mList.size() <= mDefaultIndex)
|
|
|
|
// mDefaultIndex = mList.size()-1;
|
|
|
|
// pCurrentSet = defaultSet();
|
|
|
|
// if (!pCurrentSet) {
|
|
|
|
// mList.clear();
|
|
|
|
// mDefaultIndex = -1;
|
|
|
|
// saveSets();
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
// saveSets();
|
|
|
|
// pCurrentSet->setProperties(pCurrentSet->CCompiler());
|
|
|
|
// } else {
|
|
|
|
// return;
|
|
|
|
// }
|
|
|
|
return;
|
2021-08-29 00:48:23 +08:00
|
|
|
} else {
|
2022-01-06 20:46:27 +08:00
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
QString msg = QObject::tr("Compiler set not configuared.")
|
|
|
|
+"<br /><br />"
|
|
|
|
+QObject::tr("Would you like Red Panda C++ to search for compilers in the following locations: <BR />'%1'<BR />'%2'? ")
|
|
|
|
.arg(includeTrailingPathDelimiter(pSettings->dirs().appDir()) + "MinGW32")
|
|
|
|
.arg(includeTrailingPathDelimiter(pSettings->dirs().appDir()) + "MinGW64");
|
|
|
|
#else
|
|
|
|
QString msg = QObject::tr("Compiler set not configuared.")
|
|
|
|
+"<br /><br />"
|
|
|
|
+QObject::tr("Would you like Red Panda C++ to search for compilers in PATH?");
|
|
|
|
#endif
|
2021-08-30 18:07:55 +08:00
|
|
|
if (QMessageBox::warning(nullptr,QObject::tr("Confirm"),
|
2022-01-06 20:46:27 +08:00
|
|
|
msg,
|
2021-08-29 00:48:23 +08:00
|
|
|
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
clearSets();
|
|
|
|
findSets();
|
|
|
|
pCurrentSet = defaultSet();
|
|
|
|
if (!pCurrentSet) {
|
2021-11-18 10:42:41 +08:00
|
|
|
mList.clear();
|
|
|
|
mDefaultIndex = -1;
|
|
|
|
saveSets();
|
2021-08-29 00:48:23 +08:00
|
|
|
return;
|
2021-04-16 22:04:48 +08:00
|
|
|
}
|
2021-08-29 00:48:23 +08:00
|
|
|
saveSets();
|
2021-04-16 22:04:48 +08:00
|
|
|
}
|
2021-08-29 00:48:23 +08:00
|
|
|
|
2021-04-16 22:04:48 +08:00
|
|
|
}
|
|
|
|
|
2021-04-18 11:41:41 +08:00
|
|
|
void Settings::CompilerSets::saveDefaultIndex()
|
|
|
|
{
|
|
|
|
mSettings->mSettings.beginGroup(SETTING_COMPILTER_SETS);
|
|
|
|
mSettings->mSettings.setValue(SETTING_COMPILTER_SETS_DEFAULT_INDEX,mDefaultIndex);
|
|
|
|
mSettings->mSettings.endGroup();
|
|
|
|
}
|
|
|
|
|
2021-04-16 22:04:48 +08:00
|
|
|
void Settings::CompilerSets::deleteSet(int index)
|
|
|
|
{
|
|
|
|
// Erase all sections at and above from disk
|
2021-06-17 10:39:46 +08:00
|
|
|
for (size_t i=index;i<mList.size();i++) {
|
2021-04-16 22:04:48 +08:00
|
|
|
mSettings->mSettings.beginGroup(QString(SETTING_COMPILTER_SET).arg(i));
|
|
|
|
mSettings->mSettings.remove("");
|
|
|
|
mSettings->mSettings.endGroup();
|
|
|
|
}
|
|
|
|
mList.erase(std::begin(mList)+index);
|
2022-07-04 11:39:06 +08:00
|
|
|
if (mDefaultIndex>=(int)mList.size()) {
|
2021-04-18 11:25:40 +08:00
|
|
|
mDefaultIndex = mList.size()-1;
|
|
|
|
}
|
2022-02-15 22:45:14 +08:00
|
|
|
saveSets();
|
2021-04-15 21:32:45 +08:00
|
|
|
}
|
|
|
|
|
2022-04-14 22:25:49 +08:00
|
|
|
size_t Settings::CompilerSets::size() const
|
2021-04-15 21:32:45 +08:00
|
|
|
{
|
|
|
|
return mList.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::CompilerSets::defaultIndex() const
|
|
|
|
{
|
|
|
|
return mDefaultIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CompilerSets::setDefaultIndex(int value)
|
|
|
|
{
|
|
|
|
mDefaultIndex = value;
|
|
|
|
}
|
|
|
|
|
2021-04-16 22:04:48 +08:00
|
|
|
Settings::PCompilerSet Settings::CompilerSets::defaultSet()
|
|
|
|
{
|
2021-09-09 11:47:04 +08:00
|
|
|
return getSet(mDefaultIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
Settings::PCompilerSet Settings::CompilerSets::getSet(int index)
|
|
|
|
{
|
2022-07-04 11:39:06 +08:00
|
|
|
if (index>=0 && index<(int)mList.size()) {
|
2021-09-09 11:47:04 +08:00
|
|
|
return mList[index];
|
2021-04-16 22:04:48 +08:00
|
|
|
}
|
|
|
|
return PCompilerSet();
|
|
|
|
}
|
|
|
|
|
2021-04-17 14:52:47 +08:00
|
|
|
void Settings::CompilerSets::savePath(const QString& name, const QString& path) {
|
|
|
|
QString s;
|
2021-12-26 15:08:54 +08:00
|
|
|
QString prefix1 = excludeTrailingPathDelimiter(mSettings->mDirs.appDir()) + "/";
|
|
|
|
QString prefix2 = excludeTrailingPathDelimiter(mSettings->mDirs.appDir()) + QDir::separator();
|
2021-04-20 22:24:33 +08:00
|
|
|
if (path.startsWith(prefix1, PATH_SENSITIVITY)) {
|
2021-04-17 14:52:47 +08:00
|
|
|
s = "%AppPath%/"+ path.mid(prefix1.length());
|
2021-04-20 22:24:33 +08:00
|
|
|
} else if (path.startsWith(prefix2, PATH_SENSITIVITY)) {
|
2021-04-17 14:52:47 +08:00
|
|
|
s = "%AppPath%/"+ path.mid(prefix2.length());
|
|
|
|
} else {
|
|
|
|
s= path;
|
|
|
|
}
|
|
|
|
mSettings->mSettings.setValue(name,s);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CompilerSets::savePathList(const QString& name, const QStringList& pathList) {
|
|
|
|
QStringList sl;
|
|
|
|
for (const QString& path: pathList) {
|
|
|
|
QString s;
|
2021-12-26 15:08:54 +08:00
|
|
|
QString prefix1 = excludeTrailingPathDelimiter(mSettings->mDirs.appDir()) + "/";
|
|
|
|
QString prefix2 = excludeTrailingPathDelimiter(mSettings->mDirs.appDir()) + QDir::separator();
|
2021-04-20 22:24:33 +08:00
|
|
|
if (path.startsWith(prefix1, PATH_SENSITIVITY)) {
|
2021-04-17 14:52:47 +08:00
|
|
|
s = "%AppPath%/"+ path.mid(prefix1.length());
|
2021-04-20 22:24:33 +08:00
|
|
|
} else if (path.startsWith(prefix2, PATH_SENSITIVITY)) {
|
2021-04-17 14:52:47 +08:00
|
|
|
s = "%AppPath%/" + path.mid(prefix2.length());
|
|
|
|
} else {
|
|
|
|
s= path;
|
|
|
|
}
|
|
|
|
sl.append(s);
|
|
|
|
}
|
|
|
|
mSettings->mSettings.setValue(name,sl);
|
|
|
|
}
|
|
|
|
|
2021-04-15 21:32:45 +08:00
|
|
|
void Settings::CompilerSets::saveSet(int index)
|
|
|
|
{
|
|
|
|
PCompilerSet pSet = mList[index];
|
|
|
|
mSettings->mSettings.beginGroup(QString(SETTING_COMPILTER_SET).arg(index));
|
2021-04-17 14:52:47 +08:00
|
|
|
|
|
|
|
savePath("ccompiler", pSet->CCompiler());
|
|
|
|
savePath("cppcompiler", pSet->cppCompiler());
|
|
|
|
savePath("debugger", pSet->debugger());
|
2021-12-25 18:09:50 +08:00
|
|
|
savePath("debug_server", pSet->debugServer());
|
2021-04-17 14:52:47 +08:00
|
|
|
savePath("make", pSet->make());
|
|
|
|
savePath("windres", pSet->resourceCompiler());
|
2023-02-08 21:07:41 +08:00
|
|
|
savePath("assembler", pSet->assembler());
|
|
|
|
|
2022-05-12 22:42:19 +08:00
|
|
|
mSettings->mSettings.remove("Options");
|
2022-06-17 18:18:12 +08:00
|
|
|
foreach(const PCompilerOption& option, CompilerInfoManager::getInstance()->getCompilerOptions(pSet->compilerType())) {
|
2022-06-13 16:31:41 +08:00
|
|
|
mSettings->mSettings.remove(option->key);
|
|
|
|
}
|
2021-04-15 21:32:45 +08:00
|
|
|
// Save option string
|
2022-05-12 15:28:08 +08:00
|
|
|
for (const QString& optionKey : pSet->compileOptions().keys()) {
|
|
|
|
mSettings->mSettings.setValue(optionKey, pSet->compileOptions().value(optionKey));
|
|
|
|
}
|
2021-04-15 21:32:45 +08:00
|
|
|
|
|
|
|
// Save extra 'general' options
|
|
|
|
mSettings->mSettings.setValue("useCustomCompileParams", pSet->useCustomCompileParams());
|
|
|
|
mSettings->mSettings.setValue("customCompileParams", pSet->customCompileParams());
|
|
|
|
mSettings->mSettings.setValue("useCustomLinkParams", pSet->useCustomLinkParams());
|
|
|
|
mSettings->mSettings.setValue("customLinkParams", pSet->customLinkParams());
|
|
|
|
mSettings->mSettings.setValue("AddCharset", pSet->autoAddCharsetParams());
|
2021-09-02 21:01:23 +08:00
|
|
|
mSettings->mSettings.setValue("StaticLink", pSet->staticLink());
|
2022-01-24 11:23:30 +08:00
|
|
|
mSettings->mSettings.setValue("ExecCharset", pSet->execCharset());
|
2021-04-15 21:32:45 +08:00
|
|
|
|
2022-10-12 19:48:35 +08:00
|
|
|
mSettings->mSettings.setValue("preprocessingSuffix", pSet->preprocessingSuffix());
|
|
|
|
mSettings->mSettings.setValue("compilationProperSuffix", pSet->compilationProperSuffix());
|
|
|
|
mSettings->mSettings.setValue("assemblingSuffix", pSet->assemblingSuffix());
|
|
|
|
mSettings->mSettings.setValue("executableSuffix", pSet->executableSuffix());
|
|
|
|
mSettings->mSettings.setValue("compilationStage", (int)pSet->compilationStage());
|
|
|
|
|
2021-04-17 14:52:47 +08:00
|
|
|
// Misc. properties
|
|
|
|
mSettings->mSettings.setValue("DumpMachine", pSet->dumpMachine());
|
|
|
|
mSettings->mSettings.setValue("Version", pSet->version());
|
|
|
|
mSettings->mSettings.setValue("Type", pSet->type());
|
|
|
|
mSettings->mSettings.setValue("Name", pSet->name());
|
|
|
|
mSettings->mSettings.setValue("Target", pSet->target());
|
2022-10-30 11:58:42 +08:00
|
|
|
mSettings->mSettings.setValue("CompilerType", (int)pSet->compilerType());
|
|
|
|
mSettings->mSettings.setValue("CompilerSetType", (int)pSet->compilerSetType());
|
2021-04-17 14:52:47 +08:00
|
|
|
|
2021-04-15 21:32:45 +08:00
|
|
|
// Paths
|
2021-04-17 14:52:47 +08:00
|
|
|
savePathList("Bins",pSet->binDirs());
|
|
|
|
savePathList("C",pSet->CIncludeDirs());
|
|
|
|
savePathList("Cpp",pSet->CppIncludeDirs());
|
2021-04-17 22:38:46 +08:00
|
|
|
savePathList("Libs",pSet->libDirs());
|
2021-04-15 21:32:45 +08:00
|
|
|
|
|
|
|
mSettings->mSettings.endGroup();
|
|
|
|
}
|
|
|
|
|
2021-04-17 14:52:47 +08:00
|
|
|
QString Settings::CompilerSets::loadPath(const QString &name)
|
|
|
|
{
|
|
|
|
QString s = mSettings->mSettings.value(name).toString();
|
|
|
|
QString prefix = "%AppPath%/";
|
|
|
|
if (s.startsWith(prefix)) {
|
2021-12-26 15:08:54 +08:00
|
|
|
s = includeTrailingPathDelimiter(mSettings->mDirs.appDir()) + s.mid(prefix.length());
|
2021-04-17 14:52:47 +08:00
|
|
|
}
|
|
|
|
return QFileInfo(s).absoluteFilePath();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CompilerSets::loadPathList(const QString &name, QStringList& list)
|
|
|
|
{
|
|
|
|
list.clear();
|
|
|
|
QStringList sl = mSettings->mSettings.value(name).toStringList();
|
|
|
|
QString prefix = "%AppPath%/";
|
|
|
|
for (QString& s:sl) {
|
|
|
|
if (s.startsWith(prefix)) {
|
2021-12-26 15:08:54 +08:00
|
|
|
s = includeTrailingPathDelimiter(mSettings->mDirs.appDir()) + s.mid(prefix.length());
|
2021-04-17 14:52:47 +08:00
|
|
|
}
|
|
|
|
list.append(QFileInfo(s).absoluteFilePath());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-15 21:32:45 +08:00
|
|
|
Settings::PCompilerSet Settings::CompilerSets::loadSet(int index)
|
|
|
|
{
|
|
|
|
PCompilerSet pSet = std::make_shared<CompilerSet>();
|
|
|
|
mSettings->mSettings.beginGroup(QString(SETTING_COMPILTER_SET).arg(index));
|
2021-04-17 14:52:47 +08:00
|
|
|
|
|
|
|
pSet->setCCompiler(loadPath("ccompiler"));
|
|
|
|
pSet->setCppCompiler(loadPath("cppcompiler"));
|
|
|
|
pSet->setDebugger(loadPath("debugger"));
|
2021-12-25 18:09:50 +08:00
|
|
|
pSet->setDebugServer(loadPath("debug_server"));
|
2021-04-17 14:52:47 +08:00
|
|
|
pSet->setMake(loadPath("make"));
|
|
|
|
pSet->setResourceCompiler(loadPath("windres"));
|
2023-02-08 21:07:41 +08:00
|
|
|
pSet->setAssembler(loadPath("assembler"));
|
2021-04-15 21:32:45 +08:00
|
|
|
|
2022-05-14 11:21:59 +08:00
|
|
|
pSet->setDumpMachine(mSettings->mSettings.value("DumpMachine").toString());
|
|
|
|
pSet->setVersion(mSettings->mSettings.value("Version").toString());
|
|
|
|
pSet->setType(mSettings->mSettings.value("Type").toString());
|
|
|
|
pSet->setName(mSettings->mSettings.value("Name").toString());
|
|
|
|
pSet->setTarget(mSettings->mSettings.value("Target").toString());
|
2022-10-30 11:58:42 +08:00
|
|
|
//compatibility
|
|
|
|
QString temp = mSettings->mSettings.value("CompilerType").toString();
|
|
|
|
if (temp==COMPILER_CLANG) {
|
|
|
|
pSet->setCompilerType(CompilerType::Clang);
|
|
|
|
} else if (temp==COMPILER_GCC) {
|
|
|
|
pSet->setCompilerType(CompilerType::GCC);
|
|
|
|
} else if (temp==COMPILER_GCC_UTF8) {
|
|
|
|
pSet->setCompilerType(CompilerType::GCC_UTF8);
|
|
|
|
} else {
|
|
|
|
pSet->setCompilerType((CompilerType)mSettings->mSettings.value("CompilerType").toInt());
|
|
|
|
}
|
|
|
|
|
|
|
|
pSet->setCompilerSetType((CompilerSetType)mSettings->mSettings.value("CompilerSetType").toInt());
|
2021-04-15 21:32:45 +08:00
|
|
|
|
2022-05-14 11:21:59 +08:00
|
|
|
// Load extra 'general' options
|
2022-01-24 11:23:30 +08:00
|
|
|
pSet->setUseCustomCompileParams(mSettings->mSettings.value("useCustomCompileParams", false).toBool());
|
2021-04-15 21:32:45 +08:00
|
|
|
pSet->setCustomCompileParams(mSettings->mSettings.value("customCompileParams").toString());
|
2022-01-24 11:23:30 +08:00
|
|
|
pSet->setUseCustomLinkParams(mSettings->mSettings.value("useCustomLinkParams", false).toBool());
|
2021-04-15 21:32:45 +08:00
|
|
|
pSet->setCustomLinkParams(mSettings->mSettings.value("customLinkParams").toString());
|
2022-01-24 11:23:30 +08:00
|
|
|
pSet->setAutoAddCharsetParams(mSettings->mSettings.value("AddCharset", true).toBool());
|
|
|
|
pSet->setStaticLink(mSettings->mSettings.value("StaticLink", false).toBool());
|
|
|
|
pSet->setExecCharset(mSettings->mSettings.value("ExecCharset", ENCODING_SYSTEM_DEFAULT).toString());
|
|
|
|
if (pSet->execCharset().isEmpty()) {
|
|
|
|
pSet->setExecCharset(ENCODING_SYSTEM_DEFAULT);
|
|
|
|
}
|
2022-10-12 19:48:35 +08:00
|
|
|
pSet->setPreprocessingSuffix(mSettings->mSettings.value("preprocessingSuffix", DEFAULT_PREPROCESSING_SUFFIX).toString());
|
|
|
|
pSet->setCompilationProperSuffix(mSettings->mSettings.value("compilationProperSuffix",DEFAULT_COMPILATION_SUFFIX).toString());
|
|
|
|
pSet->setAssemblingSuffix(mSettings->mSettings.value("assemblingSuffix", DEFAULT_ASSEMBLING_SUFFIX).toString());
|
|
|
|
pSet->setExecutableSuffix(mSettings->mSettings.value("executableSuffix", DEFAULT_EXECUTABLE_SUFFIX).toString());
|
|
|
|
pSet->setCompilationStage((Settings::CompilerSet::CompilationStage)mSettings->mSettings.value(
|
|
|
|
"compilationStage",
|
|
|
|
(int)Settings::CompilerSet::CompilationStage::GenerateExecutable).toInt());
|
2021-04-15 21:32:45 +08:00
|
|
|
|
2022-05-14 11:21:59 +08:00
|
|
|
// Load options
|
|
|
|
QByteArray iniOptions = mSettings->mSettings.value("Options","").toByteArray();
|
|
|
|
if (!iniOptions.isEmpty())
|
|
|
|
pSet->setIniOptions(iniOptions);
|
|
|
|
else {
|
|
|
|
foreach (const QString &optionKey, mSettings->mSettings.allKeys()) {
|
|
|
|
if (CompilerInfoManager::hasCompilerOption(pSet->compilerType(),optionKey)) {
|
|
|
|
pSet->setCompileOption(optionKey, mSettings->mSettings.value(optionKey).toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-04-17 14:52:47 +08:00
|
|
|
|
2021-04-15 21:32:45 +08:00
|
|
|
// Paths
|
2021-04-17 14:52:47 +08:00
|
|
|
loadPathList("Bins",pSet->binDirs());
|
|
|
|
loadPathList("C",pSet->CIncludeDirs());
|
|
|
|
loadPathList("Cpp",pSet->CppIncludeDirs());
|
2021-04-17 22:38:46 +08:00
|
|
|
loadPathList("Libs",pSet->libDirs());
|
2021-04-15 21:32:45 +08:00
|
|
|
|
|
|
|
mSettings->mSettings.endGroup();
|
2021-04-17 14:52:47 +08:00
|
|
|
|
2022-12-16 11:10:46 +08:00
|
|
|
// if (pSet->binDirs().isEmpty())
|
|
|
|
// return PCompilerSet();
|
2022-03-11 20:51:33 +08:00
|
|
|
|
2021-04-15 21:32:45 +08:00
|
|
|
return pSet;
|
|
|
|
}
|
2021-06-18 21:48:40 +08:00
|
|
|
|
2022-05-13 20:22:16 +08:00
|
|
|
void Settings::CompilerSets::prepareCompatibleIndex()
|
|
|
|
{
|
2022-05-12 15:28:08 +08:00
|
|
|
|
|
|
|
//old settings compatibility, don't reorder, add or remove items
|
2022-05-14 11:21:59 +08:00
|
|
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_ANSI);
|
2022-09-24 21:24:58 +08:00
|
|
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_NO_ASM);
|
2022-05-14 11:21:59 +08:00
|
|
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_TRADITIONAL_CPP);
|
|
|
|
|
|
|
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_ARCH);
|
|
|
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_TUNE);
|
|
|
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_INSTRUCTION);
|
|
|
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_OPTIMIZE);
|
|
|
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_POINTER_SIZE);
|
|
|
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_STD);
|
|
|
|
|
|
|
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_INHIBIT_ALL_WARNING);
|
|
|
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_WARNING_ALL);
|
|
|
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_WARNING_EXTRA);
|
|
|
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_CHECK_ISO_CONFORMANCE);
|
|
|
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_SYNTAX_ONLY);
|
|
|
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_WARNING_AS_ERROR);
|
|
|
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_ABORT_ON_ERROR);
|
|
|
|
|
|
|
|
mCompilerCompatibleIndex.append(CC_CMD_OPT_PROFILE_INFO);
|
|
|
|
|
|
|
|
mCompilerCompatibleIndex.append(LINK_CMD_OPT_LINK_OBJC);
|
|
|
|
mCompilerCompatibleIndex.append(LINK_CMD_OPT_NO_LINK_STDLIB);
|
|
|
|
mCompilerCompatibleIndex.append(LINK_CMD_OPT_NO_CONSOLE);
|
|
|
|
mCompilerCompatibleIndex.append(LINK_CMD_OPT_STRIP_EXE);
|
|
|
|
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);
|
2022-05-12 15:28:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
QString Settings::CompilerSets::getKeyFromCompilerCompatibleIndex(int idx) const
|
|
|
|
{
|
|
|
|
if (idx<0 || idx >= mCompilerCompatibleIndex.length())
|
|
|
|
return QString();
|
|
|
|
return mCompilerCompatibleIndex[idx];
|
|
|
|
}
|
|
|
|
|
2022-12-11 18:22:44 +08:00
|
|
|
bool Settings::CompilerSets::isTarget64Bit(const QString &target)
|
|
|
|
{
|
2022-12-11 22:43:23 +08:00
|
|
|
/* Fetched from LLVM 15.0.6's arch parser,
|
|
|
|
* `Triple::ArchType parseArch(StringRef ArchName)`
|
|
|
|
* in `llvm/lib/Support/Triple.cpp`.
|
|
|
|
* The following non-CPU targets are not included:
|
|
|
|
* nvptx64, le64, amdil64, hsail64, spir64, spirv64, renderscript64.
|
|
|
|
*/
|
|
|
|
QSet<QString> targets {
|
|
|
|
// x86_64
|
|
|
|
"amd64", "x86_64", "x86_64h",
|
|
|
|
// ppc64
|
|
|
|
"powerpc64", "ppu", "ppc64",
|
|
|
|
// ppc64le
|
|
|
|
"powerpc64le", "ppc64le",
|
|
|
|
// aarch64
|
|
|
|
"aarch64", "arm64", "arm64e",
|
|
|
|
// aarch64_be
|
|
|
|
"aarch64_be",
|
|
|
|
// aarch64_32
|
|
|
|
"aarch64_32", "arm64_32",
|
|
|
|
// mips64
|
|
|
|
"mips64", "mips64eb", "mipsn32", "mipsisa64r6", "mips64r6", "mipsn32r6",
|
|
|
|
// mips64el
|
|
|
|
"mips64el", "mipsn32el", "mipsisa64r6el", "mips64r6el", "mipsn32r6el",
|
|
|
|
// riscv64
|
|
|
|
"riscv64",
|
|
|
|
// systemz
|
|
|
|
"s390x", "systemz",
|
|
|
|
// sparcv9
|
|
|
|
"sparcv9", "sparc64",
|
|
|
|
// wasm64
|
|
|
|
"wasm64",
|
|
|
|
// loongarch64
|
|
|
|
"loongarch64",
|
2022-12-11 18:22:44 +08:00
|
|
|
};
|
2022-12-11 22:43:23 +08:00
|
|
|
return targets.contains(target);
|
2022-12-11 18:22:44 +08:00
|
|
|
}
|
|
|
|
|
2021-06-18 21:48:40 +08:00
|
|
|
Settings::Environment::Environment(Settings *settings):_Base(settings, SETTING_ENVIRONMENT)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Environment::doLoad()
|
|
|
|
{
|
|
|
|
//Appearence
|
2021-06-21 16:25:21 +08:00
|
|
|
mTheme = stringValue("theme","dark");
|
2021-11-30 22:39:24 +08:00
|
|
|
QString defaultFontName = "Segoe UI";
|
2022-03-27 16:07:51 +08:00
|
|
|
QString defaultLocaleName = QLocale::system().name();
|
|
|
|
if (defaultLocaleName == "zh_CN") {
|
2021-11-30 22:39:24 +08:00
|
|
|
QString fontName;
|
2022-05-28 21:19:29 +08:00
|
|
|
#ifdef Q_OS_WINDOWS
|
2021-11-30 22:39:24 +08:00
|
|
|
fontName = "Microsoft Yahei";
|
2022-05-28 21:19:29 +08:00
|
|
|
#elif defined(Q_OS_MACOS)
|
|
|
|
fontName = "PingFang SC";
|
|
|
|
#elif defined(Q_OS_LINUX)
|
|
|
|
fontName = "Noto Sans CJK";
|
|
|
|
#endif
|
2021-11-30 22:39:24 +08:00
|
|
|
QFont font(fontName);
|
|
|
|
if (font.exactMatch()) {
|
|
|
|
defaultFontName = fontName;
|
|
|
|
}
|
|
|
|
}
|
2021-12-16 19:14:14 +08:00
|
|
|
mInterfaceFont = stringValue("interface_font",defaultFontName);
|
2022-11-12 10:56:57 +08:00
|
|
|
mInterfaceFontSize = intValue("interface_font_size",11);
|
2022-12-20 11:01:04 +08:00
|
|
|
mIconZoomFactor = doubleValue("icon_zoom_factor",1.0);
|
2022-03-27 16:07:51 +08:00
|
|
|
mLanguage = stringValue("language", defaultLocaleName);
|
2022-02-01 21:39:31 +08:00
|
|
|
mIconSet = stringValue("icon_set","contrast");
|
2022-01-27 12:08:57 +08:00
|
|
|
mUseCustomIconSet = boolValue("use_custom_icon_set", false);
|
2022-01-28 16:13:20 +08:00
|
|
|
mUseCustomTheme = boolValue("use_custom_theme", false);
|
2022-01-27 12:08:57 +08:00
|
|
|
|
2021-10-22 07:42:51 +08:00
|
|
|
mCurrentFolder = stringValue("current_folder",QDir::currentPath());
|
2021-10-22 15:02:54 +08:00
|
|
|
if (!fileExists(mCurrentFolder)) {
|
|
|
|
mCurrentFolder = QDir::currentPath();
|
|
|
|
}
|
2021-11-10 10:42:33 +08:00
|
|
|
mDefaultOpenFolder = stringValue("default_open_folder",QDir::currentPath());
|
|
|
|
if (!fileExists(mDefaultOpenFolder)) {
|
|
|
|
mDefaultOpenFolder = QDir::currentPath();
|
|
|
|
}
|
2021-12-25 23:38:53 +08:00
|
|
|
#ifdef Q_OS_LINUX
|
2022-01-04 19:43:23 +08:00
|
|
|
//use qterminal by default
|
|
|
|
mTerminalPath = stringValue("terminal_path","/usr/bin/qterminal");
|
|
|
|
if (mTerminalPath.isEmpty())
|
|
|
|
mTerminalPath = stringValue("terminal_path","/usr/bin/konsole");
|
|
|
|
if (mTerminalPath.isEmpty())
|
|
|
|
mTerminalPath = stringValue("terminal_path","/usr/bin/x-terminal-emulator");
|
2022-01-05 09:08:44 +08:00
|
|
|
mAStylePath = includeTrailingPathDelimiter(pSettings->dirs().appLibexecDir())+"astyle";
|
2022-05-28 21:19:29 +08:00
|
|
|
#elif defined(Q_OS_MACOS)
|
|
|
|
mTerminalPath = stringValue("terminal_path",
|
|
|
|
"/System/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal");
|
|
|
|
mAStylePath = includeTrailingPathDelimiter(pSettings->dirs().appLibexecDir())+"astyle";
|
2021-12-25 23:38:53 +08:00
|
|
|
#endif
|
2022-02-28 22:40:09 +08:00
|
|
|
mHideNonSupportFilesInFileView=boolValue("hide_non_support_files_file_view",true);
|
|
|
|
mOpenFilesInSingleInstance = boolValue("open_files_in_single_instance",false);
|
2021-06-18 21:48:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::Environment::interfaceFontSize() const
|
|
|
|
{
|
|
|
|
return mInterfaceFontSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Environment::setInterfaceFontSize(int interfaceFontSize)
|
|
|
|
{
|
|
|
|
mInterfaceFontSize = interfaceFontSize;
|
|
|
|
}
|
|
|
|
|
2021-06-20 09:27:37 +08:00
|
|
|
QString Settings::Environment::language() const
|
|
|
|
{
|
|
|
|
return mLanguage;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Environment::setLanguage(const QString &language)
|
|
|
|
{
|
|
|
|
mLanguage = language;
|
|
|
|
}
|
|
|
|
|
2021-10-22 07:42:51 +08:00
|
|
|
const QString &Settings::Environment::currentFolder() const
|
|
|
|
{
|
|
|
|
return mCurrentFolder;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Environment::setCurrentFolder(const QString &newCurrentFolder)
|
|
|
|
{
|
|
|
|
mCurrentFolder = newCurrentFolder;
|
|
|
|
}
|
|
|
|
|
2021-11-10 10:42:33 +08:00
|
|
|
const QString &Settings::Environment::defaultOpenFolder() const
|
|
|
|
{
|
|
|
|
return mDefaultOpenFolder;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Environment::setDefaultOpenFolder(const QString &newDefaultOpenFolder)
|
|
|
|
{
|
|
|
|
mDefaultOpenFolder = newDefaultOpenFolder;
|
|
|
|
}
|
|
|
|
|
2021-12-24 09:17:28 +08:00
|
|
|
const QString &Settings::Environment::iconSet() const
|
|
|
|
{
|
|
|
|
return mIconSet;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Environment::setIconSet(const QString &newIconSet)
|
|
|
|
{
|
|
|
|
mIconSet = newIconSet;
|
|
|
|
}
|
|
|
|
|
2021-12-25 23:38:53 +08:00
|
|
|
QString Settings::Environment::terminalPath() const
|
|
|
|
{
|
|
|
|
return mTerminalPath;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Environment::setTerminalPath(const QString &terminalPath)
|
|
|
|
{
|
|
|
|
mTerminalPath = terminalPath;
|
|
|
|
}
|
|
|
|
|
2021-12-27 22:46:54 +08:00
|
|
|
QString Settings::Environment::AStylePath() const
|
|
|
|
{
|
|
|
|
return mAStylePath;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Environment::setAStylePath(const QString &aStylePath)
|
|
|
|
{
|
|
|
|
mAStylePath = aStylePath;
|
|
|
|
}
|
|
|
|
|
2022-01-27 12:08:57 +08:00
|
|
|
bool Settings::Environment::useCustomIconSet() const
|
|
|
|
{
|
|
|
|
return mUseCustomIconSet;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Environment::setUseCustomIconSet(bool newUseCustomIconSet)
|
|
|
|
{
|
|
|
|
mUseCustomIconSet = newUseCustomIconSet;
|
|
|
|
}
|
|
|
|
|
2022-01-28 16:13:20 +08:00
|
|
|
bool Settings::Environment::useCustomTheme() const
|
|
|
|
{
|
|
|
|
return mUseCustomTheme;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Environment::setUseCustomTheme(bool newUseCustomTheme)
|
|
|
|
{
|
|
|
|
mUseCustomTheme = newUseCustomTheme;
|
|
|
|
}
|
|
|
|
|
2022-02-28 22:40:09 +08:00
|
|
|
bool Settings::Environment::hideNonSupportFilesInFileView() const
|
|
|
|
{
|
|
|
|
return mHideNonSupportFilesInFileView;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Environment::setHideNonSupportFilesInFileView(bool newHideNonSupportFilesInFileView)
|
|
|
|
{
|
|
|
|
mHideNonSupportFilesInFileView = newHideNonSupportFilesInFileView;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Environment::openFilesInSingleInstance() const
|
|
|
|
{
|
|
|
|
return mOpenFilesInSingleInstance;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Environment::setOpenFilesInSingleInstance(bool newOpenFilesInSingleInstance)
|
|
|
|
{
|
|
|
|
mOpenFilesInSingleInstance = newOpenFilesInSingleInstance;
|
|
|
|
}
|
|
|
|
|
2022-12-20 11:01:04 +08:00
|
|
|
double Settings::Environment::iconZoomFactor() const
|
|
|
|
{
|
|
|
|
return mIconZoomFactor;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Environment::setIconZoomFactor(double newIconZoomFactor)
|
|
|
|
{
|
|
|
|
mIconZoomFactor = newIconZoomFactor;
|
|
|
|
}
|
|
|
|
|
2021-06-18 21:48:40 +08:00
|
|
|
void Settings::Environment::doSave()
|
|
|
|
{
|
|
|
|
//Appearence
|
|
|
|
saveValue("theme", mTheme);
|
2021-12-16 19:14:14 +08:00
|
|
|
saveValue("interface_font", mInterfaceFont);
|
|
|
|
saveValue("interface_font_size", mInterfaceFontSize);
|
2022-12-20 11:01:04 +08:00
|
|
|
saveValue("icon_zoom_factor",mIconZoomFactor);
|
2021-06-20 09:27:37 +08:00
|
|
|
saveValue("language", mLanguage);
|
2021-12-24 09:17:28 +08:00
|
|
|
saveValue("icon_set",mIconSet);
|
2022-01-27 12:08:57 +08:00
|
|
|
saveValue("use_custom_icon_set", mUseCustomIconSet);
|
2022-01-28 16:13:20 +08:00
|
|
|
saveValue("use_custom_theme", mUseCustomTheme);
|
2021-11-10 10:42:33 +08:00
|
|
|
|
2021-10-22 07:42:51 +08:00
|
|
|
saveValue("current_folder",mCurrentFolder);
|
2021-11-10 10:42:33 +08:00
|
|
|
saveValue("default_open_folder",mDefaultOpenFolder);
|
2021-12-25 23:38:53 +08:00
|
|
|
#ifndef Q_OS_WIN
|
|
|
|
saveValue("terminal_path",mTerminalPath);
|
2021-12-27 22:46:54 +08:00
|
|
|
saveValue("asyle_path",mAStylePath);
|
2021-12-25 23:38:53 +08:00
|
|
|
#endif
|
2022-02-28 22:40:09 +08:00
|
|
|
|
|
|
|
saveValue("hide_non_support_files_file_view",mHideNonSupportFilesInFileView);
|
|
|
|
saveValue("open_files_in_single_instance",mOpenFilesInSingleInstance);
|
2021-06-18 21:48:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
QString Settings::Environment::interfaceFont() const
|
|
|
|
{
|
|
|
|
return mInterfaceFont;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Environment::setInterfaceFont(const QString &interfaceFont)
|
|
|
|
{
|
|
|
|
mInterfaceFont = interfaceFont;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString Settings::Environment::theme() const
|
|
|
|
{
|
|
|
|
return mTheme;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Environment::setTheme(const QString &theme)
|
|
|
|
{
|
|
|
|
mTheme = theme;
|
|
|
|
}
|
2021-07-01 19:44:38 +08:00
|
|
|
|
|
|
|
Settings::Executor::Executor(Settings *settings):_Base(settings, SETTING_EXECUTOR)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Executor::minimizeOnRun() const
|
|
|
|
{
|
|
|
|
return mMinimizeOnRun;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Executor::setMinimizeOnRun(bool minimizeOnRun)
|
|
|
|
{
|
|
|
|
mMinimizeOnRun = minimizeOnRun;
|
|
|
|
}
|
|
|
|
|
2021-09-19 17:59:03 +08:00
|
|
|
bool Settings::Executor::useParams() const
|
|
|
|
{
|
|
|
|
return mUseParams;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Executor::setUseParams(bool newUseParams)
|
|
|
|
{
|
|
|
|
mUseParams = newUseParams;
|
|
|
|
}
|
|
|
|
|
|
|
|
const QString &Settings::Executor::params() const
|
|
|
|
{
|
|
|
|
return mParams;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Executor::setParams(const QString &newParams)
|
|
|
|
{
|
|
|
|
mParams = newParams;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Executor::redirectInput() const
|
|
|
|
{
|
|
|
|
return mRedirectInput;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Executor::setRedirectInput(bool newRedirectInput)
|
|
|
|
{
|
|
|
|
mRedirectInput = newRedirectInput;
|
|
|
|
}
|
|
|
|
|
|
|
|
const QString &Settings::Executor::inputFilename() const
|
|
|
|
{
|
|
|
|
return mInputFilename;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Executor::setInputFilename(const QString &newInputFilename)
|
|
|
|
{
|
|
|
|
mInputFilename = newInputFilename;
|
|
|
|
}
|
|
|
|
|
2021-11-02 13:12:36 +08:00
|
|
|
int Settings::Executor::competivieCompanionPort() const
|
|
|
|
{
|
|
|
|
return mCompetivieCompanionPort;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Executor::setCompetivieCompanionPort(int newCompetivieCompanionPort)
|
|
|
|
{
|
|
|
|
mCompetivieCompanionPort = newCompetivieCompanionPort;
|
|
|
|
}
|
|
|
|
|
2021-11-27 15:43:47 +08:00
|
|
|
bool Settings::Executor::ignoreSpacesWhenValidatingCases() const
|
|
|
|
{
|
|
|
|
return mIgnoreSpacesWhenValidatingCases;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Executor::setIgnoreSpacesWhenValidatingCases(bool newIgnoreSpacesWhenValidatingCases)
|
|
|
|
{
|
|
|
|
mIgnoreSpacesWhenValidatingCases = newIgnoreSpacesWhenValidatingCases;
|
|
|
|
}
|
|
|
|
|
2021-12-15 19:12:16 +08:00
|
|
|
bool Settings::Executor::caseEditorFontOnlyMonospaced() const
|
|
|
|
{
|
|
|
|
return mCaseEditorFontOnlyMonospaced;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Executor::setCaseEditorFontOnlyMonospaced(bool newCaseEditorFontOnlyMonospaced)
|
|
|
|
{
|
|
|
|
mCaseEditorFontOnlyMonospaced = newCaseEditorFontOnlyMonospaced;
|
|
|
|
}
|
|
|
|
|
2022-12-13 08:49:20 +08:00
|
|
|
size_t Settings::Executor::caseTimeout() const
|
2022-03-27 11:44:52 +08:00
|
|
|
{
|
|
|
|
return mCaseTimeout;
|
|
|
|
}
|
|
|
|
|
2022-12-13 08:49:20 +08:00
|
|
|
void Settings::Executor::setCaseTimeout(size_t newCaseTimeout)
|
2022-03-27 11:44:52 +08:00
|
|
|
{
|
|
|
|
mCaseTimeout = newCaseTimeout;
|
|
|
|
}
|
|
|
|
|
2022-12-13 08:49:20 +08:00
|
|
|
size_t Settings::Executor::caseMemoryLimit() const
|
|
|
|
{
|
|
|
|
return mCaseMemoryLimit;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Executor::setCaseMemoryLimit(size_t newCaseMemoryLimit)
|
2022-03-27 11:44:52 +08:00
|
|
|
{
|
2022-12-13 08:49:20 +08:00
|
|
|
mCaseMemoryLimit = newCaseMemoryLimit;
|
2022-03-27 11:44:52 +08:00
|
|
|
}
|
|
|
|
|
2022-12-24 12:08:13 +08:00
|
|
|
bool Settings::Executor::convertHTMLToTextForExpected() const
|
|
|
|
{
|
|
|
|
return mConvertHTMLToTextForExpected;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Executor::setConvertHTMLToTextForExpected(bool newConvertHTMLToTextForExpected)
|
|
|
|
{
|
|
|
|
mConvertHTMLToTextForExpected = newConvertHTMLToTextForExpected;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Executor::convertHTMLToTextForInput() const
|
|
|
|
{
|
|
|
|
return mConvertHTMLToTextForInput;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Executor::setConvertHTMLToTextForInput(bool newConvertHTMLToTextForInput)
|
|
|
|
{
|
|
|
|
mConvertHTMLToTextForInput = newConvertHTMLToTextForInput;
|
|
|
|
}
|
|
|
|
|
2022-12-13 08:49:20 +08:00
|
|
|
bool Settings::Executor::enableCaseLimit() const
|
2022-03-27 11:44:52 +08:00
|
|
|
{
|
2022-12-13 08:49:20 +08:00
|
|
|
return mEnableCaseLimit;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Executor::setEnableCaseLimit(bool newValue)
|
|
|
|
{
|
|
|
|
mEnableCaseLimit = newValue;
|
2022-03-27 11:44:52 +08:00
|
|
|
}
|
|
|
|
|
2021-12-15 19:12:16 +08:00
|
|
|
int Settings::Executor::caseEditorFontSize() const
|
|
|
|
{
|
|
|
|
return mCaseEditorFontSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Executor::setCaseEditorFontSize(int newCaseEditorFontSize)
|
|
|
|
{
|
|
|
|
mCaseEditorFontSize = newCaseEditorFontSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
const QString &Settings::Executor::caseEditorFontName() const
|
|
|
|
{
|
|
|
|
return mCaseEditorFontName;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Executor::setCaseEditorFontName(const QString &newCaseEditorFontName)
|
|
|
|
{
|
|
|
|
mCaseEditorFontName = newCaseEditorFontName;
|
|
|
|
}
|
|
|
|
|
2021-11-02 13:12:36 +08:00
|
|
|
bool Settings::Executor::enableCompetitiveCompanion() const
|
|
|
|
{
|
|
|
|
return mEnableCompetitiveCompanion;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Executor::setEnableCompetitiveCompanion(bool newEnableCompetitiveCompanion)
|
|
|
|
{
|
|
|
|
mEnableCompetitiveCompanion = newEnableCompetitiveCompanion;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Executor::enableProblemSet() const
|
|
|
|
{
|
|
|
|
return mEnableProblemSet;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Executor::setEnableProblemSet(bool newEnableProblemSet)
|
|
|
|
{
|
|
|
|
mEnableProblemSet = newEnableProblemSet;
|
|
|
|
}
|
|
|
|
|
2021-07-01 19:44:38 +08:00
|
|
|
void Settings::Executor::doSave()
|
|
|
|
{
|
|
|
|
saveValue("pause_console", mPauseConsole);
|
|
|
|
saveValue("minimize_on_run", mMinimizeOnRun);
|
2021-09-19 17:59:03 +08:00
|
|
|
saveValue("use_params",mUseParams);
|
|
|
|
saveValue("params",mParams);
|
|
|
|
saveValue("redirect_input",mRedirectInput);
|
|
|
|
saveValue("input_filename",mInputFilename);
|
2021-11-02 13:12:36 +08:00
|
|
|
//problem set
|
2021-11-19 08:11:33 +08:00
|
|
|
saveValue("enable_proble_set", mEnableProblemSet);
|
|
|
|
saveValue("enable_competivie_companion", mEnableCompetitiveCompanion);
|
|
|
|
saveValue("competitive_companion_port", mCompetivieCompanionPort);
|
2022-12-24 12:08:13 +08:00
|
|
|
saveValue("input_convert_html", mConvertHTMLToTextForInput);
|
|
|
|
saveValue("expected_convert_html", mConvertHTMLToTextForExpected);
|
2021-11-27 15:43:47 +08:00
|
|
|
saveValue("ignore_spaces_when_validating_cases", mIgnoreSpacesWhenValidatingCases);
|
2021-12-15 19:12:16 +08:00
|
|
|
saveValue("case_editor_font_name",mCaseEditorFontName);
|
|
|
|
saveValue("case_editor_font_size",mCaseEditorFontSize);
|
|
|
|
saveValue("case_editor_font_only_monospaced",mCaseEditorFontOnlyMonospaced);
|
2022-05-21 10:44:39 +08:00
|
|
|
saveValue("case_timeout_ms", mCaseTimeout);
|
2022-12-13 08:49:20 +08:00
|
|
|
saveValue("case_memory_limit",mCaseMemoryLimit);
|
2022-05-21 10:44:39 +08:00
|
|
|
remove("case_timeout");
|
2022-12-13 08:49:20 +08:00
|
|
|
saveValue("enable_case_limit", mEnableCaseLimit);
|
2021-07-01 19:44:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Executor::pauseConsole() const
|
|
|
|
{
|
|
|
|
return mPauseConsole;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Executor::setPauseConsole(bool pauseConsole)
|
|
|
|
{
|
|
|
|
mPauseConsole = pauseConsole;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Executor::doLoad()
|
|
|
|
{
|
|
|
|
mPauseConsole = boolValue("pause_console",true);
|
|
|
|
mMinimizeOnRun = boolValue("minimize_on_run",false);
|
2021-09-19 17:59:03 +08:00
|
|
|
mUseParams = boolValue("use_params",false);
|
|
|
|
mParams = stringValue("params", "");
|
|
|
|
mRedirectInput = boolValue("redirect_input",false);
|
|
|
|
mInputFilename = stringValue("input_filename","");
|
|
|
|
|
2021-11-02 13:12:36 +08:00
|
|
|
mEnableProblemSet = boolValue("enable_proble_set",true);
|
|
|
|
mEnableCompetitiveCompanion = boolValue("enable_competivie_companion",true);
|
|
|
|
mCompetivieCompanionPort = intValue("competitive_companion_port",10045);
|
2022-12-24 12:08:13 +08:00
|
|
|
mConvertHTMLToTextForInput = boolValue("input_convert_html", false);
|
|
|
|
mConvertHTMLToTextForExpected = boolValue("expected_convert_html", false);
|
2021-11-27 15:43:47 +08:00
|
|
|
mIgnoreSpacesWhenValidatingCases = boolValue("ignore_spaces_when_validating_cases",false);
|
2021-12-25 18:09:50 +08:00
|
|
|
#ifdef Q_OS_WIN
|
2021-12-15 19:12:16 +08:00
|
|
|
mCaseEditorFontName = stringValue("case_editor_font_name","consolas");
|
2022-05-30 17:10:10 +08:00
|
|
|
#elif defined(Q_OS_MACOS)
|
|
|
|
mCaseEditorFontName = stringValue("case_editor_font_name", "Menlo");
|
2021-12-25 08:23:52 +08:00
|
|
|
#else
|
|
|
|
mCaseEditorFontName = stringValue("case_editor_font_name","Dejavu Sans Mono");
|
|
|
|
#endif
|
2022-11-12 10:56:57 +08:00
|
|
|
mCaseEditorFontSize = intValue("case_editor_font_size",11);
|
2022-03-28 16:57:58 +08:00
|
|
|
mCaseEditorFontOnlyMonospaced = boolValue("case_editor_font_only_monospaced",true);
|
2022-05-21 10:44:39 +08:00
|
|
|
int case_timeout = intValue("case_timeout", -1);
|
|
|
|
if (case_timeout>0)
|
|
|
|
mCaseTimeout = case_timeout*1000;
|
|
|
|
else
|
2022-12-13 08:49:20 +08:00
|
|
|
mCaseTimeout = uintValue("case_timeout_ms", 2000); //2000ms
|
|
|
|
mCaseMemoryLimit = uintValue("case_memory_limit",0); // kb
|
|
|
|
|
|
|
|
mEnableCaseLimit = boolValue("enable_case_limit", true);
|
|
|
|
//compatibility
|
|
|
|
if (boolValue("enable_time_limit", true)) {
|
|
|
|
mEnableCaseLimit=true;
|
|
|
|
}
|
2021-07-01 19:44:38 +08:00
|
|
|
}
|
|
|
|
|
2021-07-26 11:47:54 +08:00
|
|
|
|
|
|
|
Settings::Debugger::Debugger(Settings *settings):_Base(settings, SETTING_DEBUGGER)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-11-25 10:18:21 +08:00
|
|
|
bool Settings::Debugger::enableDebugConsole() const
|
2021-07-26 11:47:54 +08:00
|
|
|
{
|
2021-11-25 10:18:21 +08:00
|
|
|
return mEnableDebugConsole;
|
2021-07-26 11:47:54 +08:00
|
|
|
}
|
|
|
|
|
2021-11-25 10:18:21 +08:00
|
|
|
void Settings::Debugger::setEnableDebugConsole(bool showCommandLog)
|
2021-07-26 11:47:54 +08:00
|
|
|
{
|
2021-11-25 10:18:21 +08:00
|
|
|
mEnableDebugConsole = showCommandLog;
|
2021-07-26 11:47:54 +08:00
|
|
|
}
|
|
|
|
|
2021-11-25 10:18:21 +08:00
|
|
|
bool Settings::Debugger::showDetailLog() const
|
2021-07-26 11:47:54 +08:00
|
|
|
{
|
2021-11-25 10:18:21 +08:00
|
|
|
return mShowDetailLog;
|
2021-07-26 11:47:54 +08:00
|
|
|
}
|
|
|
|
|
2021-11-25 10:18:21 +08:00
|
|
|
void Settings::Debugger::setShowDetailLog(bool showAnnotations)
|
2021-07-26 11:47:54 +08:00
|
|
|
{
|
2021-11-25 10:18:21 +08:00
|
|
|
mShowDetailLog = showAnnotations;
|
2021-07-26 11:47:54 +08:00
|
|
|
}
|
|
|
|
|
2021-08-01 23:24:37 +08:00
|
|
|
QString Settings::Debugger::fontName() const
|
|
|
|
{
|
|
|
|
return mFontName;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Debugger::setFontName(const QString &fontName)
|
|
|
|
{
|
|
|
|
mFontName = fontName;
|
|
|
|
}
|
|
|
|
|
2021-08-13 11:18:42 +08:00
|
|
|
bool Settings::Debugger::blendMode() const
|
|
|
|
{
|
|
|
|
return mBlendMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Debugger::setBlendMode(bool blendMode)
|
|
|
|
{
|
|
|
|
mBlendMode = blendMode;
|
|
|
|
}
|
|
|
|
|
2021-09-28 14:18:51 +08:00
|
|
|
bool Settings::Debugger::skipSystemLibraries() const
|
|
|
|
{
|
|
|
|
return mSkipSystemLibraries;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Debugger::setSkipSystemLibraries(bool newSkipSystemLibraries)
|
|
|
|
{
|
|
|
|
mSkipSystemLibraries = newSkipSystemLibraries;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Debugger::skipProjectLibraries() const
|
|
|
|
{
|
|
|
|
return mSkipProjectLibraries;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Debugger::setSkipProjectLibraries(bool newSkipProjectLibraries)
|
|
|
|
{
|
|
|
|
mSkipProjectLibraries = newSkipProjectLibraries;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Debugger::skipCustomLibraries() const
|
|
|
|
{
|
|
|
|
return mSkipCustomLibraries;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Debugger::setSkipCustomLibraries(bool newSkipCustomLibraries)
|
|
|
|
{
|
|
|
|
mSkipCustomLibraries = newSkipCustomLibraries;
|
|
|
|
}
|
|
|
|
|
2021-11-25 10:18:21 +08:00
|
|
|
bool Settings::Debugger::openCPUInfoWhenSignaled() const
|
|
|
|
{
|
|
|
|
return mOpenCPUInfoWhenSignaled;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Debugger::setOpenCPUInfoWhenSignaled(bool newOpenCPUInfoWhenSignaled)
|
|
|
|
{
|
|
|
|
mOpenCPUInfoWhenSignaled = newOpenCPUInfoWhenSignaled;
|
|
|
|
}
|
|
|
|
|
2021-12-25 18:09:50 +08:00
|
|
|
bool Settings::Debugger::useGDBServer() const
|
|
|
|
{
|
|
|
|
return mUseGDBServer;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Debugger::setUseGDBServer(bool newUseGDBServer)
|
|
|
|
{
|
|
|
|
mUseGDBServer = newUseGDBServer;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::Debugger::GDBServerPort() const
|
|
|
|
{
|
|
|
|
return mGDBServerPort;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Debugger::setGDBServerPort(int newGDBServerPort)
|
|
|
|
{
|
|
|
|
mGDBServerPort = newGDBServerPort;
|
|
|
|
}
|
|
|
|
|
2022-07-21 15:28:07 +08:00
|
|
|
int Settings::Debugger::memoryViewRows() const
|
|
|
|
{
|
|
|
|
return mMemoryViewRows;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Debugger::setMemoryViewRows(int newMemoryViewRows)
|
|
|
|
{
|
|
|
|
mMemoryViewRows = newMemoryViewRows;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::Debugger::memoryViewColumns() const
|
|
|
|
{
|
|
|
|
return mMemoryViewColumns;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Debugger::setMemoryViewColumns(int newMemoryViewColumns)
|
|
|
|
{
|
|
|
|
mMemoryViewColumns = newMemoryViewColumns;
|
|
|
|
}
|
|
|
|
|
2022-10-16 23:10:57 +08:00
|
|
|
bool Settings::Debugger::autosave() const
|
2021-10-21 19:33:11 +08:00
|
|
|
{
|
2022-10-16 23:10:57 +08:00
|
|
|
return mAutosave;
|
2021-10-21 19:33:11 +08:00
|
|
|
}
|
|
|
|
|
2022-10-16 23:10:57 +08:00
|
|
|
void Settings::Debugger::setAutosave(bool newAutosave)
|
2021-10-21 19:33:11 +08:00
|
|
|
{
|
2022-10-16 23:10:57 +08:00
|
|
|
mAutosave = newAutosave;
|
2021-10-21 19:33:11 +08:00
|
|
|
}
|
|
|
|
|
2021-08-01 23:24:37 +08:00
|
|
|
bool Settings::Debugger::useIntelStyle() const
|
|
|
|
{
|
|
|
|
return mUseIntelStyle;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Debugger::setUseIntelStyle(bool useIntelStyle)
|
|
|
|
{
|
|
|
|
mUseIntelStyle = useIntelStyle;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::Debugger::fontSize() const
|
|
|
|
{
|
|
|
|
return mFontSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Debugger::setFontSize(int fontSize)
|
|
|
|
{
|
|
|
|
mFontSize = fontSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::Debugger::onlyShowMono() const
|
|
|
|
{
|
|
|
|
return mOnlyShowMono;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Debugger::setOnlyShowMono(bool onlyShowMono)
|
|
|
|
{
|
|
|
|
mOnlyShowMono = onlyShowMono;
|
|
|
|
}
|
|
|
|
|
2021-07-26 11:47:54 +08:00
|
|
|
void Settings::Debugger::doSave()
|
|
|
|
{
|
2021-11-25 10:18:21 +08:00
|
|
|
saveValue("enable_debug_console", mEnableDebugConsole);
|
|
|
|
saveValue("show_detail_log", mShowDetailLog);
|
2021-08-01 23:24:37 +08:00
|
|
|
saveValue("font_name",mFontName);
|
|
|
|
saveValue("only_show_mono",mOnlyShowMono);
|
|
|
|
saveValue("font_size",mFontSize);
|
2021-08-13 11:18:42 +08:00
|
|
|
saveValue("use_intel_style",mUseIntelStyle);
|
|
|
|
saveValue("blend_mode",mBlendMode);
|
2021-09-28 14:18:51 +08:00
|
|
|
saveValue("skip_system_lib", mSkipSystemLibraries);
|
|
|
|
saveValue("skip_project_lib", mSkipProjectLibraries);
|
|
|
|
saveValue("skip_custom_lib", mSkipCustomLibraries);
|
2022-10-16 23:10:57 +08:00
|
|
|
saveValue("autosave",mAutosave);
|
2021-11-25 10:18:21 +08:00
|
|
|
saveValue("open_cpu_info_when_signaled",mOpenCPUInfoWhenSignaled);
|
2021-12-25 18:09:50 +08:00
|
|
|
saveValue("use_gdb_server", mUseGDBServer);
|
|
|
|
saveValue("gdb_server_port",mGDBServerPort);
|
2022-07-21 15:28:07 +08:00
|
|
|
saveValue("memory_view_rows",mMemoryViewRows);
|
|
|
|
saveValue("memory_view_columns",mMemoryViewColumns);
|
2021-07-26 11:47:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::Debugger::doLoad()
|
|
|
|
{
|
2021-11-25 10:18:21 +08:00
|
|
|
mEnableDebugConsole = boolValue("enable_debug_console",true);
|
|
|
|
mShowDetailLog = boolValue("show_detail_log",false);
|
2021-12-25 18:09:50 +08:00
|
|
|
#ifdef Q_OS_WIN
|
2021-08-01 23:24:37 +08:00
|
|
|
mFontName = stringValue("font_name","Consolas");
|
2021-12-25 08:23:52 +08:00
|
|
|
#else
|
|
|
|
mFontName = stringValue("font_name","Dejavu Sans Mono");
|
|
|
|
#endif
|
2021-08-01 23:24:37 +08:00
|
|
|
mOnlyShowMono = boolValue("only_show_mono",true);
|
2022-11-12 10:56:57 +08:00
|
|
|
mFontSize = intValue("font_size",14);
|
2023-02-13 10:24:35 +08:00
|
|
|
mUseIntelStyle = boolValue("use_intel_style",false);
|
2021-08-13 11:18:42 +08:00
|
|
|
mBlendMode = boolValue("blend_mode",true);
|
2021-09-28 14:18:51 +08:00
|
|
|
mSkipSystemLibraries = boolValue("skip_system_lib",true);
|
|
|
|
mSkipProjectLibraries = boolValue("skip_project_lib",true);
|
|
|
|
mSkipCustomLibraries = boolValue("skip_custom_lib",false);
|
2022-10-16 23:10:57 +08:00
|
|
|
mAutosave = boolValue("autosave",true);
|
2021-11-25 10:18:21 +08:00
|
|
|
mOpenCPUInfoWhenSignaled = boolValue("open_cpu_info_when_signaled",true);
|
2021-12-25 18:09:50 +08:00
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
mUseGDBServer = boolValue("use_gdb_server", false);
|
|
|
|
#else
|
|
|
|
mUseGDBServer = boolValue("use_gdb_server", true);
|
|
|
|
#endif
|
|
|
|
mGDBServerPort = intValue("gdb_server_port",41234);
|
2022-07-21 15:28:07 +08:00
|
|
|
mMemoryViewRows = intValue("memory_view_rows",8);
|
|
|
|
mMemoryViewColumns = intValue("memory_view_columns",8);
|
2021-08-01 23:24:37 +08:00
|
|
|
}
|
|
|
|
|
2021-08-30 13:30:42 +08:00
|
|
|
Settings::CodeCompletion::CodeCompletion(Settings *settings):_Base(settings, SETTING_CODE_COMPLETION)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeCompletion::showCodeIns() const
|
|
|
|
{
|
|
|
|
return mShowCodeIns;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeCompletion::setShowCodeIns(bool newShowCodeIns)
|
|
|
|
{
|
|
|
|
mShowCodeIns = newShowCodeIns;
|
|
|
|
}
|
|
|
|
|
2022-10-27 15:18:57 +08:00
|
|
|
bool Settings::CodeCompletion::clearWhenEditorHidden()
|
2021-11-08 09:19:50 +08:00
|
|
|
{
|
2022-11-23 11:41:16 +08:00
|
|
|
if (!mShareParser) {
|
2022-10-27 15:18:57 +08:00
|
|
|
#ifdef Q_OS_WIN
|
2022-11-23 11:41:16 +08:00
|
|
|
MEMORYSTATUSEX statex;
|
|
|
|
statex.dwLength = sizeof (statex);
|
|
|
|
GlobalMemoryStatusEx (&statex);
|
2022-10-28 12:43:47 +08:00
|
|
|
|
2022-11-23 11:41:16 +08:00
|
|
|
if (statex.ullAvailPhys < (long long int)2*1024*1024*1024) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
#elif defined(Q_OS_LINUX)
|
|
|
|
struct sysinfo si;
|
|
|
|
sysinfo(&si);
|
|
|
|
if (si.freeram < (long long int)2*1024*1024*1024) {
|
|
|
|
return true;
|
|
|
|
}
|
2022-10-27 15:18:57 +08:00
|
|
|
#endif
|
2022-11-23 11:41:16 +08:00
|
|
|
}
|
2021-11-08 09:19:50 +08:00
|
|
|
return mClearWhenEditorHidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeCompletion::setClearWhenEditorHidden(bool newClearWhenEditorHidden)
|
|
|
|
{
|
|
|
|
mClearWhenEditorHidden = newClearWhenEditorHidden;
|
|
|
|
}
|
|
|
|
|
2022-01-10 21:46:03 +08:00
|
|
|
int Settings::CodeCompletion::minCharRequired() const
|
|
|
|
{
|
|
|
|
return mMinCharRequired;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeCompletion::setMinCharRequired(int newMinCharRequired)
|
|
|
|
{
|
|
|
|
mMinCharRequired = newMinCharRequired;
|
|
|
|
}
|
|
|
|
|
2022-03-01 22:03:54 +08:00
|
|
|
bool Settings::CodeCompletion::hideSymbolsStartsWithTwoUnderLine() const
|
|
|
|
{
|
|
|
|
return mHideSymbolsStartsWithTwoUnderLine;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeCompletion::setHideSymbolsStartsWithTwoUnderLine(bool newHideSymbolsStartsWithTwoUnderLine)
|
|
|
|
{
|
|
|
|
mHideSymbolsStartsWithTwoUnderLine = newHideSymbolsStartsWithTwoUnderLine;
|
|
|
|
}
|
|
|
|
|
2022-10-27 15:18:57 +08:00
|
|
|
bool Settings::CodeCompletion::shareParser()
|
|
|
|
{
|
|
|
|
return mShareParser;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeCompletion::setShareParser(bool newShareParser)
|
|
|
|
{
|
|
|
|
mShareParser = newShareParser;
|
|
|
|
}
|
|
|
|
|
2022-03-01 22:03:54 +08:00
|
|
|
bool Settings::CodeCompletion::hideSymbolsStartsWithUnderLine() const
|
|
|
|
{
|
|
|
|
return mHideSymbolsStartsWithUnderLine;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeCompletion::setHideSymbolsStartsWithUnderLine(bool newHideSymbolsStartsWithOneUnderLine)
|
|
|
|
{
|
|
|
|
mHideSymbolsStartsWithUnderLine = newHideSymbolsStartsWithOneUnderLine;
|
|
|
|
}
|
|
|
|
|
2021-08-30 13:30:42 +08:00
|
|
|
bool Settings::CodeCompletion::appendFunc() const
|
|
|
|
{
|
|
|
|
return mAppendFunc;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeCompletion::setAppendFunc(bool newAppendFunc)
|
|
|
|
{
|
|
|
|
mAppendFunc = newAppendFunc;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeCompletion::ignoreCase() const
|
|
|
|
{
|
|
|
|
return mIgnoreCase;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeCompletion::setIgnoreCase(bool newIgnoreCase)
|
|
|
|
{
|
|
|
|
mIgnoreCase = newIgnoreCase;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeCompletion::showKeywords() const
|
|
|
|
{
|
|
|
|
return mShowKeywords;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeCompletion::setShowKeywords(bool newShowKeywords)
|
|
|
|
{
|
|
|
|
mShowKeywords = newShowKeywords;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeCompletion::sortByScope() const
|
|
|
|
{
|
|
|
|
return mSortByScope;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeCompletion::setSortByScope(bool newSortByScope)
|
|
|
|
{
|
|
|
|
mSortByScope = newSortByScope;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeCompletion::recordUsage() const
|
|
|
|
{
|
|
|
|
return mRecordUsage;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeCompletion::setRecordUsage(bool newRecordUsage)
|
|
|
|
{
|
|
|
|
mRecordUsage = newRecordUsage;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeCompletion::showCompletionWhileInput() const
|
|
|
|
{
|
|
|
|
return mShowCompletionWhileInput;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeCompletion::setShowCompletionWhileInput(bool newShowCompletionWhileInput)
|
|
|
|
{
|
|
|
|
mShowCompletionWhileInput = newShowCompletionWhileInput;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeCompletion::parseGlobalHeaders() const
|
|
|
|
{
|
|
|
|
return mParseGlobalHeaders;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeCompletion::setParseGlobalHeaders(bool newParseGlobalHeaders)
|
|
|
|
{
|
|
|
|
mParseGlobalHeaders = newParseGlobalHeaders;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeCompletion::parseLocalHeaders() const
|
|
|
|
{
|
|
|
|
return mParseLocalHeaders;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeCompletion::setParseLocalHeaders(bool newParseLocalHeaders)
|
|
|
|
{
|
|
|
|
mParseLocalHeaders = newParseLocalHeaders;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeCompletion::enabled() const
|
|
|
|
{
|
|
|
|
return mEnabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeCompletion::setEnabled(bool newEnabled)
|
|
|
|
{
|
|
|
|
mEnabled = newEnabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::CodeCompletion::height() const
|
|
|
|
{
|
|
|
|
return mHeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeCompletion::setHeight(int newHeight)
|
|
|
|
{
|
|
|
|
mHeight = newHeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::CodeCompletion::width() const
|
|
|
|
{
|
|
|
|
return mWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeCompletion::setWidth(int newWidth)
|
|
|
|
{
|
|
|
|
mWidth = newWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeCompletion::doSave()
|
|
|
|
{
|
|
|
|
saveValue("width",mWidth);
|
|
|
|
saveValue("height",mHeight);
|
|
|
|
saveValue("enabled",mEnabled);
|
|
|
|
saveValue("parse_local_headers",mParseLocalHeaders);
|
|
|
|
saveValue("parse_global_headers",mParseGlobalHeaders);
|
|
|
|
saveValue("show_completion_while_input",mShowCompletionWhileInput);
|
|
|
|
saveValue("record_usage",mRecordUsage);
|
|
|
|
saveValue("sort_by_scope",mSortByScope);
|
|
|
|
saveValue("show_keywords",mShowKeywords);
|
|
|
|
saveValue("ignore_case",mIgnoreCase);
|
|
|
|
saveValue("append_func",mAppendFunc);
|
|
|
|
saveValue("show_code_ins",mShowCodeIns);
|
2021-11-08 09:19:50 +08:00
|
|
|
saveValue("clear_when_editor_hidden",mClearWhenEditorHidden);
|
2022-01-10 21:46:03 +08:00
|
|
|
saveValue("min_char_required",mMinCharRequired);
|
2022-03-01 22:03:54 +08:00
|
|
|
saveValue("hide_symbols_start_with_two_underline", mHideSymbolsStartsWithTwoUnderLine);
|
|
|
|
saveValue("hide_symbols_start_with_underline", mHideSymbolsStartsWithUnderLine);
|
2022-10-27 15:18:57 +08:00
|
|
|
saveValue("share_parser",mShareParser);
|
2021-08-30 13:30:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void Settings::CodeCompletion::doLoad()
|
|
|
|
{
|
|
|
|
//Appearence
|
2021-08-30 16:59:08 +08:00
|
|
|
mWidth = intValue("width",700);
|
|
|
|
mHeight = intValue("height",400);
|
|
|
|
mEnabled = boolValue("enabled",true);
|
|
|
|
mParseLocalHeaders = boolValue("parse_local_headers",true);
|
|
|
|
mParseGlobalHeaders = boolValue("parse_global_headers",true);
|
|
|
|
mShowCompletionWhileInput = boolValue("show_completion_while_input",true);
|
|
|
|
mRecordUsage = boolValue("record_usage",true);
|
|
|
|
mSortByScope = boolValue("sort_by_scope",true);
|
|
|
|
mShowKeywords = boolValue("show_keywords",true);
|
|
|
|
mIgnoreCase = boolValue("ignore_case",true);
|
|
|
|
mAppendFunc = boolValue("append_func",true);
|
|
|
|
mShowCodeIns = boolValue("show_code_ins",true);
|
2022-01-10 21:46:03 +08:00
|
|
|
mMinCharRequired = intValue("min_char_required",1);
|
2022-03-01 22:03:54 +08:00
|
|
|
mHideSymbolsStartsWithTwoUnderLine = boolValue("hide_symbols_start_with_two_underline", true);
|
|
|
|
mHideSymbolsStartsWithUnderLine = boolValue("hide_symbols_start_with_underline", false);
|
2021-11-08 22:00:49 +08:00
|
|
|
|
2022-11-23 11:41:16 +08:00
|
|
|
bool shouldShare= true;
|
|
|
|
bool doClear = false;
|
2021-11-08 22:00:49 +08:00
|
|
|
|
2022-11-30 09:54:23 +08:00
|
|
|
//#ifdef Q_OS_WIN
|
|
|
|
// MEMORYSTATUSEX statex;
|
|
|
|
|
|
|
|
// statex.dwLength = sizeof (statex);
|
|
|
|
|
|
|
|
// GlobalMemoryStatusEx (&statex);
|
|
|
|
|
|
|
|
// if (statex.ullAvailPhys > (long long int)32*1024*1024*1024) {
|
|
|
|
// shouldShare = false;
|
|
|
|
// }
|
|
|
|
|
|
|
|
//// if (shouldShare) {
|
|
|
|
//// SYSTEM_INFO info;
|
|
|
|
//// GetSystemInfo(&info);
|
|
|
|
//// if (info.dwNumberOfProcessors>8 && info.dwProcessorType) {
|
|
|
|
//// doClear = true;
|
|
|
|
//// }
|
|
|
|
//// }
|
|
|
|
//#elif defined(Q_OS_LINUX)
|
|
|
|
// struct sysinfo si;
|
|
|
|
// sysinfo(&si);
|
|
|
|
// if (si.freeram > (long long int)24*1024*1024*1024) {
|
|
|
|
// shouldShare = false;
|
|
|
|
// }
|
|
|
|
//#endif
|
2022-10-28 12:43:47 +08:00
|
|
|
mClearWhenEditorHidden = boolValue("clear_when_editor_hidden",doClear);
|
2022-10-27 15:18:57 +08:00
|
|
|
mShareParser = boolValue("share_parser",shouldShare);
|
2021-08-30 13:30:42 +08:00
|
|
|
}
|
2021-08-31 19:15:11 +08:00
|
|
|
|
|
|
|
Settings::CodeFormatter::CodeFormatter(Settings *settings):
|
|
|
|
_Base(settings,SETTING_CODE_FORMATTER)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2021-09-01 00:05:46 +08:00
|
|
|
|
2021-09-01 22:40:58 +08:00
|
|
|
QStringList Settings::CodeFormatter::getArguments()
|
|
|
|
{
|
|
|
|
QStringList result;
|
|
|
|
switch(mBraceStyle) {
|
|
|
|
case FormatterBraceStyle::fbsDefault:
|
|
|
|
break;
|
|
|
|
case FormatterBraceStyle::fbsAllman:
|
|
|
|
result.append("--style=allman");
|
|
|
|
break;
|
|
|
|
case FormatterBraceStyle::fbsJava:
|
|
|
|
result.append("--style=java");
|
|
|
|
break;
|
|
|
|
case FormatterBraceStyle::fbsKR:
|
|
|
|
result.append("--style=kr");
|
|
|
|
break;
|
|
|
|
case FormatterBraceStyle::fbsStroustrup:
|
|
|
|
result.append("--style=stroustrup");
|
|
|
|
break;
|
|
|
|
case FormatterBraceStyle::fbsWitesmith:
|
|
|
|
result.append("--style=whitesmith");
|
|
|
|
break;
|
|
|
|
case FormatterBraceStyle::fbsVtk:
|
|
|
|
result.append("--style=vtk");
|
|
|
|
break;
|
|
|
|
case FormatterBraceStyle::fbsRatliff:
|
|
|
|
result.append("--style=ratliff");
|
|
|
|
break;
|
|
|
|
case FormatterBraceStyle::fbsGNU:
|
|
|
|
result.append("--style=gnu");
|
|
|
|
break;
|
|
|
|
case FormatterBraceStyle::fbsLinux:
|
|
|
|
result.append("--style=linux");
|
|
|
|
break;
|
|
|
|
case FormatterBraceStyle::fbsHorstmann:
|
|
|
|
result.append("--style=horstmann");
|
|
|
|
break;
|
|
|
|
case FormatterBraceStyle::fbs1TBS:
|
|
|
|
result.append("--style=1tbs");
|
|
|
|
break;
|
|
|
|
case FormatterBraceStyle::fbsGoogle:
|
|
|
|
result.append("--style=google");
|
|
|
|
break;
|
|
|
|
case FormatterBraceStyle::fbsMozilla:
|
|
|
|
result.append("--style=mozilla");
|
|
|
|
break;
|
|
|
|
case FormatterBraceStyle::fbsWebkit:
|
|
|
|
result.append("--style=webkit");
|
|
|
|
break;
|
|
|
|
case FormatterBraceStyle::fbsPico:
|
|
|
|
result.append("--style=pico");
|
|
|
|
break;
|
|
|
|
case FormatterBraceStyle::fbsLisp:
|
|
|
|
result.append("--style=lisp");
|
|
|
|
break;
|
|
|
|
};
|
|
|
|
switch(mIndentStyle) {
|
|
|
|
case FormatterIndentType::fitTab:
|
|
|
|
result.append(QString("--indent=tab=%1").arg(mTabWidth));
|
|
|
|
break;
|
|
|
|
case FormatterIndentType::fitSpace:
|
|
|
|
result.append(QString("--indent=spaces=%1").arg(mTabWidth));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (mAttachNamespaces)
|
|
|
|
result.append("--attach-namespaces");
|
|
|
|
if (mAttachClasses)
|
|
|
|
result.append("--attach-classes");
|
|
|
|
if (mAttachInlines)
|
|
|
|
result.append("--attach-inlines");
|
|
|
|
if (mAttachExternC)
|
|
|
|
result.append("--attach-extern-c");
|
|
|
|
if (mAttachClosingWhile)
|
|
|
|
result.append("--attach-closing-while");
|
|
|
|
if (mIndentClasses)
|
|
|
|
result.append("--indent-classes");
|
|
|
|
if (mIndentModifiers)
|
|
|
|
result.append("--indent-modifiers");
|
|
|
|
if (mIndentSwitches)
|
|
|
|
result.append("--indent-switches");
|
|
|
|
if (mIndentCases)
|
|
|
|
result.append("--indent-cases");
|
|
|
|
if (mIndentNamespaces)
|
|
|
|
result.append("--indent-namespaces");
|
|
|
|
if (mIndentAfterParens)
|
|
|
|
result.append("--indent-after-parens");
|
|
|
|
if (mIndentContinuation!=1)
|
|
|
|
result.append(QString("--indent-continuation=%1").arg(mIndentContinuation));
|
|
|
|
if (mIndentLabels)
|
|
|
|
result.append("--indent-labels");
|
|
|
|
if (mIndentPreprocBlock)
|
|
|
|
result.append("--indent-preproc-block");
|
|
|
|
if (mIndentPreprocCond)
|
|
|
|
result.append("--indent-preproc-cond");
|
|
|
|
if (mIndentPreprocDefine)
|
|
|
|
result.append("--indent-preproc-define");
|
|
|
|
if (mIndentCol1Comments)
|
|
|
|
result.append("--indent-col1-comments");
|
|
|
|
if (mMinConditionalIndent!=2)
|
|
|
|
result.append(QString("--min-conditional-indent=%1").arg(mMinConditionalIndent));
|
|
|
|
if (mMaxContinuationIndent!=40)
|
|
|
|
result.append(QString("--max-continuation-indent=%1").arg(mMaxContinuationIndent));
|
|
|
|
if (mBreakBlocks)
|
|
|
|
result.append("--break-blocks");
|
|
|
|
if (mBreakBlocksAll)
|
|
|
|
result.append("--break-blocks=all");
|
|
|
|
if (mPadOper)
|
|
|
|
result.append("--pad-oper");
|
|
|
|
if (mPadComma)
|
|
|
|
result.append("--pad-comma");
|
|
|
|
if (mPadParen)
|
|
|
|
result.append("--pad-paren");
|
|
|
|
if (mPadParenOut)
|
|
|
|
result.append("--pad-paren-out");
|
|
|
|
if (mPadFirstParenOut)
|
|
|
|
result.append("--pad-first-paren-out");
|
|
|
|
if (mPadParenIn)
|
|
|
|
result.append("--pad-paren-in");
|
|
|
|
if (mPadHeader)
|
|
|
|
result.append("--pad-header");
|
|
|
|
if (mUnpadParen)
|
|
|
|
result.append("--unpad-paren");
|
|
|
|
if (mDeleteEmptyLines)
|
|
|
|
result.append("--delete-empty-lines");
|
|
|
|
if (mDeleteMultipleEmptyLines)
|
|
|
|
result.append("--delete-multiple-empty-lines");
|
|
|
|
if (mFillEmptyLines)
|
|
|
|
result.append("--fill-empty-lines");
|
|
|
|
switch(mAlignPointerStyle) {
|
|
|
|
case FormatterOperatorAlign::foaNone:
|
|
|
|
break;
|
|
|
|
case FormatterOperatorAlign::foaType:
|
|
|
|
result.append("--align-pointer=type");
|
|
|
|
break;
|
|
|
|
case FormatterOperatorAlign::foaMiddle:
|
|
|
|
result.append("--align-pointer=middle");
|
|
|
|
break;
|
|
|
|
case FormatterOperatorAlign::foaName:
|
|
|
|
result.append("--align-pointer=name");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
switch(mAlignReferenceStyle) {
|
|
|
|
case FormatterOperatorAlign::foaNone:
|
|
|
|
break;
|
|
|
|
case FormatterOperatorAlign::foaType:
|
|
|
|
result.append("--align-reference=type");
|
|
|
|
break;
|
|
|
|
case FormatterOperatorAlign::foaMiddle:
|
|
|
|
result.append("--align-reference=middle");
|
|
|
|
break;
|
|
|
|
case FormatterOperatorAlign::foaName:
|
|
|
|
result.append("--align-reference=name");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mBreakClosingBraces)
|
|
|
|
result.append("--break-closing-braces");
|
|
|
|
if (mBreakElseIf)
|
|
|
|
result.append("--break-elseifs");
|
|
|
|
if (mBreakOneLineHeaders)
|
|
|
|
result.append("--break-one-line-headers");
|
|
|
|
if (mAddBraces)
|
|
|
|
result.append("--add-braces");
|
|
|
|
if (mAddOneLineBraces)
|
|
|
|
result.append("--add-one-line-braces");
|
|
|
|
if (mRemoveBraces)
|
|
|
|
result.append("--remove-braces");
|
|
|
|
if (mBreakReturnType)
|
|
|
|
result.append("--break-return-type");
|
|
|
|
if (mBreakReturnTypeDecl)
|
|
|
|
result.append("--break-return-type-decl");
|
|
|
|
if (mAttachReturnType)
|
|
|
|
result.append("--attach-return-type");
|
|
|
|
if (mAttachReturnTypeDecl)
|
|
|
|
result.append("--attach-return-type-decl");
|
|
|
|
if (mKeepOneLineBlocks)
|
|
|
|
result.append("--keep-one-line-blocks");
|
|
|
|
if (mKeepOneLineStatements)
|
|
|
|
result.append("--keep-one-line-statements");
|
|
|
|
if (mConvertTabs)
|
|
|
|
result.append("--convert-tabs");
|
|
|
|
if (mCloseTemplates)
|
|
|
|
result.append("--close-templates");
|
|
|
|
if (mRemoveCommentPrefix)
|
|
|
|
result.append("--remove-comment-prefix");
|
|
|
|
if (mBreakMaxCodeLength) {
|
|
|
|
result.append(QString("--max-code-length=%1").arg(mMaxCodeLength));
|
|
|
|
if (mBreakAfterLogical)
|
|
|
|
result.append("--break-after-logical");
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2021-09-01 00:05:46 +08:00
|
|
|
int Settings::CodeFormatter::indentStyle() const
|
|
|
|
{
|
|
|
|
return mIndentStyle;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setIndentStyle(int newIndentStyle)
|
|
|
|
{
|
|
|
|
mIndentStyle = newIndentStyle;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::CodeFormatter::tabWidth() const
|
|
|
|
{
|
|
|
|
return mTabWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setTabWidth(int newTabWidth)
|
|
|
|
{
|
|
|
|
mTabWidth = newTabWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::attachNamespaces() const
|
|
|
|
{
|
|
|
|
return mAttachNamespaces;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setAttachNamespaces(bool newAttachNamespaces)
|
|
|
|
{
|
|
|
|
mAttachNamespaces = newAttachNamespaces;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::attachClasses() const
|
|
|
|
{
|
|
|
|
return mAttachClasses;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setAttachClasses(bool newAttachClasses)
|
|
|
|
{
|
|
|
|
mAttachClasses = newAttachClasses;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::attachInlines() const
|
|
|
|
{
|
|
|
|
return mAttachInlines;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setAttachInlines(bool newAttachInlines)
|
|
|
|
{
|
|
|
|
mAttachInlines = newAttachInlines;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::attachExternC() const
|
|
|
|
{
|
|
|
|
return mAttachExternC;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setAttachExternC(bool newAttachExternC)
|
|
|
|
{
|
|
|
|
mAttachExternC = newAttachExternC;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::attachClosingWhile() const
|
|
|
|
{
|
|
|
|
return mAttachClosingWhile;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setAttachClosingWhile(bool newAttachClosingWhile)
|
|
|
|
{
|
|
|
|
mAttachClosingWhile = newAttachClosingWhile;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::indentClasses() const
|
|
|
|
{
|
|
|
|
return mIndentClasses;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setIndentClasses(bool newIndentClasses)
|
|
|
|
{
|
|
|
|
mIndentClasses = newIndentClasses;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::indentModifiers() const
|
|
|
|
{
|
|
|
|
return mIndentModifiers;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setIndentModifiers(bool newIndentModifiers)
|
|
|
|
{
|
|
|
|
mIndentModifiers = newIndentModifiers;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::indentCases() const
|
|
|
|
{
|
|
|
|
return mIndentCases;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setIndentCases(bool newIndentCases)
|
|
|
|
{
|
|
|
|
mIndentCases = newIndentCases;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::indentNamespaces() const
|
|
|
|
{
|
|
|
|
return mIndentNamespaces;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setIndentNamespaces(bool newIndentNamespaces)
|
|
|
|
{
|
|
|
|
mIndentNamespaces = newIndentNamespaces;
|
|
|
|
}
|
|
|
|
|
2021-09-01 15:14:40 +08:00
|
|
|
int Settings::CodeFormatter::indentContinuation() const
|
2021-09-01 00:05:46 +08:00
|
|
|
{
|
|
|
|
return mIndentContinuation;
|
|
|
|
}
|
|
|
|
|
2021-09-01 15:14:40 +08:00
|
|
|
void Settings::CodeFormatter::setIndentContinuation(int newIndentContinuation)
|
2021-09-01 00:05:46 +08:00
|
|
|
{
|
|
|
|
mIndentContinuation = newIndentContinuation;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::indentLabels() const
|
|
|
|
{
|
|
|
|
return mIndentLabels;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setIndentLabels(bool newIndentLabels)
|
|
|
|
{
|
|
|
|
mIndentLabels = newIndentLabels;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::indentPreprocBlock() const
|
|
|
|
{
|
|
|
|
return mIndentPreprocBlock;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setIndentPreprocBlock(bool newIndentPreprocBlock)
|
|
|
|
{
|
|
|
|
mIndentPreprocBlock = newIndentPreprocBlock;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::indentPreprocCond() const
|
|
|
|
{
|
|
|
|
return mIndentPreprocCond;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setIndentPreprocCond(bool newIndentPreprocCond)
|
|
|
|
{
|
|
|
|
mIndentPreprocCond = newIndentPreprocCond;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::indentPreprocDefine() const
|
|
|
|
{
|
|
|
|
return mIndentPreprocDefine;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setIndentPreprocDefine(bool newIndentPreprocDefine)
|
|
|
|
{
|
|
|
|
mIndentPreprocDefine = newIndentPreprocDefine;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::indentCol1Comments() const
|
|
|
|
{
|
|
|
|
return mIndentCol1Comments;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setIndentCol1Comments(bool newIndentCol1Comments)
|
|
|
|
{
|
|
|
|
mIndentCol1Comments = newIndentCol1Comments;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::CodeFormatter::minConditionalIndent() const
|
|
|
|
{
|
|
|
|
return mMinConditionalIndent;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setMinConditionalIndent(int newMinConditionalIndent)
|
|
|
|
{
|
|
|
|
mMinConditionalIndent = newMinConditionalIndent;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::CodeFormatter::maxContinuationIndent() const
|
|
|
|
{
|
|
|
|
return mMaxContinuationIndent;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setMaxContinuationIndent(int newMaxContinuationIndent)
|
|
|
|
{
|
|
|
|
mMaxContinuationIndent = newMaxContinuationIndent;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::breakBlocks() const
|
|
|
|
{
|
|
|
|
return mBreakBlocks;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setBreakBlocks(bool newBreakBlocks)
|
|
|
|
{
|
|
|
|
mBreakBlocks = newBreakBlocks;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::breakBlocksAll() const
|
|
|
|
{
|
|
|
|
return mBreakBlocksAll;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setBreakBlocksAll(bool newBreakBlocksAll)
|
|
|
|
{
|
|
|
|
mBreakBlocksAll = newBreakBlocksAll;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::padOper() const
|
|
|
|
{
|
|
|
|
return mPadOper;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setPadOper(bool newPadOper)
|
|
|
|
{
|
|
|
|
mPadOper = newPadOper;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::padComma() const
|
|
|
|
{
|
|
|
|
return mPadComma;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setPadComma(bool newPadComma)
|
|
|
|
{
|
|
|
|
mPadComma = newPadComma;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::padParen() const
|
|
|
|
{
|
|
|
|
return mPadParen;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setPadParen(bool newPadParen)
|
|
|
|
{
|
|
|
|
mPadParen = newPadParen;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::padParenOut() const
|
|
|
|
{
|
|
|
|
return mPadParenOut;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setPadParenOut(bool newPadParenOut)
|
|
|
|
{
|
|
|
|
mPadParenOut = newPadParenOut;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::padFirstParenOut() const
|
|
|
|
{
|
|
|
|
return mPadFirstParenOut;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setPadFirstParenOut(bool newPadFirstParenOut)
|
|
|
|
{
|
|
|
|
mPadFirstParenOut = newPadFirstParenOut;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::padParenIn() const
|
|
|
|
{
|
|
|
|
return mPadParenIn;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setPadParenIn(bool newPadParenIn)
|
|
|
|
{
|
|
|
|
mPadParenIn = newPadParenIn;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::padHeader() const
|
|
|
|
{
|
|
|
|
return mPadHeader;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setPadHeader(bool newPadHeader)
|
|
|
|
{
|
|
|
|
mPadHeader = newPadHeader;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::unpadParen() const
|
|
|
|
{
|
|
|
|
return mUnpadParen;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setUnpadParen(bool newUnpadParen)
|
|
|
|
{
|
|
|
|
mUnpadParen = newUnpadParen;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::deleteEmptyLines() const
|
|
|
|
{
|
|
|
|
return mDeleteEmptyLines;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setDeleteEmptyLines(bool newDeleteEmptyLines)
|
|
|
|
{
|
|
|
|
mDeleteEmptyLines = newDeleteEmptyLines;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::deleteMultipleEmptyLines() const
|
|
|
|
{
|
|
|
|
return mDeleteMultipleEmptyLines;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setDeleteMultipleEmptyLines(bool newDeleteMultipleEmptyLines)
|
|
|
|
{
|
|
|
|
mDeleteMultipleEmptyLines = newDeleteMultipleEmptyLines;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::fillEmptyLines() const
|
|
|
|
{
|
|
|
|
return mFillEmptyLines;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setFillEmptyLines(bool newFillEmptyLines)
|
|
|
|
{
|
|
|
|
mFillEmptyLines = newFillEmptyLines;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::CodeFormatter::alignPointerStyle() const
|
|
|
|
{
|
|
|
|
return mAlignPointerStyle;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setAlignPointerStyle(int newAlignPointerStyle)
|
|
|
|
{
|
|
|
|
mAlignPointerStyle = newAlignPointerStyle;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::CodeFormatter::alignReferenceStyle() const
|
|
|
|
{
|
|
|
|
return mAlignReferenceStyle;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setAlignReferenceStyle(int newAlignReferenceStyle)
|
|
|
|
{
|
|
|
|
mAlignReferenceStyle = newAlignReferenceStyle;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::breakClosingBraces() const
|
|
|
|
{
|
|
|
|
return mBreakClosingBraces;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setBreakClosingBraces(bool newBreakClosingBraces)
|
|
|
|
{
|
|
|
|
mBreakClosingBraces = newBreakClosingBraces;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::breakElseIf() const
|
|
|
|
{
|
|
|
|
return mBreakElseIf;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setBreakElseIf(bool newBreakElseIf)
|
|
|
|
{
|
|
|
|
mBreakElseIf = newBreakElseIf;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::breakOneLineHeaders() const
|
|
|
|
{
|
|
|
|
return mBreakOneLineHeaders;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setBreakOneLineHeaders(bool newBreakOneLineHeaders)
|
|
|
|
{
|
|
|
|
mBreakOneLineHeaders = newBreakOneLineHeaders;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::addBraces() const
|
|
|
|
{
|
|
|
|
return mAddBraces;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setAddBraces(bool newAddBraces)
|
|
|
|
{
|
|
|
|
mAddBraces = newAddBraces;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::addOneLineBraces() const
|
|
|
|
{
|
|
|
|
return mAddOneLineBraces;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setAddOneLineBraces(bool newAddOneLineBraces)
|
|
|
|
{
|
|
|
|
mAddOneLineBraces = newAddOneLineBraces;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::removeBraces() const
|
|
|
|
{
|
|
|
|
return mRemoveBraces;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setRemoveBraces(bool newRemoveBraces)
|
|
|
|
{
|
|
|
|
mRemoveBraces = newRemoveBraces;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::breakReturnTypeDecl() const
|
|
|
|
{
|
|
|
|
return mBreakReturnTypeDecl;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setBreakReturnTypeDecl(bool newBreakReturnTypeDecl)
|
|
|
|
{
|
|
|
|
mBreakReturnTypeDecl = newBreakReturnTypeDecl;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::attachReturnType() const
|
|
|
|
{
|
|
|
|
return mAttachReturnType;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setAttachReturnType(bool newAttachReturnType)
|
|
|
|
{
|
|
|
|
mAttachReturnType = newAttachReturnType;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::attachReturnTypeDecl() const
|
|
|
|
{
|
|
|
|
return mAttachReturnTypeDecl;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setAttachReturnTypeDecl(bool newAttachReturnTypeDecl)
|
|
|
|
{
|
|
|
|
mAttachReturnTypeDecl = newAttachReturnTypeDecl;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::keepOneLineBlocks() const
|
|
|
|
{
|
|
|
|
return mKeepOneLineBlocks;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setKeepOneLineBlocks(bool newKeepOneLineBlocks)
|
|
|
|
{
|
|
|
|
mKeepOneLineBlocks = newKeepOneLineBlocks;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::keepOneLineStatements() const
|
|
|
|
{
|
|
|
|
return mKeepOneLineStatements;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setKeepOneLineStatements(bool newKeepOneLineStatements)
|
|
|
|
{
|
|
|
|
mKeepOneLineStatements = newKeepOneLineStatements;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::convertTabs() const
|
|
|
|
{
|
|
|
|
return mConvertTabs;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setConvertTabs(bool newConvertTabs)
|
|
|
|
{
|
|
|
|
mConvertTabs = newConvertTabs;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::closeTemplates() const
|
|
|
|
{
|
|
|
|
return mCloseTemplates;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setCloseTemplates(bool newCloseTemplates)
|
|
|
|
{
|
|
|
|
mCloseTemplates = newCloseTemplates;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::removeCommentPrefix() const
|
|
|
|
{
|
|
|
|
return mRemoveCommentPrefix;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setRemoveCommentPrefix(bool newRemoveCommentPrefix)
|
|
|
|
{
|
|
|
|
mRemoveCommentPrefix = newRemoveCommentPrefix;
|
|
|
|
}
|
|
|
|
|
2021-09-01 15:14:40 +08:00
|
|
|
int Settings::CodeFormatter::maxCodeLength() const
|
2021-09-01 00:05:46 +08:00
|
|
|
{
|
2021-09-01 15:14:40 +08:00
|
|
|
return mMaxCodeLength;
|
2021-09-01 00:05:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setMaxCodeLength(int newMaxCodeLength)
|
|
|
|
{
|
2021-09-01 15:14:40 +08:00
|
|
|
mMaxCodeLength = newMaxCodeLength;
|
2021-09-01 00:05:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::breakAfterLogical() const
|
|
|
|
{
|
|
|
|
return mBreakAfterLogical;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setBreakAfterLogical(bool newBreakAfterLogical)
|
|
|
|
{
|
|
|
|
mBreakAfterLogical = newBreakAfterLogical;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::breakReturnType() const
|
|
|
|
{
|
|
|
|
return mBreakReturnType;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setBreakReturnType(bool newBreakReturnType)
|
|
|
|
{
|
|
|
|
mBreakReturnType = newBreakReturnType;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::breakMaxCodeLength() const
|
|
|
|
{
|
|
|
|
return mBreakMaxCodeLength;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setBreakMaxCodeLength(bool newBreakMaxCodeLength)
|
|
|
|
{
|
|
|
|
mBreakMaxCodeLength = newBreakMaxCodeLength;
|
|
|
|
}
|
|
|
|
|
2021-09-01 15:14:40 +08:00
|
|
|
bool Settings::CodeFormatter::indentAfterParens() const
|
|
|
|
{
|
|
|
|
return mIndentAfterParens;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setIndentAfterParens(bool newIndentAfterParens)
|
|
|
|
{
|
|
|
|
mIndentAfterParens = newIndentAfterParens;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::CodeFormatter::indentSwitches() const
|
|
|
|
{
|
|
|
|
return mIndentSwitches;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setIndentSwitches(bool newIndentSwitches)
|
|
|
|
{
|
|
|
|
mIndentSwitches = newIndentSwitches;
|
|
|
|
}
|
|
|
|
|
2021-09-01 00:05:46 +08:00
|
|
|
void Settings::CodeFormatter::doSave()
|
|
|
|
{
|
|
|
|
saveValue("brace_style",mBraceStyle);
|
|
|
|
saveValue("indent_style",mIndentStyle);
|
|
|
|
saveValue("tab_width",mTabWidth);
|
|
|
|
saveValue("attach_namespaces",mAttachNamespaces);
|
|
|
|
saveValue("attach_classes",mAttachClasses);
|
|
|
|
saveValue("attach_inlines",mAttachInlines);
|
|
|
|
saveValue("attach_extern_c",mAttachExternC);
|
|
|
|
saveValue("attach_closing_while",mAttachClosingWhile);
|
|
|
|
saveValue("indent_classes",mIndentClasses);
|
|
|
|
saveValue("indent_modifiers",mIndentModifiers);
|
2021-09-01 15:14:40 +08:00
|
|
|
saveValue("indent_switches",mIndentSwitches);
|
2021-09-01 00:05:46 +08:00
|
|
|
saveValue("indent_cases",mIndentCases);
|
|
|
|
saveValue("indent_namespaces",mIndentNamespaces);
|
2021-09-01 15:14:40 +08:00
|
|
|
saveValue("indent_after_parents",mIndentAfterParens);
|
2021-09-01 00:05:46 +08:00
|
|
|
saveValue("indent_continuation",mIndentContinuation);
|
|
|
|
saveValue("indent_labels",mIndentLabels);
|
|
|
|
saveValue("indent_preproc_block",mIndentPreprocBlock);
|
|
|
|
saveValue("indent_preproc_cond",mIndentPreprocCond);
|
|
|
|
saveValue("indent_preproc_define",mIndentPreprocDefine);
|
|
|
|
saveValue("indent_col1_comments",mIndentCol1Comments);
|
|
|
|
saveValue("min_conditional_indent",mMinConditionalIndent);
|
|
|
|
saveValue("max_continuation_indent",mMaxContinuationIndent);
|
|
|
|
saveValue("break_blocks",mBreakBlocks);
|
|
|
|
saveValue("break_blocks_all",mBreakBlocksAll);
|
|
|
|
saveValue("pad_oper",mPadOper);
|
|
|
|
saveValue("pad_comma",mPadComma);
|
|
|
|
saveValue("pad_paren",mPadParen);
|
|
|
|
saveValue("pad_paren_out",mPadParenOut);
|
|
|
|
saveValue("pad_first_paren_out",mPadFirstParenOut);
|
|
|
|
saveValue("pad_parent_in",mPadParenIn);
|
|
|
|
saveValue("pad_header",mPadHeader);
|
|
|
|
saveValue("unpad_paren",mUnpadParen);
|
|
|
|
saveValue("delete_empty_lines",mDeleteEmptyLines);
|
|
|
|
saveValue("delete_multiple_empty_lines",mDeleteMultipleEmptyLines);
|
|
|
|
saveValue("fill_empty_lines",mFillEmptyLines);
|
|
|
|
saveValue("align_pointer_style",mAlignPointerStyle);
|
|
|
|
saveValue("align_reference_style",mAlignReferenceStyle);
|
|
|
|
saveValue("break_closing_braces",mBreakClosingBraces);
|
|
|
|
saveValue("break_else_if",mBreakElseIf);
|
|
|
|
saveValue("break_one_line_headers",mBreakOneLineHeaders);
|
|
|
|
saveValue("add_braces",mAddBraces);
|
|
|
|
saveValue("add_one_line_braces",mAddOneLineBraces);
|
|
|
|
saveValue("remove_braces",mRemoveBraces);
|
|
|
|
saveValue("break_return_type",mBreakReturnType);
|
|
|
|
saveValue("break_return_type_decl",mBreakReturnTypeDecl);
|
|
|
|
saveValue("attach_return_type",mAttachReturnType);
|
|
|
|
saveValue("attach_return_type_decl",mAttachReturnTypeDecl);
|
|
|
|
saveValue("keep_one_line_blocks",mKeepOneLineBlocks);
|
|
|
|
saveValue("keep_one_line_statements",mKeepOneLineStatements);
|
|
|
|
saveValue("convert_tabs",mConvertTabs);
|
|
|
|
saveValue("close_templates",mCloseTemplates);
|
|
|
|
saveValue("remove_comment_prefix",mRemoveCommentPrefix);
|
|
|
|
saveValue("break_max_code_length",mBreakMaxCodeLength);
|
2021-09-01 15:14:40 +08:00
|
|
|
saveValue("max_code_length",mMaxCodeLength);
|
2021-09-01 00:05:46 +08:00
|
|
|
saveValue("break_after_logical",mBreakAfterLogical);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::doLoad()
|
|
|
|
{
|
2021-10-08 20:01:29 +08:00
|
|
|
mBraceStyle = intValue("brace_style", FormatterBraceStyle::fbsJava);
|
2021-09-01 00:05:46 +08:00
|
|
|
mIndentStyle = intValue("indent_style",FormatterIndentType::fitTab); // 0 isspaces, 1 is tab
|
|
|
|
mTabWidth = intValue("tab_width",4);
|
|
|
|
mAttachNamespaces = boolValue("attach_namespaces",false);
|
|
|
|
mAttachClasses = boolValue("attach_classes",false);
|
|
|
|
mAttachInlines = boolValue("attach_inlines",false);
|
|
|
|
mAttachExternC = boolValue("attach_extern_c",false);
|
|
|
|
mAttachClosingWhile = boolValue("attach_closing_while",false);
|
2021-10-08 20:01:29 +08:00
|
|
|
mIndentClasses = boolValue("indent_classes",true);
|
2021-09-01 00:05:46 +08:00
|
|
|
mIndentModifiers = boolValue("indent_modifiers",false);
|
2021-10-08 20:01:29 +08:00
|
|
|
mIndentSwitches = boolValue("indent_switches",true);
|
2021-09-01 00:05:46 +08:00
|
|
|
mIndentCases = boolValue("indent_cases",false);
|
2021-10-08 20:01:29 +08:00
|
|
|
mIndentNamespaces = boolValue("indent_namespaces",true);
|
2021-09-01 15:14:40 +08:00
|
|
|
mIndentAfterParens = boolValue("indent_after_parents",false);
|
2022-11-11 21:20:57 +08:00
|
|
|
mIndentContinuation = intValue("indent_continuation",1);
|
2021-09-01 00:05:46 +08:00
|
|
|
mIndentLabels = boolValue("indent_labels",false);
|
2021-10-08 20:01:29 +08:00
|
|
|
mIndentPreprocBlock = boolValue("indent_preproc_block",true);
|
2021-09-01 00:05:46 +08:00
|
|
|
mIndentPreprocCond = boolValue("indent_preproc_cond",false);
|
|
|
|
mIndentPreprocDefine = boolValue("indent_preproc_define",false);
|
|
|
|
mIndentCol1Comments = boolValue("indent_col1_comments",false);
|
|
|
|
mMinConditionalIndent = intValue("min_conditional_indent",1);
|
|
|
|
mMaxContinuationIndent = intValue("max_continuation_indent",40);
|
|
|
|
mBreakBlocks = boolValue("break_blocks",false);
|
|
|
|
mBreakBlocksAll = boolValue("break_blocks_all",false);
|
2021-10-08 20:01:29 +08:00
|
|
|
mPadOper = boolValue("pad_oper",true);
|
|
|
|
mPadComma = boolValue("pad_comma",true);
|
2021-09-01 00:05:46 +08:00
|
|
|
mPadParen = boolValue("pad_paren",false);
|
|
|
|
mPadParenOut = boolValue("pad_paren_out",false);
|
|
|
|
mPadFirstParenOut = boolValue("pad_first_paren_out",false);
|
|
|
|
mPadParenIn = boolValue("pad_parent_in",false);
|
2021-10-08 20:01:29 +08:00
|
|
|
mPadHeader = boolValue("pad_header",true);
|
2021-09-01 00:05:46 +08:00
|
|
|
mUnpadParen = boolValue("unpad_paren",false);
|
|
|
|
mDeleteEmptyLines = boolValue("delete_empty_lines",false);
|
|
|
|
mDeleteMultipleEmptyLines = boolValue("delete_multiple_empty_lines",false);
|
|
|
|
mFillEmptyLines = boolValue("fill_empty_lines",false);
|
|
|
|
mAlignPointerStyle = intValue("align_pointer_style", FormatterOperatorAlign::foaNone);
|
|
|
|
mAlignReferenceStyle = intValue("align_reference_style", FormatterOperatorAlign::foaNone);
|
|
|
|
mBreakClosingBraces = boolValue("break_closing_braces",false);
|
|
|
|
mBreakElseIf = boolValue("break_else_if",false);
|
|
|
|
mBreakOneLineHeaders = boolValue("break_one_line_headers",false);
|
|
|
|
mAddBraces = boolValue("add_braces",false);
|
|
|
|
mAddOneLineBraces = boolValue("add_one_line_braces",false);
|
|
|
|
mRemoveBraces = boolValue("remove_braces",false);
|
|
|
|
mBreakReturnType = boolValue("break_return_type",false);
|
|
|
|
mBreakReturnTypeDecl = boolValue("break_return_type_decl",false);
|
|
|
|
mAttachReturnType = boolValue("attach_return_type",false);
|
|
|
|
mAttachReturnTypeDecl = boolValue("attach_return_type_decl",false);
|
|
|
|
mKeepOneLineBlocks = boolValue("keep_one_line_blocks",false);
|
|
|
|
mKeepOneLineStatements = boolValue("keep_one_line_statements",false);
|
|
|
|
mConvertTabs = boolValue("convert_tabs",false);
|
|
|
|
mCloseTemplates = boolValue("close_templates",false);
|
|
|
|
mRemoveCommentPrefix = boolValue("remove_comment_prefix",false);
|
|
|
|
mBreakMaxCodeLength = boolValue("break_max_code_length",false);
|
2021-10-08 20:01:29 +08:00
|
|
|
mMaxCodeLength = intValue("max_code_length",80);
|
2021-09-01 00:05:46 +08:00
|
|
|
mBreakAfterLogical = boolValue("break_after_logical",false);
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::CodeFormatter::braceStyle() const
|
|
|
|
{
|
|
|
|
return mBraceStyle;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::CodeFormatter::setBraceStyle(int newBraceStyle)
|
|
|
|
{
|
|
|
|
mBraceStyle = newBraceStyle;
|
|
|
|
}
|
2021-09-02 16:35:28 +08:00
|
|
|
|
|
|
|
Settings::UI::UI(Settings *settings):_Base(settings,SETTING_UI)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const QByteArray &Settings::UI::mainWindowGeometry() const
|
|
|
|
{
|
|
|
|
return mMainWindowGeometry;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setMainWindowGeometry(const QByteArray &newMainWindowGeometry)
|
|
|
|
{
|
|
|
|
mMainWindowGeometry = newMainWindowGeometry;
|
|
|
|
}
|
|
|
|
|
2021-09-02 16:46:53 +08:00
|
|
|
int Settings::UI::bottomPanelIndex() const
|
|
|
|
{
|
|
|
|
return mBottomPanelIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setBottomPanelIndex(int newBottomPanelIndex)
|
|
|
|
{
|
|
|
|
mBottomPanelIndex = newBottomPanelIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::UI::leftPanelIndex() const
|
|
|
|
{
|
|
|
|
return mLeftPanelIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setLeftPanelIndex(int newLeftPanelIndex)
|
|
|
|
{
|
|
|
|
mLeftPanelIndex = newLeftPanelIndex;
|
|
|
|
}
|
|
|
|
|
2021-09-26 16:25:17 +08:00
|
|
|
bool Settings::UI::classBrowserShowInherited() const
|
|
|
|
{
|
|
|
|
return mClassBrowserShowInherited;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setClassBrowserShowInherited(bool newClassBrowserShowInherited)
|
|
|
|
{
|
|
|
|
mClassBrowserShowInherited = newClassBrowserShowInherited;
|
|
|
|
}
|
|
|
|
|
2021-11-09 12:31:37 +08:00
|
|
|
bool Settings::UI::showProblem() const
|
|
|
|
{
|
|
|
|
return mShowProblem;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setShowProblem(bool newShowProblem)
|
|
|
|
{
|
|
|
|
mShowProblem = newShowProblem;
|
|
|
|
}
|
|
|
|
|
2021-12-23 09:11:58 +08:00
|
|
|
int Settings::UI::settingsDialogSplitterPos() const
|
|
|
|
{
|
|
|
|
return mSettingsDialogSplitterPos;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setSettingsDialogSplitterPos(int newSettingsDialogSplitterPos)
|
|
|
|
{
|
|
|
|
mSettingsDialogSplitterPos = newSettingsDialogSplitterPos;
|
|
|
|
}
|
|
|
|
|
2022-01-08 21:23:20 +08:00
|
|
|
int Settings::UI::newProjectDialogWidth() const
|
|
|
|
{
|
|
|
|
return mNewProjectDialogWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setNewProjectDialogWidth(int newNewProjectDialogWidth)
|
|
|
|
{
|
|
|
|
mNewProjectDialogWidth = newNewProjectDialogWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::UI::newProjectDialogHeight() const
|
|
|
|
{
|
|
|
|
return mNewProjectDialogHeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setNewProjectDialogHeight(int newNewProjectDialogHeight)
|
|
|
|
{
|
|
|
|
mNewProjectDialogHeight = newNewProjectDialogHeight;
|
|
|
|
}
|
|
|
|
|
2022-01-27 18:46:37 +08:00
|
|
|
int Settings::UI::newClassDialogWidth() const
|
|
|
|
{
|
|
|
|
return mNewClassDialogWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setNewClassDialogWidth(int newNewClassDialogWidth)
|
|
|
|
{
|
|
|
|
mNewClassDialogWidth = newNewClassDialogWidth;
|
|
|
|
}
|
|
|
|
|
2022-01-27 20:31:44 +08:00
|
|
|
int Settings::UI::newClassDialogHeight() const
|
|
|
|
{
|
|
|
|
return mNewClassDialogHeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setNewClassDialogHeight(int newNewClassDialogHeight)
|
|
|
|
{
|
|
|
|
mNewClassDialogHeight = newNewClassDialogHeight;
|
|
|
|
}
|
|
|
|
|
2022-02-01 16:17:28 +08:00
|
|
|
int Settings::UI::newHeaderDialogHeight() const
|
|
|
|
{
|
|
|
|
return mNewHeaderDialogHeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setNewHeaderDialogHeight(int newNewFileDialogHeight)
|
|
|
|
{
|
|
|
|
mNewHeaderDialogHeight = newNewFileDialogHeight;
|
|
|
|
}
|
|
|
|
|
2022-05-22 14:31:13 +08:00
|
|
|
const QSize &Settings::UI::messagesTabsSize() const
|
|
|
|
{
|
|
|
|
return mMessagesTabsSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setMessagesTabsSize(const QSize &newMessagesTabsSize)
|
|
|
|
{
|
|
|
|
mMessagesTabsSize = newMessagesTabsSize;
|
|
|
|
}
|
|
|
|
|
2022-10-17 23:23:05 +08:00
|
|
|
int Settings::UI::debugPanelIndex() const
|
|
|
|
{
|
|
|
|
return mDebugPanelIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setDebugPanelIndex(int newDebugPanelIndex)
|
|
|
|
{
|
|
|
|
mDebugPanelIndex = newDebugPanelIndex;
|
|
|
|
}
|
|
|
|
|
2022-10-24 19:23:43 +08:00
|
|
|
int Settings::UI::problemOrder() const
|
|
|
|
{
|
|
|
|
return mProblemOrder;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setProblemOrder(int newProblemOrder)
|
|
|
|
{
|
|
|
|
mProblemOrder = newProblemOrder;
|
|
|
|
}
|
|
|
|
|
2023-01-12 16:53:00 +08:00
|
|
|
bool Settings::UI::openEditorsWhenReplace() const
|
|
|
|
{
|
|
|
|
return mOpenEditorsWhenReplace;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setOpenEditorsWhenReplace(bool newOpenEditorsWhenReplace)
|
|
|
|
{
|
|
|
|
mOpenEditorsWhenReplace = newOpenEditorsWhenReplace;
|
|
|
|
}
|
|
|
|
|
2022-10-24 19:23:43 +08:00
|
|
|
int Settings::UI::bookmarkOrder() const
|
|
|
|
{
|
|
|
|
return mBookmarkOrder;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setBookmarkOrder(int newBookmarkOrder)
|
|
|
|
{
|
|
|
|
mBookmarkOrder = newBookmarkOrder;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::UI::TODOOrder() const
|
|
|
|
{
|
|
|
|
return mTODOOrder;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setTODOOrder(int newTODOOrder)
|
|
|
|
{
|
|
|
|
mTODOOrder = newTODOOrder;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::UI::searchOrder() const
|
|
|
|
{
|
|
|
|
return mSearchOrder;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setSearchOrder(int newSearchOrder)
|
|
|
|
{
|
|
|
|
mSearchOrder = newSearchOrder;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::UI::debugOrder() const
|
|
|
|
{
|
|
|
|
return mDebugOrder;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setDebugOrder(int newDebugOrder)
|
|
|
|
{
|
|
|
|
mDebugOrder = newDebugOrder;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::UI::compileLogOrder() const
|
|
|
|
{
|
|
|
|
return mCompileLogOrder;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setCompileLogOrder(int newCompileLogOrder)
|
|
|
|
{
|
|
|
|
mCompileLogOrder = newCompileLogOrder;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::UI::issuesOrder() const
|
|
|
|
{
|
|
|
|
return mIssuesOrder;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setIssuesOrder(int newIssuesOrder)
|
|
|
|
{
|
|
|
|
mIssuesOrder = newIssuesOrder;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::UI::problemSetOrder() const
|
|
|
|
{
|
|
|
|
return mProblemSetOrder;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setProblemSetOrder(int newProblemSetOrder)
|
|
|
|
{
|
|
|
|
mProblemSetOrder = newProblemSetOrder;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::UI::filesOrder() const
|
|
|
|
{
|
|
|
|
return mFilesOrder;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setFilesOrder(int newFilesOrder)
|
|
|
|
{
|
|
|
|
mFilesOrder = newFilesOrder;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::UI::structureOrder() const
|
|
|
|
{
|
|
|
|
return mStructureOrder;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setStructureOrder(int newStructureOrder)
|
|
|
|
{
|
|
|
|
mStructureOrder = newStructureOrder;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::UI::watchOrder() const
|
|
|
|
{
|
|
|
|
return mWatchOrder;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setWatchOrder(int newWatchOrder)
|
|
|
|
{
|
|
|
|
mWatchOrder = newWatchOrder;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::UI::projectOrder() const
|
|
|
|
{
|
|
|
|
return mProjectOrder;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setProjectOrder(int newProjectOrder)
|
|
|
|
{
|
|
|
|
mProjectOrder = newProjectOrder;
|
|
|
|
}
|
|
|
|
|
2022-05-22 14:31:13 +08:00
|
|
|
const QSize &Settings::UI::explorerTabsSize() const
|
|
|
|
{
|
|
|
|
return mExplorerTabsSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setExplorerTabsSize(const QSize &newExplorerTabsSize)
|
|
|
|
{
|
|
|
|
mExplorerTabsSize = newExplorerTabsSize;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::UI::shrinkMessagesTabs() const
|
|
|
|
{
|
|
|
|
return mShrinkMessagesTabs;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setShrinkMessagesTabs(bool newShrinkMessagesTabs)
|
|
|
|
{
|
|
|
|
mShrinkMessagesTabs = newShrinkMessagesTabs;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::UI::shrinkExplorerTabs() const
|
|
|
|
{
|
|
|
|
return mShrinkExplorerTabs;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setShrinkExplorerTabs(bool newShrinkExplorerTabs)
|
|
|
|
{
|
|
|
|
mShrinkExplorerTabs = newShrinkExplorerTabs;
|
|
|
|
}
|
|
|
|
|
2022-02-01 16:17:28 +08:00
|
|
|
int Settings::UI::newHeaderDialogWidth() const
|
|
|
|
{
|
|
|
|
return mNewHeaderDialogWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setNewHeaderDialogWidth(int newNewFileDialogWidth)
|
|
|
|
{
|
|
|
|
mNewHeaderDialogWidth = newNewFileDialogWidth;
|
|
|
|
}
|
|
|
|
|
2021-12-23 09:11:58 +08:00
|
|
|
int Settings::UI::settingsDialogHeight() const
|
|
|
|
{
|
|
|
|
return mSettingsDialogHeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setSettingsDialogHeight(int newSettingsDialogHeight)
|
|
|
|
{
|
|
|
|
mSettingsDialogHeight = newSettingsDialogHeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::UI::settingsDialogWidth() const
|
|
|
|
{
|
|
|
|
return mSettingsDialogWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setSettingsDialogWidth(int newSettingsDialogWidth)
|
|
|
|
{
|
|
|
|
mSettingsDialogWidth = newSettingsDialogWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::UI::CPUDialogSplitterPos() const
|
|
|
|
{
|
|
|
|
return mCPUDialogSplitterPos;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setCPUDialogSplitterPos(int newCPUDialogSplitterPos)
|
|
|
|
{
|
|
|
|
mCPUDialogSplitterPos = newCPUDialogSplitterPos;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::UI::CPUDialogHeight() const
|
|
|
|
{
|
|
|
|
return mCPUDialogHeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setCPUDialogHeight(int newCPUDialogHeight)
|
|
|
|
{
|
|
|
|
mCPUDialogHeight = newCPUDialogHeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
int Settings::UI::CPUDialogWidth() const
|
|
|
|
{
|
|
|
|
return mCPUDialogWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setCPUDialogWidth(int newCPUDialogWidth)
|
|
|
|
{
|
|
|
|
mCPUDialogWidth = newCPUDialogWidth;
|
|
|
|
}
|
|
|
|
|
2021-11-09 12:31:37 +08:00
|
|
|
bool Settings::UI::showBookmark() const
|
|
|
|
{
|
|
|
|
return mShowBookmark;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setShowBookmark(bool newShowBookmark)
|
|
|
|
{
|
|
|
|
mShowBookmark = newShowBookmark;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::UI::showTODO() const
|
|
|
|
{
|
|
|
|
return mShowTODO;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setShowTODO(bool newShowTODO)
|
|
|
|
{
|
|
|
|
mShowTODO = newShowTODO;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::UI::showSearch() const
|
|
|
|
{
|
|
|
|
return mShowSearch;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setShowSearch(bool newShowSearch)
|
|
|
|
{
|
|
|
|
mShowSearch = newShowSearch;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::UI::showDebug() const
|
|
|
|
{
|
|
|
|
return mShowDebug;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setShowDebug(bool newShowDebug)
|
|
|
|
{
|
|
|
|
mShowDebug = newShowDebug;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::UI::showCompileLog() const
|
|
|
|
{
|
|
|
|
return mShowCompileLog;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setShowCompileLog(bool newShowCompileLog)
|
|
|
|
{
|
|
|
|
mShowCompileLog = newShowCompileLog;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::UI::showIssues() const
|
|
|
|
{
|
|
|
|
return mShowIssues;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setShowIssues(bool newShowIssues)
|
|
|
|
{
|
|
|
|
mShowIssues = newShowIssues;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::UI::showProblemSet() const
|
|
|
|
{
|
|
|
|
return mShowProblemSet;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setShowProblemSet(bool newShowProblemSet)
|
|
|
|
{
|
|
|
|
mShowProblemSet = newShowProblemSet;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::UI::showFiles() const
|
|
|
|
{
|
|
|
|
return mShowFiles;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setShowFiles(bool newShowFiles)
|
|
|
|
{
|
|
|
|
mShowFiles = newShowFiles;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::UI::showStructure() const
|
|
|
|
{
|
|
|
|
return mShowStructure;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setShowStructure(bool newShowStructure)
|
|
|
|
{
|
|
|
|
mShowStructure = newShowStructure;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::UI::showWatch() const
|
|
|
|
{
|
|
|
|
return mShowWatch;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setShowWatch(bool newShowWatch)
|
|
|
|
{
|
|
|
|
mShowWatch = newShowWatch;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::UI::showProject() const
|
|
|
|
{
|
|
|
|
return mShowProject;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setShowProject(bool newShowProject)
|
|
|
|
{
|
|
|
|
mShowProject = newShowProject;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::UI::showToolWindowBars() const
|
|
|
|
{
|
|
|
|
return mShowToolWindowBars;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setShowToolWindowBars(bool newShowToolWindowBars)
|
|
|
|
{
|
|
|
|
mShowToolWindowBars = newShowToolWindowBars;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::UI::showStatusBar() const
|
|
|
|
{
|
|
|
|
return mShowStatusBar;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setShowStatusBar(bool newShowStatusBar)
|
|
|
|
{
|
|
|
|
mShowStatusBar = newShowStatusBar;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::UI::showToolbar() const
|
|
|
|
{
|
|
|
|
return mShowToolbar;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setShowToolbar(bool newShowToolbar)
|
|
|
|
{
|
|
|
|
mShowToolbar = newShowToolbar;
|
|
|
|
}
|
|
|
|
|
2021-09-26 16:25:17 +08:00
|
|
|
bool Settings::UI::classBrowserSortType() const
|
|
|
|
{
|
|
|
|
return mClassBrowserSortType;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setClassBrowserSortType(bool newClassBrowserSortType)
|
|
|
|
{
|
|
|
|
mClassBrowserSortType = newClassBrowserSortType;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::UI::classBrowserSortAlpha() const
|
|
|
|
{
|
|
|
|
return mClassBrowserSortAlpha;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setClassBrowserSortAlpha(bool newClassBrowserSortAlpha)
|
|
|
|
{
|
|
|
|
mClassBrowserSortAlpha = newClassBrowserSortAlpha;
|
|
|
|
}
|
|
|
|
|
2021-09-02 16:35:28 +08:00
|
|
|
const QByteArray &Settings::UI::mainWindowState() const
|
|
|
|
{
|
|
|
|
return mMainWindowState;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::setMainWindowState(const QByteArray &newMainWindowState)
|
|
|
|
{
|
|
|
|
mMainWindowState = newMainWindowState;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::doSave()
|
|
|
|
{
|
2023-01-12 16:53:00 +08:00
|
|
|
saveValue("open_editor_when_batch_replace",mOpenEditorsWhenReplace);
|
|
|
|
|
2021-09-02 16:35:28 +08:00
|
|
|
saveValue("main_window_state",mMainWindowState);
|
|
|
|
saveValue("main_window_geometry",mMainWindowGeometry);
|
2021-09-02 19:36:16 +08:00
|
|
|
saveValue("bottom_panel_index",mBottomPanelIndex);
|
|
|
|
saveValue("left_panel_index",mLeftPanelIndex);
|
2022-10-17 23:23:05 +08:00
|
|
|
saveValue("debug_panel_index",mDebugPanelIndex);
|
2021-09-26 16:25:17 +08:00
|
|
|
saveValue("class_browser_sort_alphabetically",mClassBrowserSortAlpha);
|
|
|
|
saveValue("class_browser_sort_by_type",mClassBrowserSortType);
|
|
|
|
saveValue("class_browser_show_inherited",mClassBrowserShowInherited);
|
2021-11-09 12:31:37 +08:00
|
|
|
|
2022-05-22 14:31:13 +08:00
|
|
|
saveValue("shrink_explorer_tabs",mShrinkExplorerTabs);
|
|
|
|
saveValue("shrink_messages_tabs",mShrinkMessagesTabs);
|
|
|
|
saveValue("explorer_tabs_size", mExplorerTabsSize);
|
|
|
|
saveValue("messages_tabs_size",mMessagesTabsSize);
|
|
|
|
|
2021-11-09 12:31:37 +08:00
|
|
|
//view
|
|
|
|
saveValue("show_toolbar", mShowToolbar);
|
|
|
|
saveValue("show_statusbar", mShowStatusBar);
|
|
|
|
saveValue("show_tool_windowbars", mShowToolWindowBars);
|
|
|
|
|
|
|
|
saveValue("show_project", mShowProject);
|
|
|
|
saveValue("show_watch", mShowWatch);
|
|
|
|
saveValue("show_structure", mShowStructure);
|
|
|
|
saveValue("show_file", mShowFiles);
|
|
|
|
saveValue("show_problem_set", mShowProblemSet);
|
|
|
|
|
|
|
|
saveValue("show_issues", mShowIssues);
|
|
|
|
saveValue("show_compile_log", mShowCompileLog);
|
|
|
|
saveValue("show_debug", mShowDebug);
|
|
|
|
saveValue("show_search", mShowSearch);
|
|
|
|
saveValue("show_todo", mShowTODO);
|
|
|
|
saveValue("show_bookmark", mShowBookmark);
|
|
|
|
saveValue("show_problem", mShowProblem);
|
2021-12-23 09:11:58 +08:00
|
|
|
|
2022-10-24 19:23:43 +08:00
|
|
|
saveValue("project_order", mProjectOrder);
|
|
|
|
saveValue("watch_order", mWatchOrder);
|
|
|
|
saveValue("structure_order", mStructureOrder);
|
|
|
|
saveValue("files_order", mFilesOrder);
|
|
|
|
saveValue("problemset_order", mProblemSetOrder);
|
|
|
|
saveValue("issues_order", mIssuesOrder);
|
|
|
|
saveValue("compilelog_order", mCompileLogOrder);
|
|
|
|
saveValue("debug_order", mDebugOrder);
|
|
|
|
saveValue("search_order", mSearchOrder);
|
|
|
|
saveValue("todo_order", mTODOOrder);
|
|
|
|
saveValue("bookmark_order", mBookmarkOrder);
|
|
|
|
saveValue("problem_order", mProblemOrder);
|
|
|
|
|
2021-12-23 09:11:58 +08:00
|
|
|
//dialogs
|
|
|
|
saveValue("cpu_dialog_width", mCPUDialogWidth);
|
|
|
|
saveValue("cpu_dialog_height", mCPUDialogHeight);
|
|
|
|
saveValue("cpu_dialog_splitter", mCPUDialogSplitterPos);
|
|
|
|
saveValue("settings_dialog_width", mSettingsDialogWidth);
|
|
|
|
saveValue("settings_dialog_height", mSettingsDialogHeight);
|
|
|
|
saveValue("settings_dialog_splitter", mSettingsDialogSplitterPos);
|
2022-01-08 21:23:20 +08:00
|
|
|
saveValue("new_project_dialog_width", mNewProjectDialogWidth);
|
|
|
|
saveValue("new_project_dialog_height", mNewProjectDialogHeight);
|
2022-01-27 18:46:37 +08:00
|
|
|
saveValue("new_class_dialog_width", mNewClassDialogWidth);
|
|
|
|
saveValue("new_class_dialog_height", mNewClassDialogHeight);
|
2022-02-01 16:17:28 +08:00
|
|
|
saveValue("new_header_dialog_width", mNewHeaderDialogWidth);
|
|
|
|
saveValue("new_header_dialog_height", mNewHeaderDialogHeight);
|
2021-09-02 16:35:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::UI::doLoad()
|
|
|
|
{
|
2023-01-12 16:53:00 +08:00
|
|
|
mOpenEditorsWhenReplace=boolValue("open_editor_when_batch_replace",true);
|
|
|
|
|
2021-09-02 16:35:28 +08:00
|
|
|
mMainWindowState = value("main_window_state",QByteArray()).toByteArray();
|
|
|
|
mMainWindowGeometry = value("main_window_geometry",QByteArray()).toByteArray();
|
2021-09-02 19:36:16 +08:00
|
|
|
mBottomPanelIndex = intValue("bottom_panel_index",0);
|
2022-02-24 17:33:19 +08:00
|
|
|
mLeftPanelIndex = intValue("left_panel_index",0);
|
2022-10-17 23:23:05 +08:00
|
|
|
mDebugPanelIndex = intValue("debug_panel_index",0);
|
|
|
|
|
2021-09-26 16:25:17 +08:00
|
|
|
mClassBrowserSortAlpha = boolValue("class_browser_sort_alphabetically",true);
|
|
|
|
mClassBrowserSortType = boolValue("class_browser_sort_by_type",true);
|
|
|
|
mClassBrowserShowInherited = boolValue("class_browser_show_inherited",true);
|
2021-11-09 12:31:37 +08:00
|
|
|
|
2022-05-22 14:31:13 +08:00
|
|
|
mShrinkExplorerTabs = boolValue("shrink_explorer_tabs",false);
|
|
|
|
mShrinkMessagesTabs = boolValue("shrink_messages_tabs",false);
|
|
|
|
mExplorerTabsSize = sizeValue("explorer_tabs_size");
|
|
|
|
mMessagesTabsSize = sizeValue("messages_tabs_size");
|
|
|
|
|
2021-11-09 12:31:37 +08:00
|
|
|
//view
|
|
|
|
mShowToolbar = boolValue("show_toolbar",true);
|
|
|
|
mShowStatusBar = boolValue("show_statusbar",true);
|
|
|
|
mShowToolWindowBars = boolValue("show_tool_windowbars",true);
|
|
|
|
|
|
|
|
mShowProject = boolValue("show_project",true);
|
|
|
|
mShowWatch = boolValue("show_watch",true);
|
|
|
|
mShowStructure = boolValue("show_structure",true);
|
|
|
|
mShowFiles = boolValue("show_file",true);
|
|
|
|
mShowProblemSet = boolValue("show_problem_set",true);
|
|
|
|
|
|
|
|
mShowIssues = boolValue("show_issues",true);
|
|
|
|
mShowCompileLog = boolValue("show_compile_log",true);
|
|
|
|
mShowDebug = boolValue("show_debug",true);
|
|
|
|
mShowSearch = boolValue("show_search",true);
|
|
|
|
mShowTODO = boolValue("show_todo",true);
|
|
|
|
mShowBookmark = boolValue("show_bookmark",true);
|
|
|
|
mShowProblem = boolValue("show_problem",true);
|
2021-12-23 09:11:58 +08:00
|
|
|
|
2022-10-24 19:23:43 +08:00
|
|
|
mProjectOrder = intValue("project_order",1);
|
|
|
|
mWatchOrder = intValue("watch_order",2);
|
|
|
|
mStructureOrder = intValue("structure_order",3);
|
|
|
|
mFilesOrder = intValue("files_order",0);
|
|
|
|
mProblemSetOrder = intValue("problemset_order",4);
|
|
|
|
|
|
|
|
mIssuesOrder = intValue("issues_order",0);
|
|
|
|
mCompileLogOrder = intValue("compilelog_order",1);
|
|
|
|
mDebugOrder = intValue("debug_order",2);
|
|
|
|
mSearchOrder = intValue("search_order",3);
|
|
|
|
mTODOOrder = intValue("todo_order",4);
|
|
|
|
mBookmarkOrder = intValue("bookmark_order",5);
|
|
|
|
mProblemOrder = intValue("problem_order",6);
|
|
|
|
|
2021-12-23 09:11:58 +08:00
|
|
|
//dialogs
|
2022-01-08 21:23:20 +08:00
|
|
|
mCPUDialogWidth = intValue("cpu_dialog_width",977*qApp->desktop()->width()/1920);
|
|
|
|
mCPUDialogHeight = intValue("cpu_dialog_height",622*qApp->desktop()->height()/1080);
|
2021-12-23 09:11:58 +08:00
|
|
|
mCPUDialogSplitterPos = intValue("cpu_dialog_splitter",500*qApp->desktop()->width()/1920);
|
2022-01-08 21:23:20 +08:00
|
|
|
mSettingsDialogWidth = intValue("settings_dialog_width",977*qApp->desktop()->width()/1920);
|
|
|
|
mSettingsDialogHeight = intValue("settings_dialog_height",622*qApp->desktop()->height()/1080);
|
2021-12-23 09:11:58 +08:00
|
|
|
mSettingsDialogSplitterPos = intValue("settings_dialog_splitter",300*qApp->desktop()->width()/1920);
|
2022-01-08 21:23:20 +08:00
|
|
|
|
|
|
|
mNewProjectDialogWidth = intValue("new_project_dialog_width", 900*qApp->desktop()->width()/1920);
|
|
|
|
mNewProjectDialogHeight = intValue("new_project_dialog_height", 600*qApp->desktop()->height()/1080);
|
2022-01-27 18:46:37 +08:00
|
|
|
mNewClassDialogWidth = intValue("new_class_dialog_width", 642*qApp->desktop()->width()/1920);
|
|
|
|
mNewClassDialogHeight = intValue("new_class_dialog_height", 300*qApp->desktop()->height()/1080);
|
2022-02-01 16:17:28 +08:00
|
|
|
mNewHeaderDialogWidth = intValue("new_header_dialog_width", 642*qApp->desktop()->width()/1920);
|
|
|
|
mNewHeaderDialogHeight = intValue("new_header_dialog_height", 300*qApp->desktop()->height()/1080);
|
2021-09-02 16:35:28 +08:00
|
|
|
}
|
2022-02-08 23:38:29 +08:00
|
|
|
|
2022-02-15 00:01:50 +08:00
|
|
|
Settings::VCS::VCS(Settings *settings):_Base(settings,SETTING_VCS),
|
|
|
|
mGitOk(false)
|
2022-02-08 23:38:29 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::VCS::doSave()
|
|
|
|
{
|
|
|
|
saveValue("git_path",mGitPath);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::VCS::doLoad()
|
|
|
|
{
|
2022-02-15 00:01:50 +08:00
|
|
|
setGitPath(stringValue("git_path", ""));
|
2022-02-08 23:38:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const QString &Settings::VCS::gitPath() const
|
|
|
|
{
|
|
|
|
return mGitPath;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::VCS::setGitPath(const QString &newGitPath)
|
|
|
|
{
|
2022-02-15 00:01:50 +08:00
|
|
|
if (mGitPath!=newGitPath) {
|
|
|
|
mGitPath = newGitPath;
|
|
|
|
validateGit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::VCS::validateGit()
|
|
|
|
{
|
|
|
|
mGitOk = false;
|
|
|
|
QFileInfo fileInfo(mGitPath);
|
|
|
|
if (!fileInfo.exists()) {
|
|
|
|
return;
|
|
|
|
}
|
2022-03-27 16:07:51 +08:00
|
|
|
mGitOk=true;
|
|
|
|
// QStringList args;
|
|
|
|
// args.append("--version");
|
|
|
|
// QString output = runAndGetOutput(
|
|
|
|
// fileInfo.fileName(),
|
|
|
|
// fileInfo.absolutePath(),
|
|
|
|
// args);
|
|
|
|
// mGitOk = output.startsWith("git version");
|
2022-02-15 00:01:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool Settings::VCS::gitOk() const
|
|
|
|
{
|
|
|
|
return mGitOk;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::VCS::detectGitInPath()
|
|
|
|
{
|
|
|
|
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
|
|
|
|
QString path = env.value("PATH");
|
|
|
|
QStringList pathList = path.split(PATH_SEPARATOR);
|
|
|
|
QSet<QString> searched;
|
|
|
|
foreach (const QString& s, pathList){
|
|
|
|
if (searched.contains(s))
|
|
|
|
continue;;
|
|
|
|
searched.insert(s);
|
|
|
|
QDir dir(s);
|
|
|
|
if (dir.exists(GIT_PROGRAM)) {
|
|
|
|
QString oldPath = mGitPath;
|
|
|
|
setGitPath(dir.filePath(GIT_PROGRAM));
|
2022-03-27 16:07:51 +08:00
|
|
|
validateGit();
|
2022-02-15 00:01:50 +08:00
|
|
|
if (mGitOk) {
|
2022-02-15 22:26:24 +08:00
|
|
|
save();
|
2022-02-15 00:01:50 +08:00
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
mGitPath = oldPath;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2022-02-08 23:38:29 +08:00
|
|
|
}
|
2023-02-16 22:27:04 +08:00
|
|
|
|
|
|
|
const QString &Settings::ExtTools::xMakePath() const
|
|
|
|
{
|
|
|
|
return mXMakePath;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::ExtTools::setXMakePath(const QString &newXMakePath)
|
|
|
|
{
|
|
|
|
mXMakePath = newXMakePath;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::ExtTools::doSave()
|
|
|
|
{
|
|
|
|
saveValue("xmake_path", mXMakePath);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Settings::ExtTools::doLoad()
|
|
|
|
{
|
|
|
|
mXMakePath=stringValue("xmake_path","");
|
|
|
|
}
|
|
|
|
|
|
|
|
Settings::ExtTools::ExtTools(Settings *settings):_Base(settings, SETTING_EXTTOOLS)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|