- enhancement: Problem Set
- enhancement: Competitive Companion Support - fix: when search in project, files opened for search shouldn't be parsed for symbols. - fix: when search in project, the search history is not correctly updated.
This commit is contained in:
parent
47f10a2105
commit
88a7c46eda
6
NEWS.md
6
NEWS.md
|
@ -1,11 +1,13 @@
|
||||||
Version 0.7.7
|
Version 0.7.7
|
||||||
|
- enhancement: Problem Set
|
||||||
|
- enhancement: Competitive Companion Support
|
||||||
- change: "save" action will be enabled no matter contents in the current editor is modified or not
|
- change: "save" action will be enabled no matter contents in the current editor is modified or not
|
||||||
- fix: focus not correctly set when the current editor is closed
|
- fix: focus not correctly set when the current editor is closed
|
||||||
- fix: can't parse old c-style enum variable definition like "enum Test test;"
|
- fix: can't parse old c-style enum variable definition like "enum Test test;"
|
||||||
- fix: remove the file change monitor if it's remove from the disk
|
- fix: remove the file change monitor if it's remove from the disk
|
||||||
- fix: don't test if a file is writable before save to it (because qt can't do that test reliably).
|
- fix: don't test if a file is writable before save to it (because qt can't do that test reliably).
|
||||||
- enhancement: Problem Set
|
- fix: when search in project, files opened for search shouldn't be parsed for symbols.
|
||||||
- enhancement: Competitive Companion Support
|
- fix: when search in project, the search history is not correctly updated.
|
||||||
|
|
||||||
Version 0.7.6
|
Version 0.7.6
|
||||||
- change: don't auto insert a new line when input an enter between '(' and ')' or between '[' and ']' (indent instead)
|
- change: don't auto insert a new line when input an enter between '(' and ')' or between '[' and ']' (indent instead)
|
||||||
|
|
|
@ -54,6 +54,7 @@ SOURCES += \
|
||||||
settingsdialog/environmentfileassociationwidget.cpp \
|
settingsdialog/environmentfileassociationwidget.cpp \
|
||||||
settingsdialog/environmentfolderswidget.cpp \
|
settingsdialog/environmentfolderswidget.cpp \
|
||||||
settingsdialog/environmentshortcutwidget.cpp \
|
settingsdialog/environmentshortcutwidget.cpp \
|
||||||
|
settingsdialog/executorproblemsetwidget.cpp \
|
||||||
settingsdialog/formattergeneralwidget.cpp \
|
settingsdialog/formattergeneralwidget.cpp \
|
||||||
settingsdialog/projectcompileparamaterswidget.cpp \
|
settingsdialog/projectcompileparamaterswidget.cpp \
|
||||||
settingsdialog/projectcompilerwidget.cpp \
|
settingsdialog/projectcompilerwidget.cpp \
|
||||||
|
@ -173,6 +174,7 @@ HEADERS += \
|
||||||
settingsdialog/environmentfileassociationwidget.h \
|
settingsdialog/environmentfileassociationwidget.h \
|
||||||
settingsdialog/environmentfolderswidget.h \
|
settingsdialog/environmentfolderswidget.h \
|
||||||
settingsdialog/environmentshortcutwidget.h \
|
settingsdialog/environmentshortcutwidget.h \
|
||||||
|
settingsdialog/executorproblemsetwidget.h \
|
||||||
settingsdialog/formattergeneralwidget.h \
|
settingsdialog/formattergeneralwidget.h \
|
||||||
settingsdialog/projectcompileparamaterswidget.h \
|
settingsdialog/projectcompileparamaterswidget.h \
|
||||||
settingsdialog/projectcompilerwidget.h \
|
settingsdialog/projectcompilerwidget.h \
|
||||||
|
@ -262,6 +264,7 @@ FORMS += \
|
||||||
settingsdialog/environmentfileassociationwidget.ui \
|
settingsdialog/environmentfileassociationwidget.ui \
|
||||||
settingsdialog/environmentfolderswidget.ui \
|
settingsdialog/environmentfolderswidget.ui \
|
||||||
settingsdialog/environmentshortcutwidget.ui \
|
settingsdialog/environmentshortcutwidget.ui \
|
||||||
|
settingsdialog/executorproblemsetwidget.ui \
|
||||||
settingsdialog/formattergeneralwidget.ui \
|
settingsdialog/formattergeneralwidget.ui \
|
||||||
settingsdialog/projectcompileparamaterswidget.ui \
|
settingsdialog/projectcompileparamaterswidget.ui \
|
||||||
settingsdialog/projectcompilerwidget.ui \
|
settingsdialog/projectcompilerwidget.ui \
|
||||||
|
|
|
@ -536,10 +536,32 @@ void MainWindow::applySettings()
|
||||||
qApp->setFont(font);
|
qApp->setFont(font);
|
||||||
this->setFont(font);
|
this->setFont(font);
|
||||||
|
|
||||||
if (!mTcpServer.listen(QHostAddress::LocalHost,10045)) {
|
mTcpServer.close();
|
||||||
|
int idxProblem = ui->tabMessages->indexOf(ui->tabProblem);
|
||||||
|
ui->tabMessages->setTabEnabled(idxProblem,pSettings->executor().enableProblemSet());
|
||||||
|
int idxProblemSet = ui->tabInfos->indexOf(ui->tabProblemSet);
|
||||||
|
ui->tabInfos->setTabEnabled(idxProblemSet,pSettings->executor().enableProblemSet());
|
||||||
|
if (pSettings->executor().enableProblemSet()) {
|
||||||
|
if (pSettings->executor().enableCompetitiveCompanion()) {
|
||||||
|
if (!mTcpServer.listen(QHostAddress::LocalHost,pSettings->executor().competivieCompanionPort())) {
|
||||||
QMessageBox::critical(nullptr,
|
QMessageBox::critical(nullptr,
|
||||||
tr("Listen failed"),
|
tr("Listen failed"),
|
||||||
tr("Can't listen to port %1").arg(10045));
|
tr("Can't listen to port %1 form Competitve Companion.").arg(10045)
|
||||||
|
+ "<BR/>"
|
||||||
|
+tr("You can turn off competitive companion support in the Problem Set options.")
|
||||||
|
+ "<BR/>"
|
||||||
|
+tr("Or You can choose a different port number and try again."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (idxProblem<0)
|
||||||
|
ui->tabMessages->addTab(ui->tabProblem,tr("Problem"));
|
||||||
|
if (idxProblemSet<0)
|
||||||
|
ui->tabInfos->addTab(ui->tabProblemSet, tr("Problem Set"));
|
||||||
|
} else {
|
||||||
|
if (idxProblem>=0)
|
||||||
|
ui->tabMessages->removeTab(idxProblem);
|
||||||
|
if (idxProblemSet>=0)
|
||||||
|
ui->tabInfos->removeTab(idxProblemSet);
|
||||||
}
|
}
|
||||||
updateDebuggerSettings();
|
updateDebuggerSettings();
|
||||||
}
|
}
|
||||||
|
@ -3118,7 +3140,7 @@ void MainWindow::closeEvent(QCloseEvent *event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mTcpServer.close();
|
||||||
mCompilerManager->stopCompile();
|
mCompilerManager->stopCompile();
|
||||||
mCompilerManager->stopRun();
|
mCompilerManager->stopRun();
|
||||||
if (!mShouldRemoveAllSettings)
|
if (!mShouldRemoveAllSettings)
|
||||||
|
|
|
@ -2757,6 +2757,36 @@ void Settings::Executor::setInputFilename(const QString &newInputFilename)
|
||||||
mInputFilename = newInputFilename;
|
mInputFilename = newInputFilename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Settings::Executor::competivieCompanionPort() const
|
||||||
|
{
|
||||||
|
return mCompetivieCompanionPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::Executor::setCompetivieCompanionPort(int newCompetivieCompanionPort)
|
||||||
|
{
|
||||||
|
mCompetivieCompanionPort = newCompetivieCompanionPort;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Settings::Executor::enableCompetitiveCompanion() const
|
||||||
|
{
|
||||||
|
return mEnableCompetitiveCompanion;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::Executor::setEnableCompetitiveCompanion(bool newEnableCompetitiveCompanion)
|
||||||
|
{
|
||||||
|
mEnableCompetitiveCompanion = newEnableCompetitiveCompanion;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Settings::Executor::enableProblemSet() const
|
||||||
|
{
|
||||||
|
return mEnableProblemSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::Executor::setEnableProblemSet(bool newEnableProblemSet)
|
||||||
|
{
|
||||||
|
mEnableProblemSet = newEnableProblemSet;
|
||||||
|
}
|
||||||
|
|
||||||
void Settings::Executor::doSave()
|
void Settings::Executor::doSave()
|
||||||
{
|
{
|
||||||
saveValue("pause_console", mPauseConsole);
|
saveValue("pause_console", mPauseConsole);
|
||||||
|
@ -2765,6 +2795,8 @@ void Settings::Executor::doSave()
|
||||||
saveValue("params",mParams);
|
saveValue("params",mParams);
|
||||||
saveValue("redirect_input",mRedirectInput);
|
saveValue("redirect_input",mRedirectInput);
|
||||||
saveValue("input_filename",mInputFilename);
|
saveValue("input_filename",mInputFilename);
|
||||||
|
//problem set
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Settings::Executor::pauseConsole() const
|
bool Settings::Executor::pauseConsole() const
|
||||||
|
@ -2786,6 +2818,9 @@ void Settings::Executor::doLoad()
|
||||||
mRedirectInput = boolValue("redirect_input",false);
|
mRedirectInput = boolValue("redirect_input",false);
|
||||||
mInputFilename = stringValue("input_filename","");
|
mInputFilename = stringValue("input_filename","");
|
||||||
|
|
||||||
|
mEnableProblemSet = boolValue("enable_proble_set",true);
|
||||||
|
mEnableCompetitiveCompanion = boolValue("enable_competivie_companion",true);
|
||||||
|
mCompetivieCompanionPort = intValue("competitive_companion_port",10045);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -763,6 +763,15 @@ public:
|
||||||
const QString &inputFilename() const;
|
const QString &inputFilename() const;
|
||||||
void setInputFilename(const QString &newInputFilename);
|
void setInputFilename(const QString &newInputFilename);
|
||||||
|
|
||||||
|
bool enableProblemSet() const;
|
||||||
|
void setEnableProblemSet(bool newEnableProblemSet);
|
||||||
|
|
||||||
|
bool enableCompetitiveCompanion() const;
|
||||||
|
void setEnableCompetitiveCompanion(bool newEnableCompetitiveCompanion);
|
||||||
|
|
||||||
|
int competivieCompanionPort() const;
|
||||||
|
void setCompetivieCompanionPort(int newCompetivieCompanionPort);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// general
|
// general
|
||||||
bool mPauseConsole;
|
bool mPauseConsole;
|
||||||
|
@ -772,6 +781,11 @@ public:
|
||||||
bool mRedirectInput;
|
bool mRedirectInput;
|
||||||
QString mInputFilename;
|
QString mInputFilename;
|
||||||
|
|
||||||
|
//Problem Set
|
||||||
|
bool mEnableProblemSet;
|
||||||
|
bool mEnableCompetitiveCompanion;
|
||||||
|
int mCompetivieCompanionPort;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void doSave() override;
|
void doSave() override;
|
||||||
void doLoad() override;
|
void doLoad() override;
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
#include "executorproblemsetwidget.h"
|
||||||
|
#include "ui_executorproblemsetwidget.h"
|
||||||
|
#include "../settings.h"
|
||||||
|
#include "../mainwindow.h"
|
||||||
|
|
||||||
|
ExecutorProblemSetWidget::ExecutorProblemSetWidget(const QString& name, const QString& group, QWidget *parent):
|
||||||
|
SettingsWidget(name,group,parent),
|
||||||
|
ui(new Ui::ExecutorProblemSetWidget)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
ExecutorProblemSetWidget::~ExecutorProblemSetWidget()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ExecutorProblemSetWidget::doLoad()
|
||||||
|
{
|
||||||
|
ui->grpProblemSet->setChecked(pSettings->executor().enableProblemSet());
|
||||||
|
ui->grpCompetitiveCompanion->setChecked(pSettings->executor().enableCompetitiveCompanion());
|
||||||
|
ui->spinPortNumber->setValue(pSettings->executor().competivieCompanionPort());
|
||||||
|
}
|
||||||
|
|
||||||
|
void ExecutorProblemSetWidget::doSave()
|
||||||
|
{
|
||||||
|
pSettings->executor().setEnableProblemSet(ui->grpProblemSet->isChecked());
|
||||||
|
pSettings->executor().setEnableCompetitiveCompanion(ui->grpCompetitiveCompanion->isChecked());
|
||||||
|
pSettings->executor().setCompetivieCompanionPort(ui->spinPortNumber->value());
|
||||||
|
pSettings->executor().save();
|
||||||
|
pMainWindow->applySettings();
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
#ifndef EXECUTORPROBLEMSETWIDGET_H
|
||||||
|
#define EXECUTORPROBLEMSETWIDGET_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include "settingswidget.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class ExecutorProblemSetWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
class ExecutorProblemSetWidget : public SettingsWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ExecutorProblemSetWidget(const QString& name, const QString& group, QWidget *parent = nullptr);
|
||||||
|
~ExecutorProblemSetWidget();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::ExecutorProblemSetWidget *ui;
|
||||||
|
protected:
|
||||||
|
void doLoad() override;
|
||||||
|
void doSave() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // EXECUTORPROBLEMSETWIDGET_H
|
|
@ -0,0 +1,88 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>ExecutorProblemSetWidget</class>
|
||||||
|
<widget class="QWidget" name="ExecutorProblemSetWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>400</width>
|
||||||
|
<height>300</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="grpProblemSet">
|
||||||
|
<property name="title">
|
||||||
|
<string>Enable Problem Set</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="grpCompetitiveCompanion">
|
||||||
|
<property name="title">
|
||||||
|
<string>Listen for Competitive Companion</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QSpinBox" name="spinPortNumber">
|
||||||
|
<property name="minimum">
|
||||||
|
<number>1025</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>65535</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Port Number</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
|
@ -19,6 +19,7 @@
|
||||||
#include "environmentfileassociationwidget.h"
|
#include "environmentfileassociationwidget.h"
|
||||||
#include "environmentfolderswidget.h"
|
#include "environmentfolderswidget.h"
|
||||||
#include "executorgeneralwidget.h"
|
#include "executorgeneralwidget.h"
|
||||||
|
#include "executorproblemsetwidget.h"
|
||||||
#include "debuggeneralwidget.h"
|
#include "debuggeneralwidget.h"
|
||||||
#include "formattergeneralwidget.h"
|
#include "formattergeneralwidget.h"
|
||||||
#include "projectgeneralwidget.h"
|
#include "projectgeneralwidget.h"
|
||||||
|
@ -175,6 +176,10 @@ PSettingsDialog SettingsDialog::optionDialog()
|
||||||
widget->init();
|
widget->init();
|
||||||
dialog->addWidget(widget);
|
dialog->addWidget(widget);
|
||||||
|
|
||||||
|
widget = new ExecutorProblemSetWidget(tr("Problem Set"),tr("Program Runner"));
|
||||||
|
widget->init();
|
||||||
|
dialog->addWidget(widget);
|
||||||
|
|
||||||
widget = new DebugGeneralWidget(tr("General"),tr("Debugger"));
|
widget = new DebugGeneralWidget(tr("General"),tr("Debugger"));
|
||||||
widget->init();
|
widget->init();
|
||||||
dialog->addWidget(widget);
|
dialog->addWidget(widget);
|
||||||
|
|
|
@ -262,7 +262,9 @@ void SearchDialog::on_btnExecute_clicked()
|
||||||
Editor * e=pMainWindow->editorList()->operator[](i);
|
Editor * e=pMainWindow->editorList()->operator[](i);
|
||||||
if (e!=nullptr) {
|
if (e!=nullptr) {
|
||||||
fileSearched++;
|
fileSearched++;
|
||||||
PSearchResultTreeItem parentItem = batchFindInEditor(e,
|
PSearchResultTreeItem parentItem = batchFindInEditor(
|
||||||
|
e,
|
||||||
|
e->filename(),
|
||||||
keyword);
|
keyword);
|
||||||
int t = parentItem->results.size();
|
int t = parentItem->results.size();
|
||||||
findCount+=t;
|
findCount+=t;
|
||||||
|
@ -282,7 +284,9 @@ void SearchDialog::on_btnExecute_clicked()
|
||||||
Editor * e= pMainWindow->editorList()->getEditor();
|
Editor * e= pMainWindow->editorList()->getEditor();
|
||||||
if (e!=nullptr) {
|
if (e!=nullptr) {
|
||||||
fileSearched++;
|
fileSearched++;
|
||||||
PSearchResultTreeItem parentItem = batchFindInEditor(e,
|
PSearchResultTreeItem parentItem = batchFindInEditor(
|
||||||
|
e,
|
||||||
|
e->filename(),
|
||||||
keyword);
|
keyword);
|
||||||
int t = parentItem->results.size();
|
int t = parentItem->results.size();
|
||||||
findCount+=t;
|
findCount+=t;
|
||||||
|
@ -303,7 +307,9 @@ void SearchDialog::on_btnExecute_clicked()
|
||||||
QString curFilename = pMainWindow->project()->units()[i]->fileName();
|
QString curFilename = pMainWindow->project()->units()[i]->fileName();
|
||||||
if (e) {
|
if (e) {
|
||||||
fileSearched++;
|
fileSearched++;
|
||||||
PSearchResultTreeItem parentItem = batchFindInEditor(e,
|
PSearchResultTreeItem parentItem = batchFindInEditor(
|
||||||
|
e,
|
||||||
|
e->filename(),
|
||||||
keyword);
|
keyword);
|
||||||
int t = parentItem->results.size();
|
int t = parentItem->results.size();
|
||||||
findCount+=t;
|
findCount+=t;
|
||||||
|
@ -312,9 +318,13 @@ void SearchDialog::on_btnExecute_clicked()
|
||||||
results->results.append(parentItem);
|
results->results.append(parentItem);
|
||||||
}
|
}
|
||||||
} else if (fileExists(curFilename)) {
|
} else if (fileExists(curFilename)) {
|
||||||
Editor editor(nullptr,curFilename,ENCODING_AUTO_DETECT,false,false,nullptr);
|
SynEdit editor;
|
||||||
|
QByteArray realEncoding;
|
||||||
|
editor.lines()->loadFromFile(curFilename,ENCODING_AUTO_DETECT, realEncoding);
|
||||||
fileSearched++;
|
fileSearched++;
|
||||||
PSearchResultTreeItem parentItem = batchFindInEditor(&editor,
|
PSearchResultTreeItem parentItem = batchFindInEditor(
|
||||||
|
&editor,
|
||||||
|
curFilename,
|
||||||
keyword);
|
keyword);
|
||||||
int t = parentItem->results.size();
|
int t = parentItem->results.size();
|
||||||
findCount+=t;
|
findCount+=t;
|
||||||
|
@ -325,26 +335,14 @@ void SearchDialog::on_btnExecute_clicked()
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// end else if rbProjectFiles.Checked then begin
|
pMainWindow->searchResultModel()->notifySearchResultsUpdated();
|
||||||
// for I := 0 to MainForm.Project.Units.Count - 1 do begin
|
|
||||||
// e := MainForm.Project.Units[i].Editor;
|
|
||||||
// fCurFile := MainForm.Project.Units[i].FileName;
|
|
||||||
|
|
||||||
// // file is already open, use memory
|
|
||||||
// if Assigned(e) then begin begin
|
|
||||||
// inc(fileSearched);
|
|
||||||
// t:=Execute(e->text, actiontype);
|
|
||||||
// Inc(findcount, t);
|
|
||||||
// if t>0 then
|
|
||||||
// inc(filehitted);
|
|
||||||
// end;
|
|
||||||
}
|
}
|
||||||
if (findCount>0)
|
if (findCount>0)
|
||||||
pMainWindow->showSearchPanel(actionType == SearchAction::ReplaceFiles);
|
pMainWindow->showSearchPanel(actionType == SearchAction::ReplaceFiles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int SearchDialog::execute(Editor *editor, const QString &sSearch, const QString &sReplace, SynSearchMathedProc matchCallback)
|
int SearchDialog::execute(SynEdit *editor, const QString &sSearch, const QString &sReplace, SynSearchMathedProc matchCallback)
|
||||||
{
|
{
|
||||||
if (editor==nullptr)
|
if (editor==nullptr)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -369,7 +367,7 @@ int SearchDialog::execute(Editor *editor, const QString &sSearch, const QString
|
||||||
mSearchEngine, matchCallback);
|
mSearchEngine, matchCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<SearchResultTreeItem> SearchDialog::batchFindInEditor(Editor *e, const QString &keyword)
|
std::shared_ptr<SearchResultTreeItem> SearchDialog::batchFindInEditor(SynEdit *e, const QString& filename,const QString &keyword)
|
||||||
{
|
{
|
||||||
//backup
|
//backup
|
||||||
BufferCoord caretBackup = e->caretXY();
|
BufferCoord caretBackup = e->caretXY();
|
||||||
|
@ -379,13 +377,13 @@ std::shared_ptr<SearchResultTreeItem> SearchDialog::batchFindInEditor(Editor *e,
|
||||||
int leftCharBackup = e->leftChar();
|
int leftCharBackup = e->leftChar();
|
||||||
|
|
||||||
PSearchResultTreeItem parentItem = std::make_shared<SearchResultTreeItem>();
|
PSearchResultTreeItem parentItem = std::make_shared<SearchResultTreeItem>();
|
||||||
parentItem->filename = e->filename();
|
parentItem->filename = filename;
|
||||||
parentItem->parent = nullptr;
|
parentItem->parent = nullptr;
|
||||||
execute(e,keyword,"",
|
execute(e,keyword,"",
|
||||||
[e,&parentItem](const QString&,
|
[e,&parentItem, filename](const QString&,
|
||||||
const QString&, int Line, int ch, int wordLen){
|
const QString&, int Line, int ch, int wordLen){
|
||||||
PSearchResultTreeItem item = std::make_shared<SearchResultTreeItem>();
|
PSearchResultTreeItem item = std::make_shared<SearchResultTreeItem>();
|
||||||
item->filename = e->filename();
|
item->filename = filename;
|
||||||
item->line = Line;
|
item->line = Line;
|
||||||
item->start = ch;
|
item->start = ch;
|
||||||
item->len = wordLen;
|
item->len = wordLen;
|
||||||
|
|
|
@ -44,9 +44,9 @@ private slots:
|
||||||
|
|
||||||
void on_btnExecute_clicked();
|
void on_btnExecute_clicked();
|
||||||
private:
|
private:
|
||||||
int execute(Editor* editor, const QString& sSearch,
|
int execute(SynEdit* editor, const QString& sSearch,
|
||||||
const QString& sReplace, SynSearchMathedProc matchCallback = nullptr);
|
const QString& sReplace, SynSearchMathedProc matchCallback = nullptr);
|
||||||
std::shared_ptr<SearchResultTreeItem> batchFindInEditor(Editor* editor,const QString& keyword);
|
std::shared_ptr<SearchResultTreeItem> batchFindInEditor(SynEdit * editor,const QString& filename, const QString& keyword);
|
||||||
private:
|
private:
|
||||||
Ui::SearchDialog *ui;
|
Ui::SearchDialog *ui;
|
||||||
QTabBar *mTabBar;
|
QTabBar *mTabBar;
|
||||||
|
|
Loading…
Reference in New Issue