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