Commit f1e74801 authored by Camilo Higuita's avatar Camilo Higuita

ui prototype

parent 39c9c8f9
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QFontDatabase>
int main(int argc, char *argv[])
{
#if defined(Q_OS_WIN)
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
QGuiApplication app(argc, argv);
QFontDatabase::addApplicationFont(":/utils/materialdesignicons-webfont.ttf");
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
if (engine.rootObjects().isEmpty())
......
import QtQuick 2.9
import QtQuick.Controls 2.2
import org.kde.kirigami 2.0 as Kirigami
Kirigami.ApplicationWindow
import "widgets"
ApplicationWindow
{
id: root
visible: true
width: 400
height: 500
title: qsTr("Pixs")
property int defaultColumnWidth: Kirigami.Units.gridUnit * 13
property int columnWidth: defaultColumnWidth
property int currentView : 0
pageStack.defaultColumnWidth: columnWidth
pageStack.initialPage: [firstPageComponent, secondPageComponent]
MouseArea
footer: PixsBar
{
id: dragHandle
visible: pageStack.wideMode
id: toolBar
visible: true
size: 24
anchors.top: parent.top
anchors.bottom: parent.bottom
currentIndex: currentView
x: columnWidth - (width / 2)
width: Kirigami.Units.devicePixelRatio * 2
property int dragRange: (Kirigami.Units.gridUnit * 5)
property int _lastX: -1
onGalleryViewClicked: currentView = 0
onAlbumsViewClicked: currentView = 1
onTagsViewClicked: currentView = 2
onSettingsViewClicked: currentView = 3
}
cursorShape: Qt.SplitHCursor
StackView
{
id: stackView
anchors.fill: parent
initialItem: SwipeView
{
id: swipeView
width: parent.width
height: parent.height
onPressed: _lastX = mouseX
currentIndex: currentView
onPositionChanged:
{
if (mouse.x > _lastX)
onCurrentIndexChanged:
{
columnWidth = Math.min((defaultColumnWidth + dragRange),
columnWidth + (mouse.x - _lastX));
} else if (mouse.x < _lastX)
currentView = currentIndex
}
GalleryView
{
columnWidth = Math.max((defaultColumnWidth - dragRange),
columnWidth - (_lastX - mouse.x));
}
}
Rectangle
{
anchors.fill: parent
AlbumsView
{
color: "blue"
}
}
}
Component
{
id: firstPageComponent
TagsView
{
Kirigami.Page
{
id: firstPage
}
background: Rectangle { color: "red" }
}
}
SettingsView
{
}
Component
{
id: secondPageComponent
SwipeView
{
id: secondPage
clip: true
background: Rectangle { color: "green" }
currentIndex: 1
anchors.fill: parent
Item {
id: firstPage
Label
{
text: "hahaha"
}
}
Item {
id: thirdPage
Label
{
text: "jajaja"
}
}
}
Component
{
id: viewer
PixsViewer
{
}
}
}
}
<RCC>
<qresource prefix="/">
<file>main.qml</file>
<file>view_models/PixViewer.qml</file>
<file>view_models/PixGrid.qml</file>
<file>widgets/Viewer.qml</file>
<file>widgets/TagsView.qml</file>
<file>widgets/GalleryView.qml</file>
<file>widgets/EditTools.qml</file>
<file>widgets/AlbumsView.qml</file>
<file>utils/Icon.qml</file>
<file>utils/Icons.js</file>
<file>utils/materialdesignicons-webfont.ttf</file>
<file>widgets/PixsBar.qml</file>
<file>qtquickcontrols2.conf</file>
<file>widgets/PixsViewer.qml</file>
<file>widgets/SettingsView.qml</file>
</qresource>
</RCC>
; This file can be edited to change the style of the application
; Read "Qt Quick Controls 2 Configuration File" for details:
; http://doc.qt.io/qt-5/qtquickcontrols2-configuration.html
[Controls]
Style=Material
[Universal]
Theme=Light
;Accent=Steel
[Material]
Theme=Light
;Accent=BlueGrey
;Primary=BlueGray
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
Item
{
}
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
Item
{
}
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
Item
{
}
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
Item
{
}
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
Rectangle
{
}
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import "../utils/Icons.js" as MdiFont
import "../utils"
ToolBar
{
property string accentColor : "#75ff75"
property string textColor : "#ffffff"
property string backgroundColor : "#31363b"
property int size
property int currentIndex : 0
signal galleryViewClicked()
signal albumsViewClicked()
signal tagsViewClicked()
signal settingsViewClicked()
id: pixBar
Rectangle
{
anchors.fill: parent
color: backgroundColor
}
RowLayout
{
anchors.fill: parent
Row
{
anchors.centerIn: parent
ToolButton
{
id: galleryBtn
Icon
{
text: MdiFont.Icon.image
color: currentIndex === 0? accentColor : textColor
iconSize: size
}
onClicked: galleryViewClicked()
hoverEnabled: true
ToolTip.delay: 1000
ToolTip.timeout: 5000
ToolTip.visible: hovered
ToolTip.text: qsTr("Gallery")
}
ToolButton
{
id: albumsView
Icon
{
id: albumsIcon
text: MdiFont.Icon.burstMode
color: currentIndex === 1? accentColor : textColor
iconSize: size
}
onClicked: albumsViewClicked()
hoverEnabled: true
ToolTip.delay: 1000
ToolTip.timeout: 5000
ToolTip.visible: hovered
ToolTip.text: qsTr("Albums")
}
ToolButton
{
id: tagsView
Icon
{
id: artistsIcon
text: MdiFont.Icon.tagFaces
color: currentIndex === 2? accentColor : textColor
iconSize: size
}
onClicked: tagsViewClicked()
hoverEnabled: true
ToolTip.delay: 1000
ToolTip.timeout: 5000
ToolTip.visible: hovered
ToolTip.text: qsTr("Tags")
}
ToolButton
{
id: settingsView
Icon
{
id: settingsIcon
text: MdiFont.Icon.settings
color: currentIndex === 3? accentColor : textColor
iconSize: size
}
onClicked: settingsViewClicked()
hoverEnabled: true
ToolTip.delay: 1000
ToolTip.timeout: 5000
ToolTip.visible: hovered
ToolTip.text: qsTr("Settings")
}
}
}
}
import QtQuick 2.0
Item {
}
import QtQuick 2.0
Item {
}
import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
Item
{
}
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