Commit 49e34e92 authored by Camilo higuita's avatar Camilo higuita

fix issue with opening external images

parent b3a7a4af
......@@ -67,6 +67,8 @@ QStringList openFiles(const QStringList &files)
urls.insert(0, QString(files.first()));
}
qDebug()<<"TRYING TO OPEN FILES<<" << urls;
return urls;
}
......
......@@ -132,7 +132,7 @@ bool DBActions::insertPic(const PIX::DB &img)
bool DBActions::addPic(const QString &url)
{
if(!this->checkExistance(PIX::TABLEMAP[PIX::TABLE::IMAGES], PIX::KEYMAP[PIX::KEY::URL],url))
if(!this->checkExistance(PIX::TABLEMAP[PIX::TABLE::IMAGES], PIX::KEYMAP[PIX::KEY::URL], url))
{
QFileInfo info(url);
auto title = info.baseName();
......@@ -147,12 +147,14 @@ bool DBActions::addPic(const QString &url)
{PIX::KEY::RATE, "0"},
{PIX::KEY::COLOR, ""},
{PIX::KEY::SOURCES_URL, sourceUrl},
{PIX::KEY::PIC_DATE, info.created().toString()},
{PIX::KEY::PIC_DATE, info.birthTime().toString()},
{PIX::KEY::FORMAT, format}
};
return this->insertPic(picMap);
}
return false;
}
bool DBActions::removePic(const QString &url)
......@@ -201,8 +203,6 @@ bool DBActions::addTag(const QString &tag)
return false;
}
bool DBActions::albumTag(const QString &tag, const QString &album)
{
this->addTag(tag);
......@@ -276,7 +276,6 @@ QVariantList DBActions::getFolders()
// {"mime", "inode/directory"},
// {"icon", "folder"},
// {"path", i[PIX::KEY::URL]}
// };
}
return res;
......
......@@ -53,7 +53,6 @@ public:
this->go = true;
QMetaObject::invokeMethod(this, "getPics", Q_ARG(QStringList, paths));
}
void nextTrack()
......@@ -65,7 +64,7 @@ public slots:
void getPics(QStringList paths)
{
qDebug()<<"GETTING TRACKS FROM SETTINGS";
qDebug()<<"GETTING IMAGES";
QStringList urls;
......@@ -73,12 +72,16 @@ public slots:
if (QFileInfo(path).isDir())
{
QDirIterator it(path, PIX::formats, QDir::Files, QDirIterator::Subdirectories);
while (it.hasNext()) urls<<it.next();
} else if (QFileInfo(path).isFile()) urls<<path;
while (it.hasNext())
urls << it.next();
}else if (QFileInfo(path).isFile())
urls << path;
int newPics = 0;
if(urls.size()>0)
if(urls.size() > 0)
{
for(auto url : urls)
{
......@@ -92,6 +95,7 @@ public slots:
}
this->t.msleep(100);
emit this->finished(newPics);
this->go = false;
}
......
......@@ -229,7 +229,7 @@ Maui.ApplicationWindow
target: pix
onRefreshViews: PIX.refreshViews()
onViewPics: VIEWER.open(pics, 0)
onViewPics: VIEWER.openExternalPics(pics, 0)
}
Connections
......
......@@ -52,9 +52,12 @@ Pix::Pix(QObject *parent) : DBActions(parent)
connect(this->fileLoader, &FileLoader::finished,[this](int size)
{
emit refreshViews({{PIX::TABLEMAP[TABLE::ALBUMS], true},
Q_UNUSED(size);
emit refreshViews({
{PIX::TABLEMAP[TABLE::ALBUMS], true},
{PIX::TABLEMAP[TABLE::TAGS], true},
{PIX::TABLEMAP[TABLE::IMAGES], true}});
{PIX::TABLEMAP[TABLE::IMAGES], true}
});
});
}
......@@ -88,7 +91,7 @@ void Pix::openPics(const QStringList &pics)
{PIX::KEYMAP[PIX::KEY::RATE], "0"},
{PIX::KEYMAP[PIX::KEY::COLOR], ""},
{PIX::KEYMAP[PIX::KEY::SOURCES_URL], sourceUrl},
{PIX::KEYMAP[PIX::KEY::PIC_DATE], info.created().toString()},
{PIX::KEYMAP[PIX::KEY::PIC_DATE], info.birthTime().toString()},
{PIX::KEYMAP[PIX::KEY::FORMAT], format}
};
......@@ -115,15 +118,12 @@ void Pix::populateDB(const QStringList &paths)
QStringList newPaths;
for(auto path : paths)
{
if(path.startsWith("file://"))
newPaths << path.replace("file://", "");
else
newPaths<<path;
newPaths << path;
qDebug()<<"paths to scan"<<newPaths;
}
fileLoader->requestPath(newPaths);
}
......
......@@ -4,8 +4,8 @@
function open(model, index)
{
pixViewer.roll.rollList.model = model
pixViewer.viewer.list.model = model
pixViewer.roll.rollList.model = pixViewer.viewer.list.model
view(index)
......@@ -14,6 +14,15 @@ function open(model, index)
}
function openExternalPics(pics, index)
{
pixViewer.viewer.populate(pics)
pixViewer.roll.rollList.model = pixViewer.viewer.list.model
view(index)
if(currentView !== views.viewer)
currentView = views.viewer
}
function view(index)
{
pixViewer.currentPicIndex = index
......
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