Commit 25a766f2 authored by Camilo Higuita's avatar Camilo Higuita

work on image viewer and open with dialog #3 #4 #6

parent 1e74ef4b
...@@ -52,6 +52,7 @@ SUBDIRS += \ ...@@ -52,6 +52,7 @@ SUBDIRS += \
RESOURCES += \ RESOURCES += \
src/qml.qrc \ src/qml.qrc \
assets.qrc
HEADERS += \ HEADERS += \
src/pix.h \ src/pix.h \
......
<RCC>
<qresource prefix="/img">
<file>assets/face.png</file>
<file>assets/Babe.notifyrc</file>
<file>assets/face-sleeping.png</file>
<file>assets/face-hug.png</file>
</qresource>
</RCC>
[Dolphin]
PreviewsShown=true
Timestamp=2018,3,26,23,14,28
Version=4
...@@ -27,6 +27,7 @@ static QVariantMap createActionItem(const QString &label, const QString &actionI ...@@ -27,6 +27,7 @@ static QVariantMap createActionItem(const QString &label, const QString &actionI
QVariantList KDE::mimeApps(const QUrl &url) QVariantList KDE::mimeApps(const QUrl &url)
{ {
qDebug()<<"trying to get mimes";
QVariantList list; QVariantList list;
if (url.isValid()) if (url.isValid())
......
...@@ -44,7 +44,7 @@ Kirigami.ApplicationWindow ...@@ -44,7 +44,7 @@ Kirigami.ApplicationWindow
readonly property var fontSizes: ({ readonly property var fontSizes: ({
tiny: defaultFontSize - 2, tiny: defaultFontSize - 2,
small: defaultFontSize -1, small: defaultFontSize -1,
standar: defaultFontSize, default: defaultFontSize,
big: defaultFontSize + 1, big: defaultFontSize + 1,
large: defaultFontSize + 2 large: defaultFontSize + 2
}) })
...@@ -75,54 +75,45 @@ Kirigami.ApplicationWindow ...@@ -75,54 +75,45 @@ Kirigami.ApplicationWindow
} }
StackView SwipeView
{ {
id: stackView id: swipeView
clip: true
anchors.fill: parent anchors.fill: parent
initialItem: SwipeView currentIndex: currentView
{
id: swipeView
width: parent.width
height: parent.height
currentIndex: currentView
onCurrentIndexChanged:
{
currentView = currentIndex
}
PixViewer
{
} onCurrentIndexChanged:
{
currentView = currentIndex
}
GalleryView PixViewer
{ {
id: pixViewer
}
} GalleryView
{
FoldersView }
{
id: foldersView
}
AlbumsView FoldersView
{ {
id: foldersView
}
} AlbumsView
{
TagsView }
{
} TagsView
{
SettingsView }
{
} SettingsView
{
} }
......
...@@ -10,8 +10,6 @@ ...@@ -10,8 +10,6 @@
<file>db/script.sql</file> <file>db/script.sql</file>
<file>view_models/PixPic.qml</file> <file>view_models/PixPic.qml</file>
<file>view_models/PixHolder.qml</file> <file>view_models/PixHolder.qml</file>
<file>../assets/face.png</file>
<file>../assets/Babe.notifyrc</file>
<file>db/Query.js</file> <file>db/Query.js</file>
<file>view_models/SideBar.qml</file> <file>view_models/SideBar.qml</file>
<file>view_models/PixButton.qml</file> <file>view_models/PixButton.qml</file>
...@@ -26,6 +24,6 @@ ...@@ -26,6 +24,6 @@
<file>widgets/views/Folders/FoldersDelegate.qml</file> <file>widgets/views/Folders/FoldersDelegate.qml</file>
<file>widgets/views/Viewer/EditTools.qml</file> <file>widgets/views/Viewer/EditTools.qml</file>
<file>widgets/views/Viewer/Viewer.qml</file> <file>widgets/views/Viewer/Viewer.qml</file>
<file>../assets/f76477106.jpg</file> <file>widgets/views/Viewer/Viewer.js</file>
</qresource> </qresource>
</RCC> </RCC>
...@@ -14,7 +14,7 @@ PixPage ...@@ -14,7 +14,7 @@ PixPage
property alias grid: grid property alias grid: grid
/*signals*/ /*signals*/
signal picClicked(string url) signal picClicked(var pic)
headerbarTitle: gridModel.count+" "+qsTr("images") headerbarTitle: gridModel.count+" "+qsTr("images")
...@@ -53,7 +53,12 @@ PixPage ...@@ -53,7 +53,12 @@ PixPage
highlightFollowsCurrentItem: true highlightFollowsCurrentItem: true
highlight: Rectangle
{
width: picSize + picSpacing
height: picSize + picSpacing
color: highlightColor
}
onWidthChanged: onWidthChanged:
{ {
...@@ -76,10 +81,9 @@ PixPage ...@@ -76,10 +81,9 @@ PixPage
Connections Connections
{ {
target: delegate target: delegate
onPicClicked: onClicked:
{ {
var url = grid.model.get(index).url picClicked(grid.model.get(index))
gridPage.picClicked(url)
grid.currentIndex = index grid.currentIndex = index
} }
} }
......
...@@ -8,21 +8,23 @@ Item ...@@ -8,21 +8,23 @@ Item
property string emoji property string emoji
property string message property string message
clip: true clip: true
property color color : textColor
focus: true
anchors.fill: parent anchors.fill: parent
GridLayout GridLayout
{ {
id: placeHolder id:placeHolder
anchors.fill: parent anchors.fill: parent
columns: 1 columns: 1
rows: 2 rows: 2
Rectangle Rectangle
{ {
width:parent.width anchors.fill: parent
height: parent.height
Layout.row: 1 Layout.row: 1
color: "transparent" color: "transparent"
...@@ -31,8 +33,8 @@ Item ...@@ -31,8 +33,8 @@ Item
id: imageHolder id: imageHolder
anchors.centerIn: parent anchors.centerIn: parent
width: 48 width: 40
height: 48 height: 40
source: emoji? emoji : "qrc:/../assets/face.png" source: emoji? emoji : "qrc:/../assets/face.png"
horizontalAlignment: Qt.AlignHCenter horizontalAlignment: Qt.AlignHCenter
...@@ -46,6 +48,7 @@ Item ...@@ -46,6 +48,7 @@ Item
saturation: -1 saturation: -1
lightness: 0.3 lightness: 0.3
} }
Label Label
{ {
id: textHolder id: textHolder
...@@ -53,11 +56,14 @@ Item ...@@ -53,11 +56,14 @@ Item
anchors.top: imageHolder.bottom anchors.top: imageHolder.bottom
opacity: 0.3 opacity: 0.3
text: message ? qsTr(message) : qsTr("Nothing here...") text: message ? qsTr(message) : qsTr("Nothing here...")
font.pointSize: fontSizes.default
padding: 10 padding: 10
font.bold: true font.bold: true
textFormat: Text.RichText
horizontalAlignment: Qt.AlignHCenter horizontalAlignment: Qt.AlignHCenter
elide: Text.ElideRight elide: Text.ElideRight
color: pix.foregroundColor() color: textColor
} }
} }
} }
......
...@@ -22,7 +22,7 @@ Page ...@@ -22,7 +22,7 @@ Page
signal exit(); signal exit();
clip: true clip: true
padding: 0
ColumnLayout ColumnLayout
{ {
...@@ -105,13 +105,13 @@ Page ...@@ -105,13 +105,13 @@ Page
Column Column
{ {
id: pageContent id: pageContent
Layout.margins: contentMargins Layout.margins: contentMargins
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
} }
......
...@@ -5,29 +5,23 @@ ItemDelegate ...@@ -5,29 +5,23 @@ ItemDelegate
{ {
height: picSize height: picSize
width: picSize width: picSize
signal picClicked(int index)
property int picSize : 150 property int picSize : 150
property int picRadius : 2 property int picRadius : 2
Image Image
{ {
id: img id: img
anchors.centerIn: parent anchors.centerIn: parent
height: picSize-contentMargins height: picSize-contentMargins
width: picSize-contentMargins width: picSize-contentMargins
sourceSize.height: picSize-contentMargins sourceSize.height: picSize-contentMargins
sourceSize.width: picSize-contentMargins sourceSize.width: picSize-contentMargins
cache: false cache: true
antialiasing: true antialiasing: true
fillMode: Image.PreserveAspectCrop fillMode: Image.PreserveAspectCrop
source: (url && url.length>0)? "file://"+encodeURIComponent(url) : "qrc:/../assets/face.png" source: (url && url.length>0)? "file://"+encodeURIComponent(url) : "qrc:/../assets/face.png"
asynchronous: true asynchronous: true
verticalAlignment: Qt.AlignVCenter
} }
} }
...@@ -9,7 +9,7 @@ import "../view_models" ...@@ -9,7 +9,7 @@ import "../view_models"
ToolBar ToolBar
{ {
property string accentColor : pix.pixColor() property string accentColor : pix.pixColor()
property string textColor : pix.foregroundColor() property string textColor : textColor
property int currentIndex : 0 property int currentIndex : 0
......
...@@ -2,6 +2,7 @@ import QtQuick 2.9 ...@@ -2,6 +2,7 @@ import QtQuick 2.9
import QtQuick.Controls 2.2 import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import "../../../db/Query.js" as Q import "../../../db/Query.js" as Q
import "../../../widgets/views/Viewer/Viewer.js" as VIEWER
import "../../../view_models" import "../../../view_models"
PixGrid PixGrid
...@@ -12,11 +13,12 @@ PixGrid ...@@ -12,11 +13,12 @@ PixGrid
picRadius: 2 picRadius: 2
Component.onCompleted: populate() Component.onCompleted: populate()
function populate() function populate()
{ {
var map = pix.get(Q.Query.allPics) var map = pix.get(Q.Query.allPics)
for(var i in map) for(var i in map)
gridModel.append(map[i]) gridModel.append(map[i])
} }
onPicClicked: VIEWER.view(pic)
} }
...@@ -3,11 +3,15 @@ import QtQuick.Controls 2.2 ...@@ -3,11 +3,15 @@ import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import "../../../view_models" import "../../../view_models"
PixPage PixPage
{ {
headerbarTitle: "drawing.jpg" property alias viewer : viewer
property var currentPic : ({})
headerbarTitle: currentPic.title || ""
headerbarExit: false headerbarExit: false
headerBarRight: [ headerBarRight: [
...@@ -39,6 +43,7 @@ PixPage ...@@ -39,6 +43,7 @@ PixPage
footer: ToolBar footer: ToolBar
{ {
position: ToolBar.Footer position: ToolBar.Footer
RowLayout RowLayout
{ {
anchors.fill: parent anchors.fill: parent
...@@ -60,6 +65,8 @@ PixPage ...@@ -60,6 +65,8 @@ PixPage
ToolTip.timeout: 5000 ToolTip.timeout: 5000
ToolTip.visible: hovered ToolTip.visible: hovered
ToolTip.text: qsTr("Share") ToolTip.text: qsTr("Share")
onClicked: pix.openWith(currentPic.url)
} }
} }
...@@ -152,9 +159,16 @@ PixPage ...@@ -152,9 +159,16 @@ PixPage
} }
} }
content: Viewer PixHolder
{ {
message: "<h2>No Pic!</h2><p>Select or open an image from yuor gallery</p>"
emoji: "qrc:/img/assets/face-hug.png"
visible: Object.keys(currentPic).length === 0
}
content: Viewer
{
id: viewer
} }
} }
function view(pic)
{
pixViewer.currentPic = pic
if(currentView !== views.viewer)
currentView = views.viewer
}
function fullscreen()
{
}
function next()
{
}
function previous()
{
}
function fav(url)
{
}
...@@ -5,8 +5,7 @@ Image { ...@@ -5,8 +5,7 @@ Image {
height: parent.height height: parent.height
width: parent.width width: parent.width
source: "qrc:/../assets/f76477106.jpg" source: "file://"+currentPic.url
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
} }
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