digiKam
|
Classes | |
class | Item |
Public Types | |
enum | Category { CategoryLocal = 0 , CategoryRemovable = 1 , CategoryRemote = 2 , NumberOfCategories } |
enum | Columns { ColumnStatus = 0 , ColumnName = 1 , ColumnPath = 2 , ColumnUpdateButton = 3 , ColumnDeleteButton = 4 , NumberOfColumns } |
enum | SetupCollectionDataRole { IsCategoryRole = Qt::UserRole , CategoryButtonDisplayRole = Qt::UserRole + 1 , CategoryButtonMapId = Qt::UserRole + 2 , IsUpdateRole = Qt::UserRole + 3 , UpdateDecorationRole = Qt::UserRole + 4 , UpdateMapId = Qt::UserRole + 5 , IsDeleteRole = Qt::UserRole + 6 , DeleteDecorationRole = Qt::UserRole + 7 , DeleteMapId = Qt::UserRole + 8 } |
Public Slots | |
void | slotCategoryButtonPressed (int mappedId) |
void | slotDeletePressed (int mappedId) |
void | slotUpdatePressed (int mappedId) |
Signals | |
void | collectionsLoaded () |
Emitted when all collections were loaded and the model reset in loadCollections. More... | |
Public Member Functions | |
void | apply () |
Apply the changed settings to CollectionManager. More... | |
QList< QModelIndex > | categoryIndexes () const |
int | columnCount (const QModelIndex &parent=QModelIndex()) const override |
QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const override |
QAbstractItemModel implementation. More... | |
Qt::ItemFlags | flags (const QModelIndex &index) const override |
QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override |
QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const override |
QModelIndex | indexForCategory (Category category) const |
void | loadCollections () |
Read collections from CollectionManager. More... | |
QModelIndex | parent (const QModelIndex &index) const override |
int | rowCount (const QModelIndex &parent=QModelIndex()) const override |
bool | setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override |
void | setParentWidgetForDialogs (QWidget *const widget) |
Set a widget used as parent for dialogs and message boxes. More... | |
SetupCollectionModel (QObject *const parent=nullptr) | |
~SetupCollectionModel () override | |
Protected Slots | |
void | addCollection (int category) |
void | deleteCollection (int internalId) |
void | updateCollection (int internalId) |
Protected Member Functions | |
bool | askForNewCollectionCategory (int *const category) |
bool | askForNewCollectionPath (int category, QString *const newPath, QString *const newLabel) |
int | buttonMapId (const QModelIndex &index) const |
int | categoryButtonMapId (const QModelIndex &index) const |
QModelIndex | indexForId (int id, int column) const |
Static Protected Member Functions | |
static Category | typeToCategory (CollectionLocation::Type type) |
Protected Attributes | |
QList< Item > | m_collections |
QWidget * | m_dialogParentWidget |
SetupCollectionModel is a model specialized for use in SetupCollectionTreeView. It provides a reads the current collections from CollectionManager, displays them in three categories, and supports adding and removing collections
|
explicit |
Internal data structure:
The category entries get a model index with INTERNALID and are identified by their row(). The item entries get the index in m_collections as INTERNALID. No item is ever removed from m_collections, deleted entries are only marked as such.
Items have a location, a parentId, and a name and label field. parentId always contains the category, needed to implement parent(). The location is the location if it exists, or is null if the item was added. Name and label are null if unchanged, then the values from location are used. They are valid if edited (label) or the location was added (both valid, location null).
|
override |
|
protectedslot |
References askForNewCollectionPath(), indexForCategory(), m_collections, NumberOfCategories, parent(), and rowCount().
Referenced by slotCategoryButtonPressed().
void Digikam::SetupCollectionModel::apply | ( | ) |
Apply the changed settings to CollectionManager.
References Digikam::CollectionManager::addLocation(), Digikam::CollectionManager::addNetworkLocation(), CategoryRemote, CategoryRemovable, Digikam::SetupCollectionModel::Item::deleted, Digikam::CollectionManager::instance(), Digikam::CollectionLocation::isNull(), Digikam::CollectionLocation::label(), Digikam::SetupCollectionModel::Item::label, Digikam::RedEye::location(), Digikam::SetupCollectionModel::Item::location, m_collections, m_dialogParentWidget, Digikam::SetupCollectionModel::Item::parentId, Digikam::SetupCollectionModel::Item::path, Digikam::CollectionManager::refreshLocation(), Digikam::CollectionManager::removeLocation(), Digikam::CollectionManager::setLabel(), Digikam::DMessageBox::showInformationList(), Digikam::MaintenanceTool::start(), Digikam::CollectionLocation::TypeNetwork, Digikam::CollectionLocation::TypeVolumeHardWired, Digikam::CollectionLocation::TypeVolumeRemovable, and Digikam::SetupCollectionModel::Item::updated.
|
protected |
References CategoryLocal, CategoryRemote, CategoryRemovable, and m_dialogParentWidget.
Referenced by updateCollection().
|
protected |
References CategoryRemote, Digikam::CollectionManager::checkLocation(), Digikam::CollectionManager::checkNetworkLocation(), Digikam::SetupCollectionModel::Item::deleted, Digikam::DFileDialog::getExistingDirectoryUrl(), Digikam::CollectionManager::instance(), Digikam::CollectionLocation::isNull(), Digikam::SetupCollectionModel::Item::location, Digikam::CollectionManager::LocationAllRight, Digikam::CollectionManager::LocationHasProblems, Digikam::CollectionManager::LocationInvalidCheck, Digikam::CollectionManager::LocationNotAllowed, m_collections, m_dialogParentWidget, and Digikam::SetupCollectionModel::Item::path.
Referenced by addCollection(), and updateCollection().
|
protected |
References index(), and INTERNALID.
Referenced by data().
|
protected |
References index(), and INTERNALID.
Referenced by data().
QList< QModelIndex > Digikam::SetupCollectionModel::categoryIndexes | ( | ) | const |
References index(), and NumberOfCategories.
Referenced by Digikam::SetupCollectionDelegate::sizeHint().
|
signal |
Emitted when all collections were loaded and the model reset in loadCollections.
Referenced by loadCollections().
|
override |
|
override |
QAbstractItemModel implementation.
References Digikam::CollectionLocation::albumRootPath(), buttonMapId(), CategoryButtonDisplayRole, CategoryButtonMapId, categoryButtonMapId(), CategoryLocal, CategoryRemote, CategoryRemovable, ColumnDeleteButton, ColumnName, ColumnPath, ColumnStatus, ColumnUpdateButton, Digikam::SetupCollectionModel::Item::deleted, DeleteDecorationRole, DeleteMapId, index(), INTERNALID, IsCategoryRole, IsDeleteRole, Digikam::CollectionLocation::isNull(), IsUpdateRole, Digikam::CollectionLocation::label(), Digikam::SetupCollectionModel::Item::label, Digikam::SetupCollectionModel::Item::location, Digikam::CollectionLocation::LocationAvailable, Digikam::CollectionLocation::LocationDeleted, Digikam::CollectionLocation::LocationHidden, Digikam::CollectionLocation::LocationNull, Digikam::CollectionLocation::LocationUnavailable, m_collections, Digikam::SetupCollectionModel::Item::parentId, Digikam::SetupCollectionModel::Item::path, Digikam::CollectionLocation::status(), Digikam::SetupCollectionModel::Item::updated, UpdateDecorationRole, and UpdateMapId.
Referenced by deleteCollection().
|
protectedslot |
References ColumnName, ColumnStatus, data(), Digikam::SetupCollectionModel::Item::deleted, index(), indexForId(), m_collections, m_dialogParentWidget, and parent().
Referenced by slotDeletePressed().
|
override |
References ColumnName, index(), and INTERNALID.
|
override |
References ColumnDeleteButton, ColumnName, ColumnPath, ColumnStatus, ColumnUpdateButton, and NumberOfColumns.
|
override |
References Digikam::SetupCollectionModel::Item::deleted, INTERNALID, m_collections, NumberOfCategories, parent(), Digikam::SetupCollectionModel::Item::parentId, and rowCount().
Referenced by buttonMapId(), categoryButtonMapId(), categoryIndexes(), data(), deleteCollection(), flags(), indexForCategory(), Digikam::SetupCollectionTreeView::modelLoadedCollections(), parent(), setData(), and updateCollection().
QModelIndex Digikam::SetupCollectionModel::indexForCategory | ( | Category | category | ) | const |
References index().
Referenced by addCollection(), and Digikam::SetupCollectionTreeView::modelLoadedCollections().
|
protected |
References Digikam::SetupCollectionModel::Item::deleted, m_collections, and Digikam::SetupCollectionModel::Item::parentId.
Referenced by deleteCollection(), and updateCollection().
void Digikam::SetupCollectionModel::loadCollections | ( | ) |
Read collections from CollectionManager.
References Digikam::CollectionManager::allLocations(), collectionsLoaded(), Digikam::CollectionManager::instance(), Digikam::RedEye::location(), and m_collections.
|
override |
References index(), INTERNALID, m_collections, and Digikam::SetupCollectionModel::Item::parentId.
Referenced by addCollection(), deleteCollection(), index(), and rowCount().
|
override |
References Digikam::SetupCollectionModel::Item::deleted, INTERNALID, m_collections, NumberOfCategories, parent(), and Digikam::SetupCollectionModel::Item::parentId.
Referenced by addCollection(), and index().
|
override |
References ColumnName, index(), INTERNALID, Digikam::SetupCollectionModel::Item::label, m_collections, and value.
void Digikam::SetupCollectionModel::setParentWidgetForDialogs | ( | QWidget *const | widget | ) |
Set a widget used as parent for dialogs and message boxes.
References m_dialogParentWidget.
Referenced by Digikam::SetupCollectionTreeView::setModel().
|
slot |
Forward category button clicked signals to this slot. mappedId is retrieved with the CategoryButtonMapId role for the model index of the button
References addCollection().
|
slot |
References deleteCollection().
|
slot |
Forward button clicked signals to this slot. mappedId is retrieved with the ButtonMapId role for the model index of the button
References updateCollection().
|
staticprotected |
|
protectedslot |
References Digikam::CollectionLocation::albumRootPath(), askForNewCollectionCategory(), askForNewCollectionPath(), ColumnStatus, Digikam::SetupCollectionModel::Item::deleted, index(), indexForId(), Digikam::CollectionLocation::isNull(), Digikam::SetupCollectionModel::Item::label, Digikam::SetupCollectionModel::Item::location, m_collections, Digikam::SetupCollectionModel::Item::parentId, Digikam::SetupCollectionModel::Item::path, and Digikam::SetupCollectionModel::Item::updated.
Referenced by slotUpdatePressed().
Referenced by addCollection(), apply(), askForNewCollectionPath(), data(), deleteCollection(), index(), indexForId(), loadCollections(), parent(), rowCount(), setData(), and updateCollection().
|
protected |
Referenced by apply(), askForNewCollectionCategory(), askForNewCollectionPath(), deleteCollection(), and setParentWidgetForDialogs().