整体一次性提交2.0的代码

This commit is contained in:
爬山虎
2023-05-13 16:42:48 +08:00
parent 11cf3364da
commit bce032f974
193 changed files with 12663 additions and 7871 deletions
+19 -47
View File
@@ -3,6 +3,7 @@
#include "ccnotepad.h"
#include "progresswin.h"
#include "nddsetting.h"
#include "ctipwin.h"
#include <QTableWidgetItem>
#include <QFileDialog>
@@ -172,42 +173,25 @@ void BatchFindReplace::on_findBtClick()
if (m_mainNotepad != nullptr && m_mainNotepad)
{
int rowNums = ui.findReplaceTable->rowCount();
if (rowNums == 0)
{
CTipWin::showTips(this, tr("Please fresh first !"), 1200);
return;
}
ProgressWin* loadFileProcessWin = new ProgressWin(this);
loadFileProcessWin->setWindowModality(Qt::WindowModal);
loadFileProcessWin->info(tr("total %1 keyword, please wait ...").arg(rowNums));
loadFileProcessWin->setTotalSteps(rowNums);
loadFileProcessWin->show();
int foundTimes = 0;
QStringList findKeyList;
for (int i = 0; i < rowNums; ++i)
{
QTableWidgetItem* item = ui.findReplaceTable->item(i, 0);
if (item != nullptr && !item->text().isEmpty())
{
if (loadFileProcessWin->isCancel())
{
break;
}
foundTimes += m_mainNotepad->findAtBack(item->text());
loadFileProcessWin->moveStep();
QCoreApplication::processEvents();
findKeyList.append(item->text());
}
}
delete loadFileProcessWin;
foundTimes = m_mainNotepad->findAtBack(findKeyList);
ui.statusBar->showMessage(tr("Batch Find Finished! total %1 found.").arg(foundTimes),10000);
}
@@ -216,11 +200,15 @@ void BatchFindReplace::on_findBtClick()
//进行批量替换工作
void BatchFindReplace::on_replaceBtClick()
{
if (m_mainNotepad != nullptr && m_mainNotepad)
if (m_mainNotepad != nullptr)
{
int rowNums = ui.findReplaceTable->rowCount();
if (rowNums == 0)
{
CTipWin::showTips(this, tr("Please fresh first !"), 1200);
return;
}
int replaceTimes = 0;
QStringList findKeyList;
QStringList replaceKeyList;
@@ -241,9 +229,9 @@ void BatchFindReplace::on_replaceBtClick()
}
}
}
replaceTimes = m_mainNotepad->replaceAtBack(findKeyList, replaceKeyList);
m_mainNotepad->replaceAtBack(findKeyList, replaceKeyList);
ui.statusBar->showMessage(tr("Batch Replace Finished, total Replace %1 times !").arg(replaceTimes), 10000);
ui.statusBar->showMessage(tr("Batch Replace Finished, total Replace %1 times !").arg(findKeyList.size()), 10000);
}
}
@@ -332,40 +320,24 @@ void BatchFindReplace::on_mark()
int rowNums = ui.findReplaceTable->rowCount();
if (rowNums == 0)
{
CTipWin::showTips(this, tr("Please fresh first !"), 1200);
return;
}
int markTimes = 0;
ProgressWin* loadFileProcessWin = new ProgressWin(this);
loadFileProcessWin->setWindowModality(Qt::WindowModal);
loadFileProcessWin->info(tr("total %1 keyword, please wait ...").arg(rowNums));
loadFileProcessWin->setTotalSteps(rowNums);
loadFileProcessWin->show();
QStringList findKeyList;
for (int i = 0; i < rowNums; ++i)
{
QTableWidgetItem* item = ui.findReplaceTable->item(i, 0);
if (item != nullptr && !item->text().isEmpty())
{
if (loadFileProcessWin->isCancel())
{
break;
}
markTimes += m_mainNotepad->markAtBack(item->text());
loadFileProcessWin->moveStep();
QCoreApplication::processEvents();
findKeyList.append(item->text());
}
}
delete loadFileProcessWin;
markTimes = m_mainNotepad->markAtBack(findKeyList);
ui.statusBar->showMessage(tr("Batch Mark Finished, total Mark %1 times !").arg(markTimes), 10000);
}
}