Commit 5c96930b authored by Camilo Higuita's avatar Camilo Higuita

moving foward MauiKit shared tagging system

parent e81c56a9
......@@ -112,6 +112,7 @@ int main(int argc, char *argv[])
auto context = engine.rootContext();
context->setContextProperty("pix", &pix);
context->setContextProperty("tag", pix.tag);
#ifdef STATIC_KIRIGAMI
KirigamiPlugin::getInstance().registerTypes();
......
......@@ -28,44 +28,45 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
class DBActions : public DB
{
Q_OBJECT
public:
explicit DBActions(QObject *parent = nullptr);
~DBActions();
Q_OBJECT
public:
explicit DBActions(QObject *parent = nullptr);
~DBActions();
PIX::DB_LIST getDBData(const QString &queryTxt);
Tagging *tag;
bool execQuery(const QString &queryTxt);
PIX::DB_LIST getDBData(const QString &queryTxt);
bool insertPic(const PIX::DB &img);
Q_INVOKABLE bool addPic(const QString &url);
Q_INVOKABLE bool removePic(const QString &url);
bool execQuery(const QString &queryTxt);
/* actions on model */
Q_INVOKABLE bool favPic(const QString &url, const bool &fav);
Q_INVOKABLE bool isFav(const QString &url);
bool insertPic(const PIX::DB &img);
Q_INVOKABLE bool addPic(const QString &url);
Q_INVOKABLE bool removePic(const QString &url);
Q_INVOKABLE bool addTag(const QString &tag);
Q_INVOKABLE bool picTag(const QString &tag, const QString &url);
Q_INVOKABLE bool albumTag(const QString &tag, const QString &album);
Q_INVOKABLE bool removePicTag(const QString &tag, const QString &url);
Q_INVOKABLE bool removeAlbumTag(const QString &tag, const QString &album);
Q_INVOKABLE bool cleanTags();
/* actions on model */
Q_INVOKABLE bool favPic(const QString &url, const bool &fav);
Q_INVOKABLE bool isFav(const QString &url);
Q_INVOKABLE bool addAlbum(const QString &album);
Q_INVOKABLE bool picAlbum(const QString &album, const QString &url);
Q_INVOKABLE bool addTag(const QString &tag);
Q_INVOKABLE bool picTag(const QString &tag, const QString &url);
Q_INVOKABLE bool albumTag(const QString &tag, const QString &album);
Q_INVOKABLE bool removePicTag(const QString &tag, const QString &url);
Q_INVOKABLE bool removeAlbumTag(const QString &tag, const QString &album);
Q_INVOKABLE bool cleanTags();
Q_INVOKABLE bool addAlbum(const QString &album);
Q_INVOKABLE bool picAlbum(const QString &album, const QString &url);
Q_INVOKABLE QVariantList searchFor(const QStringList &queries, const QString &queryTxt);
/* utils */
Q_INVOKABLE QVariantList getFolders();
Q_INVOKABLE QVariantList get(const QString &queryTxt);
Q_INVOKABLE QVariantList searchFor(const QStringList &queries, const QString &queryTxt);
/* utils */
Q_INVOKABLE QVariantList getFolders();
Q_INVOKABLE QVariantList get(const QString &queryTxt);
private:
Tagging *tag;
signals:
void tagAdded(QString tag);
void tagAdded(QString tag);
};
#endif // DBACTIONS_H
......@@ -34,11 +34,9 @@ ListView
}
}
function populate(query)
function populate(tags)
{
model.clear()
var tags = pix.get(query)
if(tags.length > 0)
for(var i in tags)
model.append(tags[i])
......
......@@ -54,7 +54,7 @@ PixDialog
for(var i in tags)
{
var tag = tags[i].trim()
if(!pix.checkExistance("tags", "tag", tag))
if(!tag.tagExists(tag, true))
{
tagsList.model.insert(0, {tag: tag})
tagListComposer.model.insert(0, {tag: tag})
......@@ -129,14 +129,14 @@ PixDialog
function populate()
{
tagsList.model.clear()
var tags = pix.get(Q.Query.allTags)
var tags = tag.getUrlsTags()
if(tags.length > 0)
for(var i in tags)
tagsList.model.append(tags[i])
tagListComposer.populate(forAlbum ? Q.Query.albumTags_.arg(picUrl) :
Q.Query.picTags_.arg(picUrl))
tagListComposer.populate(forAlbum ? tag.getAbstractTags("album", picUrl, true) :
tag.getUrlTags(picUrl, true))
}
}
......@@ -132,7 +132,7 @@ Kirigami.PageRow
populateAlbum(Q.Query.allAlbumPics_.arg(album))
footerBar.visible = true
tagBar.tagsList.populate(Q.Query.albumTags_.arg(album))
tagBar.tagsList.populate(tag.getAbstractTags("album", album, true))
break
}
}
......
......@@ -39,7 +39,7 @@ Kirigami.PageRow
function populate()
{
tagsSidebar.list.model.clear()
var tags = pix.get(Q.Query.allTags)
var tags = tag.getUrlsTags(true)
if(tags.length > 0)
for(var i in tags)
......@@ -47,14 +47,14 @@ Kirigami.PageRow
}
function populateGrid(tag)
function populateGrid(myTag)
{
if(!wideMode && currentIndex === 0)
currentIndex = 1
tagsGrid.grid.model.clear()
var tags = pix.get(Q.Query.tagPics_.arg(tag))
var tags = tag.getUrls(myTag);
if(tags.length > 0)
for(var i in tags)
......
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