forked from qt-creator/qt-creator
TextEditor: Modernize
modernize-* Change-Id: Ic497fea1942a77cf017be3b0033f92e3807066f1 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -40,8 +40,7 @@ AutoCompleter::AutoCompleter() :
|
|||||||
m_surroundWithQuotes(true)
|
m_surroundWithQuotes(true)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
AutoCompleter::~AutoCompleter()
|
AutoCompleter::~AutoCompleter() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
static void countBracket(QChar open, QChar close, QChar c, int *errors, int *stillopen)
|
static void countBracket(QChar open, QChar close, QChar c, int *errors, int *stillopen)
|
||||||
{
|
{
|
||||||
|
@@ -32,8 +32,7 @@
|
|||||||
|
|
||||||
namespace TextEditor {
|
namespace TextEditor {
|
||||||
|
|
||||||
BaseHoverHandler::~BaseHoverHandler()
|
BaseHoverHandler::~BaseHoverHandler() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
void BaseHoverHandler::showToolTip(TextEditorWidget *widget, const QPoint &point, bool decorate)
|
void BaseHoverHandler::showToolTip(TextEditorWidget *widget, const QPoint &point, bool decorate)
|
||||||
{
|
{
|
||||||
|
@@ -29,13 +29,9 @@ using namespace TextEditor::Internal;
|
|||||||
|
|
||||||
static const int kMaxSize = 10;
|
static const int kMaxSize = 10;
|
||||||
|
|
||||||
CircularClipboard::CircularClipboard()
|
CircularClipboard::CircularClipboard() = default;
|
||||||
: m_current(-1)
|
|
||||||
{}
|
|
||||||
|
|
||||||
CircularClipboard::~CircularClipboard()
|
CircularClipboard::~CircularClipboard() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
CircularClipboard *CircularClipboard::instance()
|
CircularClipboard *CircularClipboard::instance()
|
||||||
{
|
{
|
||||||
|
@@ -48,7 +48,7 @@ private:
|
|||||||
~CircularClipboard();
|
~CircularClipboard();
|
||||||
CircularClipboard &operator=(const CircularClipboard &);
|
CircularClipboard &operator=(const CircularClipboard &);
|
||||||
|
|
||||||
mutable int m_current;
|
mutable int m_current = -1;
|
||||||
QList< QSharedPointer<const QMimeData> > m_items;
|
QList< QSharedPointer<const QMimeData> > m_items;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -59,7 +59,7 @@ public:
|
|||||||
setText(text);
|
setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
~ClipboardProposalItem() noexcept override {}
|
~ClipboardProposalItem() noexcept override = default;
|
||||||
|
|
||||||
void apply(TextDocumentManipulatorInterface &manipulator, int /*basePosition*/) const override
|
void apply(TextDocumentManipulatorInterface &manipulator, int /*basePosition*/) const override
|
||||||
{
|
{
|
||||||
|
@@ -39,7 +39,7 @@ namespace TextEditor {
|
|||||||
class TEXTEDITOR_EXPORT AssistProposalItem : public AssistProposalItemInterface
|
class TEXTEDITOR_EXPORT AssistProposalItem : public AssistProposalItemInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
~AssistProposalItem() noexcept override {}
|
~AssistProposalItem() noexcept override = default;
|
||||||
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;
|
||||||
|
@@ -33,8 +33,7 @@ CompletionAssistProvider::CompletionAssistProvider(QObject *parent)
|
|||||||
: IAssistProvider(parent)
|
: IAssistProvider(parent)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
CompletionAssistProvider::~CompletionAssistProvider()
|
CompletionAssistProvider::~CompletionAssistProvider() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
IAssistProvider::RunType CompletionAssistProvider::runType() const
|
IAssistProvider::RunType CompletionAssistProvider::runType() const
|
||||||
{
|
{
|
||||||
|
@@ -36,8 +36,7 @@ FunctionHintProposal::FunctionHintProposal(int cursorPos, FunctionHintProposalMo
|
|||||||
setFragile(true);
|
setFragile(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
FunctionHintProposal::~FunctionHintProposal()
|
FunctionHintProposal::~FunctionHintProposal() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
ProposalModelPtr FunctionHintProposal::model() const
|
ProposalModelPtr FunctionHintProposal::model() const
|
||||||
{
|
{
|
||||||
|
@@ -43,8 +43,7 @@ GenericProposal::GenericProposal(int cursorPos, const QList<AssistProposalItemIn
|
|||||||
m_model->loadContent(items);
|
m_model->loadContent(items);
|
||||||
}
|
}
|
||||||
|
|
||||||
GenericProposal::~GenericProposal()
|
GenericProposal::~GenericProposal() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
GenericProposal *GenericProposal::createProposal(const AssistInterface *interface, const QuickFixOperations &quickFixes)
|
GenericProposal *GenericProposal::createProposal(const AssistInterface *interface, const QuickFixOperations &quickFixes)
|
||||||
{
|
{
|
||||||
|
@@ -38,10 +38,12 @@
|
|||||||
|
|
||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
uint qHash(const AssistProposalItem &item)
|
uint qHash(const AssistProposalItem &item)
|
||||||
{
|
{
|
||||||
return qHash(item.text());
|
return qHash(item.text());
|
||||||
}
|
}
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@@ -129,8 +131,7 @@ private:
|
|||||||
|
|
||||||
} // Anonymous
|
} // Anonymous
|
||||||
|
|
||||||
GenericProposalModel::GenericProposalModel()
|
GenericProposalModel::GenericProposalModel() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
GenericProposalModel::~GenericProposalModel()
|
GenericProposalModel::~GenericProposalModel()
|
||||||
{
|
{
|
||||||
|
@@ -36,11 +36,9 @@ using namespace TextEditor;
|
|||||||
\sa IAssistProposal, IAssistProvider
|
\sa IAssistProposal, IAssistProvider
|
||||||
*/
|
*/
|
||||||
|
|
||||||
IAssistProcessor::IAssistProcessor()
|
IAssistProcessor::IAssistProcessor() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
IAssistProcessor::~IAssistProcessor()
|
IAssistProcessor::~IAssistProcessor() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
void IAssistProcessor::setAsyncProposalAvailable(IAssistProposal *proposal)
|
void IAssistProcessor::setAsyncProposalAvailable(IAssistProposal *proposal)
|
||||||
{
|
{
|
||||||
|
@@ -63,8 +63,7 @@ IAssistProposal::IAssistProposal(int basePosition)
|
|||||||
: m_basePosition(basePosition)
|
: m_basePosition(basePosition)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
IAssistProposal::~IAssistProposal()
|
IAssistProposal::~IAssistProposal() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn bool TextEditor::IAssistProposal::isFragile() const
|
\fn bool TextEditor::IAssistProposal::isFragile() const
|
||||||
|
@@ -41,8 +41,6 @@ using namespace TextEditor;
|
|||||||
This is class is part of the CodeAssist API.
|
This is class is part of the CodeAssist API.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
IAssistProposalModel::IAssistProposalModel()
|
IAssistProposalModel::IAssistProposalModel() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
IAssistProposalModel::~IAssistProposalModel()
|
IAssistProposalModel::~IAssistProposalModel() = default;
|
||||||
{}
|
|
||||||
|
@@ -52,8 +52,7 @@ IAssistProposalWidget::IAssistProposalWidget()
|
|||||||
: QFrame(nullptr, Qt::Popup)
|
: QFrame(nullptr, Qt::Popup)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
IAssistProposalWidget::~IAssistProposalWidget()
|
IAssistProposalWidget::~IAssistProposalWidget() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
int IAssistProposalWidget::basePosition() const
|
int IAssistProposalWidget::basePosition() const
|
||||||
{
|
{
|
||||||
|
@@ -29,11 +29,9 @@
|
|||||||
|
|
||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
|
|
||||||
IFunctionHintProposalModel::IFunctionHintProposalModel()
|
IFunctionHintProposalModel::IFunctionHintProposalModel() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
IFunctionHintProposalModel::~IFunctionHintProposalModel()
|
IFunctionHintProposalModel::~IFunctionHintProposalModel() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
QString IFunctionHintProposalModel::id(int /*index*/) const
|
QString IFunctionHintProposalModel::id(int /*index*/) const
|
||||||
{
|
{
|
||||||
|
@@ -160,7 +160,7 @@ int KeywordsFunctionHintModel::activeArgument(const QString &prefix) const
|
|||||||
// ---------------------------------
|
// ---------------------------------
|
||||||
// KeywordsCompletionAssistProcessor
|
// KeywordsCompletionAssistProcessor
|
||||||
// ---------------------------------
|
// ---------------------------------
|
||||||
KeywordsCompletionAssistProcessor::KeywordsCompletionAssistProcessor(Keywords keywords)
|
KeywordsCompletionAssistProcessor::KeywordsCompletionAssistProcessor(const Keywords &keywords)
|
||||||
: m_snippetCollector(QString(), QIcon(":/texteditor/images/snippet.png"))
|
: m_snippetCollector(QString(), QIcon(":/texteditor/images/snippet.png"))
|
||||||
, m_variableIcon(QLatin1String(":/codemodel/images/keyword.png"))
|
, m_variableIcon(QLatin1String(":/codemodel/images/keyword.png"))
|
||||||
, m_functionIcon(QLatin1String(":/codemodel/images/member.png"))
|
, m_functionIcon(QLatin1String(":/codemodel/images/member.png"))
|
||||||
@@ -222,7 +222,7 @@ void KeywordsCompletionAssistProcessor::setSnippetGroup(const QString &id)
|
|||||||
m_snippetCollector.setGroupId(id);
|
m_snippetCollector.setGroupId(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void KeywordsCompletionAssistProcessor::setKeywords(Keywords keywords)
|
void KeywordsCompletionAssistProcessor::setKeywords(const Keywords &keywords)
|
||||||
{
|
{
|
||||||
m_keywords = keywords;
|
m_keywords = keywords;
|
||||||
}
|
}
|
||||||
|
@@ -100,7 +100,7 @@ private:
|
|||||||
class TEXTEDITOR_EXPORT KeywordsCompletionAssistProcessor : public IAssistProcessor
|
class TEXTEDITOR_EXPORT KeywordsCompletionAssistProcessor : public IAssistProcessor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
KeywordsCompletionAssistProcessor(Keywords keywords);
|
KeywordsCompletionAssistProcessor(const Keywords &keywords);
|
||||||
~KeywordsCompletionAssistProcessor() override = default;
|
~KeywordsCompletionAssistProcessor() override = default;
|
||||||
|
|
||||||
IAssistProposal *perform(const AssistInterface *interface) override;
|
IAssistProposal *perform(const AssistInterface *interface) override;
|
||||||
@@ -108,7 +108,7 @@ public:
|
|||||||
void setSnippetGroup(const QString &id);
|
void setSnippetGroup(const QString &id);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setKeywords (Keywords keywords);
|
void setKeywords (const Keywords &keywords);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool isInComment(const AssistInterface *interface) const;
|
bool isInComment(const AssistInterface *interface) const;
|
||||||
|
@@ -32,8 +32,7 @@
|
|||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
using namespace Internal;
|
using namespace Internal;
|
||||||
|
|
||||||
ProcessorRunner::ProcessorRunner()
|
ProcessorRunner::ProcessorRunner() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
ProcessorRunner::~ProcessorRunner()
|
ProcessorRunner::~ProcessorRunner()
|
||||||
{
|
{
|
||||||
|
@@ -134,9 +134,7 @@ CodecSelector::CodecSelector(QWidget *parent, TextDocument *doc)
|
|||||||
updateButtons();
|
updateButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
CodecSelector::~CodecSelector()
|
CodecSelector::~CodecSelector() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void CodecSelector::updateButtons()
|
void CodecSelector::updateButtons()
|
||||||
{
|
{
|
||||||
|
@@ -50,14 +50,12 @@ namespace Internal {
|
|||||||
class CodeStylePoolPrivate
|
class CodeStylePoolPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CodeStylePoolPrivate()
|
CodeStylePoolPrivate() = default;
|
||||||
: m_factory(nullptr)
|
|
||||||
{}
|
|
||||||
~CodeStylePoolPrivate();
|
~CodeStylePoolPrivate();
|
||||||
|
|
||||||
QByteArray generateUniqueId(const QByteArray &id) const;
|
QByteArray generateUniqueId(const QByteArray &id) const;
|
||||||
|
|
||||||
ICodeStylePreferencesFactory *m_factory;
|
ICodeStylePreferencesFactory *m_factory = nullptr;
|
||||||
QList<ICodeStylePreferences *> m_pool;
|
QList<ICodeStylePreferences *> m_pool;
|
||||||
QList<ICodeStylePreferences *> m_builtInPool;
|
QList<ICodeStylePreferences *> m_builtInPool;
|
||||||
QList<ICodeStylePreferences *> m_customPool;
|
QList<ICodeStylePreferences *> m_customPool;
|
||||||
|
@@ -109,9 +109,9 @@ static QColor fromEnumString(const QString &s)
|
|||||||
{QLatin1String("transparent"), QColor(Qt::transparent)}
|
{QLatin1String("transparent"), QColor(Qt::transparent)}
|
||||||
};
|
};
|
||||||
|
|
||||||
for (uint ii = 0; ii < sizeof(table) / sizeof(table[0]); ++ii) {
|
for (const auto &enumColor : table) {
|
||||||
if (s == table[ii].name)
|
if (s == enumColor.name)
|
||||||
return table[ii].color;
|
return enumColor.color;
|
||||||
}
|
}
|
||||||
|
|
||||||
return QColor();
|
return QColor();
|
||||||
@@ -189,11 +189,9 @@ static QString removeWhitespace(const QString &s)
|
|||||||
{
|
{
|
||||||
QString ret;
|
QString ret;
|
||||||
ret.reserve(s.size());
|
ret.reserve(s.size());
|
||||||
for (int ii = 0; ii < s.length(); ++ii) {
|
for (QChar c : s) {
|
||||||
const QChar c = s[ii];
|
|
||||||
if (!c.isSpace())
|
if (!c.isSpace())
|
||||||
ret += c;
|
ret += c;
|
||||||
|
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@@ -428,7 +428,7 @@ void ColorSchemeEdit::changeForeColor()
|
|||||||
m_ui->foregroundToolButton->setStyleSheet(colorButtonStyleSheet(newColor));
|
m_ui->foregroundToolButton->setStyleSheet(colorButtonStyleSheet(newColor));
|
||||||
m_ui->eraseForegroundToolButton->setEnabled(true);
|
m_ui->eraseForegroundToolButton->setEnabled(true);
|
||||||
|
|
||||||
foreach (const QModelIndex &index, m_ui->itemList->selectionModel()->selectedRows()) {
|
for (const QModelIndex &index : m_ui->itemList->selectionModel()->selectedRows()) {
|
||||||
const TextStyle category = m_descriptions[index.row()].id();
|
const TextStyle category = m_descriptions[index.row()].id();
|
||||||
m_scheme.formatFor(category).setForeground(newColor);
|
m_scheme.formatFor(category).setForeground(newColor);
|
||||||
m_formatsModel->emitDataChanged(index);
|
m_formatsModel->emitDataChanged(index);
|
||||||
@@ -448,7 +448,7 @@ void ColorSchemeEdit::changeBackColor()
|
|||||||
m_ui->backgroundToolButton->setStyleSheet(colorButtonStyleSheet(newColor));
|
m_ui->backgroundToolButton->setStyleSheet(colorButtonStyleSheet(newColor));
|
||||||
m_ui->eraseBackgroundToolButton->setEnabled(true);
|
m_ui->eraseBackgroundToolButton->setEnabled(true);
|
||||||
|
|
||||||
foreach (const QModelIndex &index, m_ui->itemList->selectionModel()->selectedRows()) {
|
for (const QModelIndex &index : m_ui->itemList->selectionModel()->selectedRows()) {
|
||||||
const TextStyle category = m_descriptions[index.row()].id();
|
const TextStyle category = m_descriptions[index.row()].id();
|
||||||
m_scheme.formatFor(category).setBackground(newColor);
|
m_scheme.formatFor(category).setBackground(newColor);
|
||||||
m_formatsModel->emitDataChanged(index);
|
m_formatsModel->emitDataChanged(index);
|
||||||
@@ -485,7 +485,7 @@ void ColorSchemeEdit::eraseForeColor()
|
|||||||
m_ui->foregroundToolButton->setStyleSheet(colorButtonStyleSheet(newColor));
|
m_ui->foregroundToolButton->setStyleSheet(colorButtonStyleSheet(newColor));
|
||||||
m_ui->eraseForegroundToolButton->setEnabled(false);
|
m_ui->eraseForegroundToolButton->setEnabled(false);
|
||||||
|
|
||||||
foreach (const QModelIndex &index, m_ui->itemList->selectionModel()->selectedRows()) {
|
for (const QModelIndex &index : m_ui->itemList->selectionModel()->selectedRows()) {
|
||||||
const TextStyle category = m_descriptions[index.row()].id();
|
const TextStyle category = m_descriptions[index.row()].id();
|
||||||
m_scheme.formatFor(category).setForeground(newColor);
|
m_scheme.formatFor(category).setForeground(newColor);
|
||||||
m_formatsModel->emitDataChanged(index);
|
m_formatsModel->emitDataChanged(index);
|
||||||
@@ -534,7 +534,7 @@ void ColorSchemeEdit::eraseRelativeForeColor()
|
|||||||
m_ui->foregroundSaturationSpinBox->setValue(0.0);
|
m_ui->foregroundSaturationSpinBox->setValue(0.0);
|
||||||
m_ui->foregroundLightnessSpinBox->setValue(0.0);
|
m_ui->foregroundLightnessSpinBox->setValue(0.0);
|
||||||
|
|
||||||
foreach (const QModelIndex &index, m_ui->itemList->selectionModel()->selectedRows()) {
|
for (const QModelIndex &index : m_ui->itemList->selectionModel()->selectedRows()) {
|
||||||
const TextStyle category = m_descriptions[index.row()].id();
|
const TextStyle category = m_descriptions[index.row()].id();
|
||||||
m_scheme.formatFor(category).setRelativeForegroundSaturation(0.0);
|
m_scheme.formatFor(category).setRelativeForegroundSaturation(0.0);
|
||||||
m_scheme.formatFor(category).setRelativeForegroundLightness(0.0);
|
m_scheme.formatFor(category).setRelativeForegroundLightness(0.0);
|
||||||
@@ -563,7 +563,7 @@ void ColorSchemeEdit::checkCheckBoxes()
|
|||||||
if (m_curItem == -1)
|
if (m_curItem == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (const QModelIndex &index, m_ui->itemList->selectionModel()->selectedRows()) {
|
for (const QModelIndex &index : m_ui->itemList->selectionModel()->selectedRows()) {
|
||||||
const TextStyle category = m_descriptions[index.row()].id();
|
const TextStyle category = m_descriptions[index.row()].id();
|
||||||
m_scheme.formatFor(category).setBold(m_ui->boldCheckBox->isChecked());
|
m_scheme.formatFor(category).setBold(m_ui->boldCheckBox->isChecked());
|
||||||
m_scheme.formatFor(category).setItalic(m_ui->italicCheckBox->isChecked());
|
m_scheme.formatFor(category).setItalic(m_ui->italicCheckBox->isChecked());
|
||||||
@@ -582,7 +582,7 @@ void ColorSchemeEdit::changeUnderlineColor()
|
|||||||
m_ui->underlineColorToolButton->setStyleSheet(colorButtonStyleSheet(newColor));
|
m_ui->underlineColorToolButton->setStyleSheet(colorButtonStyleSheet(newColor));
|
||||||
m_ui->eraseUnderlineColorToolButton->setEnabled(true);
|
m_ui->eraseUnderlineColorToolButton->setEnabled(true);
|
||||||
|
|
||||||
foreach (const QModelIndex &index, m_ui->itemList->selectionModel()->selectedRows()) {
|
for (const QModelIndex &index : m_ui->itemList->selectionModel()->selectedRows()) {
|
||||||
const TextStyle category = m_descriptions[index.row()].id();
|
const TextStyle category = m_descriptions[index.row()].id();
|
||||||
m_scheme.formatFor(category).setUnderlineColor(newColor);
|
m_scheme.formatFor(category).setUnderlineColor(newColor);
|
||||||
m_formatsModel->emitDataChanged(index);
|
m_formatsModel->emitDataChanged(index);
|
||||||
@@ -597,7 +597,7 @@ void ColorSchemeEdit::eraseUnderlineColor()
|
|||||||
m_ui->underlineColorToolButton->setStyleSheet(colorButtonStyleSheet(newColor));
|
m_ui->underlineColorToolButton->setStyleSheet(colorButtonStyleSheet(newColor));
|
||||||
m_ui->eraseUnderlineColorToolButton->setEnabled(false);
|
m_ui->eraseUnderlineColorToolButton->setEnabled(false);
|
||||||
|
|
||||||
foreach (const QModelIndex &index, m_ui->itemList->selectionModel()->selectedRows()) {
|
for (const QModelIndex &index : m_ui->itemList->selectionModel()->selectedRows()) {
|
||||||
const TextStyle category = m_descriptions[index.row()].id();
|
const TextStyle category = m_descriptions[index.row()].id();
|
||||||
m_scheme.formatFor(category).setUnderlineColor(newColor);
|
m_scheme.formatFor(category).setUnderlineColor(newColor);
|
||||||
m_formatsModel->emitDataChanged(index);
|
m_formatsModel->emitDataChanged(index);
|
||||||
@@ -609,7 +609,7 @@ void ColorSchemeEdit::changeUnderlineStyle(int comboBoxIndex)
|
|||||||
if (m_curItem == -1)
|
if (m_curItem == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (const QModelIndex &index, m_ui->itemList->selectionModel()->selectedRows()) {
|
for (const QModelIndex &index : m_ui->itemList->selectionModel()->selectedRows()) {
|
||||||
const TextStyle category = m_descriptions[index.row()].id();
|
const TextStyle category = m_descriptions[index.row()].id();
|
||||||
auto value = m_ui->underlineComboBox->itemData(comboBoxIndex);
|
auto value = m_ui->underlineComboBox->itemData(comboBoxIndex);
|
||||||
auto enumeratorIndex = static_cast<QTextCharFormat::UnderlineStyle>(value.toInt());
|
auto enumeratorIndex = static_cast<QTextCharFormat::UnderlineStyle>(value.toInt());
|
||||||
|
@@ -39,8 +39,7 @@ using namespace TextEditor;
|
|||||||
ExtraEncodingSettings::ExtraEncodingSettings() : m_utf8BomSetting(OnlyKeep)
|
ExtraEncodingSettings::ExtraEncodingSettings() : m_utf8BomSetting(OnlyKeep)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
ExtraEncodingSettings::~ExtraEncodingSettings()
|
ExtraEncodingSettings::~ExtraEncodingSettings() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
void ExtraEncodingSettings::toSettings(const QString &category, QSettings *s) const
|
void ExtraEncodingSettings::toSettings(const QString &category, QSettings *s) const
|
||||||
{
|
{
|
||||||
|
@@ -58,9 +58,7 @@ FindInFiles::FindInFiles()
|
|||||||
this, &FindInFiles::findOnFileSystem);
|
this, &FindInFiles::findOnFileSystem);
|
||||||
}
|
}
|
||||||
|
|
||||||
FindInFiles::~FindInFiles()
|
FindInFiles::~FindInFiles() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool FindInFiles::isValid() const
|
bool FindInFiles::isValid() const
|
||||||
{
|
{
|
||||||
|
@@ -51,7 +51,7 @@ class FormatDescription;
|
|||||||
class TEXTEDITOR_EXPORT FontSettings
|
class TEXTEDITOR_EXPORT FontSettings
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef std::vector<FormatDescription> FormatDescriptions;
|
using FormatDescriptions = std::vector<FormatDescription>;
|
||||||
|
|
||||||
FontSettings();
|
FontSettings();
|
||||||
void clear();
|
void clear();
|
||||||
|
@@ -117,7 +117,7 @@ private:
|
|||||||
ShowControls m_showControls = ShowAllAbsoluteControls;
|
ShowControls m_showControls = ShowAllAbsoluteControls;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<FormatDescription> FormatDescriptions;
|
using FormatDescriptions = std::vector<FormatDescription>;
|
||||||
|
|
||||||
class TEXTEDITOR_EXPORT FontSettingsPage : public TextEditorOptionsPage
|
class TEXTEDITOR_EXPORT FontSettingsPage : public TextEditorOptionsPage
|
||||||
{
|
{
|
||||||
|
@@ -270,7 +270,7 @@ static void updateEditorText(QPlainTextEdit *editor, const QString &text)
|
|||||||
+ absoluteVerticalCursorOffset / fontHeight);
|
+ absoluteVerticalCursorOffset / fontHeight);
|
||||||
// Restore folded blocks
|
// Restore folded blocks
|
||||||
const QTextDocument *doc = editor->document();
|
const QTextDocument *doc = editor->document();
|
||||||
for (int blockId : foldedBlocks) {
|
for (int blockId : qAsConst(foldedBlocks)) {
|
||||||
const QTextBlock block = doc->findBlockByNumber(qMax(0, blockId));
|
const QTextBlock block = doc->findBlockByNumber(qMax(0, blockId));
|
||||||
if (block.isValid())
|
if (block.isValid())
|
||||||
TextDocumentLayout::doFoldOrUnfold(block, false);
|
TextDocumentLayout::doFoldOrUnfold(block, false);
|
||||||
|
@@ -54,8 +54,7 @@ const Context &Context::operator=(Context copy)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Context::~Context()
|
Context::~Context() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
void Context::swap(Context &context)
|
void Context::swap(Context &context)
|
||||||
{
|
{
|
||||||
|
@@ -32,8 +32,7 @@ using namespace Internal;
|
|||||||
DynamicRule::DynamicRule() : m_active(false)
|
DynamicRule::DynamicRule() : m_active(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
DynamicRule::~DynamicRule()
|
DynamicRule::~DynamicRule() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
void DynamicRule::setActive(const QString &active)
|
void DynamicRule::setActive(const QString &active)
|
||||||
{ m_active = toBool(active); }
|
{ m_active = toBool(active); }
|
||||||
|
@@ -76,13 +76,12 @@ HighlightDefinition::HighlightDefinition() :
|
|||||||
m_singleLineCommentAfterWhiteSpaces(false),
|
m_singleLineCommentAfterWhiteSpaces(false),
|
||||||
m_indentationBasedFolding(false)
|
m_indentationBasedFolding(false)
|
||||||
{
|
{
|
||||||
QString s(QLatin1String(".():!+,-<=>%&/;?[]^{|}~\\*, \t"));
|
const QString s(QLatin1String(".():!+,-<=>%&/;?[]^{|}~\\*, \t"));
|
||||||
foreach (const QChar &c, s)
|
for (auto &c : s)
|
||||||
m_delimiters.insert(c);
|
m_delimiters.insert(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
HighlightDefinition::~HighlightDefinition()
|
HighlightDefinition::~HighlightDefinition() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
bool HighlightDefinition::isValid() const
|
bool HighlightDefinition::isValid() const
|
||||||
{
|
{
|
||||||
@@ -169,15 +168,15 @@ const QString &HighlightDefinition::multiLineCommentRegion() const
|
|||||||
|
|
||||||
void HighlightDefinition::removeDelimiters(const QString &characters)
|
void HighlightDefinition::removeDelimiters(const QString &characters)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < characters.length(); ++i)
|
for (QChar character : characters)
|
||||||
m_delimiters.remove(characters.at(i));
|
m_delimiters.remove(character);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HighlightDefinition::addDelimiters(const QString &characters)
|
void HighlightDefinition::addDelimiters(const QString &characters)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < characters.length(); ++i) {
|
for (QChar character : characters) {
|
||||||
if (!m_delimiters.contains(characters.at(i)))
|
if (!m_delimiters.contains(character))
|
||||||
m_delimiters.insert(characters.at(i));
|
m_delimiters.insert(character);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -113,8 +113,7 @@ HighlightDefinitionHandler(const QSharedPointer<HighlightDefinition> &definition
|
|||||||
m_initialContext(true)
|
m_initialContext(true)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
HighlightDefinitionHandler::~HighlightDefinitionHandler()
|
HighlightDefinitionHandler::~HighlightDefinitionHandler() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
bool HighlightDefinitionHandler::startDocument()
|
bool HighlightDefinitionHandler::startDocument()
|
||||||
{
|
{
|
||||||
|
@@ -35,10 +35,10 @@ namespace Internal {
|
|||||||
class HighlightDefinitionMetaData
|
class HighlightDefinitionMetaData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HighlightDefinitionMetaData() : priority(0) {}
|
HighlightDefinitionMetaData() = default;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int priority;
|
int priority = 0;
|
||||||
QString id;
|
QString id;
|
||||||
QString name;
|
QString name;
|
||||||
QString version;
|
QString version;
|
||||||
@@ -48,7 +48,7 @@ public:
|
|||||||
QUrl url;
|
QUrl url;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef QSharedPointer<HighlightDefinitionMetaData> DefinitionMetaDataPtr;
|
using DefinitionMetaDataPtr = QSharedPointer<HighlightDefinitionMetaData>;
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace TextEditor
|
} // namespace TextEditor
|
||||||
|
@@ -56,17 +56,11 @@ namespace {
|
|||||||
class HighlighterCodeFormatterData : public CodeFormatterData
|
class HighlighterCodeFormatterData : public CodeFormatterData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HighlighterCodeFormatterData() :
|
~HighlighterCodeFormatterData() override = default;
|
||||||
m_foldingIndentDelta(0),
|
int m_foldingIndentDelta = 0;
|
||||||
m_originalObservableState(-1),
|
int m_originalObservableState = -1;
|
||||||
m_continueObservableState(-1)
|
|
||||||
{}
|
|
||||||
|
|
||||||
~HighlighterCodeFormatterData() override {}
|
|
||||||
int m_foldingIndentDelta;
|
|
||||||
int m_originalObservableState;
|
|
||||||
QStack<QString> m_foldingRegions;
|
QStack<QString> m_foldingRegions;
|
||||||
int m_continueObservableState;
|
int m_continueObservableState = -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
HighlighterCodeFormatterData *formatterData(const QTextBlock &block)
|
HighlighterCodeFormatterData *formatterData(const QTextBlock &block)
|
||||||
@@ -132,8 +126,7 @@ Highlighter::Highlighter(QTextDocument *parent) :
|
|||||||
setTextFormatCategories(TextFormatIdCount, styleForFormat);
|
setTextFormatCategories(TextFormatIdCount, styleForFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
Highlighter::~Highlighter()
|
Highlighter::~Highlighter() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
// Mapping from Kate format strings to format ids.
|
// Mapping from Kate format strings to format ids.
|
||||||
struct KateFormatMap
|
struct KateFormatMap
|
||||||
@@ -344,7 +337,7 @@ void Highlighter::iterateThroughRules(const QString &text,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef QList<QSharedPointer<Rule> >::const_iterator RuleIterator;
|
using RuleIterator = QList<QSharedPointer<Rule> >::const_iterator;
|
||||||
|
|
||||||
bool contextChanged = false;
|
bool contextChanged = false;
|
||||||
bool atLeastOneMatch = false;
|
bool atLeastOneMatch = false;
|
||||||
@@ -639,8 +632,8 @@ void Highlighter::mapLeadingSequence(const QString &contextSequence)
|
|||||||
void Highlighter::pushContextSequence(int state)
|
void Highlighter::pushContextSequence(int state)
|
||||||
{
|
{
|
||||||
const QVector<QSharedPointer<Context> > &contexts = m_persistentContexts.value(state);
|
const QVector<QSharedPointer<Context> > &contexts = m_persistentContexts.value(state);
|
||||||
for (int i = 0; i < contexts.size(); ++i)
|
for (const auto &context : contexts)
|
||||||
m_contexts.push_back(contexts.at(i));
|
m_contexts.push_back(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Highlighter::currentContextSequence() const
|
QString Highlighter::currentContextSequence() const
|
||||||
|
@@ -45,20 +45,19 @@ QString findFallbackDefinitionsLocation()
|
|||||||
dir.setNameFilters(QStringList(QLatin1String("*.xml")));
|
dir.setNameFilters(QStringList(QLatin1String("*.xml")));
|
||||||
|
|
||||||
if (Utils::HostOsInfo::isAnyUnixHost() && !Utils::HostOsInfo::isMacHost()) {
|
if (Utils::HostOsInfo::isAnyUnixHost() && !Utils::HostOsInfo::isMacHost()) {
|
||||||
static const QLatin1String kateSyntax[] = {
|
static const QLatin1String kateSyntaxPaths[] = {
|
||||||
QLatin1String("/share/apps/katepart/syntax"),
|
QLatin1String("/share/apps/katepart/syntax"),
|
||||||
QLatin1String("/share/kde4/apps/katepart/syntax")
|
QLatin1String("/share/kde4/apps/katepart/syntax")
|
||||||
};
|
};
|
||||||
static const int kateSyntaxCount =
|
|
||||||
sizeof(kateSyntax) / sizeof(kateSyntax[0]);
|
|
||||||
|
|
||||||
// Some wild guesses.
|
// Some wild guesses.
|
||||||
for (int i = 0; i < kateSyntaxCount; ++i) {
|
for (const auto &kateSyntaxPath : kateSyntaxPaths) {
|
||||||
QStringList paths;
|
const QStringList paths = {
|
||||||
paths << QLatin1String("/usr") + kateSyntax[i]
|
QLatin1String("/usr") + kateSyntaxPath,
|
||||||
<< QLatin1String("/usr/local") + kateSyntax[i]
|
QLatin1String("/usr/local") + kateSyntaxPath,
|
||||||
<< QLatin1String("/opt") + kateSyntax[i];
|
QLatin1String("/opt") + kateSyntaxPath
|
||||||
foreach (const QString &path, paths) {
|
};
|
||||||
|
for (const auto &path : paths) {
|
||||||
dir.setPath(path);
|
dir.setPath(path);
|
||||||
if (dir.exists() && !dir.entryInfoList().isEmpty())
|
if (dir.exists() && !dir.entryInfoList().isEmpty())
|
||||||
return dir.path();
|
return dir.path();
|
||||||
@@ -66,9 +65,8 @@ QString findFallbackDefinitionsLocation()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Try kde-config.
|
// Try kde-config.
|
||||||
QStringList programs;
|
const QStringList programs = {QLatin1String("kde-config"), QLatin1String("kde4-config")};
|
||||||
programs << QLatin1String("kde-config") << QLatin1String("kde4-config");
|
for (auto &program : programs) {
|
||||||
foreach (const QString &program, programs) {
|
|
||||||
Utils::SynchronousProcess process;
|
Utils::SynchronousProcess process;
|
||||||
process.setTimeoutS(5);
|
process.setTimeoutS(5);
|
||||||
Utils::SynchronousProcessResponse response
|
Utils::SynchronousProcessResponse response
|
||||||
@@ -76,8 +74,8 @@ QString findFallbackDefinitionsLocation()
|
|||||||
if (response.result == Utils::SynchronousProcessResponse::Finished) {
|
if (response.result == Utils::SynchronousProcessResponse::Finished) {
|
||||||
QString output = response.stdOut();
|
QString output = response.stdOut();
|
||||||
output.remove(QLatin1Char('\n'));
|
output.remove(QLatin1Char('\n'));
|
||||||
for (int i = 0; i < kateSyntaxCount; ++i) {
|
for (auto &kateSyntaxPath : kateSyntaxPaths) {
|
||||||
dir.setPath(output + kateSyntax[i]);
|
dir.setPath(output + kateSyntaxPath);
|
||||||
if (dir.exists() && !dir.entryInfoList().isEmpty())
|
if (dir.exists() && !dir.entryInfoList().isEmpty())
|
||||||
return dir.path();
|
return dir.path();
|
||||||
}
|
}
|
||||||
@@ -189,7 +187,7 @@ void HighlighterSettings::assignDefaultDefinitionsPath()
|
|||||||
|
|
||||||
bool HighlighterSettings::isIgnoredFilePattern(const QString &fileName) const
|
bool HighlighterSettings::isIgnoredFilePattern(const QString &fileName) const
|
||||||
{
|
{
|
||||||
foreach (QRegExp regExp, m_ignoredFiles)
|
for (auto ®Exp : m_ignoredFiles)
|
||||||
if (regExp.indexIn(fileName) != -1)
|
if (regExp.indexIn(fileName) != -1)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@@ -210,8 +208,8 @@ void HighlighterSettings::setExpressionsFromList(const QStringList &patterns)
|
|||||||
QRegExp regExp;
|
QRegExp regExp;
|
||||||
regExp.setCaseSensitivity(Qt::CaseInsensitive);
|
regExp.setCaseSensitivity(Qt::CaseInsensitive);
|
||||||
regExp.setPatternSyntax(QRegExp::Wildcard);
|
regExp.setPatternSyntax(QRegExp::Wildcard);
|
||||||
foreach (const QString &s, patterns) {
|
for (auto &pattern : patterns) {
|
||||||
regExp.setPattern(s);
|
regExp.setPattern(pattern);
|
||||||
m_ignoredFiles.append(regExp);
|
m_ignoredFiles.append(regExp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -58,8 +58,7 @@ Rule::Rule(bool consumesNonSpace) :
|
|||||||
m_lookAhead(false), m_firstNonSpace(false), m_column(-1), m_consumesNonSpace(consumesNonSpace)
|
m_lookAhead(false), m_firstNonSpace(false), m_column(-1), m_consumesNonSpace(consumesNonSpace)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Rule::~Rule()
|
Rule::~Rule() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
void Rule::setContext(const QString &context)
|
void Rule::setContext(const QString &context)
|
||||||
{ m_context = context; }
|
{ m_context = context; }
|
||||||
|
@@ -278,8 +278,7 @@ KeywordRule::KeywordRule(const QSharedPointer<HighlightDefinition> &definition)
|
|||||||
setDefinition(definition);
|
setDefinition(definition);
|
||||||
}
|
}
|
||||||
|
|
||||||
KeywordRule::~KeywordRule()
|
KeywordRule::~KeywordRule() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
void KeywordRule::setInsensitive(const QString &insensitive)
|
void KeywordRule::setInsensitive(const QString &insensitive)
|
||||||
{
|
{
|
||||||
|
@@ -42,7 +42,7 @@ class HighlightDefinition;
|
|||||||
class DetectCharRule : public DynamicRule
|
class DetectCharRule : public DynamicRule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
~DetectCharRule() override {}
|
~DetectCharRule() override = default;
|
||||||
|
|
||||||
void setChar(const QString &character);
|
void setChar(const QString &character);
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ private:
|
|||||||
class Detect2CharsRule : public DynamicRule
|
class Detect2CharsRule : public DynamicRule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
~Detect2CharsRule() override {}
|
~Detect2CharsRule() override = default;
|
||||||
|
|
||||||
void setChar(const QString &character);
|
void setChar(const QString &character);
|
||||||
void setChar1(const QString &character);
|
void setChar1(const QString &character);
|
||||||
@@ -74,7 +74,7 @@ private:
|
|||||||
class AnyCharRule : public Rule
|
class AnyCharRule : public Rule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
~AnyCharRule() override {}
|
~AnyCharRule() override = default;
|
||||||
|
|
||||||
void setCharacterSet(const QString &s);
|
void setCharacterSet(const QString &s);
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ private:
|
|||||||
class StringDetectRule : public DynamicRule
|
class StringDetectRule : public DynamicRule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
~StringDetectRule() override {}
|
~StringDetectRule() override = default;
|
||||||
|
|
||||||
void setString(const QString &s);
|
void setString(const QString &s);
|
||||||
void setInsensitive(const QString &insensitive);
|
void setInsensitive(const QString &insensitive);
|
||||||
@@ -157,7 +157,7 @@ private:
|
|||||||
class IntRule : public Rule
|
class IntRule : public Rule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
~IntRule() override {}
|
~IntRule() override = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
||||||
@@ -167,7 +167,7 @@ private:
|
|||||||
class FloatRule : public Rule
|
class FloatRule : public Rule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
~FloatRule() override {}
|
~FloatRule() override = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
||||||
@@ -177,7 +177,7 @@ private:
|
|||||||
class HlCOctRule : public Rule
|
class HlCOctRule : public Rule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
~HlCOctRule() override {}
|
~HlCOctRule() override = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
||||||
@@ -187,7 +187,7 @@ private:
|
|||||||
class HlCHexRule : public Rule
|
class HlCHexRule : public Rule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
~HlCHexRule() override {}
|
~HlCHexRule() override = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
||||||
@@ -197,7 +197,7 @@ private:
|
|||||||
class HlCStringCharRule : public Rule
|
class HlCStringCharRule : public Rule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
~HlCStringCharRule() override {}
|
~HlCStringCharRule() override = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
||||||
@@ -207,7 +207,7 @@ private:
|
|||||||
class HlCCharRule : public Rule
|
class HlCCharRule : public Rule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
~HlCCharRule() override {}
|
~HlCCharRule() override = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
||||||
@@ -217,7 +217,7 @@ private:
|
|||||||
class RangeDetectRule : public Rule
|
class RangeDetectRule : public Rule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
~RangeDetectRule() override {}
|
~RangeDetectRule() override = default;
|
||||||
|
|
||||||
void setChar(const QString &character);
|
void setChar(const QString &character);
|
||||||
void setChar1(const QString &character);
|
void setChar1(const QString &character);
|
||||||
@@ -233,7 +233,7 @@ private:
|
|||||||
class LineContinueRule : public Rule
|
class LineContinueRule : public Rule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
~LineContinueRule() override {}
|
~LineContinueRule() override = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
||||||
@@ -244,7 +244,7 @@ class DetectSpacesRule : public Rule
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DetectSpacesRule();
|
DetectSpacesRule();
|
||||||
~DetectSpacesRule() override {}
|
~DetectSpacesRule() override = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
||||||
@@ -254,7 +254,7 @@ private:
|
|||||||
class DetectIdentifierRule : public Rule
|
class DetectIdentifierRule : public Rule
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
~DetectIdentifierRule() override {}
|
~DetectIdentifierRule() override = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
bool doMatchSucceed(const QString &text, const int length, ProgressData *progress) override;
|
||||||
|
@@ -30,8 +30,7 @@
|
|||||||
|
|
||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
|
|
||||||
HelpItem::HelpItem()
|
HelpItem::HelpItem() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
HelpItem::HelpItem(const QString &helpId, Category category) :
|
HelpItem::HelpItem(const QString &helpId, Category category) :
|
||||||
m_helpId(helpId), m_docMark(helpId), m_category(category)
|
m_helpId(helpId), m_docMark(helpId), m_category(category)
|
||||||
|
@@ -32,11 +32,9 @@
|
|||||||
|
|
||||||
using namespace TextEditor;
|
using namespace TextEditor;
|
||||||
|
|
||||||
Indenter::Indenter()
|
Indenter::Indenter() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
Indenter::~Indenter()
|
Indenter::~Indenter() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
bool Indenter::isElectricCharacter(const QChar &) const
|
bool Indenter::isElectricCharacter(const QChar &) const
|
||||||
{
|
{
|
||||||
|
@@ -36,7 +36,7 @@
|
|||||||
#include <QPair>
|
#include <QPair>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
typedef QPair<int,int> LineColumn;
|
using LineColumn = QPair<int, int>;
|
||||||
Q_DECLARE_METATYPE(LineColumn)
|
Q_DECLARE_METATYPE(LineColumn)
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
|
@@ -32,8 +32,8 @@ namespace TextEditor {
|
|||||||
class TEXTEDITOR_EXPORT NormalIndenter : public Indenter
|
class TEXTEDITOR_EXPORT NormalIndenter : public Indenter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NormalIndenter() {}
|
NormalIndenter() = default;
|
||||||
~NormalIndenter() override {}
|
~NormalIndenter() override = default;
|
||||||
|
|
||||||
int indentFor(const QTextBlock &block, const TabSettings &tabSettings) override;
|
int indentFor(const QTextBlock &block, const TabSettings &tabSettings) override;
|
||||||
};
|
};
|
||||||
|
@@ -92,9 +92,7 @@ OutlineWidgetStack::OutlineWidgetStack(OutlineFactory *factory) :
|
|||||||
updateCurrentEditor(Core::EditorManager::currentEditor());
|
updateCurrentEditor(Core::EditorManager::currentEditor());
|
||||||
}
|
}
|
||||||
|
|
||||||
OutlineWidgetStack::~OutlineWidgetStack()
|
OutlineWidgetStack::~OutlineWidgetStack() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
QToolButton *OutlineWidgetStack::toggleSyncButton()
|
QToolButton *OutlineWidgetStack::toggleSyncButton()
|
||||||
{
|
{
|
||||||
@@ -166,7 +164,7 @@ void OutlineWidgetStack::updateCurrentEditor(Core::IEditor *editor)
|
|||||||
IOutlineWidget *newWidget = nullptr;
|
IOutlineWidget *newWidget = nullptr;
|
||||||
|
|
||||||
if (editor) {
|
if (editor) {
|
||||||
for (IOutlineWidgetFactory *widgetFactory : g_outlineWidgetFactories) {
|
for (IOutlineWidgetFactory *widgetFactory : qAsConst(g_outlineWidgetFactories)) {
|
||||||
if (widgetFactory->supportsEditor(editor)) {
|
if (widgetFactory->supportsEditor(editor)) {
|
||||||
newWidget = widgetFactory->createWidget(editor);
|
newWidget = widgetFactory->createWidget(editor);
|
||||||
break;
|
break;
|
||||||
|
@@ -46,7 +46,7 @@ static PlainTextEditorFactory *m_instance = nullptr;
|
|||||||
class PlainTextEditorWidget : public TextEditorWidget
|
class PlainTextEditorWidget : public TextEditorWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PlainTextEditorWidget() {}
|
PlainTextEditorWidget() = default;
|
||||||
void finalizeInitialization() override
|
void finalizeInitialization() override
|
||||||
{
|
{
|
||||||
textDocument()->setMimeType(QLatin1String(Constants::C_TEXTEDITOR_MIMETYPE_TEXT));
|
textDocument()->setMimeType(QLatin1String(Constants::C_TEXTEDITOR_MIMETYPE_TEXT));
|
||||||
|
@@ -32,9 +32,7 @@ QuickFixOperation::QuickFixOperation(int priority)
|
|||||||
setPriority(priority);
|
setPriority(priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
QuickFixOperation::~QuickFixOperation()
|
QuickFixOperation::~QuickFixOperation() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int QuickFixOperation::priority() const
|
int QuickFixOperation::priority() const
|
||||||
{
|
{
|
||||||
|
@@ -49,7 +49,7 @@ class TEXTEDITOR_EXPORT QuickFixOperation
|
|||||||
Q_DISABLE_COPY(QuickFixOperation)
|
Q_DISABLE_COPY(QuickFixOperation)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef QSharedPointer<QuickFixOperation> Ptr;
|
using Ptr = QSharedPointer<QuickFixOperation>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QuickFixOperation(int priority = -1);
|
QuickFixOperation(int priority = -1);
|
||||||
@@ -85,7 +85,7 @@ private:
|
|||||||
QString _description;
|
QString _description;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef QList<QuickFixOperation::Ptr> QuickFixOperations;
|
using QuickFixOperations = QList<QuickFixOperation::Ptr>;
|
||||||
|
|
||||||
inline QuickFixOperations &operator<<(QuickFixOperations &list, QuickFixOperation *op)
|
inline QuickFixOperations &operator<<(QuickFixOperations &list, QuickFixOperation *op)
|
||||||
{
|
{
|
||||||
@@ -93,7 +93,7 @@ inline QuickFixOperations &operator<<(QuickFixOperations &list, QuickFixOperatio
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef QSharedPointer<const AssistInterface> QuickFixInterface;
|
using QuickFixInterface = QSharedPointer<const AssistInterface>;
|
||||||
|
|
||||||
} // namespace TextEditor
|
} // namespace TextEditor
|
||||||
|
|
||||||
|
@@ -55,8 +55,7 @@ RefactoringChanges::RefactoringChanges(RefactoringChangesData *data)
|
|||||||
: m_data(data)
|
: m_data(data)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
RefactoringChanges::~RefactoringChanges()
|
RefactoringChanges::~RefactoringChanges() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
RefactoringSelections RefactoringChanges::rangesToSelections(QTextDocument *document,
|
RefactoringSelections RefactoringChanges::rangesToSelections(QTextDocument *document,
|
||||||
const QList<Range> &ranges)
|
const QList<Range> &ranges)
|
||||||
@@ -387,7 +386,7 @@ void RefactoringFile::indentOrReindent(void (RefactoringChangesData::*mf)(const
|
|||||||
const TextDocument *) const,
|
const TextDocument *) const,
|
||||||
const RefactoringSelections &ranges)
|
const RefactoringSelections &ranges)
|
||||||
{
|
{
|
||||||
typedef QPair<QTextCursor, QTextCursor> CursorPair;
|
using CursorPair = QPair<QTextCursor, QTextCursor>;
|
||||||
|
|
||||||
foreach (const CursorPair &p, ranges) {
|
foreach (const CursorPair &p, ranges) {
|
||||||
QTextCursor selection(p.first.document());
|
QTextCursor selection(p.first.document());
|
||||||
@@ -403,8 +402,7 @@ void RefactoringFile::fileChanged()
|
|||||||
m_data->fileChanged(m_fileName);
|
m_data->fileChanged(m_fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
RefactoringChangesData::~RefactoringChangesData()
|
RefactoringChangesData::~RefactoringChangesData() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
void RefactoringChangesData::indentSelection(const QTextCursor &, const QString &, const TextDocument *) const
|
void RefactoringChangesData::indentSelection(const QTextCursor &, const QString &, const TextDocument *) const
|
||||||
{
|
{
|
||||||
|
@@ -44,15 +44,15 @@ class TextEditorWidget;
|
|||||||
class RefactoringChanges;
|
class RefactoringChanges;
|
||||||
class RefactoringFile;
|
class RefactoringFile;
|
||||||
class RefactoringChangesData;
|
class RefactoringChangesData;
|
||||||
typedef QSharedPointer<RefactoringFile> RefactoringFilePtr;
|
using RefactoringFilePtr = QSharedPointer<RefactoringFile>;
|
||||||
typedef QVector<QPair<QTextCursor, QTextCursor> > RefactoringSelections;
|
using RefactoringSelections = QVector<QPair<QTextCursor, QTextCursor>>;
|
||||||
|
|
||||||
// ### listen to the m_editor::destroyed signal?
|
// ### listen to the m_editor::destroyed signal?
|
||||||
class TEXTEDITOR_EXPORT RefactoringFile
|
class TEXTEDITOR_EXPORT RefactoringFile
|
||||||
{
|
{
|
||||||
Q_DISABLE_COPY(RefactoringFile)
|
Q_DISABLE_COPY(RefactoringFile)
|
||||||
public:
|
public:
|
||||||
typedef Utils::ChangeSet::Range Range;
|
using Range = Utils::ChangeSet::Range;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~RefactoringFile();
|
virtual ~RefactoringFile();
|
||||||
@@ -122,7 +122,7 @@ protected:
|
|||||||
class TEXTEDITOR_EXPORT RefactoringChanges
|
class TEXTEDITOR_EXPORT RefactoringChanges
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef Utils::ChangeSet::Range Range;
|
using Range = Utils::ChangeSet::Range;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RefactoringChanges();
|
RefactoringChanges();
|
||||||
@@ -150,7 +150,7 @@ class TEXTEDITOR_EXPORT RefactoringChangesData
|
|||||||
Q_DISABLE_COPY(RefactoringChangesData)
|
Q_DISABLE_COPY(RefactoringChangesData)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RefactoringChangesData() {}
|
RefactoringChangesData() = default;
|
||||||
virtual ~RefactoringChangesData();
|
virtual ~RefactoringChangesData();
|
||||||
|
|
||||||
virtual void indentSelection(const QTextCursor &selection,
|
virtual void indentSelection(const QTextCursor &selection,
|
||||||
|
@@ -46,8 +46,8 @@ RefactorOverlay::RefactorOverlay(TextEditor::TextEditorWidget *editor) :
|
|||||||
void RefactorOverlay::paint(QPainter *painter, const QRect &clip)
|
void RefactorOverlay::paint(QPainter *painter, const QRect &clip)
|
||||||
{
|
{
|
||||||
m_maxWidth = 0;
|
m_maxWidth = 0;
|
||||||
for (int i = 0; i < m_markers.size(); ++i) {
|
for (auto &marker : qAsConst(m_markers)) {
|
||||||
paintMarker(m_markers.at(i), painter, clip);
|
paintMarker(marker, painter, clip);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto documentLayout = qobject_cast<TextDocumentLayout*>(m_editor->document()->documentLayout()))
|
if (auto documentLayout = qobject_cast<TextDocumentLayout*>(m_editor->document()->documentLayout()))
|
||||||
@@ -57,7 +57,7 @@ void RefactorOverlay::paint(QPainter *painter, const QRect &clip)
|
|||||||
|
|
||||||
RefactorMarker RefactorOverlay::markerAt(const QPoint &pos) const
|
RefactorMarker RefactorOverlay::markerAt(const QPoint &pos) const
|
||||||
{
|
{
|
||||||
foreach (const RefactorMarker &marker, m_markers) {
|
for (const auto &marker : m_markers) {
|
||||||
if (marker.rect.contains(pos))
|
if (marker.rect.contains(pos))
|
||||||
return marker;
|
return marker;
|
||||||
}
|
}
|
||||||
|
@@ -42,7 +42,7 @@ struct TEXTEDITOR_EXPORT RefactorMarker {
|
|||||||
QVariant data;
|
QVariant data;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef QList<RefactorMarker> RefactorMarkers;
|
using RefactorMarkers = QList<RefactorMarker>;
|
||||||
|
|
||||||
class TEXTEDITOR_EXPORT RefactorOverlay : public QObject
|
class TEXTEDITOR_EXPORT RefactorOverlay : public QObject
|
||||||
{
|
{
|
||||||
|
@@ -82,8 +82,7 @@ const QChar Snippet::kEscapeChar(QLatin1Char('\\'));
|
|||||||
Snippet::Snippet(const QString &groupId, const QString &id) : m_groupId(groupId), m_id(id)
|
Snippet::Snippet(const QString &groupId, const QString &id) : m_groupId(groupId), m_id(id)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Snippet::~Snippet()
|
Snippet::~Snippet() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
const QString &Snippet::id() const
|
const QString &Snippet::id() const
|
||||||
{
|
{
|
||||||
|
@@ -107,8 +107,7 @@ SnippetsCollection::SnippetsCollection() :
|
|||||||
this, &SnippetsCollection::identifyGroups);
|
this, &SnippetsCollection::identifyGroups);
|
||||||
}
|
}
|
||||||
|
|
||||||
SnippetsCollection::~SnippetsCollection()
|
SnippetsCollection::~SnippetsCollection() = default;
|
||||||
{}
|
|
||||||
|
|
||||||
void SnippetsCollection::insertSnippet(const Snippet &snippet)
|
void SnippetsCollection::insertSnippet(const Snippet &snippet)
|
||||||
{
|
{
|
||||||
@@ -309,7 +308,7 @@ bool SnippetsCollection::synchronize(QString *errorString)
|
|||||||
}
|
}
|
||||||
Utils::FileSaver saver(m_userSnippetsPath + m_userSnippetsFile);
|
Utils::FileSaver saver(m_userSnippetsPath + m_userSnippetsFile);
|
||||||
if (!saver.hasError()) {
|
if (!saver.hasError()) {
|
||||||
typedef QHash<QString, int>::ConstIterator GroupIndexByIdConstIt;
|
using GroupIndexByIdConstIt = QHash<QString, int>::ConstIterator;
|
||||||
|
|
||||||
QXmlStreamWriter writer(saver.file());
|
QXmlStreamWriter writer(saver.file());
|
||||||
writer.setAutoFormatting(true);
|
writer.setAutoFormatting(true);
|
||||||
|
@@ -54,7 +54,7 @@ class SnippetsTableModel : public QAbstractTableModel
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
SnippetsTableModel(QObject *parent);
|
SnippetsTableModel(QObject *parent);
|
||||||
~SnippetsTableModel() override {}
|
~SnippetsTableModel() override = default;
|
||||||
|
|
||||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||||
|
@@ -36,8 +36,6 @@
|
|||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include <qtimer.h>
|
#include <qtimer.h>
|
||||||
|
|
||||||
#include <math.h>
|
|
||||||
|
|
||||||
namespace TextEditor {
|
namespace TextEditor {
|
||||||
|
|
||||||
class SyntaxHighlighterPrivate
|
class SyntaxHighlighterPrivate
|
||||||
@@ -690,8 +688,8 @@ void SyntaxHighlighter::setExtraFormats(const QTextBlock &block,
|
|||||||
previousSemanticFormats.reserve(all.size());
|
previousSemanticFormats.reserve(all.size());
|
||||||
formatsToApply.reserve(all.size() + formats.size());
|
formatsToApply.reserve(all.size() + formats.size());
|
||||||
|
|
||||||
for (int i = 0, ei = formats.size(); i < ei; ++i)
|
for (auto &format : formats)
|
||||||
formats[i].format.setProperty(QTextFormat::UserProperty, true);
|
format.format.setProperty(QTextFormat::UserProperty, true);
|
||||||
|
|
||||||
foreach (const QTextLayout::FormatRange &r, all) {
|
foreach (const QTextLayout::FormatRange &r, all) {
|
||||||
if (r.format.hasProperty(QTextFormat::UserProperty))
|
if (r.format.hasProperty(QTextFormat::UserProperty))
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
#include <QTextLayout>
|
#include <QTextLayout>
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <limits.h>
|
#include <climits>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QTextDocument;
|
class QTextDocument;
|
||||||
|
@@ -224,8 +224,8 @@ int TabSettings::positionAtColumn(const QString &text, int column, int *offset,
|
|||||||
int TabSettings::columnCountForText(const QString &text, int startColumn) const
|
int TabSettings::columnCountForText(const QString &text, int startColumn) const
|
||||||
{
|
{
|
||||||
int column = startColumn;
|
int column = startColumn;
|
||||||
for (int i = 0; i < text.size(); ++i) {
|
for (auto c : text) {
|
||||||
if (text.at(i) == QLatin1Char('\t'))
|
if (c == QLatin1Char('\t'))
|
||||||
column = column - (column % m_tabSize) + m_tabSize;
|
column = column - (column % m_tabSize) + m_tabSize;
|
||||||
else
|
else
|
||||||
++column;
|
++column;
|
||||||
|
@@ -57,7 +57,7 @@ class TextDocumentPrivate;
|
|||||||
class TextMark;
|
class TextMark;
|
||||||
class TypingSettings;
|
class TypingSettings;
|
||||||
|
|
||||||
typedef QList<TextMark *> TextMarks;
|
using TextMarks = QList<TextMark *>;
|
||||||
|
|
||||||
class TEXTEDITOR_EXPORT TextDocument : public Core::BaseTextDocument
|
class TEXTEDITOR_EXPORT TextDocument : public Core::BaseTextDocument
|
||||||
{
|
{
|
||||||
@@ -169,6 +169,6 @@ private:
|
|||||||
TextDocumentPrivate *d;
|
TextDocumentPrivate *d;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef QSharedPointer<TextDocument> TextDocumentPtr;
|
using TextDocumentPtr = QSharedPointer<TextDocument>;
|
||||||
|
|
||||||
} // namespace TextEditor
|
} // namespace TextEditor
|
||||||
|
@@ -30,9 +30,7 @@
|
|||||||
|
|
||||||
namespace TextEditor {
|
namespace TextEditor {
|
||||||
|
|
||||||
CodeFormatterData::~CodeFormatterData()
|
CodeFormatterData::~CodeFormatterData() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
TextBlockUserData::~TextBlockUserData()
|
TextBlockUserData::~TextBlockUserData()
|
||||||
{
|
{
|
||||||
@@ -48,8 +46,8 @@ TextBlockUserData::~TextBlockUserData()
|
|||||||
int TextBlockUserData::braceDepthDelta() const
|
int TextBlockUserData::braceDepthDelta() const
|
||||||
{
|
{
|
||||||
int delta = 0;
|
int delta = 0;
|
||||||
for (int i = 0; i < m_parentheses.size(); ++i) {
|
for (auto &parenthesis : m_parentheses) {
|
||||||
switch (m_parentheses.at(i).chr.unicode()) {
|
switch (parenthesis.chr.unicode()) {
|
||||||
case '{': case '+': case '[': ++delta; break;
|
case '{': case '+': case '[': ++delta; break;
|
||||||
case '}': case '-': case ']': --delta; break;
|
case '}': case '-': case ']': --delta; break;
|
||||||
default: break;
|
default: break;
|
||||||
|
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
namespace TextEditor {
|
namespace TextEditor {
|
||||||
struct Parenthesis;
|
struct Parenthesis;
|
||||||
typedef QVector<Parenthesis> Parentheses;
|
using Parentheses = QVector<Parenthesis>;
|
||||||
|
|
||||||
struct TEXTEDITOR_EXPORT Parenthesis
|
struct TEXTEDITOR_EXPORT Parenthesis
|
||||||
{
|
{
|
||||||
|
@@ -3852,8 +3852,8 @@ void TextEditorWidgetPrivate::insertIntoBlockSelection(const QString &text)
|
|||||||
const QStringList::const_iterator endLine = textLines.constEnd();
|
const QStringList::const_iterator endLine = textLines.constEnd();
|
||||||
for (QStringList::const_iterator textLine = textLines.constBegin(); textLine != endLine; ++textLine)
|
for (QStringList::const_iterator textLine = textLines.constBegin(); textLine != endLine; ++textLine)
|
||||||
textLength += qMax(0, ts.columnCountForText(*textLine, column) - textLength);
|
textLength += qMax(0, ts.columnCountForText(*textLine, column) - textLength);
|
||||||
for (QStringList::iterator textLine = textLines.begin(); textLine != textLines.end(); ++textLine)
|
for (auto &textLine : textLines)
|
||||||
textLine->append(QString(qMax(0, textLength - ts.columnCountForText(*textLine, column)), QLatin1Char(' ')));
|
textLine.append(QString(qMax(0, textLength - ts.columnCountForText(textLine, column)), QLatin1Char(' ')));
|
||||||
|
|
||||||
// insert Text
|
// insert Text
|
||||||
for (;;) {
|
for (;;) {
|
||||||
@@ -4156,7 +4156,7 @@ void TextEditorWidgetPrivate::updateLineAnnotation(const PaintEventData &data,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const TextMark *mark : marks) {
|
for (const TextMark *mark : qAsConst(marks)) {
|
||||||
boundingRect = QRectF(x, boundingRect.top(), q->viewport()->width() - x, boundingRect.height());
|
boundingRect = QRectF(x, boundingRect.top(), q->viewport()->width() - x, boundingRect.height());
|
||||||
if (boundingRect.isEmpty())
|
if (boundingRect.isEmpty())
|
||||||
break;
|
break;
|
||||||
@@ -4617,7 +4617,7 @@ void TextEditorWidgetPrivate::paintReplacement(PaintEventData &data, QPainter &p
|
|||||||
|
|
||||||
if (TextBlockUserData *nextBlockUserData = TextDocumentLayout::testUserData(nextBlock)) {
|
if (TextBlockUserData *nextBlockUserData = TextDocumentLayout::testUserData(nextBlock)) {
|
||||||
if (nextBlockUserData->foldingStartIncluded())
|
if (nextBlockUserData->foldingStartIncluded())
|
||||||
replacement.prepend(nextBlock.text().trimmed().left(1));
|
replacement.prepend(nextBlock.text().trimmed().at(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
QTextBlock nextVisibleBlock = TextEditor::nextVisibleBlock(data.block, data.doc);
|
QTextBlock nextVisibleBlock = TextEditor::nextVisibleBlock(data.block, data.doc);
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
#include "texteditor_global.h"
|
#include "texteditor_global.h"
|
||||||
|
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
#include <QTextCursor>
|
||||||
|
|
||||||
namespace TextEditor {
|
namespace TextEditor {
|
||||||
|
|
||||||
@@ -39,9 +40,7 @@ namespace Internal {
|
|||||||
class TEXTEDITOR_EXPORT TextBlockSelection
|
class TEXTEDITOR_EXPORT TextBlockSelection
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TextBlockSelection()
|
TextBlockSelection() = default;
|
||||||
: positionBlock(0), positionColumn(0)
|
|
||||||
, anchorBlock(0) , anchorColumn(0){}
|
|
||||||
TextBlockSelection(const TextBlockSelection &other);
|
TextBlockSelection(const TextBlockSelection &other);
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
@@ -60,10 +59,10 @@ public:
|
|||||||
inline int lastVisualColumn() const { return qMax(positionColumn, anchorColumn); }
|
inline int lastVisualColumn() const { return qMax(positionColumn, anchorColumn); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int positionBlock;
|
int positionBlock = 0;
|
||||||
int positionColumn;
|
int positionColumn = 0;
|
||||||
int anchorBlock;
|
int anchorBlock = 0;
|
||||||
int anchorColumn;
|
int anchorColumn = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QTextCursor cursor(const TextDocument *baseTextDocument, bool fullSelection) const;
|
QTextCursor cursor(const TextDocument *baseTextDocument, bool fullSelection) const;
|
||||||
|
@@ -51,7 +51,7 @@ struct TestBlockSelection
|
|||||||
TestBlockSelection(int positionBlock, int positionColumn, int anchorBlock, int anchorColumn)
|
TestBlockSelection(int positionBlock, int positionColumn, int anchorBlock, int anchorColumn)
|
||||||
: positionBlock(positionBlock), positionColumn(positionColumn)
|
: positionBlock(positionBlock), positionColumn(positionColumn)
|
||||||
, anchorBlock(anchorBlock), anchorColumn(anchorColumn) {}
|
, anchorBlock(anchorBlock), anchorColumn(anchorColumn) {}
|
||||||
TestBlockSelection() {}
|
TestBlockSelection() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(TransFormationType)
|
Q_DECLARE_METATYPE(TransFormationType)
|
||||||
@@ -529,23 +529,25 @@ struct TabSettingsFlags{
|
|||||||
TabSettings::ContinuationAlignBehavior behavior;
|
TabSettings::ContinuationAlignBehavior behavior;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::function<bool(TabSettingsFlags)> IsClean;
|
using IsClean = std::function<bool (TabSettingsFlags)>;
|
||||||
void generateTestRows(QLatin1String name, QString text, IsClean isClean)
|
void generateTestRows(const QLatin1String &name, const QString &text, IsClean isClean)
|
||||||
{
|
{
|
||||||
QList<TabSettings::TabPolicy> allPolicys;
|
const QVector<TabSettings::TabPolicy> allPolicies = {
|
||||||
allPolicys << TabSettings::SpacesOnlyTabPolicy
|
TabSettings::SpacesOnlyTabPolicy,
|
||||||
<< TabSettings::TabsOnlyTabPolicy
|
TabSettings::TabsOnlyTabPolicy,
|
||||||
<< TabSettings::MixedTabPolicy;
|
TabSettings::MixedTabPolicy
|
||||||
QList<TabSettings::ContinuationAlignBehavior> allbehavior;
|
};
|
||||||
allbehavior << TabSettings::NoContinuationAlign
|
const QVector<TabSettings::ContinuationAlignBehavior> allbehaviors = {
|
||||||
<< TabSettings::ContinuationAlignWithSpaces
|
TabSettings::NoContinuationAlign,
|
||||||
<< TabSettings::ContinuationAlignWithIndent;
|
TabSettings::ContinuationAlignWithSpaces,
|
||||||
|
TabSettings::ContinuationAlignWithIndent
|
||||||
|
};
|
||||||
|
|
||||||
const QLatin1Char splitter('_');
|
const QLatin1Char splitter('_');
|
||||||
const int indentSize = 3;
|
const int indentSize = 3;
|
||||||
|
|
||||||
foreach (TabSettings::TabPolicy policy, allPolicys) {
|
for (auto policy : allPolicies) {
|
||||||
foreach (TabSettings::ContinuationAlignBehavior behavior, allbehavior) {
|
for (auto behavior : allbehaviors) {
|
||||||
const QString tag = tabPolicyToString(policy) + splitter
|
const QString tag = tabPolicyToString(policy) + splitter
|
||||||
+ continuationAlignBehaviorToString(behavior) + splitter
|
+ continuationAlignBehaviorToString(behavior) + splitter
|
||||||
+ name;
|
+ name;
|
||||||
|
@@ -41,14 +41,14 @@ namespace Internal {
|
|||||||
|
|
||||||
struct OverlaySelection
|
struct OverlaySelection
|
||||||
{
|
{
|
||||||
OverlaySelection():m_fixedLength(-1), m_dropShadow(false){}
|
OverlaySelection() = default;
|
||||||
|
|
||||||
QTextCursor m_cursor_begin;
|
QTextCursor m_cursor_begin;
|
||||||
QTextCursor m_cursor_end;
|
QTextCursor m_cursor_end;
|
||||||
QColor m_fg;
|
QColor m_fg;
|
||||||
QColor m_bg;
|
QColor m_bg;
|
||||||
int m_fixedLength;
|
int m_fixedLength = -1;
|
||||||
bool m_dropShadow;
|
bool m_dropShadow = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TextEditorOverlay : public QObject
|
class TextEditorOverlay : public QObject
|
||||||
|
Reference in New Issue
Block a user