forked from qt-creator/qt-creator
TextEditor: Modernize
override, auto, nullptr, member initializers. Change-Id: I04c6ebb683849568973bd7782fb5a3279267141e Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
439bc225e1
commit
41dee83bec
@@ -115,7 +115,7 @@ public:
|
|||||||
~BaseFileFindPrivate() { delete m_internalSearchEngine; }
|
~BaseFileFindPrivate() { delete m_internalSearchEngine; }
|
||||||
QPointer<IFindSupport> m_currentFindSupport;
|
QPointer<IFindSupport> m_currentFindSupport;
|
||||||
|
|
||||||
QLabel *m_resultLabel = 0;
|
QLabel *m_resultLabel = nullptr;
|
||||||
// models in native path format
|
// models in native path format
|
||||||
QStringListModel m_filterStrings;
|
QStringListModel m_filterStrings;
|
||||||
QStringListModel m_exclusionStrings;
|
QStringListModel m_exclusionStrings;
|
||||||
@@ -253,7 +253,7 @@ static void displayResult(QFutureWatcher<FileSearchResultList> *watcher,
|
|||||||
void BaseFileFind::runNewSearch(const QString &txt, FindFlags findFlags,
|
void BaseFileFind::runNewSearch(const QString &txt, FindFlags findFlags,
|
||||||
SearchResultWindow::SearchMode searchMode)
|
SearchResultWindow::SearchMode searchMode)
|
||||||
{
|
{
|
||||||
d->m_currentFindSupport = 0;
|
d->m_currentFindSupport = nullptr;
|
||||||
if (d->m_filterCombo)
|
if (d->m_filterCombo)
|
||||||
updateComboEntries(d->m_filterCombo, true);
|
updateComboEntries(d->m_filterCombo, true);
|
||||||
if (d->m_exclusionCombo)
|
if (d->m_exclusionCombo)
|
||||||
@@ -290,12 +290,12 @@ void BaseFileFind::runNewSearch(const QString &txt, FindFlags findFlags,
|
|||||||
void BaseFileFind::runSearch(SearchResult *search)
|
void BaseFileFind::runSearch(SearchResult *search)
|
||||||
{
|
{
|
||||||
FileFindParameters parameters = search->userData().value<FileFindParameters>();
|
FileFindParameters parameters = search->userData().value<FileFindParameters>();
|
||||||
CountingLabel *label = new CountingLabel;
|
auto label = new CountingLabel;
|
||||||
connect(search, &SearchResult::countChanged, label, &CountingLabel::updateCount);
|
connect(search, &SearchResult::countChanged, label, &CountingLabel::updateCount);
|
||||||
CountingLabel *statusLabel = new CountingLabel;
|
auto statusLabel = new CountingLabel;
|
||||||
connect(search, &SearchResult::countChanged, statusLabel, &CountingLabel::updateCount);
|
connect(search, &SearchResult::countChanged, statusLabel, &CountingLabel::updateCount);
|
||||||
SearchResultWindow::instance()->popup(IOutputPane::Flags(IOutputPane::ModeSwitch|IOutputPane::WithFocus));
|
SearchResultWindow::instance()->popup(IOutputPane::Flags(IOutputPane::ModeSwitch|IOutputPane::WithFocus));
|
||||||
QFutureWatcher<FileSearchResultList> *watcher = new QFutureWatcher<FileSearchResultList>();
|
auto watcher = new QFutureWatcher<FileSearchResultList>();
|
||||||
watcher->setPendingResultsLimit(1);
|
watcher->setPendingResultsLimit(1);
|
||||||
// search is deleted if it is removed from search panel
|
// search is deleted if it is removed from search panel
|
||||||
connect(search, &QObject::destroyed, watcher, &QFutureWatcherBase::cancel);
|
connect(search, &QObject::destroyed, watcher, &QFutureWatcherBase::cancel);
|
||||||
@@ -344,7 +344,7 @@ void BaseFileFind::doReplace(const QString &text,
|
|||||||
QStringList files = replaceAll(text, items, preserveCase);
|
QStringList files = replaceAll(text, items, preserveCase);
|
||||||
if (!files.isEmpty()) {
|
if (!files.isEmpty()) {
|
||||||
Utils::FadingIndicator::showText(ICore::mainWindow(),
|
Utils::FadingIndicator::showText(ICore::mainWindow(),
|
||||||
tr("%n occurrences replaced.", 0, items.size()),
|
tr("%n occurrences replaced.", nullptr, items.size()),
|
||||||
Utils::FadingIndicator::SmallText);
|
Utils::FadingIndicator::SmallText);
|
||||||
DocumentManager::notifyFilesChangedInternally(files);
|
DocumentManager::notifyFilesChangedInternally(files);
|
||||||
SearchResultWindow::instance()->hide();
|
SearchResultWindow::instance()->hide();
|
||||||
@@ -444,7 +444,7 @@ void BaseFileFind::readCommonSettings(QSettings *settings, const QString &defaul
|
|||||||
|
|
||||||
void BaseFileFind::openEditor(const SearchResultItem &item)
|
void BaseFileFind::openEditor(const SearchResultItem &item)
|
||||||
{
|
{
|
||||||
SearchResult *result = qobject_cast<SearchResult *>(sender());
|
auto result = qobject_cast<SearchResult *>(sender());
|
||||||
FileFindParameters parameters = result->userData().value<FileFindParameters>();
|
FileFindParameters parameters = result->userData().value<FileFindParameters>();
|
||||||
IEditor *openedEditor =
|
IEditor *openedEditor =
|
||||||
d->m_searchEngines[parameters.searchEngineIndex]->openEditor(item, parameters);
|
d->m_searchEngines[parameters.searchEngineIndex]->openEditor(item, parameters);
|
||||||
@@ -452,11 +452,11 @@ void BaseFileFind::openEditor(const SearchResultItem &item)
|
|||||||
EditorManager::openEditorAtSearchResult(item, EditorManager::DoNotSwitchToDesignMode);
|
EditorManager::openEditorAtSearchResult(item, EditorManager::DoNotSwitchToDesignMode);
|
||||||
if (d->m_currentFindSupport)
|
if (d->m_currentFindSupport)
|
||||||
d->m_currentFindSupport->clearHighlights();
|
d->m_currentFindSupport->clearHighlights();
|
||||||
d->m_currentFindSupport = 0;
|
d->m_currentFindSupport = nullptr;
|
||||||
if (!openedEditor)
|
if (!openedEditor)
|
||||||
return;
|
return;
|
||||||
// highlight results
|
// highlight results
|
||||||
if (IFindSupport *findSupport = Aggregation::query<IFindSupport>(openedEditor->widget())) {
|
if (auto findSupport = Aggregation::query<IFindSupport>(openedEditor->widget())) {
|
||||||
d->m_currentFindSupport = findSupport;
|
d->m_currentFindSupport = findSupport;
|
||||||
d->m_currentFindSupport->highlightAll(parameters.text, parameters.flags);
|
d->m_currentFindSupport->highlightAll(parameters.text, parameters.flags);
|
||||||
}
|
}
|
||||||
@@ -470,14 +470,14 @@ void BaseFileFind::hideHighlightAll(bool visible)
|
|||||||
|
|
||||||
void BaseFileFind::searchAgain()
|
void BaseFileFind::searchAgain()
|
||||||
{
|
{
|
||||||
SearchResult *search = qobject_cast<SearchResult *>(sender());
|
auto search = qobject_cast<SearchResult *>(sender());
|
||||||
search->restart();
|
search->restart();
|
||||||
runSearch(search);
|
runSearch(search);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseFileFind::recheckEnabled()
|
void BaseFileFind::recheckEnabled()
|
||||||
{
|
{
|
||||||
SearchResult *search = qobject_cast<SearchResult *>(sender());
|
auto search = qobject_cast<SearchResult *>(sender());
|
||||||
if (!search)
|
if (!search)
|
||||||
return;
|
return;
|
||||||
search->setSearchAgainEnabled(isEnabled());
|
search->setSearchAgainEnabled(isEnabled());
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ BehaviorSettingsPage::BehaviorSettingsPage(const BehaviorSettingsPageParameters
|
|||||||
d->m_codeStyle->setId(Constants::GLOBAL_SETTINGS_ID);
|
d->m_codeStyle->setId(Constants::GLOBAL_SETTINGS_ID);
|
||||||
|
|
||||||
// default pool for all other languages
|
// default pool for all other languages
|
||||||
d->m_defaultCodeStylePool = new CodeStylePool(0, this); // Any language
|
d->m_defaultCodeStylePool = new CodeStylePool(nullptr, this); // Any language
|
||||||
d->m_defaultCodeStylePool->addCodeStyle(d->m_codeStyle);
|
d->m_defaultCodeStylePool->addCodeStyle(d->m_codeStyle);
|
||||||
d->init();
|
d->init();
|
||||||
|
|
||||||
@@ -225,7 +225,7 @@ void BehaviorSettingsPage::finish()
|
|||||||
if (!d->m_page) // page was never shown
|
if (!d->m_page) // page was never shown
|
||||||
return;
|
return;
|
||||||
delete d->m_page;
|
delete d->m_page;
|
||||||
d->m_page = 0;
|
d->m_page = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ICodeStylePreferences *BehaviorSettingsPage::codeStyle() const
|
ICodeStylePreferences *BehaviorSettingsPage::codeStyle() const
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public:
|
|||||||
setText(text);
|
setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
~ClipboardProposalItem() Q_DECL_NOEXCEPT {}
|
~ClipboardProposalItem() noexcept override {}
|
||||||
|
|
||||||
void apply(TextDocumentManipulatorInterface &manipulator, int /*basePosition*/) const override
|
void apply(TextDocumentManipulatorInterface &manipulator, int /*basePosition*/) const override
|
||||||
{
|
{
|
||||||
@@ -88,7 +88,7 @@ public:
|
|||||||
IAssistProposal *perform(const AssistInterface *interface) override
|
IAssistProposal *perform(const AssistInterface *interface) override
|
||||||
{
|
{
|
||||||
if (!interface)
|
if (!interface)
|
||||||
return 0;
|
return nullptr;
|
||||||
const QScopedPointer<const AssistInterface> AssistInterface(interface);
|
const QScopedPointer<const AssistInterface> AssistInterface(interface);
|
||||||
|
|
||||||
QIcon icon = QIcon::fromTheme(QLatin1String("edit-paste"), Utils::Icons::PASTE.icon()).pixmap(16);
|
QIcon icon = QIcon::fromTheme(QLatin1String("edit-paste"), Utils::Icons::PASTE.icon()).pixmap(16);
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ void AssistInterface::prepareForAsyncUse()
|
|||||||
m_userStates.reserve(m_textDocument->blockCount());
|
m_userStates.reserve(m_textDocument->blockCount());
|
||||||
for (QTextBlock block = m_textDocument->firstBlock(); block.isValid(); block = block.next())
|
for (QTextBlock block = m_textDocument->firstBlock(); block.isValid(); block = block.next())
|
||||||
m_userStates.append(block.userState());
|
m_userStates.append(block.userState());
|
||||||
m_textDocument = 0;
|
m_textDocument = nullptr;
|
||||||
m_isAsync = true;
|
m_isAsync = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace TextEditor {
|
|||||||
class TEXTEDITOR_EXPORT AssistProposalItem : public AssistProposalItemInterface
|
class TEXTEDITOR_EXPORT AssistProposalItem : public AssistProposalItemInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
~AssistProposalItem() Q_DECL_NOEXCEPT override {}
|
~AssistProposalItem() noexcept override {}
|
||||||
QString text() const override;
|
QString text() const override;
|
||||||
bool implicitlyApplies() const override;
|
bool implicitlyApplies() const override;
|
||||||
bool prematurelyApplies(const QChar &c) const override;
|
bool prematurelyApplies(const QChar &c) const override;
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
AssistProposalItemInterface() = default;
|
AssistProposalItemInterface() = default;
|
||||||
virtual ~AssistProposalItemInterface() Q_DECL_NOEXCEPT = default;
|
virtual ~AssistProposalItemInterface() noexcept = default;
|
||||||
|
|
||||||
UTILS_DELETE_MOVE_AND_COPY(AssistProposalItemInterface)
|
UTILS_DELETE_MOVE_AND_COPY(AssistProposalItemInterface)
|
||||||
|
|
||||||
|
|||||||
@@ -516,7 +516,7 @@ bool CodeAssistantPrivate::isDestroyEvent(int key, const QString &keyText)
|
|||||||
{
|
{
|
||||||
if (keyText.isEmpty())
|
if (keyText.isEmpty())
|
||||||
return key != Qt::LeftArrow && key != Qt::RightArrow && key != Qt::Key_Shift;
|
return key != Qt::LeftArrow && key != Qt::RightArrow && key != Qt::Key_Shift;
|
||||||
if (auto *provider = qobject_cast<CompletionAssistProvider *>(m_requestProvider))
|
if (auto provider = qobject_cast<CompletionAssistProvider *>(m_requestProvider))
|
||||||
return !provider->isContinuationChar(keyText.at(0));
|
return !provider->isContinuationChar(keyText.at(0));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -530,7 +530,7 @@ bool CodeAssistantPrivate::eventFilter(QObject *o, QEvent *e)
|
|||||||
if (type == QEvent::FocusOut) {
|
if (type == QEvent::FocusOut) {
|
||||||
destroyContext();
|
destroyContext();
|
||||||
} else if (type == QEvent::KeyPress) {
|
} else if (type == QEvent::KeyPress) {
|
||||||
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(e);
|
auto keyEvent = static_cast<QKeyEvent *>(e);
|
||||||
const QString &keyText = keyEvent->text();
|
const QString &keyText = keyEvent->text();
|
||||||
|
|
||||||
if (isDestroyEvent(keyEvent->key(), keyText))
|
if (isDestroyEvent(keyEvent->key(), keyText))
|
||||||
|
|||||||
@@ -269,7 +269,7 @@ bool FunctionHintProposalWidget::eventFilter(QObject *obj, QEvent *e)
|
|||||||
}
|
}
|
||||||
QTC_CHECK(d->m_model);
|
QTC_CHECK(d->m_model);
|
||||||
if (d->m_model && d->m_model->size() > 1) {
|
if (d->m_model && d->m_model->size() > 1) {
|
||||||
QKeyEvent *ke = static_cast<QKeyEvent*>(e);
|
auto ke = static_cast<QKeyEvent*>(e);
|
||||||
if (ke->key() == Qt::Key_Up) {
|
if (ke->key() == Qt::Key_Up) {
|
||||||
previousPage();
|
previousPage();
|
||||||
return true;
|
return true;
|
||||||
@@ -281,7 +281,7 @@ bool FunctionHintProposalWidget::eventFilter(QObject *obj, QEvent *e)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case QEvent::KeyRelease: {
|
case QEvent::KeyRelease: {
|
||||||
QKeyEvent *ke = static_cast<QKeyEvent*>(e);
|
auto ke = static_cast<QKeyEvent*>(e);
|
||||||
if (ke->key() == Qt::Key_Escape && d->m_escapePressed) {
|
if (ke->key() == Qt::Key_Escape && d->m_escapePressed) {
|
||||||
abort();
|
abort();
|
||||||
emit explicitlyAborted();
|
emit explicitlyAborted();
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ GenericProposal *GenericProposal::createProposal(const AssistInterface *interfac
|
|||||||
foreach (const QuickFixOperation::Ptr &op, quickFixes) {
|
foreach (const QuickFixOperation::Ptr &op, quickFixes) {
|
||||||
QVariant v;
|
QVariant v;
|
||||||
v.setValue(op);
|
v.setValue(op);
|
||||||
AssistProposalItem *item = new AssistProposalItem;
|
auto item = new AssistProposalItem;
|
||||||
item->setText(op->description());
|
item->setText(op->description());
|
||||||
item->setData(v);
|
item->setData(v);
|
||||||
item->setOrder(op->priority());
|
item->setOrder(op->priority());
|
||||||
|
|||||||
@@ -64,8 +64,8 @@ class ModelAdapter : public QAbstractListModel
|
|||||||
public:
|
public:
|
||||||
ModelAdapter(GenericProposalModelPtr completionModel, QWidget *parent);
|
ModelAdapter(GenericProposalModelPtr completionModel, QWidget *parent);
|
||||||
|
|
||||||
virtual int rowCount(const QModelIndex &) const;
|
int rowCount(const QModelIndex &) const override;
|
||||||
virtual QVariant data(const QModelIndex &index, int role) const;
|
QVariant data(const QModelIndex &index, int role) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GenericProposalModelPtr m_completionModel;
|
GenericProposalModelPtr m_completionModel;
|
||||||
@@ -102,10 +102,10 @@ QVariant ModelAdapter::data(const QModelIndex &index, int role) const
|
|||||||
class GenericProposalInfoFrame : public FakeToolTip
|
class GenericProposalInfoFrame : public FakeToolTip
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GenericProposalInfoFrame(QWidget *parent = 0)
|
GenericProposalInfoFrame(QWidget *parent = nullptr)
|
||||||
: FakeToolTip(parent), m_label(new QLabel(this))
|
: FakeToolTip(parent), m_label(new QLabel(this))
|
||||||
{
|
{
|
||||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
auto layout = new QVBoxLayout(this);
|
||||||
layout->setMargin(0);
|
layout->setMargin(0);
|
||||||
layout->setSpacing(0);
|
layout->setSpacing(0);
|
||||||
layout->addWidget(m_label);
|
layout->addWidget(m_label);
|
||||||
@@ -297,7 +297,7 @@ GenericProposalWidget::GenericProposalWidget()
|
|||||||
connect(d->m_completionListView->verticalScrollBar(), &QAbstractSlider::sliderReleased,
|
connect(d->m_completionListView->verticalScrollBar(), &QAbstractSlider::sliderReleased,
|
||||||
this, &GenericProposalWidget::turnOnAutoWidth);
|
this, &GenericProposalWidget::turnOnAutoWidth);
|
||||||
|
|
||||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
auto layout = new QVBoxLayout(this);
|
||||||
layout->setMargin(0);
|
layout->setMargin(0);
|
||||||
layout->addWidget(d->m_completionListView);
|
layout->addWidget(d->m_completionListView);
|
||||||
|
|
||||||
@@ -501,7 +501,7 @@ bool GenericProposalWidget::eventFilter(QObject *o, QEvent *e)
|
|||||||
d->m_infoFrame->close();
|
d->m_infoFrame->close();
|
||||||
return true;
|
return true;
|
||||||
} else if (e->type() == QEvent::ShortcutOverride) {
|
} else if (e->type() == QEvent::ShortcutOverride) {
|
||||||
QKeyEvent *ke = static_cast<QKeyEvent *>(e);
|
auto ke = static_cast<QKeyEvent *>(e);
|
||||||
switch (ke->key()) {
|
switch (ke->key()) {
|
||||||
case Qt::Key_N:
|
case Qt::Key_N:
|
||||||
case Qt::Key_P:
|
case Qt::Key_P:
|
||||||
@@ -511,7 +511,7 @@ bool GenericProposalWidget::eventFilter(QObject *o, QEvent *e)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (e->type() == QEvent::KeyPress) {
|
} else if (e->type() == QEvent::KeyPress) {
|
||||||
QKeyEvent *ke = static_cast<QKeyEvent *>(e);
|
auto ke = static_cast<QKeyEvent *>(e);
|
||||||
switch (ke->key()) {
|
switch (ke->key()) {
|
||||||
case Qt::Key_Escape:
|
case Qt::Key_Escape:
|
||||||
abort();
|
abort();
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ using namespace TextEditor;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
IAssistProposalWidget::IAssistProposalWidget()
|
IAssistProposalWidget::IAssistProposalWidget()
|
||||||
: QFrame(0, Qt::Popup)
|
: QFrame(nullptr, Qt::Popup)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
IAssistProposalWidget::~IAssistProposalWidget()
|
IAssistProposalWidget::~IAssistProposalWidget()
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ IAssistProposal *KeywordsCompletionAssistProcessor::perform(const AssistInterfac
|
|||||||
if (characterUnderCursor.isLetterOrNumber())
|
if (characterUnderCursor.isLetterOrNumber())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
if (interface->position() - startPosition < 3)
|
if (interface->position() - startPosition < 3)
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// extract word
|
// extract word
|
||||||
|
|||||||
@@ -43,13 +43,13 @@ class ProcessorRunner : public QThread
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
ProcessorRunner();
|
ProcessorRunner();
|
||||||
virtual ~ProcessorRunner();
|
~ProcessorRunner() override;
|
||||||
|
|
||||||
void setProcessor(IAssistProcessor *processor); // Takes ownership of the processor.
|
void setProcessor(IAssistProcessor *processor); // Takes ownership of the processor.
|
||||||
void setAssistInterface(AssistInterface *interface);
|
void setAssistInterface(AssistInterface *interface);
|
||||||
void setDiscardProposal(bool discard);
|
void setDiscardProposal(bool discard);
|
||||||
|
|
||||||
virtual void run();
|
void run() override;
|
||||||
|
|
||||||
IAssistProposal *proposal() const;
|
IAssistProposal *proposal() const;
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public:
|
|||||||
void insertCodeSnippet(int position, const QString &text) final;
|
void insertCodeSnippet(int position, const QString &text) final;
|
||||||
void paste() final;
|
void paste() final;
|
||||||
void encourageApply() final;
|
void encourageApply() final;
|
||||||
void autoIndent(int position, int length);
|
void autoIndent(int position, int length) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool textIsDifferentAt(int position, int length, const QString &text) const;
|
bool textIsDifferentAt(int position, int length, const QString &text) const;
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class CodecListWidget : public Utils::ListWidget
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CodecListWidget(QWidget *parent) : Utils::ListWidget(parent){}
|
CodecListWidget(QWidget *parent) : Utils::ListWidget(parent){}
|
||||||
QSize sizeHint() const {
|
QSize sizeHint() const override {
|
||||||
return QListWidget::sizeHint().expandedTo(
|
return QListWidget::sizeHint().expandedTo(
|
||||||
QSize(sizeHintForColumn(0) + verticalScrollBar()->sizeHint().width() + 4, 0));
|
QSize(sizeHintForColumn(0) + verticalScrollBar()->sizeHint().width() + 4, 0));
|
||||||
}
|
}
|
||||||
@@ -126,7 +126,7 @@ CodecSelector::CodecSelector(QWidget *parent, TextDocument *doc)
|
|||||||
connect(m_dialogButtonBox, &QDialogButtonBox::clicked, this, &CodecSelector::buttonClicked);
|
connect(m_dialogButtonBox, &QDialogButtonBox::clicked, this, &CodecSelector::buttonClicked);
|
||||||
connect(m_listWidget, &QAbstractItemView::activated, m_reloadButton, &QAbstractButton::click);
|
connect(m_listWidget, &QAbstractItemView::activated, m_reloadButton, &QAbstractButton::click);
|
||||||
|
|
||||||
QVBoxLayout *vbox = new QVBoxLayout(this);
|
auto vbox = new QVBoxLayout(this);
|
||||||
vbox->addWidget(m_label);
|
vbox->addWidget(m_label);
|
||||||
vbox->addWidget(m_listWidget);
|
vbox->addWidget(m_listWidget);
|
||||||
vbox->addWidget(m_dialogButtonBox);
|
vbox->addWidget(m_dialogButtonBox);
|
||||||
@@ -140,7 +140,7 @@ CodecSelector::~CodecSelector()
|
|||||||
|
|
||||||
void CodecSelector::updateButtons()
|
void CodecSelector::updateButtons()
|
||||||
{
|
{
|
||||||
bool hasCodec = (selectedCodec() != 0);
|
bool hasCodec = (selectedCodec() != nullptr);
|
||||||
m_reloadButton->setEnabled(!m_isModified && hasCodec);
|
m_reloadButton->setEnabled(!m_isModified && hasCodec);
|
||||||
m_saveButton->setEnabled(!m_hasDecodingError && hasCodec);
|
m_saveButton->setEnabled(!m_hasDecodingError && hasCodec);
|
||||||
}
|
}
|
||||||
@@ -149,13 +149,13 @@ QTextCodec *CodecSelector::selectedCodec() const
|
|||||||
{
|
{
|
||||||
if (QListWidgetItem *item = m_listWidget->currentItem()) {
|
if (QListWidgetItem *item = m_listWidget->currentItem()) {
|
||||||
if (!item->isSelected())
|
if (!item->isSelected())
|
||||||
return 0;
|
return nullptr;
|
||||||
QString codecName = item->text();
|
QString codecName = item->text();
|
||||||
if (codecName.contains(QLatin1String(" / ")))
|
if (codecName.contains(QLatin1String(" / ")))
|
||||||
codecName = codecName.left(codecName.indexOf(QLatin1String(" / ")));
|
codecName = codecName.left(codecName.indexOf(QLatin1String(" / ")));
|
||||||
return QTextCodec::codecForName(codecName.toLatin1());
|
return QTextCodec::codecForName(codecName.toLatin1());
|
||||||
}
|
}
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CodecSelector::buttonClicked(QAbstractButton *button)
|
void CodecSelector::buttonClicked(QAbstractButton *button)
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ CodeStyleEditor::CodeStyleEditor(ICodeStylePreferencesFactory *factory,
|
|||||||
m_codeStyle(codeStyle)
|
m_codeStyle(codeStyle)
|
||||||
{
|
{
|
||||||
m_layout = new QVBoxLayout(this);
|
m_layout = new QVBoxLayout(this);
|
||||||
CodeStyleSelectorWidget *selector = new CodeStyleSelectorWidget(factory, this);
|
auto selector = new CodeStyleSelectorWidget(factory, this);
|
||||||
selector->setCodeStyle(codeStyle);
|
selector->setCodeStyle(codeStyle);
|
||||||
m_preview = new SnippetEditorWidget(this);
|
m_preview = new SnippetEditorWidget(this);
|
||||||
DisplaySettings displaySettings = m_preview->displaySettings();
|
DisplaySettings displaySettings = m_preview->displaySettings();
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class CodeStylePoolPrivate
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CodeStylePoolPrivate()
|
CodeStylePoolPrivate()
|
||||||
: m_factory(0)
|
: m_factory(nullptr)
|
||||||
{}
|
{}
|
||||||
~CodeStylePoolPrivate();
|
~CodeStylePoolPrivate();
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ ICodeStylePreferences *CodeStylePool::createCodeStyle(const QByteArray &id, cons
|
|||||||
const QVariant &codeStyleData, const QString &displayName)
|
const QVariant &codeStyleData, const QString &displayName)
|
||||||
{
|
{
|
||||||
if (!d->m_factory)
|
if (!d->m_factory)
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
ICodeStylePreferences *codeStyle = d->m_factory->createCodeStyle();
|
ICodeStylePreferences *codeStyle = d->m_factory->createCodeStyle();
|
||||||
codeStyle->setId(id);
|
codeStyle->setId(id);
|
||||||
@@ -236,7 +236,7 @@ ICodeStylePreferences *CodeStylePool::importCodeStyle(const Utils::FileName &fil
|
|||||||
|
|
||||||
ICodeStylePreferences *CodeStylePool::loadCodeStyle(const Utils::FileName &fileName)
|
ICodeStylePreferences *CodeStylePool::loadCodeStyle(const Utils::FileName &fileName)
|
||||||
{
|
{
|
||||||
ICodeStylePreferences *codeStyle = 0;
|
ICodeStylePreferences *codeStyle = nullptr;
|
||||||
Utils::PersistentSettingsReader reader;
|
Utils::PersistentSettingsReader reader;
|
||||||
reader.load(fileName);
|
reader.load(fileName);
|
||||||
QVariantMap m = reader.restoreValues();
|
QVariantMap m = reader.restoreValues();
|
||||||
@@ -258,7 +258,7 @@ ICodeStylePreferences *CodeStylePool::loadCodeStyle(const Utils::FileName &fileN
|
|||||||
|
|
||||||
void CodeStylePool::slotSaveCodeStyle()
|
void CodeStylePool::slotSaveCodeStyle()
|
||||||
{
|
{
|
||||||
ICodeStylePreferences *codeStyle = qobject_cast<ICodeStylePreferences *>(sender());
|
auto codeStyle = qobject_cast<ICodeStylePreferences *>(sender());
|
||||||
if (!codeStyle)
|
if (!codeStyle)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -52,8 +52,8 @@ class CodeStyleDialog : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CodeStyleDialog(ICodeStylePreferencesFactory *factory,
|
CodeStyleDialog(ICodeStylePreferencesFactory *factory,
|
||||||
ICodeStylePreferences *codeStyle, QWidget *parent = 0);
|
ICodeStylePreferences *codeStyle, QWidget *parent = nullptr);
|
||||||
~CodeStyleDialog();
|
~CodeStyleDialog() override;
|
||||||
ICodeStylePreferences *codeStyle() const;
|
ICodeStylePreferences *codeStyle() const;
|
||||||
private:
|
private:
|
||||||
void slotCopyClicked();
|
void slotCopyClicked();
|
||||||
@@ -62,28 +62,26 @@ private:
|
|||||||
ICodeStylePreferences *m_codeStyle;
|
ICodeStylePreferences *m_codeStyle;
|
||||||
QLineEdit *m_lineEdit;
|
QLineEdit *m_lineEdit;
|
||||||
QDialogButtonBox *m_buttons;
|
QDialogButtonBox *m_buttons;
|
||||||
QLabel *m_warningLabel;
|
QLabel *m_warningLabel = nullptr;
|
||||||
QPushButton *m_copyButton;
|
QPushButton *m_copyButton = nullptr;
|
||||||
QString m_originalDisplayName;
|
QString m_originalDisplayName;
|
||||||
};
|
};
|
||||||
|
|
||||||
CodeStyleDialog::CodeStyleDialog(ICodeStylePreferencesFactory *factory,
|
CodeStyleDialog::CodeStyleDialog(ICodeStylePreferencesFactory *factory,
|
||||||
ICodeStylePreferences *codeStyle, QWidget *parent)
|
ICodeStylePreferences *codeStyle, QWidget *parent)
|
||||||
: QDialog(parent),
|
: QDialog(parent)
|
||||||
m_warningLabel(0),
|
|
||||||
m_copyButton(0)
|
|
||||||
{
|
{
|
||||||
setWindowTitle(tr("Edit Code Style"));
|
setWindowTitle(tr("Edit Code Style"));
|
||||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
auto layout = new QVBoxLayout(this);
|
||||||
QLabel *label = new QLabel(tr("Code style name:"));
|
QLabel *label = new QLabel(tr("Code style name:"));
|
||||||
m_lineEdit = new QLineEdit(codeStyle->displayName(), this);
|
m_lineEdit = new QLineEdit(codeStyle->displayName(), this);
|
||||||
QHBoxLayout *nameLayout = new QHBoxLayout();
|
auto nameLayout = new QHBoxLayout;
|
||||||
nameLayout->addWidget(label);
|
nameLayout->addWidget(label);
|
||||||
nameLayout->addWidget(m_lineEdit);
|
nameLayout->addWidget(m_lineEdit);
|
||||||
layout->addLayout(nameLayout);
|
layout->addLayout(nameLayout);
|
||||||
|
|
||||||
if (codeStyle->isReadOnly()) {
|
if (codeStyle->isReadOnly()) {
|
||||||
QHBoxLayout *warningLayout = new QHBoxLayout();
|
auto warningLayout = new QHBoxLayout;
|
||||||
m_warningLabel = new QLabel(
|
m_warningLabel = new QLabel(
|
||||||
tr("You cannot save changes to a built-in code style. "
|
tr("You cannot save changes to a built-in code style. "
|
||||||
"Copy it first to create your own version."), this);
|
"Copy it first to create your own version."), this);
|
||||||
@@ -158,9 +156,7 @@ CodeStyleDialog::~CodeStyleDialog()
|
|||||||
CodeStyleSelectorWidget::CodeStyleSelectorWidget(ICodeStylePreferencesFactory *factory, QWidget *parent) :
|
CodeStyleSelectorWidget::CodeStyleSelectorWidget(ICodeStylePreferencesFactory *factory, QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
m_factory(factory),
|
m_factory(factory),
|
||||||
m_codeStyle(0),
|
m_ui(new Internal::Ui::CodeStyleSelectorWidget)
|
||||||
m_ui(new Internal::Ui::CodeStyleSelectorWidget),
|
|
||||||
m_ignoreGuiSignals(false)
|
|
||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
m_ui->importButton->setEnabled(false);
|
m_ui->importButton->setEnabled(false);
|
||||||
@@ -239,8 +235,7 @@ void CodeStyleSelectorWidget::slotComboBoxActivated(int index)
|
|||||||
|
|
||||||
if (index < 0 || index >= m_ui->delegateComboBox->count())
|
if (index < 0 || index >= m_ui->delegateComboBox->count())
|
||||||
return;
|
return;
|
||||||
ICodeStylePreferences *delegate =
|
auto delegate = m_ui->delegateComboBox->itemData(index).value<ICodeStylePreferences *>();
|
||||||
m_ui->delegateComboBox->itemData(index).value<ICodeStylePreferences *>();
|
|
||||||
|
|
||||||
QSignalBlocker blocker(this);
|
QSignalBlocker blocker(this);
|
||||||
m_codeStyle->setCurrentDelegate(delegate);
|
m_codeStyle->setCurrentDelegate(delegate);
|
||||||
@@ -319,7 +314,7 @@ void CodeStyleSelectorWidget::slotRemoveClicked()
|
|||||||
this);
|
this);
|
||||||
|
|
||||||
// Change the text and role of the discard button
|
// Change the text and role of the discard button
|
||||||
QPushButton *deleteButton = static_cast<QPushButton*>(messageBox.button(QMessageBox::Discard));
|
auto deleteButton = static_cast<QPushButton*>(messageBox.button(QMessageBox::Discard));
|
||||||
deleteButton->setText(tr("Delete"));
|
deleteButton->setText(tr("Delete"));
|
||||||
messageBox.addButton(deleteButton, QMessageBox::AcceptRole);
|
messageBox.addButton(deleteButton, QMessageBox::AcceptRole);
|
||||||
messageBox.setDefaultButton(deleteButton);
|
messageBox.setDefaultButton(deleteButton);
|
||||||
@@ -390,7 +385,7 @@ void CodeStyleSelectorWidget::slotCodeStyleRemoved(ICodeStylePreferences *codeSt
|
|||||||
|
|
||||||
void CodeStyleSelectorWidget::slotUpdateName()
|
void CodeStyleSelectorWidget::slotUpdateName()
|
||||||
{
|
{
|
||||||
ICodeStylePreferences *changedCodeStyle = qobject_cast<ICodeStylePreferences *>(sender());
|
auto changedCodeStyle = qobject_cast<ICodeStylePreferences *>(sender());
|
||||||
if (!changedCodeStyle)
|
if (!changedCodeStyle)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -59,13 +59,13 @@ private:
|
|||||||
|
|
||||||
void updateName(ICodeStylePreferences *codeStyle);
|
void updateName(ICodeStylePreferences *codeStyle);
|
||||||
ICodeStylePreferencesFactory *m_factory;
|
ICodeStylePreferencesFactory *m_factory;
|
||||||
ICodeStylePreferences *m_codeStyle;
|
ICodeStylePreferences *m_codeStyle = nullptr;
|
||||||
|
|
||||||
QString displayName(ICodeStylePreferences *codeStyle) const;
|
QString displayName(ICodeStylePreferences *codeStyle) const;
|
||||||
|
|
||||||
Internal::Ui::CodeStyleSelectorWidget *m_ui;
|
Internal::Ui::CodeStyleSelectorWidget *m_ui;
|
||||||
|
|
||||||
bool m_ignoreGuiSignals;
|
bool m_ignoreGuiSignals = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace TextEditor
|
} // namespace TextEditor
|
||||||
|
|||||||
@@ -292,10 +292,6 @@ namespace {
|
|||||||
class ColorSchemeReader : public QXmlStreamReader
|
class ColorSchemeReader : public QXmlStreamReader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ColorSchemeReader() :
|
|
||||||
m_scheme(0)
|
|
||||||
{}
|
|
||||||
|
|
||||||
bool read(const QString &fileName, ColorScheme *scheme);
|
bool read(const QString &fileName, ColorScheme *scheme);
|
||||||
QString readName(const QString &fileName);
|
QString readName(const QString &fileName);
|
||||||
|
|
||||||
@@ -305,7 +301,7 @@ private:
|
|||||||
void readStyleScheme();
|
void readStyleScheme();
|
||||||
void readStyle();
|
void readStyle();
|
||||||
|
|
||||||
ColorScheme *m_scheme;
|
ColorScheme *m_scheme = nullptr;
|
||||||
QString m_name;
|
QString m_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -332,7 +328,7 @@ bool ColorSchemeReader::read(const QString &fileName, ColorScheme *scheme)
|
|||||||
|
|
||||||
QString ColorSchemeReader::readName(const QString &fileName)
|
QString ColorSchemeReader::readName(const QString &fileName)
|
||||||
{
|
{
|
||||||
read(fileName, 0);
|
read(fileName, nullptr);
|
||||||
return m_name;
|
return m_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,10 +54,8 @@ namespace Internal {
|
|||||||
class FormatsModel : public QAbstractListModel
|
class FormatsModel : public QAbstractListModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FormatsModel(QObject *parent = 0):
|
FormatsModel(QObject *parent = nullptr):
|
||||||
QAbstractListModel(parent),
|
QAbstractListModel(parent)
|
||||||
m_descriptions(0),
|
|
||||||
m_scheme(0)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,12 +80,12 @@ public:
|
|||||||
emitDataChanged(index(0));
|
emitDataChanged(index(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
int rowCount(const QModelIndex &parent) const
|
int rowCount(const QModelIndex &parent) const override
|
||||||
{
|
{
|
||||||
return (parent.isValid() || !m_descriptions) ? 0 : int(m_descriptions->size());
|
return (parent.isValid() || !m_descriptions) ? 0 : int(m_descriptions->size());
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant data(const QModelIndex &index, int role) const
|
QVariant data(const QModelIndex &index, int role) const override
|
||||||
{
|
{
|
||||||
if (!m_descriptions || !m_scheme)
|
if (!m_descriptions || !m_scheme)
|
||||||
return QVariant();
|
return QVariant();
|
||||||
@@ -139,8 +137,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const FormatDescriptions *m_descriptions;
|
const FormatDescriptions *m_descriptions = nullptr;
|
||||||
const ColorScheme *m_scheme;
|
const ColorScheme *m_scheme = nullptr;
|
||||||
QFont m_baseFont;
|
QFont m_baseFont;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ using namespace CppTools;
|
|||||||
|
|
||||||
CompletionSettingsPage::CompletionSettingsPage(QObject *parent)
|
CompletionSettingsPage::CompletionSettingsPage(QObject *parent)
|
||||||
: TextEditor::TextEditorOptionsPage(parent)
|
: TextEditor::TextEditorOptionsPage(parent)
|
||||||
, m_page(0)
|
|
||||||
{
|
{
|
||||||
setId("P.Completion");
|
setId("P.Completion");
|
||||||
setDisplayName(tr("Completion"));
|
setDisplayName(tr("Completion"));
|
||||||
@@ -204,7 +203,7 @@ void CompletionSettingsPage::finish()
|
|||||||
if (!m_page) // page was never shown
|
if (!m_page) // page was never shown
|
||||||
return;
|
return;
|
||||||
delete m_page;
|
delete m_page;
|
||||||
m_page = 0;
|
m_page = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const CompletionSettings &CompletionSettingsPage::completionSettings()
|
const CompletionSettings &CompletionSettingsPage::completionSettings()
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ private:
|
|||||||
|
|
||||||
void onCompletionTriggerChanged();
|
void onCompletionTriggerChanged();
|
||||||
|
|
||||||
Ui::CompletionSettingsPage *m_page;
|
Ui::CompletionSettingsPage *m_page = nullptr;
|
||||||
QPointer<QWidget> m_widget;
|
QPointer<QWidget> m_widget;
|
||||||
CommentsSettings m_commentsSettings;
|
CommentsSettings m_commentsSettings;
|
||||||
CompletionSettings m_completionSettings;
|
CompletionSettings m_completionSettings;
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ bool DisplaySettings::equals(const DisplaySettings &ds) const
|
|||||||
|
|
||||||
QLabel *DisplaySettings::createAnnotationSettingsLink()
|
QLabel *DisplaySettings::createAnnotationSettingsLink()
|
||||||
{
|
{
|
||||||
auto *label = new QLabel("<i><a href>Annotation Settings</a></i>", Core::ICore::mainWindow());
|
auto label = new QLabel("<i><a href>Annotation Settings</a></i>", Core::ICore::mainWindow());
|
||||||
QObject::connect(label, &QLabel::linkActivated, []() {
|
QObject::connect(label, &QLabel::linkActivated, []() {
|
||||||
Utils::ToolTip::hideImmediately();
|
Utils::ToolTip::hideImmediately();
|
||||||
Core::ICore::showOptionsDialog(Constants::TEXT_EDITOR_DISPLAY_SETTINGS);
|
Core::ICore::showOptionsDialog(Constants::TEXT_EDITOR_DISPLAY_SETTINGS);
|
||||||
|
|||||||
@@ -41,14 +41,14 @@ struct DisplaySettingsPage::DisplaySettingsPagePrivate
|
|||||||
|
|
||||||
const DisplaySettingsPageParameters m_parameters;
|
const DisplaySettingsPageParameters m_parameters;
|
||||||
QPointer<QWidget> m_widget;
|
QPointer<QWidget> m_widget;
|
||||||
Internal::Ui::DisplaySettingsPage *m_page;
|
Internal::Ui::DisplaySettingsPage *m_page = nullptr;
|
||||||
DisplaySettings m_displaySettings;
|
DisplaySettings m_displaySettings;
|
||||||
MarginSettings m_marginSettings;
|
MarginSettings m_marginSettings;
|
||||||
};
|
};
|
||||||
|
|
||||||
DisplaySettingsPage::DisplaySettingsPagePrivate::DisplaySettingsPagePrivate
|
DisplaySettingsPage::DisplaySettingsPagePrivate::DisplaySettingsPagePrivate
|
||||||
(const DisplaySettingsPageParameters &p)
|
(const DisplaySettingsPageParameters &p)
|
||||||
: m_parameters(p), m_page(0)
|
: m_parameters(p)
|
||||||
{
|
{
|
||||||
m_displaySettings.fromSettings(m_parameters.settingsPrefix, Core::ICore::settings());
|
m_displaySettings.fromSettings(m_parameters.settingsPrefix, Core::ICore::settings());
|
||||||
m_marginSettings.fromSettings(m_parameters.settingsPrefix, Core::ICore::settings());
|
m_marginSettings.fromSettings(m_parameters.settingsPrefix, Core::ICore::settings());
|
||||||
@@ -96,7 +96,7 @@ void DisplaySettingsPage::finish()
|
|||||||
if (!d->m_page) // page was never shown
|
if (!d->m_page) // page was never shown
|
||||||
return;
|
return;
|
||||||
delete d->m_page;
|
delete d->m_page;
|
||||||
d->m_page = 0;
|
d->m_page = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplaySettingsPage::settingsFromUI(DisplaySettings &displaySettings,
|
void DisplaySettingsPage::settingsFromUI(DisplaySettings &displaySettings,
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ using namespace TextEditor;
|
|||||||
using namespace TextEditor::Internal;
|
using namespace TextEditor::Internal;
|
||||||
|
|
||||||
FindInCurrentFile::FindInCurrentFile()
|
FindInCurrentFile::FindInCurrentFile()
|
||||||
: m_currentDocument(0)
|
|
||||||
{
|
{
|
||||||
connect(Core::EditorManager::instance(), &Core::EditorManager::currentEditorChanged,
|
connect(Core::EditorManager::instance(), &Core::EditorManager::currentEditorChanged,
|
||||||
this, &FindInCurrentFile::handleFileChange);
|
this, &FindInCurrentFile::handleFileChange);
|
||||||
@@ -95,7 +94,7 @@ void FindInCurrentFile::handleFileChange(Core::IEditor *editor)
|
|||||||
{
|
{
|
||||||
if (!editor) {
|
if (!editor) {
|
||||||
if (m_currentDocument) {
|
if (m_currentDocument) {
|
||||||
m_currentDocument = 0;
|
m_currentDocument = nullptr;
|
||||||
emit enabledChanged(isEnabled());
|
emit enabledChanged(isEnabled());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -48,12 +48,10 @@ using namespace Core;
|
|||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
using namespace Utils;
|
using namespace Utils;
|
||||||
|
|
||||||
static FindInFiles *m_instance = 0;
|
static FindInFiles *m_instance = nullptr;
|
||||||
static const char HistoryKey[] = "FindInFiles.Directories.History";
|
static const char HistoryKey[] = "FindInFiles.Directories.History";
|
||||||
|
|
||||||
FindInFiles::FindInFiles()
|
FindInFiles::FindInFiles()
|
||||||
: m_configWidget(0),
|
|
||||||
m_directory(0)
|
|
||||||
{
|
{
|
||||||
m_instance = this;
|
m_instance = this;
|
||||||
connect(EditorManager::instance(), &EditorManager::findOnFileSystemRequest,
|
connect(EditorManager::instance(), &EditorManager::findOnFileSystemRequest,
|
||||||
@@ -147,7 +145,7 @@ QWidget *FindInFiles::createConfigWidget()
|
|||||||
{
|
{
|
||||||
if (!m_configWidget) {
|
if (!m_configWidget) {
|
||||||
m_configWidget = new QWidget;
|
m_configWidget = new QWidget;
|
||||||
QGridLayout * const gridLayout = new QGridLayout(m_configWidget);
|
auto gridLayout = new QGridLayout(m_configWidget);
|
||||||
gridLayout->setMargin(0);
|
gridLayout->setMargin(0);
|
||||||
m_configWidget->setLayout(gridLayout);
|
m_configWidget->setLayout(gridLayout);
|
||||||
|
|
||||||
|
|||||||
@@ -66,15 +66,15 @@ struct ColorSchemeEntry
|
|||||||
class SchemeListModel : public QAbstractListModel
|
class SchemeListModel : public QAbstractListModel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SchemeListModel(QObject *parent = 0):
|
SchemeListModel(QObject *parent = nullptr):
|
||||||
QAbstractListModel(parent)
|
QAbstractListModel(parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
int rowCount(const QModelIndex &parent) const
|
int rowCount(const QModelIndex &parent) const override
|
||||||
{ return parent.isValid() ? 0 : m_colorSchemes.size(); }
|
{ return parent.isValid() ? 0 : m_colorSchemes.size(); }
|
||||||
|
|
||||||
QVariant data(const QModelIndex &index, int role) const
|
QVariant data(const QModelIndex &index, int role) const override
|
||||||
{
|
{
|
||||||
if (role == Qt::DisplayRole)
|
if (role == Qt::DisplayRole)
|
||||||
return m_colorSchemes.at(index.row()).name;
|
return m_colorSchemes.at(index.row()).name;
|
||||||
@@ -526,7 +526,7 @@ void FontSettingsPage::confirmDeleteColorScheme()
|
|||||||
d_ptr->m_ui->deleteButton->window());
|
d_ptr->m_ui->deleteButton->window());
|
||||||
|
|
||||||
// Change the text and role of the discard button
|
// Change the text and role of the discard button
|
||||||
QPushButton *deleteButton = static_cast<QPushButton*>(messageBox->button(QMessageBox::Discard));
|
auto deleteButton = static_cast<QPushButton*>(messageBox->button(QMessageBox::Discard));
|
||||||
deleteButton->setText(tr("Delete"));
|
deleteButton->setText(tr("Delete"));
|
||||||
messageBox->addButton(deleteButton, QMessageBox::AcceptRole);
|
messageBox->addButton(deleteButton, QMessageBox::AcceptRole);
|
||||||
messageBox->setDefaultButton(deleteButton);
|
messageBox->setDefaultButton(deleteButton);
|
||||||
@@ -562,7 +562,7 @@ void FontSettingsPage::maybeSaveColorScheme()
|
|||||||
d_ptr->m_ui->schemeComboBox->window());
|
d_ptr->m_ui->schemeComboBox->window());
|
||||||
|
|
||||||
// Change the text of the discard button
|
// Change the text of the discard button
|
||||||
QPushButton *discardButton = static_cast<QPushButton*>(messageBox.button(QMessageBox::Discard));
|
auto discardButton = static_cast<QPushButton*>(messageBox.button(QMessageBox::Discard));
|
||||||
discardButton->setText(tr("Discard"));
|
discardButton->setText(tr("Discard"));
|
||||||
messageBox.addButton(discardButton, QMessageBox::DestructiveRole);
|
messageBox.addButton(discardButton, QMessageBox::DestructiveRole);
|
||||||
messageBox.setDefaultButton(QMessageBox::Save);
|
messageBox.setDefaultButton(QMessageBox::Save);
|
||||||
@@ -658,7 +658,7 @@ void FontSettingsPage::finish()
|
|||||||
// If changes were applied, these are equal. Otherwise restores last value.
|
// If changes were applied, these are equal. Otherwise restores last value.
|
||||||
d_ptr->m_value = d_ptr->m_lastValue;
|
d_ptr->m_value = d_ptr->m_lastValue;
|
||||||
delete d_ptr->m_ui;
|
delete d_ptr->m_ui;
|
||||||
d_ptr->m_ui = 0;
|
d_ptr->m_ui = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const FontSettings &FontSettingsPage::fontSettings() const
|
const FontSettings &FontSettingsPage::fontSettings() const
|
||||||
|
|||||||
@@ -347,7 +347,7 @@ void formatEditorAsync(TextEditorWidget *editor, const Command &command, int sta
|
|||||||
if (sd.isEmpty())
|
if (sd.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto *watcher = new QFutureWatcher<FormatTask>;
|
auto watcher = new QFutureWatcher<FormatTask>;
|
||||||
const TextDocument *doc = editor->textDocument();
|
const TextDocument *doc = editor->textDocument();
|
||||||
QObject::connect(doc, &TextDocument::contentsChanged, watcher, &QFutureWatcher<FormatTask>::cancel);
|
QObject::connect(doc, &TextDocument::contentsChanged, watcher, &QFutureWatcher<FormatTask>::cancel);
|
||||||
QObject::connect(watcher, &QFutureWatcherBase::finished, [watcher] {
|
QObject::connect(watcher, &QFutureWatcherBase::finished, [watcher] {
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace Internal {
|
|||||||
void updateDynamicRules(const QList<QSharedPointer<Rule> > &rules, const QStringList &captures)
|
void updateDynamicRules(const QList<QSharedPointer<Rule> > &rules, const QStringList &captures)
|
||||||
{
|
{
|
||||||
foreach (QSharedPointer<Rule> rule, rules) {
|
foreach (QSharedPointer<Rule> rule, rules) {
|
||||||
DynamicRule *dynamicRule = dynamic_cast<DynamicRule *>(rule.data());
|
auto dynamicRule = dynamic_cast<DynamicRule *>(rule.data());
|
||||||
if (dynamicRule && dynamicRule->isActive())
|
if (dynamicRule && dynamicRule->isActive())
|
||||||
dynamicRule->replaceExpressions(captures);
|
dynamicRule->replaceExpressions(captures);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class DynamicRule : public Rule
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DynamicRule();
|
DynamicRule();
|
||||||
virtual ~DynamicRule();
|
~DynamicRule() override;
|
||||||
|
|
||||||
void setActive(const QString &active);
|
void setActive(const QString &active);
|
||||||
bool isActive() const;
|
bool isActive() const;
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ void HighlightDefinitionHandler::foldingElementStarted(const QXmlAttributes &att
|
|||||||
|
|
||||||
void HighlightDefinitionHandler::detectCharStarted(const QXmlAttributes &atts)
|
void HighlightDefinitionHandler::detectCharStarted(const QXmlAttributes &atts)
|
||||||
{
|
{
|
||||||
DetectCharRule *rule = new DetectCharRule;
|
auto rule = new DetectCharRule;
|
||||||
rule->setChar(atts.value(kChar));
|
rule->setChar(atts.value(kChar));
|
||||||
rule->setActive(atts.value(kDynamic));
|
rule->setActive(atts.value(kDynamic));
|
||||||
ruleElementStarted(atts, QSharedPointer<Rule>(rule));
|
ruleElementStarted(atts, QSharedPointer<Rule>(rule));
|
||||||
@@ -314,7 +314,7 @@ void HighlightDefinitionHandler::detectCharStarted(const QXmlAttributes &atts)
|
|||||||
|
|
||||||
void HighlightDefinitionHandler::detect2CharsStarted(const QXmlAttributes &atts)
|
void HighlightDefinitionHandler::detect2CharsStarted(const QXmlAttributes &atts)
|
||||||
{
|
{
|
||||||
Detect2CharsRule *rule = new Detect2CharsRule;
|
auto rule = new Detect2CharsRule;
|
||||||
rule->setChar(atts.value(kChar));
|
rule->setChar(atts.value(kChar));
|
||||||
rule->setChar1(atts.value(kChar1));
|
rule->setChar1(atts.value(kChar1));
|
||||||
rule->setActive(atts.value(kDynamic));
|
rule->setActive(atts.value(kDynamic));
|
||||||
@@ -323,14 +323,14 @@ void HighlightDefinitionHandler::detect2CharsStarted(const QXmlAttributes &atts)
|
|||||||
|
|
||||||
void HighlightDefinitionHandler::anyCharStarted(const QXmlAttributes &atts)
|
void HighlightDefinitionHandler::anyCharStarted(const QXmlAttributes &atts)
|
||||||
{
|
{
|
||||||
AnyCharRule *rule = new AnyCharRule;
|
auto rule = new AnyCharRule;
|
||||||
rule->setCharacterSet(atts.value(kString));
|
rule->setCharacterSet(atts.value(kString));
|
||||||
ruleElementStarted(atts, QSharedPointer<Rule>(rule));
|
ruleElementStarted(atts, QSharedPointer<Rule>(rule));
|
||||||
}
|
}
|
||||||
|
|
||||||
void HighlightDefinitionHandler::stringDetectedStarted(const QXmlAttributes &atts)
|
void HighlightDefinitionHandler::stringDetectedStarted(const QXmlAttributes &atts)
|
||||||
{
|
{
|
||||||
StringDetectRule *rule = new StringDetectRule;
|
auto rule = new StringDetectRule;
|
||||||
rule->setString(atts.value(kString));
|
rule->setString(atts.value(kString));
|
||||||
rule->setInsensitive(atts.value(kInsensitive));
|
rule->setInsensitive(atts.value(kInsensitive));
|
||||||
rule->setActive(atts.value(kDynamic));
|
rule->setActive(atts.value(kDynamic));
|
||||||
@@ -339,7 +339,7 @@ void HighlightDefinitionHandler::stringDetectedStarted(const QXmlAttributes &att
|
|||||||
|
|
||||||
void HighlightDefinitionHandler::wordDetectStarted(const QXmlAttributes &atts)
|
void HighlightDefinitionHandler::wordDetectStarted(const QXmlAttributes &atts)
|
||||||
{
|
{
|
||||||
WordDetectRule *rule = new WordDetectRule;
|
auto rule = new WordDetectRule;
|
||||||
rule->setString(atts.value(kString));
|
rule->setString(atts.value(kString));
|
||||||
rule->setInsensitive(atts.value(kInsensitive));
|
rule->setInsensitive(atts.value(kInsensitive));
|
||||||
rule->setActive(atts.value(kDynamic));
|
rule->setActive(atts.value(kDynamic));
|
||||||
@@ -348,7 +348,7 @@ void HighlightDefinitionHandler::wordDetectStarted(const QXmlAttributes &atts)
|
|||||||
|
|
||||||
void HighlightDefinitionHandler::regExprStarted(const QXmlAttributes &atts)
|
void HighlightDefinitionHandler::regExprStarted(const QXmlAttributes &atts)
|
||||||
{
|
{
|
||||||
RegExprRule *rule = new RegExprRule;
|
auto rule = new RegExprRule;
|
||||||
rule->setPattern(atts.value(kString));
|
rule->setPattern(atts.value(kString));
|
||||||
rule->setMinimal(atts.value(kMinimal));
|
rule->setMinimal(atts.value(kMinimal));
|
||||||
rule->setInsensitive(atts.value(kInsensitive));
|
rule->setInsensitive(atts.value(kInsensitive));
|
||||||
@@ -358,7 +358,7 @@ void HighlightDefinitionHandler::regExprStarted(const QXmlAttributes &atts)
|
|||||||
|
|
||||||
void HighlightDefinitionHandler::keywordStarted(const QXmlAttributes &atts)
|
void HighlightDefinitionHandler::keywordStarted(const QXmlAttributes &atts)
|
||||||
{
|
{
|
||||||
KeywordRule *rule = new KeywordRule(m_definition);
|
auto rule = new KeywordRule(m_definition);
|
||||||
try {
|
try {
|
||||||
rule->setList(atts.value(kString));
|
rule->setList(atts.value(kString));
|
||||||
} catch (const HighlighterException &e) {
|
} catch (const HighlighterException &e) {
|
||||||
@@ -404,7 +404,7 @@ void HighlightDefinitionHandler::hlCCharStarted(const QXmlAttributes &atts)
|
|||||||
|
|
||||||
void HighlightDefinitionHandler::rangeDetectStarted(const QXmlAttributes &atts)
|
void HighlightDefinitionHandler::rangeDetectStarted(const QXmlAttributes &atts)
|
||||||
{
|
{
|
||||||
RangeDetectRule *rule = new RangeDetectRule;
|
auto rule = new RangeDetectRule;
|
||||||
rule->setChar(atts.value(kChar));
|
rule->setChar(atts.value(kChar));
|
||||||
rule->setChar1(atts.value(kChar1));
|
rule->setChar1(atts.value(kChar1));
|
||||||
ruleElementStarted(atts, QSharedPointer<Rule>(rule));
|
ruleElementStarted(atts, QSharedPointer<Rule>(rule));
|
||||||
|
|||||||
@@ -43,14 +43,15 @@ class HighlightDefinitionHandler : public QXmlDefaultHandler
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HighlightDefinitionHandler(const QSharedPointer<HighlightDefinition> &definition);
|
HighlightDefinitionHandler(const QSharedPointer<HighlightDefinition> &definition);
|
||||||
~HighlightDefinitionHandler();
|
~HighlightDefinitionHandler() override;
|
||||||
|
|
||||||
bool startDocument();
|
bool startDocument() override;
|
||||||
bool endDocument();
|
bool endDocument() override;
|
||||||
bool startElement(const QString &namespaceURI, const QString &localName,
|
bool startElement(const QString &namespaceURI, const QString &localName,
|
||||||
const QString &qName, const QXmlAttributes &atts);
|
const QString &qName, const QXmlAttributes &atts) override;
|
||||||
bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName);
|
bool endElement(const QString &namespaceURI, const QString &localName,
|
||||||
bool characters(const QString &ch);
|
const QString &qName) override;
|
||||||
|
bool characters(const QString &ch) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void listElementStarted(const QXmlAttributes &atts);
|
void listElementStarted(const QXmlAttributes &atts);
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public:
|
|||||||
m_continueObservableState(-1)
|
m_continueObservableState(-1)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
~HighlighterCodeFormatterData() {}
|
~HighlighterCodeFormatterData() override {}
|
||||||
int m_foldingIndentDelta;
|
int m_foldingIndentDelta;
|
||||||
int m_originalObservableState;
|
int m_originalObservableState;
|
||||||
QStack<QString> m_foldingRegions;
|
QStack<QString> m_foldingRegions;
|
||||||
@@ -71,7 +71,7 @@ public:
|
|||||||
|
|
||||||
HighlighterCodeFormatterData *formatterData(const QTextBlock &block)
|
HighlighterCodeFormatterData *formatterData(const QTextBlock &block)
|
||||||
{
|
{
|
||||||
HighlighterCodeFormatterData *data = 0;
|
HighlighterCodeFormatterData *data = nullptr;
|
||||||
if (TextBlockUserData *userData = TextDocumentLayout::userData(block)) {
|
if (TextBlockUserData *userData = TextDocumentLayout::userData(block)) {
|
||||||
data = static_cast<HighlighterCodeFormatterData *>(userData->codeFormatterData());
|
data = static_cast<HighlighterCodeFormatterData *>(userData->codeFormatterData());
|
||||||
if (!data) {
|
if (!data) {
|
||||||
@@ -127,13 +127,7 @@ static TextStyle styleForFormat(int format)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Highlighter::Highlighter(QTextDocument *parent) :
|
Highlighter::Highlighter(QTextDocument *parent) :
|
||||||
SyntaxHighlighter(parent),
|
SyntaxHighlighter(parent)
|
||||||
m_regionDepth(0),
|
|
||||||
m_indentationBasedFolding(false),
|
|
||||||
m_tabSettings(0),
|
|
||||||
m_persistentObservableStatesCounter(PersistentsStart),
|
|
||||||
m_dynamicContextsCounter(0),
|
|
||||||
m_isBroken(false)
|
|
||||||
{
|
{
|
||||||
setTextFormatCategories(TextFormatIdCount, styleForFormat);
|
setTextFormatCategories(TextFormatIdCount, styleForFormat);
|
||||||
}
|
}
|
||||||
@@ -217,7 +211,7 @@ void Highlighter::highlightBlock(const QString &text)
|
|||||||
handleContextChange(m_currentContext->lineBeginContext(),
|
handleContextChange(m_currentContext->lineBeginContext(),
|
||||||
m_currentContext->definition());
|
m_currentContext->definition());
|
||||||
|
|
||||||
ProgressData *progress = new ProgressData;
|
auto progress = new ProgressData;
|
||||||
const int length = text.length();
|
const int length = text.length();
|
||||||
while (progress->offset() < length)
|
while (progress->offset() < length)
|
||||||
iterateThroughRules(text, length, progress, false, m_currentContext->rules());
|
iterateThroughRules(text, length, progress, false, m_currentContext->rules());
|
||||||
|
|||||||
@@ -172,14 +172,14 @@ private:
|
|||||||
static int extractRegionDepth(const int state);
|
static int extractRegionDepth(const int state);
|
||||||
static int extractObservableState(const int state);
|
static int extractObservableState(const int state);
|
||||||
|
|
||||||
int m_regionDepth;
|
int m_regionDepth = 0;
|
||||||
bool m_indentationBasedFolding;
|
bool m_indentationBasedFolding = false;
|
||||||
const TabSettings *m_tabSettings;
|
const TabSettings *m_tabSettings = nullptr;
|
||||||
|
|
||||||
int m_persistentObservableStatesCounter;
|
int m_persistentObservableStatesCounter = PersistentsStart;
|
||||||
int m_dynamicContextsCounter;
|
int m_dynamicContextsCounter = 0;
|
||||||
|
|
||||||
bool m_isBroken;
|
bool m_isBroken = false;
|
||||||
|
|
||||||
QSharedPointer<Internal::Context> m_defaultContext;
|
QSharedPointer<Internal::Context> m_defaultContext;
|
||||||
QSharedPointer<Internal::Context> m_currentContext;
|
QSharedPointer<Internal::Context> m_currentContext;
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ void HighlighterSettingsPage::finish()
|
|||||||
if (!m_d->m_page) // page was not shown
|
if (!m_d->m_page) // page was not shown
|
||||||
return;
|
return;
|
||||||
delete m_d->m_page;
|
delete m_d->m_page;
|
||||||
m_d->m_page = 0;
|
m_d->m_page = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const HighlighterSettings &HighlighterSettingsPage::highlighterSettings() const
|
const HighlighterSettings &HighlighterSettingsPage::highlighterSettings() const
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ void ManageDefinitionsDialog::populateDefinitionsWidget(const QList<DefinitionMe
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int j = 0; j < 3; ++j) {
|
for (int j = 0; j < 3; ++j) {
|
||||||
QTableWidgetItem *item = new QTableWidgetItem;
|
auto item = new QTableWidgetItem;
|
||||||
if (j == 0) {
|
if (j == 0) {
|
||||||
item->setText(downloadData.name);
|
item->setText(downloadData.name);
|
||||||
item->setData(Qt::UserRole, downloadData.url);
|
item->setData(Qt::UserRole, downloadData.url);
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class ManageDefinitionsDialog : public QDialog
|
|||||||
public:
|
public:
|
||||||
explicit ManageDefinitionsDialog(const QList<DefinitionMetaDataPtr> &metaDataList,
|
explicit ManageDefinitionsDialog(const QList<DefinitionMetaDataPtr> &metaDataList,
|
||||||
const QString &path,
|
const QString &path,
|
||||||
QWidget *parent = 0);
|
QWidget *parent = nullptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void downloadDefinitions();
|
void downloadDefinitions();
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ public:
|
|||||||
this, &MultiDefinitionDownloader::downloadDefinitionsFinished);
|
this, &MultiDefinitionDownloader::downloadDefinitionsFinished);
|
||||||
}
|
}
|
||||||
|
|
||||||
~MultiDefinitionDownloader()
|
~MultiDefinitionDownloader() override
|
||||||
{
|
{
|
||||||
if (m_downloadWatcher.isRunning())
|
if (m_downloadWatcher.isRunning())
|
||||||
m_downloadWatcher.cancel();
|
m_downloadWatcher.cancel();
|
||||||
@@ -107,9 +107,7 @@ private:
|
|||||||
QString m_downloadPath;
|
QString m_downloadPath;
|
||||||
};
|
};
|
||||||
|
|
||||||
Manager::Manager() :
|
Manager::Manager()
|
||||||
m_multiDownloader(0),
|
|
||||||
m_hasQueuedRegistration(false)
|
|
||||||
{
|
{
|
||||||
connect(&m_registeringWatcher, &QFutureWatcherBase::finished,
|
connect(&m_registeringWatcher, &QFutureWatcherBase::finished,
|
||||||
this, &Manager::registerHighlightingFilesFinished);
|
this, &Manager::registerHighlightingFilesFinished);
|
||||||
@@ -404,7 +402,7 @@ void Manager::downloadAvailableDefinitionsMetaData()
|
|||||||
|
|
||||||
void Manager::downloadAvailableDefinitionsListFinished()
|
void Manager::downloadAvailableDefinitionsListFinished()
|
||||||
{
|
{
|
||||||
if (QNetworkReply *reply = qobject_cast<QNetworkReply *>(sender())) {
|
if (auto reply = qobject_cast<QNetworkReply *>(sender())) {
|
||||||
if (reply->error() == QNetworkReply::NoError)
|
if (reply->error() == QNetworkReply::NoError)
|
||||||
emit definitionsMetaDataReady(parseAvailableDefinitionsList(reply));
|
emit definitionsMetaDataReady(parseAvailableDefinitionsList(reply));
|
||||||
else
|
else
|
||||||
@@ -425,7 +423,7 @@ void MultiDefinitionDownloader::downloadDefinitions(const QList<QUrl> &urls)
|
|||||||
{
|
{
|
||||||
m_downloaders.clear();
|
m_downloaders.clear();
|
||||||
foreach (const QUrl &url, urls) {
|
foreach (const QUrl &url, urls) {
|
||||||
DefinitionDownloader *downloader = new DefinitionDownloader(url, m_downloadPath);
|
auto downloader = new DefinitionDownloader(url, m_downloadPath);
|
||||||
connect(downloader, &DefinitionDownloader::foundReferencedDefinition,
|
connect(downloader, &DefinitionDownloader::foundReferencedDefinition,
|
||||||
this, &MultiDefinitionDownloader::downloadReferencedDefinition);
|
this, &MultiDefinitionDownloader::downloadReferencedDefinition);
|
||||||
m_downloaders.append(downloader);
|
m_downloaders.append(downloader);
|
||||||
@@ -479,7 +477,7 @@ void MultiDefinitionDownloader::downloadDefinitionsFinished()
|
|||||||
void Manager::downloadDefinitionsFinished()
|
void Manager::downloadDefinitionsFinished()
|
||||||
{
|
{
|
||||||
delete m_multiDownloader;
|
delete m_multiDownloader;
|
||||||
m_multiDownloader = 0;
|
m_multiDownloader = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiDefinitionDownloader::downloadReferencedDefinition(const QString &name)
|
void MultiDefinitionDownloader::downloadReferencedDefinition(const QString &name)
|
||||||
@@ -492,7 +490,7 @@ void MultiDefinitionDownloader::downloadReferencedDefinition(const QString &name
|
|||||||
|
|
||||||
bool Manager::isDownloadingDefinitions() const
|
bool Manager::isDownloadingDefinitions() const
|
||||||
{
|
{
|
||||||
return m_multiDownloader != 0;
|
return m_multiDownloader != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Manager::clear()
|
void Manager::clear()
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ private:
|
|||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
MultiDefinitionDownloader *m_multiDownloader;
|
MultiDefinitionDownloader *m_multiDownloader = nullptr;
|
||||||
QList<DefinitionMetaDataPtr> parseAvailableDefinitionsList(QIODevice *device);
|
QList<DefinitionMetaDataPtr> parseAvailableDefinitionsList(QIODevice *device);
|
||||||
|
|
||||||
QSet<QString> m_isBuildingDefinition;
|
QSet<QString> m_isBuildingDefinition;
|
||||||
@@ -105,7 +105,7 @@ private:
|
|||||||
QHash<QString, DefinitionMetaDataPtr> m_availableDefinitions;
|
QHash<QString, DefinitionMetaDataPtr> m_availableDefinitions;
|
||||||
|
|
||||||
RegisterData m_register;
|
RegisterData m_register;
|
||||||
bool m_hasQueuedRegistration;
|
bool m_hasQueuedRegistration = false;
|
||||||
QFutureWatcher<RegisterData> m_registeringWatcher;
|
QFutureWatcher<RegisterData> m_registeringWatcher;
|
||||||
friend class ManagerProcessor;
|
friend class ManagerProcessor;
|
||||||
|
|
||||||
|
|||||||
@@ -42,16 +42,14 @@ class HighlightDefinition;
|
|||||||
class DetectCharRule : public DynamicRule
|
class DetectCharRule : public DynamicRule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~DetectCharRule() {}
|
~DetectCharRule() override {}
|
||||||
|
|
||||||
void setChar(const QString &character);
|
void setChar(const QString &character);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual bool doMatchSucceed(const QString &text,
|
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
||||||
const int length,
|
DetectCharRule *doClone() const override { return new DetectCharRule(*this); }
|
||||||
ProgressData *progress);
|
void doReplaceExpressions(const QStringList &captures) override;
|
||||||
virtual DetectCharRule *doClone() const { return new DetectCharRule(*this); }
|
|
||||||
virtual void doReplaceExpressions(const QStringList &captures);
|
|
||||||
|
|
||||||
QChar m_char;
|
QChar m_char;
|
||||||
};
|
};
|
||||||
@@ -59,17 +57,15 @@ private:
|
|||||||
class Detect2CharsRule : public DynamicRule
|
class Detect2CharsRule : public DynamicRule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~Detect2CharsRule() {}
|
~Detect2CharsRule() override {}
|
||||||
|
|
||||||
void setChar(const QString &character);
|
void setChar(const QString &character);
|
||||||
void setChar1(const QString &character);
|
void setChar1(const QString &character);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual bool doMatchSucceed(const QString &text,
|
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
||||||
const int length,
|
Detect2CharsRule *doClone() const override { return new Detect2CharsRule(*this); }
|
||||||
ProgressData *progress);
|
void doReplaceExpressions(const QStringList &captures) override;
|
||||||
virtual Detect2CharsRule *doClone() const { return new Detect2CharsRule(*this); }
|
|
||||||
virtual void doReplaceExpressions(const QStringList &captures);
|
|
||||||
|
|
||||||
QChar m_char;
|
QChar m_char;
|
||||||
QChar m_char1;
|
QChar m_char1;
|
||||||
@@ -78,15 +74,13 @@ private:
|
|||||||
class AnyCharRule : public Rule
|
class AnyCharRule : public Rule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~AnyCharRule() {}
|
~AnyCharRule() override {}
|
||||||
|
|
||||||
void setCharacterSet(const QString &s);
|
void setCharacterSet(const QString &s);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual bool doMatchSucceed(const QString &text,
|
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
||||||
const int length,
|
AnyCharRule *doClone() const override { return new AnyCharRule(*this); }
|
||||||
ProgressData *progress);
|
|
||||||
virtual AnyCharRule *doClone() const { return new AnyCharRule(*this); }
|
|
||||||
|
|
||||||
QString m_characterSet;
|
QString m_characterSet;
|
||||||
};
|
};
|
||||||
@@ -94,17 +88,15 @@ private:
|
|||||||
class StringDetectRule : public DynamicRule
|
class StringDetectRule : public DynamicRule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~StringDetectRule() {}
|
~StringDetectRule() override {}
|
||||||
|
|
||||||
void setString(const QString &s);
|
void setString(const QString &s);
|
||||||
void setInsensitive(const QString &insensitive);
|
void setInsensitive(const QString &insensitive);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool doMatchSucceed(const QString &text,
|
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
||||||
const int length,
|
StringDetectRule *doClone() const override { return new StringDetectRule(*this); }
|
||||||
ProgressData *progress);
|
void doReplaceExpressions(const QStringList &captures) override;
|
||||||
virtual StringDetectRule *doClone() const { return new StringDetectRule(*this); }
|
|
||||||
virtual void doReplaceExpressions(const QStringList &captures);
|
|
||||||
|
|
||||||
QString m_string;
|
QString m_string;
|
||||||
int m_length = 0;
|
int m_length = 0;
|
||||||
@@ -114,28 +106,24 @@ protected:
|
|||||||
class WordDetectRule : public StringDetectRule
|
class WordDetectRule : public StringDetectRule
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
virtual bool doMatchSucceed(const QString &text,
|
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
||||||
const int length,
|
WordDetectRule *doClone() const override { return new WordDetectRule(*this); }
|
||||||
ProgressData *progress);
|
|
||||||
virtual WordDetectRule *doClone() const { return new WordDetectRule(*this); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class RegExprRule : public DynamicRule
|
class RegExprRule : public DynamicRule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~RegExprRule();
|
~RegExprRule() override;
|
||||||
|
|
||||||
void setPattern(const QString &pattern);
|
void setPattern(const QString &pattern);
|
||||||
void setInsensitive(const QString &insensitive);
|
void setInsensitive(const QString &insensitive);
|
||||||
void setMinimal(const QString &minimal);
|
void setMinimal(const QString &minimal);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual bool doMatchSucceed(const QString &text,
|
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
||||||
const int length,
|
RegExprRule *doClone() const override;
|
||||||
ProgressData *progress);
|
void doReplaceExpressions(const QStringList &captures) override;
|
||||||
virtual RegExprRule *doClone() const;
|
void doProgressFinished() override;
|
||||||
virtual void doReplaceExpressions(const QStringList &captures);
|
|
||||||
virtual void doProgressFinished();
|
|
||||||
|
|
||||||
bool isExactMatch(ProgressData *progress);
|
bool isExactMatch(ProgressData *progress);
|
||||||
|
|
||||||
@@ -152,16 +140,14 @@ class KeywordRule : public Rule
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
KeywordRule(const QSharedPointer<HighlightDefinition> &definition);
|
KeywordRule(const QSharedPointer<HighlightDefinition> &definition);
|
||||||
virtual ~KeywordRule();
|
~KeywordRule() override;
|
||||||
|
|
||||||
void setInsensitive(const QString &insensitive);
|
void setInsensitive(const QString &insensitive);
|
||||||
void setList(const QString &listName);
|
void setList(const QString &listName);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual bool doMatchSucceed(const QString &text,
|
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
||||||
const int length,
|
KeywordRule *doClone() const override { return new KeywordRule(*this); }
|
||||||
ProgressData *progress);
|
|
||||||
virtual KeywordRule *doClone() const { return new KeywordRule(*this); }
|
|
||||||
|
|
||||||
bool m_overrideGlobal;
|
bool m_overrideGlobal;
|
||||||
Qt::CaseSensitivity m_localCaseSensitivity;
|
Qt::CaseSensitivity m_localCaseSensitivity;
|
||||||
@@ -171,88 +157,74 @@ private:
|
|||||||
class IntRule : public Rule
|
class IntRule : public Rule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~IntRule() {}
|
~IntRule() override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual bool doMatchSucceed(const QString &text,
|
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
||||||
const int length,
|
IntRule *doClone() const override { return new IntRule(*this); }
|
||||||
ProgressData *progress);
|
|
||||||
virtual IntRule *doClone() const { return new IntRule(*this); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class FloatRule : public Rule
|
class FloatRule : public Rule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~FloatRule() {}
|
~FloatRule() override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual bool doMatchSucceed(const QString &text,
|
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
||||||
const int length,
|
FloatRule *doClone() const override { return new FloatRule(*this); }
|
||||||
ProgressData *progress);
|
|
||||||
virtual FloatRule *doClone() const { return new FloatRule(*this); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class HlCOctRule : public Rule
|
class HlCOctRule : public Rule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~HlCOctRule() {}
|
~HlCOctRule() override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual bool doMatchSucceed(const QString &text,
|
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
||||||
const int length,
|
HlCOctRule *doClone() const override { return new HlCOctRule(*this); }
|
||||||
ProgressData *progress);
|
|
||||||
virtual HlCOctRule *doClone() const { return new HlCOctRule(*this); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class HlCHexRule : public Rule
|
class HlCHexRule : public Rule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~HlCHexRule() {}
|
~HlCHexRule() override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual bool doMatchSucceed(const QString &text,
|
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
||||||
const int length,
|
HlCHexRule *doClone() const override { return new HlCHexRule(*this); }
|
||||||
ProgressData *progress);
|
|
||||||
virtual HlCHexRule *doClone() const { return new HlCHexRule(*this); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class HlCStringCharRule : public Rule
|
class HlCStringCharRule : public Rule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~HlCStringCharRule() {}
|
~HlCStringCharRule() override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual bool doMatchSucceed(const QString &text,
|
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
||||||
const int length,
|
HlCStringCharRule *doClone() const override { return new HlCStringCharRule(*this); }
|
||||||
ProgressData *progress);
|
|
||||||
virtual HlCStringCharRule *doClone() const { return new HlCStringCharRule(*this); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class HlCCharRule : public Rule
|
class HlCCharRule : public Rule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~HlCCharRule() {}
|
~HlCCharRule() override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual bool doMatchSucceed(const QString &text,
|
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
||||||
const int length,
|
HlCCharRule *doClone() const override { return new HlCCharRule(*this); }
|
||||||
ProgressData *progress);
|
|
||||||
virtual HlCCharRule *doClone() const { return new HlCCharRule(*this); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class RangeDetectRule : public Rule
|
class RangeDetectRule : public Rule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~RangeDetectRule() {}
|
~RangeDetectRule() override {}
|
||||||
|
|
||||||
void setChar(const QString &character);
|
void setChar(const QString &character);
|
||||||
void setChar1(const QString &character);
|
void setChar1(const QString &character);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual bool doMatchSucceed(const QString &text,
|
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
||||||
const int length,
|
RangeDetectRule *doClone() const override { return new RangeDetectRule(*this); }
|
||||||
ProgressData *progress);
|
|
||||||
virtual RangeDetectRule *doClone() const { return new RangeDetectRule(*this); }
|
|
||||||
|
|
||||||
QChar m_char;
|
QChar m_char;
|
||||||
QChar m_char1;
|
QChar m_char1;
|
||||||
@@ -261,38 +233,32 @@ private:
|
|||||||
class LineContinueRule : public Rule
|
class LineContinueRule : public Rule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~LineContinueRule() {}
|
~LineContinueRule() override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual bool doMatchSucceed(const QString &text,
|
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
||||||
const int length,
|
LineContinueRule *doClone() const override { return new LineContinueRule(*this); }
|
||||||
ProgressData *progress);
|
|
||||||
virtual LineContinueRule *doClone() const { return new LineContinueRule(*this); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DetectSpacesRule : public Rule
|
class DetectSpacesRule : public Rule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DetectSpacesRule();
|
DetectSpacesRule();
|
||||||
virtual ~DetectSpacesRule() {}
|
~DetectSpacesRule() override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual bool doMatchSucceed(const QString &text,
|
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
||||||
const int length,
|
DetectSpacesRule *doClone() const override { return new DetectSpacesRule(*this); }
|
||||||
ProgressData *progress);
|
|
||||||
virtual DetectSpacesRule *doClone() const { return new DetectSpacesRule(*this); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DetectIdentifierRule : public Rule
|
class DetectIdentifierRule : public Rule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~DetectIdentifierRule() {}
|
~DetectIdentifierRule() override {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual bool doMatchSucceed(const QString &text,
|
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
||||||
const int length,
|
DetectIdentifierRule *doClone() const override { return new DetectIdentifierRule(*this); }
|
||||||
ProgressData *progress);
|
|
||||||
virtual DetectIdentifierRule *doClone() const { return new DetectIdentifierRule(*this); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -40,18 +40,12 @@ namespace Internal {
|
|||||||
class ICodeStylePreferencesPrivate
|
class ICodeStylePreferencesPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ICodeStylePreferencesPrivate()
|
CodeStylePool *m_pool = nullptr;
|
||||||
: m_pool(0),
|
ICodeStylePreferences *m_currentDelegate = nullptr;
|
||||||
m_currentDelegate(0),
|
|
||||||
m_readOnly(false)
|
|
||||||
{}
|
|
||||||
|
|
||||||
CodeStylePool *m_pool;
|
|
||||||
ICodeStylePreferences *m_currentDelegate;
|
|
||||||
TabSettings m_tabSettings;
|
TabSettings m_tabSettings;
|
||||||
QByteArray m_id;
|
QByteArray m_id;
|
||||||
QString m_displayName;
|
QString m_displayName;
|
||||||
bool m_readOnly;
|
bool m_readOnly = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -128,7 +122,7 @@ QVariant ICodeStylePreferences::currentValue() const
|
|||||||
|
|
||||||
ICodeStylePreferences *ICodeStylePreferences::currentPreferences() const
|
ICodeStylePreferences *ICodeStylePreferences::currentPreferences() const
|
||||||
{
|
{
|
||||||
ICodeStylePreferences *prefs = (ICodeStylePreferences *)this;
|
auto prefs = (ICodeStylePreferences *)this;
|
||||||
while (prefs->currentDelegate())
|
while (prefs->currentDelegate())
|
||||||
prefs = prefs->currentDelegate();
|
prefs = prefs->currentDelegate();
|
||||||
return prefs;
|
return prefs;
|
||||||
@@ -144,7 +138,7 @@ void ICodeStylePreferences::setDelegatingPool(CodeStylePool *pool)
|
|||||||
if (pool == d->m_pool)
|
if (pool == d->m_pool)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
setCurrentDelegate(0);
|
setCurrentDelegate(nullptr);
|
||||||
if (d->m_pool) {
|
if (d->m_pool) {
|
||||||
disconnect(d->m_pool, &CodeStylePool::codeStyleRemoved,
|
disconnect(d->m_pool, &CodeStylePool::codeStyleRemoved,
|
||||||
this, &ICodeStylePreferences::codeStyleRemoved);
|
this, &ICodeStylePreferences::codeStyleRemoved);
|
||||||
@@ -247,7 +241,7 @@ void ICodeStylePreferences::codeStyleRemoved(ICodeStylePreferences *preferences)
|
|||||||
CodeStylePool *pool = delegatingPool();
|
CodeStylePool *pool = delegatingPool();
|
||||||
QList<ICodeStylePreferences *> codeStyles = pool->codeStyles();
|
QList<ICodeStylePreferences *> codeStyles = pool->codeStyles();
|
||||||
const int idx = codeStyles.indexOf(preferences);
|
const int idx = codeStyles.indexOf(preferences);
|
||||||
ICodeStylePreferences *newCurrentPreferences = 0;
|
ICodeStylePreferences *newCurrentPreferences = nullptr;
|
||||||
int i = idx + 1;
|
int i = idx + 1;
|
||||||
// go forward
|
// go forward
|
||||||
while (i < codeStyles.count()) {
|
while (i < codeStyles.count()) {
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ LineNumberFilter::LineNumberFilter(QObject *parent)
|
|||||||
void LineNumberFilter::prepareSearch(const QString &entry)
|
void LineNumberFilter::prepareSearch(const QString &entry)
|
||||||
{
|
{
|
||||||
Q_UNUSED(entry)
|
Q_UNUSED(entry)
|
||||||
m_hasCurrentEditor = EditorManager::currentEditor() != 0;
|
m_hasCurrentEditor = EditorManager::currentEditor() != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<LocatorFilterEntry> LineNumberFilter::matchesFor(QFutureInterface<LocatorFilterEntry> &, const QString &entry)
|
QList<LocatorFilterEntry> LineNumberFilter::matchesFor(QFutureInterface<LocatorFilterEntry> &, const QString &entry)
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ void OutlineWidgetStack::restoreSettings(QSettings *settings, int position)
|
|||||||
}
|
}
|
||||||
|
|
||||||
toggleSyncButton()->setChecked(syncWithEditor);
|
toggleSyncButton()->setChecked(syncWithEditor);
|
||||||
if (IOutlineWidget *outlineWidget = qobject_cast<IOutlineWidget*>(currentWidget()))
|
if (auto outlineWidget = qobject_cast<IOutlineWidget*>(currentWidget()))
|
||||||
outlineWidget->restoreSettings(m_widgetSettings);
|
outlineWidget->restoreSettings(m_widgetSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,14 +146,14 @@ bool OutlineWidgetStack::isCursorSynchronized() const
|
|||||||
void OutlineWidgetStack::toggleCursorSynchronization()
|
void OutlineWidgetStack::toggleCursorSynchronization()
|
||||||
{
|
{
|
||||||
m_syncWithEditor = !m_syncWithEditor;
|
m_syncWithEditor = !m_syncWithEditor;
|
||||||
if (IOutlineWidget *outlineWidget = qobject_cast<IOutlineWidget*>(currentWidget()))
|
if (auto outlineWidget = qobject_cast<IOutlineWidget*>(currentWidget()))
|
||||||
outlineWidget->setCursorSynchronization(m_syncWithEditor);
|
outlineWidget->setCursorSynchronization(m_syncWithEditor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutlineWidgetStack::updateFilterMenu()
|
void OutlineWidgetStack::updateFilterMenu()
|
||||||
{
|
{
|
||||||
m_filterMenu->clear();
|
m_filterMenu->clear();
|
||||||
if (IOutlineWidget *outlineWidget = qobject_cast<IOutlineWidget*>(currentWidget())) {
|
if (auto outlineWidget = qobject_cast<IOutlineWidget*>(currentWidget())) {
|
||||||
foreach (QAction *filterAction, outlineWidget->filterMenuActions()) {
|
foreach (QAction *filterAction, outlineWidget->filterMenuActions()) {
|
||||||
m_filterMenu->addAction(filterAction);
|
m_filterMenu->addAction(filterAction);
|
||||||
}
|
}
|
||||||
@@ -163,7 +163,7 @@ void OutlineWidgetStack::updateFilterMenu()
|
|||||||
|
|
||||||
void OutlineWidgetStack::updateCurrentEditor(Core::IEditor *editor)
|
void OutlineWidgetStack::updateCurrentEditor(Core::IEditor *editor)
|
||||||
{
|
{
|
||||||
IOutlineWidget *newWidget = 0;
|
IOutlineWidget *newWidget = nullptr;
|
||||||
|
|
||||||
if (editor) {
|
if (editor) {
|
||||||
for (IOutlineWidgetFactory *widgetFactory : g_outlineWidgetFactories) {
|
for (IOutlineWidgetFactory *widgetFactory : g_outlineWidgetFactories) {
|
||||||
@@ -176,7 +176,7 @@ void OutlineWidgetStack::updateCurrentEditor(Core::IEditor *editor)
|
|||||||
|
|
||||||
if (newWidget != currentWidget()) {
|
if (newWidget != currentWidget()) {
|
||||||
// delete old widget
|
// delete old widget
|
||||||
if (IOutlineWidget *outlineWidget = qobject_cast<IOutlineWidget*>(currentWidget())) {
|
if (auto outlineWidget = qobject_cast<IOutlineWidget*>(currentWidget())) {
|
||||||
QVariantMap widgetSettings = outlineWidget->settings();
|
QVariantMap widgetSettings = outlineWidget->settings();
|
||||||
for (auto iter = widgetSettings.constBegin(); iter != widgetSettings.constEnd(); ++iter)
|
for (auto iter = widgetSettings.constBegin(); iter != widgetSettings.constEnd(); ++iter)
|
||||||
m_widgetSettings.insert(iter.key(), iter.value());
|
m_widgetSettings.insert(iter.key(), iter.value());
|
||||||
@@ -205,7 +205,7 @@ OutlineFactory::OutlineFactory()
|
|||||||
Core::NavigationView OutlineFactory::createWidget()
|
Core::NavigationView OutlineFactory::createWidget()
|
||||||
{
|
{
|
||||||
Core::NavigationView n;
|
Core::NavigationView n;
|
||||||
OutlineWidgetStack *placeHolder = new OutlineWidgetStack(this);
|
auto placeHolder = new OutlineWidgetStack(this);
|
||||||
n.widget = placeHolder;
|
n.widget = placeHolder;
|
||||||
n.dockToolBarWidgets.append(placeHolder->filterButton());
|
n.dockToolBarWidgets.append(placeHolder->filterButton());
|
||||||
n.dockToolBarWidgets.append(placeHolder->toggleSyncButton());
|
n.dockToolBarWidgets.append(placeHolder->toggleSyncButton());
|
||||||
@@ -214,14 +214,14 @@ Core::NavigationView OutlineFactory::createWidget()
|
|||||||
|
|
||||||
void OutlineFactory::saveSettings(QSettings *settings, int position, QWidget *widget)
|
void OutlineFactory::saveSettings(QSettings *settings, int position, QWidget *widget)
|
||||||
{
|
{
|
||||||
OutlineWidgetStack *widgetStack = qobject_cast<OutlineWidgetStack *>(widget);
|
auto widgetStack = qobject_cast<OutlineWidgetStack *>(widget);
|
||||||
Q_ASSERT(widgetStack);
|
Q_ASSERT(widgetStack);
|
||||||
widgetStack->saveSettings(settings, position);
|
widgetStack->saveSettings(settings, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutlineFactory::restoreSettings(QSettings *settings, int position, QWidget *widget)
|
void OutlineFactory::restoreSettings(QSettings *settings, int position, QWidget *widget)
|
||||||
{
|
{
|
||||||
OutlineWidgetStack *widgetStack = qobject_cast<OutlineWidgetStack *>(widget);
|
auto widgetStack = qobject_cast<OutlineWidgetStack *>(widget);
|
||||||
Q_ASSERT(widgetStack);
|
Q_ASSERT(widgetStack);
|
||||||
widgetStack->restoreSettings(settings, position);
|
widgetStack->restoreSettings(settings, position);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
namespace TextEditor {
|
namespace TextEditor {
|
||||||
|
|
||||||
static PlainTextEditorFactory *m_instance = 0;
|
static PlainTextEditorFactory *m_instance = nullptr;
|
||||||
|
|
||||||
class PlainTextEditorWidget : public TextEditorWidget
|
class PlainTextEditorWidget : public TextEditorWidget
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ bool RefactoringChanges::createFile(const QString &fileName, const QString &cont
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Create a text document for the new file:
|
// Create a text document for the new file:
|
||||||
QTextDocument *document = new QTextDocument;
|
auto document = new QTextDocument;
|
||||||
QTextCursor cursor(document);
|
QTextCursor cursor(document);
|
||||||
cursor.beginEditBlock();
|
cursor.beginEditBlock();
|
||||||
cursor.insertText(contents);
|
cursor.insertText(contents);
|
||||||
@@ -90,7 +90,7 @@ bool RefactoringChanges::createFile(const QString &fileName, const QString &cont
|
|||||||
// Reindent the contents:
|
// Reindent the contents:
|
||||||
if (reindent) {
|
if (reindent) {
|
||||||
cursor.select(QTextCursor::Document);
|
cursor.select(QTextCursor::Document);
|
||||||
m_data->indentSelection(cursor, fileName, 0);
|
m_data->indentSelection(cursor, fileName, nullptr);
|
||||||
}
|
}
|
||||||
cursor.endEditBlock();
|
cursor.endEditBlock();
|
||||||
|
|
||||||
@@ -135,7 +135,7 @@ TextEditorWidget *RefactoringChanges::openEditor(const QString &fileName, bool a
|
|||||||
if (editor)
|
if (editor)
|
||||||
return qobject_cast<TextEditorWidget *>(editor->widget());
|
return qobject_cast<TextEditorWidget *>(editor->widget());
|
||||||
else
|
else
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
RefactoringFilePtr RefactoringChanges::file(TextEditorWidget *editor)
|
RefactoringFilePtr RefactoringChanges::file(TextEditorWidget *editor)
|
||||||
@@ -151,32 +151,16 @@ RefactoringFilePtr RefactoringChanges::file(const QString &fileName) const
|
|||||||
RefactoringFile::RefactoringFile(QTextDocument *document, const QString &fileName)
|
RefactoringFile::RefactoringFile(QTextDocument *document, const QString &fileName)
|
||||||
: m_fileName(fileName)
|
: m_fileName(fileName)
|
||||||
, m_document(document)
|
, m_document(document)
|
||||||
, m_editor(0)
|
|
||||||
, m_openEditor(false)
|
|
||||||
, m_activateEditor(false)
|
|
||||||
, m_editorCursorPosition(-1)
|
|
||||||
, m_appliedOnce(false)
|
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
RefactoringFile::RefactoringFile(TextEditorWidget *editor)
|
RefactoringFile::RefactoringFile(TextEditorWidget *editor)
|
||||||
: m_fileName(editor->textDocument()->filePath().toString())
|
: m_fileName(editor->textDocument()->filePath().toString())
|
||||||
, m_document(0)
|
|
||||||
, m_editor(editor)
|
, m_editor(editor)
|
||||||
, m_openEditor(false)
|
|
||||||
, m_activateEditor(false)
|
|
||||||
, m_editorCursorPosition(-1)
|
|
||||||
, m_appliedOnce(false)
|
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
RefactoringFile::RefactoringFile(const QString &fileName, const QSharedPointer<RefactoringChangesData> &data)
|
RefactoringFile::RefactoringFile(const QString &fileName, const QSharedPointer<RefactoringChangesData> &data)
|
||||||
: m_fileName(fileName)
|
: m_fileName(fileName)
|
||||||
, m_data(data)
|
, m_data(data)
|
||||||
, m_document(0)
|
|
||||||
, m_editor(0)
|
|
||||||
, m_openEditor(false)
|
|
||||||
, m_activateEditor(false)
|
|
||||||
, m_editorCursorPosition(-1)
|
|
||||||
, m_appliedOnce(false)
|
|
||||||
{
|
{
|
||||||
QList<IEditor *> editors = DocumentModel::editorsForFilePath(fileName);
|
QList<IEditor *> editors = DocumentModel::editorsForFilePath(fileName);
|
||||||
if (!editors.isEmpty()) {
|
if (!editors.isEmpty()) {
|
||||||
@@ -218,7 +202,7 @@ QTextDocument *RefactoringFile::mutableDocument() const
|
|||||||
&error);
|
&error);
|
||||||
if (result != TextFileFormat::ReadSuccess) {
|
if (result != TextFileFormat::ReadSuccess) {
|
||||||
qWarning() << "Could not read " << m_fileName << ". Error: " << error;
|
qWarning() << "Could not read " << m_fileName << ". Error: " << error;
|
||||||
m_textFileFormat.codec = 0;
|
m_textFileFormat.codec = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// always make a QTextDocument to avoid excessive null checks
|
// always make a QTextDocument to avoid excessive null checks
|
||||||
@@ -340,7 +324,7 @@ bool RefactoringFile::apply()
|
|||||||
|
|
||||||
// open / activate / goto position
|
// open / activate / goto position
|
||||||
if (m_openEditor && !m_fileName.isEmpty()) {
|
if (m_openEditor && !m_fileName.isEmpty()) {
|
||||||
unsigned line = unsigned(-1), column = unsigned(-1);
|
auto line = unsigned(-1), column = unsigned(-1);
|
||||||
if (m_editorCursorPosition != -1)
|
if (m_editorCursorPosition != -1)
|
||||||
lineAndColumn(m_editorCursorPosition, &line, &column);
|
lineAndColumn(m_editorCursorPosition, &line, &column);
|
||||||
m_editor = RefactoringChanges::openEditor(m_fileName, m_activateEditor, line, column);
|
m_editor = RefactoringChanges::openEditor(m_fileName, m_activateEditor, line, column);
|
||||||
@@ -409,7 +393,7 @@ void RefactoringFile::indentOrReindent(void (RefactoringChangesData::*mf)(const
|
|||||||
QTextCursor selection(p.first.document());
|
QTextCursor selection(p.first.document());
|
||||||
selection.setPosition(p.first.position());
|
selection.setPosition(p.first.position());
|
||||||
selection.setPosition(p.second.position(), QTextCursor::KeepAnchor);
|
selection.setPosition(p.second.position(), QTextCursor::KeepAnchor);
|
||||||
((*m_data).*(mf))(selection, m_fileName, m_editor ? m_editor->textDocument() : 0);
|
((*m_data).*(mf))(selection, m_fileName, m_editor ? m_editor->textDocument() : nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,15 +102,15 @@ protected:
|
|||||||
QString m_fileName;
|
QString m_fileName;
|
||||||
QSharedPointer<RefactoringChangesData> m_data;
|
QSharedPointer<RefactoringChangesData> m_data;
|
||||||
mutable Utils::TextFileFormat m_textFileFormat;
|
mutable Utils::TextFileFormat m_textFileFormat;
|
||||||
mutable QTextDocument *m_document;
|
mutable QTextDocument *m_document = nullptr;
|
||||||
TextEditorWidget *m_editor;
|
TextEditorWidget *m_editor = nullptr;
|
||||||
Utils::ChangeSet m_changes;
|
Utils::ChangeSet m_changes;
|
||||||
QList<Range> m_indentRanges;
|
QList<Range> m_indentRanges;
|
||||||
QList<Range> m_reindentRanges;
|
QList<Range> m_reindentRanges;
|
||||||
bool m_openEditor;
|
bool m_openEditor = false;
|
||||||
bool m_activateEditor;
|
bool m_activateEditor = false;
|
||||||
int m_editorCursorPosition;
|
int m_editorCursorPosition = -1;
|
||||||
bool m_appliedOnce;
|
bool m_appliedOnce = false;
|
||||||
|
|
||||||
friend class RefactoringChanges; // access to constructor
|
friend class RefactoringChanges; // access to constructor
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ void RefactorOverlay::paint(QPainter *painter, const QRect &clip)
|
|||||||
paintMarker(m_markers.at(i), painter, clip);
|
paintMarker(m_markers.at(i), painter, clip);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TextDocumentLayout *documentLayout = qobject_cast<TextDocumentLayout*>(m_editor->document()->documentLayout()))
|
if (auto documentLayout = qobject_cast<TextDocumentLayout*>(m_editor->document()->documentLayout()))
|
||||||
documentLayout->setRequiredWidth(m_maxWidth);
|
documentLayout->setRequiredWidth(m_maxWidth);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,11 +33,10 @@
|
|||||||
namespace TextEditor {
|
namespace TextEditor {
|
||||||
|
|
||||||
SimpleCodeStylePreferencesWidget::SimpleCodeStylePreferencesWidget(QWidget *parent) :
|
SimpleCodeStylePreferencesWidget::SimpleCodeStylePreferencesWidget(QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent)
|
||||||
m_preferences(0)
|
|
||||||
{
|
{
|
||||||
m_tabSettingsWidget = new TabSettingsWidget(this);
|
m_tabSettingsWidget = new TabSettingsWidget(this);
|
||||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
auto layout = new QVBoxLayout(this);
|
||||||
layout->addWidget(m_tabSettingsWidget);
|
layout->addWidget(m_tabSettingsWidget);
|
||||||
layout->setContentsMargins(QMargins());
|
layout->setContentsMargins(QMargins());
|
||||||
m_tabSettingsWidget->setEnabled(false);
|
m_tabSettingsWidget->setEnabled(false);
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ private:
|
|||||||
void slotTabSettingsChanged(const TextEditor::TabSettings &settings);
|
void slotTabSettingsChanged(const TextEditor::TabSettings &settings);
|
||||||
|
|
||||||
TabSettingsWidget *m_tabSettingsWidget;
|
TabSettingsWidget *m_tabSettingsWidget;
|
||||||
ICodeStylePreferences *m_preferences;
|
ICodeStylePreferences *m_preferences = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace TextEditor
|
} // namespace TextEditor
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ Snippet::ParsedSnippet Snippet::parse(const QString &snippet)
|
|||||||
} else {
|
} else {
|
||||||
int length = result.text.count() - start;
|
int length = result.text.count() - start;
|
||||||
result.ranges << ParsedSnippet::Range(start, length, mangler);
|
result.ranges << ParsedSnippet::Range(start, length, mangler);
|
||||||
mangler = 0;
|
mangler = nullptr;
|
||||||
start = -1;
|
start = -1;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ static void appendSnippets(QList<AssistProposalItemInterface *> *items,
|
|||||||
const int size = collection->totalActiveSnippets(groupId);
|
const int size = collection->totalActiveSnippets(groupId);
|
||||||
for (int i = 0; i < size; ++i) {
|
for (int i = 0; i < size; ++i) {
|
||||||
const Snippet &snippet = collection->snippet(i, groupId);
|
const Snippet &snippet = collection->snippet(i, groupId);
|
||||||
AssistProposalItem *item = new AssistProposalItem;
|
auto item = new AssistProposalItem;
|
||||||
item->setText(snippet.trigger() + QLatin1Char(' ') + snippet.complement());
|
item->setText(snippet.trigger() + QLatin1Char(' ') + snippet.complement());
|
||||||
item->setData(snippet.content());
|
item->setData(snippet.content());
|
||||||
item->setDetail(snippet.generateTip());
|
item->setDetail(snippet.generateTip());
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class SnippetsCollection : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
virtual ~SnippetsCollection();
|
~SnippetsCollection() override;
|
||||||
|
|
||||||
static SnippetsCollection *instance();
|
static SnippetsCollection *instance();
|
||||||
|
|
||||||
|
|||||||
@@ -54,16 +54,16 @@ class SnippetsTableModel : public QAbstractTableModel
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
SnippetsTableModel(QObject *parent);
|
SnippetsTableModel(QObject *parent);
|
||||||
virtual ~SnippetsTableModel() {}
|
~SnippetsTableModel() override {}
|
||||||
|
|
||||||
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||||
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||||
virtual Qt::ItemFlags flags(const QModelIndex &modelIndex) const;
|
Qt::ItemFlags flags(const QModelIndex &modelIndex) const override;
|
||||||
virtual QVariant data(const QModelIndex &modelIndex, int role = Qt::DisplayRole) const;
|
QVariant data(const QModelIndex &modelIndex, int role = Qt::DisplayRole) const override;
|
||||||
virtual bool setData(const QModelIndex &modelIndex, const QVariant &value,
|
bool setData(const QModelIndex &modelIndex, const QVariant &value,
|
||||||
int role = Qt::EditRole);
|
int role = Qt::EditRole) override;
|
||||||
virtual QVariant headerData(int section, Qt::Orientation orientation,
|
QVariant headerData(int section, Qt::Orientation orientation,
|
||||||
int role = Qt::DisplayRole) const;
|
int role = Qt::DisplayRole) const override;
|
||||||
|
|
||||||
QList<QString> groupIds() const;
|
QList<QString> groupIds() const;
|
||||||
void load(const QString &groupId);
|
void load(const QString &groupId);
|
||||||
@@ -267,7 +267,7 @@ class SnippetsSettingsPagePrivate : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
SnippetsSettingsPagePrivate(Core::Id id);
|
SnippetsSettingsPagePrivate(Core::Id id);
|
||||||
~SnippetsSettingsPagePrivate() { delete m_model; }
|
~SnippetsSettingsPagePrivate() override { delete m_model; }
|
||||||
|
|
||||||
Core::Id id() const { return m_id; }
|
Core::Id id() const { return m_id; }
|
||||||
const QString &displayName() const { return m_displayName; }
|
const QString &displayName() const { return m_displayName; }
|
||||||
@@ -312,7 +312,7 @@ SnippetsSettingsPagePrivate::SnippetsSettingsPagePrivate(Core::Id id) :
|
|||||||
m_id(id),
|
m_id(id),
|
||||||
m_displayName(tr("Snippets")),
|
m_displayName(tr("Snippets")),
|
||||||
m_settingsPrefix(QLatin1String("Text")),
|
m_settingsPrefix(QLatin1String("Text")),
|
||||||
m_model(new SnippetsTableModel(0)),
|
m_model(new SnippetsTableModel(nullptr)),
|
||||||
m_snippetsCollectionChanged(false)
|
m_snippetsCollectionChanged(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
@@ -332,7 +332,7 @@ void SnippetsSettingsPagePrivate::configureUi(QWidget *w)
|
|||||||
|
|
||||||
for (const SnippetProvider &provider : SnippetProvider::snippetProviders()) {
|
for (const SnippetProvider &provider : SnippetProvider::snippetProviders()) {
|
||||||
m_ui.groupCombo->addItem(provider.displayName(), provider.groupId());
|
m_ui.groupCombo->addItem(provider.displayName(), provider.groupId());
|
||||||
SnippetEditorWidget *snippetEditor = new SnippetEditorWidget(w);
|
auto snippetEditor = new SnippetEditorWidget(w);
|
||||||
SnippetProvider::decorateEditor(snippetEditor, provider.groupId());
|
SnippetProvider::decorateEditor(snippetEditor, provider.groupId());
|
||||||
m_ui.snippetsEditorStack->insertWidget(m_ui.groupCombo->count() - 1, snippetEditor);
|
m_ui.snippetsEditorStack->insertWidget(m_ui.groupCombo->count() - 1, snippetEditor);
|
||||||
connect(snippetEditor, &SnippetEditorWidget::snippetContentChanged,
|
connect(snippetEditor, &SnippetEditorWidget::snippetContentChanged,
|
||||||
@@ -409,7 +409,7 @@ void SnippetsSettingsPagePrivate::finish()
|
|||||||
m_snippetsCollectionChanged = false;
|
m_snippetsCollectionChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
disconnect(TextEditorSettings::instance(), 0, this, 0);
|
disconnect(TextEditorSettings::instance(), nullptr, this, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SnippetsSettingsPagePrivate::loadSettings()
|
void SnippetsSettingsPagePrivate::loadSettings()
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ SyntaxHighlighter::SyntaxHighlighter(QTextEdit *parent)
|
|||||||
*/
|
*/
|
||||||
SyntaxHighlighter::~SyntaxHighlighter()
|
SyntaxHighlighter::~SyntaxHighlighter()
|
||||||
{
|
{
|
||||||
setDocument(0);
|
setDocument(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -641,7 +641,7 @@ QTextBlockUserData *SyntaxHighlighter::currentBlockUserData() const
|
|||||||
{
|
{
|
||||||
Q_D(const SyntaxHighlighter);
|
Q_D(const SyntaxHighlighter);
|
||||||
if (!d->currentBlock.isValid())
|
if (!d->currentBlock.isValid())
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
return d->currentBlock.userData();
|
return d->currentBlock.userData();
|
||||||
}
|
}
|
||||||
@@ -679,7 +679,7 @@ void SyntaxHighlighter::setExtraFormats(const QTextBlock &block,
|
|||||||
Q_D(SyntaxHighlighter);
|
Q_D(SyntaxHighlighter);
|
||||||
|
|
||||||
const int blockLength = block.length();
|
const int blockLength = block.length();
|
||||||
if (block.layout() == 0 || blockLength == 0)
|
if (block.layout() == nullptr || blockLength == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Utils::sort(formats, byStartOfRange);
|
Utils::sort(formats, byStartOfRange);
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ QTextCursor TextDocumentPrivate::indentOrUnindent(const QTextCursor &textCursor,
|
|||||||
|
|
||||||
void TextDocumentPrivate::resetRevisions()
|
void TextDocumentPrivate::resetRevisions()
|
||||||
{
|
{
|
||||||
TextDocumentLayout *documentLayout = qobject_cast<TextDocumentLayout*>(m_document.documentLayout());
|
auto documentLayout = qobject_cast<TextDocumentLayout*>(m_document.documentLayout());
|
||||||
QTC_ASSERT(documentLayout, return);
|
QTC_ASSERT(documentLayout, return);
|
||||||
documentLayout->lastSaveRevision = m_document.revision();
|
documentLayout->lastSaveRevision = m_document.revision();
|
||||||
|
|
||||||
@@ -217,7 +217,7 @@ void TextDocumentPrivate::resetRevisions()
|
|||||||
|
|
||||||
void TextDocumentPrivate::updateRevisions()
|
void TextDocumentPrivate::updateRevisions()
|
||||||
{
|
{
|
||||||
TextDocumentLayout *documentLayout = qobject_cast<TextDocumentLayout*>(m_document.documentLayout());
|
auto documentLayout = qobject_cast<TextDocumentLayout*>(m_document.documentLayout());
|
||||||
QTC_ASSERT(documentLayout, return);
|
QTC_ASSERT(documentLayout, return);
|
||||||
int oldLastSaveRevision = documentLayout->lastSaveRevision;
|
int oldLastSaveRevision = documentLayout->lastSaveRevision;
|
||||||
documentLayout->lastSaveRevision = m_document.revision();
|
documentLayout->lastSaveRevision = m_document.revision();
|
||||||
@@ -272,7 +272,7 @@ QMap<QString, QString> TextDocument::openedTextDocumentContents()
|
|||||||
{
|
{
|
||||||
QMap<QString, QString> workingCopy;
|
QMap<QString, QString> workingCopy;
|
||||||
foreach (IDocument *document, DocumentModel::openedDocuments()) {
|
foreach (IDocument *document, DocumentModel::openedDocuments()) {
|
||||||
TextDocument *textEditorDocument = qobject_cast<TextDocument *>(document);
|
auto textEditorDocument = qobject_cast<TextDocument *>(document);
|
||||||
if (!textEditorDocument)
|
if (!textEditorDocument)
|
||||||
continue;
|
continue;
|
||||||
QString fileName = textEditorDocument->filePath().toString();
|
QString fileName = textEditorDocument->filePath().toString();
|
||||||
@@ -285,7 +285,7 @@ QMap<QString, QTextCodec *> TextDocument::openedTextDocumentEncodings()
|
|||||||
{
|
{
|
||||||
QMap<QString, QTextCodec *> workingCopy;
|
QMap<QString, QTextCodec *> workingCopy;
|
||||||
foreach (IDocument *document, DocumentModel::openedDocuments()) {
|
foreach (IDocument *document, DocumentModel::openedDocuments()) {
|
||||||
TextDocument *textEditorDocument = qobject_cast<TextDocument *>(document);
|
auto textEditorDocument = qobject_cast<TextDocument *>(document);
|
||||||
if (!textEditorDocument)
|
if (!textEditorDocument)
|
||||||
continue;
|
continue;
|
||||||
QString fileName = textEditorDocument->filePath().toString();
|
QString fileName = textEditorDocument->filePath().toString();
|
||||||
@@ -340,7 +340,7 @@ void TextDocument::setTabSettings(const TabSettings &newTabSettings)
|
|||||||
return;
|
return;
|
||||||
d->m_tabSettings = newTabSettings;
|
d->m_tabSettings = newTabSettings;
|
||||||
|
|
||||||
if (Highlighter *highlighter = qobject_cast<Highlighter *>(d->m_highlighter))
|
if (auto highlighter = qobject_cast<Highlighter *>(d->m_highlighter))
|
||||||
highlighter->setTabSettings(tabSettings());
|
highlighter->setTabSettings(tabSettings());
|
||||||
|
|
||||||
emit tabSettingsChanged();
|
emit tabSettingsChanged();
|
||||||
@@ -696,7 +696,7 @@ Core::IDocument::OpenResult TextDocument::openImpl(QString *errorString, const Q
|
|||||||
if (!reload || fileName == realFileName)
|
if (!reload || fileName == realFileName)
|
||||||
d->m_document.setUndoRedoEnabled(true);
|
d->m_document.setUndoRedoEnabled(true);
|
||||||
|
|
||||||
TextDocumentLayout *documentLayout =
|
auto documentLayout =
|
||||||
qobject_cast<TextDocumentLayout*>(d->m_document.documentLayout());
|
qobject_cast<TextDocumentLayout*>(d->m_document.documentLayout());
|
||||||
QTC_ASSERT(documentLayout, return OpenResult::CannotHandle);
|
QTC_ASSERT(documentLayout, return OpenResult::CannotHandle);
|
||||||
documentLayout->lastSaveRevision = d->m_autoSaveRevision = d->m_document.revision();
|
documentLayout->lastSaveRevision = d->m_autoSaveRevision = d->m_document.revision();
|
||||||
@@ -724,7 +724,7 @@ bool TextDocument::reload(QString *errorString)
|
|||||||
bool TextDocument::reload(QString *errorString, const QString &realFileName)
|
bool TextDocument::reload(QString *errorString, const QString &realFileName)
|
||||||
{
|
{
|
||||||
emit aboutToReload();
|
emit aboutToReload();
|
||||||
TextDocumentLayout *documentLayout =
|
auto documentLayout =
|
||||||
qobject_cast<TextDocumentLayout*>(d->m_document.documentLayout());
|
qobject_cast<TextDocumentLayout*>(d->m_document.documentLayout());
|
||||||
TextMarks marks;
|
TextMarks marks;
|
||||||
if (documentLayout)
|
if (documentLayout)
|
||||||
@@ -801,7 +801,7 @@ void TextDocument::cleanWhitespace(const QTextCursor &cursor)
|
|||||||
|
|
||||||
void TextDocument::cleanWhitespace(QTextCursor &cursor, bool cleanIndentation, bool inEntireDocument)
|
void TextDocument::cleanWhitespace(QTextCursor &cursor, bool cleanIndentation, bool inEntireDocument)
|
||||||
{
|
{
|
||||||
TextDocumentLayout *documentLayout = qobject_cast<TextDocumentLayout*>(d->m_document.documentLayout());
|
auto documentLayout = qobject_cast<TextDocumentLayout*>(d->m_document.documentLayout());
|
||||||
Q_ASSERT(cursor.visualNavigation() == false);
|
Q_ASSERT(cursor.visualNavigation() == false);
|
||||||
|
|
||||||
QTextBlock block = d->m_document.findBlock(cursor.selectionStart());
|
QTextBlock block = d->m_document.findBlock(cursor.selectionStart());
|
||||||
@@ -973,7 +973,7 @@ void TextDocument::removeMarkFromMarksCache(TextMark *mark)
|
|||||||
void TextDocument::removeMark(TextMark *mark)
|
void TextDocument::removeMark(TextMark *mark)
|
||||||
{
|
{
|
||||||
QTextBlock block = d->m_document.findBlockByNumber(mark->lineNumber() - 1);
|
QTextBlock block = d->m_document.findBlockByNumber(mark->lineNumber() - 1);
|
||||||
if (TextBlockUserData *data = static_cast<TextBlockUserData *>(block.userData())) {
|
if (auto data = static_cast<TextBlockUserData *>(block.userData())) {
|
||||||
if (!data->removeMark(mark))
|
if (!data->removeMark(mark))
|
||||||
qDebug() << "Could not find mark" << mark << "on line" << mark->lineNumber();
|
qDebug() << "Could not find mark" << mark << "on line" << mark->lineNumber();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -521,9 +521,7 @@ void TextDocumentLayout::setFolded(const QTextBlock &block, bool folded)
|
|||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TextDocumentLayout *layout = qobject_cast<TextDocumentLayout *>(
|
if (auto layout = qobject_cast<TextDocumentLayout *>(block.document()->documentLayout()))
|
||||||
block.document()->documentLayout());
|
|
||||||
if (layout)
|
|
||||||
emit layout->foldChanged(block.blockNumber(), folded);
|
emit layout->foldChanged(block.blockNumber(), folded);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -577,7 +575,7 @@ TextMarks TextDocumentLayout::documentClosing()
|
|||||||
{
|
{
|
||||||
TextMarks marks;
|
TextMarks marks;
|
||||||
for (QTextBlock block = document()->begin(); block.isValid(); block = block.next()) {
|
for (QTextBlock block = document()->begin(); block.isValid(); block = block.next()) {
|
||||||
if (TextBlockUserData *data = static_cast<TextBlockUserData *>(block.userData()))
|
if (auto data = static_cast<TextBlockUserData *>(block.userData()))
|
||||||
marks.append(data->documentClosing());
|
marks.append(data->documentClosing());
|
||||||
}
|
}
|
||||||
return marks;
|
return marks;
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ public:
|
|||||||
return static_cast<TextBlockUserData*>(block.userData());
|
return static_cast<TextBlockUserData*>(block.userData());
|
||||||
}
|
}
|
||||||
static TextBlockUserData *userData(const QTextBlock &block) {
|
static TextBlockUserData *userData(const QTextBlock &block) {
|
||||||
TextBlockUserData *data = static_cast<TextBlockUserData*>(block.userData());
|
auto data = static_cast<TextBlockUserData*>(block.userData());
|
||||||
if (!data && block.isValid())
|
if (!data && block.isValid())
|
||||||
const_cast<QTextBlock &>(block).setUserData((data = new TextBlockUserData));
|
const_cast<QTextBlock &>(block).setUserData((data = new TextBlockUserData));
|
||||||
return data;
|
return data;
|
||||||
|
|||||||
@@ -126,9 +126,9 @@ void Internal::TextEditorPlugin::testBlockSelectionTransformation()
|
|||||||
|
|
||||||
// open editor
|
// open editor
|
||||||
Core::IEditor *editor = Core::EditorManager::openEditorWithContents(
|
Core::IEditor *editor = Core::EditorManager::openEditorWithContents(
|
||||||
Core::Constants::K_DEFAULT_TEXT_EDITOR_ID, 0, input.toLatin1());
|
Core::Constants::K_DEFAULT_TEXT_EDITOR_ID, nullptr, input.toLatin1());
|
||||||
QVERIFY(editor);
|
QVERIFY(editor);
|
||||||
if (BaseTextEditor *textEditor = qobject_cast<BaseTextEditor*>(editor)) {
|
if (auto textEditor = qobject_cast<BaseTextEditor*>(editor)) {
|
||||||
TextEditorWidget *editorWidget = textEditor->editorWidget();
|
TextEditorWidget *editorWidget = textEditor->editorWidget();
|
||||||
editorWidget->setBlockSelection(selection.positionBlock,
|
editorWidget->setBlockSelection(selection.positionBlock,
|
||||||
selection.positionColumn,
|
selection.positionColumn,
|
||||||
@@ -349,9 +349,9 @@ void Internal::TextEditorPlugin::testBlockSelectionInsert()
|
|||||||
|
|
||||||
// open editor
|
// open editor
|
||||||
Core::IEditor *editor = Core::EditorManager::openEditorWithContents(
|
Core::IEditor *editor = Core::EditorManager::openEditorWithContents(
|
||||||
Core::Constants::K_DEFAULT_TEXT_EDITOR_ID, 0, text);
|
Core::Constants::K_DEFAULT_TEXT_EDITOR_ID, nullptr, text);
|
||||||
QVERIFY(editor);
|
QVERIFY(editor);
|
||||||
if (BaseTextEditor *textEditor = qobject_cast<BaseTextEditor*>(editor)) {
|
if (auto textEditor = qobject_cast<BaseTextEditor*>(editor)) {
|
||||||
TextEditorWidget *editorWidget = textEditor->editorWidget();
|
TextEditorWidget *editorWidget = textEditor->editorWidget();
|
||||||
editorWidget->setBlockSelection(selection.positionBlock,
|
editorWidget->setBlockSelection(selection.positionBlock,
|
||||||
selection.positionColumn,
|
selection.positionColumn,
|
||||||
@@ -427,9 +427,9 @@ void Internal::TextEditorPlugin::testBlockSelectionRemove()
|
|||||||
|
|
||||||
// open editor
|
// open editor
|
||||||
Core::IEditor *editor = Core::EditorManager::openEditorWithContents(
|
Core::IEditor *editor = Core::EditorManager::openEditorWithContents(
|
||||||
Core::Constants::K_DEFAULT_TEXT_EDITOR_ID, 0, text);
|
Core::Constants::K_DEFAULT_TEXT_EDITOR_ID, nullptr, text);
|
||||||
QVERIFY(editor);
|
QVERIFY(editor);
|
||||||
if (BaseTextEditor *textEditor = qobject_cast<BaseTextEditor*>(editor)) {
|
if (auto textEditor = qobject_cast<BaseTextEditor*>(editor)) {
|
||||||
TextEditorWidget *editorWidget = textEditor->editorWidget();
|
TextEditorWidget *editorWidget = textEditor->editorWidget();
|
||||||
editorWidget->setBlockSelection(selection.positionBlock,
|
editorWidget->setBlockSelection(selection.positionBlock,
|
||||||
selection.positionColumn,
|
selection.positionColumn,
|
||||||
@@ -482,9 +482,9 @@ void Internal::TextEditorPlugin::testBlockSelectionCopy()
|
|||||||
|
|
||||||
// open editor
|
// open editor
|
||||||
Core::IEditor *editor = Core::EditorManager::openEditorWithContents(
|
Core::IEditor *editor = Core::EditorManager::openEditorWithContents(
|
||||||
Core::Constants::K_DEFAULT_TEXT_EDITOR_ID, 0, text);
|
Core::Constants::K_DEFAULT_TEXT_EDITOR_ID, nullptr, text);
|
||||||
QVERIFY(editor);
|
QVERIFY(editor);
|
||||||
if (BaseTextEditor *textEditor = qobject_cast<BaseTextEditor*>(editor)) {
|
if (auto textEditor = qobject_cast<BaseTextEditor*>(editor)) {
|
||||||
TextEditorWidget *editorWidget = textEditor->editorWidget();
|
TextEditorWidget *editorWidget = textEditor->editorWidget();
|
||||||
editorWidget->setBlockSelection(selection.positionBlock,
|
editorWidget->setBlockSelection(selection.positionBlock,
|
||||||
selection.positionColumn,
|
selection.positionColumn,
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public:
|
|||||||
Core::ActionContainer *container,
|
Core::ActionContainer *container,
|
||||||
std::function<void(bool)> slot)
|
std::function<void(bool)> slot)
|
||||||
{
|
{
|
||||||
QAction *result = new QAction(title, this);
|
auto result = new QAction(title, this);
|
||||||
Core::Command *command = Core::ActionManager::registerAction(result, id, Core::Context(m_contextId), scriptable);
|
Core::Command *command = Core::ActionManager::registerAction(result, id, Core::Context(m_contextId), scriptable);
|
||||||
if (!keySequence.isEmpty())
|
if (!keySequence.isEmpty())
|
||||||
command->setDefaultKeySequence(keySequence);
|
command->setDefaultKeySequence(keySequence);
|
||||||
@@ -81,7 +81,7 @@ public:
|
|||||||
const QString &title = QString(),
|
const QString &title = QString(),
|
||||||
const QKeySequence &keySequence = QKeySequence(),
|
const QKeySequence &keySequence = QKeySequence(),
|
||||||
Core::Id menueGroup = Core::Id(),
|
Core::Id menueGroup = Core::Id(),
|
||||||
Core::ActionContainer *container = 0)
|
Core::ActionContainer *container = nullptr)
|
||||||
{
|
{
|
||||||
return registerActionHelper(id, scriptable, title, keySequence, menueGroup, container,
|
return registerActionHelper(id, scriptable, title, keySequence, menueGroup, container,
|
||||||
[this, slot](bool) { if (m_currentEditorWidget) slot(m_currentEditorWidget); });
|
[this, slot](bool) { if (m_currentEditorWidget) slot(m_currentEditorWidget); });
|
||||||
@@ -93,7 +93,7 @@ public:
|
|||||||
const QString &title = QString(),
|
const QString &title = QString(),
|
||||||
const QKeySequence &keySequence = QKeySequence(),
|
const QKeySequence &keySequence = QKeySequence(),
|
||||||
Core::Id menueGroup = Core::Id(),
|
Core::Id menueGroup = Core::Id(),
|
||||||
Core::ActionContainer *container = 0)
|
Core::ActionContainer *container = nullptr)
|
||||||
{
|
{
|
||||||
return registerActionHelper(id, scriptable, title, keySequence, menueGroup, container,
|
return registerActionHelper(id, scriptable, title, keySequence, menueGroup, container,
|
||||||
[this, slot](bool on) { if (m_currentEditorWidget) slot(m_currentEditorWidget, on); });
|
[this, slot](bool on) { if (m_currentEditorWidget) slot(m_currentEditorWidget, on); });
|
||||||
@@ -105,7 +105,7 @@ public:
|
|||||||
const QString &title = QString(),
|
const QString &title = QString(),
|
||||||
const QKeySequence &keySequence = QKeySequence(),
|
const QKeySequence &keySequence = QKeySequence(),
|
||||||
Core::Id menueGroup = Core::Id(),
|
Core::Id menueGroup = Core::Id(),
|
||||||
Core::ActionContainer *container = 0)
|
Core::ActionContainer *container = nullptr)
|
||||||
{
|
{
|
||||||
return registerActionHelper(id, scriptable, title, keySequence, menueGroup, container,
|
return registerActionHelper(id, scriptable, title, keySequence, menueGroup, container,
|
||||||
[this, slot](bool on) { if (m_currentEditorWidget) slot(m_currentEditorWidget, on); });
|
[this, slot](bool on) { if (m_currentEditorWidget) slot(m_currentEditorWidget, on); });
|
||||||
@@ -562,7 +562,7 @@ void TextEditorActionHandlerPrivate::updateCurrentEditor(Core::IEditor *editor)
|
|||||||
{
|
{
|
||||||
if (m_currentEditorWidget)
|
if (m_currentEditorWidget)
|
||||||
m_currentEditorWidget->disconnect(this);
|
m_currentEditorWidget->disconnect(this);
|
||||||
m_currentEditorWidget = 0;
|
m_currentEditorWidget = nullptr;
|
||||||
|
|
||||||
if (editor && editor->document()->id() == m_editorId) {
|
if (editor && editor->document()->id() == m_editorId) {
|
||||||
TextEditorWidget *editorWidget = m_findTextWidget(editor);
|
TextEditorWidget *editorWidget = m_findTextWidget(editor);
|
||||||
|
|||||||
@@ -78,8 +78,8 @@ public:
|
|||||||
} // namespace TextEditor
|
} // namespace TextEditor
|
||||||
|
|
||||||
|
|
||||||
static TextEditorSettingsPrivate *d = 0;
|
static TextEditorSettingsPrivate *d = nullptr;
|
||||||
static TextEditorSettings *m_instance = 0;
|
static TextEditorSettings *m_instance = nullptr;
|
||||||
|
|
||||||
TextEditorSettings::TextEditorSettings()
|
TextEditorSettings::TextEditorSettings()
|
||||||
{
|
{
|
||||||
@@ -386,7 +386,7 @@ TextEditorSettings::~TextEditorSettings()
|
|||||||
{
|
{
|
||||||
delete d;
|
delete d;
|
||||||
|
|
||||||
m_instance = 0;
|
m_instance = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextEditorSettings *TextEditorSettings::instance()
|
TextEditorSettings *TextEditorSettings::instance()
|
||||||
@@ -521,7 +521,7 @@ Core::Id TextEditorSettings::languageId(const QString &mimeType)
|
|||||||
|
|
||||||
int TextEditorSettings::increaseFontZoom(int step)
|
int TextEditorSettings::increaseFontZoom(int step)
|
||||||
{
|
{
|
||||||
FontSettings &fs = const_cast<FontSettings&>(d->m_fontSettingsPage->fontSettings());
|
auto &fs = const_cast<FontSettings&>(d->m_fontSettingsPage->fontSettings());
|
||||||
const int previousZoom = fs.fontZoom();
|
const int previousZoom = fs.fontZoom();
|
||||||
const int newZoom = qMax(10, previousZoom + step);
|
const int newZoom = qMax(10, previousZoom + step);
|
||||||
if (newZoom != previousZoom) {
|
if (newZoom != previousZoom) {
|
||||||
@@ -533,7 +533,7 @@ int TextEditorSettings::increaseFontZoom(int step)
|
|||||||
|
|
||||||
void TextEditorSettings::resetFontZoom()
|
void TextEditorSettings::resetFontZoom()
|
||||||
{
|
{
|
||||||
FontSettings &fs = const_cast<FontSettings&>(d->m_fontSettingsPage->fontSettings());
|
auto &fs = const_cast<FontSettings&>(d->m_fontSettingsPage->fontSettings());
|
||||||
fs.setFontZoom(100);
|
fs.setFontZoom(100);
|
||||||
d->m_fontSettingsPage->saveSettings();
|
d->m_fontSettingsPage->saveSettings();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -267,7 +267,7 @@ void TextMark::dragToLine(int lineNumber)
|
|||||||
|
|
||||||
void TextMark::addToToolTipLayout(QGridLayout *target) const
|
void TextMark::addToToolTipLayout(QGridLayout *target) const
|
||||||
{
|
{
|
||||||
auto *contentLayout = new QVBoxLayout;
|
auto contentLayout = new QVBoxLayout;
|
||||||
addToolTipContent(contentLayout);
|
addToolTipContent(contentLayout);
|
||||||
if (contentLayout->count() > 0) {
|
if (contentLayout->count() > 0) {
|
||||||
const int row = target->rowCount();
|
const int row = target->rowCount();
|
||||||
@@ -346,7 +346,7 @@ TextMarkRegistry *TextMarkRegistry::instance()
|
|||||||
|
|
||||||
void TextMarkRegistry::editorOpened(IEditor *editor)
|
void TextMarkRegistry::editorOpened(IEditor *editor)
|
||||||
{
|
{
|
||||||
auto document = qobject_cast<TextDocument *>(editor ? editor->document() : 0);
|
auto document = qobject_cast<TextDocument *>(editor ? editor->document() : nullptr);
|
||||||
if (!document)
|
if (!document)
|
||||||
return;
|
return;
|
||||||
if (!m_marks.contains(document->filePath()))
|
if (!m_marks.contains(document->filePath()))
|
||||||
@@ -359,7 +359,7 @@ void TextMarkRegistry::editorOpened(IEditor *editor)
|
|||||||
void TextMarkRegistry::documentRenamed(IDocument *document, const
|
void TextMarkRegistry::documentRenamed(IDocument *document, const
|
||||||
QString &oldName, const QString &newName)
|
QString &oldName, const QString &newName)
|
||||||
{
|
{
|
||||||
TextDocument *baseTextDocument = qobject_cast<TextDocument *>(document);
|
auto baseTextDocument = qobject_cast<TextDocument *>(document);
|
||||||
if (!baseTextDocument)
|
if (!baseTextDocument)
|
||||||
return;
|
return;
|
||||||
FileName oldFileName = FileName::fromString(oldName);
|
FileName oldFileName = FileName::fromString(oldName);
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ struct Parenthesis
|
|||||||
int pos;
|
int pos;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CodeFormatterData {};
|
struct CodeFormatterData { virtual ~CodeFormatterData() {} };
|
||||||
|
|
||||||
struct TextBlockUserData : QTextBlockUserData
|
struct TextBlockUserData : QTextBlockUserData
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user