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