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)
- fix: language options in the project wizard don'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
- fix: can't correctly undo/redo indent

View File

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

View File

@ -22,6 +22,7 @@
#include "editor.h"
#include "project.h"
#include "version.h"
#include "compiler/executablerunner.h"
const QByteArray GuessTextEncoding(const QByteArray& text){
bool allAscii;
@ -826,6 +827,30 @@ QString parseMacros(const QString &s)
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)
{
QFile file(fileName);

View File

@ -8,6 +8,7 @@
#include <QRect>
#include <QStringList>
#include <memory>
#include <QThread>
#include "SimpleIni.h"
using SimpleIni = CSimpleIniA;
@ -121,6 +122,8 @@ 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);

View File

@ -87,7 +87,7 @@ string GetCommand(int argc,char** argv,bool &reInp,bool &pauseAfterExit) {
// 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("\"");
// Add a space except for the last argument