forked from qt-creator/qt-creator
QmlDesigner: Remove ItemLibraryInfoPrivate
Change-Id: I66340a32e7627432b8a0f7b1fc8e71486303c6a3 Reviewed-by: Alessandro Portale <alessandro.portale@nokia.com>
This commit is contained in:
committed by
Alessandro Portale
parent
f3649ce4d0
commit
d3f0560120
@@ -41,7 +41,6 @@ namespace QmlDesigner {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class ItemLibraryEntryData;
|
class ItemLibraryEntryData;
|
||||||
class ItemLibraryInfoPrivate;
|
|
||||||
class MetaInfoPrivate;
|
class MetaInfoPrivate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,7 +100,6 @@ class CORESHARED_EXPORT ItemLibraryInfo : public QObject
|
|||||||
|
|
||||||
friend class Internal::MetaInfoPrivate;
|
friend class Internal::MetaInfoPrivate;
|
||||||
public:
|
public:
|
||||||
~ItemLibraryInfo();
|
|
||||||
|
|
||||||
QList<ItemLibraryEntry> entries() const;
|
QList<ItemLibraryEntry> entries() const;
|
||||||
QList<ItemLibraryEntry> entriesForType(const QString &typeName, int majorVersion, int minorVersion) const;
|
QList<ItemLibraryEntry> entriesForType(const QString &typeName, int majorVersion, int minorVersion) const;
|
||||||
@@ -114,10 +112,13 @@ public:
|
|||||||
signals:
|
signals:
|
||||||
void entriesChanged();
|
void entriesChanged();
|
||||||
|
|
||||||
private:
|
private: // functions
|
||||||
ItemLibraryInfo(QObject *parent = 0);
|
ItemLibraryInfo(QObject *parent = 0);
|
||||||
void setBaseInfo(ItemLibraryInfo *baseInfo);
|
void setBaseInfo(ItemLibraryInfo *m_baseInfo);
|
||||||
Internal::ItemLibraryInfoPrivate *d;
|
|
||||||
|
private: // variables
|
||||||
|
QHash<QString, ItemLibraryEntry> m_nameToEntryHash;
|
||||||
|
QWeakPointer<ItemLibraryInfo> m_baseInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
} // namespace QmlDesigner
|
||||||
|
@@ -56,14 +56,6 @@ public:
|
|||||||
bool forceImport;
|
bool forceImport;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ItemLibraryInfoPrivate
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
QHash<QString, ItemLibraryEntry> nameToEntryHash;
|
|
||||||
|
|
||||||
QWeakPointer<ItemLibraryInfo> baseInfo;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -253,50 +245,46 @@ QDataStream& operator>>(QDataStream& stream, ItemLibraryEntry &itemLibraryEntry)
|
|||||||
// ItemLibraryInfo
|
// ItemLibraryInfo
|
||||||
//
|
//
|
||||||
|
|
||||||
ItemLibraryInfo::ItemLibraryInfo(QObject *parent) :
|
ItemLibraryInfo::ItemLibraryInfo(QObject *parent)
|
||||||
QObject(parent),
|
: QObject(parent)
|
||||||
d(new Internal::ItemLibraryInfoPrivate())
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemLibraryInfo::~ItemLibraryInfo()
|
|
||||||
{
|
|
||||||
delete d;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<ItemLibraryEntry> ItemLibraryInfo::entriesForType(const QString &typeName, int majorVersion, int minorVersion) const
|
QList<ItemLibraryEntry> ItemLibraryInfo::entriesForType(const QString &typeName, int majorVersion, int minorVersion) const
|
||||||
{
|
{
|
||||||
QList<ItemLibraryEntry> entries;
|
QList<ItemLibraryEntry> entries;
|
||||||
|
|
||||||
foreach (const ItemLibraryEntry &entry, d->nameToEntryHash) {
|
foreach (const ItemLibraryEntry &entry, m_nameToEntryHash) {
|
||||||
if (entry.typeName() == typeName
|
if (entry.typeName() == typeName
|
||||||
&& entry.majorVersion() >= majorVersion
|
&& entry.majorVersion() >= majorVersion
|
||||||
&& entry.minorVersion() >= minorVersion)
|
&& entry.minorVersion() >= minorVersion)
|
||||||
entries += entry;
|
entries += entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d->baseInfo)
|
if (m_baseInfo)
|
||||||
entries += d->baseInfo->entriesForType(typeName, majorVersion, minorVersion);
|
entries += m_baseInfo->entriesForType(typeName, majorVersion, minorVersion);
|
||||||
|
|
||||||
return entries;
|
return entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemLibraryEntry ItemLibraryInfo::entry(const QString &name) const
|
ItemLibraryEntry ItemLibraryInfo::entry(const QString &name) const
|
||||||
{
|
{
|
||||||
if (d->nameToEntryHash.contains(name))
|
if (m_nameToEntryHash.contains(name))
|
||||||
return d->nameToEntryHash.value(name);
|
return m_nameToEntryHash.value(name);
|
||||||
|
|
||||||
if (d->baseInfo)
|
if (m_baseInfo)
|
||||||
return d->baseInfo->entry(name);
|
return m_baseInfo->entry(name);
|
||||||
|
|
||||||
return ItemLibraryEntry();
|
return ItemLibraryEntry();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<ItemLibraryEntry> ItemLibraryInfo::entries() const
|
QList<ItemLibraryEntry> ItemLibraryInfo::entries() const
|
||||||
{
|
{
|
||||||
QList<ItemLibraryEntry> list = d->nameToEntryHash.values();
|
QList<ItemLibraryEntry> list = m_nameToEntryHash.values();
|
||||||
if (d->baseInfo)
|
if (m_baseInfo)
|
||||||
list += d->baseInfo->entries();
|
list += m_baseInfo->entries();
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -308,9 +296,9 @@ static inline QString keyForEntry(const ItemLibraryEntry &entry)
|
|||||||
void ItemLibraryInfo::addEntry(const ItemLibraryEntry &entry)
|
void ItemLibraryInfo::addEntry(const ItemLibraryEntry &entry)
|
||||||
{
|
{
|
||||||
const QString key = keyForEntry(entry);
|
const QString key = keyForEntry(entry);
|
||||||
if (d->nameToEntryHash.contains(key))
|
if (m_nameToEntryHash.contains(key))
|
||||||
throw InvalidMetaInfoException(__LINE__, __FUNCTION__, __FILE__);
|
throw InvalidMetaInfoException(__LINE__, __FUNCTION__, __FILE__);
|
||||||
d->nameToEntryHash.insert(key, entry);
|
m_nameToEntryHash.insert(key, entry);
|
||||||
|
|
||||||
emit entriesChanged();
|
emit entriesChanged();
|
||||||
}
|
}
|
||||||
@@ -318,18 +306,18 @@ void ItemLibraryInfo::addEntry(const ItemLibraryEntry &entry)
|
|||||||
bool ItemLibraryInfo::containsEntry(const ItemLibraryEntry &entry)
|
bool ItemLibraryInfo::containsEntry(const ItemLibraryEntry &entry)
|
||||||
{
|
{
|
||||||
const QString key = keyForEntry(entry);
|
const QString key = keyForEntry(entry);
|
||||||
return d->nameToEntryHash.contains(key);
|
return m_nameToEntryHash.contains(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ItemLibraryInfo::clearEntries()
|
void ItemLibraryInfo::clearEntries()
|
||||||
{
|
{
|
||||||
d->nameToEntryHash.clear();
|
m_nameToEntryHash.clear();
|
||||||
emit entriesChanged();
|
emit entriesChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ItemLibraryInfo::setBaseInfo(ItemLibraryInfo *baseInfo)
|
void ItemLibraryInfo::setBaseInfo(ItemLibraryInfo *baseInfo)
|
||||||
{
|
{
|
||||||
d->baseInfo = baseInfo;
|
baseInfo = baseInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
} // namespace QmlDesigner
|
||||||
|
Reference in New Issue
Block a user