Commit f6cec96b authored by Gilles Caulier's avatar Gilles Caulier 🗼

Merge branch 'master' of invent.kde.org:kde/digikam

parents 2fe47153 4946f6e1
Pipeline #10655 canceled with stage
......@@ -29,16 +29,16 @@
// Qt includes
#include <QString>
#include <QDateTime>
#include <QUrl>
#include <QList>
#include <QSize>
#include <QUrl>
#include <QString>
#include <QDateTime>
#include <QExplicitlySharedDataPointer>
// Local includes
#include "digikam_export.h"
#include "dshareddata.h"
#include "coredbalbuminfo.h"
#include "coredburl.h"
#include "coredbfields.h"
......@@ -528,7 +528,7 @@ private:
friend class ItemInfoCache;
friend class ItemInfoList;
DSharedDataPointer<ItemInfoData> m_data;
QExplicitlySharedDataPointer<ItemInfoData> m_data;
};
inline uint qHash(const ItemInfo& info)
......
......@@ -65,12 +65,12 @@ ItemInfoCache::~ItemInfoCache()
}
template <class T>
DSharedDataPointer<T> toStrongRef(T* weakRef)
QExplicitlySharedDataPointer<T> toStrongRef(T* weakRef)
{
// Called under read lock
if (!weakRef)
{
return DSharedDataPointer<T>();
return QExplicitlySharedDataPointer<T>();
}
// The weak ref is a data object which is not deleted
// (because deletion is done under mutex protection)
......@@ -88,11 +88,11 @@ DSharedDataPointer<T> toStrongRef(T* weakRef)
{
// drop weakRef
weakRef->ref.deref();
return DSharedDataPointer<T>();
return QExplicitlySharedDataPointer<T>();
}
// Convert to a strong reference. Will ref() the weakRef once again
DSharedDataPointer<ItemInfoData> ptr(weakRef);
QExplicitlySharedDataPointer<ItemInfoData> ptr(weakRef);
// decrease counter, which we incremented twice now
weakRef->ref.deref();
......@@ -132,11 +132,11 @@ int ItemInfoCache::getImageGroupedCount(qlonglong id)
return m_grouped.count(id);
}
DSharedDataPointer<ItemInfoData> ItemInfoCache::infoForId(qlonglong id)
QExplicitlySharedDataPointer<ItemInfoData> ItemInfoCache::infoForId(qlonglong id)
{
{
ItemInfoReadLocker lock;
DSharedDataPointer<ItemInfoData> ptr = toStrongRef(m_infos.value(id));
QExplicitlySharedDataPointer<ItemInfoData> ptr = toStrongRef(m_infos.value(id));
if (ptr)
{
......@@ -149,7 +149,7 @@ DSharedDataPointer<ItemInfoData> ItemInfoCache::infoForId(qlonglong id)
data->id = id;
m_infos[id] = data;
return DSharedDataPointer<ItemInfoData>(data);
return QExplicitlySharedDataPointer<ItemInfoData>(data);
}
void ItemInfoCache::cacheByName(ItemInfoData* const data)
......@@ -167,7 +167,8 @@ void ItemInfoCache::cacheByName(ItemInfoData* const data)
m_dataHash.insert(data, data->name);
}
DSharedDataPointer<ItemInfoData> ItemInfoCache::infoForPath(int albumRootId, const QString& relativePath, const QString& name)
QExplicitlySharedDataPointer<ItemInfoData> ItemInfoCache::infoForPath(int albumRootId,
const QString& relativePath, const QString& name)
{
ItemInfoReadLocker lock;
// We check all entries in the multi hash with matching file name
......@@ -193,7 +194,7 @@ DSharedDataPointer<ItemInfoData> ItemInfoCache::infoForPath(int albumRootId, con
return toStrongRef(it.value());
}
return DSharedDataPointer<ItemInfoData>();
return QExplicitlySharedDataPointer<ItemInfoData>();
}
void ItemInfoCache::dropInfo(ItemInfoData* const infodata)
......@@ -210,7 +211,6 @@ void ItemInfoCache::dropInfo(ItemInfoData* const infodata)
m_nameHash.remove(m_dataHash.value(infodata), infodata);
m_nameHash.remove(infodata->name, infodata);
m_dataHash.remove(infodata);
delete infodata;
}
QList<AlbumShortInfo>::const_iterator ItemInfoCache::findAlbum(int id)
......@@ -253,7 +253,7 @@ void ItemInfoCache::invalidate()
for (it = m_infos.begin() ; it != m_infos.end() ; ++it)
{
if ((*it)->isReferenced())
if ((*it)->ref > 0)
{
(*it)->invalid = true;
(*it)->id = -1;
......
......@@ -27,14 +27,14 @@
// Qt includes
#include <QMultiHash>
#include <QHash>
#include <QObject>
#include <QMultiHash>
#include <QExplicitlySharedDataPointer>
// Local includes
#include "coredbwatch.h"
#include "dshareddata.h"
namespace Digikam
{
......@@ -57,7 +57,7 @@ public:
* A new object is created, or an existing object is returned.
* If a new object is created, the id field will be initialized.
*/
DSharedDataPointer<ItemInfoData> infoForId(qlonglong id);
QExplicitlySharedDataPointer<ItemInfoData> infoForId(qlonglong id);
/**
* Call this when the data has been dereferenced,
......@@ -77,7 +77,8 @@ public:
* Works if previously cached with cacheByName.
* Returns 0 if not found.
*/
DSharedDataPointer<ItemInfoData> infoForPath(int albumRootId, const QString& relativePath, const QString& name);
QExplicitlySharedDataPointer<ItemInfoData> infoForPath(int albumRootId,
const QString& relativePath, const QString& name);
/**
* Returns the cached relativePath for the given album id.
......@@ -110,10 +111,10 @@ private:
QHash<qlonglong, ItemInfoData*> m_infos;
QHash<ItemInfoData*, QString> m_dataHash;
QMultiHash<QString, ItemInfoData*> m_nameHash;
volatile bool m_needUpdateAlbums;
volatile bool m_needUpdateGrouped;
QList<qlonglong> m_grouped;
QList<AlbumShortInfo> m_albums;
volatile bool m_needUpdateAlbums;
volatile bool m_needUpdateGrouped;
QList<qlonglong> m_grouped;
QList<AlbumShortInfo> m_albums;
};
} // namespace Digikam
......
......@@ -28,17 +28,17 @@
// Qt includes
#include <QDateTime>
#include <QList>
#include <QSize>
#include <QDateTime>
#include <QSharedData>
#include <QReadWriteLock>
#include <QReadLocker>
#include <QWriteLocker>
#include <QReadLocker>
// Local includes
#include "coredburl.h"
#include "dshareddata.h"
#include "coredbalbuminfo.h"
#include "iteminfocache.h"
......@@ -57,7 +57,7 @@ public:
public:
ItemInfoCache m_cache;
QReadWriteLock m_lock;
QReadWriteLock m_lock;
static ItemInfoStatic* m_instance;
};
......@@ -88,7 +88,7 @@ public:
// -----------------------------------------------------------------------------------
class ItemInfoData : public DSharedData
class ItemInfoData : public QSharedData
{
public:
......
......@@ -283,14 +283,11 @@ ItemDescEditTab::ItemDescEditTab(QWidget* const parent)
d->tagModel->setRootCheckable(false);
d->tagCheckView = new TagCheckView(tagsArea, d->tagModel);
d->tagCheckView->setCheckNewTags(true);
d->tagCheckView->filteredModel()->doNotListTagsWithProperty(TagPropertyName::person());
d->tagCheckView->filteredModel()->setFilterBehavior(AlbumFilterModel::StrictFiltering);
d->openTagMngr = new QPushButton( i18n("Open Tag Manager"));
d->newTagEdit = new AddTagsLineEdit(tagsArea);
d->newTagEdit->setSupportingTagModel(d->tagModel);
d->newTagEdit->setFilterModel(d->tagCheckView->filteredModel());
d->newTagEdit->setTagTreeView(d->tagCheckView);
//, "ItemDescEditTabNewTagEdit",
//d->newTagEdit->setCaseSensitive(false);
......
......@@ -34,7 +34,6 @@
#include "tagscache.h"
#include "coredbaccess.h"
#include "coredb.h"
#include "facetags.h"
namespace Digikam
{
......@@ -241,9 +240,7 @@ QList<TaggingAction> TaggingActionFactory::actions() const
}
actions << newUnderParent;
//Don't need to add top level for face tags
if (d->parentTagId != FaceTags::personParentTag())
actions << newToplevel;
actions << newToplevel;
}
else // if (createItemTopLevel && createItemTopLevel->action() == defaultAction)
{
......@@ -394,7 +391,7 @@ QString TaggingActionFactory::suggestedUIString(const TaggingAction& action) con
}
else // shallCreateNewTag
{
if (action.parentTagId() && d->parentTagId != FaceTags::personParentTag())
if (action.parentTagId())
{
return i18nc("Create New Tag <tag name> in <parent tag path>", "Create \"%1\" in %2",
action.newTagName(), TagsCache::instance()->tagPath(action.parentTagId(), TagsCache::NoLeadingSlash));
......
......@@ -194,9 +194,6 @@ void TagsManager::setupUi()
d->tagMngrView = new TagMngrTreeView(this, d->tagModel);
d->tagMngrView->setConfigGroup(getConfigGroup());
d->tagMngrView->getFilterModel()->doNotListTagsWithProperty(TagPropertyName::person());
d->tagMngrView->getFilterModel()->setFilterBehavior(AlbumFilterModel::StrictFiltering);
d->searchBar = new SearchTextBar(this, QLatin1String("ItemIconViewTagSearchBar"));
d->searchBar->setHighlightOnResult(true);
d->searchBar->setModel(d->tagMngrView->filteredModel(),
......
......@@ -144,14 +144,24 @@ void TagFolderView::addCustomContextMenuActions(ContextMenuHelper& cmh, Album* a
cmh.addExportMenu();
cmh.addSeparator();
if (tag->id() != FaceTags::unconfirmedPersonTagId() &&
tag->id() != FaceTags::unknownPersonTagId())
if (d->showDeleteFaceTagsAction)
{
cmh.addActionDeleteFaceTag(tagModificationHelper(), tag);
cmh.addSeparator();
}
else
{
cmh.addActionDeleteTag(tagModificationHelper(), tag);
cmh.addSeparator();
cmh.addActionEditTag(tagModificationHelper(), tag);
// If the tag is no face tag, add the option to set it as face tag.
if (!FaceTags::isPerson(tag->id()) && !tag->isRoot())
{
cmh.addActionTagToFaceTag(tagModificationHelper(), tag);
}
}
cmh.addActionEditTag(tagModificationHelper(), tag);
connect(&cmh, SIGNAL(signalAddNewTagFromABCMenu(QString)),
this, SLOT(slotTagNewFromABCMenu(QString)));
......
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