update translations
This commit is contained in:
parent
1a3df76068
commit
1df289c131
1
NEWS.md
1
NEWS.md
|
@ -5,6 +5,7 @@ Version 0.11.0 For Dev-C++ 7 Beta
|
||||||
- fix: typo errors in settings dialog
|
- fix: typo errors in settings dialog
|
||||||
- enhancement: console pauser clears STDIN buffer before show "press any key to continue..."
|
- enhancement: console pauser clears STDIN buffer before show "press any key to continue..."
|
||||||
- fix: path in macros should use system's path separator
|
- 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
|
Version 0.10.4 For Dev-C++ 7 Beta
|
||||||
- fix: can't correctly undo/redo indent
|
- fix: can't correctly undo/redo indent
|
||||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
@ -36,6 +36,7 @@
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
#include <QTcpSocket>
|
#include <QTcpSocket>
|
||||||
|
#include <QTemporaryFile>
|
||||||
#include <QTextBlock>
|
#include <QTextBlock>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
|
|
||||||
|
@ -1800,30 +1801,48 @@ void MainWindow::updateTools()
|
||||||
if (!mToolsManager->tools().isEmpty()) {
|
if (!mToolsManager->tools().isEmpty()) {
|
||||||
ui->menuTools->addSeparator();
|
ui->menuTools->addSeparator();
|
||||||
foreach (const PToolItem& item, mToolsManager->tools()) {
|
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,
|
connect(action, &QAction::triggered,
|
||||||
[item] (){
|
[item] (){
|
||||||
QString program = parseMacros(item->program);
|
QString program = parseMacros(item->program);
|
||||||
QString workDir = parseMacros(item->workingDirectory);
|
QString workDir = parseMacros(item->workingDirectory);
|
||||||
if (program == "del") {
|
QString params = parseMacros(item->parameters);
|
||||||
QString current = QDir::currentPath();
|
if (!program.endsWith(".bat",Qt::CaseInsensitive)) {
|
||||||
QDir::setCurrent(workDir);
|
QTemporaryFile file(QDir::tempPath()+QDir::separator()+"XXXXXX.bat");
|
||||||
qDebug()<<(program+" "+parseMacros(item->parameters));
|
file.setAutoRemove(false);
|
||||||
system((program+" "+parseMacros(item->parameters)).toLocal8Bit());
|
if (file.open()) {
|
||||||
QDir::setCurrent(current);
|
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 {
|
} else {
|
||||||
if (item->pauseAfterExit) {
|
if (item->pauseAfterExit) {
|
||||||
executeFile(
|
executeFile(
|
||||||
includeTrailingPathDelimiter(pSettings->dirs().app())+"ConsolePauser.exe",
|
includeTrailingPathDelimiter(pSettings->dirs().app())+"ConsolePauser.exe",
|
||||||
" 0 \""+localizePath(program)+"\" "+parseMacros(item->parameters),
|
" 1 \""+program+"\" "+params,
|
||||||
workDir);
|
workDir, "");
|
||||||
} else {
|
} else {
|
||||||
executeFile(
|
executeFile(
|
||||||
program,
|
program,
|
||||||
parseMacros(item->parameters),
|
params,
|
||||||
workDir);
|
workDir, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
ui->menuTools->addAction(action);
|
ui->menuTools->addAction(action);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ ToolsGeneralWidget::ToolsGeneralWidget(const QString &name, const QString &group
|
||||||
finishEditing(false);
|
finishEditing(false);
|
||||||
connect(ui->lstTools->selectionModel(), &QItemSelectionModel::currentRowChanged,
|
connect(ui->lstTools->selectionModel(), &QItemSelectionModel::currentRowChanged,
|
||||||
this,&ToolsGeneralWidget::onToolsCurrentChanged);
|
this,&ToolsGeneralWidget::onToolsCurrentChanged);
|
||||||
connect(ui->txtDirectory,&QLineEdit::textChanged,
|
connect(ui->txtProgram,&QLineEdit::textChanged,
|
||||||
this, &ToolsGeneralWidget::updateDemo);
|
this, &ToolsGeneralWidget::updateDemo);
|
||||||
connect(ui->txtParameters,&QLineEdit::textChanged,
|
connect(ui->txtParameters,&QLineEdit::textChanged,
|
||||||
this, &ToolsGeneralWidget::updateDemo);
|
this, &ToolsGeneralWidget::updateDemo);
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
# define PATH_SENSITIVITY Qt::CaseInsensitive
|
# define PATH_SENSITIVITY Qt::CaseInsensitive
|
||||||
# define PATH_SEPARATOR ";"
|
# define PATH_SEPARATOR ";"
|
||||||
|
# define LINE_BREAKER "\r\n"
|
||||||
# define NULL_FILE "NUL"
|
# define NULL_FILE "NUL"
|
||||||
# define EXECUTABLE_EXT "exe"
|
# define EXECUTABLE_EXT "exe"
|
||||||
# define STATIC_LIB_EXT "a"
|
# define STATIC_LIB_EXT "a"
|
||||||
|
@ -60,6 +61,7 @@
|
||||||
#elif defined(Q_OS_LINUX)
|
#elif defined(Q_OS_LINUX)
|
||||||
# define PATH_SENSITIVITY Qt::CaseSensitive
|
# define PATH_SENSITIVITY Qt::CaseSensitive
|
||||||
# define PATH_SEPARATOR ":"
|
# define PATH_SEPARATOR ":"
|
||||||
|
# define LINE_BREAKER "\n"
|
||||||
# define NULL_FILE "/dev/null"
|
# define NULL_FILE "/dev/null"
|
||||||
# define EXECUTABLE_EXT ""
|
# define EXECUTABLE_EXT ""
|
||||||
# define STATIC_LIB_EXT "a"
|
# define STATIC_LIB_EXT "a"
|
||||||
|
|
|
@ -786,30 +786,27 @@ QString parseMacros(const QString &s)
|
||||||
result.replace("<LIB>","");
|
result.replace("<LIB>","");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Project-dependent macros
|
if (e!=nullptr && !e->inProject()) { // Non-project editor macros
|
||||||
if (pMainWindow->project()) {
|
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("<EXENAME>", extractFileName(pMainWindow->project()->executable()));
|
||||||
result.replace("<EXEFILE>", localizePath(pMainWindow->project()->executable()));
|
result.replace("<EXEFILE>", localizePath(pMainWindow->project()->executable()));
|
||||||
result.replace("<PROJECTNAME>", pMainWindow->project()->name());
|
result.replace("<PROJECTNAME>", pMainWindow->project()->name());
|
||||||
result.replace("<PROJECTFILE>", localizePath(pMainWindow->project()->filename()));
|
result.replace("<PROJECTFILE>", localizePath(pMainWindow->project()->filename()));
|
||||||
result.replace("<PROJECTFILENAME>", extractFileName(pMainWindow->project()->filename()));
|
result.replace("<PROJECTFILENAME>", extractFileName(pMainWindow->project()->filename()));
|
||||||
result.replace("<PROJECTPATH>", localizePath(pMainWindow->project()->directory()));
|
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 {
|
} else {
|
||||||
result.replace("<EXENAME>", "");
|
result.replace("<EXENAME>", "");
|
||||||
|
result.replace("<EXEFILE>", "");
|
||||||
result.replace("<PROJECTNAME>", "");
|
result.replace("<PROJECTNAME>", "");
|
||||||
result.replace("<PROJECTFILE>", "");
|
result.replace("<PROJECTFILE>", "");
|
||||||
|
result.replace("<PROJECTFILENAME>", "");
|
||||||
result.replace("<PROJECTPATH>", "");
|
result.replace("<PROJECTPATH>", "");
|
||||||
// result.replace("<SOURCESPCLIST>", ""); // clear unchanged macros
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Editor macros
|
// Editor macros
|
||||||
|
@ -827,26 +824,23 @@ QString parseMacros(const QString &s)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void executeFile(const QString &fileName, const QString ¶ms, const QString &workingDir)
|
void executeFile(const QString &fileName, const QString ¶ms, const QString &workingDir, const QString &tempFile)
|
||||||
{
|
{
|
||||||
qDebug()<<fileName;
|
|
||||||
qDebug()<<params;
|
|
||||||
qDebug()<<workingDir;
|
|
||||||
ExecutableRunner* runner=new ExecutableRunner(
|
ExecutableRunner* runner=new ExecutableRunner(
|
||||||
fileName,
|
fileName,
|
||||||
params,
|
params,
|
||||||
workingDir);
|
workingDir);
|
||||||
runner->connect(runner, &QThread::finished,
|
runner->connect(runner, &QThread::finished,
|
||||||
[runner](){
|
[runner,tempFile](){
|
||||||
qDebug()<<"finished";
|
if (!tempFile.isEmpty()) {
|
||||||
|
QFile::remove(tempFile);
|
||||||
|
}
|
||||||
runner->deleteLater();
|
runner->deleteLater();
|
||||||
});
|
});
|
||||||
runner->connect(runner, &Runner::runErrorOccurred,
|
runner->connect(runner, &Runner::runErrorOccurred,
|
||||||
[](const QString& s){
|
[](const QString&){
|
||||||
qDebug()<<"error occured";
|
//todo
|
||||||
qDebug()<<s;
|
|
||||||
});
|
});
|
||||||
qDebug()<<"running";
|
|
||||||
runner->setStartConsole(true);
|
runner->setStartConsole(true);
|
||||||
runner->start();
|
runner->start();
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,10 @@ 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);
|
void executeFile(const QString& fileName,
|
||||||
|
const QString& params,
|
||||||
|
const QString& workingDir,
|
||||||
|
const QString& tempFile);
|
||||||
|
|
||||||
bool isNonPrintableAsciiChar(char ch);
|
bool isNonPrintableAsciiChar(char ch);
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
MacroInfoModel::MacroInfoModel(QObject *parent) : QAbstractListModel(parent)
|
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("<DEVCPP>", tr("Path to the Red Panda C++'s executable file."));
|
||||||
addMacroInfo("<DEVCPPVERSION>", tr("Version of the Red Panda C++"));
|
addMacroInfo("<DEVCPPVERSION>", tr("Version of the Red Panda C++"));
|
||||||
addMacroInfo("<EXECPATH>", tr("PATH to the Red Panda C++'s installation folder."));
|
addMacroInfo("<EXECPATH>", tr("PATH to the Red Panda C++'s installation folder."));
|
||||||
|
|
|
@ -78,15 +78,6 @@ string GetCommand(int argc,char** argv,bool &reInp,bool &pauseAfterExit) {
|
||||||
reInp = flags & RPF_REDIRECT_INPUT;
|
reInp = flags & RPF_REDIRECT_INPUT;
|
||||||
pauseAfterExit = flags & RPF_PAUSE_CONSOLE;
|
pauseAfterExit = flags & RPF_PAUSE_CONSOLE;
|
||||||
for(int i = 2;i < argc;i++) {
|
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
|
// Quote the argument in case the path name contains spaces
|
||||||
result += string("\"") + string(argv[i]) + string("\"");
|
result += string("\"") + string(argv[i]) + string("\"");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue