Changeset View
Changeset View
Standalone View
Standalone View
cuttlefish/package/contents/ui/cuttlefish.qml
Show All 33 Lines | 30 | Kirigami.ApplicationWindow { | |||
---|---|---|---|---|---|
34 | signal itemRightClicked() | 34 | signal itemRightClicked() | ||
35 | 35 | | |||
36 | minimumWidth: 400 | 36 | minimumWidth: 400 | ||
37 | minimumHeight: 400 | 37 | minimumHeight: 400 | ||
38 | 38 | | |||
39 | property bool widescreen: cuttlefish.width >= 800 | 39 | property bool widescreen: cuttlefish.width >= 800 | ||
40 | 40 | | |||
41 | property int iconSize: Kirigami.Units.iconSizes.large | 41 | property int iconSize: Kirigami.Units.iconSizes.large | ||
42 | property bool darkScheme: false | | |||
43 | property bool usesPlasmaTheme: true | | |||
44 | property var schemeStash | | |||
45 | | ||||
46 | property color textcolor: Kirigami.Theme.textColor | | |||
47 | property color bgcolor: Kirigami.Theme.backgroundColor | | |||
48 | property color highlightcolor: Kirigami.Theme.highlightColor | | |||
49 | property color highlightedtextcolor: Kirigami.Theme.highlightedTextColor | | |||
50 | property color positivetextcolor: Kirigami.Theme.positiveTextColor | | |||
51 | property color neutraltextcolor: Kirigami.Theme.neutralTextColor | | |||
52 | property color negativetextcolor: Kirigami.Theme.negativeTextColor | | |||
53 | property color viewbgcolor: Kirigami.Theme.viewBackgroundColor | | |||
54 | | ||||
55 | Kirigami.Theme.textColor: cuttlefish.textcolor | | |||
56 | Kirigami.Theme.backgroundColor: cuttlefish.bgcolor | | |||
57 | Kirigami.Theme.highlightColor: cuttlefish.highlightcolor | | |||
58 | Kirigami.Theme.highlightedTextColor: cuttlefish.highlightedtextcolor | | |||
59 | Kirigami.Theme.positiveTextColor: cuttlefish.positivetextcolor | | |||
60 | Kirigami.Theme.neutralTextColor: cuttlefish.neutraltextcolor | | |||
61 | Kirigami.Theme.negativeTextColor: cuttlefish.negativetextcolor | | |||
62 | 42 | | |||
63 | Loader { | 43 | Loader { | ||
64 | // Use a Loader instead of creating a GMB directly, | 44 | // Use a Loader instead of creating a GMB directly, | ||
65 | // so if the GMB errors, it doesn't affect Cuttlefish's operation | 45 | // so if the GMB errors, it doesn't affect Cuttlefish's operation | ||
66 | id: loader | 46 | id: loader | ||
67 | source: "GlobalMenuBar.qml" | 47 | source: "GlobalMenuBar.qml" | ||
68 | } | 48 | } | ||
69 | Loader { | 49 | Loader { | ||
Show All 23 Lines | 72 | case 2: | |||
93 | previewPane.iconPreview.shot("dark") | 73 | previewPane.iconPreview.shot("dark") | ||
94 | break; | 74 | break; | ||
95 | case 3: | 75 | case 3: | ||
96 | previewPane.dualMont.shot() | 76 | previewPane.dualMont.shot() | ||
97 | break; | 77 | break; | ||
98 | } | 78 | } | ||
99 | } | 79 | } | ||
100 | } | 80 | } | ||
101 | function changeColors(index) { | | |||
102 | switch(index) { | | |||
103 | case 0: | | |||
104 | cuttlefish.Kirigami.Theme.inherit = true | | |||
105 | cuttlefish.textcolor = cuttlefish.schemeStash[0] | | |||
106 | cuttlefish.bgcolor = cuttlefish.schemeStash[1] | | |||
107 | cuttlefish.highlightcolor = cuttlefish.schemeStash[2] | | |||
108 | cuttlefish.highlightedtextcolor = cuttlefish.schemeStash[3] | | |||
109 | cuttlefish.positivetextcolor = cuttlefish.schemeStash[4] | | |||
110 | cuttlefish.neutraltextcolor = cuttlefish.schemeStash[5] | | |||
111 | cuttlefish.negativetextcolor = cuttlefish.schemeStash[6] | | |||
112 | cuttlefish.viewbgcolor = cuttlefish.schemeStash[7] | | |||
113 | break | | |||
114 | case 1: | | |||
115 | cuttlefish.Kirigami.Theme.inherit = false | | |||
116 | cuttlefish.textcolor = "#232629" | | |||
117 | cuttlefish.bgcolor = "#eff0f1" | | |||
118 | cuttlefish.highlightcolor = "#3daee9" | | |||
119 | cuttlefish.highlightedtextcolor = "#eff0f1" | | |||
120 | cuttlefish.positivetextcolor = "#27ae60" | | |||
121 | cuttlefish.neutraltextcolor = "#f67400" | | |||
122 | cuttlefish.negativetextcolor = "#da4453" | | |||
123 | cuttlefish.viewbgcolor = "#fcfcfc" | | |||
124 | break | | |||
125 | case 2: | | |||
126 | cuttlefish.Kirigami.Theme.inherit = false | | |||
127 | cuttlefish.textcolor = "#eff0f1" | | |||
128 | cuttlefish.bgcolor = "#31363b" | | |||
129 | cuttlefish.highlightcolor = "#3daee9" | | |||
130 | cuttlefish.highlightedtextcolor = "#eff0f1" | | |||
131 | cuttlefish.positivetextcolor = "#27ae60" | | |||
132 | cuttlefish.neutraltextcolor = "#f67400" | | |||
133 | cuttlefish.negativetextcolor = "#da4453" | | |||
134 | cuttlefish.viewbgcolor = "#232629" | | |||
135 | break | | |||
136 | } | | |||
137 | } | | |||
138 | 81 | | |||
139 | function indexToSize(ix) { | 82 | function indexToSize(ix) { | ||
140 | 83 | | |||
141 | var sizes = new Array(); | 84 | var sizes = new Array(); | ||
142 | sizes[0] = 8; | 85 | sizes[0] = 8; | ||
143 | sizes[1] = 16; | 86 | sizes[1] = 16; | ||
144 | sizes[2] = 22; | 87 | sizes[2] = 22; | ||
145 | sizes[3] = 32; | 88 | sizes[3] = 32; | ||
146 | sizes[4] = 48 | 89 | sizes[4] = 48 | ||
147 | sizes[5] = 64; | 90 | sizes[5] = 64; | ||
148 | sizes[6] = 128; | 91 | sizes[6] = 128; | ||
149 | 92 | | |||
150 | return sizes[ix]; | 93 | return sizes[ix]; | ||
151 | } | 94 | } | ||
152 | Rectangle { | 95 | Rectangle { | ||
153 | Kirigami.Theme.colorSet: Kirigami.Theme.View | 96 | Kirigami.Theme.colorSet: Kirigami.Theme.View | ||
154 | color: tools.currentIndex != 0 ? cuttlefish.viewbgcolor : Kirigami.Theme.viewBackgroundColor | 97 | color: Kirigami.Theme.backgroundColor | ||
155 | anchors.fill: parent | 98 | anchors.fill: parent | ||
156 | } | 99 | } | ||
157 | ColumnLayout { | 100 | ColumnLayout { | ||
158 | Shortcut { | 101 | Shortcut { | ||
159 | sequence: StandardKey.ZoomIn | 102 | sequence: StandardKey.ZoomIn | ||
160 | onActivated: tools.slider.value += 1 | 103 | onActivated: tools.slider.value += 1 | ||
161 | } | 104 | } | ||
162 | Shortcut { | 105 | Shortcut { | ||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | 149 | Loader { | |||
208 | source: "ResponsivePreview.qml" | 151 | source: "ResponsivePreview.qml" | ||
209 | } | 152 | } | ||
210 | Comparison { | 153 | Comparison { | ||
211 | id: comparison | 154 | id: comparison | ||
212 | } | 155 | } | ||
213 | Connections { | 156 | Connections { | ||
214 | target: tools | 157 | target: tools | ||
215 | onColorschemeChanged: (index) => { | 158 | onColorschemeChanged: (index) => { | ||
216 | cuttlefish.changeColors(index) | | |||
217 | toolsResponsive.currentIndex = index | 159 | toolsResponsive.currentIndex = index | ||
218 | } | 160 | } | ||
219 | onSliderValueChanged: (val) => { | 161 | onSliderValueChanged: (val) => { | ||
220 | toolsResponsive.value = val | 162 | toolsResponsive.value = val | ||
221 | } | 163 | } | ||
222 | } | 164 | } | ||
223 | Connections { | 165 | Connections { | ||
224 | target: toolsResponsive | 166 | target: toolsResponsive | ||
225 | onColorschemeChanged: (index) => { | 167 | onColorschemeChanged: (index) => { | ||
226 | cuttlefish.changeColors(index) | | |||
227 | tools.currentIndex = index | 168 | tools.currentIndex = index | ||
228 | } | 169 | } | ||
229 | onSliderValueChanged: (val) => { | 170 | onSliderValueChanged: (val) => { | ||
230 | tools.value = val | 171 | tools.value = val | ||
231 | } | 172 | } | ||
232 | } | 173 | } | ||
233 | Item { | 174 | Item { | ||
234 | id: preview | 175 | id: preview | ||
235 | property string iconName: "plasma" | 176 | property string iconName: "plasma" | ||
236 | property string fullPath: "" | 177 | property string fullPath: "" | ||
237 | property string category: "" | 178 | property string category: "" | ||
238 | property string fileName: "" | 179 | property string fileName: "" | ||
239 | property string type: "" | 180 | property string type: "" | ||
240 | property string iconTheme: "" | 181 | property string iconTheme: "" | ||
241 | property variant sizes: [] | 182 | property variant sizes: [] | ||
242 | property bool scalable: true | 183 | property bool scalable: true | ||
243 | } | 184 | } | ||
244 | | ||||
245 | Component.onCompleted: { | | |||
246 | cuttlefish.schemeStash += Kirigami.Theme.textColor | | |||
247 | cuttlefish.schemeStash += Kirigami.Theme.backgroundColor | | |||
248 | cuttlefish.schemeStash += Kirigami.Theme.highlightColor | | |||
249 | cuttlefish.schemeStash += Kirigami.Theme.highlightedTextColor | | |||
250 | cuttlefish.schemeStash += Kirigami.Theme.positiveTextColor | | |||
251 | cuttlefish.schemeStash += Kirigami.Theme.neutralTextColor | | |||
252 | cuttlefish.schemeStash += Kirigami.Theme.negativeTextColor | | |||
253 | cuttlefish.schemeStash += Kirigami.Theme.viewBackgroundColor | | |||
254 | console.log(cuttlefish.schemeStash) | | |||
255 | } | | |||
256 | } | 185 | } |