- fix: encoding option not correctly set when check syntax in back
This commit is contained in:
parent
f300fe15c4
commit
156913a3ca
|
@ -79,6 +79,7 @@ SOURCES += \
|
||||||
utils.cpp \
|
utils.cpp \
|
||||||
widgets/coloredit.cpp \
|
widgets/coloredit.cpp \
|
||||||
widgets/consolewidget.cpp \
|
widgets/consolewidget.cpp \
|
||||||
|
widgets/filepropertiesdialog.cpp \
|
||||||
widgets/headercompletionpopup.cpp \
|
widgets/headercompletionpopup.cpp \
|
||||||
widgets/issuestable.cpp \
|
widgets/issuestable.cpp \
|
||||||
widgets/qconsole.cpp \
|
widgets/qconsole.cpp \
|
||||||
|
@ -154,6 +155,7 @@ HEADERS += \
|
||||||
common.h \
|
common.h \
|
||||||
widgets/coloredit.h \
|
widgets/coloredit.h \
|
||||||
widgets/consolewidget.h \
|
widgets/consolewidget.h \
|
||||||
|
widgets/filepropertiesdialog.h \
|
||||||
widgets/headercompletionpopup.h \
|
widgets/headercompletionpopup.h \
|
||||||
widgets/issuestable.h \
|
widgets/issuestable.h \
|
||||||
widgets/qconsole.h \
|
widgets/qconsole.h \
|
||||||
|
@ -180,6 +182,7 @@ FORMS += \
|
||||||
settingsdialog/environmentappearencewidget.ui \
|
settingsdialog/environmentappearencewidget.ui \
|
||||||
settingsdialog/executorgeneralwidget.ui \
|
settingsdialog/executorgeneralwidget.ui \
|
||||||
settingsdialog/settingsdialog.ui \
|
settingsdialog/settingsdialog.ui \
|
||||||
|
widgets/filepropertiesdialog.ui \
|
||||||
widgets/searchdialog.ui
|
widgets/searchdialog.ui
|
||||||
|
|
||||||
TRANSLATIONS += \
|
TRANSLATIONS += \
|
||||||
|
|
|
@ -61,7 +61,7 @@ void CompilerManager::compile(const QString& filename, const QByteArray& encodin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompilerManager::checkSyntax(const QString &filename, const QString &content)
|
void CompilerManager::checkSyntax(const QString &filename, const QString &content, bool isAscii)
|
||||||
{
|
{
|
||||||
if (!pSettings->compilerSets().defaultSet()) {
|
if (!pSettings->compilerSets().defaultSet()) {
|
||||||
QMessageBox::critical(pMainWindow,
|
QMessageBox::critical(pMainWindow,
|
||||||
|
@ -76,7 +76,7 @@ void CompilerManager::checkSyntax(const QString &filename, const QString &conten
|
||||||
}
|
}
|
||||||
|
|
||||||
mSyntaxCheckErrorCount = 0;
|
mSyntaxCheckErrorCount = 0;
|
||||||
mBackgroundSyntaxChecker = new StdinCompiler(filename,content,true,true);
|
mBackgroundSyntaxChecker = new StdinCompiler(filename,content,isAscii,true,true);
|
||||||
connect(mBackgroundSyntaxChecker, &Compiler::compileFinished, this ,&CompilerManager::onSyntaxCheckFinished);
|
connect(mBackgroundSyntaxChecker, &Compiler::compileFinished, this ,&CompilerManager::onSyntaxCheckFinished);
|
||||||
connect(mBackgroundSyntaxChecker, &Compiler::compileIssue, this, &CompilerManager::onSyntaxCheckIssue);
|
connect(mBackgroundSyntaxChecker, &Compiler::compileIssue, this, &CompilerManager::onSyntaxCheckIssue);
|
||||||
connect(mBackgroundSyntaxChecker, &Compiler::compileFinished, pMainWindow, &MainWindow::onCompileFinished);
|
connect(mBackgroundSyntaxChecker, &Compiler::compileFinished, pMainWindow, &MainWindow::onCompileFinished);
|
||||||
|
|
|
@ -19,7 +19,7 @@ public:
|
||||||
bool running();
|
bool running();
|
||||||
|
|
||||||
void compile(const QString& filename, const QByteArray& encoding, bool rebuild, bool silent=false,bool onlyCheckSyntax=false);
|
void compile(const QString& filename, const QByteArray& encoding, bool rebuild, bool silent=false,bool onlyCheckSyntax=false);
|
||||||
void checkSyntax(const QString&filename, const QString& content);
|
void checkSyntax(const QString&filename, const QString& content, bool isAscii);
|
||||||
void run(const QString& filename, const QString& arguments, const QString& workDir);
|
void run(const QString& filename, const QString& arguments, const QString& workDir);
|
||||||
void stopRun();
|
void stopRun();
|
||||||
void stopCompile();
|
void stopCompile();
|
||||||
|
|
|
@ -2,10 +2,12 @@
|
||||||
#include "compilermanager.h"
|
#include "compilermanager.h"
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
#include "../platform.h"
|
||||||
|
|
||||||
StdinCompiler::StdinCompiler(const QString &filename, const QString& content, bool silent, bool onlyCheckSyntax):
|
StdinCompiler::StdinCompiler(const QString &filename, const QString& content,bool isAscii, bool silent, bool onlyCheckSyntax):
|
||||||
Compiler(filename,silent,onlyCheckSyntax),
|
Compiler(filename,silent,onlyCheckSyntax),
|
||||||
mContent(content)
|
mContent(content),
|
||||||
|
mIsAscii(isAscii)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,6 +28,8 @@ bool StdinCompiler::prepareForCompile()
|
||||||
if (fileType == FileType::Other)
|
if (fileType == FileType::Other)
|
||||||
fileType = FileType::CppSource;
|
fileType = FileType::CppSource;
|
||||||
QString strFileType;
|
QString strFileType;
|
||||||
|
if (!mIsAscii)
|
||||||
|
mArguments += getCharsetArgument(getDefaultSystemEncoding());
|
||||||
switch(fileType) {
|
switch(fileType) {
|
||||||
case FileType::CSource:
|
case FileType::CSource:
|
||||||
case FileType::CHeader:
|
case FileType::CHeader:
|
||||||
|
|
|
@ -8,7 +8,7 @@ class StdinCompiler : public Compiler
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit StdinCompiler(const QString& filename, const QString& content, bool silent,bool onlyCheckSyntax);
|
explicit StdinCompiler(const QString& filename, const QString& content, bool isAscii, bool silent,bool onlyCheckSyntax);
|
||||||
|
|
||||||
// Compiler interface
|
// Compiler interface
|
||||||
protected:
|
protected:
|
||||||
|
@ -17,6 +17,7 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString mContent;
|
QString mContent;
|
||||||
|
bool mIsAscii;
|
||||||
|
|
||||||
// Compiler interface
|
// Compiler interface
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -614,7 +614,8 @@ void MainWindow::checkSyntaxInBack(Editor *e)
|
||||||
mCheckSyntaxInBack=true;
|
mCheckSyntaxInBack=true;
|
||||||
e->clearSyntaxIssues();
|
e->clearSyntaxIssues();
|
||||||
ui->tableIssues->clearIssues();
|
ui->tableIssues->clearIssues();
|
||||||
mCompilerManager->checkSyntax(e->filename(),e->lines()->text());
|
mCompilerManager->checkSyntax(e->filename(),e->lines()->text(),
|
||||||
|
e->fileEncoding() == ENCODING_ASCII);
|
||||||
// if not PrepareForCompile(cttStdin,True) then begin
|
// if not PrepareForCompile(cttStdin,True) then begin
|
||||||
// fCheckSyntaxInBack:=False;
|
// fCheckSyntaxInBack:=False;
|
||||||
// Exit;
|
// Exit;
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
#include "filepropertiesdialog.h"
|
||||||
|
#include "ui_filepropertiesdialog.h"
|
||||||
|
|
||||||
|
FilePropertiesDialog::FilePropertiesDialog(QWidget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
|
ui(new Ui::FilePropertiesDialog)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
FilePropertiesDialog::~FilePropertiesDialog()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
#ifndef FILEPROPERTIESDIALOG_H
|
||||||
|
#define FILEPROPERTIESDIALOG_H
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class FilePropertiesDialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
class FilePropertiesDialog : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit FilePropertiesDialog(QWidget *parent = nullptr);
|
||||||
|
~FilePropertiesDialog();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::FilePropertiesDialog *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // FILEPROPERTIESDIALOG_H
|
|
@ -0,0 +1,18 @@
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>FilePropertiesDialog</class>
|
||||||
|
<widget name="FilePropertiesDialog" class="QDialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
Loading…
Reference in New Issue