Commit 5e0d9ebf authored by Camilo higuita's avatar Camilo higuita

push updates towards RC

parent 3a6588a8
......@@ -53,7 +53,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "./src/models/baselist.h"
#include "./src/models/gallery/gallery.h"
#include "./src/models/albums/albums.h"
#include "./src/models/cloud/cloud.h"
//#include "./src/models/cloud/cloud.h"
#include "./src/models/folders/foldermodel.h"
#include "./src/models/folders/folders.h"
......@@ -145,7 +145,7 @@ int main(int argc, char *argv[])
qmlRegisterType<Albums>("AlbumsList", 1, 0, "AlbumsList");
qmlRegisterType<FolderModel>("FolderModel", 1, 0, "FolderModel");
qmlRegisterType<Folders>("FoldersList", 1, 0, "FoldersList");
qmlRegisterType<Cloud>("CloudList", 1, 0, "CloudList");
// qmlRegisterType<Cloud>("CloudList", 1, 0, "CloudList");
#ifdef STATIC_KIRIGAMI
KirigamiPlugin::getInstance().registerTypes();
......
......@@ -69,10 +69,8 @@ bool DBActions::insertPic(const FMH::MODEL &img)
auto rate = img[FMH::MODEL_KEY::RATE];
auto fav = img[FMH::MODEL_KEY::FAV];
auto color = img[FMH::MODEL_KEY::COLOR];
auto addDate = img[FMH::MODEL_KEY::ADDDATE];
auto sourceUrl = img[FMH::MODEL_KEY::SOURCE];
auto picDate = img[FMH::MODEL_KEY::DATE];
auto place = img[FMH::MODEL_KEY::PLACE];
auto format = img[FMH::MODEL_KEY::FORMAT];
qDebug()<< "writting to db: "<<title<<url;
......@@ -89,8 +87,8 @@ bool DBActions::insertPic(const FMH::MODEL &img)
{FMH::MODEL_NAME[FMH::MODEL_KEY::COLOR], color},
{FMH::MODEL_NAME[FMH::MODEL_KEY::FORMAT], format},
{FMH::MODEL_NAME[FMH::MODEL_KEY::DATE], picDate},
{FMH::MODEL_NAME[FMH::MODEL_KEY::PLACE], place},
{FMH::MODEL_NAME[FMH::MODEL_KEY::ADDDATE], QDateTime::currentDateTime()}};
{FMH::MODEL_NAME[FMH::MODEL_KEY::PLACE], QString()},
{FMH::MODEL_NAME[FMH::MODEL_KEY::ADDDATE], QDateTime::currentDateTime().toString(Qt::TextDate)}};
return this->insert(PIX::TABLEMAP[PIX::TABLE::IMAGES], imgMap);
......@@ -113,7 +111,7 @@ bool DBActions::addPic(const QString &url)
{FMH::MODEL_KEY::RATE, "0"},
{FMH::MODEL_KEY::COLOR, ""},
{FMH::MODEL_KEY::SOURCE, sourceUrl},
{FMH::MODEL_KEY::DATE, info.birthTime().toString()},
{FMH::MODEL_KEY::DATE, info.birthTime().toString(Qt::TextDate)},
{FMH::MODEL_KEY::FORMAT, format}
};
......
......@@ -62,7 +62,7 @@ Maui.ApplicationWindow
{
id: root
title: qsTr("Pix")
showAccounts: false
// visibility: fullScreen ? ApplicationWindow.FullScreen : ApplicationWindow.Windowed
// altToolBars: true
about.appDescription: qsTr("Pix is an image gallery manager made for Maui. Pix is a convergent and multiplatform app that works under Android and GNU Linux distros.")
......@@ -76,9 +76,9 @@ Maui.ApplicationWindow
folders: 2,
albums: 3,
tags: 4,
cloud: 5,
store: 6,
search: 7
// cloud: 5,
// store: 6,
search: 5
})
/*PROPS*/
......@@ -115,21 +115,21 @@ Maui.ApplicationWindow
// menuDrawer.bannerImageSource: "qrc:/img/assets/banner.png"
mainMenu: [
Maui.MenuItem
{
id: _storeButton
text: qsTr("Store")
onTriggered: currentView = views.store
icon.name: "nx-software-center"
},
Maui.MenuItem
{
id: _cloudButton
text: qsTr("Cloud")
onTriggered: currentView = views.cloud
icon.name: "folder-cloud"
},
// Maui.MenuItem
// {
// id: _storeButton
// text: qsTr("Store")
// onTriggered: currentView = views.store
// icon.name: "nx-software-center"
// },
// Maui.MenuItem
// {
// id: _cloudButton
// text: qsTr("Cloud")
// onTriggered: currentView = views.cloud
// icon.name: "folder-cloud"
// },
Maui.MenuItem
{
......@@ -148,7 +148,12 @@ Maui.ApplicationWindow
onTriggered:
{
dialogLoader.sourceComponent= fmDialogComponent
dialog.show()
dialog.mode= dialog.modes.OPEN
dialog.onlyDirs= true
dialog.show(function(paths)
{
pix.addSources(paths)
})
}
}
]
......@@ -242,15 +247,15 @@ Maui.ApplicationWindow
}
Loader
{
id: cloudViewLoader
}
// Loader
// {
// id: cloudViewLoader
// }
Loader
{
id: storeViewLoader
}
// Loader
// {
// id: storeViewLoader
// }
SearchView
{
......@@ -267,35 +272,33 @@ Maui.ApplicationWindow
Layout.rightMargin: space.big
Layout.bottomMargin: space.big
Layout.topMargin: space.small
}
}
}
/*** Components ***/
Component
{
id: _cloudViewComponent
CloudView
{
anchors.fill : parent
}
}
Component
{
id: _storeViewComponent
Maui.Store
{
anchors.fill : parent
detailsView: true
list.category: StoreList.WALLPAPERS
list.provider: StoreList.KDELOOK
}
}
// Component
// {
// id: _cloudViewComponent
// CloudView
// {
// anchors.fill : parent
// }
// }
// Component
// {
// id: _storeViewComponent
// Maui.Store
// {
// anchors.fill : parent
// detailsView: true
// list.category: StoreList.WALLPAPERS
// list.provider: StoreList.KDELOOK
// }
// }
Component
{
......@@ -374,9 +377,9 @@ Maui.ApplicationWindow
onViewPics: VIEWER.openExternalPics(pics, 0)
}
Component.onCompleted:
{
cloudViewLoader.sourceComponent = _cloudViewComponent
storeViewLoader.sourceComponent= _storeViewComponent
}
// Component.onCompleted:
// {
// cloudViewLoader.sourceComponent = _cloudViewComponent
// storeViewLoader.sourceComponent= _storeViewComponent
// }
}
......@@ -20,7 +20,7 @@ Gallery::Gallery(QObject *parent) : BaseList(parent)
connect(this, &Gallery::sortByChanged, this, &Gallery::setList);
}
void Gallery::setSortBy(const uint &sort)
void Gallery::setSortBy(const SORTBY &sort)
{
if(this->sort == sort)
return;
......@@ -29,7 +29,7 @@ void Gallery::setSortBy(const uint &sort)
emit this->sortByChanged();
}
uint Gallery::getSortBy() const
Gallery::SORTBY Gallery::getSortBy() const
{
return this->sort;
}
......@@ -59,13 +59,14 @@ void Gallery::sortList()
{
const auto key = static_cast<FMH::MODEL_KEY>(this->sort);
qDebug()<< "SORTING LIST BY"<< this->sort;
qSort(this->list.begin(), this->list.end(), [key](const FMH::MODEL &e1, const FMH::MODEL &e2) -> bool
std::sort(this->list.begin(), this->list.end(), [key](const FMH::MODEL &e1, const FMH::MODEL &e2) -> bool
{
auto role = key;
switch(role)
{
case FMH::MODEL_KEY::SIZE:
case FMH::MODEL_KEY::FAV:
{
if(e1[role].toDouble() > e2[role].toDouble())
return true;
......@@ -74,17 +75,15 @@ void Gallery::sortList()
case FMH::MODEL_KEY::DATE:
case FMH::MODEL_KEY::ADDDATE:
case FMH::MODEL_KEY::MODIFIED:
{
auto currentTime = QDateTime::currentDateTime();
auto date1 = QDateTime::fromString(e1[role], Qt::TextDate);
auto date2 = QDateTime::fromString(e2[role], Qt::TextDate);
if(date1.secsTo(currentTime) < date2.secsTo(currentTime))
if(date1 > date2)
return true;
break;
}
case FMH::MODEL_KEY::TITLE:
......
......@@ -10,17 +10,30 @@ class Gallery : public BaseList
{
Q_OBJECT
Q_PROPERTY(QString query READ getQuery WRITE setQuery NOTIFY queryChanged())
Q_PROPERTY(uint sortBy READ getSortBy WRITE setSortBy NOTIFY sortByChanged)
Q_PROPERTY(SORTBY sortBy READ getSortBy WRITE setSortBy NOTIFY sortByChanged)
public:
enum SORTBY : uint_fast8_t
{
ADDDATE = FMH::MODEL_KEY::ADDDATE,
DATE = FMH::MODEL_KEY::DATE,
PLACE = FMH::MODEL_KEY::PLACE,
TITLE = FMH::MODEL_KEY::TITLE,
SIZE = FMH::MODEL_KEY::SIZE,
FORMAT = FMH::MODEL_KEY::FORMAT,
FAV = FMH::MODEL_KEY::FAV,
NONE
}; Q_ENUM(SORTBY)
explicit Gallery(QObject *parent = nullptr);
FMH::MODEL_LIST items() const override;
void setQuery(const QString &query);
QString getQuery() const;
void setSortBy(const uint &sort);
uint getSortBy() const;
void setSortBy(const Gallery::SORTBY &sort);
Gallery::SORTBY getSortBy() const;
private:
DBActions *dba;
......@@ -29,7 +42,7 @@ private:
void setList();
QString query;
uint sort = FMH::MODEL_KEY::DATE;
Gallery::SORTBY sort = Gallery::SORTBY::ADDDATE;
bool addPic(const FMH::MODEL &img);
......
......@@ -120,3 +120,8 @@ void Pix::showInFolder(const QStringList &urls)
for(auto url : urls)
QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(url).dir().absolutePath()));
}
void Pix::addSources(const QStringList &paths)
{
this->populateDB(paths);
}
......@@ -51,6 +51,9 @@ public:
/*File actions*/
Q_INVOKABLE void showInFolder(const QStringList &urls);
public slots:
void addSources(const QStringList &paths);
private:
FileLoader *fileLoader;
void populateDB(const QStringList &paths);
......
......@@ -49,7 +49,7 @@ Maui.Page
{
checkable: true
checked: fitPreviews
text: qsTr( "Crop previews")
text: qsTr( "Fit previews")
onTriggered:
{
fitPreviews = !fitPreviews
......@@ -108,48 +108,56 @@ Maui.Page
{
text: qsTr("Title")
checkable: true
checked: pixList.sortBy === FMList.TITLE
onTriggered: pixList.sortBy = FMList.TITLE
checked: pixList.sortBy === GalleryList.TITLE
onTriggered: pixList.sortBy = GalleryList.TITLE
}
Maui.MenuItem
{
text: qsTr("Add date")
checkable: true
checked: pixList.sortBy === FMList.ADDDATE
onTriggered: pixList.sortBy = FMList.ADDDATE
checked: pixList.sortBy === GalleryList.ADDDATE
onTriggered: pixList.sortBy = GalleryList.ADDDATE
}
Maui.MenuItem
{
text: qsTr("Creation date")
checkable: true
checked: pixList.sortBy === FMList.DATE
onTriggered: pixList.sortBy = FMList.DATE
checked: pixList.sortBy === GalleryList.DATE
onTriggered: pixList.sortBy = GalleryList.DATE
}
// Maui.MenuItem
// {
// text: qsTr("Place")
// checkable: true
// checked: pixList.sortBy === FMList.PLACE
// onTriggered: pixList.sortBy = FMList.PLACE
// }
Maui.MenuItem
{
text: qsTr("Place")
text: qsTr("Format")
checkable: true
checked: pixList.sortBy === FMList.PLACE
onTriggered: pixList.sortBy = FMList.PLACE
checked: pixList.sortBy === GalleryList.FORMAT
onTriggered: pixList.sortBy = GalleryList.FORMAT
}
Maui.MenuItem
{
text: qsTr("Format")
text: qsTr("Size")
checkable: true
checked: pixList.sortBy === FMList.FORMAT
onTriggered: pixList.sortBy = FMList.FORMAT
checked: pixList.sortBy === GalleryList.SIZE
onTriggered: pixList.sortBy = GalleryList.SIZE
}
Maui.MenuItem
{
text: qsTr("Size")
text: qsTr("Favorites")
checkable: true
checked: pixList.sortBy === FMList.SIZE
onTriggered: pixList.sortBy = FMList.SIZE
checked: pixList.sortBy === GalleryList.FAV
onTriggered: pixList.sortBy = GalleryList.FAV
}
}
}
......
......@@ -155,7 +155,7 @@ ItemDelegate
Label
{
id: _label
text: title
text: model.adddate
width: parent.width
height: parent.height
horizontalAlignment: Qt.AlignHCenter
......
......@@ -41,7 +41,6 @@ Kirigami.PageRow
{
id: albumsPage
headBar.visible: false
headBar.implicitHeight: 0
floatingBar: true
footBarOverlap: true
allowRiseContent: false
......@@ -60,8 +59,7 @@ Kirigami.PageRow
AlbumsGrid
{
id: albumGrid
height: parent.height
width: parent.width
anchors.fill: parent
onAlbumClicked: filter(albumsList.get(index).album)
}
}
......
......@@ -91,10 +91,10 @@ Maui.Page
id : viewerConf
}
EditTools
{
id: editTools
}
// EditTools
// {
// id: editTools
// }
backContain: GalleryRoll
{
......
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