- fix: The Enter key in the numpad doesn't work
- fix: The compiled executable not fully write to the disk before run it - fix: settings object not correctly released when exit - fix: shouldn't check syntax when save modifications before compiling - fix: shouldn't scroll to the end of the last line when update compile logs - fix: can't debug project
This commit is contained in:
parent
c58ddf7073
commit
a16562f6ce
9
NEWS.md
9
NEWS.md
|
@ -1,8 +1,13 @@
|
|||
Version 0.6.1
|
||||
- fix: editor deadlock
|
||||
Version 0.6.2
|
||||
- fix: The Enter key in the numpad doesn't work
|
||||
- fix: The compiled executable not fully write to the disk before run it
|
||||
- fix: settings object not correctly released when exit
|
||||
- fix: shouldn't check syntax when save modifications before compiling
|
||||
- fix: shouldn't scroll to the end of the last line when update compile logs
|
||||
- fix: can't debug project
|
||||
|
||||
Version 0.6.1
|
||||
- fix: editor deadlock
|
||||
|
||||
Version 0.6.0
|
||||
- fix: old data not displayed when editing code snippets
|
||||
|
|
|
@ -65,10 +65,11 @@ void CompilerManager::compile(const QString& filename, const QByteArray& encodin
|
|||
mCompileErrorCount = 0;
|
||||
mCompiler = new FileCompiler(filename,encoding,silent,onlyCheckSyntax);
|
||||
mCompiler->setRebuild(rebuild);
|
||||
connect(mCompiler, &Compiler::compileFinished, this ,&CompilerManager::onCompileFinished);
|
||||
connect(mCompiler, &Compiler::finished, mCompiler, &QObject::deleteLater);
|
||||
connect(mCompiler, &Compiler::compileFinished, this, &CompilerManager::onCompileFinished);
|
||||
connect(mCompiler, &Compiler::compileIssue, this, &CompilerManager::onCompileIssue);
|
||||
connect(mCompiler, &Compiler::compileStarted, pMainWindow, &MainWindow::onCompileStarted);
|
||||
connect(mCompiler, &Compiler::compileFinished, pMainWindow, &MainWindow::onCompileFinished);
|
||||
|
||||
connect(mCompiler, &Compiler::compileOutput, pMainWindow, &MainWindow::onCompileLog);
|
||||
connect(mCompiler, &Compiler::compileIssue, pMainWindow, &MainWindow::onCompileIssue);
|
||||
connect(mCompiler, &Compiler::compileErrorOccured, pMainWindow, &MainWindow::onCompileErrorOccured);
|
||||
|
@ -92,9 +93,12 @@ void CompilerManager::compileProject(std::shared_ptr<Project> project, bool rebu
|
|||
mCompileErrorCount = 0;
|
||||
mCompiler = new ProjectCompiler(project,silent,onlyCheckSyntax);
|
||||
mCompiler->setRebuild(rebuild);
|
||||
connect(mCompiler, &Compiler::compileFinished, this ,&CompilerManager::onCompileFinished);
|
||||
connect(mCompiler, &Compiler::finished, mCompiler, &QObject::deleteLater);
|
||||
connect(mCompiler, &Compiler::compileFinished, this, &CompilerManager::onCompileFinished);
|
||||
|
||||
connect(mCompiler, &Compiler::compileIssue, this, &CompilerManager::onCompileIssue);
|
||||
connect(mCompiler, &Compiler::compileFinished, pMainWindow, &MainWindow::onCompileFinished);
|
||||
connect(mCompiler, &Compiler::compileStarted, pMainWindow, &MainWindow::onCompileStarted);
|
||||
|
||||
connect(mCompiler, &Compiler::compileOutput, pMainWindow, &MainWindow::onCompileLog);
|
||||
connect(mCompiler, &Compiler::compileIssue, pMainWindow, &MainWindow::onCompileIssue);
|
||||
connect(mCompiler, &Compiler::compileErrorOccured, pMainWindow, &MainWindow::onCompileErrorOccured);
|
||||
|
@ -120,9 +124,12 @@ void CompilerManager::cleanProject(std::shared_ptr<Project> project)
|
|||
compiler->setOnlyClean(true);
|
||||
mCompiler->setRebuild(false);
|
||||
mCompiler = compiler;
|
||||
connect(mCompiler, &Compiler::compileFinished, this ,&CompilerManager::onCompileFinished);
|
||||
connect(mCompiler, &Compiler::finished, mCompiler, &QObject::deleteLater);
|
||||
connect(mCompiler, &Compiler::compileFinished, this, &CompilerManager::onCompileFinished);
|
||||
|
||||
connect(mCompiler, &Compiler::compileIssue, this, &CompilerManager::onCompileIssue);
|
||||
connect(mCompiler, &Compiler::compileFinished, pMainWindow, &MainWindow::onCompileFinished);
|
||||
connect(mCompiler, &Compiler::compileStarted, pMainWindow, &MainWindow::onCompileStarted);
|
||||
|
||||
connect(mCompiler, &Compiler::compileOutput, pMainWindow, &MainWindow::onCompileLog);
|
||||
connect(mCompiler, &Compiler::compileIssue, pMainWindow, &MainWindow::onCompileIssue);
|
||||
connect(mCompiler, &Compiler::compileErrorOccured, pMainWindow, &MainWindow::onCompileErrorOccured);
|
||||
|
@ -166,9 +173,10 @@ void CompilerManager::checkSyntax(const QString &filename, const QString &conten
|
|||
mSyntaxCheckErrorCount = 0;
|
||||
mBackgroundSyntaxChecker = new StdinCompiler(filename,content,isAscii,true,true);
|
||||
mBackgroundSyntaxChecker->setProject(project);
|
||||
connect(mBackgroundSyntaxChecker, &Compiler::compileFinished, this ,&CompilerManager::onSyntaxCheckFinished);
|
||||
connect(mBackgroundSyntaxChecker, &Compiler::finished, mBackgroundSyntaxChecker, &QThread::deleteLater);
|
||||
connect(mBackgroundSyntaxChecker, &Compiler::compileIssue, this, &CompilerManager::onSyntaxCheckIssue);
|
||||
connect(mBackgroundSyntaxChecker, &Compiler::compileFinished, pMainWindow, &MainWindow::onCompileFinished);
|
||||
connect(mBackgroundSyntaxChecker, &Compiler::compileStarted, pMainWindow, &MainWindow::onCompileStarted);
|
||||
connect(mBackgroundSyntaxChecker, &Compiler::compileFinished, this, &CompilerManager::onSyntaxCheckFinished);
|
||||
connect(mBackgroundSyntaxChecker, &Compiler::compileOutput, pMainWindow, &MainWindow::onCompileLog);
|
||||
connect(mBackgroundSyntaxChecker, &Compiler::compileIssue, pMainWindow, &MainWindow::onCompileIssue);
|
||||
connect(mBackgroundSyntaxChecker, &Compiler::compileErrorOccured, pMainWindow, &MainWindow::onCompileErrorOccured);
|
||||
|
@ -210,7 +218,7 @@ void CompilerManager::stopCompile()
|
|||
|
||||
void CompilerManager::stopCheckSyntax()
|
||||
{
|
||||
QMutexLocker locker(&mCompileMutex);
|
||||
QMutexLocker locker(&mBackgroundSyntaxCheckMutex);
|
||||
if (mBackgroundSyntaxChecker!=nullptr)
|
||||
mBackgroundSyntaxChecker->stopCompile();
|
||||
}
|
||||
|
@ -223,8 +231,8 @@ bool CompilerManager::canCompile(const QString &filename)
|
|||
void CompilerManager::onCompileFinished()
|
||||
{
|
||||
QMutexLocker locker(&mCompileMutex);
|
||||
delete mCompiler;
|
||||
mCompiler=nullptr;
|
||||
pMainWindow->onCompileFinished(false);
|
||||
}
|
||||
|
||||
void CompilerManager::onRunnerTerminated()
|
||||
|
@ -245,8 +253,8 @@ void CompilerManager::onCompileIssue(PCompileIssue issue)
|
|||
void CompilerManager::onSyntaxCheckFinished()
|
||||
{
|
||||
QMutexLocker locker(&mBackgroundSyntaxCheckMutex);
|
||||
delete mBackgroundSyntaxChecker;
|
||||
mBackgroundSyntaxChecker=nullptr;
|
||||
pMainWindow->onCompileFinished(true);
|
||||
}
|
||||
|
||||
void CompilerManager::onSyntaxCheckIssue(PCompileIssue issue)
|
||||
|
|
|
@ -52,9 +52,9 @@ private:
|
|||
int mSyntaxCheckIssueCount;
|
||||
Compiler* mBackgroundSyntaxChecker;
|
||||
ExecutableRunner* mRunner;
|
||||
QMutex mCompileMutex;
|
||||
QMutex mBackgroundSyntaxCheckMutex;
|
||||
QMutex mRunnerMutex;
|
||||
QRecursiveMutex mCompileMutex;
|
||||
QRecursiveMutex mBackgroundSyntaxCheckMutex;
|
||||
QRecursiveMutex mRunnerMutex;
|
||||
};
|
||||
|
||||
class CompileError : public BaseError {
|
||||
|
|
|
@ -194,9 +194,6 @@ void Editor::saveFile(const QString &filename) {
|
|||
QFile file(filename);
|
||||
this->lines()->SaveToFile(file,mEncodingOption,mFileEncoding);
|
||||
pMainWindow->updateForEncodingInfo();
|
||||
if (pSettings->editor().syntaxCheckWhenSave())
|
||||
checkSyntaxInBack();
|
||||
reparseTodo();
|
||||
}
|
||||
|
||||
void Editor::convertToEncoding(const QByteArray &encoding)
|
||||
|
@ -238,6 +235,9 @@ bool Editor::save(bool force, bool doReparse) {
|
|||
if (doReparse && mParser) {
|
||||
reparse();
|
||||
}
|
||||
if (doReparse && pSettings->editor().syntaxCheckWhenSave())
|
||||
checkSyntaxInBack();
|
||||
reparseTodo();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -328,6 +328,8 @@ bool Editor::saveAs(const QString &name, bool fromProject){
|
|||
|
||||
if (pSettings->editor().syntaxCheckWhenSave())
|
||||
pMainWindow->checkSyntaxInBack(this);
|
||||
reparseTodo();
|
||||
|
||||
|
||||
if (pSettings->editor().readOnlySytemHeader()
|
||||
&& (!mParser->isSystemHeaderFile(mFilename) && !mParser->isProjectHeaderFile(mFilename))) {
|
||||
|
|
|
@ -1114,11 +1114,7 @@ void MainWindow::debug()
|
|||
host.replace('\\','/');
|
||||
mDebugger->sendCommand("exec-file", '"' + host + '"');
|
||||
}
|
||||
for (int i=0;i<mProject->units().count();i++) {
|
||||
QString file = mProject->units()[i]->fileName();
|
||||
file.replace('\\','/');
|
||||
mDebugger->sendCommand("file", '"'+file+ '"');
|
||||
}
|
||||
|
||||
includeOrSkipDirs(mProject->options().includes,
|
||||
pSettings->debugger().skipProjectLibraries());
|
||||
includeOrSkipDirs(mProject->options().libs,
|
||||
|
@ -2535,6 +2531,7 @@ void MainWindow::on_actionOpen_triggered()
|
|||
}
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent *event) {
|
||||
mQuitting = true;
|
||||
if (!mShouldRemoveAllSettings) {
|
||||
Settings::UI& settings = pSettings->ui();
|
||||
settings.setMainWindowState(saveState());
|
||||
|
@ -2558,6 +2555,7 @@ void MainWindow::closeEvent(QCloseEvent *event) {
|
|||
}
|
||||
|
||||
if (!mEditorList->closeAll(false)) {
|
||||
mQuitting = false;
|
||||
event->ignore();
|
||||
return ;
|
||||
}
|
||||
|
@ -2695,6 +2693,8 @@ void MainWindow::onCompilerSetChanged(int index)
|
|||
void MainWindow::onCompileLog(const QString &msg)
|
||||
{
|
||||
ui->txtCompilerOutput->appendPlainText(msg);
|
||||
ui->txtCompilerOutput->moveCursor(QTextCursor::End);
|
||||
ui->txtCompilerOutput->moveCursor(QTextCursor::StartOfLine);
|
||||
ui->txtCompilerOutput->ensureCursorVisible();
|
||||
}
|
||||
|
||||
|
@ -2726,22 +2726,27 @@ void MainWindow::onCompileStarted()
|
|||
ui->txtCompilerOutput->clear();
|
||||
}
|
||||
|
||||
void MainWindow::onCompileFinished()
|
||||
void MainWindow::onCompileFinished(bool isCheckSyntax)
|
||||
{
|
||||
if (mQuitting) {
|
||||
if (isCheckSyntax)
|
||||
mCheckSyntaxInBack = false;
|
||||
else
|
||||
mCompileSuccessionTask = nullptr;
|
||||
return;
|
||||
}
|
||||
// Update tab caption
|
||||
int i = ui->tabMessages->indexOf(ui->tabIssues);
|
||||
if (i==-1)
|
||||
return;
|
||||
ui->tabMessages->setTabText(i, tr("Issues") +
|
||||
if (i==-1) {
|
||||
ui->tabMessages->setTabText(i, tr("Issues") +
|
||||
QString(" (%1)").arg(ui->tableIssues->model()->rowCount()));
|
||||
}
|
||||
|
||||
// Close it if there's nothing to show
|
||||
if (mCheckSyntaxInBack) {
|
||||
if (isCheckSyntax) {
|
||||
// check syntax in back, don't change message panel
|
||||
} else if (
|
||||
(ui->tableIssues->count() == 0)
|
||||
// and (ResourceOutput.Items.Count = 0)
|
||||
// and devData.AutoCloseProgress
|
||||
) {
|
||||
openCloseBottomPanel(false);
|
||||
// Or open it if there is anything to show
|
||||
|
@ -2750,12 +2755,6 @@ void MainWindow::onCompileFinished()
|
|||
if (ui->tabMessages->currentIndex() != i) {
|
||||
ui->tabMessages->setCurrentIndex(i);
|
||||
}
|
||||
// end else if (ResourceOutput.Items.Count > 0) then begin
|
||||
// if MessageControl.ActivePage <> ResSheet then begin
|
||||
// MessageControl.ActivePage := ResSheet;
|
||||
// fMessageControlChanged := False;
|
||||
// end;
|
||||
// end;
|
||||
openCloseBottomPanel(true);
|
||||
}
|
||||
}
|
||||
|
@ -2765,46 +2764,48 @@ void MainWindow::onCompileFinished()
|
|||
e->invalidate();
|
||||
}
|
||||
|
||||
//run succession task if there aren't any errors
|
||||
if (mCompileSuccessionTask && mCompilerManager->compileErrorCount()==0) {
|
||||
QThread::msleep(500); // wait for exec file writed to disk;
|
||||
switch (mCompileSuccessionTask->type) {
|
||||
case MainWindow::CompileSuccessionTaskType::Run:
|
||||
runExecutable(mCompileSuccessionTask->filename);
|
||||
break;
|
||||
case MainWindow::CompileSuccessionTaskType::Debug:
|
||||
debug();
|
||||
break;
|
||||
}
|
||||
mCompileSuccessionTask.reset();
|
||||
// Jump to problem location, sorted by significance
|
||||
} else if ((mCompilerManager->compileIssueCount() > 0) && (!mCheckSyntaxInBack)) {
|
||||
// First try to find errors
|
||||
for (int i=0;i<ui->tableIssues->count();i++) {
|
||||
PCompileIssue issue = ui->tableIssues->issue(i);
|
||||
if (issue->type == CompileIssueType::Error) {
|
||||
if (e && e->filename() != issue->filename)
|
||||
continue;
|
||||
ui->tableIssues->selectRow(i);
|
||||
QModelIndex index =ui->tableIssues->model()->index(i,0);
|
||||
emit ui->tableIssues->doubleClicked(index);
|
||||
if (!isCheckSyntax) {
|
||||
//run succession task if there aren't any errors
|
||||
if (mCompileSuccessionTask && mCompilerManager->compileErrorCount()==0) {
|
||||
switch (mCompileSuccessionTask->type) {
|
||||
case MainWindow::CompileSuccessionTaskType::Run:
|
||||
runExecutable(mCompileSuccessionTask->filename);
|
||||
break;
|
||||
case MainWindow::CompileSuccessionTaskType::Debug:
|
||||
debug();
|
||||
break;
|
||||
}
|
||||
}
|
||||
mCompileSuccessionTask.reset();
|
||||
// Jump to problem location, sorted by significance
|
||||
} else if ((mCompilerManager->compileIssueCount() > 0) && (!mCheckSyntaxInBack)) {
|
||||
// First try to find errors
|
||||
for (int i=0;i<ui->tableIssues->count();i++) {
|
||||
PCompileIssue issue = ui->tableIssues->issue(i);
|
||||
if (issue->type == CompileIssueType::Error) {
|
||||
if (e && e->filename() != issue->filename)
|
||||
continue;
|
||||
ui->tableIssues->selectRow(i);
|
||||
QModelIndex index =ui->tableIssues->model()->index(i,0);
|
||||
emit ui->tableIssues->doubleClicked(index);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Then try to find warnings
|
||||
for (int i=0;i<ui->tableIssues->count();i++) {
|
||||
PCompileIssue issue = ui->tableIssues->issue(i);
|
||||
if (issue->type == CompileIssueType::Warning) {
|
||||
if (e && e->filename() != issue->filename)
|
||||
continue;
|
||||
ui->tableIssues->selectRow(i);
|
||||
QModelIndex index =ui->tableIssues->model()->index(i,0);
|
||||
emit ui->tableIssues->doubleClicked(index);
|
||||
// Then try to find warnings
|
||||
for (int i=0;i<ui->tableIssues->count();i++) {
|
||||
PCompileIssue issue = ui->tableIssues->issue(i);
|
||||
if (issue->type == CompileIssueType::Warning) {
|
||||
if (e && e->filename() != issue->filename)
|
||||
continue;
|
||||
ui->tableIssues->selectRow(i);
|
||||
QModelIndex index =ui->tableIssues->model()->index(i,0);
|
||||
emit ui->tableIssues->doubleClicked(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mCheckSyntaxInBack=false;
|
||||
}
|
||||
mCheckSyntaxInBack=false;
|
||||
updateCompileActions();
|
||||
updateAppTitle();
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ public slots:
|
|||
void onCompileLog(const QString& msg);
|
||||
void onCompileIssue(PCompileIssue issue);
|
||||
void onCompileStarted();
|
||||
void onCompileFinished();
|
||||
void onCompileFinished(bool isCheckSyntax);
|
||||
void onCompileErrorOccured(const QString& reason);
|
||||
void onRunErrorOccured(const QString& reason);
|
||||
void onRunFinished();
|
||||
|
|
|
@ -283,7 +283,7 @@
|
|||
<enum>QTabWidget::South</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>3</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tabIssues">
|
||||
<attribute name="icon">
|
||||
|
|
|
@ -2210,10 +2210,11 @@ static void setReleaseOptions(Settings::PCompilerSet pSet) {
|
|||
pSet->setOption(pOption,'1');
|
||||
}
|
||||
|
||||
pOption = pSet->findOption("-static");
|
||||
if (pOption) {
|
||||
pSet->setOption(pOption,'1');
|
||||
}
|
||||
// pOption = pSet->findOption("-static");
|
||||
// if (pOption) {
|
||||
// pSet->setOption(pOption,'1');
|
||||
// }
|
||||
pSet->setStaticLink(true);
|
||||
}
|
||||
|
||||
static void setDebugOptions(Settings::PCompilerSet pSet) {
|
||||
|
@ -2229,10 +2230,11 @@ static void setDebugOptions(Settings::PCompilerSet pSet) {
|
|||
if (pOption) {
|
||||
pSet->setOption(pOption,'1');
|
||||
}
|
||||
pOption = pSet->findOption("-static");
|
||||
if (pOption) {
|
||||
pSet->setOption(pOption,'1');
|
||||
}
|
||||
// pOption = pSet->findOption("-static");
|
||||
// if (pOption) {
|
||||
// pSet->setOption(pOption,'1');
|
||||
// }
|
||||
pSet->setStaticLink(false);
|
||||
}
|
||||
|
||||
static void setProfileOptions(Settings::PCompilerSet pSet) {
|
||||
|
@ -2241,10 +2243,11 @@ static void setProfileOptions(Settings::PCompilerSet pSet) {
|
|||
pSet->setOption(pOption,'1');
|
||||
}
|
||||
|
||||
pOption = pSet->findOption("-static");
|
||||
if (pOption) {
|
||||
pSet->setOption(pOption,'1');
|
||||
}
|
||||
// pOption = pSet->findOption("-static");
|
||||
// if (pOption) {
|
||||
// pSet->setOption(pOption,'1');
|
||||
// }
|
||||
pSet->setStaticLink(false);
|
||||
}
|
||||
|
||||
void Settings::CompilerSets::addSets(const QString &folder)
|
||||
|
|
Loading…
Reference in New Issue