- change: Don't turn on "Show some more warnings (-Wextra)" option by default for DEBUG compiler set
- fix: Changes mainwindows's compiler set combobox not correctly handled for project - change: Don't localize autogenerated name for new files and new project (new msys2 gcc compiler can't correctly handle non-ascii chars in filenames)
This commit is contained in:
parent
819d217708
commit
01c1e96aeb
2
NEWS.md
2
NEWS.md
|
@ -12,6 +12,8 @@ Red Panda C++ Version 2.1
|
||||||
- change: escape spaces in the executabe path under linux.
|
- change: escape spaces in the executabe path under linux.
|
||||||
- fix: Before run a project's executable, we should check timestamp for project files AND modification states of files openned in editor.
|
- fix: Before run a project's executable, we should check timestamp for project files AND modification states of files openned in editor.
|
||||||
- change: Don't turn on "Show some more warnings (-Wextra)" option by default for DEBUG compiler set
|
- change: Don't turn on "Show some more warnings (-Wextra)" option by default for DEBUG compiler set
|
||||||
|
- fix: Changes mainwindows's compiler set combobox not correctly handled for project
|
||||||
|
- change: Don't localize autogenerated name for new files and new project (new msys2 gcc compiler can't correctly handle non-ascii chars in filenames)
|
||||||
|
|
||||||
Red Panda C++ Version 2.0
|
Red Panda C++ Version 2.0
|
||||||
|
|
||||||
|
|
|
@ -341,7 +341,7 @@ QString Compiler::getCharsetArgument(const QByteArray& encoding,FileType fileTyp
|
||||||
|
|
||||||
}
|
}
|
||||||
if ((forceExecUTF8 || compilerSet()->autoAddCharsetParams()) && encoding != ENCODING_ASCII
|
if ((forceExecUTF8 || compilerSet()->autoAddCharsetParams()) && encoding != ENCODING_ASCII
|
||||||
&& compilerSet()->compilerType()!=COMPILER_CLANG) {
|
&& compilerSet()->compilerType()!=CompilerType::Clang) {
|
||||||
QString encodingName;
|
QString encodingName;
|
||||||
QString execEncodingName;
|
QString execEncodingName;
|
||||||
QString compilerSetExecCharset = compilerSet()->execCharset();
|
QString compilerSetExecCharset = compilerSet()->execCharset();
|
||||||
|
@ -674,13 +674,13 @@ void Compiler::runCommand(const QString &cmd, const QString &arguments, const Q
|
||||||
errorOccurred= true;
|
errorOccurred= true;
|
||||||
});
|
});
|
||||||
process.connect(&process, &QProcess::readyReadStandardError,[&process,this](){
|
process.connect(&process, &QProcess::readyReadStandardError,[&process,this](){
|
||||||
if (compilerSet()->compilerType() == COMPILER_CLANG)
|
if (compilerSet()->compilerType() == CompilerType::Clang)
|
||||||
this->error(QString::fromUtf8(process.readAllStandardError()));
|
this->error(QString::fromUtf8(process.readAllStandardError()));
|
||||||
else
|
else
|
||||||
this->error(QString::fromLocal8Bit( process.readAllStandardError()));
|
this->error(QString::fromLocal8Bit( process.readAllStandardError()));
|
||||||
});
|
});
|
||||||
process.connect(&process, &QProcess::readyReadStandardOutput,[&process,this](){
|
process.connect(&process, &QProcess::readyReadStandardOutput,[&process,this](){
|
||||||
if (compilerSet()->compilerType() == COMPILER_CLANG)
|
if (compilerSet()->compilerType() == CompilerType::Clang)
|
||||||
this->log(QString::fromUtf8(process.readAllStandardOutput()));
|
this->log(QString::fromUtf8(process.readAllStandardOutput()));
|
||||||
else
|
else
|
||||||
this->log(QString::fromLocal8Bit( process.readAllStandardOutput()));
|
this->log(QString::fromLocal8Bit( process.readAllStandardOutput()));
|
||||||
|
|
|
@ -180,16 +180,17 @@ void CompilerInfo::prepareCompilerOptions()
|
||||||
|
|
||||||
CompilerInfoManager::CompilerInfoManager()
|
CompilerInfoManager::CompilerInfoManager()
|
||||||
{
|
{
|
||||||
mInfos.insert(COMPILER_CLANG, std::make_shared<ClangCompilerInfo>());
|
mInfos.insert(CompilerType::Clang, std::make_shared<ClangCompilerInfo>());
|
||||||
mInfos.insert(COMPILER_GCC, std::make_shared<GCCCompilerInfo>());
|
mInfos.insert(CompilerType::GCC, std::make_shared<GCCCompilerInfo>());
|
||||||
|
mInfos.insert(CompilerType::GCC_UTF8, std::make_shared<GCCUTF8CompilerInfo>());
|
||||||
}
|
}
|
||||||
|
|
||||||
PCompilerInfo CompilerInfoManager::getInfo(const QString &compilerType)
|
PCompilerInfo CompilerInfoManager::getInfo(CompilerType compilerType)
|
||||||
{
|
{
|
||||||
return getInstance()->mInfos.value(compilerType,PCompilerInfo());
|
return getInstance()->mInfos.value(compilerType,PCompilerInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CompilerInfoManager::hasCompilerOption(const QString &compilerType, const QString &optKey)
|
bool CompilerInfoManager::hasCompilerOption(CompilerType compilerType, const QString &optKey)
|
||||||
{
|
{
|
||||||
PCompilerInfo pInfo = getInfo(compilerType);
|
PCompilerInfo pInfo = getInfo(compilerType);
|
||||||
if (!pInfo)
|
if (!pInfo)
|
||||||
|
@ -197,7 +198,7 @@ bool CompilerInfoManager::hasCompilerOption(const QString &compilerType, const Q
|
||||||
return pInfo->hasCompilerOption(optKey);
|
return pInfo->hasCompilerOption(optKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
PCompilerOption CompilerInfoManager::getCompilerOption(const QString &compilerType, const QString &optKey)
|
PCompilerOption CompilerInfoManager::getCompilerOption(CompilerType compilerType, const QString &optKey)
|
||||||
{
|
{
|
||||||
PCompilerInfo pInfo = getInfo(compilerType);
|
PCompilerInfo pInfo = getInfo(compilerType);
|
||||||
if (!pInfo)
|
if (!pInfo)
|
||||||
|
@ -205,7 +206,7 @@ PCompilerOption CompilerInfoManager::getCompilerOption(const QString &compilerTy
|
||||||
return pInfo->getCompilerOption(optKey);
|
return pInfo->getCompilerOption(optKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<PCompilerOption> CompilerInfoManager::getCompilerOptions(const QString &compilerType)
|
QList<PCompilerOption> CompilerInfoManager::getCompilerOptions(CompilerType compilerType)
|
||||||
{
|
{
|
||||||
PCompilerInfo pInfo = getInfo(compilerType);
|
PCompilerInfo pInfo = getInfo(compilerType);
|
||||||
if (!pInfo)
|
if (!pInfo)
|
||||||
|
@ -213,7 +214,7 @@ QList<PCompilerOption> CompilerInfoManager::getCompilerOptions(const QString &co
|
||||||
return pInfo->compilerOptions();
|
return pInfo->compilerOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CompilerInfoManager::supportCovertingCharset(const QString &compilerType)
|
bool CompilerInfoManager::supportCovertingCharset(CompilerType compilerType)
|
||||||
{
|
{
|
||||||
PCompilerInfo pInfo = getInfo(compilerType);
|
PCompilerInfo pInfo = getInfo(compilerType);
|
||||||
if (!pInfo)
|
if (!pInfo)
|
||||||
|
@ -221,7 +222,7 @@ bool CompilerInfoManager::supportCovertingCharset(const QString &compilerType)
|
||||||
return pInfo->supportConvertingCharset();
|
return pInfo->supportConvertingCharset();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CompilerInfoManager::forceUTF8InDebugger(const QString &compilerType)
|
bool CompilerInfoManager::forceUTF8InDebugger(CompilerType compilerType)
|
||||||
{
|
{
|
||||||
PCompilerInfo pInfo = getInfo(compilerType);
|
PCompilerInfo pInfo = getInfo(compilerType);
|
||||||
if (!pInfo)
|
if (!pInfo)
|
||||||
|
@ -239,9 +240,9 @@ PCompilerInfoManager CompilerInfoManager::getInstance()
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompilerInfoManager::addInfo(const QString &name, PCompilerInfo info)
|
void CompilerInfoManager::addInfo(CompilerType compilerType, PCompilerInfo info)
|
||||||
{
|
{
|
||||||
getInstance()->mInfos.insert(name,info);
|
getInstance()->mInfos.insert(compilerType,info);
|
||||||
}
|
}
|
||||||
|
|
||||||
ClangCompilerInfo::ClangCompilerInfo():CompilerInfo(COMPILER_CLANG)
|
ClangCompilerInfo::ClangCompilerInfo():CompilerInfo(COMPILER_CLANG)
|
||||||
|
@ -258,6 +259,11 @@ bool ClangCompilerInfo::forceUTF8InDebugger()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ClangCompilerInfo::forceUTF8InMakefile()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
GCCCompilerInfo::GCCCompilerInfo():CompilerInfo(COMPILER_GCC)
|
GCCCompilerInfo::GCCCompilerInfo():CompilerInfo(COMPILER_GCC)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -272,6 +278,11 @@ bool GCCCompilerInfo::forceUTF8InDebugger()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GCCCompilerInfo::forceUTF8InMakefile()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
GCCUTF8CompilerInfo::GCCUTF8CompilerInfo():CompilerInfo(COMPILER_GCC_UTF8)
|
GCCUTF8CompilerInfo::GCCUTF8CompilerInfo():CompilerInfo(COMPILER_GCC_UTF8)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -285,3 +296,8 @@ bool GCCUTF8CompilerInfo::forceUTF8InDebugger()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GCCUTF8CompilerInfo::forceUTF8InMakefile()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
|
@ -45,6 +45,18 @@
|
||||||
|
|
||||||
#define COMPILER_OPTION_ON "on"
|
#define COMPILER_OPTION_ON "on"
|
||||||
|
|
||||||
|
enum class CompilerSetType {
|
||||||
|
RELEASE,
|
||||||
|
DEBUG,
|
||||||
|
PROFILING
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class CompilerType {
|
||||||
|
GCC,
|
||||||
|
GCC_UTF8,
|
||||||
|
Clang
|
||||||
|
};
|
||||||
|
|
||||||
using CompileOptionChoiceList = QList<QPair<QString,QString>>;
|
using CompileOptionChoiceList = QList<QPair<QString,QString>>;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -73,6 +85,7 @@ public:
|
||||||
|
|
||||||
virtual bool supportConvertingCharset()=0;
|
virtual bool supportConvertingCharset()=0;
|
||||||
virtual bool forceUTF8InDebugger()=0;
|
virtual bool forceUTF8InDebugger()=0;
|
||||||
|
virtual bool forceUTF8InMakefile()=0;
|
||||||
protected:
|
protected:
|
||||||
void addOption(const QString& key,
|
void addOption(const QString& key,
|
||||||
const QString& name,
|
const QString& name,
|
||||||
|
@ -98,17 +111,17 @@ using PCompilerInfoManager = std::shared_ptr<CompilerInfoManager>;
|
||||||
class CompilerInfoManager {
|
class CompilerInfoManager {
|
||||||
public:
|
public:
|
||||||
CompilerInfoManager();
|
CompilerInfoManager();
|
||||||
static PCompilerInfo getInfo(const QString& compilerType);
|
static PCompilerInfo getInfo(CompilerType compilerType);
|
||||||
static bool hasCompilerOption(const QString& compilerType, const QString& optKey);
|
static bool hasCompilerOption(CompilerType compilerType, const QString& optKey);
|
||||||
static PCompilerOption getCompilerOption(const QString& compilerType, const QString& optKey);
|
static PCompilerOption getCompilerOption(CompilerType compilerType, const QString& optKey);
|
||||||
static QList<PCompilerOption> getCompilerOptions(const QString& compilerType);
|
static QList<PCompilerOption> getCompilerOptions(CompilerType compilerType);
|
||||||
static bool supportCovertingCharset(const QString& compilerType);
|
static bool supportCovertingCharset(CompilerType compilerType);
|
||||||
static bool forceUTF8InDebugger(const QString& compilerType);
|
static bool forceUTF8InDebugger(CompilerType compilerType);
|
||||||
static PCompilerInfoManager getInstance();
|
static PCompilerInfoManager getInstance();
|
||||||
static void addInfo(const QString& name, PCompilerInfo info);
|
static void addInfo(CompilerType compilerType, PCompilerInfo info);
|
||||||
private:
|
private:
|
||||||
static PCompilerInfoManager instance;
|
static PCompilerInfoManager instance;
|
||||||
QMap<QString,PCompilerInfo> mInfos;
|
QMap<CompilerType,PCompilerInfo> mInfos;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ClangCompilerInfo: public CompilerInfo{
|
class ClangCompilerInfo: public CompilerInfo{
|
||||||
|
@ -116,6 +129,7 @@ public:
|
||||||
ClangCompilerInfo();
|
ClangCompilerInfo();
|
||||||
bool supportConvertingCharset() override;
|
bool supportConvertingCharset() override;
|
||||||
bool forceUTF8InDebugger() override;
|
bool forceUTF8InDebugger() override;
|
||||||
|
bool forceUTF8InMakefile() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GCCCompilerInfo: public CompilerInfo{
|
class GCCCompilerInfo: public CompilerInfo{
|
||||||
|
@ -123,6 +137,7 @@ public:
|
||||||
GCCCompilerInfo();
|
GCCCompilerInfo();
|
||||||
bool supportConvertingCharset() override;
|
bool supportConvertingCharset() override;
|
||||||
bool forceUTF8InDebugger() override;
|
bool forceUTF8InDebugger() override;
|
||||||
|
bool forceUTF8InMakefile() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GCCUTF8CompilerInfo: public CompilerInfo{
|
class GCCUTF8CompilerInfo: public CompilerInfo{
|
||||||
|
@ -130,6 +145,7 @@ public:
|
||||||
GCCUTF8CompilerInfo();
|
GCCUTF8CompilerInfo();
|
||||||
bool supportConvertingCharset() override;
|
bool supportConvertingCharset() override;
|
||||||
bool forceUTF8InDebugger() override;
|
bool forceUTF8InDebugger() override;
|
||||||
|
bool forceUTF8InMakefile() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -384,7 +384,7 @@ void ProjectCompiler::writeMakeObjFilesRules(QFile &file)
|
||||||
// Or roll our own
|
// Or roll our own
|
||||||
} else {
|
} else {
|
||||||
QString encodingStr;
|
QString encodingStr;
|
||||||
if (compilerSet()->compilerType() != COMPILER_CLANG && mProject->options().addCharset) {
|
if (compilerSet()->compilerType() != CompilerType::Clang && mProject->options().addCharset) {
|
||||||
QByteArray defaultSystemEncoding=pCharsetInfoManager->getDefaultSystemEncoding();
|
QByteArray defaultSystemEncoding=pCharsetInfoManager->getDefaultSystemEncoding();
|
||||||
QByteArray encoding = mProject->options().execEncoding;
|
QByteArray encoding = mProject->options().execEncoding;
|
||||||
QByteArray targetEncoding;
|
QByteArray targetEncoding;
|
||||||
|
|
|
@ -72,7 +72,7 @@ const char* SaveException::what() const noexcept {
|
||||||
QHash<ParserLanguage,std::weak_ptr<CppParser>> Editor::mSharedParsers;
|
QHash<ParserLanguage,std::weak_ptr<CppParser>> Editor::mSharedParsers;
|
||||||
|
|
||||||
Editor::Editor(QWidget *parent):
|
Editor::Editor(QWidget *parent):
|
||||||
Editor(parent,QObject::tr("untitled"),ENCODING_AUTO_DETECT,nullptr,true,nullptr)
|
Editor(parent,"untitled",ENCODING_AUTO_DETECT,nullptr,true,nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ Editor::Editor(QWidget *parent, const QString& filename,
|
||||||
mCurrentLineModified = false;
|
mCurrentLineModified = false;
|
||||||
mUseCppSyntax = pSettings->editor().defaultFileCpp();
|
mUseCppSyntax = pSettings->editor().defaultFileCpp();
|
||||||
if (mFilename.isEmpty()) {
|
if (mFilename.isEmpty()) {
|
||||||
mFilename = tr("untitled")+QString("%1").arg(getNewFileNumber());
|
mFilename = QString("untitled%1").arg(getNewFileNumber());
|
||||||
}
|
}
|
||||||
QFileInfo fileInfo(mFilename);
|
QFileInfo fileInfo(mFilename);
|
||||||
QSynedit::PHighlighter highlighter;
|
QSynedit::PHighlighter highlighter;
|
||||||
|
|
|
@ -3916,11 +3916,11 @@ void MainWindow::onFilesViewCreateFile()
|
||||||
suffix=".cpp";
|
suffix=".cpp";
|
||||||
else
|
else
|
||||||
suffix=".c";
|
suffix=".c";
|
||||||
QString fileName = tr("untitled")+suffix;
|
QString fileName = QString("untitled")+suffix;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while (dir.exists(fileName)) {
|
while (dir.exists(fileName)) {
|
||||||
count++;
|
count++;
|
||||||
fileName = tr("untitled%1").arg(count)+suffix;
|
fileName = QString("untitled%1").arg(count)+suffix;
|
||||||
}
|
}
|
||||||
QFile file(dir.filePath(fileName));
|
QFile file(dir.filePath(fileName));
|
||||||
file.open(QFile::NewOnly);
|
file.open(QFile::NewOnly);
|
||||||
|
@ -5044,7 +5044,7 @@ void MainWindow::onCompilerSetChanged(int index)
|
||||||
mCompilerSet->setCurrentIndex(mProject->options().compilerSet);
|
mCompilerSet->setCurrentIndex(mProject->options().compilerSet);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mProject->setCompilerSet(mProject->options().compilerSet);
|
mProject->setCompilerSet(index);
|
||||||
mProject->saveOptions();
|
mProject->saveOptions();
|
||||||
scanActiveProject(true);
|
scanActiveProject(true);
|
||||||
return;
|
return;
|
||||||
|
@ -6669,7 +6669,7 @@ void MainWindow::newProjectUnitFile()
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
do {
|
do {
|
||||||
newFileName = tr("untitled")+QString("%1").arg(getNewFileNumber());
|
newFileName = QString("untitled")+QString("%1").arg(getNewFileNumber());
|
||||||
if (mProject->options().isCpp)
|
if (mProject->options().isCpp)
|
||||||
newFileName += ".cpp";
|
newFileName += ".cpp";
|
||||||
else
|
else
|
||||||
|
|
|
@ -343,7 +343,7 @@ PProjectUnit Project::newUnit(PProjectModelNode parentNode, const QString& custo
|
||||||
// Find unused 'new' filename
|
// Find unused 'new' filename
|
||||||
if (customFileName.isEmpty()) {
|
if (customFileName.isEmpty()) {
|
||||||
do {
|
do {
|
||||||
s = cleanPath(dir.absoluteFilePath(tr("untitled")+QString("%1").arg(getNewFileNumber())));
|
s = cleanPath(dir.absoluteFilePath(QString("untitled%1").arg(getNewFileNumber())));
|
||||||
} while (fileExists(s));
|
} while (fileExists(s));
|
||||||
} else {
|
} else {
|
||||||
s = cleanPath(dir.absoluteFilePath(customFileName));
|
s = cleanPath(dir.absoluteFilePath(customFileName));
|
||||||
|
@ -1123,7 +1123,7 @@ void Project::saveOptions()
|
||||||
ini.SetLongValue("Project","IncludeVersionInfo", mOptions.includeVersionInfo);
|
ini.SetLongValue("Project","IncludeVersionInfo", mOptions.includeVersionInfo);
|
||||||
ini.SetLongValue("Project","SupportXPThemes", mOptions.supportXPThemes);
|
ini.SetLongValue("Project","SupportXPThemes", mOptions.supportXPThemes);
|
||||||
ini.SetLongValue("Project","CompilerSet", mOptions.compilerSet);
|
ini.SetLongValue("Project","CompilerSet", mOptions.compilerSet);
|
||||||
ini.SetLongValue("Project","CompilerSetType", mOptions.compilerSetType);
|
ini.SetLongValue("Project","CompilerSetType", (int)mOptions.compilerSetType);
|
||||||
ini.Delete("Project","CompilerSettings"); // remove old compiler settings
|
ini.Delete("Project","CompilerSettings"); // remove old compiler settings
|
||||||
ini.Delete("CompilerSettings",nullptr); // remove old compiler settings
|
ini.Delete("CompilerSettings",nullptr); // remove old compiler settings
|
||||||
foreach (const QString& key, mOptions.compilerOptions.keys()) {
|
foreach (const QString& key, mOptions.compilerOptions.keys()) {
|
||||||
|
@ -2043,8 +2043,11 @@ void Project::loadOptions(SimpleIni& ini)
|
||||||
mOptions.execEncoding = ini.GetValue("Project","ExecEncoding", ENCODING_SYSTEM_DEFAULT);
|
mOptions.execEncoding = ini.GetValue("Project","ExecEncoding", ENCODING_SYSTEM_DEFAULT);
|
||||||
mOptions.addCharset = ini.GetBoolValue("Project", "AddCharset", true);
|
mOptions.addCharset = ini.GetBoolValue("Project", "AddCharset", true);
|
||||||
|
|
||||||
if (mOptions.compilerSetType<0) {
|
int val=ini.GetLongValue("Project","CompilerSetType",-1);
|
||||||
|
if (val<0) {
|
||||||
updateCompilerSetType();
|
updateCompilerSetType();
|
||||||
|
} else {
|
||||||
|
mOptions.compilerSetType=(CompilerSetType)val;
|
||||||
}
|
}
|
||||||
bool useUTF8 = ini.GetBoolValue("Project", "UseUTF8", false);
|
bool useUTF8 = ini.GetBoolValue("Project", "UseUTF8", false);
|
||||||
if (useUTF8) {
|
if (useUTF8) {
|
||||||
|
@ -2179,7 +2182,7 @@ void Project::updateCompilerSetType()
|
||||||
mOptions.staticLink = defaultSet->staticLink();
|
mOptions.staticLink = defaultSet->staticLink();
|
||||||
mOptions.compilerOptions = defaultSet->compileOptions();
|
mOptions.compilerOptions = defaultSet->compileOptions();
|
||||||
} else {
|
} else {
|
||||||
mOptions.compilerSetType=CST_DEBUG;
|
mOptions.compilerSetType=CompilerSetType::DEBUG;
|
||||||
mOptions.staticLink = false;
|
mOptions.staticLink = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ ProjectOptions::ProjectOptions()
|
||||||
includeVersionInfo = false;
|
includeVersionInfo = false;
|
||||||
supportXPThemes = false;
|
supportXPThemes = false;
|
||||||
compilerSet = 0;
|
compilerSet = 0;
|
||||||
compilerSetType = 0;
|
compilerSetType = CompilerSetType::DEBUG;
|
||||||
staticLink = true;
|
staticLink = true;
|
||||||
addCharset = true;
|
addCharset = true;
|
||||||
modelType = ProjectModelType::FileSystem;
|
modelType = ProjectModelType::FileSystem;
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include "compiler/compilerinfo.h"
|
||||||
|
|
||||||
enum class ProjectModelType {
|
enum class ProjectModelType {
|
||||||
FileSystem,
|
FileSystem,
|
||||||
|
@ -88,7 +89,7 @@ struct ProjectOptions{
|
||||||
bool includeVersionInfo;
|
bool includeVersionInfo;
|
||||||
bool supportXPThemes;
|
bool supportXPThemes;
|
||||||
int compilerSet;
|
int compilerSet;
|
||||||
int compilerSetType;
|
CompilerSetType compilerSetType;
|
||||||
QMap<QString,QString> compilerOptions;
|
QMap<QString,QString> compilerOptions;
|
||||||
ProjectVersionInfo versionInfo;
|
ProjectVersionInfo versionInfo;
|
||||||
QString cmdLineArgs;
|
QString cmdLineArgs;
|
||||||
|
|
|
@ -2024,7 +2024,7 @@ void Settings::CompilerSet::setProperties(const QString &binDir, const QString&
|
||||||
targetStr = "clang version ";
|
targetStr = "clang version ";
|
||||||
delimPos1 = output.indexOf(targetStr);
|
delimPos1 = output.indexOf(targetStr);
|
||||||
if (delimPos1>=0) {
|
if (delimPos1>=0) {
|
||||||
mCompilerType = COMPILER_CLANG;
|
mCompilerType = CompilerType::Clang;
|
||||||
delimPos1+=strlen(targetStr);
|
delimPos1+=strlen(targetStr);
|
||||||
delimPos2 = delimPos1;
|
delimPos2 = delimPos1;
|
||||||
while (delimPos2<output.length() && !isNonPrintableAsciiChar(output[delimPos2]))
|
while (delimPos2<output.length() && !isNonPrintableAsciiChar(output[delimPos2]))
|
||||||
|
@ -2033,7 +2033,7 @@ void Settings::CompilerSet::setProperties(const QString &binDir, const QString&
|
||||||
|
|
||||||
mName = "Clang " + mVersion;
|
mName = "Clang " + mVersion;
|
||||||
} else {
|
} else {
|
||||||
mCompilerType = COMPILER_GCC;
|
mCompilerType = CompilerType::GCC;
|
||||||
targetStr = "gcc version ";
|
targetStr = "gcc version ";
|
||||||
delimPos1 = output.indexOf(targetStr);
|
delimPos1 = output.indexOf(targetStr);
|
||||||
if (delimPos1<0)
|
if (delimPos1<0)
|
||||||
|
@ -2044,6 +2044,18 @@ void Settings::CompilerSet::setProperties(const QString &binDir, const QString&
|
||||||
delimPos2++;
|
delimPos2++;
|
||||||
mVersion = output.mid(delimPos1,delimPos2-delimPos1);
|
mVersion = output.mid(delimPos1,delimPos2-delimPos1);
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
// //fix for mingw64 gcc
|
// //fix for mingw64 gcc
|
||||||
// double versionValue;
|
// double versionValue;
|
||||||
// bool ok;
|
// bool ok;
|
||||||
|
@ -2060,6 +2072,8 @@ void Settings::CompilerSet::setProperties(const QString &binDir, const QString&
|
||||||
delimPos2++;
|
delimPos2++;
|
||||||
mType = output.mid(delimPos1 + 1, delimPos2 - delimPos1 - 1);
|
mType = output.mid(delimPos1 + 1, delimPos2 - delimPos1 - 1);
|
||||||
|
|
||||||
|
if (majorVersion>=12 && mType.contains("MSYS2"))
|
||||||
|
mCompilerType = CompilerType::GCC_UTF8;
|
||||||
// Assemble user friendly name if we don't have one yet
|
// Assemble user friendly name if we don't have one yet
|
||||||
if (mName == "") {
|
if (mName == "") {
|
||||||
if (mType.contains("tdm64")) {
|
if (mType.contains("tdm64")) {
|
||||||
|
@ -2153,7 +2167,7 @@ void Settings::CompilerSet::setDefines() {
|
||||||
|
|
||||||
void Settings::CompilerSet::setExecutables()
|
void Settings::CompilerSet::setExecutables()
|
||||||
{
|
{
|
||||||
if (mCompilerType == COMPILER_CLANG) {
|
if (mCompilerType == CompilerType::Clang) {
|
||||||
mCCompiler = findProgramInBinDirs(CLANG_PROGRAM);
|
mCCompiler = findProgramInBinDirs(CLANG_PROGRAM);
|
||||||
mCppCompiler = findProgramInBinDirs(CLANG_CPP_PROGRAM);
|
mCppCompiler = findProgramInBinDirs(CLANG_CPP_PROGRAM);
|
||||||
mDebugger = findProgramInBinDirs(GDB_PROGRAM);
|
mDebugger = findProgramInBinDirs(GDB_PROGRAM);
|
||||||
|
@ -2177,11 +2191,11 @@ void Settings::CompilerSet::setExecutables()
|
||||||
mProfiler = findProgramInBinDirs(GPROF_PROGRAM);
|
mProfiler = findProgramInBinDirs(GPROF_PROGRAM);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::CompilerSet::setDirectories(const QString& binDir,const QString& compilerType)
|
void Settings::CompilerSet::setDirectories(const QString& binDir,CompilerType compilerType)
|
||||||
{
|
{
|
||||||
QString folder = QFileInfo(binDir).absolutePath();
|
QString folder = QFileInfo(binDir).absolutePath();
|
||||||
QString cc_prog;
|
QString cc_prog;
|
||||||
if (compilerType==COMPILER_CLANG)
|
if (compilerType==CompilerType::Clang)
|
||||||
cc_prog = CLANG_PROGRAM;
|
cc_prog = CLANG_PROGRAM;
|
||||||
else
|
else
|
||||||
cc_prog = GCC_PROGRAM;
|
cc_prog = GCC_PROGRAM;
|
||||||
|
@ -2472,22 +2486,22 @@ void Settings::CompilerSet::setDebugServer(const QString &newDebugServer)
|
||||||
mDebugServer = newDebugServer;
|
mDebugServer = newDebugServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Settings::CompilerSet::compilerSetType() const
|
CompilerSetType Settings::CompilerSet::compilerSetType() const
|
||||||
{
|
{
|
||||||
return mCompilerSetType;
|
return mCompilerSetType;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::CompilerSet::setCompilerSetType(int newCompilerSetType)
|
void Settings::CompilerSet::setCompilerSetType(CompilerSetType newCompilerSetType)
|
||||||
{
|
{
|
||||||
mCompilerSetType = newCompilerSetType;
|
mCompilerSetType = newCompilerSetType;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::CompilerSet::setCompilerType(const QString &newCompilerType)
|
void Settings::CompilerSet::setCompilerType(CompilerType newCompilerType)
|
||||||
{
|
{
|
||||||
mCompilerType = newCompilerType;
|
mCompilerType = newCompilerType;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString &Settings::CompilerSet::compilerType() const
|
CompilerType Settings::CompilerSet::compilerType() const
|
||||||
{
|
{
|
||||||
return mCompilerType;
|
return mCompilerType;
|
||||||
}
|
}
|
||||||
|
@ -2524,7 +2538,7 @@ Settings::PCompilerSet Settings::CompilerSets::addSet()
|
||||||
Settings::PCompilerSet Settings::CompilerSets::addSet(const QString &folder, const QString& cc_prog)
|
Settings::PCompilerSet Settings::CompilerSets::addSet(const QString &folder, const QString& cc_prog)
|
||||||
{
|
{
|
||||||
PCompilerSet p=std::make_shared<CompilerSet>(folder,cc_prog);
|
PCompilerSet p=std::make_shared<CompilerSet>(folder,cc_prog);
|
||||||
if (cc_prog==GCC_PROGRAM && p->compilerType()==COMPILER_CLANG)
|
if (cc_prog==GCC_PROGRAM && p->compilerType()==CompilerType::Clang)
|
||||||
return PCompilerSet();
|
return PCompilerSet();
|
||||||
mList.push_back(p);
|
mList.push_back(p);
|
||||||
return p;
|
return p;
|
||||||
|
@ -2576,13 +2590,13 @@ bool Settings::CompilerSets::addSets(const QString &folder, const QString& cc_pr
|
||||||
PCompilerSet set= addSet(baseSet);
|
PCompilerSet set= addSet(baseSet);
|
||||||
platformName = "32-bit";
|
platformName = "32-bit";
|
||||||
set->setName(baseName + " " + platformName + " Release");
|
set->setName(baseName + " " + platformName + " Release");
|
||||||
set->setCompilerSetType(CompilerSetType::CST_RELEASE);
|
set->setCompilerSetType(CompilerSetType::RELEASE);
|
||||||
set64_32Options(set);
|
set64_32Options(set);
|
||||||
setReleaseOptions(set);
|
setReleaseOptions(set);
|
||||||
|
|
||||||
set = addSet(baseSet);
|
set = addSet(baseSet);
|
||||||
set->setName(baseName + " " + platformName + " Debug");
|
set->setName(baseName + " " + platformName + " Debug");
|
||||||
set->setCompilerSetType(CompilerSetType::CST_DEBUG);
|
set->setCompilerSetType(CompilerSetType::DEBUG);
|
||||||
set64_32Options(set);
|
set64_32Options(set);
|
||||||
setDebugOptions(set);
|
setDebugOptions(set);
|
||||||
}
|
}
|
||||||
|
@ -2594,11 +2608,11 @@ bool Settings::CompilerSets::addSets(const QString &folder, const QString& cc_pr
|
||||||
|
|
||||||
PCompilerSet set = addSet(baseSet);
|
PCompilerSet set = addSet(baseSet);
|
||||||
set->setName(baseName + " " + platformName + " Debug");
|
set->setName(baseName + " " + platformName + " Debug");
|
||||||
set->setCompilerSetType(CompilerSetType::CST_DEBUG);
|
set->setCompilerSetType(CompilerSetType::DEBUG);
|
||||||
setDebugOptions(set);
|
setDebugOptions(set);
|
||||||
|
|
||||||
baseSet->setName(baseName + " " + platformName + " Release");
|
baseSet->setName(baseName + " " + platformName + " Release");
|
||||||
baseSet->setCompilerSetType(CompilerSetType::CST_RELEASE);
|
baseSet->setCompilerSetType(CompilerSetType::RELEASE);
|
||||||
setReleaseOptions(baseSet);
|
setReleaseOptions(baseSet);
|
||||||
|
|
||||||
// baseSet = addSet(folder);
|
// baseSet = addSet(folder);
|
||||||
|
@ -2902,8 +2916,8 @@ void Settings::CompilerSets::saveSet(int index)
|
||||||
mSettings->mSettings.setValue("Type", pSet->type());
|
mSettings->mSettings.setValue("Type", pSet->type());
|
||||||
mSettings->mSettings.setValue("Name", pSet->name());
|
mSettings->mSettings.setValue("Name", pSet->name());
|
||||||
mSettings->mSettings.setValue("Target", pSet->target());
|
mSettings->mSettings.setValue("Target", pSet->target());
|
||||||
mSettings->mSettings.setValue("CompilerType", pSet->compilerType());
|
mSettings->mSettings.setValue("CompilerType", (int)pSet->compilerType());
|
||||||
mSettings->mSettings.setValue("CompilerSetType", pSet->compilerSetType());
|
mSettings->mSettings.setValue("CompilerSetType", (int)pSet->compilerSetType());
|
||||||
|
|
||||||
// Paths
|
// Paths
|
||||||
savePathList("Bins",pSet->binDirs());
|
savePathList("Bins",pSet->binDirs());
|
||||||
|
@ -2955,8 +2969,19 @@ Settings::PCompilerSet Settings::CompilerSets::loadSet(int index)
|
||||||
pSet->setType(mSettings->mSettings.value("Type").toString());
|
pSet->setType(mSettings->mSettings.value("Type").toString());
|
||||||
pSet->setName(mSettings->mSettings.value("Name").toString());
|
pSet->setName(mSettings->mSettings.value("Name").toString());
|
||||||
pSet->setTarget(mSettings->mSettings.value("Target").toString());
|
pSet->setTarget(mSettings->mSettings.value("Target").toString());
|
||||||
pSet->setCompilerType(mSettings->mSettings.value("CompilerType").toString());
|
//compatibility
|
||||||
pSet->setCompilerSetType(mSettings->mSettings.value("CompilerSetType").toInt());
|
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());
|
||||||
|
|
||||||
// Load extra 'general' options
|
// Load extra 'general' options
|
||||||
pSet->setUseCustomCompileParams(mSettings->mSettings.value("useCustomCompileParams", false).toBool());
|
pSet->setUseCustomCompileParams(mSettings->mSettings.value("useCustomCompileParams", false).toBool());
|
||||||
|
|
|
@ -53,12 +53,6 @@ extern const char ValueToChar[28];
|
||||||
|
|
||||||
class Settings;
|
class Settings;
|
||||||
|
|
||||||
enum CompilerSetType {
|
|
||||||
CST_RELEASE,
|
|
||||||
CST_DEBUG,
|
|
||||||
CST_PROFILING
|
|
||||||
};
|
|
||||||
|
|
||||||
class Settings
|
class Settings
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
@ -1294,12 +1288,12 @@ public:
|
||||||
|
|
||||||
static int charToValue(char valueChar);
|
static int charToValue(char valueChar);
|
||||||
static char valueToChar(int val);
|
static char valueToChar(int val);
|
||||||
const QString &compilerType() const;
|
CompilerType compilerType() const;
|
||||||
|
|
||||||
void setCompilerType(const QString &newCompilerType);
|
void setCompilerType(CompilerType newCompilerType);
|
||||||
|
|
||||||
int compilerSetType() const;
|
CompilerSetType compilerSetType() const;
|
||||||
void setCompilerSetType(int newCompilerSetType);
|
void setCompilerSetType(CompilerSetType newCompilerSetType);
|
||||||
|
|
||||||
const QString &execCharset() const;
|
const QString &execCharset() const;
|
||||||
void setExecCharset(const QString &newExecCharset);
|
void setExecCharset(const QString &newExecCharset);
|
||||||
|
@ -1325,7 +1319,7 @@ public:
|
||||||
bool isOutputExecutable();
|
bool isOutputExecutable();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setDirectories(const QString& binDir, const QString& mCompilerType);
|
void setDirectories(const QString& binDir, CompilerType mCompilerType);
|
||||||
//load hard defines
|
//load hard defines
|
||||||
void setDefines();
|
void setDefines();
|
||||||
void setExecutables();
|
void setExecutables();
|
||||||
|
@ -1363,8 +1357,8 @@ public:
|
||||||
QStringList mCppDefines; // list of predefined constants
|
QStringList mCppDefines; // list of predefined constants
|
||||||
QStringList mCDefines; // list of predefined constants
|
QStringList mCDefines; // list of predefined constants
|
||||||
QString mTarget; // 'X86_64' / 'i686'
|
QString mTarget; // 'X86_64' / 'i686'
|
||||||
QString mCompilerType; // 'Clang' / 'GCC'
|
CompilerType mCompilerType; // 'Clang' / 'GCC'
|
||||||
int mCompilerSetType; // RELEASE/ DEBUG/ Profile
|
CompilerSetType mCompilerSetType; // RELEASE/ DEBUG/ Profile
|
||||||
|
|
||||||
// User settings
|
// User settings
|
||||||
bool mUseCustomCompileParams;
|
bool mUseCustomCompileParams;
|
||||||
|
|
|
@ -72,12 +72,12 @@ void CompilerSetOptionWidget::init()
|
||||||
|
|
||||||
|
|
||||||
static void loadCompilerSetSettings(Settings::PCompilerSet pSet, Ui::CompilerSetOptionWidget* ui) {
|
static void loadCompilerSetSettings(Settings::PCompilerSet pSet, Ui::CompilerSetOptionWidget* ui) {
|
||||||
ui->chkAutoAddCharset->setEnabled(pSet->compilerType() != COMPILER_CLANG);
|
ui->chkAutoAddCharset->setEnabled(pSet->compilerType() != CompilerType::Clang);
|
||||||
ui->chkAutoAddCharset->setVisible(pSet->compilerType() != COMPILER_CLANG);
|
ui->chkAutoAddCharset->setVisible(pSet->compilerType() != CompilerType::Clang);
|
||||||
ui->cbEncoding->setEnabled(pSet->compilerType() != COMPILER_CLANG);
|
ui->cbEncoding->setEnabled(pSet->compilerType() != CompilerType::Clang);
|
||||||
ui->cbEncoding->setVisible(pSet->compilerType() != COMPILER_CLANG);
|
ui->cbEncoding->setVisible(pSet->compilerType() != CompilerType::Clang);
|
||||||
ui->cbEncodingDetails->setEnabled(pSet->compilerType() != COMPILER_CLANG);
|
ui->cbEncodingDetails->setEnabled(pSet->compilerType() != CompilerType::Clang);
|
||||||
ui->cbEncodingDetails->setVisible(pSet->compilerType() != COMPILER_CLANG);
|
ui->cbEncodingDetails->setVisible(pSet->compilerType() != CompilerType::Clang);
|
||||||
|
|
||||||
ui->chkUseCustomCompilerParams->setChecked(pSet->useCustomCompileParams());
|
ui->chkUseCustomCompilerParams->setChecked(pSet->useCustomCompileParams());
|
||||||
ui->txtCustomCompileParams->setPlainText(pSet->customCompileParams());
|
ui->txtCustomCompileParams->setPlainText(pSet->customCompileParams());
|
||||||
|
|
|
@ -38,7 +38,7 @@ void ProjectCompilerWidget::refreshOptions()
|
||||||
Settings::PCompilerSet pSet = pSettings->compilerSets().getSet(ui->cbCompilerSet->currentIndex());
|
Settings::PCompilerSet pSet = pSettings->compilerSets().getSet(ui->cbCompilerSet->currentIndex());
|
||||||
if (!pSet)
|
if (!pSet)
|
||||||
return;
|
return;
|
||||||
ui->panelAddCharset->setVisible(pSet->compilerType()!=COMPILER_CLANG);
|
ui->panelAddCharset->setVisible(pSet->compilerType()!=CompilerType::Clang);
|
||||||
//ui->chkAddCharset->setEnabled(pSet->compilerType()!=COMPILER_CLANG);
|
//ui->chkAddCharset->setEnabled(pSet->compilerType()!=COMPILER_CLANG);
|
||||||
mOptions = pMainWindow->project()->options().compilerOptions;
|
mOptions = pMainWindow->project()->options().compilerOptions;
|
||||||
if (mOptions.isEmpty())
|
if (mOptions.isEmpty())
|
||||||
|
@ -87,7 +87,7 @@ void ProjectCompilerWidget::doSave()
|
||||||
|
|
||||||
pMainWindow->project()->setCompilerSet(ui->cbCompilerSet->currentIndex());
|
pMainWindow->project()->setCompilerSet(ui->cbCompilerSet->currentIndex());
|
||||||
pMainWindow->project()->options().compilerOptions = ui->tabOptions->arguments(true);
|
pMainWindow->project()->options().compilerOptions = ui->tabOptions->arguments(true);
|
||||||
if (pSet->compilerType()!=COMPILER_CLANG)
|
if (pSet->compilerType()!=CompilerType::Clang)
|
||||||
pMainWindow->project()->options().addCharset = ui->chkAddCharset->isChecked();
|
pMainWindow->project()->options().addCharset = ui->chkAddCharset->isChecked();
|
||||||
pMainWindow->project()->options().staticLink = ui->chkStaticLink->isChecked();
|
pMainWindow->project()->options().staticLink = ui->chkStaticLink->isChecked();
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ public:
|
||||||
void setBoolArgument(const QString &argKey, bool checked);
|
void setBoolArgument(const QString &argKey, bool checked);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString mCompilerType;
|
CompilerType mCompilerType;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // COMPILEARGUMENTSWIDGET_H
|
#endif // COMPILEARGUMENTSWIDGET_H
|
||||||
|
|
|
@ -43,7 +43,7 @@ NewProjectDialog::NewProjectDialog(QWidget *parent) :
|
||||||
location = excludeTrailingPathDelimiter(pSettings->dirs().projectDir());
|
location = excludeTrailingPathDelimiter(pSettings->dirs().projectDir());
|
||||||
while (true) {
|
while (true) {
|
||||||
i++;
|
i++;
|
||||||
projectName = tr("Project%1").arg(i);
|
projectName = QString("Project%1").arg(i);
|
||||||
QString tempLocation = includeTrailingPathDelimiter(location)+projectName;
|
QString tempLocation = includeTrailingPathDelimiter(location)+projectName;
|
||||||
if (!QDir(tempLocation).exists())
|
if (!QDir(tempLocation).exists())
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -192,7 +192,7 @@ void SynExporter::setTitle(const QString &Value)
|
||||||
if (!Value.isEmpty())
|
if (!Value.isEmpty())
|
||||||
mTitle = Value;
|
mTitle = Value;
|
||||||
else
|
else
|
||||||
mTitle = QObject::tr("Untitled");
|
mTitle = "Untitled";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue