Skip to content

Commit 9b3be06

Browse files
committed
Various improvements
1 parent 21f5ec9 commit 9b3be06

6 files changed

Lines changed: 538 additions & 202 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ set(SOURCES
4545
src/main.cpp
4646
src/SettingsManager.cpp src/SettingsManager.h
4747
src/DatabaseManager.cpp src/DatabaseManager.h
48+
src/PermissionManager.cpp src/PermissionManager.h
4849
src/BarcodeManager.cpp src/BarcodeManager.h
4950
src/Barcode.cpp src/Barcode.h
5051
src/utils_camera.cpp src/utils_camera.h

QmlMobileScanner.pro

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,14 @@ DESTDIR = bin/
4343
SOURCES += src/main.cpp \
4444
src/SettingsManager.cpp \
4545
src/DatabaseManager.cpp \
46+
src/PermissionManager.cpp \
4647
src/BarcodeManager.cpp \
4748
src/Barcode.cpp \
4849
src/utils_camera.cpp
4950

5051
HEADERS += src/DatabaseManager.h \
5152
src/SettingsManager.h \
53+
src/PermissionManager.h \
5254
src/BarcodeManager.h \
5355
src/Barcode.h \
5456
src/utils_camera.h

qml/DesktopSidebar.qml

Lines changed: 57 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import QtQuick
2-
import QtQuick.Controls
3-
import QtQuick.Window
42

53
import ComponentLibrary
64
import QmlMobileScanner
@@ -12,10 +10,10 @@ Rectangle {
1210
anchors.bottom: parent.bottom
1311

1412
z: 10
15-
width: isHdpi ? 72 : 80
13+
width: isHdpi ? 220 : 240
1614
color: Theme.colorSidebar
1715

18-
////////////////////////////////////////////////////////////////////////////
16+
////////////
1917

2018
DragHandler {
2119
// Drag on the sidebar to drag the whole window // Qt 5.15+
@@ -24,101 +22,102 @@ Rectangle {
2422
target: null
2523
}
2624

27-
////////////////////////////////////////////////////////////////////////////
25+
////////////
2826

29-
// MENUS up
30-
31-
Column {
27+
Column { // top menu
3228
anchors.top: parent.top
33-
anchors.topMargin: 20
29+
anchors.topMargin: 16
3430
anchors.left: parent.left
35-
anchors.leftMargin: 0
31+
anchors.leftMargin: 12
3632
anchors.right: parent.right
37-
anchors.rightMargin: 0
38-
39-
spacing: 0
33+
anchors.rightMargin: 12
34+
spacing: 8
4035

41-
DesktopSidebarItem {
36+
DesktopSidebarMenu {
37+
text: qsTr("Scanner")
4238
source: "qrc:/IconLibrary/material-icons/duotone/qr_code_scanner.svg"
43-
sourceSize: 40
44-
45-
highlightMode: "background"
46-
highlighted: (appContent.state === "ScreenBarcodeReader")
47-
48-
indicatorVisible: false
49-
indicatorSource: "qrc:/IconLibrary/material-symbols/media/camera.svg"
39+
checked: (appContent.state === "ScreenBarcodeReader")
5040

5141
onClicked: screenBarcodeReader.loadScreen()
5242
}
53-
DesktopSidebarItem {
43+
DesktopSidebarMenu {
44+
text: qsTr("Generator")
5445
source: "qrc:/IconLibrary/material-icons/duotone/qr_code_2.svg"
55-
sourceSize: 40
56-
57-
highlightMode: "background"
58-
highlighted: (appContent.state === "ScreenBarcodeWriter")
46+
checked: (appContent.state === "ScreenBarcodeWriter")
5947

6048
onClicked: screenBarcodeWriter.loadScreen()
6149
}
62-
DesktopSidebarItem {
50+
DesktopSidebarMenu {
51+
text: qsTr("Barcode history")
6352
source: "qrc:/IconLibrary/material-icons/duotone/list.svg"
64-
sourceSize: 40
65-
66-
highlightMode: "background"
67-
highlighted: (appContent.state === "ScreenBarcodeHistory")
53+
checked: (appContent.state === "ScreenBarcodeHistory")
6854

6955
onClicked: screenBarcodeHistory.loadScreen()
7056
}
7157
}
7258

73-
// MENUS down
59+
////////////
7460

75-
Column {
61+
Column { // bottom menu
7662
anchors.left: parent.left
77-
anchors.leftMargin: 0
63+
anchors.leftMargin: 12
7864
anchors.right: parent.right
79-
anchors.rightMargin: 0
65+
anchors.rightMargin: 12
8066
anchors.bottom: parent.bottom
81-
anchors.bottomMargin: 20
82-
83-
spacing: 0
67+
anchors.bottomMargin: 16
68+
spacing: 8
8469

85-
DesktopSidebarItem {
70+
DesktopSidebarMenu {
71+
text: qsTr("Settings")
8672
source: "qrc:/IconLibrary/material-icons/duotone/tune.svg"
87-
sourceSize: 40
88-
89-
highlightMode: (Theme.sidebarSelector) ? "indicator" : "background"
90-
highlighted: appContent.state === "ScreenSettings"
73+
checked: (appContent.state === "ScreenSettings")
9174

9275
onClicked: screenSettings.loadScreen()
9376
}
94-
DesktopSidebarItem {
95-
source: "qrc:/IconLibrary/material-icons/duotone/info.svg"
96-
sourceSize: 40
9777

98-
highlightMode: (Theme.sidebarSelector) ? "indicator" : "background"
99-
highlighted: (appContent.state === "ScreenAbout" ||
100-
appContent.state === "ScreenAboutFormats" ||
101-
appContent.state === "ScreenAboutPermissions")
78+
DesktopSidebarMenu {
79+
text: qsTr("About")
80+
source: "qrc:/IconLibrary/material-icons/duotone/info.svg"
81+
checked: (appContent.state === "ScreenAbout" ||
82+
appContent.state === "ScreenAboutFormats" ||
83+
appContent.state === "ScreenAboutPermissions")
10284

10385
onClicked: screenAbout.loadScreen()
10486
}
105-
DesktopSidebarItem {
87+
88+
DesktopSidebarMenu {
89+
text: qsTr("Exit")
10690
source: "qrc:/IconLibrary/material-icons/duotone/exit_to_app.svg"
107-
sourceSize: 40
108-
highlightMode: "circle"
109-
onClicked: appWindow.close()
91+
onClicked: Qt.quit()
11092
}
11193
}
11294

113-
//
95+
////////////
11496

115-
Rectangle {
97+
Rectangle { // border
11698
anchors.top: parent.top
11799
anchors.right: parent.right
118100
anchors.bottom: parent.bottom
101+
119102
width: 2
120-
color: Theme.colorSidebarHighlight
103+
opacity: 1.0
104+
color: Theme.colorSeparator
105+
}
106+
107+
Rectangle { // fake shadow
108+
anchors.top: parent.top
109+
anchors.left: parent.right
110+
anchors.bottom: parent.bottom
111+
112+
width: 8
113+
opacity: 0.333
114+
115+
gradient: Gradient {
116+
orientation: Gradient.Horizontal
117+
GradientStop { position: 0.0; color: Theme.colorSeparator; }
118+
GradientStop { position: 1.0; color: "transparent"; }
119+
}
121120
}
122121

123-
////////////////////////////////////////////////////////////////////////////
122+
////////////
124123
}

0 commit comments

Comments
 (0)