Commit 3b5b43a7 authored by Camilo Higuita's avatar Camilo Higuita

start using mauikit tagging system

parent c07437c5
......@@ -38,6 +38,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#endif
#include "mauikit/src/mauikit.h"
#include "tagging.h"
QStringList getFolderImages(const QString &path)
{
......@@ -99,6 +100,7 @@ int main(int argc, char *argv[])
pics = openFiles(args);
Pix pix;
Tagging tag;
QQmlApplicationEngine engine;
QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, [&]()
......@@ -111,6 +113,7 @@ int main(int argc, char *argv[])
auto context = engine.rootContext();
context->setContextProperty("pix", &pix);
context->setContextProperty("tag", &tag);
#ifdef STATIC_KIRIGAMI
KirigamiPlugin::getInstance().registerTypes();
......
......@@ -96,7 +96,6 @@ bool DBActions::execQuery(const QString &queryTxt)
bool DBActions::insertPic(const PIX::DB &img)
{
auto url = img[PIX::KEY::URL];
auto title = img[PIX::KEY::TITLE];
auto rate = img[PIX::KEY::RATE];
......@@ -190,12 +189,7 @@ bool DBActions::isFav(const QString &url)
bool DBActions::addTag(const QString &tag)
{
QVariantMap tagMap
{
{PIX::KEYMAP[PIX::KEY::TAG], tag}
};
if(this->insert(PIX::TABLEMAP[PIX::TABLE::TAGS], tagMap))
if (this->tag.tag(tag))
{
emit tagAdded(tag);
return true;
......@@ -206,16 +200,10 @@ bool DBActions::addTag(const QString &tag)
bool DBActions::picTag(const QString &tag, const QString &url)
{
if(!tag.isEmpty() && tag.length() >0 && PIX::fileExists(url))
if(!tag.isEmpty() && PIX::fileExists(url))
{
auto myTag = tag.trimmed();
this->addTag(myTag);
QVariantMap taggedPic
{
{PIX::KEYMAP[PIX::KEY::URL], url},
{PIX::KEYMAP[PIX::KEY::TAG], myTag}
};
return this->insert(PIX::TABLEMAP[PIX::TABLE::IMAGES_TAGS], taggedPic);
return this->tag.tagUrl(url,myTag);
}
return false;
......
......@@ -23,6 +23,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QObject>
#include "db.h"
#include "tagging.h"
class DBActions : public DB
{
......@@ -59,6 +61,9 @@ class DBActions : public DB
Q_INVOKABLE QVariantList getFolders();
Q_INVOKABLE QVariantList get(const QString &queryTxt);
private:
Tagging tag;
signals:
void tagAdded(QString tag);
};
......
......@@ -31,7 +31,6 @@ Row
onItemClicked:
{
console.log(item.btn)
if(item.btn === "love")
pixViewer.currentPicFav = VIEWER.fav(pixViewer.currentPic.url)
......
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