update translations

This commit is contained in:
Roy Qu 2021-12-09 11:22:28 +08:00
parent 1a3df76068
commit 1df289c131
10 changed files with 314 additions and 293 deletions

View File

@ -5,6 +5,7 @@ Version 0.11.0 For Dev-C++ 7 Beta
- 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
- fix: custom tools doesn't work
Version 0.10.4 For Dev-C++ 7 Beta
- fix: can't correctly undo/redo indent

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -36,6 +36,7 @@
#include <QMessageBox>
#include <QMimeData>
#include <QTcpSocket>
#include <QTemporaryFile>
#include <QTextBlock>
#include <QTranslator>
@ -1800,30 +1801,48 @@ void MainWindow::updateTools()
if (!mToolsManager->tools().isEmpty()) {
ui->menuTools->addSeparator();
foreach (const PToolItem& item, mToolsManager->tools()) {
QAction* action = new QAction(item->title,ui->menuTools);
QAction* action = new QAction(tr(item->title.toUtf8()),ui->menuTools);
connect(action, &QAction::triggered,
[item] (){
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);
QString params = parseMacros(item->parameters);
if (!program.endsWith(".bat",Qt::CaseInsensitive)) {
QTemporaryFile file(QDir::tempPath()+QDir::separator()+"XXXXXX.bat");
file.setAutoRemove(false);
if (file.open()) {
file.write(QString("cd /d \"%1\"")
.arg(localizePath(workDir))
.toLocal8Bit()+LINE_BREAKER);
file.write((program+" "+params).toLocal8Bit()
+ LINE_BREAKER);
file.close();
if (item->pauseAfterExit) {
executeFile(
includeTrailingPathDelimiter(pSettings->dirs().app())+"ConsolePauser.exe",
" 1 \""+localizePath(file.fileName())+"\" ",
workDir, file.fileName());
} else {
executeFile(
file.fileName(),
"",
workDir, file.fileName());
}
}
} else {
if (item->pauseAfterExit) {
executeFile(
includeTrailingPathDelimiter(pSettings->dirs().app())+"ConsolePauser.exe",
" 0 \""+localizePath(program)+"\" "+parseMacros(item->parameters),
workDir);
" 1 \""+program+"\" "+params,
workDir, "");
} else {
executeFile(
program,
parseMacros(item->parameters),
workDir);
params,
workDir, "");
}
}
});
ui->menuTools->addAction(action);
}

View File

