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