Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit cc9f7553 authored by Camilo Higuita's avatar Camilo Higuita

style info dialog

parent 60e0b20b
......@@ -4,56 +4,62 @@
#include <QObject>
#include <QAbstractListModel>
#include <MauiKit/mauilist.h>
#include <QFileInfo>
class ReverseGeoCoder;
class PicInfoModel : public MauiList
{
Q_OBJECT
Q_PROPERTY (QUrl url READ url WRITE setUrl NOTIFY urlChanged)
Q_OBJECT
Q_PROPERTY (QUrl url READ url WRITE setUrl NOTIFY urlChanged)
Q_PROPERTY (QString fileName MEMBER m_fileName NOTIFY fileNameChanged CONSTANT)
public:
enum ROLES
{
KEY,
VALUE
};
explicit PicInfoModel(QObject *parent = nullptr);
~PicInfoModel();
QUrl url() const
{
return m_url;
}
enum ROLES
{
KEY,
VALUE
};
explicit PicInfoModel(QObject *parent = nullptr);
~PicInfoModel();
QUrl url() const
{
return m_url;
}
public slots:
void setUrl(QUrl url)
{
if(!FMH::fileExists(url))
{
return;
}
void setUrl(QUrl url)
{
if(!FMH::fileExists(url))
{
return;
}
if (m_url == url)
return;
if (m_url == url)
return;
m_url = url;
emit urlChanged(m_url);
this->parse();
}
m_url = url;
emit urlChanged(m_url);
QFileInfo file(m_url.toLocalFile ());
m_fileName = file.fileName ();
emit fileNameChanged();
this->parse();
}
private:
QUrl m_url;
FMH::MODEL_LIST m_data;
ReverseGeoCoder* m_geoCoder;
QUrl m_url;
QString m_fileName;
FMH::MODEL_LIST m_data;
ReverseGeoCoder* m_geoCoder;
void parse();
void parse();
signals:
void urlChanged(QUrl url);
// MauiList interface
void urlChanged(QUrl url);
void fileNameChanged();
// MauiList interface
public:
FMH::MODEL_LIST items() const override;
FMH::MODEL_LIST items() const override;
};
#endif // PICINFOMODEL_H
......@@ -184,6 +184,11 @@ MauiLab.AltBrowser
{
control.currentView.itemsSelected([index])
}
if(event.key === Qt.Key_Space)
{
getFileInfo(item.url)
}
}
}
......
......@@ -4,6 +4,7 @@ import org.kde.kirigami 2.8 as Kirigami
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.12
import Pix 1.0 as Pix
import QtQuick.Shapes 1.12
Maui.Dialog
{
......@@ -11,6 +12,10 @@ Maui.Dialog
property alias url : _infoModel.url
maxHeight: 800
maxWidth: 600
defaultButtons: false
page.title: _infoModel.fileName
headBar.visible: true
page.floatingHeader: true
Kirigami.ScrollablePage
{
......@@ -32,15 +37,38 @@ Maui.Dialog
Rectangle
{
Layout.fillWidth: true
Layout.preferredHeight: width
color: Qt.darker(Kirigami.Theme.backgroundColor)
Layout.preferredHeight: 200
color: Qt.darker(Kirigami.Theme.backgroundColor, 1.1)
Image
{
id: _img
anchors.fill: parent
source: control.url
fillMode: Image.PreserveAspectFit
}
fillMode: Image.PreserveAspectCrop
Rectangle
{
color: "#333"
opacity: 0.5
anchors.fill: parent
}
Rectangle
{
anchors.centerIn: parent
color: "#333"
radius: Maui.Style.radiusV
width: 100
height: 32
Label
{
anchors.centerIn: parent
text: _img.sourceSize.height + " x " + _img.sourceSize.width
color: "white"
}
}
}
}
Kirigami.Separator
......@@ -68,7 +96,7 @@ Maui.Dialog
width: visible ? parent.width : 0
height: visible ? _delegateColumnInfo.implicitHeight + Maui.Style.space.large : 0
color: index % 2 === 0 ? Kirigami.Theme.backgroundColor : Qt.darker(Kirigami.Theme.backgroundColor)
color: index % 2 === 0 ? Kirigami.Theme.backgroundColor : Qt.darker(Kirigami.Theme.backgroundColor, 1.1)
Kirigami.Separator
{
anchors.left: parent.left
......@@ -76,41 +104,24 @@ Maui.Dialog
anchors.bottom: parent.bottom
}
Column
Maui.ListItemTemplate
{
id: _delegateColumnInfo
spacing: Maui.Style.space.tiny
width: parent.width * 0.9
width: parent.width
iconSource: "documentinfo"
iconSizeHint: Maui.Style.iconSizes.medium
anchors.centerIn: parent
anchors.margins: Maui.Style.space.medium
Label
{
width: parent.width
text: model.key
color: Kirigami.Theme.textColor
elide: Text.ElideRight
wrapMode: Text.NoWrap
horizontalAlignment: Qt.AlignLeft
font.weight: Font.Bold
font.bold: true
}
Label
{
id: _valueLabel
width: parent.width
visible: text.length
text: model.value
color: Kirigami.Theme.textColor
elide: Qt.ElideMiddle
wrapMode: Text.Wrap
horizontalAlignment: Qt.AlignLeft
font.weight: Font.Light
}
label1.text: model.key
label1.font.weight: Font.Bold
label1.font.bold: true
label2.text: model.value
label2.elide: Qt.ElideMiddle
label2.wrapMode: Text.Wrap
label2.font.weight: Font.Light
}
}
}
......
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