forked from qt-creator/qt-creator
Core: Modernize
modernize-use-auto modernize-use-nullptr modernize-use-override modernize-use-using modernize-use-default-member-init (partially) Change-Id: Idf10d7ffb1d98a04edc09a25c35e4e9e3abe87b5 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -202,29 +202,29 @@ QList<Group>::const_iterator ActionContainerPrivate::findGroup(Id groupId) const
|
||||
QAction *ActionContainerPrivate::insertLocation(Id groupId) const
|
||||
{
|
||||
QList<Group>::const_iterator it = findGroup(groupId);
|
||||
QTC_ASSERT(it != m_groups.constEnd(), return 0);
|
||||
QTC_ASSERT(it != m_groups.constEnd(), return nullptr);
|
||||
return insertLocation(it);
|
||||
}
|
||||
|
||||
QAction *ActionContainerPrivate::insertLocation(QList<Group>::const_iterator group) const
|
||||
{
|
||||
if (group == m_groups.constEnd())
|
||||
return 0;
|
||||
return nullptr;
|
||||
++group;
|
||||
while (group != m_groups.constEnd()) {
|
||||
if (!group->items.isEmpty()) {
|
||||
QObject *item = group->items.first();
|
||||
if (Command *cmd = qobject_cast<Command *>(item)) {
|
||||
if (auto cmd = qobject_cast<Command *>(item)) {
|
||||
return cmd->action();
|
||||
} else if (ActionContainer *container = qobject_cast<ActionContainer *>(item)) {
|
||||
} else if (auto container = qobject_cast<ActionContainer *>(item)) {
|
||||
if (container->menu())
|
||||
return container->menu()->menuAction();
|
||||
}
|
||||
QTC_ASSERT(false, return 0);
|
||||
QTC_ASSERT(false, return nullptr);
|
||||
}
|
||||
++group;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ActionContainerPrivate::addAction(Command *command, Id groupId)
|
||||
@@ -247,11 +247,11 @@ void ActionContainerPrivate::addAction(Command *command, Id groupId)
|
||||
|
||||
void ActionContainerPrivate::addMenu(ActionContainer *menu, Id groupId)
|
||||
{
|
||||
ActionContainerPrivate *containerPrivate = static_cast<ActionContainerPrivate *>(menu);
|
||||
auto containerPrivate = static_cast<ActionContainerPrivate *>(menu);
|
||||
if (!containerPrivate->canBeAddedToMenu())
|
||||
return;
|
||||
|
||||
MenuActionContainer *container = static_cast<MenuActionContainer *>(containerPrivate);
|
||||
auto container = static_cast<MenuActionContainer *>(containerPrivate);
|
||||
const Id actualGroupId = groupId.isValid() ? groupId : Id(Constants::G_DEFAULT_TWO);
|
||||
QList<Group>::const_iterator groupIt = findGroup(actualGroupId);
|
||||
QTC_ASSERT(groupIt != m_groups.constEnd(), return);
|
||||
@@ -265,11 +265,11 @@ void ActionContainerPrivate::addMenu(ActionContainer *menu, Id groupId)
|
||||
|
||||
void ActionContainerPrivate::addMenu(ActionContainer *before, ActionContainer *menu, Id groupId)
|
||||
{
|
||||
ActionContainerPrivate *containerPrivate = static_cast<ActionContainerPrivate *>(menu);
|
||||
auto containerPrivate = static_cast<ActionContainerPrivate *>(menu);
|
||||
if (!containerPrivate->canBeAddedToMenu())
|
||||
return;
|
||||
|
||||
MenuActionContainer *container = static_cast<MenuActionContainer *>(containerPrivate);
|
||||
auto container = static_cast<MenuActionContainer *>(containerPrivate);
|
||||
const Id actualGroupId = groupId.isValid() ? groupId : Id(Constants::G_DEFAULT_TWO);
|
||||
QList<Group>::const_iterator groupIt = findGroup(actualGroupId);
|
||||
QTC_ASSERT(groupIt != m_groups.constEnd(), return);
|
||||
@@ -293,7 +293,7 @@ void ActionContainerPrivate::addMenu(ActionContainer *before, ActionContainer *m
|
||||
Command *ActionContainerPrivate::addSeparator(const Context &context, Id group, QAction **outSeparator)
|
||||
{
|
||||
static int separatorIdCount = 0;
|
||||
QAction *separator = new QAction(this);
|
||||
auto separator = new QAction(this);
|
||||
separator->setSeparator(true);
|
||||
Id sepId = id().withSuffix(".Separator.").withSuffix(++separatorIdCount);
|
||||
Command *cmd = ActionManager::registerAction(separator, sepId, context);
|
||||
@@ -309,12 +309,12 @@ void ActionContainerPrivate::clear()
|
||||
while (it.hasNext()) {
|
||||
Group &group = it.next();
|
||||
foreach (QObject *item, group.items) {
|
||||
if (Command *command = qobject_cast<Command *>(item)) {
|
||||
if (auto command = qobject_cast<Command *>(item)) {
|
||||
removeAction(command->action());
|
||||
disconnect(command, &Command::activeStateChanged,
|
||||
this, &ActionContainerPrivate::scheduleUpdate);
|
||||
disconnect(command, &QObject::destroyed, this, &ActionContainerPrivate::itemDestroyed);
|
||||
} else if (ActionContainer *container = qobject_cast<ActionContainer *>(item)) {
|
||||
} else if (auto container = qobject_cast<ActionContainer *>(item)) {
|
||||
container->clear();
|
||||
disconnect(container, &QObject::destroyed,
|
||||
this, &ActionContainerPrivate::itemDestroyed);
|
||||
@@ -344,12 +344,12 @@ Id ActionContainerPrivate::id() const
|
||||
|
||||
QMenu *ActionContainerPrivate::menu() const
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QMenuBar *ActionContainerPrivate::menuBar() const
|
||||
{
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool ActionContainerPrivate::canAddAction(Command *action) const
|
||||
@@ -429,7 +429,7 @@ bool MenuActionContainer::updateInternal()
|
||||
while (it.hasNext()) {
|
||||
const Group &group = it.next();
|
||||
foreach (QObject *item, group.items) {
|
||||
if (ActionContainerPrivate *container = qobject_cast<ActionContainerPrivate*>(item)) {
|
||||
if (auto container = qobject_cast<ActionContainerPrivate*>(item)) {
|
||||
actions.removeAll(container->menu()->menuAction());
|
||||
if (container == this) {
|
||||
QByteArray warning = Q_FUNC_INFO + QByteArray(" container '");
|
||||
@@ -443,7 +443,7 @@ bool MenuActionContainer::updateInternal()
|
||||
hasitems = true;
|
||||
break;
|
||||
}
|
||||
} else if (Command *command = qobject_cast<Command *>(item)) {
|
||||
} else if (auto command = qobject_cast<Command *>(item)) {
|
||||
actions.removeAll(command->action());
|
||||
if (command->isActive()) {
|
||||
hasitems = true;
|
||||
@@ -488,7 +488,7 @@ bool MenuActionContainer::canBeAddedToMenu() const
|
||||
*/
|
||||
|
||||
MenuBarActionContainer::MenuBarActionContainer(Id id)
|
||||
: ActionContainerPrivate(id), m_menuBar(0)
|
||||
: ActionContainerPrivate(id), m_menuBar(nullptr)
|
||||
{
|
||||
setOnAllDisabledBehavior(Show);
|
||||
}
|
||||
|
@@ -46,7 +46,7 @@ class ActionContainerPrivate : public ActionContainer
|
||||
|
||||
public:
|
||||
ActionContainerPrivate(Id id);
|
||||
~ActionContainerPrivate() override {}
|
||||
~ActionContainerPrivate() override = default;
|
||||
|
||||
void setOnAllDisabledBehavior(OnAllDisabledBehavior behavior) override;
|
||||
ActionContainer::OnAllDisabledBehavior onAllDisabledBehavior() const override;
|
||||
|
@@ -152,7 +152,7 @@ using namespace Core::Internal;
|
||||
Emitted when a command (with the \a id) is added.
|
||||
*/
|
||||
|
||||
static ActionManager *m_instance = 0;
|
||||
static ActionManager *m_instance = nullptr;
|
||||
static ActionManagerPrivate *d;
|
||||
|
||||
/*!
|
||||
@@ -198,7 +198,7 @@ ActionContainer *ActionManager::createMenu(Id id)
|
||||
if (it != d->m_idContainerMap.constEnd())
|
||||
return it.value();
|
||||
|
||||
MenuActionContainer *mc = new MenuActionContainer(id);
|
||||
auto mc = new MenuActionContainer(id);
|
||||
|
||||
d->m_idContainerMap.insert(id, mc);
|
||||
connect(mc, &QObject::destroyed, d, &ActionManagerPrivate::containerDestroyed);
|
||||
@@ -219,10 +219,10 @@ ActionContainer *ActionManager::createMenuBar(Id id)
|
||||
if (it != d->m_idContainerMap.constEnd())
|
||||
return it.value();
|
||||
|
||||
QMenuBar *mb = new QMenuBar; // No parent (System menu bar on Mac OS X)
|
||||
auto mb = new QMenuBar; // No parent (System menu bar on macOS)
|
||||
mb->setObjectName(id.toString());
|
||||
|
||||
MenuBarActionContainer *mbc = new MenuBarActionContainer(id);
|
||||
auto mbc = new MenuBarActionContainer(id);
|
||||
mbc->setMenuBar(mb);
|
||||
|
||||
d->m_idContainerMap.insert(id, mbc);
|
||||
@@ -268,7 +268,7 @@ Command *ActionManager::command(Id id)
|
||||
if (warnAboutFindFailures)
|
||||
qWarning() << "ActionManagerPrivate::command(): failed to find :"
|
||||
<< id.name();
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
return it.value();
|
||||
}
|
||||
@@ -287,7 +287,7 @@ ActionContainer *ActionManager::actionContainer(Id id)
|
||||
if (warnAboutFindFailures)
|
||||
qWarning() << "ActionManagerPrivate::actionContainer(): failed to find :"
|
||||
<< id.name();
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
return it.value();
|
||||
}
|
||||
@@ -415,13 +415,13 @@ bool ActionManagerPrivate::hasContext(const Context &context) const
|
||||
|
||||
void ActionManagerPrivate::containerDestroyed()
|
||||
{
|
||||
ActionContainerPrivate *container = static_cast<ActionContainerPrivate *>(sender());
|
||||
auto container = static_cast<ActionContainerPrivate *>(sender());
|
||||
m_idContainerMap.remove(m_idContainerMap.key(container));
|
||||
}
|
||||
|
||||
void ActionManagerPrivate::actionTriggered()
|
||||
{
|
||||
QAction *action = qobject_cast<QAction *>(QObject::sender());
|
||||
auto action = qobject_cast<QAction *>(QObject::sender());
|
||||
if (action)
|
||||
showShortcutPopup(action->shortcut().toString());
|
||||
}
|
||||
|
@@ -46,8 +46,8 @@ class ActionManagerPrivate : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
typedef QHash<Id, Action *> IdCmdMap;
|
||||
typedef QHash<Id, ActionContainerPrivate *> IdContainerMap;
|
||||
using IdCmdMap = QHash<Id, Action *>;
|
||||
using IdContainerMap = QHash<Id, ActionContainerPrivate *>;
|
||||
|
||||
~ActionManagerPrivate() override;
|
||||
|
||||
|
@@ -200,12 +200,9 @@ namespace Internal {
|
||||
\internal
|
||||
*/
|
||||
Action::Action(Id id)
|
||||
: m_attributes(0),
|
||||
: m_attributes({}),
|
||||
m_id(id),
|
||||
m_isKeyInitialized(false),
|
||||
m_action(new Utils::ProxyAction(this)),
|
||||
m_active(false),
|
||||
m_contextInitialized(false)
|
||||
m_action(new Utils::ProxyAction(this))
|
||||
{
|
||||
m_action->setShortcutVisibleInToolTip(true);
|
||||
connect(m_action, &QAction::changed, this, &Action::updateActiveState);
|
||||
@@ -276,9 +273,9 @@ void Action::setCurrentContext(const Context &context)
|
||||
{
|
||||
m_context = context;
|
||||
|
||||
QAction *currentAction = 0;
|
||||
QAction *currentAction = nullptr;
|
||||
for (int i = 0; i < m_context.size(); ++i) {
|
||||
if (QAction *a = m_contextActionMap.value(m_context.at(i), 0)) {
|
||||
if (QAction *a = m_contextActionMap.value(m_context.at(i), nullptr)) {
|
||||
currentAction = a;
|
||||
break;
|
||||
}
|
||||
@@ -319,7 +316,7 @@ void Action::addOverrideAction(QAction *action, const Context &context, bool scr
|
||||
for (int i = 0; i < context.size(); ++i) {
|
||||
Id id = context.at(i);
|
||||
if (m_contextActionMap.contains(id))
|
||||
qWarning("%s", qPrintable(msgActionWarning(action, id, m_contextActionMap.value(id, 0))));
|
||||
qWarning("%s", qPrintable(msgActionWarning(action, id, m_contextActionMap.value(id, nullptr))));
|
||||
m_contextActionMap.insert(id, action);
|
||||
}
|
||||
}
|
||||
@@ -332,7 +329,7 @@ void Action::removeOverrideAction(QAction *action)
|
||||
QMutableMapIterator<Id, QPointer<QAction> > it(m_contextActionMap);
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
if (it.value() == 0)
|
||||
if (it.value() == nullptr)
|
||||
it.remove();
|
||||
else if (it.value() == action)
|
||||
it.remove();
|
||||
@@ -369,7 +366,7 @@ bool Action::isScriptable(const Context &context) const
|
||||
return m_scriptableMap.value(m_action->action());
|
||||
|
||||
for (int i = 0; i < context.size(); ++i) {
|
||||
if (QAction *a = m_contextActionMap.value(context.at(i), 0)) {
|
||||
if (QAction *a = m_contextActionMap.value(context.at(i), nullptr)) {
|
||||
if (m_scriptableMap.contains(a) && m_scriptableMap.value(a))
|
||||
return true;
|
||||
}
|
||||
@@ -433,7 +430,7 @@ void Command::augmentActionWithShortcutToolTip(QAction *a) const
|
||||
|
||||
QToolButton *Command::toolButtonWithAppendedShortcut(QAction *action, Command *cmd)
|
||||
{
|
||||
QToolButton *button = new QToolButton;
|
||||
auto button = new QToolButton;
|
||||
button->setDefaultAction(action);
|
||||
if (cmd)
|
||||
cmd->augmentActionWithShortcutToolTip(action);
|
||||
|
@@ -86,15 +86,15 @@ private:
|
||||
Id m_id;
|
||||
QKeySequence m_defaultKey;
|
||||
QString m_defaultText;
|
||||
bool m_isKeyInitialized;
|
||||
bool m_isKeyInitialized = false;
|
||||
|
||||
Utils::ProxyAction *m_action;
|
||||
Utils::ProxyAction *m_action = nullptr;
|
||||
QString m_toolTip;
|
||||
|
||||
QMap<Id, QPointer<QAction> > m_contextActionMap;
|
||||
QMap<QAction*, bool> m_scriptableMap;
|
||||
bool m_active;
|
||||
bool m_contextInitialized;
|
||||
bool m_active = false;
|
||||
bool m_contextInitialized = false;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -44,13 +44,13 @@ using namespace Core;
|
||||
|
||||
CommandButton::CommandButton(QWidget *parent)
|
||||
: QToolButton(parent)
|
||||
, m_command(0)
|
||||
, m_command(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
CommandButton::CommandButton(Id id, QWidget *parent)
|
||||
: QToolButton(parent)
|
||||
, m_command(0)
|
||||
, m_command(nullptr)
|
||||
{
|
||||
setCommandId(id);
|
||||
}
|
||||
|
@@ -77,21 +77,21 @@ public:
|
||||
importButton = new QPushButton(CommandMappings::tr("Import..."), groupBox);
|
||||
exportButton = new QPushButton(CommandMappings::tr("Export..."), groupBox);
|
||||
|
||||
QHBoxLayout *hboxLayout1 = new QHBoxLayout();
|
||||
auto hboxLayout1 = new QHBoxLayout();
|
||||
hboxLayout1->addWidget(defaultButton);
|
||||
hboxLayout1->addStretch();
|
||||
hboxLayout1->addWidget(importButton);
|
||||
hboxLayout1->addWidget(exportButton);
|
||||
|
||||
QHBoxLayout *hboxLayout = new QHBoxLayout();
|
||||
auto hboxLayout = new QHBoxLayout();
|
||||
hboxLayout->addWidget(filterEdit);
|
||||
|
||||
QVBoxLayout *vboxLayout1 = new QVBoxLayout(groupBox);
|
||||
auto vboxLayout1 = new QVBoxLayout(groupBox);
|
||||
vboxLayout1->addLayout(hboxLayout);
|
||||
vboxLayout1->addWidget(commandList);
|
||||
vboxLayout1->addLayout(hboxLayout1);
|
||||
|
||||
QVBoxLayout *vboxLayout = new QVBoxLayout(parent);
|
||||
auto vboxLayout = new QVBoxLayout(parent);
|
||||
vboxLayout->addWidget(groupBox);
|
||||
|
||||
q->connect(exportButton, &QPushButton::clicked,
|
||||
|
@@ -89,7 +89,7 @@ void BaseFileWizard::accept()
|
||||
reject();
|
||||
return;
|
||||
case BaseFileWizardFactory::OverwriteError:
|
||||
QMessageBox::critical(0, tr("Existing files"), errorMessage);
|
||||
QMessageBox::critical(nullptr, tr("Existing files"), errorMessage);
|
||||
reject();
|
||||
return;
|
||||
case BaseFileWizardFactory::OverwriteOk:
|
||||
@@ -132,7 +132,7 @@ void BaseFileWizard::accept()
|
||||
// Post generation handler
|
||||
if (!m_factory->postGenerateFiles(this, m_files, &errorMessage))
|
||||
if (!errorMessage.isEmpty())
|
||||
QMessageBox::critical(0, tr("File Generation Failure"), errorMessage);
|
||||
QMessageBox::critical(nullptr, tr("File Generation Failure"), errorMessage);
|
||||
|
||||
Wizard::accept();
|
||||
}
|
||||
|
@@ -78,7 +78,7 @@ Utils::Wizard *BaseFileWizardFactory::runWizardImpl(const QString &path, QWidget
|
||||
Id platform,
|
||||
const QVariantMap &extraValues)
|
||||
{
|
||||
QTC_ASSERT(!path.isEmpty(), return 0);
|
||||
QTC_ASSERT(!path.isEmpty(), return nullptr);
|
||||
|
||||
// Create dialog and run it. Ensure that the dialog is deleted when
|
||||
// leaving the func, but not before the IFileWizardExtension::process
|
||||
|
@@ -47,7 +47,7 @@ class BaseFileWizard;
|
||||
class CORE_EXPORT WizardDialogParameters
|
||||
{
|
||||
public:
|
||||
typedef QList<QWizardPage *> WizardPageList;
|
||||
using WizardPageList = QList<QWizardPage *>;
|
||||
|
||||
enum DialogParameterEnum {
|
||||
ForceCapitalLetterForFileName = 0x01
|
||||
|
@@ -70,9 +70,6 @@ using namespace Core::Internal;
|
||||
using namespace Utils;
|
||||
|
||||
CorePlugin::CorePlugin()
|
||||
: m_mainWindow(nullptr)
|
||||
, m_editMode(nullptr)
|
||||
, m_locator(nullptr)
|
||||
{
|
||||
qRegisterMetaType<Id>();
|
||||
qRegisterMetaType<Core::Search::TextPosition>();
|
||||
|
@@ -78,9 +78,9 @@ private slots:
|
||||
private:
|
||||
static void addToPathChooserContextMenu(Utils::PathChooser *pathChooser, QMenu *menu);
|
||||
|
||||
MainWindow *m_mainWindow;
|
||||
EditMode *m_editMode;
|
||||
Locator *m_locator;
|
||||
MainWindow *m_mainWindow = nullptr;
|
||||
EditMode *m_editMode = nullptr;
|
||||
Locator *m_locator = nullptr;
|
||||
ReaperPrivate m_reaper;
|
||||
};
|
||||
|
||||
|
@@ -80,7 +80,7 @@ static DesignModePrivate *d = nullptr;
|
||||
DesignMode::DesignMode()
|
||||
{
|
||||
ICore::addPreCloseListener([]() -> bool {
|
||||
m_instance->currentEditorChanged(0);
|
||||
m_instance->currentEditorChanged(nullptr);
|
||||
return true;
|
||||
});
|
||||
|
||||
@@ -130,7 +130,7 @@ void DesignMode::registerDesignWidget(QWidget *widget,
|
||||
setDesignModeIsRequired();
|
||||
int index = d->m_stackWidget->addWidget(widget);
|
||||
|
||||
DesignEditorInfo *info = new DesignEditorInfo;
|
||||
auto info = new DesignEditorInfo;
|
||||
info->mimeTypes = mimeTypes;
|
||||
info->context = context;
|
||||
info->widgetIndex = index;
|
||||
@@ -184,7 +184,7 @@ void DesignMode::currentEditorChanged(IEditor *editor)
|
||||
if (ModeManager::currentMode() == id())
|
||||
ModeManager::activateMode(Constants::MODE_EDIT);
|
||||
setEnabled(false);
|
||||
d->m_currentEditor = 0;
|
||||
d->m_currentEditor = nullptr;
|
||||
emit actionsUpdated(d->m_currentEditor.data());
|
||||
} else {
|
||||
d->m_currentEditor = editor;
|
||||
|
@@ -121,14 +121,14 @@ QVariant ExternalToolModel::data(const QString &category, int role) const
|
||||
QMimeData *ExternalToolModel::mimeData(const QModelIndexList &indexes) const
|
||||
{
|
||||
if (indexes.isEmpty())
|
||||
return 0;
|
||||
return nullptr;
|
||||
QModelIndex modelIndex = indexes.first();
|
||||
ExternalTool *tool = toolForIndex(modelIndex);
|
||||
QTC_ASSERT(tool, return 0);
|
||||
QTC_ASSERT(tool, return nullptr);
|
||||
bool found;
|
||||
QString category = categoryForIndex(modelIndex.parent(), &found);
|
||||
QTC_ASSERT(found, return 0);
|
||||
QMimeData *md = new QMimeData();
|
||||
QTC_ASSERT(found, return nullptr);
|
||||
auto md = new QMimeData();
|
||||
QByteArray ba;
|
||||
QDataStream stream(&ba, QIODevice::WriteOnly);
|
||||
stream << category << m_tools.value(category).indexOf(tool);
|
||||
@@ -230,7 +230,7 @@ Qt::ItemFlags ExternalToolModel::flags(const QModelIndex &index) const
|
||||
return TOOLSMENU_ITEM_FLAGS;
|
||||
return CATEGORY_ITEM_FLAGS;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool ExternalToolModel::setData(const QModelIndex &modelIndex, const QVariant &value, int role)
|
||||
@@ -342,7 +342,7 @@ QModelIndex ExternalToolModel::addTool(const QModelIndex &atIndex)
|
||||
if (!found)
|
||||
category = categoryForIndex(atIndex.parent(), &found);
|
||||
|
||||
ExternalTool *tool = new ExternalTool;
|
||||
auto tool = new ExternalTool;
|
||||
tool->setDisplayCategory(category);
|
||||
tool->setDisplayName(tr("New Tool"));
|
||||
tool->setDescription(tr("This tool prints a line of useful text"));
|
||||
@@ -440,7 +440,7 @@ ExternalToolConfig::ExternalToolConfig(QWidget *parent) :
|
||||
connect(ui->revertButton, &QAbstractButton::clicked, this, &ExternalToolConfig::revertCurrentItem);
|
||||
connect(ui->removeButton, &QAbstractButton::clicked, this, &ExternalToolConfig::removeTool);
|
||||
|
||||
QMenu *menu = new QMenu(ui->addButton);
|
||||
auto menu = new QMenu(ui->addButton);
|
||||
ui->addButton->setMenu(menu);
|
||||
QAction *addTool = new QAction(tr("Add Tool"), this);
|
||||
menu->addAction(addTool);
|
||||
|
@@ -46,7 +46,7 @@ class ExternalToolModel : public QAbstractItemModel
|
||||
|
||||
public:
|
||||
explicit ExternalToolModel(QObject *parent);
|
||||
~ExternalToolModel();
|
||||
~ExternalToolModel() override;
|
||||
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex &modelIndex, int role = Qt::DisplayRole) const override;
|
||||
@@ -86,8 +86,8 @@ class ExternalToolConfig : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ExternalToolConfig(QWidget *parent = 0);
|
||||
~ExternalToolConfig();
|
||||
explicit ExternalToolConfig(QWidget *parent = nullptr);
|
||||
~ExternalToolConfig() override;
|
||||
|
||||
void setTools(const QMap<QString, QList<ExternalTool *> > &tools);
|
||||
QMap<QString, QList<ExternalTool *> > tools() const;
|
||||
|
@@ -169,7 +169,7 @@ const QList<Core::IOptionsPage *> Core::IOptionsPage::allOptionsPages()
|
||||
bool Core::IOptionsPage::matches(const QString &searchKeyWord) const
|
||||
{
|
||||
if (!m_keywordsInitialized) {
|
||||
IOptionsPage *that = const_cast<IOptionsPage *>(this);
|
||||
auto that = const_cast<IOptionsPage *>(this);
|
||||
QWidget *widget = that->widget();
|
||||
if (!widget)
|
||||
return false;
|
||||
|
@@ -61,10 +61,10 @@ using namespace Core::Internal;
|
||||
class WizardFactoryContainer
|
||||
{
|
||||
public:
|
||||
WizardFactoryContainer() : wizard(nullptr), wizardOption(0) {}
|
||||
WizardFactoryContainer() = default;
|
||||
WizardFactoryContainer(Core::IWizardFactory *w, int i): wizard(w), wizardOption(i) {}
|
||||
Core::IWizardFactory *wizard;
|
||||
int wizardOption;
|
||||
Core::IWizardFactory *wizard = nullptr;
|
||||
int wizardOption = 0;
|
||||
};
|
||||
|
||||
inline Core::IWizardFactory *factoryOfItem(const QStandardItem *item = nullptr)
|
||||
@@ -175,8 +175,7 @@ QWidget *NewDialog::m_currentDialog = nullptr;
|
||||
|
||||
NewDialog::NewDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
m_ui(new Ui::NewDialog),
|
||||
m_okButton(nullptr)
|
||||
m_ui(new Ui::NewDialog)
|
||||
{
|
||||
QTC_CHECK(m_currentDialog == nullptr);
|
||||
|
||||
@@ -257,10 +256,10 @@ void NewDialog::setWizardFactories(QList<IWizardFactory *> factories,
|
||||
|
||||
QStandardItem *projectKindItem = new QStandardItem(tr("Projects"));
|
||||
projectKindItem->setData(IWizardFactory::ProjectWizard, Qt::UserRole);
|
||||
projectKindItem->setFlags(0); // disable item to prevent focus
|
||||
projectKindItem->setFlags(nullptr); // disable item to prevent focus
|
||||
QStandardItem *filesKindItem = new QStandardItem(tr("Files and Classes"));
|
||||
filesKindItem->setData(IWizardFactory::FileWizard, Qt::UserRole);
|
||||
filesKindItem->setFlags(0); // disable item to prevent focus
|
||||
filesKindItem->setFlags(nullptr); // disable item to prevent focus
|
||||
|
||||
parentItem->appendRow(projectKindItem);
|
||||
parentItem->appendRow(filesKindItem);
|
||||
@@ -355,7 +354,7 @@ QWidget *NewDialog::currentDialog()
|
||||
bool NewDialog::event(QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::ShortcutOverride) {
|
||||
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
|
||||
auto ke = static_cast<QKeyEvent *>(event);
|
||||
if (ke->key() == Qt::Key_Escape && !ke->modifiers()) {
|
||||
ke->accept();
|
||||
return true;
|
||||
@@ -518,7 +517,7 @@ void NewDialog::reject()
|
||||
|
||||
void NewDialog::updateOkButton()
|
||||
{
|
||||
m_okButton->setEnabled(currentWizardFactory() != 0);
|
||||
m_okButton->setEnabled(currentWizardFactory() != nullptr);
|
||||
}
|
||||
|
||||
void NewDialog::setSelectedPlatform(const QString & /*platform*/)
|
||||
|
@@ -82,7 +82,7 @@ private:
|
||||
Ui::NewDialog *m_ui;
|
||||
QStandardItemModel *m_model;
|
||||
QSortFilterProxyModel *m_filterProxyModel;
|
||||
QPushButton *m_okButton;
|
||||
QPushButton *m_okButton = nullptr;
|
||||
QIcon m_dummyIcon;
|
||||
QList<QStandardItem*> m_categoryItems;
|
||||
QString m_defaultLocation;
|
||||
|
@@ -63,7 +63,7 @@ PromptOverwriteDialog::PromptOverwriteDialog(QWidget *parent) :
|
||||
setWindowTitle(tr("Overwrite Existing Files"));
|
||||
setModal(true);
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
QVBoxLayout *mainLayout = new QVBoxLayout(this);
|
||||
auto mainLayout = new QVBoxLayout(this);
|
||||
mainLayout->addWidget(m_label);
|
||||
m_view->setRootIsDecorated(false);
|
||||
m_view->setUniformRowHeights(true);
|
||||
@@ -105,7 +105,7 @@ QStandardItem *PromptOverwriteDialog::itemForFile(const QString &f) const
|
||||
if (fileNameOfItem(item) == f)
|
||||
return item;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QStringList PromptOverwriteDialog::files(Qt::CheckState cs) const
|
||||
|
@@ -53,7 +53,7 @@ class ReadOnlyFilesDialogPrivate
|
||||
Q_DECLARE_TR_FUNCTIONS(Core::ReadOnlyFilesDialog)
|
||||
|
||||
public:
|
||||
ReadOnlyFilesDialogPrivate(ReadOnlyFilesDialog *parent, IDocument *document = 0, bool useSaveAs = false);
|
||||
ReadOnlyFilesDialogPrivate(ReadOnlyFilesDialog *parent, IDocument *document = nullptr, bool useSaveAs = false);
|
||||
~ReadOnlyFilesDialogPrivate();
|
||||
|
||||
enum ReadOnlyFilesTreeColumn {
|
||||
@@ -324,7 +324,7 @@ QRadioButton *ReadOnlyFilesDialogPrivate::createRadioButtonForItem(QTreeWidgetIt
|
||||
ReadOnlyFilesTreeColumn type)
|
||||
|
||||
{
|
||||
QRadioButton *radioButton = new QRadioButton(q);
|
||||
auto radioButton = new QRadioButton(q);
|
||||
group->addButton(radioButton, type);
|
||||
item->setTextAlignment(type, Qt::AlignHCenter);
|
||||
ui.treeWidget->setItemWidget(item, type, radioButton);
|
||||
@@ -353,7 +353,7 @@ void ReadOnlyFilesDialogPrivate::setAll(int index)
|
||||
|
||||
// Check for every file if the selected operation is available and change it to the operation.
|
||||
foreach (ReadOnlyFilesDialogPrivate::ButtonGroupForFile groupForFile, buttonGroups) {
|
||||
QRadioButton *radioButton = qobject_cast<QRadioButton*> (groupForFile.group->button(type));
|
||||
auto radioButton = qobject_cast<QRadioButton*> (groupForFile.group->button(type));
|
||||
if (radioButton)
|
||||
radioButton->setChecked(true);
|
||||
}
|
||||
@@ -400,11 +400,11 @@ void ReadOnlyFilesDialogPrivate::initDialog(const QStringList &fileNames)
|
||||
const QString directory = info.absolutePath();
|
||||
|
||||
// Setup a default entry with filename folder and make writable radio button.
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem(ui.treeWidget);
|
||||
auto item = new QTreeWidgetItem(ui.treeWidget);
|
||||
item->setText(FileName, visibleName);
|
||||
item->setIcon(FileName, FileIconProvider::icon(fileName));
|
||||
item->setText(Folder, Utils::FileUtils::shortNativePath(Utils::FileName(QFileInfo(directory))));
|
||||
QButtonGroup *radioButtonGroup = new QButtonGroup;
|
||||
auto radioButtonGroup = new QButtonGroup;
|
||||
|
||||
// Add a button for opening the file with a version control system
|
||||
// if the file is managed by an version control system which allows opening files.
|
||||
@@ -442,7 +442,7 @@ void ReadOnlyFilesDialogPrivate::initDialog(const QStringList &fileNames)
|
||||
if (useSaveAs)
|
||||
createRadioButtonForItem(item, radioButtonGroup, SaveAs);
|
||||
// If the file is managed by a version control system save the vcs for this file.
|
||||
versionControls[fileName] = fileManagedByVCS ? versionControlForFile : 0;
|
||||
versionControls[fileName] = fileManagedByVCS ? versionControlForFile : nullptr;
|
||||
|
||||
// Also save the buttongroup for every file to get the result for each entry.
|
||||
ReadOnlyFilesDialogPrivate::ButtonGroupForFile groupForFile;
|
||||
|
@@ -166,7 +166,7 @@ void SaveItemsDialog::collectFilesToDiff()
|
||||
{
|
||||
m_filesToDiff.clear();
|
||||
foreach (QTreeWidgetItem *item, m_ui.treeWidget->selectedItems()) {
|
||||
if (IDocument *doc = item->data(0, Qt::UserRole).value<IDocument*>())
|
||||
if (auto doc = item->data(0, Qt::UserRole).value<IDocument*>())
|
||||
m_filesToDiff.append(doc->filePath().toString());
|
||||
}
|
||||
reject();
|
||||
|
@@ -101,7 +101,7 @@ class CategoryModel : public QAbstractListModel
|
||||
{
|
||||
public:
|
||||
CategoryModel();
|
||||
~CategoryModel();
|
||||
~CategoryModel() override;
|
||||
|
||||
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
@@ -172,7 +172,7 @@ void CategoryModel::setPages(const QList<IOptionsPage*> &pages,
|
||||
if (!category) {
|
||||
category = new Category;
|
||||
category->id = categoryId;
|
||||
category->tabWidget = 0;
|
||||
category->tabWidget = nullptr;
|
||||
category->index = -1;
|
||||
m_categories.append(category);
|
||||
}
|
||||
@@ -189,7 +189,7 @@ void CategoryModel::setPages(const QList<IOptionsPage*> &pages,
|
||||
if (!category) {
|
||||
category = new Category;
|
||||
category->id = categoryId;
|
||||
category->tabWidget = 0;
|
||||
category->tabWidget = nullptr;
|
||||
category->index = -1;
|
||||
m_categories.append(category);
|
||||
}
|
||||
@@ -233,7 +233,7 @@ Category *CategoryModel::findCategoryById(Id id)
|
||||
return category;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// ----------- Category filter model
|
||||
@@ -245,7 +245,7 @@ Category *CategoryModel::findCategoryById(Id id)
|
||||
class CategoryFilterModel : public QSortFilterProxyModel
|
||||
{
|
||||
public:
|
||||
CategoryFilterModel() {}
|
||||
CategoryFilterModel() = default;
|
||||
|
||||
protected:
|
||||
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
|
||||
@@ -284,7 +284,7 @@ class CategoryListViewDelegate : public QStyledItemDelegate
|
||||
public:
|
||||
explicit CategoryListViewDelegate(QObject *parent) : QStyledItemDelegate(parent) {}
|
||||
|
||||
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override
|
||||
{
|
||||
QSize size = QStyledItemDelegate::sizeHint(option, index);
|
||||
size.setHeight(qMax(size.height(), 32));
|
||||
@@ -540,7 +540,7 @@ void SettingsDialog::createGui()
|
||||
headerLabelFont.setPointSize(pointSize + 2);
|
||||
m_headerLabel->setFont(headerLabelFont);
|
||||
|
||||
QHBoxLayout *headerHLayout = new QHBoxLayout;
|
||||
auto headerHLayout = new QHBoxLayout;
|
||||
const int leftMargin = QApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin);
|
||||
headerHLayout->addSpacerItem(new QSpacerItem(leftMargin, 0, QSizePolicy::Fixed, QSizePolicy::Ignored));
|
||||
headerHLayout->addWidget(m_headerLabel);
|
||||
@@ -559,7 +559,7 @@ void SettingsDialog::createGui()
|
||||
connect(buttonBox, &QDialogButtonBox::accepted, this, &SettingsDialog::accept);
|
||||
connect(buttonBox, &QDialogButtonBox::rejected, this, &SettingsDialog::reject);
|
||||
|
||||
QGridLayout *mainGridLayout = new QGridLayout;
|
||||
auto mainGridLayout = new QGridLayout;
|
||||
mainGridLayout->addWidget(m_filterLineEdit, 0, 0, 1, 1);
|
||||
mainGridLayout->addLayout(headerHLayout, 0, 1, 1, 1);
|
||||
mainGridLayout->addWidget(m_categoryList, 1, 0, 1, 1);
|
||||
@@ -598,12 +598,12 @@ void SettingsDialog::ensureCategoryWidget(Category *category)
|
||||
return;
|
||||
|
||||
m_model.ensurePages(category);
|
||||
QTabWidget *tabWidget = new QTabWidget;
|
||||
auto tabWidget = new QTabWidget;
|
||||
tabWidget->tabBar()->setObjectName("qc_settings_main_tabbar"); // easier lookup in Squish
|
||||
for (IOptionsPage *page : category->pages) {
|
||||
QWidget *widget = page->widget();
|
||||
ICore::setupScreenShooter(page->displayName(), widget);
|
||||
SmartScrollArea *ssa = new SmartScrollArea(this);
|
||||
auto ssa = new SmartScrollArea(this);
|
||||
ssa->setWidget(widget);
|
||||
widget->setAutoFillBackground(false);
|
||||
tabWidget->addTab(ssa, page->displayName());
|
||||
|
@@ -125,7 +125,7 @@ QSize ShortcutButton::sizeHint() const
|
||||
{
|
||||
if (m_preferredWidth < 0) { // initialize size hint
|
||||
const QString originalText = text();
|
||||
ShortcutButton *that = const_cast<ShortcutButton *>(this);
|
||||
auto that = const_cast<ShortcutButton *>(this);
|
||||
that->setText(m_checkedText);
|
||||
m_preferredWidth = QPushButton::sizeHint().width();
|
||||
that->setText(m_uncheckedText);
|
||||
@@ -153,7 +153,7 @@ bool ShortcutButton::eventFilter(QObject *obj, QEvent *evt)
|
||||
return true;
|
||||
}
|
||||
if (evt->type() == QEvent::KeyPress) {
|
||||
QKeyEvent *k = static_cast<QKeyEvent*>(evt);
|
||||
auto k = static_cast<QKeyEvent*>(evt);
|
||||
int nextKey = k->key();
|
||||
if (m_keyNum > 3
|
||||
|| nextKey == Qt::Key_Control
|
||||
@@ -486,8 +486,8 @@ void ShortcutSettingsWidget::initialize()
|
||||
if (c->action() && c->action()->isSeparator())
|
||||
continue;
|
||||
|
||||
QTreeWidgetItem *item = 0;
|
||||
ShortcutItem *s = new ShortcutItem;
|
||||
QTreeWidgetItem *item = nullptr;
|
||||
auto s = new ShortcutItem;
|
||||
m_scitems << s;
|
||||
item = new QTreeWidgetItem;
|
||||
s->m_cmd = c;
|
||||
|
@@ -436,7 +436,7 @@ void DocumentManager::renamedFile(const QString &from, const QString &to)
|
||||
|
||||
void DocumentManager::filePathChanged(const FileName &oldName, const FileName &newName)
|
||||
{
|
||||
IDocument *doc = qobject_cast<IDocument *>(sender());
|
||||
auto doc = qobject_cast<IDocument *>(sender());
|
||||
QTC_ASSERT(doc, return);
|
||||
if (doc == d->m_blockedIDocument)
|
||||
return;
|
||||
@@ -456,7 +456,7 @@ void DocumentManager::addDocument(IDocument *document, bool addWatcher)
|
||||
|
||||
void DocumentManager::documentDestroyed(QObject *obj)
|
||||
{
|
||||
IDocument *document = static_cast<IDocument*>(obj);
|
||||
auto document = static_cast<IDocument*>(obj);
|
||||
// Check the special unwatched first:
|
||||
if (!d->m_documentsWithoutWatch.removeOne(document))
|
||||
removeFileInfo(document);
|
||||
@@ -487,7 +487,7 @@ bool DocumentManager::removeDocument(IDocument *document)
|
||||
because the file was saved under different name. */
|
||||
void DocumentManager::checkForNewFileName()
|
||||
{
|
||||
IDocument *document = qobject_cast<IDocument *>(sender());
|
||||
auto document = qobject_cast<IDocument *>(sender());
|
||||
// We modified the IDocument
|
||||
// Trust the other code to also update the m_states map
|
||||
if (document == d->m_blockedIDocument)
|
||||
@@ -720,7 +720,7 @@ bool DocumentManager::saveDocument(IDocument *document, const QString &fileName,
|
||||
return ret;
|
||||
}
|
||||
|
||||
QString DocumentManager::allDocumentFactoryFiltersString(QString *allFilesFilter = 0)
|
||||
QString DocumentManager::allDocumentFactoryFiltersString(QString *allFilesFilter = nullptr)
|
||||
{
|
||||
QSet<QString> uniqueFilters;
|
||||
|
||||
|
@@ -54,7 +54,7 @@ public:
|
||||
KeepLinks
|
||||
};
|
||||
|
||||
typedef QPair<QString, Id> RecentFile;
|
||||
using RecentFile = QPair<QString, Id>;
|
||||
|
||||
static DocumentManager *instance();
|
||||
|
||||
|
@@ -61,13 +61,13 @@ EditMode::EditMode() :
|
||||
auto editorPlaceHolder = new EditorManagerPlaceHolder;
|
||||
m_rightSplitWidgetLayout->insertWidget(0, editorPlaceHolder);
|
||||
|
||||
MiniSplitter *rightPaneSplitter = new MiniSplitter;
|
||||
auto rightPaneSplitter = new MiniSplitter;
|
||||
rightPaneSplitter->insertWidget(0, rightSplitWidget);
|
||||
rightPaneSplitter->insertWidget(1, new RightPanePlaceHolder(Constants::MODE_EDIT));
|
||||
rightPaneSplitter->setStretchFactor(0, 1);
|
||||
rightPaneSplitter->setStretchFactor(1, 0);
|
||||
|
||||
MiniSplitter *splitter = new MiniSplitter;
|
||||
auto splitter = new MiniSplitter;
|
||||
splitter->setOrientation(Qt::Vertical);
|
||||
splitter->insertWidget(0, rightPaneSplitter);
|
||||
QWidget *outputPane = new OutputPanePlaceHolder(Constants::MODE_EDIT, splitter);
|
||||
@@ -87,7 +87,7 @@ EditMode::EditMode() :
|
||||
this, &EditMode::grabEditorManager);
|
||||
m_splitter->setFocusProxy(editorPlaceHolder);
|
||||
|
||||
IContext *modeContextObject = new IContext(this);
|
||||
auto modeContextObject = new IContext(this);
|
||||
modeContextObject->setContext(Context(Constants::C_EDITORMANAGER));
|
||||
modeContextObject->setWidget(m_splitter);
|
||||
ICore::addContextObject(modeContextObject);
|
||||
|
@@ -44,7 +44,7 @@ class EditMode : public IMode
|
||||
|
||||
public:
|
||||
EditMode();
|
||||
~EditMode();
|
||||
~EditMode() override;
|
||||
|
||||
private:
|
||||
void grabEditorManager(Id mode);
|
||||
|
@@ -295,7 +295,7 @@ QVariant DocumentModelPrivate::data(const QModelIndex &index, int role) const
|
||||
|
||||
void DocumentModelPrivate::itemChanged()
|
||||
{
|
||||
IDocument *document = qobject_cast<IDocument *>(sender());
|
||||
auto document = qobject_cast<IDocument *>(sender());
|
||||
|
||||
const Utils::optional<int> idx = indexOfDocument(document);
|
||||
if (!idx)
|
||||
@@ -439,7 +439,7 @@ void DocumentModelPrivate::DynamicEntry::setNumberedName(int number)
|
||||
} // Internal
|
||||
|
||||
DocumentModel::Entry::Entry() :
|
||||
document(0),
|
||||
document(nullptr),
|
||||
isSuspended(false)
|
||||
{
|
||||
}
|
||||
@@ -450,9 +450,7 @@ DocumentModel::Entry::~Entry()
|
||||
delete document;
|
||||
}
|
||||
|
||||
DocumentModel::DocumentModel()
|
||||
{
|
||||
}
|
||||
DocumentModel::DocumentModel() = default;
|
||||
|
||||
void DocumentModel::init()
|
||||
{
|
||||
@@ -561,7 +559,7 @@ DocumentModel::Entry *DocumentModel::entryAtRow(int row)
|
||||
{
|
||||
int entryIndex = row - 1/*<no document>*/;
|
||||
if (entryIndex < 0)
|
||||
return 0;
|
||||
return nullptr;
|
||||
return d->m_entries[entryIndex];
|
||||
}
|
||||
|
||||
|
@@ -42,7 +42,7 @@ class DocumentModelPrivate : public QAbstractItemModel
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
~DocumentModelPrivate();
|
||||
~DocumentModelPrivate() override;
|
||||
|
||||
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||
|
@@ -665,9 +665,9 @@ IEditor *EditorManagerPrivate::openEditor(EditorView *view, const QString &fileN
|
||||
|
||||
IEditorFactory *selectedFactory = nullptr;
|
||||
if (!factories.isEmpty()) {
|
||||
QPushButton *button = qobject_cast<QPushButton *>(msgbox.button(QMessageBox::Open));
|
||||
auto button = qobject_cast<QPushButton *>(msgbox.button(QMessageBox::Open));
|
||||
QTC_ASSERT(button, return nullptr);
|
||||
QMenu *menu = new QMenu(button);
|
||||
auto menu = new QMenu(button);
|
||||
foreach (IEditorFactory *factory, factories) {
|
||||
QAction *action = menu->addAction(factory->displayName());
|
||||
connect(action, &QAction::triggered, &msgbox, [&selectedFactory, factory, &msgbox]() {
|
||||
@@ -785,7 +785,7 @@ EditorView *EditorManagerPrivate::viewForEditor(IEditor *editor)
|
||||
QWidget *w = editor->widget();
|
||||
while (w) {
|
||||
w = w->parentWidget();
|
||||
if (EditorView *view = qobject_cast<EditorView *>(w))
|
||||
if (auto view = qobject_cast<EditorView *>(w))
|
||||
return view;
|
||||
}
|
||||
return nullptr;
|
||||
@@ -1566,7 +1566,7 @@ EditorArea *EditorManagerPrivate::findEditorArea(const EditorView *view, int *ar
|
||||
{
|
||||
SplitterOrView *current = view->parentSplitterOrView();
|
||||
while (current) {
|
||||
if (EditorArea *area = qobject_cast<EditorArea *>(current)) {
|
||||
if (auto area = qobject_cast<EditorArea *>(current)) {
|
||||
int index = d->m_editorAreas.indexOf(area);
|
||||
QTC_ASSERT(index >= 0, return nullptr);
|
||||
if (areaIndex)
|
||||
@@ -1980,7 +1980,7 @@ void EditorManagerPrivate::vcsOpenCurrentEditor()
|
||||
void EditorManagerPrivate::handleDocumentStateChange()
|
||||
{
|
||||
updateActions();
|
||||
IDocument *document = qobject_cast<IDocument *>(sender());
|
||||
auto document = qobject_cast<IDocument *>(sender());
|
||||
if (!document->isModified())
|
||||
document->removeAutoSaveFile();
|
||||
if (EditorManager::currentDocument() == document)
|
||||
@@ -2082,7 +2082,7 @@ void EditorManagerPrivate::copyFilePathFromContextMenu()
|
||||
|
||||
void EditorManagerPrivate::copyLocationFromContextMenu()
|
||||
{
|
||||
const QAction *action = qobject_cast<const QAction *>(sender());
|
||||
const auto action = qobject_cast<const QAction *>(sender());
|
||||
if (!d->m_contextMenuEntry || !action)
|
||||
return;
|
||||
const QString text = d->m_contextMenuEntry->fileName().toUserOutput()
|
||||
@@ -2501,8 +2501,8 @@ void EditorManager::addNativeDirAndOpenWithActions(QMenu *contextMenu, DocumentM
|
||||
|
||||
void EditorManager::populateOpenWithMenu(QMenu *menu, const QString &fileName)
|
||||
{
|
||||
typedef QList<IEditorFactory*> EditorFactoryList;
|
||||
typedef QList<IExternalEditor*> ExternalEditorList;
|
||||
using EditorFactoryList = QList<IEditorFactory*>;
|
||||
using ExternalEditorList = QList<IExternalEditor*>;
|
||||
|
||||
menu->clear();
|
||||
|
||||
|
@@ -75,7 +75,7 @@ class CORE_EXPORT EditorManager : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
typedef std::function<QString (const QString &)> WindowTitleHandler;
|
||||
using WindowTitleHandler = std::function<QString (const QString &)>;
|
||||
|
||||
static EditorManager *instance();
|
||||
|
||||
|
@@ -68,10 +68,9 @@ EditorView::EditorView(SplitterOrView *parentSplitterOrView, QWidget *parent) :
|
||||
m_container(new QStackedWidget(this)),
|
||||
m_infoBarDisplay(new InfoBarDisplay(this)),
|
||||
m_statusHLine(new QFrame(this)),
|
||||
m_statusWidget(new QFrame(this)),
|
||||
m_currentNavigationHistoryPosition(0)
|
||||
m_statusWidget(new QFrame(this))
|
||||
{
|
||||
QVBoxLayout *tl = new QVBoxLayout(this);
|
||||
auto tl = new QVBoxLayout(this);
|
||||
tl->setSpacing(0);
|
||||
tl->setMargin(0);
|
||||
{
|
||||
@@ -106,7 +105,7 @@ EditorView::EditorView(SplitterOrView *parentSplitterOrView, QWidget *parent) :
|
||||
m_statusWidget->setLineWidth(0);
|
||||
m_statusWidget->setAutoFillBackground(true);
|
||||
|
||||
QHBoxLayout *hbox = new QHBoxLayout(m_statusWidget);
|
||||
auto hbox = new QHBoxLayout(m_statusWidget);
|
||||
hbox->setContentsMargins(1, 0, 1, 1);
|
||||
m_statusWidgetLabel = new QLabel;
|
||||
m_statusWidgetLabel->setContentsMargins(3, 0, 3, 0);
|
||||
@@ -153,9 +152,7 @@ EditorView::EditorView(SplitterOrView *parentSplitterOrView, QWidget *parent) :
|
||||
updateNavigatorActions();
|
||||
}
|
||||
|
||||
EditorView::~EditorView()
|
||||
{
|
||||
}
|
||||
EditorView::~EditorView() = default;
|
||||
|
||||
SplitterOrView *EditorView::parentSplitterOrView() const
|
||||
{
|
||||
@@ -173,7 +170,7 @@ EditorView *EditorView::findNextView()
|
||||
QTC_ASSERT(splitter->count() == 2, return nullptr);
|
||||
// is current the first child? then the next view is the first one in current's sibling
|
||||
if (splitter->widget(0) == current) {
|
||||
SplitterOrView *second = qobject_cast<SplitterOrView *>(splitter->widget(1));
|
||||
auto second = qobject_cast<SplitterOrView *>(splitter->widget(1));
|
||||
QTC_ASSERT(second, return nullptr);
|
||||
return second->findFirstView();
|
||||
}
|
||||
@@ -196,7 +193,7 @@ EditorView *EditorView::findPreviousView()
|
||||
QTC_ASSERT(splitter->count() == 2, return nullptr);
|
||||
// is current the last child? then the previous view is the first child in current's sibling
|
||||
if (splitter->widget(1) == current) {
|
||||
SplitterOrView *first = qobject_cast<SplitterOrView *>(splitter->widget(0));
|
||||
auto first = qobject_cast<SplitterOrView *>(splitter->widget(0));
|
||||
QTC_ASSERT(first, return nullptr);
|
||||
return first->findFirstView();
|
||||
}
|
||||
@@ -652,7 +649,7 @@ EditorView *SplitterOrView::findFirstView()
|
||||
{
|
||||
if (m_splitter) {
|
||||
for (int i = 0; i < m_splitter->count(); ++i) {
|
||||
if (SplitterOrView *splitterOrView = qobject_cast<SplitterOrView*>(m_splitter->widget(i)))
|
||||
if (auto splitterOrView = qobject_cast<SplitterOrView*>(m_splitter->widget(i)))
|
||||
if (EditorView *result = splitterOrView->findFirstView())
|
||||
return result;
|
||||
}
|
||||
@@ -665,7 +662,7 @@ EditorView *SplitterOrView::findLastView()
|
||||
{
|
||||
if (m_splitter) {
|
||||
for (int i = m_splitter->count() - 1; 0 < i; --i) {
|
||||
if (SplitterOrView *splitterOrView = qobject_cast<SplitterOrView*>(m_splitter->widget(i)))
|
||||
if (auto splitterOrView = qobject_cast<SplitterOrView*>(m_splitter->widget(i)))
|
||||
if (EditorView *result = splitterOrView->findLastView())
|
||||
return result;
|
||||
}
|
||||
@@ -678,7 +675,7 @@ SplitterOrView *SplitterOrView::findParentSplitter() const
|
||||
{
|
||||
QWidget *w = parentWidget();
|
||||
while (w) {
|
||||
if (SplitterOrView *splitter = qobject_cast<SplitterOrView *>(w)) {
|
||||
if (auto splitter = qobject_cast<SplitterOrView *>(w)) {
|
||||
QTC_CHECK(splitter->splitter());
|
||||
return splitter;
|
||||
}
|
||||
@@ -801,7 +798,7 @@ const QList<IEditor *> SplitterOrView::unsplitAll_helper()
|
||||
QList<IEditor *> editorsToDelete;
|
||||
if (m_splitter) {
|
||||
for (int i = 0; i < m_splitter->count(); ++i) {
|
||||
if (SplitterOrView *splitterOrView = qobject_cast<SplitterOrView*>(m_splitter->widget(i)))
|
||||
if (auto splitterOrView = qobject_cast<SplitterOrView*>(m_splitter->widget(i)))
|
||||
editorsToDelete.append(splitterOrView->unsplitAll_helper());
|
||||
}
|
||||
}
|
||||
@@ -814,7 +811,7 @@ void SplitterOrView::unsplit()
|
||||
return;
|
||||
|
||||
Q_ASSERT(m_splitter->count() == 1);
|
||||
SplitterOrView *childSplitterOrView = qobject_cast<SplitterOrView*>(m_splitter->widget(0));
|
||||
auto childSplitterOrView = qobject_cast<SplitterOrView*>(m_splitter->widget(0));
|
||||
QSplitter *oldSplitter = m_splitter;
|
||||
m_splitter = nullptr;
|
||||
QList<IEditor *> editorsToDelete;
|
||||
@@ -838,7 +835,7 @@ void SplitterOrView::unsplit()
|
||||
m_view = childSplitterOrView->takeView();
|
||||
m_view->setParentSplitterOrView(this);
|
||||
m_layout->addWidget(m_view);
|
||||
QSplitter *parentSplitter = qobject_cast<QSplitter *>(parentWidget());
|
||||
auto parentSplitter = qobject_cast<QSplitter *>(parentWidget());
|
||||
if (parentSplitter) { // not the toplevel splitterOrView
|
||||
if (parentSplitter->orientation() == Qt::Horizontal)
|
||||
m_view->setCloseSplitIcon(parentSplitter->widget(0) == this ?
|
||||
|
@@ -142,7 +142,7 @@ private:
|
||||
|
||||
QList<EditLocation> m_navigationHistory;
|
||||
QList<EditLocation> m_editorHistory;
|
||||
int m_currentNavigationHistoryPosition;
|
||||
int m_currentNavigationHistoryPosition = 0;
|
||||
void updateCurrentPositionInNavigationHistory();
|
||||
|
||||
public:
|
||||
|
@@ -82,7 +82,7 @@ EditorWindow::EditorWindow(QWidget *parent) :
|
||||
EditorWindow::~EditorWindow()
|
||||
{
|
||||
if (m_area)
|
||||
disconnect(m_area, 0, this, 0);
|
||||
disconnect(m_area, nullptr, this, nullptr);
|
||||
}
|
||||
|
||||
EditorArea *EditorWindow::editorArea() const
|
||||
|
@@ -36,8 +36,8 @@ class EditorWindow : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit EditorWindow(QWidget *parent = 0);
|
||||
~EditorWindow();
|
||||
explicit EditorWindow(QWidget *parent = nullptr);
|
||||
~EditorWindow() override;
|
||||
|
||||
EditorArea *editorArea() const;
|
||||
|
||||
|
@@ -65,9 +65,7 @@ OpenEditorsWidget::OpenEditorsWidget()
|
||||
this, &OpenEditorsWidget::contextMenuRequested);
|
||||
}
|
||||
|
||||
OpenEditorsWidget::~OpenEditorsWidget()
|
||||
{
|
||||
}
|
||||
OpenEditorsWidget::~OpenEditorsWidget() = default;
|
||||
|
||||
void OpenEditorsWidget::updateCurrentItem(IEditor *editor)
|
||||
{
|
||||
@@ -93,7 +91,7 @@ void OpenEditorsWidget::handleActivated(const QModelIndex &index)
|
||||
// work around a bug in itemviews where the delegate wouldn't get the QStyle::State_MouseOver
|
||||
QPoint cursorPos = QCursor::pos();
|
||||
QWidget *vp = viewport();
|
||||
QMouseEvent e(QEvent::MouseMove, vp->mapFromGlobal(cursorPos), cursorPos, Qt::NoButton, 0, 0);
|
||||
QMouseEvent e(QEvent::MouseMove, vp->mapFromGlobal(cursorPos), cursorPos, Qt::NoButton, nullptr, nullptr);
|
||||
QCoreApplication::sendEvent(vp, &e);
|
||||
}
|
||||
}
|
||||
|
@@ -39,7 +39,7 @@ class ProxyModel : public QAbstractProxyModel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ProxyModel(QObject *parent = 0);
|
||||
explicit ProxyModel(QObject *parent = nullptr);
|
||||
QModelIndex mapFromSource(const QModelIndex & sourceIndex) const override;
|
||||
QModelIndex mapToSource(const QModelIndex & proxyIndex) const override;
|
||||
|
||||
@@ -69,7 +69,7 @@ class OpenEditorsWidget : public OpenDocumentsTreeView
|
||||
|
||||
public:
|
||||
OpenEditorsWidget();
|
||||
~OpenEditorsWidget();
|
||||
~OpenEditorsWidget() override;
|
||||
|
||||
private:
|
||||
void handleActivated(const QModelIndex &);
|
||||
@@ -88,7 +88,7 @@ class OpenEditorsViewFactory : public INavigationWidgetFactory
|
||||
public:
|
||||
OpenEditorsViewFactory();
|
||||
|
||||
NavigationView createWidget();
|
||||
NavigationView createWidget() override;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -72,7 +72,7 @@ OpenEditorsWindow::OpenEditorsWindow(QWidget *parent) :
|
||||
setFrameStyle(m_editorList->frameStyle());
|
||||
m_editorList->setFrameStyle(QFrame::NoFrame);
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
auto layout = new QVBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
layout->addWidget(m_editorList);
|
||||
|
||||
@@ -97,7 +97,7 @@ bool OpenEditorsWindow::eventFilter(QObject *obj, QEvent *e)
|
||||
{
|
||||
if (obj == m_editorList) {
|
||||
if (e->type() == QEvent::KeyPress) {
|
||||
QKeyEvent *ke = static_cast<QKeyEvent*>(e);
|
||||
auto ke = static_cast<QKeyEvent*>(e);
|
||||
if (ke->key() == Qt::Key_Escape) {
|
||||
setVisible(false);
|
||||
return true;
|
||||
@@ -108,7 +108,7 @@ bool OpenEditorsWindow::eventFilter(QObject *obj, QEvent *e)
|
||||
return true;
|
||||
}
|
||||
} else if (e->type() == QEvent::KeyRelease) {
|
||||
QKeyEvent *ke = static_cast<QKeyEvent*>(e);
|
||||
auto ke = static_cast<QKeyEvent*>(e);
|
||||
if (ke->modifiers() == 0
|
||||
/*HACK this is to overcome some event inconsistencies between platforms*/
|
||||
|| (ke->modifiers() == Qt::AltModifier
|
||||
@@ -133,7 +133,7 @@ void OpenEditorsWindow::selectUpDown(bool up)
|
||||
int index = m_editorList->indexOfTopLevelItem(m_editorList->currentItem());
|
||||
if (index < 0)
|
||||
return;
|
||||
QTreeWidgetItem *editor = 0;
|
||||
QTreeWidgetItem *editor = nullptr;
|
||||
int count = 0;
|
||||
while (!editor && count < itemCount) {
|
||||
if (up) {
|
||||
@@ -245,7 +245,7 @@ void OpenEditorsWindow::addItem(DocumentModel::Entry *entry,
|
||||
entriesDone.insert(entry);
|
||||
QString title = entry->displayName();
|
||||
QTC_ASSERT(!title.isEmpty(), return);
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||
auto item = new QTreeWidgetItem();
|
||||
if (entry->document->isModified())
|
||||
title += tr("*");
|
||||
item->setIcon(0, !entry->fileName().isEmpty() && entry->document->isFileReadOnly()
|
||||
|
@@ -45,9 +45,9 @@ namespace Internal {
|
||||
|
||||
class OpenEditorsTreeWidget : public QTreeWidget {
|
||||
public:
|
||||
explicit OpenEditorsTreeWidget(QWidget *parent = 0) : QTreeWidget(parent) {}
|
||||
~OpenEditorsTreeWidget() {}
|
||||
QSize sizeHint() const;
|
||||
explicit OpenEditorsTreeWidget(QWidget *parent = nullptr) : QTreeWidget(parent) {}
|
||||
~OpenEditorsTreeWidget() override = default;
|
||||
QSize sizeHint() const override;
|
||||
};
|
||||
|
||||
|
||||
@@ -58,16 +58,16 @@ class OpenEditorsWindow : public QFrame
|
||||
public:
|
||||
enum Mode {ListMode, HistoryMode };
|
||||
|
||||
explicit OpenEditorsWindow(QWidget *parent = 0);
|
||||
explicit OpenEditorsWindow(QWidget *parent = nullptr);
|
||||
|
||||
void setEditors(const QList<EditLocation> &globalHistory, EditorView *view);
|
||||
|
||||
bool eventFilter(QObject *src, QEvent *e);
|
||||
void focusInEvent(QFocusEvent *);
|
||||
void setVisible(bool visible);
|
||||
bool eventFilter(QObject *src, QEvent *e) override;
|
||||
void focusInEvent(QFocusEvent*) override;
|
||||
void setVisible(bool visible) override;
|
||||
void selectNextEditor();
|
||||
void selectPreviousEditor();
|
||||
QSize sizeHint() const;
|
||||
QSize sizeHint() const override;
|
||||
|
||||
public slots:
|
||||
void selectAndHide();
|
||||
|
@@ -35,13 +35,13 @@ class SystemEditor : public IExternalEditor
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SystemEditor(QObject *parent = 0);
|
||||
explicit SystemEditor(QObject *parent = nullptr);
|
||||
|
||||
QStringList mimeTypes() const;
|
||||
Id id() const;
|
||||
QString displayName() const;
|
||||
QStringList mimeTypes() const override;
|
||||
Id id() const override;
|
||||
QString displayName() const override;
|
||||
|
||||
bool startEditor(const QString &fileName, QString *errorMessage);
|
||||
bool startEditor(const QString &fileName, QString *errorMessage) override;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -93,7 +93,7 @@ EditorToolBarPrivate::EditorToolBarPrivate(QWidget *parent, EditorToolBar *q) :
|
||||
m_closeEditorButton(new QToolButton(q)),
|
||||
m_lockButton(new QToolButton(q)),
|
||||
m_dragHandle(new QToolButton(q)),
|
||||
m_dragHandleMenu(0),
|
||||
m_dragHandleMenu(nullptr),
|
||||
m_goBackAction(new QAction(Utils::Icons::PREV_TOOLBAR.icon(), EditorManager::tr("Go Back"), parent)),
|
||||
m_goForwardAction(new QAction(Utils::Icons::NEXT_TOOLBAR.icon(), EditorManager::tr("Go Forward"), parent)),
|
||||
m_backButton(new QToolButton(q)),
|
||||
@@ -105,7 +105,7 @@ EditorToolBarPrivate::EditorToolBarPrivate(QWidget *parent, EditorToolBar *q) :
|
||||
EditorManager::tr("Split Side by Side"), parent)),
|
||||
m_splitNewWindowAction(new QAction(EditorManager::tr("Open in New Window"), parent)),
|
||||
m_closeSplitButton(new QToolButton(q)),
|
||||
m_activeToolBar(0),
|
||||
m_activeToolBar(nullptr),
|
||||
m_toolBarPlaceholder(new QWidget(q)),
|
||||
m_defaultToolBar(new QWidget(q)),
|
||||
m_isStandalone(false)
|
||||
@@ -118,7 +118,7 @@ EditorToolBarPrivate::EditorToolBarPrivate(QWidget *parent, EditorToolBar *q) :
|
||||
EditorToolBar::EditorToolBar(QWidget *parent) :
|
||||
Utils::StyledBar(parent), d(new EditorToolBarPrivate(parent, this))
|
||||
{
|
||||
QHBoxLayout *toolBarLayout = new QHBoxLayout(this);
|
||||
auto toolBarLayout = new QHBoxLayout(this);
|
||||
toolBarLayout->setMargin(0);
|
||||
toolBarLayout->setSpacing(0);
|
||||
toolBarLayout->addWidget(d->m_defaultToolBar);
|
||||
@@ -164,7 +164,7 @@ EditorToolBar::EditorToolBar(QWidget *parent) :
|
||||
d->m_splitButton->setToolTip(tr("Split"));
|
||||
d->m_splitButton->setPopupMode(QToolButton::InstantPopup);
|
||||
d->m_splitButton->setProperty("noArrow", true);
|
||||
QMenu *splitMenu = new QMenu(d->m_splitButton);
|
||||
auto splitMenu = new QMenu(d->m_splitButton);
|
||||
splitMenu->addAction(d->m_horizontalSplitAction);
|
||||
splitMenu->addAction(d->m_verticalSplitAction);
|
||||
splitMenu->addAction(d->m_splitNewWindowAction);
|
||||
@@ -173,7 +173,7 @@ EditorToolBar::EditorToolBar(QWidget *parent) :
|
||||
d->m_closeSplitButton->setAutoRaise(true);
|
||||
d->m_closeSplitButton->setIcon(Utils::Icons::CLOSE_SPLIT_BOTTOM.icon());
|
||||
|
||||
QHBoxLayout *toplayout = new QHBoxLayout(this);
|
||||
auto toplayout = new QHBoxLayout(this);
|
||||
toplayout->setSpacing(0);
|
||||
toplayout->setMargin(0);
|
||||
toplayout->addWidget(d->m_backButton);
|
||||
@@ -236,14 +236,14 @@ void EditorToolBar::removeToolbarForEditor(IEditor *editor)
|
||||
disconnect(editor->document(), &IDocument::changed, this, &EditorToolBar::checkDocumentStatus);
|
||||
|
||||
QWidget *toolBar = editor->toolBar();
|
||||
if (toolBar != 0) {
|
||||
if (toolBar != nullptr) {
|
||||
if (d->m_activeToolBar == toolBar) {
|
||||
d->m_activeToolBar = d->m_defaultToolBar;
|
||||
d->m_activeToolBar->setVisible(true);
|
||||
}
|
||||
d->m_toolBarPlaceholder->layout()->removeWidget(toolBar);
|
||||
toolBar->setVisible(false);
|
||||
toolBar->setParent(0);
|
||||
toolBar->setParent(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ void EditorToolBar::setMenuProvider(const EditorToolBar::MenuProvider &provider)
|
||||
|
||||
void EditorToolBar::setCurrentEditor(IEditor *editor)
|
||||
{
|
||||
IDocument *document = editor ? editor->document() : 0;
|
||||
IDocument *document = editor ? editor->document() : nullptr;
|
||||
const Utils::optional<int> index = DocumentModel::rowOfDocument(document);
|
||||
if (QTC_GUARD(index))
|
||||
d->m_editorList->setCurrentIndex(*index);
|
||||
@@ -327,7 +327,7 @@ void EditorToolBar::setCurrentEditor(IEditor *editor)
|
||||
// If we never added the toolbar from the editor, we will never change
|
||||
// the editor, so there's no need to update the toolbar either.
|
||||
if (!d->m_isStandalone)
|
||||
updateToolBar(editor ? editor->toolBar() : 0);
|
||||
updateToolBar(editor ? editor->toolBar() : nullptr);
|
||||
|
||||
updateDocumentStatus(document);
|
||||
}
|
||||
@@ -353,7 +353,7 @@ void EditorToolBar::fillListContextMenu(QMenu *menu)
|
||||
} else {
|
||||
IEditor *editor = EditorManager::currentEditor();
|
||||
DocumentModel::Entry *entry = editor ? DocumentModel::entryForDocument(editor->document())
|
||||
: 0;
|
||||
: nullptr;
|
||||
EditorManager::addSaveAndCloseEditorActions(menu, entry, editor);
|
||||
menu->addSeparator();
|
||||
EditorManager::addNativeDirAndOpenWithActions(menu, entry);
|
||||
@@ -386,7 +386,7 @@ void EditorToolBar::updateActionShortcuts()
|
||||
|
||||
void EditorToolBar::checkDocumentStatus()
|
||||
{
|
||||
IDocument *document = qobject_cast<IDocument *>(sender());
|
||||
auto document = qobject_cast<IDocument *>(sender());
|
||||
QTC_ASSERT(document, return);
|
||||
DocumentModel::Entry *entry = DocumentModel::entryAtRow(
|
||||
d->m_editorList->currentIndex());
|
||||
@@ -397,7 +397,7 @@ void EditorToolBar::checkDocumentStatus()
|
||||
|
||||
void EditorToolBar::updateDocumentStatus(IDocument *document)
|
||||
{
|
||||
d->m_closeEditorButton->setEnabled(document != 0);
|
||||
d->m_closeEditorButton->setEnabled(document != nullptr);
|
||||
|
||||
if (!document) {
|
||||
d->m_lockButton->setIcon(QIcon());
|
||||
|
@@ -53,7 +53,7 @@ public:
|
||||
explicit EditorToolBar(QWidget *parent = nullptr);
|
||||
~EditorToolBar() override;
|
||||
|
||||
typedef std::function<void(QMenu*)> MenuProvider;
|
||||
using MenuProvider = std::function<void(QMenu*)>;
|
||||
enum ToolbarCreationFlags { FlagsNone = 0, FlagsStandalone = 1 };
|
||||
|
||||
/**
|
||||
|
@@ -81,11 +81,7 @@ const char kFalse[] = "false";
|
||||
// #pragma mark -- ExternalTool
|
||||
|
||||
ExternalTool::ExternalTool() :
|
||||
m_displayCategory(QLatin1String("")), // difference between isNull and isEmpty
|
||||
m_order(-1),
|
||||
m_outputHandling(ShowInPane),
|
||||
m_errorHandling(ShowInPane),
|
||||
m_modifiesCurrentDocument(false)
|
||||
m_displayCategory(QLatin1String("")) // difference between isNull and isEmpty
|
||||
{
|
||||
}
|
||||
|
||||
@@ -129,9 +125,7 @@ ExternalTool &ExternalTool::operator=(const ExternalTool &other)
|
||||
return *this;
|
||||
}
|
||||
|
||||
ExternalTool::~ExternalTool()
|
||||
{
|
||||
}
|
||||
ExternalTool::~ExternalTool() = default;
|
||||
|
||||
QString ExternalTool::id() const
|
||||
{
|
||||
@@ -354,7 +348,7 @@ ExternalTool * ExternalTool::createFromXml(const QByteArray &xml, QString *error
|
||||
int nameLocale = -1;
|
||||
int categoryLocale = -1;
|
||||
const QStringList &locales = splitLocale(locale);
|
||||
ExternalTool *tool = new ExternalTool;
|
||||
auto tool = new ExternalTool;
|
||||
QXmlStreamReader reader(xml);
|
||||
|
||||
if (!reader.readNextStartElement() || reader.name() != QLatin1String(kExternalTool))
|
||||
@@ -442,7 +436,7 @@ ExternalTool * ExternalTool::createFromXml(const QByteArray &xml, QString *error
|
||||
if (errorMessage)
|
||||
*errorMessage = reader.errorString();
|
||||
delete tool;
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
return tool;
|
||||
}
|
||||
@@ -452,10 +446,10 @@ ExternalTool * ExternalTool::createFromFile(const QString &fileName, QString *er
|
||||
QString absFileName = QFileInfo(fileName).absoluteFilePath();
|
||||
FileReader reader;
|
||||
if (!reader.fetch(absFileName, errorMessage))
|
||||
return 0;
|
||||
return nullptr;
|
||||
ExternalTool *tool = ExternalTool::createFromXml(reader.data(), errorMessage, locale);
|
||||
if (!tool)
|
||||
return 0;
|
||||
return nullptr;
|
||||
tool->m_fileName = absFileName;
|
||||
return tool;
|
||||
}
|
||||
@@ -541,7 +535,7 @@ bool ExternalTool::operator==(const ExternalTool &other) const
|
||||
|
||||
ExternalToolRunner::ExternalToolRunner(const ExternalTool *tool)
|
||||
: m_tool(new ExternalTool(tool)),
|
||||
m_process(0),
|
||||
m_process(nullptr),
|
||||
m_outputCodec(QTextCodec::codecForLocale()),
|
||||
m_hasError(false)
|
||||
{
|
||||
|
@@ -103,15 +103,15 @@ private:
|
||||
QString m_description;
|
||||
QString m_displayName;
|
||||
QString m_displayCategory;
|
||||
int m_order;
|
||||
int m_order = -1;
|
||||
QStringList m_executables;
|
||||
QString m_arguments;
|
||||
QString m_input;
|
||||
QString m_workingDirectory;
|
||||
QList<Utils::EnvironmentItem> m_environment;
|
||||
OutputHandling m_outputHandling;
|
||||
OutputHandling m_errorHandling;
|
||||
bool m_modifiesCurrentDocument;
|
||||
OutputHandling m_outputHandling = ShowInPane;
|
||||
OutputHandling m_errorHandling = ShowInPane;
|
||||
bool m_modifiesCurrentDocument = false;
|
||||
|
||||
QString m_fileName;
|
||||
QString m_presetFileName;
|
||||
|
@@ -56,8 +56,8 @@ struct ExternalToolManagerPrivate
|
||||
QAction *m_configureAction;
|
||||
};
|
||||
|
||||
static ExternalToolManager *m_instance = 0;
|
||||
static ExternalToolManagerPrivate *d = 0;
|
||||
static ExternalToolManager *m_instance = nullptr;
|
||||
static ExternalToolManagerPrivate *d = nullptr;
|
||||
|
||||
static void writeSettings();
|
||||
static void readSettings(const QMap<QString, ExternalTool *> &tools,
|
||||
@@ -211,7 +211,7 @@ void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<ExternalT
|
||||
it.toFront();
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
ActionContainer *container = 0;
|
||||
ActionContainer *container = nullptr;
|
||||
const QString &containerName = it.key();
|
||||
if (containerName.isEmpty()) { // no displayCategory, so put into external tools menu directly
|
||||
container = mexternaltools;
|
||||
@@ -227,8 +227,8 @@ void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<ExternalT
|
||||
foreach (ExternalTool *tool, it.value()) {
|
||||
const QString &toolId = tool->id();
|
||||
// tool action and command
|
||||
QAction *action = 0;
|
||||
Command *command = 0;
|
||||
QAction *action = nullptr;
|
||||
Command *command = nullptr;
|
||||
if (d->m_actions.contains(toolId)) {
|
||||
action = d->m_actions.value(toolId);
|
||||
command = ActionManager::command(externalToolsPrefix.withSuffix(toolId));
|
||||
@@ -236,7 +236,7 @@ void ExternalToolManager::setToolsByCategory(const QMap<QString, QList<ExternalT
|
||||
action = new QAction(tool->displayName(), m_instance);
|
||||
d->m_actions.insert(toolId, action);
|
||||
connect(action, &QAction::triggered, [tool] {
|
||||
ExternalToolRunner *runner = new ExternalToolRunner(tool);
|
||||
auto runner = new ExternalToolRunner(tool);
|
||||
if (runner->hasError())
|
||||
MessageManager::write(runner->errorString());
|
||||
});
|
||||
|
@@ -111,7 +111,7 @@ void BaseTextFind::setTextCursor(const QTextCursor &cursor)
|
||||
|
||||
QTextDocument *BaseTextFind::document() const
|
||||
{
|
||||
QTC_ASSERT(d->m_editor || d->m_plaineditor, return 0);
|
||||
QTC_ASSERT(d->m_editor || d->m_plaineditor, return nullptr);
|
||||
return d->m_editor ? d->m_editor->document() : d->m_plaineditor->document();
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ void BaseTextFind::resetIncrementalSearch()
|
||||
|
||||
void BaseTextFind::clearHighlights()
|
||||
{
|
||||
highlightAll(QString(), 0);
|
||||
highlightAll(QString(), nullptr);
|
||||
}
|
||||
|
||||
QString BaseTextFind::currentFindString() const
|
||||
@@ -191,7 +191,7 @@ IFindSupport::Result BaseTextFind::findIncremental(const QString &txt, FindFlags
|
||||
if (found)
|
||||
highlightAll(txt, findFlags);
|
||||
else
|
||||
highlightAll(QString(), 0);
|
||||
highlightAll(QString(), nullptr);
|
||||
return found ? Found : NotFound;
|
||||
}
|
||||
|
||||
|
@@ -40,7 +40,7 @@ using namespace Core;
|
||||
using namespace Core::Internal;
|
||||
|
||||
CurrentDocumentFind::CurrentDocumentFind()
|
||||
: m_currentFind(0)
|
||||
: m_currentFind(nullptr)
|
||||
{
|
||||
connect(qApp, &QApplication::focusChanged,
|
||||
this, &CurrentDocumentFind::updateCandidateFindFilter);
|
||||
@@ -48,7 +48,7 @@ CurrentDocumentFind::CurrentDocumentFind()
|
||||
|
||||
void CurrentDocumentFind::removeConnections()
|
||||
{
|
||||
disconnect(qApp, 0, this, 0);
|
||||
disconnect(qApp, nullptr, this, nullptr);
|
||||
removeFindSupportConnections();
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ bool CurrentDocumentFind::supportsReplace() const
|
||||
|
||||
FindFlags CurrentDocumentFind::supportedFindFlags() const
|
||||
{
|
||||
QTC_ASSERT(m_currentFind, return 0);
|
||||
QTC_ASSERT(m_currentFind, return nullptr);
|
||||
return m_currentFind->supportedFindFlags();
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ int CurrentDocumentFind::replaceAll(const QString &before, const QString &after,
|
||||
QTC_CHECK(m_currentWidget);
|
||||
int count = m_currentFind->replaceAll(before, after, findFlags);
|
||||
Utils::FadingIndicator::showText(m_currentWidget,
|
||||
tr("%n occurrences replaced.", 0, count),
|
||||
tr("%n occurrences replaced.", nullptr, count),
|
||||
Utils::FadingIndicator::SmallText);
|
||||
return count;
|
||||
}
|
||||
@@ -155,7 +155,7 @@ void CurrentDocumentFind::updateCandidateFindFilter(QWidget *old, QWidget *now)
|
||||
{
|
||||
Q_UNUSED(old)
|
||||
QWidget *candidate = now;
|
||||
QPointer<IFindSupport> impl = 0;
|
||||
QPointer<IFindSupport> impl = nullptr;
|
||||
while (!impl && candidate) {
|
||||
impl = Aggregation::query<IFindSupport>(candidate);
|
||||
if (!impl)
|
||||
@@ -215,8 +215,8 @@ void CurrentDocumentFind::removeFindSupportConnections()
|
||||
void CurrentDocumentFind::clearFindSupport()
|
||||
{
|
||||
removeFindSupportConnections();
|
||||
m_currentWidget = 0;
|
||||
m_currentFind = 0;
|
||||
m_currentWidget = nullptr;
|
||||
m_currentFind = nullptr;
|
||||
emit changed();
|
||||
}
|
||||
|
||||
|
@@ -61,7 +61,7 @@ public:
|
||||
void removeConnections();
|
||||
bool setFocusToCurrentFindSupport();
|
||||
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
|
||||
signals:
|
||||
void changed();
|
||||
|
@@ -181,24 +181,24 @@ public:
|
||||
void setupFilterMenuItems();
|
||||
void readSettings();
|
||||
|
||||
Internal::CurrentDocumentFind *m_currentDocumentFind = 0;
|
||||
Internal::FindToolBar *m_findToolBar = 0;
|
||||
Internal::FindToolWindow *m_findDialog = 0;
|
||||
SearchResultWindow *m_searchResultWindow = 0;
|
||||
Internal::CurrentDocumentFind *m_currentDocumentFind = nullptr;
|
||||
Internal::FindToolBar *m_findToolBar = nullptr;
|
||||
Internal::FindToolWindow *m_findDialog = nullptr;
|
||||
SearchResultWindow *m_searchResultWindow = nullptr;
|
||||
FindFlags m_findFlags;
|
||||
CompletionModel m_findCompletionModel;
|
||||
QStringListModel m_replaceCompletionModel;
|
||||
QStringList m_replaceCompletions;
|
||||
QAction *m_openFindDialog = 0;
|
||||
QAction *m_openFindDialog = nullptr;
|
||||
};
|
||||
|
||||
Find *m_instance = 0;
|
||||
FindPrivate *d = 0;
|
||||
Find *m_instance = nullptr;
|
||||
FindPrivate *d = nullptr;
|
||||
|
||||
void Find::destroy()
|
||||
{
|
||||
delete m_instance;
|
||||
m_instance = 0;
|
||||
m_instance = nullptr;
|
||||
if (d) {
|
||||
delete d->m_currentDocumentFind;
|
||||
delete d->m_findToolBar;
|
||||
@@ -245,7 +245,7 @@ void Find::extensionsInitialized()
|
||||
void Find::aboutToShutdown()
|
||||
{
|
||||
d->m_findToolBar->setVisible(false);
|
||||
d->m_findToolBar->setParent(0);
|
||||
d->m_findToolBar->setParent(nullptr);
|
||||
d->m_currentDocumentFind->removeConnections();
|
||||
}
|
||||
|
||||
|
@@ -121,26 +121,26 @@ FindToolBar::FindToolBar(CurrentDocumentFind *currentDocumentFind)
|
||||
static_cast<void (QCompleter::*)(const QModelIndex &)>(&QCompleter::activated),
|
||||
this, &FindToolBar::findCompleterActivated);
|
||||
|
||||
QAction *shiftEnterAction = new QAction(m_ui.findEdit);
|
||||
auto shiftEnterAction = new QAction(m_ui.findEdit);
|
||||
shiftEnterAction->setShortcut(QKeySequence(tr("Shift+Enter")));
|
||||
shiftEnterAction->setShortcutContext(Qt::WidgetShortcut);
|
||||
connect(shiftEnterAction, &QAction::triggered,
|
||||
this, &FindToolBar::invokeFindPrevious);
|
||||
m_ui.findEdit->addAction(shiftEnterAction);
|
||||
QAction *shiftReturnAction = new QAction(m_ui.findEdit);
|
||||
auto shiftReturnAction = new QAction(m_ui.findEdit);
|
||||
shiftReturnAction->setShortcut(QKeySequence(tr("Shift+Return")));
|
||||
shiftReturnAction->setShortcutContext(Qt::WidgetShortcut);
|
||||
connect(shiftReturnAction, &QAction::triggered,
|
||||
this, &FindToolBar::invokeFindPrevious);
|
||||
m_ui.findEdit->addAction(shiftReturnAction);
|
||||
|
||||
QAction *shiftEnterReplaceAction = new QAction(m_ui.replaceEdit);
|
||||
auto shiftEnterReplaceAction = new QAction(m_ui.replaceEdit);
|
||||
shiftEnterReplaceAction->setShortcut(QKeySequence(tr("Shift+Enter")));
|
||||
shiftEnterReplaceAction->setShortcutContext(Qt::WidgetShortcut);
|
||||
connect(shiftEnterReplaceAction, &QAction::triggered,
|
||||
this, &FindToolBar::invokeReplacePrevious);
|
||||
m_ui.replaceEdit->addAction(shiftEnterReplaceAction);
|
||||
QAction *shiftReturnReplaceAction = new QAction(m_ui.replaceEdit);
|
||||
auto shiftReturnReplaceAction = new QAction(m_ui.replaceEdit);
|
||||
shiftReturnReplaceAction->setShortcut(QKeySequence(tr("Shift+Return")));
|
||||
shiftReturnReplaceAction->setShortcutContext(Qt::WidgetShortcut);
|
||||
connect(shiftReturnReplaceAction, &QAction::triggered,
|
||||
@@ -313,9 +313,7 @@ FindToolBar::FindToolBar(CurrentDocumentFind *currentDocumentFind)
|
||||
connect(&m_findStepTimer, &QTimer::timeout, this, &FindToolBar::invokeFindStep);
|
||||
}
|
||||
|
||||
FindToolBar::~FindToolBar()
|
||||
{
|
||||
}
|
||||
FindToolBar::~FindToolBar() = default;
|
||||
|
||||
void FindToolBar::findCompleterActivated(const QModelIndex &index)
|
||||
{
|
||||
@@ -342,7 +340,7 @@ void FindToolBar::installEventFilters()
|
||||
bool FindToolBar::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::KeyPress) {
|
||||
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
|
||||
auto ke = static_cast<QKeyEvent *>(event);
|
||||
if (ke->key() == Qt::Key_Down) {
|
||||
if (obj == m_ui.findEdit) {
|
||||
if (m_ui.findEdit->text().isEmpty())
|
||||
@@ -358,7 +356,7 @@ bool FindToolBar::eventFilter(QObject *obj, QEvent *event)
|
||||
|
||||
if ((obj == m_ui.findEdit || obj == m_findCompleter->popup())
|
||||
&& event->type() == QEvent::KeyPress) {
|
||||
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
|
||||
auto ke = static_cast<QKeyEvent *>(event);
|
||||
if (ke->key() == Qt::Key_Space && (ke->modifiers() & Utils::HostOsInfo::controlModifier())) {
|
||||
QString completedText = m_currentDocumentFind->completedFindString();
|
||||
if (!completedText.isEmpty()) {
|
||||
@@ -368,7 +366,7 @@ bool FindToolBar::eventFilter(QObject *obj, QEvent *event)
|
||||
}
|
||||
}
|
||||
} else if (obj == this && event->type() == QEvent::ShortcutOverride) {
|
||||
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
|
||||
auto ke = static_cast<QKeyEvent *>(event);
|
||||
if (ke->key() == Qt::Key_Space && (ke->modifiers() & Utils::HostOsInfo::controlModifier())) {
|
||||
event->accept();
|
||||
return true;
|
||||
@@ -394,7 +392,7 @@ void FindToolBar::adaptToCandidate()
|
||||
void FindToolBar::updateGlobalActions()
|
||||
{
|
||||
IFindSupport *candidate = m_currentDocumentFind->candidate();
|
||||
bool enabled = (candidate != 0);
|
||||
bool enabled = (candidate != nullptr);
|
||||
bool replaceEnabled = enabled && candidate->supportsReplace();
|
||||
m_findInDocumentAction->setEnabled(enabled || (toolBarHasFocus() && isEnabled()));
|
||||
m_findNextSelectedAction->setEnabled(enabled);
|
||||
@@ -670,7 +668,7 @@ void FindToolBar::findFlagsChanged()
|
||||
|
||||
void FindToolBar::findEditButtonClicked()
|
||||
{
|
||||
OptionsPopup *popup = new OptionsPopup(m_ui.findEdit);
|
||||
auto popup = new OptionsPopup(m_ui.findEdit);
|
||||
popup->show();
|
||||
}
|
||||
|
||||
@@ -753,7 +751,7 @@ FindToolBarPlaceHolder *FindToolBar::findToolBarPlaceHolder() const
|
||||
}
|
||||
candidate = candidate->parentWidget();
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool FindToolBar::toolBarHasFocus() const
|
||||
@@ -826,7 +824,7 @@ void FindToolBar::openFindToolBar(OpenFlags flags)
|
||||
FindToolBarPlaceHolder *previousHolder = FindToolBarPlaceHolder::getCurrent();
|
||||
if (previousHolder != holder) {
|
||||
if (previousHolder)
|
||||
previousHolder->setWidget(0);
|
||||
previousHolder->setWidget(nullptr);
|
||||
holder->setWidget(this);
|
||||
FindToolBarPlaceHolder::setCurrent(holder);
|
||||
}
|
||||
@@ -987,7 +985,7 @@ OptionsPopup::OptionsPopup(QWidget *parent)
|
||||
: QWidget(parent, Qt::Popup)
|
||||
{
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
auto layout = new QVBoxLayout(this);
|
||||
layout->setContentsMargins(2, 2, 2, 2);
|
||||
layout->setSpacing(2);
|
||||
setLayout(layout);
|
||||
@@ -1003,7 +1001,7 @@ OptionsPopup::OptionsPopup(QWidget *parent)
|
||||
bool OptionsPopup::event(QEvent *ev)
|
||||
{
|
||||
if (ev->type() == QEvent::ShortcutOverride) {
|
||||
QKeyEvent *ke = static_cast<QKeyEvent *>(ev);
|
||||
auto ke = static_cast<QKeyEvent *>(ev);
|
||||
if (ke->key() == Qt::Key_Escape && !ke->modifiers()) {
|
||||
ev->accept();
|
||||
return true;
|
||||
@@ -1014,9 +1012,9 @@ bool OptionsPopup::event(QEvent *ev)
|
||||
|
||||
bool OptionsPopup::eventFilter(QObject *obj, QEvent *ev)
|
||||
{
|
||||
QCheckBox *checkbox = qobject_cast<QCheckBox *>(obj);
|
||||
auto checkbox = qobject_cast<QCheckBox *>(obj);
|
||||
if (ev->type() == QEvent::KeyPress && checkbox) {
|
||||
QKeyEvent *ke = static_cast<QKeyEvent *>(ev);
|
||||
auto ke = static_cast<QKeyEvent *>(ev);
|
||||
if (!ke->modifiers() && (ke->key() == Qt::Key_Enter || ke->key() == Qt::Key_Return)) {
|
||||
checkbox->click();
|
||||
ev->accept();
|
||||
@@ -1028,7 +1026,7 @@ bool OptionsPopup::eventFilter(QObject *obj, QEvent *ev)
|
||||
|
||||
void OptionsPopup::actionChanged()
|
||||
{
|
||||
QAction *action = qobject_cast<QAction *>(sender());
|
||||
auto action = qobject_cast<QAction *>(sender());
|
||||
QTC_ASSERT(action, return);
|
||||
QCheckBox *checkbox = m_checkboxMap.value(action);
|
||||
QTC_ASSERT(checkbox, return);
|
||||
|
@@ -51,8 +51,8 @@ public:
|
||||
explicit OptionsPopup(QWidget *parent);
|
||||
|
||||
protected:
|
||||
bool event(QEvent *ev);
|
||||
bool eventFilter(QObject *obj, QEvent *ev);
|
||||
bool event(QEvent *ev) override;
|
||||
bool eventFilter(QObject *obj, QEvent *ev) override;
|
||||
|
||||
private:
|
||||
void actionChanged();
|
||||
@@ -77,7 +77,7 @@ public:
|
||||
Q_DECLARE_FLAGS(OpenFlags, OpenFlag)
|
||||
|
||||
explicit FindToolBar(CurrentDocumentFind *currentDocumentFind);
|
||||
~FindToolBar();
|
||||
~FindToolBar() override;
|
||||
|
||||
void readSettings();
|
||||
void writeSettings();
|
||||
@@ -91,8 +91,8 @@ public slots:
|
||||
void setBackward(bool backward);
|
||||
|
||||
protected:
|
||||
bool focusNextPrevChild(bool next);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
bool focusNextPrevChild(bool next) override;
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
|
||||
private:
|
||||
void invokeFindNext();
|
||||
@@ -147,7 +147,7 @@ private:
|
||||
void acceptCandidateAndMoveToolBar();
|
||||
void indicateSearchState(IFindSupport::Result searchState);
|
||||
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
void setFindText(const QString &text);
|
||||
QString getFindText();
|
||||
QString getReplaceText();
|
||||
|
@@ -41,7 +41,7 @@
|
||||
using namespace Core;
|
||||
using namespace Core::Internal;
|
||||
|
||||
static FindToolWindow *m_instance = 0;
|
||||
static FindToolWindow *m_instance = nullptr;
|
||||
|
||||
static bool validateRegExp(Utils::FancyLineEdit *edit, QString *errorMessage)
|
||||
{
|
||||
@@ -63,8 +63,8 @@ static bool validateRegExp(Utils::FancyLineEdit *edit, QString *errorMessage)
|
||||
FindToolWindow::FindToolWindow(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
m_findCompleter(new QCompleter(this)),
|
||||
m_currentFilter(0),
|
||||
m_configWidget(0)
|
||||
m_currentFilter(nullptr),
|
||||
m_configWidget(nullptr)
|
||||
{
|
||||
m_instance = this;
|
||||
m_ui.setupUi(this);
|
||||
@@ -93,7 +93,7 @@ FindToolWindow::FindToolWindow(QWidget *parent)
|
||||
connect(m_ui.searchTerm, &Utils::FancyLineEdit::validChanged,
|
||||
this, &FindToolWindow::updateButtonStates);
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
auto layout = new QVBoxLayout;
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(0);
|
||||
m_ui.configWidget->setLayout(layout);
|
||||
@@ -115,7 +115,7 @@ FindToolWindow *FindToolWindow::instance()
|
||||
bool FindToolWindow::event(QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::KeyPress) {
|
||||
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
|
||||
auto ke = static_cast<QKeyEvent *>(event);
|
||||
if ((ke->key() == Qt::Key_Return || ke->key() == Qt::Key_Enter)
|
||||
&& (ke->modifiers() == Qt::NoModifier || ke->modifiers() == Qt::KeypadModifier)) {
|
||||
ke->accept();
|
||||
@@ -130,7 +130,7 @@ bool FindToolWindow::event(QEvent *event)
|
||||
bool FindToolWindow::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
if (obj == m_ui.searchTerm && event->type() == QEvent::KeyPress) {
|
||||
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
|
||||
auto ke = static_cast<QKeyEvent *>(event);
|
||||
if (ke->key() == Qt::Key_Down) {
|
||||
if (m_ui.searchTerm->text().isEmpty())
|
||||
m_findCompleter->setCompletionPrefix(QString());
|
||||
@@ -247,12 +247,12 @@ void FindToolWindow::setCurrentFilter(int index)
|
||||
m_ui.configWidget->layout()->addWidget(m_configWidget);
|
||||
} else {
|
||||
if (configWidget)
|
||||
configWidget->setParent(0);
|
||||
configWidget->setParent(nullptr);
|
||||
}
|
||||
}
|
||||
QWidget *w = m_ui.configWidget;
|
||||
while (w) {
|
||||
QScrollArea *sa = qobject_cast<QScrollArea *>(w);
|
||||
auto sa = qobject_cast<QScrollArea *>(w);
|
||||
if (sa) {
|
||||
sa->updateGeometry();
|
||||
break;
|
||||
@@ -268,7 +268,7 @@ void FindToolWindow::setCurrentFilter(int index)
|
||||
void FindToolWindow::acceptAndGetParameters(QString *term, IFindFilter **filter)
|
||||
{
|
||||
QTC_ASSERT(filter, return);
|
||||
*filter = 0;
|
||||
*filter = nullptr;
|
||||
Find::updateFindCompletion(m_ui.searchTerm->text());
|
||||
int index = m_ui.filterList->currentIndex();
|
||||
QString searchTerm = m_ui.searchTerm->text();
|
||||
@@ -277,13 +277,13 @@ void FindToolWindow::acceptAndGetParameters(QString *term, IFindFilter **filter)
|
||||
if (term)
|
||||
*term = searchTerm;
|
||||
if (searchTerm.isEmpty() && *filter && !(*filter)->isValid())
|
||||
*filter = 0;
|
||||
*filter = nullptr;
|
||||
}
|
||||
|
||||
void FindToolWindow::search()
|
||||
{
|
||||
QString term;
|
||||
IFindFilter *filter = 0;
|
||||
IFindFilter *filter = nullptr;
|
||||
acceptAndGetParameters(&term, &filter);
|
||||
QTC_ASSERT(filter, return);
|
||||
filter->findAll(term, Find::findFlags());
|
||||
@@ -292,7 +292,7 @@ void FindToolWindow::search()
|
||||
void FindToolWindow::replace()
|
||||
{
|
||||
QString term;
|
||||
IFindFilter *filter = 0;
|
||||
IFindFilter *filter = nullptr;
|
||||
acceptAndGetParameters(&term, &filter);
|
||||
QTC_ASSERT(filter, return);
|
||||
filter->replaceAll(term, Find::findFlags());
|
||||
|
@@ -42,8 +42,8 @@ class FindToolWindow : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FindToolWindow(QWidget *parent = 0);
|
||||
~FindToolWindow();
|
||||
explicit FindToolWindow(QWidget *parent = nullptr);
|
||||
~FindToolWindow() override;
|
||||
static FindToolWindow *instance();
|
||||
|
||||
void setFindFilters(const QList<IFindFilter *> &filters);
|
||||
@@ -55,8 +55,8 @@ public:
|
||||
void writeSettings();
|
||||
|
||||
protected:
|
||||
bool event(QEvent *event);
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
bool event(QEvent *event) override;
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
|
||||
private:
|
||||
void search();
|
||||
|
@@ -204,7 +204,7 @@ void HighlightScrollBarOverlay::drawHighlights(QPainter *painter,
|
||||
const QColor &color = creatorTheme()->color(itColor.key());
|
||||
const QMap<int, int> &positions = itColor.value();
|
||||
const auto itPosEnd = positions.constEnd();
|
||||
const int firstPos = int(docStart / lineHeight);
|
||||
const auto firstPos = int(docStart / lineHeight);
|
||||
auto itPos = positions.upperBound(firstPos);
|
||||
if (itPos != positions.constBegin())
|
||||
--itPos;
|
||||
|
@@ -40,7 +40,7 @@ public:
|
||||
enum Result { Found, NotFound, NotYetFound };
|
||||
|
||||
IFindSupport() : QObject(nullptr) {}
|
||||
~IFindSupport() override {}
|
||||
~IFindSupport() override = default;
|
||||
|
||||
virtual bool supportsReplace() const = 0;
|
||||
virtual FindFlags supportedFindFlags() const = 0;
|
||||
|
@@ -230,7 +230,7 @@ IFindSupport::Result ItemViewFind::find(const QString &searchTxt,
|
||||
d->m_view->setCurrentIndex(resultIndex);
|
||||
d->m_view->scrollTo(resultIndex);
|
||||
if (resultIndex.parent().isValid())
|
||||
if (QTreeView *treeView = qobject_cast<QTreeView *>(d->m_view))
|
||||
if (auto treeView = qobject_cast<QTreeView *>(d->m_view))
|
||||
treeView->expand(resultIndex.parent());
|
||||
if (wrapped)
|
||||
*wrapped = anyWrapped;
|
||||
|
@@ -134,7 +134,7 @@ int SearchResultTreeItemDelegate::drawLineNumber(QPainter *painter, const QStyle
|
||||
opt.palette.setColor(cg, QPalette::Text, Qt::darkGray);
|
||||
|
||||
const QStyle *style = QApplication::style();
|
||||
const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, 0) + 1;
|
||||
const int textMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, nullptr, nullptr) + 1;
|
||||
|
||||
const QRect rowRect = lineNumberAreaRect.adjusted(-textMargin, 0, textMargin-lineNumberAreaHorizontalPadding, 0);
|
||||
QItemDelegate::drawDisplay(painter, opt, rowRect, lineText);
|
||||
|
@@ -33,8 +33,8 @@ namespace Internal {
|
||||
class SearchResultTreeItemDelegate: public QItemDelegate
|
||||
{
|
||||
public:
|
||||
SearchResultTreeItemDelegate(int tabWidth, QObject *parent = 0);
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||
SearchResultTreeItemDelegate(int tabWidth, QObject *parent = nullptr);
|
||||
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
void setTabWidth(int width);
|
||||
|
||||
private:
|
||||
|
@@ -44,7 +44,7 @@ SearchResultTreeItem::~SearchResultTreeItem()
|
||||
|
||||
bool SearchResultTreeItem::isLeaf() const
|
||||
{
|
||||
return childrenCount() == 0 && parent() != 0;
|
||||
return childrenCount() == 0 && parent() != nullptr;
|
||||
}
|
||||
|
||||
Qt::CheckState SearchResultTreeItem::checkState() const
|
||||
@@ -96,7 +96,7 @@ int SearchResultTreeItem::insertionIndex(const QString &text, SearchResultTreeIt
|
||||
if (insertionPosition != m_children.end() && (*insertionPosition)->item.text == text)
|
||||
(*existingItem) = (*insertionPosition);
|
||||
else
|
||||
*existingItem = 0;
|
||||
*existingItem = nullptr;
|
||||
}
|
||||
return insertionPosition - m_children.begin();
|
||||
}
|
||||
@@ -113,7 +113,7 @@ void SearchResultTreeItem::insertChild(int index, SearchResultTreeItem *child)
|
||||
|
||||
void SearchResultTreeItem::insertChild(int index, const SearchResultItem &item)
|
||||
{
|
||||
SearchResultTreeItem *child = new SearchResultTreeItem(item, this);
|
||||
auto child = new SearchResultTreeItem(item, this);
|
||||
insertChild(index, child);
|
||||
}
|
||||
|
||||
|
@@ -37,7 +37,7 @@ class SearchResultTreeItem
|
||||
{
|
||||
public:
|
||||
explicit SearchResultTreeItem(const SearchResultItem &item = SearchResultItem(),
|
||||
SearchResultTreeItem *parent = NULL);
|
||||
SearchResultTreeItem *parent = nullptr);
|
||||
virtual ~SearchResultTreeItem();
|
||||
|
||||
bool isLeaf() const;
|
||||
|
@@ -37,7 +37,7 @@ using namespace Core::Internal;
|
||||
|
||||
SearchResultTreeModel::SearchResultTreeModel(QObject *parent)
|
||||
: QAbstractItemModel(parent)
|
||||
, m_currentParent(0)
|
||||
, m_currentParent(nullptr)
|
||||
, m_showReplaceUI(false)
|
||||
, m_editorFontIsUsed(false)
|
||||
{
|
||||
@@ -178,7 +178,7 @@ QVariant SearchResultTreeModel::data(const QModelIndex &idx, int role) const
|
||||
bool SearchResultTreeModel::setData(const QModelIndex &idx, const QVariant &value, int role)
|
||||
{
|
||||
if (role == Qt::CheckStateRole) {
|
||||
Qt::CheckState checkState = static_cast<Qt::CheckState>(value.toInt());
|
||||
auto checkState = static_cast<Qt::CheckState>(value.toInt());
|
||||
return setCheckState(idx, checkState);
|
||||
}
|
||||
return QAbstractItemModel::setData(idx, value, role);
|
||||
@@ -308,7 +308,7 @@ QSet<SearchResultTreeItem *> SearchResultTreeModel::addPath(const QStringList &p
|
||||
QSet<SearchResultTreeItem *> pathNodes;
|
||||
SearchResultTreeItem *currentItem = m_rootItem;
|
||||
QModelIndex currentItemIndex = QModelIndex();
|
||||
SearchResultTreeItem *partItem = 0;
|
||||
SearchResultTreeItem *partItem = nullptr;
|
||||
QStringList currentPath;
|
||||
foreach (const QString &part, path) {
|
||||
const int insertionIndex = currentItem->insertionIndex(part, &partItem);
|
||||
@@ -418,7 +418,7 @@ QList<QModelIndex> SearchResultTreeModel::addResults(const QList<SearchResultIte
|
||||
void SearchResultTreeModel::clear()
|
||||
{
|
||||
beginResetModel();
|
||||
m_currentParent = NULL;
|
||||
m_currentParent = nullptr;
|
||||
m_rootItem->clearChildren();
|
||||
m_editorFontIsUsed = false;
|
||||
endResetModel();
|
||||
|
@@ -41,8 +41,8 @@ class SearchResultTreeModel : public QAbstractItemModel
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SearchResultTreeModel(QObject *parent = 0);
|
||||
~SearchResultTreeModel();
|
||||
SearchResultTreeModel(QObject *parent = nullptr);
|
||||
~SearchResultTreeModel() override;
|
||||
|
||||
void setShowReplaceUI(bool show);
|
||||
void setTextEditorFont(const QFont &font, const SearchResultColor &color);
|
||||
@@ -56,8 +56,8 @@ public:
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||
|
||||
QModelIndex next(const QModelIndex &idx, bool includeGenerated = false, bool *wrapped = 0) const;
|
||||
QModelIndex prev(const QModelIndex &idx, bool includeGenerated = false, bool *wrapped = 0) const;
|
||||
QModelIndex next(const QModelIndex &idx, bool includeGenerated = false, bool *wrapped = nullptr) const;
|
||||
QModelIndex prev(const QModelIndex &idx, bool includeGenerated = false, bool *wrapped = nullptr) const;
|
||||
|
||||
QList<QModelIndex> addResults(const QList<SearchResultItem> &items, SearchResult::AddMode mode);
|
||||
|
||||
@@ -74,8 +74,8 @@ private:
|
||||
QSet<SearchResultTreeItem *> addPath(const QStringList &path);
|
||||
QVariant data(const SearchResultTreeItem *row, int role) const;
|
||||
bool setCheckState(const QModelIndex &idx, Qt::CheckState checkState, bool firstCall = true);
|
||||
QModelIndex nextIndex(const QModelIndex &idx, bool *wrapped = 0) const;
|
||||
QModelIndex prevIndex(const QModelIndex &idx, bool *wrapped = 0) const;
|
||||
QModelIndex nextIndex(const QModelIndex &idx, bool *wrapped = nullptr) const;
|
||||
QModelIndex prevIndex(const QModelIndex &idx, bool *wrapped = nullptr) const;
|
||||
SearchResultTreeItem *treeItemAtIndex(const QModelIndex &idx) const;
|
||||
|
||||
SearchResultTreeItem *m_rootItem;
|
||||
|
@@ -89,7 +89,7 @@ void SearchResultTreeView::emitJumpToSearchResult(const QModelIndex &index)
|
||||
|
||||
void SearchResultTreeView::setTabWidth(int tabWidth)
|
||||
{
|
||||
SearchResultTreeItemDelegate *delegate = static_cast<SearchResultTreeItemDelegate *>(itemDelegate());
|
||||
auto delegate = static_cast<SearchResultTreeItemDelegate *>(itemDelegate());
|
||||
delegate->setTabWidth(tabWidth);
|
||||
doItemsLayout();
|
||||
}
|
||||
|
@@ -40,7 +40,7 @@ class SearchResultTreeView : public Utils::TreeView
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SearchResultTreeView(QWidget *parent = 0);
|
||||
explicit SearchResultTreeView(QWidget *parent = nullptr);
|
||||
|
||||
void setAutoExpandResults(bool expand);
|
||||
void setTextEditorFont(const QFont &font, const SearchResultColor &color);
|
||||
|
@@ -69,7 +69,7 @@ public:
|
||||
|
||||
}
|
||||
|
||||
QSize sizeHint() const
|
||||
QSize sizeHint() const override
|
||||
{
|
||||
QSize sh = QLineEdit::minimumSizeHint();
|
||||
sh.rwidth() += qMax(25 * fontMetrics().width(QLatin1Char('x')),
|
||||
@@ -81,7 +81,7 @@ public:
|
||||
SearchResultWidget::SearchResultWidget(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
auto layout = new QVBoxLayout(this);
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(0);
|
||||
setLayout(layout);
|
||||
@@ -122,7 +122,7 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) :
|
||||
m_messageWidget->setLineWidth(1);
|
||||
}
|
||||
m_messageWidget->setAutoFillBackground(true);
|
||||
QHBoxLayout *messageLayout = new QHBoxLayout(m_messageWidget);
|
||||
auto messageLayout = new QHBoxLayout(m_messageWidget);
|
||||
messageLayout->setMargin(2);
|
||||
m_messageWidget->setLayout(messageLayout);
|
||||
QLabel *messageLabel = new QLabel(tr("Search was canceled."));
|
||||
@@ -134,7 +134,7 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) :
|
||||
m_searchResultTreeView = new SearchResultTreeView(this);
|
||||
m_searchResultTreeView->setFrameStyle(QFrame::NoFrame);
|
||||
m_searchResultTreeView->setAttribute(Qt::WA_MacShowFocusRect, false);
|
||||
Aggregation::Aggregate * agg = new Aggregation::Aggregate;
|
||||
auto agg = new Aggregation::Aggregate;
|
||||
agg->add(m_searchResultTreeView);
|
||||
agg->add(new ItemViewFind(m_searchResultTreeView,
|
||||
ItemDataRoles::ResultLineRole));
|
||||
@@ -144,7 +144,7 @@ SearchResultWidget::SearchResultWidget(QWidget *parent) :
|
||||
m_infoBarDisplay.setInfoBar(&m_infoBar);
|
||||
|
||||
m_descriptionContainer = new QWidget(topFindWidget);
|
||||
QHBoxLayout *descriptionLayout = new QHBoxLayout(m_descriptionContainer);
|
||||
auto descriptionLayout = new QHBoxLayout(m_descriptionContainer);
|
||||
m_descriptionContainer->setLayout(descriptionLayout);
|
||||
descriptionLayout->setMargin(0);
|
||||
m_descriptionContainer->setMinimumWidth(200);
|
||||
@@ -282,7 +282,7 @@ void SearchResultWidget::addResults(const QList<SearchResultItem> &items, Search
|
||||
emit paused(true);
|
||||
InfoBarEntry info(sizeWarningId,
|
||||
tr("The search resulted in more than %n items, do you still want to continue?",
|
||||
0, SEARCHRESULT_WARNING_LIMIT));
|
||||
nullptr, SEARCHRESULT_WARNING_LIMIT));
|
||||
info.setCancelButtonInfo(tr("Cancel"), [this]() { cancelAfterSizeWarning(); });
|
||||
info.setCustomButtonInfo(tr("Continue"), [this]() { continueAfterSizeWarning(); });
|
||||
m_infoBar.addInfo(info);
|
||||
@@ -499,12 +499,12 @@ QList<SearchResultItem> SearchResultWidget::checkedItems() const
|
||||
const int fileCount = model->rowCount();
|
||||
for (int i = 0; i < fileCount; ++i) {
|
||||
QModelIndex fileIndex = model->index(i, 0);
|
||||
SearchResultTreeItem *fileItem = static_cast<SearchResultTreeItem *>(fileIndex.internalPointer());
|
||||
QTC_ASSERT(fileItem != 0, continue);
|
||||
auto fileItem = static_cast<SearchResultTreeItem *>(fileIndex.internalPointer());
|
||||
QTC_ASSERT(fileItem != nullptr, continue);
|
||||
for (int rowIndex = 0; rowIndex < fileItem->childrenCount(); ++rowIndex) {
|
||||
QModelIndex textIndex = model->index(rowIndex, 0, fileIndex);
|
||||
SearchResultTreeItem *rowItem = static_cast<SearchResultTreeItem *>(textIndex.internalPointer());
|
||||
QTC_ASSERT(rowItem != 0, continue);
|
||||
auto rowItem = static_cast<SearchResultTreeItem *>(textIndex.internalPointer());
|
||||
QTC_ASSERT(rowItem != nullptr, continue);
|
||||
if (rowItem->checkState())
|
||||
result << rowItem->item;
|
||||
}
|
||||
@@ -517,7 +517,7 @@ void SearchResultWidget::updateMatchesFoundLabel()
|
||||
if (m_count == 0)
|
||||
m_matchesFoundLabel->setText(tr("No matches found."));
|
||||
else
|
||||
m_matchesFoundLabel->setText(tr("%n matches found.", 0, m_count));
|
||||
m_matchesFoundLabel->setText(tr("%n matches found.", nullptr, m_count));
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -49,8 +49,8 @@ class SearchResultWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SearchResultWidget(QWidget *parent = 0);
|
||||
~SearchResultWidget();
|
||||
explicit SearchResultWidget(QWidget *parent = nullptr);
|
||||
~SearchResultWidget() override;
|
||||
|
||||
void setInfo(const QString &label, const QString &toolTip, const QString &term);
|
||||
QWidget *additionalReplaceWidget() const;
|
||||
|
@@ -67,7 +67,7 @@ namespace Internal {
|
||||
setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||
}
|
||||
|
||||
QSize sizeHint() const
|
||||
QSize sizeHint() const override
|
||||
{
|
||||
if (widget())
|
||||
return widget()->size();
|
||||
@@ -109,7 +109,7 @@ namespace Internal {
|
||||
|
||||
SearchResultWindowPrivate::SearchResultWindowPrivate(SearchResultWindow *window, QWidget *nsp) :
|
||||
q(window),
|
||||
m_expandCollapseButton(0),
|
||||
m_expandCollapseButton(nullptr),
|
||||
m_expandCollapseAction(new QAction(tr("Expand All"), window)),
|
||||
m_spacer(new QWidget),
|
||||
m_historyLabel(new QLabel(tr("History:"))),
|
||||
@@ -178,7 +178,7 @@ namespace Internal {
|
||||
|
||||
void SearchResultWindowPrivate::moveWidgetToTop()
|
||||
{
|
||||
SearchResultWidget *widget = qobject_cast<SearchResultWidget *>(sender());
|
||||
auto widget = qobject_cast<SearchResultWidget *>(sender());
|
||||
QTC_ASSERT(widget, return);
|
||||
int index = m_searchResultWidgets.indexOf(widget);
|
||||
if (index == 0)
|
||||
@@ -212,7 +212,7 @@ namespace Internal {
|
||||
|
||||
void SearchResultWindowPrivate::popupRequested(bool focus)
|
||||
{
|
||||
SearchResultWidget *widget = qobject_cast<SearchResultWidget *>(sender());
|
||||
auto widget = qobject_cast<SearchResultWidget *>(sender());
|
||||
QTC_ASSERT(widget, return);
|
||||
int internalIndex = m_searchResultWidgets.indexOf(widget) + 1/*account for "new search" entry*/;
|
||||
setCurrentIndex(internalIndex, focus);
|
||||
@@ -297,7 +297,7 @@ using namespace Core::Internal;
|
||||
\internal
|
||||
*/
|
||||
|
||||
SearchResultWindow *SearchResultWindow::m_instance = 0;
|
||||
SearchResultWindow *SearchResultWindow::m_instance = nullptr;
|
||||
|
||||
/*!
|
||||
\internal
|
||||
@@ -316,7 +316,7 @@ SearchResultWindow::~SearchResultWindow()
|
||||
{
|
||||
qDeleteAll(d->m_searchResults);
|
||||
delete d->m_widget;
|
||||
d->m_widget = 0;
|
||||
d->m_widget = nullptr;
|
||||
delete d;
|
||||
}
|
||||
|
||||
|
@@ -30,12 +30,12 @@
|
||||
|
||||
using namespace Core;
|
||||
|
||||
FindToolBarPlaceHolder *FindToolBarPlaceHolder::m_current = 0;
|
||||
FindToolBarPlaceHolder *FindToolBarPlaceHolder::m_current = nullptr;
|
||||
|
||||
static QList<FindToolBarPlaceHolder *> g_findToolBarPlaceHolders;
|
||||
|
||||
FindToolBarPlaceHolder::FindToolBarPlaceHolder(QWidget *owner, QWidget *parent)
|
||||
: QWidget(parent), m_owner(owner), m_subWidget(0), m_lightColored(false)
|
||||
: QWidget(parent), m_owner(owner), m_subWidget(nullptr)
|
||||
{
|
||||
g_findToolBarPlaceHolders.append(this);
|
||||
setLayout(new QVBoxLayout);
|
||||
@@ -48,10 +48,10 @@ FindToolBarPlaceHolder::~FindToolBarPlaceHolder()
|
||||
g_findToolBarPlaceHolders.removeOne(this);
|
||||
if (m_subWidget) {
|
||||
m_subWidget->setVisible(false);
|
||||
m_subWidget->setParent(0);
|
||||
m_subWidget->setParent(nullptr);
|
||||
}
|
||||
if (m_current == this)
|
||||
m_current = 0;
|
||||
m_current = nullptr;
|
||||
}
|
||||
|
||||
const QList<FindToolBarPlaceHolder *> FindToolBarPlaceHolder::allFindToolbarPlaceHolders()
|
||||
@@ -82,7 +82,7 @@ void FindToolBarPlaceHolder::setWidget(Internal::FindToolBar *widget)
|
||||
{
|
||||
if (m_subWidget) {
|
||||
m_subWidget->setVisible(false);
|
||||
m_subWidget->setParent(0);
|
||||
m_subWidget->setParent(nullptr);
|
||||
}
|
||||
m_subWidget = widget;
|
||||
if (m_subWidget) {
|
||||
|
@@ -56,7 +56,7 @@ public:
|
||||
private:
|
||||
QWidget *m_owner;
|
||||
QPointer<Internal::FindToolBar> m_subWidget;
|
||||
bool m_lightColored;
|
||||
bool m_lightColored = false;
|
||||
static FindToolBarPlaceHolder *m_current;
|
||||
};
|
||||
|
||||
|
@@ -48,7 +48,7 @@ namespace Internal {
|
||||
const char settingsKeyDPI[] = "Core/EnableHighDpiScaling";
|
||||
|
||||
GeneralSettings::GeneralSettings()
|
||||
: m_page(0), m_dialog(0)
|
||||
: m_page(nullptr), m_dialog(nullptr)
|
||||
{
|
||||
setId(Constants::SETTINGS_ID_INTERFACE);
|
||||
setDisplayName(tr("Interface"));
|
||||
@@ -143,7 +143,7 @@ void GeneralSettings::finish()
|
||||
{
|
||||
delete m_widget;
|
||||
delete m_page;
|
||||
m_page = 0;
|
||||
m_page = nullptr;
|
||||
}
|
||||
|
||||
void GeneralSettings::resetInterfaceColor()
|
||||
|
@@ -44,9 +44,9 @@ class GeneralSettings : public IOptionsPage
|
||||
public:
|
||||
GeneralSettings();
|
||||
|
||||
QWidget *widget();
|
||||
void apply();
|
||||
void finish();
|
||||
QWidget *widget() override;
|
||||
void apply() override;
|
||||
void finish() override;
|
||||
|
||||
private:
|
||||
void resetInterfaceColor();
|
||||
|
@@ -49,19 +49,18 @@ namespace Core {
|
||||
class GeneratedFilePrivate : public QSharedData
|
||||
{
|
||||
public:
|
||||
GeneratedFilePrivate() : binary(false) {}
|
||||
GeneratedFilePrivate() = default;
|
||||
explicit GeneratedFilePrivate(const QString &p);
|
||||
QString path;
|
||||
QByteArray contents;
|
||||
Id editorId;
|
||||
bool binary;
|
||||
bool binary = false;
|
||||
GeneratedFile::Attributes attributes;
|
||||
};
|
||||
|
||||
GeneratedFilePrivate::GeneratedFilePrivate(const QString &p) :
|
||||
path(QDir::cleanPath(p)),
|
||||
binary(false),
|
||||
attributes(0)
|
||||
attributes({})
|
||||
{
|
||||
}
|
||||
|
||||
@@ -75,10 +74,7 @@ GeneratedFile::GeneratedFile(const QString &p) :
|
||||
{
|
||||
}
|
||||
|
||||
GeneratedFile::GeneratedFile(const GeneratedFile &rhs) :
|
||||
m_d(rhs.m_d)
|
||||
{
|
||||
}
|
||||
GeneratedFile::GeneratedFile(const GeneratedFile &rhs) = default;
|
||||
|
||||
GeneratedFile &GeneratedFile::operator=(const GeneratedFile &rhs)
|
||||
{
|
||||
@@ -87,9 +83,7 @@ GeneratedFile &GeneratedFile::operator=(const GeneratedFile &rhs)
|
||||
return *this;
|
||||
}
|
||||
|
||||
GeneratedFile::~GeneratedFile()
|
||||
{
|
||||
}
|
||||
GeneratedFile::~GeneratedFile() = default;
|
||||
|
||||
QString GeneratedFile::path() const
|
||||
{
|
||||
|
@@ -84,6 +84,6 @@ private:
|
||||
QSharedDataPointer<GeneratedFilePrivate> m_d;
|
||||
};
|
||||
|
||||
typedef QList<GeneratedFile> GeneratedFiles;
|
||||
using GeneratedFiles = QList<GeneratedFile>;
|
||||
|
||||
} // namespace Core
|
||||
|
@@ -57,10 +57,7 @@ namespace Core {
|
||||
|
||||
struct HelpManagerPrivate
|
||||
{
|
||||
HelpManagerPrivate() :
|
||||
m_needsSetup(true), m_helpEngine(nullptr), m_collectionWatcher(nullptr)
|
||||
{}
|
||||
|
||||
HelpManagerPrivate() = default;
|
||||
~HelpManagerPrivate();
|
||||
|
||||
const QStringList documentationFromInstaller();
|
||||
@@ -68,9 +65,9 @@ struct HelpManagerPrivate
|
||||
void writeSettings();
|
||||
void cleanUpDocumentation();
|
||||
|
||||
bool m_needsSetup;
|
||||
QHelpEngineCore *m_helpEngine;
|
||||
Utils::FileSystemWatcher *m_collectionWatcher;
|
||||
bool m_needsSetup = true;
|
||||
QHelpEngineCore *m_helpEngine = nullptr;
|
||||
Utils::FileSystemWatcher *m_collectionWatcher = nullptr;
|
||||
|
||||
// data for delayed initialization
|
||||
QSet<QString> m_filesToRegister;
|
||||
@@ -506,7 +503,7 @@ void HelpManagerPrivate::writeSettings()
|
||||
|
||||
namespace Core {
|
||||
|
||||
HelpManager *HelpManager::instance() { return 0; }
|
||||
HelpManager *HelpManager::instance() { return nullptr; }
|
||||
|
||||
QString HelpManager::collectionFilePath() { return QString(); }
|
||||
|
||||
@@ -542,7 +539,7 @@ void HelpManager::handleHelpRequest(const QUrl &, HelpManager::HelpViewerLocatio
|
||||
void HelpManager::handleHelpRequest(const QString &, HelpViewerLocation) {}
|
||||
|
||||
HelpManager::HelpManager(QObject *) {}
|
||||
HelpManager::~HelpManager() {}
|
||||
HelpManager::~HelpManager() = default;
|
||||
void HelpManager::aboutToShutdown() {}
|
||||
void HelpManager::setupHelpManager() {}
|
||||
|
||||
|
@@ -56,7 +56,7 @@ public:
|
||||
ExternalHelpAlways = 3
|
||||
};
|
||||
|
||||
typedef QHash<QString, QStringList> Filters;
|
||||
using Filters = QHash<QString, QStringList>;
|
||||
|
||||
static HelpManager *instance();
|
||||
static QString collectionFilePath();
|
||||
|
@@ -40,7 +40,7 @@ namespace Core {
|
||||
class CORE_EXPORT Context
|
||||
{
|
||||
public:
|
||||
Context() {}
|
||||
Context() = default;
|
||||
|
||||
explicit Context(Id c1) { add(c1); }
|
||||
Context(Id c1, Id c2) { add(c1); add(c2); }
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
Id at(int i) const { return d.at(i); }
|
||||
|
||||
// FIXME: Make interface slimmer.
|
||||
typedef QList<Id>::const_iterator const_iterator;
|
||||
using const_iterator = QList<Id>::const_iterator;
|
||||
const_iterator begin() const { return d.begin(); }
|
||||
const_iterator end() const { return d.end(); }
|
||||
int indexOf(Id c) const { return d.indexOf(c); }
|
||||
|
@@ -337,8 +337,8 @@ ICore::ICore(MainWindow *mainwindow)
|
||||
|
||||
ICore::~ICore()
|
||||
{
|
||||
m_instance = 0;
|
||||
m_mainwindow = 0;
|
||||
m_instance = nullptr;
|
||||
m_mainwindow = nullptr;
|
||||
}
|
||||
|
||||
void ICore::showNewItemDialog(const QString &title,
|
||||
|
@@ -56,9 +56,7 @@ namespace Core {
|
||||
class StringHolder
|
||||
{
|
||||
public:
|
||||
StringHolder()
|
||||
: n(0), str(0)
|
||||
{}
|
||||
StringHolder() = default;
|
||||
|
||||
StringHolder(const char *s, int length)
|
||||
: n(length), str(s)
|
||||
@@ -72,8 +70,8 @@ public:
|
||||
h &= 0x0fffffff;
|
||||
}
|
||||
}
|
||||
int n;
|
||||
const char *str;
|
||||
int n = 0;
|
||||
const char *str = nullptr;
|
||||
quintptr h;
|
||||
};
|
||||
|
||||
|
@@ -40,8 +40,9 @@ namespace Core {
|
||||
class CORE_EXPORT Id
|
||||
{
|
||||
public:
|
||||
Id() : m_id(0) {}
|
||||
Id() = default;
|
||||
Id(const char *name); // Good to use.
|
||||
Id(const QLatin1String &) = delete;
|
||||
|
||||
Id withSuffix(int suffix) const;
|
||||
Id withSuffix(const char *suffix) const;
|
||||
@@ -72,11 +73,9 @@ public:
|
||||
static QStringList toStringList(const QSet<Id> &ids);
|
||||
|
||||
private:
|
||||
// Intentionally unimplemented
|
||||
Id(const QLatin1String &) = delete;
|
||||
explicit Id(quintptr uid) : m_id(uid) {}
|
||||
|
||||
quintptr m_id;
|
||||
quintptr m_id = 0;
|
||||
};
|
||||
|
||||
inline uint qHash(Id id) { return static_cast<uint>(id.uniqueIdentifier()); }
|
||||
|
@@ -49,7 +49,7 @@ const QList<IDocumentFactory *> IDocumentFactory::allDocumentFactories()
|
||||
|
||||
IDocument *IDocumentFactory::open(const QString &filename)
|
||||
{
|
||||
QTC_ASSERT(m_opener, return 0);
|
||||
QTC_ASSERT(m_opener, return nullptr);
|
||||
return m_opener(filename);
|
||||
}
|
||||
|
||||
|
@@ -46,7 +46,7 @@ public:
|
||||
|
||||
static const QList<IDocumentFactory *> allDocumentFactories();
|
||||
|
||||
typedef std::function<IDocument *(const QString &fileName)> Opener;
|
||||
using Opener = std::function<IDocument *(const QString &fileName)>;
|
||||
IDocument *open(const QString &filename);
|
||||
|
||||
QStringList mimeTypes() const { return m_mimeTypes; }
|
||||
|
@@ -91,7 +91,6 @@ static QList<INavigationWidgetFactory *> g_navigationWidgetFactories;
|
||||
Creates a \l{Core::NavigationViewFactory}.
|
||||
*/
|
||||
INavigationWidgetFactory::INavigationWidgetFactory()
|
||||
: m_priority(0)
|
||||
{
|
||||
g_navigationWidgetFactories.append(this);
|
||||
}
|
||||
|
@@ -78,7 +78,7 @@ public:
|
||||
|
||||
private:
|
||||
QString m_displayName;
|
||||
int m_priority;
|
||||
int m_priority = 0;
|
||||
Id m_id;
|
||||
QKeySequence m_activationSequence;
|
||||
};
|
||||
|
@@ -202,7 +202,7 @@ void InfoBarDisplay::setInfoBar(InfoBar *infoBar)
|
||||
|
||||
void InfoBarDisplay::infoBarDestroyed()
|
||||
{
|
||||
m_infoBar = 0;
|
||||
m_infoBar = nullptr;
|
||||
// Calling update() here causes a complicated crash on shutdown.
|
||||
// So instead we rely on the view now being either destroyed (in which case it
|
||||
// will delete the widgets itself) or setInfoBar() being called explicitly.
|
||||
@@ -233,10 +233,10 @@ void InfoBarDisplay::update()
|
||||
infoWidget->setLineWidth(1);
|
||||
infoWidget->setAutoFillBackground(true);
|
||||
|
||||
QHBoxLayout *hbox = new QHBoxLayout;
|
||||
auto hbox = new QHBoxLayout;
|
||||
hbox->setMargin(2);
|
||||
|
||||
auto *vbox = new QVBoxLayout(infoWidget);
|
||||
auto vbox = new QVBoxLayout(infoWidget);
|
||||
vbox->setMargin(0);
|
||||
vbox->addLayout(hbox);
|
||||
|
||||
@@ -250,7 +250,7 @@ void InfoBarDisplay::update()
|
||||
vbox->addWidget(detailsWidget);
|
||||
}
|
||||
|
||||
auto *showDetailsButton = new QToolButton;
|
||||
auto showDetailsButton = new QToolButton;
|
||||
showDetailsButton->setCheckable(true);
|
||||
showDetailsButton->setChecked(m_isShowingDetailsWidget);
|
||||
showDetailsButton->setText(tr("&Show Details"));
|
||||
@@ -271,7 +271,7 @@ void InfoBarDisplay::update()
|
||||
}
|
||||
|
||||
if (!info.buttonText.isEmpty()) {
|
||||
QToolButton *infoWidgetButton = new QToolButton;
|
||||
auto infoWidgetButton = new QToolButton;
|
||||
infoWidgetButton->setText(info.buttonText);
|
||||
connect(infoWidgetButton, &QAbstractButton::clicked, [info]() { info.m_buttonCallBack(); });
|
||||
|
||||
@@ -279,7 +279,7 @@ void InfoBarDisplay::update()
|
||||
}
|
||||
|
||||
const Id id = info.id;
|
||||
QToolButton *infoWidgetSuppressButton = 0;
|
||||
QToolButton *infoWidgetSuppressButton = nullptr;
|
||||
if (info.globalSuppression == InfoBarEntry::GlobalSuppressionEnabled) {
|
||||
infoWidgetSuppressButton = new QToolButton;
|
||||
infoWidgetSuppressButton->setText(tr("Do Not Show Again"));
|
||||
|
@@ -87,7 +87,7 @@ ShellCommand *IVersionControl::createInitialCheckoutCommand(const QString &url,
|
||||
Q_UNUSED(baseDirectory);
|
||||
Q_UNUSED(localName);
|
||||
Q_UNUSED(extraArgs);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QString IVersionControl::vcsTopic(const QString &topLevel)
|
||||
@@ -106,9 +106,7 @@ IVersionControl::OpenSupportMode IVersionControl::openSupportMode(const QString
|
||||
return NoOpen;
|
||||
}
|
||||
|
||||
IVersionControl::TopicCache::~TopicCache()
|
||||
{
|
||||
}
|
||||
IVersionControl::TopicCache::~TopicCache() = default;
|
||||
|
||||
/*!
|
||||
Returns the topic for repository under \a topLevel.
|
||||
@@ -175,7 +173,7 @@ bool TestVersionControl::managesFile(const QString &workingDirectory, const QStr
|
||||
|
||||
QFileInfo fi(workingDirectory + QLatin1Char('/') + fileName);
|
||||
QString dir = fi.absolutePath();
|
||||
if (!managesDirectory(dir, 0))
|
||||
if (!managesDirectory(dir, nullptr))
|
||||
return false;
|
||||
QString file = fi.absoluteFilePath();
|
||||
return m_managedFiles.contains(file);
|
||||
|
@@ -241,7 +241,7 @@ class CORE_EXPORT TestVersionControl : public IVersionControl
|
||||
Q_OBJECT
|
||||
public:
|
||||
TestVersionControl(Id id, const QString &name) :
|
||||
m_id(id), m_displayName(name), m_dirCount(0), m_fileCount(0)
|
||||
m_id(id), m_displayName(name)
|
||||
{ }
|
||||
~TestVersionControl() override;
|
||||
|
||||
@@ -273,8 +273,8 @@ private:
|
||||
QString m_displayName;
|
||||
QHash<QString, QString> m_managedDirs;
|
||||
QSet<QString> m_managedFiles;
|
||||
mutable int m_dirCount;
|
||||
mutable int m_fileCount;
|
||||
mutable int m_dirCount = 0;
|
||||
mutable int m_fileCount = 0;
|
||||
};
|
||||
|
||||
} // namespace Core
|
||||
|
@@ -151,7 +151,7 @@ namespace {
|
||||
static QList<IFeatureProvider *> s_providerList;
|
||||
QList<IWizardFactory *> s_allFactories;
|
||||
QList<IWizardFactory::FactoryCreator> s_factoryCreators;
|
||||
QAction *s_inspectWizardAction = 0;
|
||||
QAction *s_inspectWizardAction = nullptr;
|
||||
bool s_areFactoriesLoaded = false;
|
||||
bool s_isWizardRunning = false;
|
||||
QWidget *s_currentWizard = nullptr;
|
||||
@@ -270,7 +270,7 @@ QString IWizardFactory::runPath(const QString &defaultPath)
|
||||
|
||||
Utils::Wizard *IWizardFactory::runWizard(const QString &path, QWidget *parent, Id platform, const QVariantMap &variables)
|
||||
{
|
||||
QTC_ASSERT(!s_isWizardRunning, return 0);
|
||||
QTC_ASSERT(!s_isWizardRunning, return nullptr);
|
||||
|
||||
s_isWizardRunning = true;
|
||||
ICore::updateNewItemDialogState();
|
||||
|
@@ -92,7 +92,7 @@ public:
|
||||
virtual bool isAvailable(Id platformId) const;
|
||||
QSet<Id> supportedPlatforms() const;
|
||||
|
||||
typedef std::function<QList<IWizardFactory *>()> FactoryCreator;
|
||||
using FactoryCreator = std::function<QList<IWizardFactory *>()>;
|
||||
static void registerFactoryCreator(const FactoryCreator &creator);
|
||||
|
||||
// Utility to find all registered wizards
|
||||
|
@@ -101,7 +101,7 @@ JsExpander::JsExpander()
|
||||
JsExpander::~JsExpander()
|
||||
{
|
||||
delete d;
|
||||
d = 0;
|
||||
d = nullptr;
|
||||
}
|
||||
|
||||
} // namespace Core
|
||||
|
@@ -67,8 +67,7 @@ public:
|
||||
} // Internal
|
||||
} // Core
|
||||
|
||||
BaseFileFilter::Iterator::~Iterator()
|
||||
{}
|
||||
BaseFileFilter::Iterator::~Iterator() = default;
|
||||
|
||||
BaseFileFilter::BaseFileFilter()
|
||||
: d(new Internal::BaseFileFilterPrivate)
|
||||
|
@@ -212,7 +212,7 @@ void DirectoryFilter::refresh(QFutureInterface<void> &future)
|
||||
if (future.isProgressUpdateNeeded()
|
||||
|| future.progressValue() == 0 /*workaround for regression in Qt*/) {
|
||||
future.setProgressValueAndText(subDirIterator.currentProgress(),
|
||||
tr("%1 filter update: %n files", 0, filesFound.size()).arg(displayName()));
|
||||
tr("%1 filter update: %n files", nullptr, filesFound.size()).arg(displayName()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -85,7 +85,7 @@ void ExecuteFilter::accept(LocatorFilterEntry selection,
|
||||
Q_UNUSED(newText)
|
||||
Q_UNUSED(selectionStart)
|
||||
Q_UNUSED(selectionLength)
|
||||
ExecuteFilter *p = const_cast<ExecuteFilter *>(this);
|
||||
auto p = const_cast<ExecuteFilter *>(this);
|
||||
|
||||
const QString value = selection.displayName.trimmed();
|
||||
const int index = m_commandHistory.indexOf(value);
|
||||
|
@@ -167,8 +167,8 @@ bool ILocatorFilter::openConfigDialog(QWidget *parent, bool &needsRefresh)
|
||||
QDialog dialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
|
||||
dialog.setWindowTitle(msgConfigureDialogTitle());
|
||||
|
||||
QVBoxLayout *vlayout = new QVBoxLayout(&dialog);
|
||||
QHBoxLayout *hlayout = new QHBoxLayout;
|
||||
auto vlayout = new QVBoxLayout(&dialog);
|
||||
auto hlayout = new QHBoxLayout;
|
||||
QLineEdit *shortcutEdit = new QLineEdit(shortcutString());
|
||||
QCheckBox *includeByDefault = new QCheckBox(msgIncludeByDefault());
|
||||
includeByDefault->setToolTip(msgIncludeByDefaultToolTip());
|
||||
|
@@ -43,9 +43,9 @@ class JavaScriptFilter : public Core::ILocatorFilter
|
||||
Q_OBJECT
|
||||
public:
|
||||
JavaScriptFilter();
|
||||
~JavaScriptFilter();
|
||||
~JavaScriptFilter() override;
|
||||
|
||||
virtual void prepareSearch(const QString &entry) override;
|
||||
void prepareSearch(const QString &entry) override;
|
||||
QList<Core::LocatorFilterEntry> matchesFor(QFutureInterface<Core::LocatorFilterEntry> &future,
|
||||
const QString &entry) override;
|
||||
void accept(Core::LocatorFilterEntry selection, QString *newText,
|
||||
|
@@ -196,7 +196,7 @@ void Locator::updateFilterActions()
|
||||
continue;
|
||||
Id filterId = filter->id();
|
||||
Id actionId = filter->actionId();
|
||||
QAction *action = 0;
|
||||
QAction *action = nullptr;
|
||||
if (!actionCopy.contains(filterId)) {
|
||||
// register new action
|
||||
action = new QAction(filter->displayName(), this);
|
||||
|
@@ -55,7 +55,7 @@ public:
|
||||
class ReferenceData
|
||||
{
|
||||
public:
|
||||
ReferenceData() {}
|
||||
ReferenceData() = default;
|
||||
ReferenceData(const QString &searchText, const ResultDataList &results)
|
||||
: searchText(searchText), results(results) {}
|
||||
|
||||
|
@@ -41,9 +41,7 @@ BasicLocatorFilterTest::BasicLocatorFilterTest(ILocatorFilter *filter) : m_filte
|
||||
{
|
||||
}
|
||||
|
||||
BasicLocatorFilterTest::~BasicLocatorFilterTest()
|
||||
{
|
||||
}
|
||||
BasicLocatorFilterTest::~BasicLocatorFilterTest() = default;
|
||||
|
||||
QList<LocatorFilterEntry> BasicLocatorFilterTest::matchesFor(const QString &searchText)
|
||||
{
|
||||
@@ -57,9 +55,7 @@ QList<LocatorFilterEntry> BasicLocatorFilterTest::matchesFor(const QString &sear
|
||||
return locatorSearch.results();
|
||||
}
|
||||
|
||||
ResultData::ResultData()
|
||||
{
|
||||
}
|
||||
ResultData::ResultData() = default;
|
||||
|
||||
ResultData::ResultData(const QString &textColumn1, const QString &textColumn2)
|
||||
: textColumn1(textColumn1), textColumn2(textColumn2)
|
||||
|
@@ -51,7 +51,7 @@ private:
|
||||
class CORE_EXPORT ResultData
|
||||
{
|
||||
public:
|
||||
typedef QList<ResultData> ResultDataList;
|
||||
using ResultDataList = QList<ResultData>;
|
||||
|
||||
ResultData();
|
||||
ResultData(const QString &textColumn1, const QString &textColumn2);
|
||||
@@ -67,7 +67,7 @@ public:
|
||||
QString textColumn2;
|
||||
};
|
||||
|
||||
typedef ResultData::ResultDataList ResultDataList;
|
||||
using ResultDataList = ResultData::ResultDataList;
|
||||
|
||||
} // namespace Tests
|
||||
} // namespace Core
|
||||
|
@@ -161,7 +161,7 @@ QVariant CategoryItem::data(int column, int role) const
|
||||
}
|
||||
|
||||
LocatorSettingsPage::LocatorSettingsPage(Locator *plugin)
|
||||
: m_plugin(plugin), m_widget(0)
|
||||
: m_plugin(plugin), m_widget(nullptr)
|
||||
{
|
||||
setId(Constants::FILTER_OPTIONS_PAGE);
|
||||
setDisplayName(QCoreApplication::translate("Locator", Constants::FILTER_OPTIONS_PAGE));
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user