- enhancement: add a demo for custom tool

This commit is contained in:
Roy Qu 2021-12-09 21:04:53 +08:00
parent 1df289c131
commit 3f708cf887
8 changed files with 38 additions and 24 deletions

View File

@ -1,11 +1,12 @@
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
- enhancement: redesign the expression parser for code completion
- fix: "make 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
- fix: custom tools doesn't work
- enhancement: add a demo for custom tool
Version 0.10.4 For Dev-C++ 7 Beta
- fix: can't correctly undo/redo indent

Binary file not shown.

View File

@ -7074,34 +7074,39 @@ Are you really want to continue?</source>
<context>
<name>ToolsManager</name>
<message>
<location filename="toolsmanager.cpp" line="26"/>
<location filename="toolsmanager.cpp" line="37"/>
<location filename="toolsmanager.cpp" line="23"/>
<source>Remove Compiled</source>
<translation></translation>
</message>
<message>
<location filename="toolsmanager.cpp" line="35"/>
<location filename="toolsmanager.cpp" line="46"/>
<source>Read tools config failed</source>
<translation></translation>
</message>
<message>
<location filename="toolsmanager.cpp" line="27"/>
<location filename="toolsmanager.cpp" line="36"/>
<source>Can&apos;t open tools config file &apos;%1&apos; for read.</source>
<translation>&apos;%1&apos;</translation>
</message>
<message>
<location filename="toolsmanager.cpp" line="38"/>
<location filename="toolsmanager.cpp" line="47"/>
<source>Read tools config file &apos;%1&apos; failed:%2</source>
<translation>&apos;%1&apos;:%2</translation>
</message>
<message>
<location filename="toolsmanager.cpp" line="65"/>
<location filename="toolsmanager.cpp" line="84"/>
<location filename="toolsmanager.cpp" line="73"/>
<location filename="toolsmanager.cpp" line="92"/>
<source>Save tools config failed</source>
<translation></translation>
</message>
<message>
<location filename="toolsmanager.cpp" line="66"/>
<location filename="toolsmanager.cpp" line="74"/>
<source>Can&apos;t open tools config file &apos;%1&apos; for write.</source>
<translation>&apos;%1&apos;</translation>
</message>
<message>
<location filename="toolsmanager.cpp" line="85"/>
<location filename="toolsmanager.cpp" line="93"/>
<source>Write to tools config file &apos;%1&apos; failed.</source>
<oldsource>Write to tool config file &apos;%1&apos; failed.</oldsource>
<translation>&apos;%1&apos;</translation>

View File

@ -194,9 +194,9 @@ void CodeSnippetsModel::remove(int index)
void CodeSnippetsModel::clear()
{
beginRemoveRows(QModelIndex(),0,mSnippets.count()-1);
beginResetModel();
mSnippets.clear();
endRemoveRows();
endResetModel();
}
QModelIndex CodeSnippetsModel::lastSnippetCaption()

View File

@ -1434,9 +1434,9 @@ void BreakpointModel::addBreakpoint(PBreakpoint p)
void BreakpointModel::clear()
{
beginRemoveRows(QModelIndex(),0,mList.size()-1);
beginResetModel();
mList.clear();
endRemoveRows();
endResetModel();
}
void BreakpointModel::removeBreakpoint(int row)
@ -1640,9 +1640,9 @@ void BacktraceModel::addTrace(PTrace p)
void BacktraceModel::clear()
{
beginRemoveRows(QModelIndex(),0,mList.size()-1);
beginResetModel();
mList.clear();
endRemoveRows();
endResetModel();
}
void BacktraceModel::removeTrace(int row)

View File

@ -1801,7 +1801,7 @@ void MainWindow::updateTools()
if (!mToolsManager->tools().isEmpty()) {
ui->menuTools->addSeparator();
foreach (const PToolItem& item, mToolsManager->tools()) {
QAction* action = new QAction(tr(item->title.toUtf8()),ui->menuTools);
QAction* action = new QAction(item->title,ui->menuTools);
connect(action, &QAction::triggered,
[item] (){
QString program = parseMacros(item->program);

View File

@ -17,8 +17,17 @@ void ToolsManager::load()
{
//if config file not exists, copy it from data
QString filename = includeTrailingPathDelimiter(pSettings->dirs().config()) + DEV_TOOLS_FILE;
if (!fileExists(filename))
if (!fileExists(filename)) {
mTools.clear();
PToolItem item = std::make_shared<ToolItem>();
item->title = tr("Remove Compiled");
item->program = "del";
item->workingDirectory = "<SOURCEPATH>";
item->parameters = "<EXENAME>";
item->pauseAfterExit = false;
mTools.append(item);
return;
}
//read config file
QFile file(filename);
if (!file.open(QFile::ReadOnly)) {
@ -36,8 +45,7 @@ void ToolsManager::load()
QMessageBox::critical(nullptr,
tr("Read tools config failed"),
tr("Read tools config file '%1' failed:%2")
.arg(filename)
.arg(error.errorString()));
.arg(filename,error.errorString()));
return;
}
mTools.clear();

View File

@ -15,9 +15,9 @@ OJProblemSetModel::OJProblemSetModel(QObject *parent) : QAbstractListModel(paren
void OJProblemSetModel::clear()
{
beginRemoveRows(QModelIndex(),0,mProblemSet.problems.count()-1);
beginResetModel();
mProblemSet.problems.clear();
endRemoveRows();
endResetModel();
}
int OJProblemSetModel::count()
@ -261,9 +261,9 @@ void OJProblemModel::clear()
{
if (mProblem==nullptr)
return;
beginRemoveRows(QModelIndex(),0,mProblem->cases.count()-1);
beginResetModel();
mProblem->cases.clear();
endRemoveRows();
endResetModel();
}
int OJProblemModel::count()