Commit 7f341580 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by hjk

Core: Cosmetics

* Remove redundant namespace qualifiers
* Qt5-ify some signal/slot connections
* Replace some using Core::Internal with explicit namespace scopes

Change-Id: Id1aae05e2c6fc2992c2716e1f8f9e985c6e56122
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 6804c211
......@@ -44,8 +44,8 @@
Q_DECLARE_METATYPE(Core::Internal::MenuActionContainer*)
using namespace Core;
using namespace Core::Internal;
namespace Core {
namespace Internal {
/*!
\class ActionContainer
......@@ -565,3 +565,5 @@ bool MenuBarActionContainer::canBeAddedToMenu() const
return false;
}
} // namespace Internal
} // namespace Core
......@@ -46,7 +46,7 @@ struct Group
QList<QObject *> items; // Command * or ActionContainer *
};
class ActionContainerPrivate : public Core::ActionContainer
class ActionContainerPrivate : public ActionContainer
{
Q_OBJECT
......
......@@ -492,7 +492,7 @@ Action *ActionManagerPrivate::overridableAction(Id id)
void ActionManagerPrivate::readUserSettings(Id id, Action *cmd)
{
QSettings *settings = Core::ICore::settings();
QSettings *settings = ICore::settings();
settings->beginGroup(QLatin1String(kKeyboardSettingsKey));
if (settings->contains(id.toString()))
cmd->setKeySequence(QKeySequence(settings->value(id.toString()).toString()));
......@@ -511,7 +511,7 @@ void ActionManagerPrivate::initialize()
// settings->contains(QLatin1String(kKeyboardSettingsKey) + QLatin1Char('/')
// + QLatin1String(kKeyboardSettingsTransferredKey))
// check if settings in old style (pre 3.1) exist
QSettings *settings = Core::ICore::settings();
QSettings *settings = ICore::settings();
if (settings->contains(QLatin1String(kKeyboardSettingsKey) + QLatin1Char('/')
+ QLatin1String(kKeyboardSettingsTransferredKey))) {
return;
......
......@@ -58,8 +58,8 @@ class ActionManagerPrivate : public QObject
Q_OBJECT
public:
typedef QHash<Core::Id, Action *> IdCmdMap;
typedef QHash<Core::Id, ActionContainerPrivate *> IdContainerMap;
typedef QHash<Id, Action *> IdCmdMap;
typedef QHash<Id, ActionContainerPrivate *> IdContainerMap;
explicit ActionManagerPrivate();
~ActionManagerPrivate();
......
......@@ -194,8 +194,8 @@
interact with it.
*/
using namespace Core;
using namespace Core::Internal;
namespace Core {
namespace Internal {
/*!
\class Action
......@@ -275,7 +275,7 @@ QString Action::description() const
return id().toString();
}
void Action::setCurrentContext(const Core::Context &context)
void Action::setCurrentContext(const Context &context)
{
m_context = context;
......@@ -309,7 +309,7 @@ static QString msgActionWarning(QAction *newAction, Id id, QAction *oldAction)
return msg;
}
void Action::addOverrideAction(QAction *action, const Core::Context &context, bool scriptable)
void Action::addOverrideAction(QAction *action, const Context &context, bool scriptable)
{
if (Utils::HostOsInfo::isMacHost())
action->setIconVisibleInMenu(false);
......@@ -369,7 +369,7 @@ bool Action::isScriptable() const
return m_scriptableMap.values().contains(true);
}
bool Action::isScriptable(const Core::Context &context) const
bool Action::isScriptable(const Context &context) const
{
if (context == m_context && m_scriptableMap.contains(m_action->action()))
return m_scriptableMap.value(m_action->action());
......@@ -387,16 +387,16 @@ void Action::setAttribute(CommandAttribute attr)
{
m_attributes |= attr;
switch (attr) {
case Core::Command::CA_Hide:
case Command::CA_Hide:
m_action->setAttribute(Utils::ProxyAction::Hide);
break;
case Core::Command::CA_UpdateText:
case Command::CA_UpdateText:
m_action->setAttribute(Utils::ProxyAction::UpdateText);
break;
case Core::Command::CA_UpdateIcon:
case Command::CA_UpdateIcon:
m_action->setAttribute(Utils::ProxyAction::UpdateIcon);
break;
case Core::Command::CA_NonConfigurable:
case Command::CA_NonConfigurable:
break;
}
}
......@@ -405,16 +405,16 @@ void Action::removeAttribute(CommandAttribute attr)
{
m_attributes &= ~attr;
switch (attr) {
case Core::Command::CA_Hide:
case Command::CA_Hide:
m_action->removeAttribute(Utils::ProxyAction::Hide);
break;
case Core::Command::CA_UpdateText:
case Command::CA_UpdateText:
m_action->removeAttribute(Utils::ProxyAction::UpdateText);
break;
case Core::Command::CA_UpdateIcon:
case Command::CA_UpdateIcon:
m_action->removeAttribute(Utils::ProxyAction::UpdateIcon);
break;
case Core::Command::CA_NonConfigurable:
case Command::CA_NonConfigurable:
break;
}
}
......@@ -424,11 +424,12 @@ bool Action::hasAttribute(Command::CommandAttribute attr) const
return (m_attributes & attr);
}
} // namespace Internal
void Command::augmentActionWithShortcutToolTip(QAction *a) const
{
a->setToolTip(stringWithAppendedShortcut(a->text()));
QObject::connect(this, &Core::Command::keySequenceChanged, a, [this, a]() {
QObject::connect(this, &Command::keySequenceChanged, a, [this, a]() {
a->setToolTip(stringWithAppendedShortcut(a->text()));
});
QObject::connect(a, &QAction::changed, this, [this, a]() {
......@@ -444,3 +445,5 @@ QToolButton *Command::toolButtonWithAppendedShortcut(QAction *action, Command *c
cmd->augmentActionWithShortcutToolTip(action);
return button;
}
} // namespace Core
......@@ -47,7 +47,7 @@
namespace Core {
namespace Internal {
class Action : public Core::Command
class Action : public Command
{
Q_OBJECT
public:
......
......@@ -57,7 +57,7 @@ private slots:
void updateToolTip();
private:
QPointer<Core::Command> m_command;
QPointer<Command> m_command;
QString m_toolTipBase;
};
......
......@@ -47,7 +47,7 @@ namespace Core {
namespace Internal { class CommandMappingsPrivate; }
class CORE_EXPORT CommandMappings : public Core::IOptionsPage
class CORE_EXPORT CommandMappings : public IOptionsPage
{
Q_OBJECT
......
......@@ -141,7 +141,7 @@ bool CommandsFile::exportCommands(const QList<ShortcutItem *> &items)
w.writeStartDocument();
w.writeDTD(QLatin1String("<!DOCTYPE KeyboardMappingScheme>"));
w.writeComment(QString::fromLatin1(" Written by Qt Creator %1, %2. ").
arg(QLatin1String(Core::Constants::IDE_VERSION_LONG),
arg(QLatin1String(Constants::IDE_VERSION_LONG),
QDateTime::currentDateTime().toString(Qt::ISODate)));
w.writeStartElement(ctx.mappingElement);
foreach (const ShortcutItem *item, items) {
......
......@@ -66,7 +66,7 @@ public:
Q_DECLARE_FLAGS(DialogParameterFlags, DialogParameterEnum)
explicit WizardDialogParameters(const QString &defaultPath, const WizardPageList &extensionPages,
const QString &platform, const Core::FeatureSet &requiredFeatures,
const QString &platform, const FeatureSet &requiredFeatures,
DialogParameterFlags flags,
QVariantMap extraValues)
: m_defaultPath(defaultPath),
......@@ -86,7 +86,7 @@ public:
QString selectedPlatform() const
{ return m_selectedPlatform; }
Core::FeatureSet requiredFeatures() const
FeatureSet requiredFeatures() const
{ return m_requiredFeatures; }
DialogParameterFlags flags() const
......@@ -99,7 +99,7 @@ private:
QString m_defaultPath;
WizardPageList m_extensionPages;
QString m_selectedPlatform;
Core::FeatureSet m_requiredFeatures;
FeatureSet m_requiredFeatures;
DialogParameterFlags m_parameterFlags;
QVariantMap m_extraValues;
};
......
......@@ -90,7 +90,7 @@ QString UtilsJsExtension::absoluteFilePath(const QString &in) const
QString UtilsJsExtension::preferredSuffix(const QString &mimetype) const
{
return Core::MimeDatabase::preferredSuffixByType(mimetype);
return MimeDatabase::preferredSuffixByType(mimetype);
}
QString UtilsJsExtension::fileName(const QString &path, const QString &extension) const
......
......@@ -56,7 +56,7 @@ enum {
namespace Internal {
class DesignModeCoreListener : public Core::ICoreListener
class DesignModeCoreListener : public ICoreListener
{
public:
DesignModeCoreListener(DesignMode* mode);
......@@ -93,7 +93,7 @@ public:
public:
Internal::DesignModeCoreListener *m_coreListener;
QPointer<Core::IEditor> m_currentEditor;
QPointer<IEditor> m_currentEditor;
bool m_isActive;
bool m_isRequired;
QList<DesignEditorInfo*> m_editors;
......@@ -124,11 +124,11 @@ DesignMode::DesignMode()
ExtensionSystem::PluginManager::addObject(d->m_coreListener);
connect(EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)),
this, SLOT(currentEditorChanged(Core::IEditor*)));
connect(EditorManager::instance(), &EditorManager::currentEditorChanged,
this, &DesignMode::currentEditorChanged);
connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*,Core::IMode*)),
this, SLOT(updateContext(Core::IMode*,Core::IMode*)));
connect(ModeManager::instance(), &ModeManager::currentModeChanged,
this, &DesignMode::updateContext);
}
DesignMode::~DesignMode()
......@@ -195,7 +195,7 @@ void DesignMode::unregisterDesignWidget(QWidget *widget)
}
// if editor changes, check if we have valid mimetype registered.
void DesignMode::currentEditorChanged(Core::IEditor *editor)
void DesignMode::currentEditorChanged(IEditor *editor)
{
if (editor && (d->m_currentEditor.data() == editor))
return;
......@@ -226,7 +226,7 @@ void DesignMode::currentEditorChanged(Core::IEditor *editor)
if (!mimeEditorAvailable) {
setActiveContext(Context());
if (ModeManager::currentMode() == this)
ModeManager::activateMode(Core::Constants::MODE_EDIT);
ModeManager::activateMode(Constants::MODE_EDIT);
setEnabled(false);
d->m_currentEditor = 0;
emit actionsUpdated(d->m_currentEditor.data());
......@@ -245,7 +245,7 @@ void DesignMode::updateActions()
emit actionsUpdated(d->m_currentEditor.data());
}
void DesignMode::updateContext(Core::IMode *newMode, Core::IMode *oldMode)
void DesignMode::updateContext(IMode *newMode, IMode *oldMode)
{
if (newMode == this)
ICore::addAdditionalContext(d->m_activeContext);
......@@ -259,7 +259,7 @@ void DesignMode::setActiveContext(const Context &context)
return;
if (ModeManager::currentMode() == this)
Core::ICore::updateAdditionalContexts(d->m_activeContext, context);
ICore::updateAdditionalContexts(d->m_activeContext, context);
d->m_activeContext = context;
}
......
......@@ -47,7 +47,7 @@ namespace Internal { class DesignModeCoreListener; }
class DesignModePrivate;
class CORE_EXPORT DesignMode : public Core::IMode
class CORE_EXPORT DesignMode : public IMode
{
Q_OBJECT
......@@ -71,11 +71,11 @@ signals:
void actionsUpdated(Core::IEditor *editor);
private slots:
void currentEditorChanged(Core::IEditor *editor);
void updateActions();
void updateContext(Core::IMode *newMode, Core::IMode *oldMode);
private:
void currentEditorChanged(IEditor *editor);
void updateContext(IMode *newMode, IMode *oldMode);
void setActiveContext(const Context &context);
DesignModePrivate *d;
......
......@@ -90,7 +90,7 @@ class CORE_EXPORT IOptionsPageProvider : public QObject
public:
IOptionsPageProvider(QObject *parent = 0) : QObject(parent) {}
Core::Id category() const { return m_category; }
Id category() const { return m_category; }
QString displayCategory() const { return m_displayCategory; }
QIcon categoryIcon() const { return QIcon(m_categoryIcon); }
......@@ -98,11 +98,11 @@ public:
virtual bool matches(const QString & /* searchKeyWord*/) const = 0;
protected:
void setCategory(Core::Id category) { m_category = category; }
void setCategory(Id category) { m_category = category; }
void setDisplayCategory(const QString &displayCategory) { m_displayCategory = displayCategory; }
void setCategoryIcon(const QString &categoryIcon) { m_categoryIcon = categoryIcon; }
Core::Id m_category;
Id m_category;
QString m_displayCategory;
QString m_categoryIcon;
};
......
......@@ -54,13 +54,12 @@ class SaveItemsDialog : public QDialog
Q_OBJECT
public:
SaveItemsDialog(QWidget *parent,
QList<Core::IDocument *> items);
SaveItemsDialog(QWidget *parent, QList<IDocument *> items);
void setMessage(const QString &msg);
void setAlwaysSaveMessage(const QString &msg);
bool alwaysSaveChecked();
QList<Core::IDocument *> itemsToSave() const;
QList<IDocument *> itemsToSave() const;
private slots:
void collectItemsToSave();
......@@ -71,7 +70,7 @@ private:
void adjustButtonWidths();
Ui::SaveItemsDialog m_ui;
QList<Core::IDocument*> m_itemsToSave;
QList<IDocument*> m_itemsToSave;
};
} // namespace Internal
......
......@@ -293,9 +293,9 @@ bool optionsPageLessThan(const IOptionsPage *p1, const IOptionsPage *p2)
return p1->id().alphabeticallyBefore(p2->id());
}
static inline QList<Core::IOptionsPage*> sortedOptionsPages()
static inline QList<IOptionsPage*> sortedOptionsPages()
{
QList<Core::IOptionsPage*> rc = ExtensionSystem::PluginManager::getObjects<IOptionsPage>();
QList<IOptionsPage*> rc = ExtensionSystem::PluginManager::getObjects<IOptionsPage>();
qStableSort(rc.begin(), rc.end(), optionsPageLessThan);
return rc;
}
......
......@@ -49,19 +49,19 @@
Q_DECLARE_METATYPE(Core::Internal::ShortcutItem*)
using namespace Core;
using namespace Core::Internal;
namespace Core {
namespace Internal {
ShortcutSettings::ShortcutSettings(QObject *parent)
: CommandMappings(parent), m_initialized(false)
{
connect(ActionManager::instance(), SIGNAL(commandListChanged()), this, SLOT(initialize()));
setId(Core::Constants::SETTINGS_ID_SHORTCUTS);
setId(Constants::SETTINGS_ID_SHORTCUTS);
setDisplayName(tr("Keyboard"));
setCategory(Core::Constants::SETTINGS_CATEGORY_CORE);
setDisplayCategory(QCoreApplication::translate("Core", Core::Constants::SETTINGS_TR_CATEGORY_CORE));
setCategoryIcon(QLatin1String(Core::Constants::SETTINGS_CATEGORY_CORE_ICON));
setCategory(Constants::SETTINGS_CATEGORY_CORE);
setDisplayCategory(QCoreApplication::translate("Core", Constants::SETTINGS_TR_CATEGORY_CORE));
setCategoryIcon(QLatin1String(Constants::SETTINGS_CATEGORY_CORE_ICON));
}
QWidget *ShortcutSettings::widget()
......@@ -411,3 +411,5 @@ void ShortcutSettings::markCollisions(ShortcutItem *item)
item->m_item->setForeground(2, hasCollision ? Qt::red : commandList()->palette().foreground());
}
} // namespace Internal
} // namespace Core
......@@ -56,7 +56,7 @@ struct ShortcutItem
};
class ShortcutSettings : public Core::CommandMappings
class ShortcutSettings : public CommandMappings
{
Q_OBJECT
......
......@@ -1189,7 +1189,7 @@ void DocumentManager::saveSettings()
recentEditorIds.append(file.second.toString());
}
QSettings *s = Core::ICore::settings();
QSettings *s = ICore::settings();
s->beginGroup(QLatin1String(settingsGroupC));
s->setValue(QLatin1String(filesKeyC), recentFiles);
s->setValue(QLatin1String(editorsKeyC), recentEditorIds);
......@@ -1203,7 +1203,7 @@ void DocumentManager::saveSettings()
void readSettings()
{
QSettings *s = Core::ICore::settings();
QSettings *s = ICore::settings();
d->m_recentFiles.clear();
s->beginGroup(QLatin1String(settingsGroupC));
QStringList recentFiles = s->value(QLatin1String(filesKeyC)).toStringList();
......
......@@ -44,8 +44,8 @@
#include <QWidget>
#include <QIcon>
using namespace Core;
using namespace Core::Internal;
namespace Core {
namespace Internal {
EditMode::EditMode() :
m_splitter(new MiniSplitter),
......@@ -73,7 +73,7 @@ EditMode::EditMode() :
MiniSplitter *splitter = new MiniSplitter;
splitter->setOrientation(Qt::Vertical);
splitter->insertWidget(0, rightPaneSplitter);
QWidget *outputPane = new Core::OutputPanePlaceHolder(this, splitter);
QWidget *outputPane = new OutputPanePlaceHolder(this, splitter);
outputPane->setObjectName(QLatin1String("EditModeOutputPanePlaceHolder"));
splitter->insertWidget(1, outputPane);
splitter->setStretchFactor(0, 3);
......@@ -84,8 +84,8 @@ EditMode::EditMode() :
m_splitter->setStretchFactor(0, 0);
m_splitter->setStretchFactor(1, 1);
connect(ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)),
this, SLOT(grabEditorManager(Core::IMode*)));
connect(ModeManager::instance(), &ModeManager::currentModeChanged,
this, &EditMode::grabEditorManager);
m_splitter->setFocusProxy(editorPlaceHolder);
IContext *modeContextObject = new IContext(this);
......@@ -103,7 +103,7 @@ EditMode::~EditMode()
delete m_splitter;
}
void EditMode::grabEditorManager(Core::IMode *mode)
void EditMode::grabEditorManager(IMode *mode)
{
if (mode != this)
return;
......@@ -111,3 +111,6 @@ void EditMode::grabEditorManager(Core::IMode *mode)
if (EditorManager::currentEditor())
EditorManager::currentEditor()->widget()->setFocus();
}
} // namespace Internal
} // namespace Core
......@@ -44,7 +44,7 @@ class EditorManager;
namespace Internal {
class EditMode : public Core::IMode
class EditMode : public IMode
{
Q_OBJECT
......@@ -52,10 +52,9 @@ public:
EditMode();
~EditMode();
private slots:
void grabEditorManager(Core::IMode *mode);
private:
void grabEditorManager(IMode *mode);
QSplitter *m_splitter;
QVBoxLayout *m_rightSplitWidgetLayout;
};
......
......@@ -51,6 +51,7 @@
#include <coreplugin/findplaceholder.h>
#include <coreplugin/icore.h>
#include <coreplugin/icorelistener.h>
#include <coreplugin/imode.h>
#include <coreplugin/infobar.h>
#include <coreplugin/iversioncontrol.h>
#include <coreplugin/mimedatabase.h>
......@@ -127,14 +128,14 @@ using namespace Utils;
//===================EditorManager=====================
EditorManagerPlaceHolder::EditorManagerPlaceHolder(Core::IMode *mode, QWidget *parent)
EditorManagerPlaceHolder::EditorManagerPlaceHolder(IMode *mode, QWidget *parent)
: QWidget(parent), m_mode(mode)
{
setLayout(new QVBoxLayout);
layout()->setMargin(0);
setFocusProxy(EditorManagerPrivate::mainEditorArea());
connect(Core::ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)),
this, SLOT(currentModeChanged(Core::IMode*)));
connect(ModeManager::instance(), &ModeManager::currentModeChanged,
this, &EditorManagerPlaceHolder::currentModeChanged);
currentModeChanged(ModeManager::currentMode());
}
......@@ -149,7 +150,7 @@ EditorManagerPlaceHolder::~EditorManagerPlaceHolder()
}
}
void EditorManagerPlaceHolder::currentModeChanged(Core::IMode *mode)
void EditorManagerPlaceHolder::currentModeChanged(IMode *mode)
{
if (m_mode == mode) {
QWidget *previousFocus = 0;
......@@ -216,7 +217,7 @@ static void setFocusToEditorViewAndUnmaximizePanes(EditorView *view)
/* For something that has a 'QString id' (IEditorFactory
* or IExternalEditor), find the one matching a id. */
template <class EditorFactoryLike>
EditorFactoryLike *findById(Core::Id id)
EditorFactoryLike *findById(Id id)
{
return ExtensionSystem::PluginManager::getObject<EditorFactoryLike>(
[&id](EditorFactoryLike *efl) {
......@@ -286,8 +287,8 @@ EditorManagerPrivate::~EditorManagerPrivate()
void EditorManagerPrivate::init()
{
DocumentModel::init();
connect(ICore::instance(), SIGNAL(contextAboutToChange(QList<Core::IContext*>)),
this, SLOT(handleContextChange(QList<Core::IContext*>)));
connect(ICore::instance(), &ICore::contextAboutToChange,
this, &EditorManagerPrivate::handleContextChange);
const Context editManagerContext(Constants::C_EDITORMANAGER);
// combined context for edit & design modes
......@@ -322,7 +323,7 @@ void EditorManagerPrivate::init()
// Close Action
cmd = ActionManager::registerAction(m_closeCurrentEditorAction, Constants::CLOSE, editManagerContext, true);
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+W")));
cmd->setAttribute(Core::Command::CA_UpdateText);
cmd->setAttribute(Command::CA_UpdateText);
cmd->setDescription(m_closeCurrentEditorAction->text());
mfile->addAction(cmd, Constants::G_FILE_CLOSE);
connect(m_closeCurrentEditorAction, SIGNAL(triggered()),
......@@ -346,7 +347,7 @@ void EditorManagerPrivate::init()
// Close All Others Action
cmd = ActionManager::registerAction(m_closeOtherDocumentsAction, Constants::CLOSEOTHERS, editManagerContext, true);
mfile->addAction(cmd, Constants::G_FILE_CLOSE);
cmd->setAttribute(Core::Command::CA_UpdateText);
cmd->setAttribute(Command::CA_UpdateText);
connect(m_closeOtherDocumentsAction, SIGNAL(triggered()), m_instance, SLOT(closeOtherDocuments()));
// Close All Others Except Visible Action
......@@ -590,7 +591,7 @@ IEditor *EditorManagerPrivate::openEditorAt(EditorView *view, const QString &fil
EditorManager::cutForwardNavigationHistory();
EditorManager::addCurrentPositionToNavigationHistory();
EditorManager::OpenEditorFlags tempFlags = flags | EditorManager::IgnoreNavigationHistory;
Core::IEditor *editor = openEditor(view, fileName, editorId, tempFlags, newEditor);