Commit b29fa169 authored by Marco Bubke's avatar Marco Bubke Committed by Tim Jenssen

QmlDesigner: Rename ItemLibraryItemModel in ItemLibraryItem

Change-Id: I93402371955e43b86a354bf38e8081d1ca737424
Reviewed-by: default avatarTim Jenssen <tim.jenssen@digia.com>
parent 117c8a5e
......@@ -7,7 +7,7 @@ HEADERS += itemlibraryview.h \
itemlibrarytreeview.h \
itemlibraryimageprovider.h \
itemlibrarysectionmodel.h \
itemlibraryitemmodel.h \
itemlibraryitem.h \
resourceitemdelegate.h
SOURCES += itemlibraryview.cpp \
......@@ -16,7 +16,7 @@ SOURCES += itemlibraryview.cpp \
itemlibrarytreeview.cpp \
itemlibraryimageprovider.cpp \
itemlibrarysectionmodel.cpp \
itemlibraryitemmodel.cpp \
itemlibraryitem.cpp \
resourceitemdelegate.cpp
RESOURCES += itemlibrary.qrc
......
......@@ -27,11 +27,11 @@
**
****************************************************************************/
#include "itemlibraryitemmodel.h"
#include "itemlibraryitem.h"
namespace QmlDesigner {
ItemLibraryItemModel::ItemLibraryItemModel(int itemLibId, const QString &itemName, QObject *parent)
ItemLibraryItem::ItemLibraryItem(int itemLibId, const QString &itemName, QObject *parent)
: QObject(parent),
m_libId(itemLibId),
m_name(itemName),
......@@ -39,38 +39,38 @@ ItemLibraryItemModel::ItemLibraryItemModel(int itemLibId, const QString &itemNam
{
}
ItemLibraryItemModel::~ItemLibraryItemModel()
ItemLibraryItem::~ItemLibraryItem()
{
}
int ItemLibraryItemModel::itemLibId() const
int ItemLibraryItem::itemLibId() const
{
return m_libId;
}
QString ItemLibraryItemModel::itemName() const
QString ItemLibraryItem::itemName() const
{
return m_name;
}
QString ItemLibraryItemModel::itemLibraryIconPath() const
QString ItemLibraryItem::itemLibraryIconPath() const
{
//Prepend image provider prefix
return QStringLiteral("image://qmldesigner_itemlibrary/") + m_iconPath;
}
QVariant ItemLibraryItemModel::sortingRole() const
QVariant ItemLibraryItem::sortingRole() const
{
return itemName();
}
void ItemLibraryItemModel::setItemIconPath(const QString &iconPath)
void ItemLibraryItem::setItemIconPath(const QString &iconPath)
{
m_iconPath = iconPath;
}
void ItemLibraryItemModel::setItemIconSize(const QSize &itemIconSize)
void ItemLibraryItem::setItemIconSize(const QSize &itemIconSize)
{
m_iconSize = itemIconSize;
setItemIconPath(m_iconPath);
......
......@@ -37,7 +37,7 @@
namespace QmlDesigner {
class ItemLibraryItemModel: public QObject {
class ItemLibraryItem: public QObject {
Q_OBJECT
......@@ -47,8 +47,8 @@ class ItemLibraryItemModel: public QObject {
Q_PROPERTY(QVariant sortingRole READ sortingRole FINAL)
public:
ItemLibraryItemModel(int itemLibId, const QString &itemName, QObject *parent);
~ItemLibraryItemModel();
ItemLibraryItem(int itemLibId, const QString &itemName, QObject *parent);
~ItemLibraryItem();
int itemLibId() const;
QString itemName() const;
......
......@@ -30,7 +30,7 @@
#include "itemlibrarymodel.h"
#include "itemlibraryinfo.h"
#include "itemlibrarysectionmodel.h"
#include "itemlibraryitemmodel.h"
#include "itemlibraryitem.h"
#include <model.h>
#include <nodemetainfo.h>
......@@ -197,7 +197,7 @@ void ItemLibraryModel::update(ItemLibraryInfo *itemLibraryInfo, Model *model)
|| model->hasImport(entryToImport(entry), true, true))) {
QString itemSectionName = entry.category();
ItemLibrarySectionModel *sectionModel;
ItemLibraryItemModel *itemModel;
ItemLibraryItem *itemModel;
int itemId = m_nextLibId++, sectionId;
if (sections.contains(itemSectionName)) {
......@@ -212,7 +212,7 @@ void ItemLibraryModel::update(ItemLibraryInfo *itemLibraryInfo, Model *model)
m_itemInfos.insert(itemId, entry);
itemModel = new ItemLibraryItemModel(itemId, entry.name(), sectionModel);
itemModel = new ItemLibraryItem(itemId, entry.name(), sectionModel);
// delayed creation of (default) icons
if (entry.iconPath().isEmpty())
......
......@@ -29,7 +29,7 @@
#include "itemlibrarysectionmodel.h"
#include "itemlibraryitemmodel.h"
#include "itemlibraryitem.h"
namespace QmlDesigner {
......@@ -84,7 +84,7 @@ static bool compareFunction(QObject *first, QObject *second)
return first->property(sortRoleName).toString() < second->property(sortRoleName).toString();
}
void ItemLibrarySortedModel::addItem(ItemLibraryItemModel *element, int libId)
void ItemLibrarySortedModel::addItem(ItemLibraryItem *element, int libId)
{
struct order_struct orderEntry;
orderEntry.libId = libId;
......@@ -153,17 +153,17 @@ void ItemLibrarySortedModel::privateRemove(int pos)
m_privList.removeAt(pos);
}
const QMap<int, ItemLibraryItemModel*> &ItemLibrarySortedModel::items() const
const QMap<int, ItemLibraryItem*> &ItemLibrarySortedModel::items() const
{
return m_itemModels;
}
const QList<ItemLibraryItemModel *> &ItemLibrarySortedModel::itemList() const
const QList<ItemLibraryItem *> &ItemLibrarySortedModel::itemList() const
{
return m_itemModels.values();
}
ItemLibraryItemModel *ItemLibrarySortedModel::item(int libId)
ItemLibraryItem *ItemLibrarySortedModel::item(int libId)
{
return m_itemModels.value(libId);
}
......@@ -251,7 +251,7 @@ QVariant ItemLibrarySectionModel::sortingRole() const
return sectionName();
}
void ItemLibrarySectionModel::addSectionEntry(ItemLibraryItemModel *sectionEntry)
void ItemLibrarySectionModel::addSectionEntry(ItemLibraryItem *sectionEntry)
{
m_sectionEntries.addItem(sectionEntry, sectionEntry->itemLibId());
}
......@@ -285,7 +285,7 @@ bool ItemLibrarySectionModel::updateSectionVisibility(const QString &searchText,
*changed = false;
QMap<int, ItemLibraryItemModel*>::const_iterator itemIterator = m_sectionEntries.items().constBegin();
QMap<int, ItemLibraryItem*>::const_iterator itemIterator = m_sectionEntries.items().constBegin();
while (itemIterator != m_sectionEntries.items().constEnd()) {
bool itemVisible = m_sectionEntries.item(itemIterator.key())->itemName().toLower().contains(searchText);
......@@ -311,7 +311,7 @@ bool ItemLibrarySectionModel::updateSectionVisibility(const QString &searchText,
void ItemLibrarySectionModel::updateItemIconSize(const QSize &itemIconSize)
{
foreach (ItemLibraryItemModel* itemLibraryItemModel, m_sectionEntries.itemList()) {
foreach (ItemLibraryItem* itemLibraryItemModel, m_sectionEntries.itemList()) {
itemLibraryItemModel->setItemIconSize(itemIconSize);
}
}
......
......@@ -36,7 +36,7 @@
namespace QmlDesigner {
class ItemLibraryItemModel;
class ItemLibraryItem;
class ItemLibrarySortedModel: public QAbstractListModel {
......@@ -51,7 +51,7 @@ public:
void clearItems();
void addItem(ItemLibraryItemModel *item, int libId);
void addItem(ItemLibraryItem *item, int libId);
void removeItem(int libId);
bool itemVisible(int libId) const;
......@@ -60,10 +60,10 @@ public:
void privateInsert(int pos, QObject *item);
void privateRemove(int pos);
const QMap<int, ItemLibraryItemModel*> &items() const;
const QList<ItemLibraryItemModel*> &itemList() const;
const QMap<int, ItemLibraryItem*> &items() const;
const QList<ItemLibraryItem*> &itemList() const;
ItemLibraryItemModel* item(int libId);
ItemLibraryItem* item(int libId);
int findItem(int libId) const;
int visibleItemPosition(int libId) const;
......@@ -78,7 +78,7 @@ private:
bool visible;
};
QMap<int, ItemLibraryItemModel*> m_itemModels;
QMap<int, ItemLibraryItem*> m_itemModels;
QList<struct order_struct> m_itemOrder;
QList<QObject *> m_privList;
......@@ -102,7 +102,7 @@ public:
bool sectionExpanded() const;
QVariant sortingRole() const;
void addSectionEntry(ItemLibraryItemModel *sectionEntry);
void addSectionEntry(ItemLibraryItem *sectionEntry);
void removeSectionEntry(int itemLibId);
QObject *sectionEntries();
......
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