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