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