main.qml 3.28 KB
Newer Older
Camilo Higuita's avatar
src  
Camilo Higuita committed
1
import QtQuick 2.9
Camilo Higuita's avatar
Camilo Higuita committed
2
import QtQuick.Controls 2.2
3 4
import QtQuick.Layouts 1.3
import org.kde.kirigami 2.0 as Kirigami
Camilo Higuita's avatar
src  
Camilo Higuita committed
5

Camilo Higuita's avatar
Camilo Higuita committed
6
import "widgets"
7 8 9 10 11 12 13
import "widgets/views/Albums"
import "widgets/views/Folders"
import "widgets/views/Gallery"
import "widgets/views/Settings"
import "widgets/views/Tags"
import "widgets/views/Viewer"

14
import "view_models"
Camilo Higuita's avatar
Camilo Higuita committed
15

16 17
import "widgets/views/Pix.js" as PIX

18
Kirigami.ApplicationWindow
Camilo Higuita's avatar
Camilo Higuita committed
19 20
{
    id: root
Camilo Higuita's avatar
Camilo Higuita committed
21 22 23 24
    visible: true
    width: 400
    height: 500
    title: qsTr("Pixs")
Camilo Higuita's avatar
Camilo Higuita committed
25

26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
    /*READONLY PROPS*/

    readonly property bool isMobile : Kirigami.Settings.isMobile
    readonly property var views : ({
                                       viewer: 0,
                                       gallery: 1,
                                       folders: 2,
                                       albums: 3,
                                       tags: 4,
                                       search: 5
                                   })
    /*PROPS*/

    property int currentView : views.gallery


    /*UI PROPS*/
43

44 45 46 47 48
    readonly property int contentMargins: isMobile ? 8 : 10
    readonly property int defaultFontSize: Kirigami.Theme.defaultFont.pointSize
    readonly property var fontSizes: ({
                                          tiny: defaultFontSize - 2,
                                          small: defaultFontSize -1,
49
                                          default: defaultFontSize,
50 51 52
                                          big: defaultFontSize + 1,
                                          large: defaultFontSize + 2
                                      })
53 54 55 56 57 58 59

    property string backgroundColor: Kirigami.Theme.backgroundColor
    property string textColor: Kirigami.Theme.textColor
    property string highlightColor: Kirigami.Theme.highlightColor
    property string highlightedTextColor: Kirigami.Theme.highlightedTextColor
    property string buttonBackgroundColor: Kirigami.Theme.buttonBackgroundColor
    property string viewBackgroundColor: Kirigami.Theme.viewBackgroundColor
60
    property string altColor: Kirigami.Theme.complementaryBackgroundColor
61

62
    property int iconSize : Kirigami.Units.iconSizes.medium
Camilo Higuita's avatar
Camilo Higuita committed
63

64 65 66 67 68 69 70 71 72 73
    overlay.modal: Rectangle {
        color: isMobile ? darkColor : "transparent"
        opacity: 0.5
        height: root.height
    }

    overlay.modeless: Rectangle {
        color: "transparent"
    }

74 75 76 77
    header: PixsBar
    {
        id: toolBar
        visible: true
Camilo Higuita's avatar
Camilo Higuita committed
78

79
        currentIndex: currentView
80

81 82 83 84 85 86
        onViewerViewClicked: currentView = 0
        onGalleryViewClicked: currentView = 1
        onFoldersViewClicked: currentView = 2
        onAlbumsViewClicked: currentView = 3
        onTagsViewClicked: currentView = 4
        onSearchViewClicked: {}
87 88
    }

89

90
    SwipeView
Camilo Higuita's avatar
Camilo Higuita committed
91
    {
92
        id: swipeView
93 94
        anchors.fill: parent

95
        currentIndex: currentView
Camilo Higuita's avatar
Camilo Higuita committed
96

97 98 99 100
        onCurrentIndexChanged:
        {
            currentView = currentIndex
        }
Camilo Higuita's avatar
Camilo Higuita committed
101

102 103 104 105
        PixViewer
        {
            id: pixViewer
        }
Camilo Higuita's avatar
Camilo Higuita committed
106

107 108
        GalleryView
        {
109
            id: galleryView
110
        }
111

112 113 114 115
        FoldersView
        {
            id: foldersView
        }
Camilo Higuita's avatar
Camilo Higuita committed
116

117 118
        AlbumsView
        {
Camilo Higuita's avatar
Camilo Higuita committed
119

120
        }
Camilo Higuita's avatar
Camilo Higuita committed
121

122 123
        TagsView
        {
Camilo Higuita's avatar
Camilo Higuita committed
124

125
        }
Camilo Higuita's avatar
Camilo Higuita committed
126

127 128
        SettingsView
        {
Camilo Higuita's avatar
Camilo Higuita committed
129 130 131 132

        }

    }
133

134 135 136 137 138 139
    Connections
    {
        target: pix

        onRefreshViews: PIX.refreshViews()
    }
140

Camilo Higuita's avatar
src  
Camilo Higuita committed
141
}