From ee3864f5656cde1e5d2c244caa00b9f22c98e152 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Wed, 8 Dec 2021 22:47:28 +0800 Subject: [PATCH] work save --- RedPandaIDE/editor.cpp | 2 +- RedPandaIDE/mainwindow.cpp | 24 +++++++++---------- RedPandaIDE/settingsdialog/settingsdialog.cpp | 2 +- RedPandaIDE/settingsdialog/settingsdialog.h | 2 +- RedPandaIDE/utils.cpp | 11 --------- RedPandaIDE/utils.h | 2 -- 6 files changed, 14 insertions(+), 29 deletions(-) diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index c0e8fb10..003d04b4 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -2678,7 +2678,7 @@ void Editor::showCompletion(const QString& preWord,bool autoComplete) caretXY(), memberOperator, memberExpression); - qDebug()<prepareSearch( preWord, diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index f7f4c372..9276e452 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -1802,20 +1802,18 @@ void MainWindow::updateTools() foreach (const PToolItem& item, mToolsManager->tools()) { QAction* action = new QAction(item->title,ui->menuTools); connect(action, &QAction::triggered, - [item] (){ - if (item->pauseAfterExit - && programHasConsole(parseMacros(item->program))) { - executeFile( - includeTrailingPathDelimiter(pSettings->dirs().app())+"ConsolePauser.exe", - " 0 \""+parseMacros(item->program)+"\" "+parseMacros(item->parameters), - parseMacros(item->workingDirectory)); - } else { - executeFile( + [item,this] (){ + QString params = parseMacros(item->parameters); + params.replace("/",QDir::separator()); + QByteArray newContent = runAndGetOutput( parseMacros(item->program), - parseMacros(item->parameters), - parseMacros(item->workingDirectory)); - - } + parseMacros(item->workingDirectory), + QProcess::splitCommand(params), + QByteArray(), + true + ); + qDebug()<<"running"<program; + ui->txtCompilerOutput->appendPlainText(QString::fromLocal8Bit(newContent)); }); ui->menuTools->addAction(action); } diff --git a/RedPandaIDE/settingsdialog/settingsdialog.cpp b/RedPandaIDE/settingsdialog/settingsdialog.cpp index 646993ef..c336b49b 100644 --- a/RedPandaIDE/settingsdialog/settingsdialog.cpp +++ b/RedPandaIDE/settingsdialog/settingsdialog.cpp @@ -301,7 +301,7 @@ void SettingsDialog::widget_settings_changed(bool value) ui->btnApply->setEnabled(value); } -void SettingsDialog::on_btnCancle_pressed() +void SettingsDialog::on_btnCancel_pressed() { this->close(); } diff --git a/RedPandaIDE/settingsdialog/settingsdialog.h b/RedPandaIDE/settingsdialog/settingsdialog.h index e9f56163..d7197981 100644 --- a/RedPandaIDE/settingsdialog/settingsdialog.h +++ b/RedPandaIDE/settingsdialog/settingsdialog.h @@ -39,7 +39,7 @@ private slots: void widget_settings_changed(bool value); void on_widgetsView_clicked(const QModelIndex &index); - void on_btnCancle_pressed(); + void on_btnCancel_pressed(); void on_btnApply_pressed(); diff --git a/RedPandaIDE/utils.cpp b/RedPandaIDE/utils.cpp index a30da405..c99c2526 100644 --- a/RedPandaIDE/utils.cpp +++ b/RedPandaIDE/utils.cpp @@ -829,17 +829,6 @@ QString parseMacros(const QString &s) return result; } -void executeFile(const QString &fileName, const QString ¶ms, const QString &workingDir) -{ - ShellExecuteA(NULL, - NULL, - fileName.toLocal8Bit(), - params.toLocal8Bit(), - workingDir.toLocal8Bit(), - SW_SHOW - ); -} - void stringToFile(const QString &str, const QString &fileName) { QFile file(fileName); diff --git a/RedPandaIDE/utils.h b/RedPandaIDE/utils.h index 7380e2f4..cf10d8df 100644 --- a/RedPandaIDE/utils.h +++ b/RedPandaIDE/utils.h @@ -121,8 +121,6 @@ QByteArray runAndGetOutput(const QString& cmd, const QString& workingDir, const const QByteArray& inputContent = QByteArray(), bool inheritEnvironment = false); -void executeFile(const QString& fileName, const QString& params, const QString& workingDir); - bool isNonPrintableAsciiChar(char ch); bool fileExists(const QString& file);