Commit fe29d6a8 authored by hjk's avatar hjk

Core: Remove Core::Id(QByteArray) constructor

This was mostly used to disambiguate the char * and the QString
constructors.

Change-Id: Ib6923ef8e8c0e5d514a883e73aa001a1cd9fb534
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent 52575f1c
......@@ -47,14 +47,14 @@ Id IAnalyzerTool::defaultMenuGroup(StartMode mode)
Id IAnalyzerTool::defaultActionId(const IAnalyzerTool *tool, StartMode mode)
{
Id id = tool->id();
Id id = Id("Analyzer").withSuffix(tool->id().toString());
switch (mode) {
case StartLocal:
return Id(QByteArray("Analyzer." + id.name() + ".Local"));
return id.withSuffix(".Local");
case StartRemote:
return Id(QByteArray("Analyzer." + id.name() + ".Remote"));
return id.withSuffix(".Remote");
case StartQml:
return Id(QByteArray("Analyzer." + id.name() + ".Qml"));
return id.withSuffix(".Qml");
}
return Id();
}
......
......@@ -1291,7 +1291,7 @@ Core::IEditor *ClearCasePlugin::showOutputInEditor(const QString& title, const Q
{
const VcsBase::VcsBaseEditorParameters *params = findType(editorType);
QTC_ASSERT(params, return 0);
const Core::Id id = Core::Id(QByteArray(params->id));
const Core::Id id = params->id;
if (ClearCase::Constants::debug)
qDebug() << "ClearCasePlugin::showOutputInEditor" << title << id.name()
<< "Size= " << output.size() << " Type=" << editorType << debugCodec(codec);
......
......@@ -1349,4 +1349,3 @@ void CMakeBuildTarget::clear()
title.clear();
library = false;
}
......@@ -160,14 +160,6 @@ Id::Id(const char *name)
: m_id(theId(name, 0))
{}
/*!
\overload
*/
Id::Id(const QByteArray &name)
: m_id(theId(name))
{}
/*!
Returns an internal representation of the id.
*/
......
......@@ -47,7 +47,6 @@ public:
Id() : m_id(0) {}
Id(int uid) : m_id(uid) {}
Id(const char *name);
explicit Id(const QByteArray &name);
Id withSuffix(int suffix) const;
Id withSuffix(const char *suffix) const;
......
......@@ -1270,7 +1270,7 @@ IEditor *CvsPlugin::showOutputInEditor(const QString& title, const QString &outp
{
const VcsBaseEditorParameters *params = findType(editorType);
QTC_ASSERT(params, return 0);
const Id id = Core::Id(QByteArray(params->id));
const Id id = params->id;
if (Cvs::Constants::debug)
qDebug() << "CVSPlugin::showOutputInEditor" << title << id.name()
<< "source=" << source << "Size= " << output.size() << " Type=" << editorType << debugCodec(codec);
......
......@@ -48,7 +48,6 @@
#include <QHBoxLayout>
static const int SEARCHRESULT_WARNING_LIMIT = 200000;
static const char UNDO_WARNING_ID[] = "warninglabel";
static const char SIZE_WARNING_ID[] = "sizeWarningLabel";
namespace Find {
......@@ -232,7 +231,7 @@ void SearchResultWidget::addResults(const QList<SearchResultItem> &items, Search
updateMatchesFoundLabel();
if (firstItems) {
if (!m_dontAskAgainGroup.isEmpty()) {
Core::Id undoWarningId(QByteArray(UNDO_WARNING_ID) + '/' + m_dontAskAgainGroup.toLatin1());
Core::Id undoWarningId = Core::Id("warninglabel/").withSuffix(m_dontAskAgainGroup);
if (m_infoBar.canInfoBeAdded(undoWarningId)) {
Core::InfoBarEntry info(undoWarningId, tr("This change cannot be undone."),
Core::InfoBarEntry::GlobalSuppressionEnabled);
......
......@@ -100,7 +100,7 @@ void MacroEvent::load(QDataStream &stream)
{
QByteArray ba;
stream >> ba;
d->id = Core::Id(ba);
d->id = Core::Id::fromName(ba);
int count;
stream >> count;
quint8 id;
......
......@@ -1170,7 +1170,7 @@ Core::IEditor *PerforcePlugin::showOutputInEditor(const QString &title, const QS
{
const VcsBase::VcsBaseEditorParameters *params = findType(editorType);
QTC_ASSERT(params, return 0);
const Core::Id id = Core::Id(QByteArray(params->id));
const Core::Id id = params->id;
if (Perforce::Constants::debug)
qDebug() << "PerforcePlugin::showOutputInEditor" << title << id.name()
<< "Size= " << output.size() << " Type=" << editorType << debugCodec(codec);
......
......@@ -294,7 +294,9 @@ void IDevice::fromMap(const QVariantMap &map)
{
d->type = typeFromMap(map);
d->displayName = map.value(QLatin1String(DisplayNameKey)).toString();
d->id = Core::Id(map.value(QLatin1String(IdKey), newId().name()).toByteArray());
d->id = Core::Id::fromSetting(map.value(QLatin1String(IdKey)));
if (!d->id.isValid())
d->id = newId();
d->origin = static_cast<Origin>(map.value(QLatin1String(OriginKey), ManuallyAdded).toInt());
d->sshParameters.host = map.value(QLatin1String(HostKey)).toString();
......@@ -317,7 +319,7 @@ QVariantMap IDevice::toMap() const
QVariantMap map;
map.insert(QLatin1String(DisplayNameKey), d->displayName);
map.insert(QLatin1String(TypeKey), d->type.toString());
map.insert(QLatin1String(IdKey), d->id.name());
map.insert(QLatin1String(IdKey), d->id.toSetting());
map.insert(QLatin1String(OriginKey), d->origin);
map.insert(QLatin1String(MachineTypeKey), d->machineType);
......
......@@ -184,7 +184,7 @@ QVariantMap EditorConfiguration::toMap() const
while (itCodeStyle.hasNext()) {
itCodeStyle.next();
QVariantMap settingsIdMap;
settingsIdMap.insert(QLatin1String("language"), itCodeStyle.key().name());
settingsIdMap.insert(QLatin1String("language"), itCodeStyle.key().toSetting());
QVariantMap value;
itCodeStyle.value()->toMap(QString(), &value);
settingsIdMap.insert(QLatin1String("value"), value);
......@@ -217,7 +217,7 @@ void EditorConfiguration::fromMap(const QVariantMap &map)
qWarning() << "No data for code style settings list" << i << "found!";
continue;
}
Core::Id languageId(settingsIdMap.value(QLatin1String("language")).toByteArray());
Core::Id languageId = Core::Id::fromSetting(settingsIdMap.value(QLatin1String("language")));
QVariantMap value = settingsIdMap.value(QLatin1String("value")).toMap();
ICodeStylePreferences *preferences = d->m_languageCodeStylePreferences.value(languageId);
if (preferences)
......
......@@ -93,7 +93,7 @@ bool ProjectConfiguration::usesDefaultDisplayName() const
QVariantMap ProjectConfiguration::toMap() const
{
QVariantMap map;
map.insert(QLatin1String(CONFIGURATION_ID_KEY), m_id.name());
map.insert(QLatin1String(CONFIGURATION_ID_KEY), m_id.toSetting());
map.insert(QLatin1String(DISPLAY_NAME_KEY), m_displayName);
map.insert(QLatin1String(DEFAULT_DISPLAY_NAME_KEY), m_defaultDisplayName);
return map;
......@@ -101,7 +101,7 @@ QVariantMap ProjectConfiguration::toMap() const
bool ProjectConfiguration::fromMap(const QVariantMap &map)
{
m_id = Core::Id(map.value(QLatin1String(CONFIGURATION_ID_KEY), QByteArray()).toByteArray());
m_id = Core::Id::fromSetting(map.value(QLatin1String(CONFIGURATION_ID_KEY)));
m_displayName = map.value(QLatin1String(DISPLAY_NAME_KEY), QString()).toString();
m_defaultDisplayName = map.value(QLatin1String(DEFAULT_DISPLAY_NAME_KEY),
m_defaultDisplayName.isEmpty() ?
......
......@@ -2425,7 +2425,7 @@ QVariantMap Version11Handler::update(Project *project, const QVariantMap &map)
QByteArray devId = dc.value(QLatin1String("Qt4ProjectManager.MaemoRunConfiguration.DeviceId")).toByteArray();
if (devId.isEmpty())
devId = QByteArray("Desktop Device");
if (!devId.isEmpty() && !DeviceManager::instance()->find(Core::Id(devId))) // We do not know that device
if (!devId.isEmpty() && !DeviceManager::instance()->find(Core::Id::fromName(devId))) // We do not know that device
devId.clear();
tmpKit->setValue(Core::Id("PE.Profile.Device"), devId);
......
......@@ -540,32 +540,32 @@ void TaskWindow::setShowWarnings(bool show)
void TaskWindow::updateCategoriesMenu()
{
typedef QMap<QString, QByteArray>::ConstIterator NameToIdsConstIt;
typedef QMap<QString, Core::Id>::ConstIterator NameToIdsConstIt;
d->m_categoriesMenu->clear();
const QList<Core::Id> filteredCategories = d->m_filter->filteredCategories();
QMap<QString, QByteArray> nameToIds;
QMap<QString, Core::Id> nameToIds;
foreach (const Core::Id &categoryId, d->m_model->categoryIds())
nameToIds.insert(d->m_model->categoryDisplayName(categoryId), categoryId.name());
nameToIds.insert(d->m_model->categoryDisplayName(categoryId), categoryId);
const NameToIdsConstIt cend = nameToIds.constEnd();
for (NameToIdsConstIt it = nameToIds.constBegin(); it != cend; ++it) {
const QString &displayName = it.key();
const QByteArray categoryId = it.value();
const Core::Id categoryId = it.value();
QAction *action = new QAction(d->m_categoriesMenu);
action->setCheckable(true);
action->setText(displayName);
action->setData(categoryId);
action->setChecked(!filteredCategories.contains(Core::Id(categoryId)));
action->setData(categoryId.toSetting());
action->setChecked(!filteredCategories.contains(categoryId));
d->m_categoriesMenu->addAction(action);
}
}
void TaskWindow::filterCategoryTriggered(QAction *action)
{
Core::Id categoryId(action->data().toByteArray());
Core::Id categoryId = Core::Id::fromSetting(action->data());
QTC_CHECK(categoryId.uniqueIdentifier() != 0);
setCategoryVisibility(categoryId, action->isChecked());
......
......@@ -1149,7 +1149,7 @@ Core::IEditor *SubversionPlugin::showOutputInEditor(const QString &title, const
{
const VcsBase::VcsBaseEditorParameters *params = findType(editorType);
QTC_ASSERT(params, return 0);
const Core::Id id = Core::Id(QByteArray(params->id));
const Core::Id id = params->id;
if (Subversion::Constants::debug)
qDebug() << "SubversionPlugin::showOutputInEditor" << title << id.name()
<< "Size= " << output.size() << " Type=" << editorType << debugCodec(codec);
......
......@@ -61,7 +61,7 @@ public:
BaseVcsEditorFactoryPrivate::BaseVcsEditorFactoryPrivate(const VcsBaseEditorParameters *t) :
m_type(t),
m_id(QByteArray(t->id)),
m_id(t->id),
m_mimeTypes(QStringList(QLatin1String(t->mimeType))),
m_editorHandler(new TextEditor::TextEditorActionHandler(t->context))
{
......
......@@ -47,7 +47,7 @@ public:
BaseVcsSubmitEditorFactoryPrivate::BaseVcsSubmitEditorFactoryPrivate(const VcsBaseSubmitEditorParameters *parameters) :
m_parameters(parameters),
m_id(QByteArray(parameters->id)),
m_id(parameters->id),
m_displayName(QLatin1String(parameters->displayName)),
m_mimeTypes(QLatin1String(parameters->mimeType))
{
......
......@@ -164,7 +164,7 @@ private:
VcsBaseEditor::VcsBaseEditor(VcsBaseEditorWidget *widget,
const VcsBaseEditorParameters *type) :
BaseTextEditor(widget),
m_id(QByteArray(type->id)),
m_id(type->id),
m_temporary(false)
{
setContext(Core::Context(type->context, TextEditor::Constants::C_TEXTEDITOR));
......
......@@ -412,7 +412,7 @@ Core::IEditor *VcsBaseSubmitEditor::duplicate(QWidget * /*parent*/)
Core::Id VcsBaseSubmitEditor::id() const
{
return Core::Id(QByteArray(d->m_parameters->id));
return d->m_parameters->id;
}
static QToolBar *createToolBar(const QWidget *someWidget, QAction *submitAction, QAction *diffAction)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment