Commit 908277d9 authored by Camilo higuita's avatar Camilo higuita

now can view cloud images with better cloud modeling list

parent 88f509ac
#include "cloud.h"
#ifdef Q_OS_ANDROID
#include "fm.h"
#include "fmh.h"
#else
#include <MauiKit/fm.h>
#include <MauiKit/fmh.h>
#endif
Cloud::Cloud(QObject *parent) : BaseList (parent)
{
this->fm = FM::getInstance();
this->setList();
// connect(this->fm, &FM::cloudServerContentReady, [](const FMH::MODEL_LIST &list, const QString &url)
// {
//// Q_UNUSED(url);
//// emit this->preListChanged();
//// this->list = list;
//// emit this->postListChanged();
// });
connect(this->fm, &FM::cloudServerContentReady, [this](const FMH::MODEL_LIST &list, const QString &url)
{
Q_UNUSED(url);
emit this->preListChanged();
this->list = list;
this->formatList();
emit this->postListChanged();
});
}
FMH::MODEL_LIST Cloud::items() const
......@@ -46,7 +38,21 @@ QString Cloud::getAccount() const
void Cloud::setList()
{
this->fm->getCloudServerContent(FMH::PATHTYPE_NAME[FMH::PATHTYPE_KEY::CLOUD_PATH]+"/"+this->account, QStringList(), 3);
this->fm->getCloudServerContent(FMH::PATHTYPE_NAME[FMH::PATHTYPE_KEY::CLOUD_PATH]+"/"+this->account, FMH::FILTER_LIST[FMH::FILTER_TYPE::IMAGE], 3);
}
void Cloud::formatList()
{
for(auto &item : this->list)
{
auto url = item[FMH::MODEL_KEY::URL];
auto thumbnail = item[FMH::MODEL_KEY::THUMBNAIL];
item[FMH::MODEL_KEY::FAV] = QString("0");
item[FMH::MODEL_KEY::URL] = thumbnail;
item[FMH::MODEL_KEY::SOURCE] = url;
item[FMH::MODEL_KEY::TITLE] = item[FMH::MODEL_KEY::LABEL];
}
}
QVariantMap Cloud::get(const int &index) const
......
......@@ -11,8 +11,17 @@ class Cloud : public BaseList
Q_PROPERTY(QString account READ getAccount WRITE setAccount NOTIFY accountChanged)
public:
explicit Cloud(QObject *parent = nullptr);
// ~Cloud();
enum SORTBY : uint_fast8_t
{
SIZE = FMH::MODEL_KEY::SIZE,
MODIFIED = FMH::MODEL_KEY::MODIFIED,
DATE = FMH::MODEL_KEY::DATE,
LABEL = FMH::MODEL_KEY::LABEL,
MIME = FMH::MODEL_KEY::MIME
}; Q_ENUM(SORTBY)
explicit Cloud(QObject *parent = nullptr);
FMH::MODEL_LIST items() const override;
void setAccount(const QString value);
......@@ -21,6 +30,7 @@ public:
private:
FMH::MODEL_LIST list;
void setList();
void formatList();
QString account;
FM *fm;
......
......@@ -123,7 +123,7 @@ ItemDelegate
{
visible: img.status !== Image.Ready
iconName: "image-x-generic"
size: iconSizes.huge
size: Math.min(picSize, iconSizes.huge)
isMask: false
anchors.centerIn: parent
......
......@@ -6,10 +6,8 @@ import "../Viewer/Viewer.js" as VIEWER
import "../Pix.js" as PIX
import "../../../view_models"
//import CloudList 1.0
import FMList 1.0
import FMModel 1.0
import CloudList 1.0
import PixModel 1.0
PixGrid
{
......@@ -56,7 +54,7 @@ PixGrid
if(selectionMode)
PIX.selectItem(pixList.get(index))
else if(isMobile)
control.openPic(index)
console.log(_cloudList.get(index).url)
}
onDoubleClicked:
......@@ -65,7 +63,7 @@ PixGrid
//picClicked(index)
if(!isMobile)
control.openPic(index)
VIEWER.open(_cloudList, index)
// else
// selectionBox.append(gridModel.get(index))
......@@ -92,18 +90,16 @@ PixGrid
}
FMModel
PixModel
{
id: _cloudModel
list: _cloudList
}
FMList
CloudList
{
id: _cloudList
path: "Cloud/"+currentAccount
filterType: FMList.IMAGE
cloudDepth: 3
account: currentAccount
}
grid.model: _cloudModel
......
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