Skip to content

Commit

Permalink
UI improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
emericg committed Jan 19, 2024
1 parent 3515bc2 commit 1967f13
Show file tree
Hide file tree
Showing 10 changed files with 113 additions and 21 deletions.
1 change: 1 addition & 0 deletions assets/assets.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<file>icons_material/baseline-arrow_back-24px.svg</file>
<file>icons_material/baseline-autorenew-24px.svg</file>
<file>icons_material/baseline-backspace-24px.svg</file>
<file>icons_material/baseline-broken_image-24px.svg</file>
<file>icons_material/baseline-camera-24px.svg</file>
<file>icons_material/baseline-chevron_left-24px.svg</file>
<file>icons_material/baseline-chevron_right-24px.svg</file>
Expand Down
1 change: 1 addition & 0 deletions assets/icons_material/baseline-broken_image-24px.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions qml/ScreenAboutFormats.qml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Item {
required property var encode

anchors.left: parent.left
anchors.leftMargin: 16
anchors.leftMargin: Theme.componentMargin
anchors.right: parent.right
anchors.rightMargin: 4
height: 32
Expand Down Expand Up @@ -164,7 +164,7 @@ Item {

RowLayout {
anchors.fill: parent
anchors.leftMargin: 16
anchors.leftMargin: Theme.componentMargin
anchors.rightMargin: 4
height: 32

Expand Down
4 changes: 2 additions & 2 deletions qml/ScreenBarcodeDetails.qml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ Item {
width: parent.width
height: barcodedata.height + Theme.componentMargin
radius: Theme.componentRadius
color: "white"
color: Theme.colorComponentBackground
border.width: 2
border.color: Theme.colorComponentBorder

Expand Down Expand Up @@ -225,7 +225,7 @@ Item {
width: parent.width
height: barcodedata2.contentHeight + Theme.componentMargin
radius: Theme.componentRadius
color: "white"
color: Theme.colorComponentBackground
border.width: 2
border.color: Theme.colorComponentBorder

Expand Down
2 changes: 1 addition & 1 deletion qml/ScreenBarcodeHistory.qml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Loader {
ListView {
model: barcodeManager.barcodesHistory
delegate: WidgetBarcodeHistory {
width: parent.width
width: ListView.view.width
onClicked: {
stackView.push(detailsView)
stackView.get(1).loadBarcode(modelData)
Expand Down
79 changes: 69 additions & 10 deletions qml/ScreenBarcodeWriter.qml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,39 @@ Loader {
if (settingsManager.backend_zint) return "image://ZintQml/encode/" + barcodeAdvanced.barcode_string + barcodeAdvanced.barcode_settings_zxingcpp
if (settingsManager.backend_zxingcpp) return "image://ZXingCpp/encode/" + barcodeAdvanced.barcode_string + barcodeAdvanced.barcode_settings_zxingcpp
if (settingsManager.backend_qzxing) return "image://QZXing/encode/" + barcodeAdvanced.barcode_string + barcodeAdvanced.barcode_settings_qzxing
return ""
}

IconSvg {
width: 80
height: 80
anchors.centerIn: parent
visible: !barcodeAdvanced.barcode_string
source: "qrc:/assets/icons_material/duotone-edit-24px.svg"
color: Theme.colorIcon
}
}

Rectangle {
id: errorarea
anchors.fill: parent

radius: Theme.componentRadius
color: Theme.colorWarning

opacity: (barcodeImage.status == Image.Error &&
barcodeAdvanced.barcode_string) ? 0.5 : 0
Behavior on opacity { NumberAnimation { duration: 233 } }

border.width: 2
border.color: Theme.colorError

IconSvg {
width: 80
height: 80
anchors.centerIn: parent
source: "qrc:/assets/icons_material/baseline-broken_image-24px.svg"
color: Theme.colorError
}
}

Expand Down Expand Up @@ -238,7 +271,7 @@ Loader {
height: 40

visible: (selectorBarcodes.currentMode == "1d") // linear
placeholderText: qsTr("type barcode content here")
placeholderText: qsTr("Type barcode content here!")

maximumLength: 12
validator: IntValidator { bottom: 0; top: 999999999; }
Expand All @@ -265,8 +298,10 @@ Loader {
anchors.top: parent.top
anchors.right: parent.right
anchors.bottom: parent.bottom

fullColor: true
visible: barcodeTextField.text
opacity: barcodeTextField.text ? 1 : 0
Behavior on opacity { NumberAnimation { duration: 200 } }

text: qsTr("clear")
onClicked: barcodeTextField.clear()
Expand All @@ -280,18 +315,40 @@ Loader {
height: isPhone ? 96 : 128

visible: (selectorBarcodes.currentMode === "2d") // matrix
placeholderText: qsTr("type barcode content here")
placeholderText: qsTr("Type barcode content here!")

wrapMode: Text.WrapAnywhere
selectByMouse: true
onTextChanged: barcodeAdvanced.barcode_string = text

SelectorMenuThemed {
id: barcodeEncodingSeclector
anchors.left: parent.left
anchors.bottom: parent.bottom
height: 32

opacity: 0.66
currentSelection: 0
model: ListModel {
id: lmEncodingSelector
ListElement { idx: 0; txt: "UTF-8"; }
ListElement { idx: 1; txt: "ASCII"; }
ListElement { idx: 2; txt: "BYTE"; }
}

onMenuSelected: (index) => {
//
}
}

ButtonWireframe {
anchors.right: parent.right
anchors.bottom: parent.bottom
height: 36
height: 32

fullColor: true
visible: barcodeTextArea.text
opacity: barcodeTextArea.text ? 1 : 0
Behavior on opacity { NumberAnimation { duration: 200 } }

text: qsTr("clear")
onClicked: {
Expand All @@ -308,19 +365,19 @@ Loader {
anchors.left: parent.left
anchors.right: parent.right

visible: (settingsManager.backend_writer !== "qzxing")
visible: (selectorBarcodes.model !== null)

ListModel {
id: lmSelectorBarcodes_zintqml

// matrix
ListElement { idx: 0; type: "2d"; txt: "QrCode"; format: "qrcode"; maxnum: 0; maxchar: 4296; maxbytes: 2953; ecc: 4; }
ListElement { idx: 1; type: "2d"; txt: "µ QrCode"; format: "microqrcode"; maxnum: 0; maxchar: 21; maxbytes: 256; ecc: 4; }
ListElement { idx: 2; type: "2d"; txt: "rµ QrCode"; format: "rmqr"; maxnum: 0; maxchar: 21; maxbytes: 256; ecc: 4; }
ListElement { idx: 1; type: "2d"; txt: "µQrCode"; format: "microqrcode"; maxnum: 0; maxchar: 21; maxbytes: 256; ecc: 4; }
ListElement { idx: 2; type: "2d"; txt: "rect. µQrCode"; format: "rmqr"; maxnum: 0; maxchar: 21; maxbytes: 256; ecc: 4; }
ListElement { idx: 3; type: "2d"; txt: "Aztec"; format: "aztec"; maxnum: 0; maxchar: 3067; maxbytes: 3067; ecc: 8; }
ListElement { idx: 4; type: "2d"; txt: "DataMatrix"; format: "datamatrix"; maxnum: 0; maxchar: 2335; maxbytes: 1556; ecc: 0; }
ListElement { idx: 5; type: "2d"; txt: "PDF417"; format: "pdf417"; maxnum: 0; maxchar: 1850; maxbytes: 1108; ecc: 8; }
ListElement { idx: 6; type: "2d"; txt: "Micro PDF417"; format: "micropdf417"; maxnum: 0; maxchar: 256; maxbytes: 1108; ecc: 8; }
ListElement { idx: 6; type: "2d"; txt: "µPDF417"; format: "micropdf417"; maxnum: 0; maxchar: 256; maxbytes: 1108; ecc: 8; }
ListElement { idx: 7; type: "2d"; txt: "GridMatrix"; format: "gridmatrix"; maxnum: 0; maxchar: 2335; maxbytes: 1556; ecc: 0; }
// esoteric (but fun)
ListElement { idx: 8; type: "2d"; txt: "DotCode"; format: "dotcode"; maxnum: 0; maxchar: 2335; maxbytes: 1556; ecc: 0; }
Expand Down Expand Up @@ -354,6 +411,7 @@ Loader {
model: {
if (settingsManager.backend_writer === "zint") return lmSelectorBarcodes_zintqml
if (settingsManager.backend_writer === "zxingcpp") return lmSelectorBarcodes_zxingcpp
return null
}

currentSelection: 0
Expand All @@ -372,7 +430,7 @@ Loader {
anchors.left: parent.left
anchors.right: parent.right

visible: (selectorBarcodes.currentMode === "2d") // matrix
visible: (barcodeEccSeclector.model !== null)
spacing: 16

Text {
Expand Down Expand Up @@ -432,6 +490,7 @@ Loader {
barcodeAdvanced.format === "rmqr") return lmBarcodeEccQR
if (barcodeAdvanced.format === "pdf417" ||
barcodeAdvanced.format === "micropdf417") return lmBarcodeEccPdf
return null
}

onModelChanged: {
Expand Down
2 changes: 1 addition & 1 deletion qml/ScreenSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ Loader {
if (settingsManager.backend_writer === "qzxing") return 1
if (settingsManager.backend_writer === "zxingcpp") return 2
if (settingsManager.backend_writer === "zint") return 3
return 0
return 3
}

onMenuSelected: (index) => {
Expand Down
2 changes: 1 addition & 1 deletion qml/components.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<file alias="ButtonWireframeIcon.qml">components_generic/ButtonWireframeIcon.qml</file>
<file alias="ButtonWireframeIconCentered.qml">components_generic/ButtonWireframeIconCentered.qml</file>
<file alias="IconSvg.qml">components_generic/IconSvg.qml</file>
<file alias="RoundButtonText.qml">components_generic/RoundButtonText.qml</file>
<file alias="ItemTagSmall.qml">components_generic/ItemTagSmall.qml</file>
<file alias="RoundButtonIcon.qml">components_generic/RoundButtonIcon.qml</file>
<file alias="SimpleShadow.qml">components_generic/SimpleShadow6.qml</file>
<file alias="SelectorMenu.qml">components_generic/SelectorMenu.qml</file>
Expand Down
6 changes: 2 additions & 4 deletions qml/components/WidgetBarcodeHistory.qml
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,9 @@ SwipeDelegate {
anchors.right: parent.right
spacing: 8

Text {
ItemTagSmall {
visible: modelData.content
text: modelData.content
font.pixelSize: Theme.fontSizeContentBig
color: Theme.colorSubText
}
Text {
text: modelData.data
Expand Down Expand Up @@ -218,7 +216,7 @@ SwipeDelegate {
}
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Supprimer")
text: qsTr("Remove")
font.bold: true
color: "white"
}
Expand Down
33 changes: 33 additions & 0 deletions qml/components_generic/ItemTagSmall.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import QtQuick 2.15

import ThemeEngine 1.0

Rectangle {
id: control
implicitWidth: 56
implicitHeight: 24

width: contentText.contentWidth + 8
radius: Theme.componentRadius
color: Theme.colorForeground

// settings
property string text: "TAG"
property string textColor: Theme.colorText
property int textSize: Theme.componentFontSize
property int textCapitalization: Font.Normal
property bool textBold: false

Text {
id: contentText
anchors.centerIn: parent

text: control.text
textFormat: Text.PlainText

color: control.textColor
font.bold: control.textBold
font.pixelSize: control.textSize
font.capitalization: control.textCapitalization
}
}

0 comments on commit 1967f13

Please sign in to comment.