work save

This commit is contained in:
Roy Qu 2021-12-09 09:27:46 +08:00
parent 319c26902c
commit 1a3df76068
5 changed files with 51 additions and 12 deletions

View File

@ -2,6 +2,9 @@ Version 0.11.0 For Dev-C++ 7 Beta
- enhancement: use token list instead of single string to do code completion ( intial version) - enhancement: use token list instead of single string to do code completion ( intial version)
- fix: language options in the project wizard don't work - fix: language options in the project wizard don't work
- fix: "ake as default language" option in the project wizard doesn't work - fix: "ake as default language" option in the project wizard doesn't work
- fix: typo errors in settings dialog
- enhancement: console pauser clears STDIN buffer before show "press any key to continue..."
- fix: path in macros should use system's path separator
Version 0.10.4 For Dev-C++ 7 Beta Version 0.10.4 For Dev-C++ 7 Beta
- fix: can't correctly undo/redo indent - fix: can't correctly undo/redo indent

View File

@ -1803,18 +1803,26 @@ void MainWindow::updateTools()
QAction* action = new QAction(item->title,ui->menuTools); QAction* action = new QAction(item->title,ui->menuTools);
connect(action, &QAction::triggered, connect(action, &QAction::triggered,
[item] (){ [item] (){
if (item->pauseAfterExit QString program = parseMacros(item->program);
&& programHasConsole(parseMacros(item->program))) { QString workDir = parseMacros(item->workingDirectory);
executeFile( if (program == "del") {
includeTrailingPathDelimiter(pSettings->dirs().app())+"ConsolePauser.exe", QString current = QDir::currentPath();
" 0 \""+parseMacros(item->program)+"\" "+parseMacros(item->parameters), QDir::setCurrent(workDir);
parseMacros(item->workingDirectory)); qDebug()<<(program+" "+parseMacros(item->parameters));
system((program+" "+parseMacros(item->parameters)).toLocal8Bit());
QDir::setCurrent(current);
} else { } else {
executeFile( if (item->pauseAfterExit) {
parseMacros(item->program), executeFile(
parseMacros(item->parameters), includeTrailingPathDelimiter(pSettings->dirs().app())+"ConsolePauser.exe",
parseMacros(item->workingDirectory)); " 0 \""+localizePath(program)+"\" "+parseMacros(item->parameters),
workDir);
} else {
executeFile(
program,
parseMacros(item->parameters),
workDir);
}
} }
}); });
ui->menuTools->addAction(action); ui->menuTools->addAction(action);

View File

@ -22,6 +22,7 @@
#include "editor.h" #include "editor.h"
#include "project.h" #include "project.h"
#include "version.h" #include "version.h"
#include "compiler/executablerunner.h"
const QByteArray GuessTextEncoding(const QByteArray& text){ const QByteArray GuessTextEncoding(const QByteArray& text){
bool allAscii; bool allAscii;
@ -826,6 +827,30 @@ QString parseMacros(const QString &s)
return result; return result;
} }
void executeFile(const QString &fileName, const QString &params, const QString &workingDir)
{
qDebug()<<fileName;
qDebug()<<params;
qDebug()<<workingDir;
ExecutableRunner* runner=new ExecutableRunner(
fileName,
params,
workingDir);
runner->connect(runner, &QThread::finished,
[runner](){
qDebug()<<"finished";
runner->deleteLater();
});
runner->connect(runner, &Runner::runErrorOccurred,
[](const QString& s){
qDebug()<<"error occured";
qDebug()<<s;
});
qDebug()<<"running";
runner->setStartConsole(true);
runner->start();
}
void stringToFile(const QString &str, const QString &fileName) void stringToFile(const QString &str, const QString &fileName)
{ {
QFile file(fileName); QFile file(fileName);

View File

@ -8,6 +8,7 @@
#include <QRect> #include <QRect>
#include <QStringList> #include <QStringList>
#include <memory> #include <memory>
#include <QThread>
#include "SimpleIni.h" #include "SimpleIni.h"
using SimpleIni = CSimpleIniA; using SimpleIni = CSimpleIniA;
@ -121,6 +122,8 @@ QByteArray runAndGetOutput(const QString& cmd, const QString& workingDir, const
const QByteArray& inputContent = QByteArray(), const QByteArray& inputContent = QByteArray(),
bool inheritEnvironment = false); bool inheritEnvironment = false);
void executeFile(const QString& fileName, const QString& params, const QString& workingDir);
bool isNonPrintableAsciiChar(char ch); bool isNonPrintableAsciiChar(char ch);
bool fileExists(const QString& file); bool fileExists(const QString& file);

View File

@ -87,7 +87,7 @@ string GetCommand(int argc,char** argv,bool &reInp,bool &pauseAfterExit) {
// result += string(argv[i]); // result += string(argv[i]);
// } // }
*/ */
// Quote the first argument in case the path name contains spaces // Quote the argument in case the path name contains spaces
result += string("\"") + string(argv[i]) + string("\""); result += string("\"") + string(argv[i]) + string("\"");
// Add a space except for the last argument // Add a space except for the last argument