- fix: Respect encoding "Project default" when search/find occurrencies/open project units.
- enhancement: Show progress dialog when search/find occurrencies in large projects.
This commit is contained in:
parent
32a29540bd
commit
79ed9573d6
2
NEWS.md
2
NEWS.md
|
@ -5,6 +5,8 @@ Red Panda C++ Version 2.11
|
||||||
- enhancement: Differentiate class and constructors in syntax color and jupming to declarations.
|
- enhancement: Differentiate class and constructors in syntax color and jupming to declarations.
|
||||||
- enhancement: Improve parsing for operator overloading.
|
- enhancement: Improve parsing for operator overloading.
|
||||||
- fix: Parser can't correctly differentiate function and var initialization.
|
- fix: Parser can't correctly differentiate function and var initialization.
|
||||||
|
- fix: Respect encoding "Project default" when search/find occurrencies/open project units.
|
||||||
|
- enhancement: Show progress dialog when search/find occurrencies in large projects.
|
||||||
|
|
||||||
Red Panda C++ Version 2.10
|
Red Panda C++ Version 2.10
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ isEmpty(APP_NAME) {
|
||||||
}
|
}
|
||||||
|
|
||||||
isEmpty(APP_VERSION) {
|
isEmpty(APP_VERSION) {
|
||||||
APP_VERSION = 2.10
|
APP_VERSION = 2.11
|
||||||
}
|
}
|
||||||
|
|
||||||
macos: {
|
macos: {
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "editorlist.h"
|
#include "editorlist.h"
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QProgressDialog>
|
||||||
#include <QTextCodec>
|
#include <QTextCodec>
|
||||||
#include "syntaxermanager.h"
|
#include "syntaxermanager.h"
|
||||||
#include "project.h"
|
#include "project.h"
|
||||||
|
@ -182,11 +183,25 @@ void CppRefacter::doFindOccurenceInProject(PStatement statement, std::shared_ptr
|
||||||
statement->fullName,
|
statement->fullName,
|
||||||
SearchFileScope::wholeProject
|
SearchFileScope::wholeProject
|
||||||
);
|
);
|
||||||
|
QProgressDialog progressDlg(
|
||||||
|
tr("Searching..."),
|
||||||
|
tr("Abort"),
|
||||||
|
0,
|
||||||
|
pMainWindow->project()->unitList().count(),
|
||||||
|
pMainWindow);
|
||||||
|
progressDlg.setWindowModality(Qt::WindowModal);
|
||||||
|
int i=0;
|
||||||
foreach (const PProjectUnit& unit, project->unitList()) {
|
foreach (const PProjectUnit& unit, project->unitList()) {
|
||||||
|
i++;
|
||||||
if (isCFile(unit->fileName()) || isHFile(unit->fileName())) {
|
if (isCFile(unit->fileName()) || isHFile(unit->fileName())) {
|
||||||
|
progressDlg.setValue(i);
|
||||||
|
progressDlg.setLabelText(tr("Searching...")+"<br/>"+unit->fileName());
|
||||||
|
|
||||||
|
if (progressDlg.wasCanceled())
|
||||||
|
break;
|
||||||
PSearchResultTreeItem item = findOccurenceInFile(
|
PSearchResultTreeItem item = findOccurenceInFile(
|
||||||
unit->fileName(),
|
unit->fileName(),
|
||||||
unit->encoding(),
|
unit->encoding()==ENCODING_PROJECT?project->options().encoding:unit->encoding(),
|
||||||
statement,
|
statement,
|
||||||
parser);
|
parser);
|
||||||
if (item && !(item->results.isEmpty())) {
|
if (item && !(item->results.isEmpty())) {
|
||||||
|
|
|
@ -1445,6 +1445,8 @@ Editor* MainWindow::openFile(const QString &filename, bool activate, QTabWidget*
|
||||||
QByteArray encoding = unit ? unit->encoding() :
|
QByteArray encoding = unit ? unit->encoding() :
|
||||||
(pSettings->editor().autoDetectFileEncoding()? ENCODING_AUTO_DETECT : pSettings->editor().defaultEncoding());
|
(pSettings->editor().autoDetectFileEncoding()? ENCODING_AUTO_DETECT : pSettings->editor().defaultEncoding());
|
||||||
Project * pProject = (inProject?mProject.get():nullptr);
|
Project * pProject = (inProject?mProject.get():nullptr);
|
||||||
|
if (pProject && encoding==ENCODING_PROJECT)
|
||||||
|
encoding=pProject->options().encoding;
|
||||||
editor = mEditorList->newEditor(filename,encoding,
|
editor = mEditorList->newEditor(filename,encoding,
|
||||||
pProject, false, page);
|
pProject, false, page);
|
||||||
// if (mProject) {
|
// if (mProject) {
|
||||||
|
@ -3103,6 +3105,8 @@ void MainWindow::loadLastOpens()
|
||||||
QByteArray encoding = unit ? unit->encoding() :
|
QByteArray encoding = unit ? unit->encoding() :
|
||||||
(pSettings->editor().autoDetectFileEncoding()? ENCODING_AUTO_DETECT : pSettings->editor().defaultEncoding());
|
(pSettings->editor().autoDetectFileEncoding()? ENCODING_AUTO_DETECT : pSettings->editor().defaultEncoding());
|
||||||
Project* pProject = (inProject?mProject.get():nullptr);
|
Project* pProject = (inProject?mProject.get():nullptr);
|
||||||
|
if (pProject && encoding==ENCODING_PROJECT)
|
||||||
|
encoding=pProject->options().encoding;
|
||||||
Editor * editor = mEditorList->newEditor(editorFilename, encoding, pProject,false,page);
|
Editor * editor = mEditorList->newEditor(editorFilename, encoding, pProject,false,page);
|
||||||
|
|
||||||
if (inProject && editor) {
|
if (inProject && editor) {
|
||||||
|
|
|
@ -370,6 +370,9 @@ Editor* Project::openUnit(PProjectUnit& unit, bool forceOpen) {
|
||||||
}
|
}
|
||||||
QByteArray encoding;
|
QByteArray encoding;
|
||||||
encoding = unit->encoding();
|
encoding = unit->encoding();
|
||||||
|
if (encoding==ENCODING_PROJECT)
|
||||||
|
encoding=options().encoding;
|
||||||
|
|
||||||
editor = mEditorList->newEditor(unit->fileName(), encoding, this, false);
|
editor = mEditorList->newEditor(unit->fileName(), encoding, this, false);
|
||||||
if (editor) {
|
if (editor) {
|
||||||
//editor->setProject(this);
|
//editor->setProject(this);
|
||||||
|
@ -397,6 +400,8 @@ Editor *Project::openUnit(PProjectUnit &unit, const PProjectEditorLayout &layout
|
||||||
}
|
}
|
||||||
QByteArray encoding;
|
QByteArray encoding;
|
||||||
encoding = unit->encoding();
|
encoding = unit->encoding();
|
||||||
|
if (encoding==ENCODING_PROJECT)
|
||||||
|
encoding=options().encoding;
|
||||||
editor = mEditorList->newEditor(unit->fileName(), encoding, this, false);
|
editor = mEditorList->newEditor(unit->fileName(), encoding, this, false);
|
||||||
if (editor) {
|
if (editor) {
|
||||||
//editor->setInProject(true);
|
//editor->setInProject(true);
|
||||||
|
@ -807,10 +812,12 @@ void Project::associateEditorToUnit(Editor *editor, PProjectUnit unit)
|
||||||
// editor->setEncodingOption(editor->fileEncoding());
|
// editor->setEncodingOption(editor->fileEncoding());
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
if (editor->encodingOption()!=mOptions.encoding)
|
if (unit->encoding()==ENCODING_PROJECT) {
|
||||||
unit->setEncoding(editor->encodingOption());
|
if (editor->encodingOption()!=mOptions.encoding)
|
||||||
else if (editor->encodingOption()!=unit->encoding())
|
unit->setEncoding(editor->encodingOption());
|
||||||
|
} else if (editor->encodingOption()!=unit->encoding()) {
|
||||||
unit->setEncoding(editor->encodingOption());
|
unit->setEncoding(editor->encodingOption());
|
||||||
|
}
|
||||||
unit->setRealEncoding(editor->fileEncoding());
|
unit->setRealEncoding(editor->fileEncoding());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -952,7 +959,7 @@ bool Project::assignTemplate(const std::shared_ptr<ProjectTemplate> aTemplate, b
|
||||||
|
|
||||||
Editor * editor = mEditorList->newEditor(
|
Editor * editor = mEditorList->newEditor(
|
||||||
unit->fileName(),
|
unit->fileName(),
|
||||||
unit->encoding(),
|
unit->encoding()==ENCODING_PROJECT?options().encoding:unit->encoding(),
|
||||||
this,
|
this,
|
||||||
true);
|
true);
|
||||||
|
|
||||||
|
|
|
@ -6835,6 +6835,14 @@
|
||||||
<source>Search in Files</source>
|
<source>Search in Files</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Searching...</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Abort</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>SearchResultListModel</name>
|
<name>SearchResultListModel</name>
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -6388,6 +6388,14 @@
|
||||||
<source>Search in Files</source>
|
<source>Search in Files</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Searching...</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Abort</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>SearchResultListModel</name>
|
<name>SearchResultListModel</name>
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "../settings.h"
|
#include "../settings.h"
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QProgressDialog>
|
||||||
|
|
||||||
|
|
||||||
SearchInFileDialog::SearchInFileDialog(QWidget *parent) :
|
SearchInFileDialog::SearchInFileDialog(QWidget *parent) :
|
||||||
|
@ -170,7 +171,23 @@ void SearchInFileDialog::doSearch(bool replace)
|
||||||
mSearchOptions,
|
mSearchOptions,
|
||||||
SearchFileScope::wholeProject
|
SearchFileScope::wholeProject
|
||||||
);
|
);
|
||||||
|
QByteArray projectEncoding = pMainWindow->project()->options().encoding;
|
||||||
|
QProgressDialog progressDlg(
|
||||||
|
tr("Searching..."),
|
||||||
|
tr("Abort"),
|
||||||
|
0,
|
||||||
|
pMainWindow->project()->unitList().count(),
|
||||||
|
pMainWindow);
|
||||||
|
|
||||||
|
progressDlg.setWindowModality(Qt::WindowModal);
|
||||||
|
int i=0;
|
||||||
foreach (PProjectUnit unit, pMainWindow->project()->unitList()) {
|
foreach (PProjectUnit unit, pMainWindow->project()->unitList()) {
|
||||||
|
i++;
|
||||||
|
progressDlg.setValue(i);
|
||||||
|
progressDlg.setLabelText(tr("Searching...")+"<br/>"+unit->fileName());
|
||||||
|
|
||||||
|
if (progressDlg.wasCanceled())
|
||||||
|
break;
|
||||||
Editor * e = pMainWindow->project()->unitEditor(unit);
|
Editor * e = pMainWindow->project()->unitEditor(unit);
|
||||||
QString curFilename = unit->fileName();
|
QString curFilename = unit->fileName();
|
||||||
if (e) {
|
if (e) {
|
||||||
|
@ -187,8 +204,11 @@ void SearchInFileDialog::doSearch(bool replace)
|
||||||
}
|
}
|
||||||
} else if (fileExists(curFilename)) {
|
} else if (fileExists(curFilename)) {
|
||||||
QSynedit::QSynEdit editor;
|
QSynedit::QSynEdit editor;
|
||||||
|
QByteArray encoding=unit->encoding();
|
||||||
|
if (encoding==ENCODING_PROJECT)
|
||||||
|
encoding = projectEncoding;
|
||||||
QByteArray realEncoding;
|
QByteArray realEncoding;
|
||||||
editor.document()->loadFromFile(curFilename,ENCODING_AUTO_DETECT, realEncoding);
|
editor.document()->loadFromFile(curFilename,encoding, realEncoding);
|
||||||
fileSearched++;
|
fileSearched++;
|
||||||
PSearchResultTreeItem parentItem = batchFindInEditor(
|
PSearchResultTreeItem parentItem = batchFindInEditor(
|
||||||
&editor,
|
&editor,
|
||||||
|
@ -200,7 +220,6 @@ void SearchInFileDialog::doSearch(bool replace)
|
||||||
fileHitted++;
|
fileHitted++;
|
||||||
results->results.append(parentItem);
|
results->results.append(parentItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pMainWindow->searchResultModel()->notifySearchResultsUpdated();
|
pMainWindow->searchResultModel()->notifySearchResultsUpdated();
|
||||||
|
|
|
@ -12,6 +12,10 @@ consolepauser.subdir = tools/consolepauser
|
||||||
redpanda_qt_utils.subdir = libs/redpanda_qt_utils
|
redpanda_qt_utils.subdir = libs/redpanda_qt_utils
|
||||||
qsynedit.subdir = libs/qsynedit
|
qsynedit.subdir = libs/qsynedit
|
||||||
|
|
||||||
|
APP_NAME = RedPandaCPP
|
||||||
|
|
||||||
|
APP_VERSION = 2.11
|
||||||
|
|
||||||
# Add the dependencies so that the RedPandaIDE project can add the depended programs
|
# Add the dependencies so that the RedPandaIDE project can add the depended programs
|
||||||
# into the main app bundle
|
# into the main app bundle
|
||||||
RedPandaIDE.depends = astyle consolepauser qsynedit
|
RedPandaIDE.depends = astyle consolepauser qsynedit
|
||||||
|
@ -31,10 +35,6 @@ redpanda-git-askpass.subdir = tools/redpanda-git-askpass
|
||||||
RedPandaIDE.depends += redpanda-git-askpass
|
RedPandaIDE.depends += redpanda-git-askpass
|
||||||
}
|
}
|
||||||
|
|
||||||
APP_NAME = RedPandaCPP
|
|
||||||
|
|
||||||
APP_VERSION = 2.10
|
|
||||||
|
|
||||||
linux: {
|
linux: {
|
||||||
isEmpty(PREFIX) {
|
isEmpty(PREFIX) {
|
||||||
PREFIX = /usr/local
|
PREFIX = /usr/local
|
||||||
|
|
Loading…
Reference in New Issue