@ -17,7 +17,7 @@ ToolsGeneralWidget::ToolsGeneralWidget(const QString &name, const QString &group
finishEditing(false);
connect(ui->lstTools->selectionModel(), &QItemSelectionModel::currentRowChanged,
this,&ToolsGeneralWidget::onToolsCurrentChanged);
connect(ui->txtDirectory,&QLineEdit::textChanged,
connect(ui->txtProgram,&QLineEdit::textChanged,
this, &ToolsGeneralWidget::updateDemo);
connect(ui->txtParameters,&QLineEdit::textChanged,
this, &ToolsGeneralWidget::updateDemo);

View File

@ -52,6 +52,7 @@
#ifdef Q_OS_WIN
# define PATH_SENSITIVITY Qt::CaseInsensitive
# define PATH_SEPARATOR ";"
# define LINE_BREAKER "\r\n"
# define NULL_FILE "NUL"
# define EXECUTABLE_EXT "exe"
# define STATIC_LIB_EXT "a"
@ -60,6 +61,7 @@
#elif defined(Q_OS_LINUX)
# define PATH_SENSITIVITY Qt::CaseSensitive
# define PATH_SEPARATOR ":"
# define LINE_BREAKER "\n"
# define NULL_FILE "/dev/null"
# define EXECUTABLE_EXT ""
# define STATIC_LIB_EXT "a"

View File

@ -786,30 +786,27 @@ QString parseMacros(const QString &s)
result.replace("<LIB>","");
}
// Project-dependent macros
if (pMainWindow->project()) {
if (e!=nullptr && !e->inProject()) { // Non-project editor macros
result.replace("<EXENAME>", extractFileName(changeFileExt(e->filename(),EXECUTABLE_EXT)));
result.replace("<EXEFILE>", localizePath(changeFileExt(e->filename(),EXECUTABLE_EXT)));
result.replace("<PROJECTNAME>", extractFileName(e->filename()));
result.replace("<PROJECTFILE>", localizePath(e->filename()));
result.replace("<PROJECTFILENAME>", extractFileName(e->filename()));
result.replace("<PROJECTPATH>", localizePath(extractFileDir(e->filename())));
} else if (pMainWindow->project()) {
result.replace("<EXENAME>", extractFileName(pMainWindow->project()->executable()));
result.replace("<EXEFILE>", localizePath(pMainWindow->project()->executable()));
result.replace("<PROJECTNAME>", pMainWindow->project()->name());
result.replace("<PROJECTFILE>", localizePath(pMainWindow->project()->filename()));
result.replace("<PROJECTFILENAME>", extractFileName(pMainWindow->project()->filename()));
result.replace("<PROJECTPATH>", localizePath(pMainWindow->project()->directory()));
// result.replace("<SOURCESPCLIST>', MainForm.Project.ListUnitStr(' '));
// result.replace("<SOURCESPCLIST>","");
} else if (e!=nullptr) { // Non-project editor macros
result.replace("<EXENAME>", extractFileName(changeFileExt(e->filename(),EXECUTABLE_EXT)));
result.replace("<EXEFILE>", localizePath(changeFileExt(e->filename(),EXECUTABLE_EXT)));
result.replace("<PROJECTNAME>", extractFileName(e->filename()));
result.replace("<PROJECTFILE>", localizePath(e->filename()));
result.replace("<PROJECTFILENAME>", extractFileName(e->filename()));
result.replace("<PROJECTPATH>", localizePath(extractFileDir(e->filename())));
// result.replace("<SOURCESPCLIST>", ""); // clear unchanged macros
} else {
result.replace("<EXENAME>", "");
result.replace("<EXEFILE>", "");
result.replace("<PROJECTNAME>", "");
result.replace("<PROJECTFILE>", "");
result.replace("<PROJECTFILENAME>", "");
result.replace("<PROJECTPATH>", "");
// result.replace("<SOURCESPCLIST>", ""); // clear unchanged macros
}
// Editor macros
@ -827,26 +824,23 @@ QString parseMacros(const QString &s)
return result;
}
void executeFile(const QString &fileName, const QString &params, const QString &workingDir)
void executeFile(const QString &fileName, const QString &params, const QString &workingDir, const QString &tempFile)
{
qDebug()<<fileName;
qDebug()<<params;
qDebug()<<workingDir;
ExecutableRunner* runner=new ExecutableRunner(
fileName,
params,
workingDir);
runner->connect(runner, &QThread::finished,
[runner](){
qDebug()<<"finished";
[runner,tempFile](){
if (!tempFile.isEmpty()) {
QFile::remove(tempFile);
}
runner->deleteLater();
});
runner->connect(runner, &Runner::runErrorOccurred,
[](const QString& s){
qDebug()<<"error occured";
qDebug()<<s;
[](const QString&){
//todo
});
qDebug()<<"running";
runner->setStartConsole(true);
runner->start();
}

View File

@ -122,7 +122,10 @@ 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);
void executeFile(const QString& fileName,
const QString& params,
const QString& workingDir,
const QString& tempFile);
bool isNonPrintableAsciiChar(char ch);

View File

@ -2,7 +2,7 @@
MacroInfoModel::MacroInfoModel(QObject *parent) : QAbstractListModel(parent)
{
addMacroInfo("<Default>", tr("The default directory"));
addMacroInfo("<DEFAULT>", tr("The default directory"));
addMacroInfo("<DEVCPP>", tr("Path to the Red Panda C++'s executable file."));
addMacroInfo("<DEVCPPVERSION>", tr("Version of the Red Panda C++"));
addMacroInfo("<EXECPATH>", tr("PATH to the Red Panda C++'s installation folder."));

View File

@ -78,15 +78,6 @@ string GetCommand(int argc,char** argv,bool &reInp,bool &pauseAfterExit) {
reInp = flags & RPF_REDIRECT_INPUT;
pauseAfterExit = flags & RPF_PAUSE_CONSOLE;
for(int i = 2;i < argc;i++) {
/*
// Quote the first argument in case the path name contains spaces
// if(i == 1) {
// result += string("\"") + string(argv[i]) + string("\"");
// } else {
// Quote the first argument in case the path name contains spaces
// result += string(argv[i]);
// }
*/
// Quote the argument in case the path name contains spaces
result += string("\"") + string(argv[i]) + string("\"");