Skip to content

Commit

Permalink
use the latest dependencies and added qvault (#52) (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
EddyTheCo authored Feb 4, 2024
1 parent 1f0b493 commit 9a7fff1
Show file tree
Hide file tree
Showing 3 changed files with 294 additions and 12 deletions.
33 changes: 24 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ option(USE_OMClient "add open-meteo types" ON)
option(USE_DateTimePickers "add datetimepickers types" ON)
option(USE_Iotaaccount "add iota account types" ON)
option(USE_Iotaconnection "add iota connection types" ON)
option(USE_QVault "add QVault types" ON)


include(FetchContent)
Expand Down Expand Up @@ -35,15 +36,15 @@ qt6_add_executable(appqmlonline
)
if(USE_OMClient)
FetchContent_Declare(
OMQml
openMeteo
GIT_REPOSITORY https://github.com/EddyTheCo/OMClient.git
GIT_TAG v0.1.2
FIND_PACKAGE_ARGS 0.1 CONFIG
GIT_TAG v0.2.0
FIND_PACKAGE_ARGS 0.2 CONFIG
)
FetchContent_MakeAvailable(OMQml)
target_link_libraries(appqmlonline PRIVATE OMQml
$<$<STREQUAL:$<TARGET_PROPERTY:OMQml,TYPE>,STATIC_LIBRARY>:OMQmlplugin>)
list(APPEND qmlimport OMQml)
FetchContent_MakeAvailable(openMeteo)
target_link_libraries(appqmlonline PRIVATE openMeteo::OMClient
$<$<STREQUAL:$<TARGET_PROPERTY:openMeteo::OMClient,TYPE>,STATIC_LIBRARY>:openMeteo::OMClientplugin>)
list(APPEND qmlimport Esterv.CustomControls.OpenMeteo)
endif(USE_OMClient)
if(USE_Iotaconnection)
FetchContent_Declare(
Expand All @@ -69,7 +70,7 @@ FetchContent_MakeAvailable(IotaAccount)
target_link_libraries(appqmlonline PRIVATE IotaAccount::account
$<$<STREQUAL:$<TARGET_PROPERTY:IotaAccount::account,TYPE>,STATIC_LIBRARY>:IotaAccount::accountplugin>
)
list(APPEND qmlimport Esterv.Iota.Account)
list(APPEND qmlimport "Esterv.Iota.Account")
endif(USE_Iotaaccount)

if(USE_QtQr)
Expand All @@ -91,7 +92,7 @@ if(USE_DateTimePickers)
FetchContent_Declare(
DTPickersQML
GIT_REPOSITORY https://github.com/EddyTheCo/DateTimePickers.git
GIT_TAG v0.1.2
GIT_TAG v0.1.3
FIND_PACKAGE_ARGS 0.1 CONFIG
)
FetchContent_MakeAvailable(DTPickersQML)
Expand All @@ -102,6 +103,20 @@ target_compile_definitions(appqmlonline PRIVATE USE_QtQr)
list(APPEND qmlimport "Esterv.CustomControls.DateTimePickers")
endif(USE_DateTimePickers)

if(USE_QVault)
FetchContent_Declare(
QtVault
GIT_REPOSITORY https://github.com/EddyTheCo/QVault.git
GIT_TAG v0.1.0
FIND_PACKAGE_ARGS 0.1 CONFIG
)
FetchContent_MakeAvailable(QtVault)
target_link_libraries(appqmlonline PRIVATE QtVault::vault
$<$<STREQUAL:$<TARGET_PROPERTY:QtVault::vault,TYPE>,STATIC_LIBRARY>:QtVault::vaultplugin>
)
list(APPEND qmlimport "Esterv.Utils.Vault")
endif(USE_QVault)

FetchContent_Declare(
EstervDesigns
GIT_REPOSITORY https://github.com/EddyTheCo/MyDesigns.git
Expand Down
6 changes: 3 additions & 3 deletions wasm/examples/omclient
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
*/

import QtQuick 2.0
import OMQml
import Esterv.CustomControls.OpenMeteo

Item
{
anchors.fill:parent

CurrentWeather
{
anchors.fill:parent
anchors.fill:parent
anchors.centerIn:parent
latitude:41.902916
longitude:12.453389
frontColor:"lightgray"
color:"lightgray"
}

}
267 changes: 267 additions & 0 deletions wasm/examples/vault
Original file line number Diff line number Diff line change
@@ -0,0 +1,267 @@
/*
* Shows the use of the account Esterv.Utils.Vault QML module.
* The library is found on https://github.com/EddyTheCo/QVault
*
*/


import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Esterv.Styles.Simple
import Esterv.CustomControls
import Esterv.Utils.Vault

Rectangle
{
color:Style.backColor1
anchors.fill:parent

Popup
{
id:pop1
property bool isSet:false

visible:false
closePolicy: Popup.CloseOnPressOutside
anchors.centerIn: Overlay.overlay
onClosed: {
pass.text="";
}

ColumnLayout
{
Label
{
text: qsTr(((vault.isEmpty)?"Set":"Enter")+" the password:")
}
TextField
{
id:pass
Layout.fillWidth: true
echoMode:TextInput.PasswordEchoOnEdit
ToolTip.text: qsTr("Wrong password")
ToolTip.visible: false
}

Button
{
text:qsTr("ok")
enabled: pass.text.length>8
onClicked:
{
if(pop1.isSet)
{
if(!vault.setDataString(setdata.text,pass.text))
{
pass.ToolTip.show(qsTr("Wrong password"),5000);
}
else
{
pop1.close();
}
}
else
{
getdata.text=vault.getDataString(pass.text);
pop1.close();
}

}
Layout.alignment: Qt.AlignRight || Qt.AlignBottom
}
}
}
Popup
{
id:pop2
visible:false
closePolicy: Popup.CloseOnPressOutside
anchors.centerIn: Overlay.overlay

onClosed: {
oldpass.text="";
newpass.text="";
}

ColumnLayout
{
Label
{
text: qsTr("Enter the vault password:")
}
TextField
{
id:oldpass
Layout.fillWidth: true
echoMode:TextInput.PasswordEchoOnEdit
}
Label
{
text: qsTr("Set the vault password:")
}
TextField
{
id:newpass
Layout.fillWidth: true
echoMode:TextInput.PasswordEchoOnEdit
}

Button
{
text:qsTr("ok")
enabled: (newpass.text.length>8)&&(oldpass.text.length>8)
onClicked:
{
if(vault.changePassword(oldpass.text,newpass.text))
{
pop2.close();
}
else
{
oldpass.ToolTip.show(qsTr("Wrong password"),5000);
}
}
Layout.alignment: Qt.AlignRight || Qt.AlignBottom
}
}
}


Vault
{
id:vault
}
ThemeSwitch
{
id:themeswitch
}

ColumnLayout
{
width: parent.width
height:parent.height-themeswitch.height
anchors.top: themeswitch.bottom
spacing:30
RowLayout
{
Layout.alignment: Qt.AlignHCenter || Qt.AlignTop
Label
{
text:qsTr("The vault is "+((vault.isEmpty)?"":"not")+" empty")
}
Button{
id:changepass
Layout.margins: 5
text:qsTr("Change password")
visible:!vault.isEmpty
onClicked:
{
pop2.open();
}
}
}

GridLayout
{

flow: (parent.width<600)?GridLayout.TopToBottom:GridLayout.LeftToRight
columns:2
Layout.fillHeight: true
Layout.fillWidth: true
Layout.margins: 40
columnSpacing: 30
rowSpacing:30
Layout.alignment: Qt.AlignCenter
Rectangle
{
color:Style.backColor2
Layout.minimumHeight: 200
Layout.maximumHeight: 300
Layout.minimumWidth: 300
Layout.maximumWidth: 400
Layout.fillHeight: true
Layout.fillWidth: true
Layout.alignment: Qt.AlignCenter
ColumnLayout
{
anchors.fill:parent
Label
{
text: qsTr("Set the data:")
Layout.margins: 5
}
TextArea
{
id:setdata
Layout.fillHeight: true
Layout.fillWidth: true
Layout.maximumWidth: 300
Layout.maximumHeight: 200
Layout.alignment: Qt.AlignCenter
}
Button
{
text:qsTr("Save")
Layout.margins: 5
onClicked:
{
pop1.isSet=true;
pop1.open();
}
Layout.alignment: Qt.AlignRight || Qt.AlignBottom
}

}
}
Rectangle
{
color:Style.backColor2
Layout.minimumHeight: 200
Layout.maximumHeight: 300
Layout.minimumWidth: 300
Layout.maximumWidth: 400
Layout.fillHeight: true
Layout.fillWidth: true
Layout.alignment: Qt.AlignCenter
ColumnLayout
{
anchors.fill:parent
Label
{
Layout.margins: 5
text: qsTr("data:")
}
TextArea
{
id:getdata
Layout.fillHeight: true
Layout.fillWidth: true
Layout.maximumWidth: 300
Layout.maximumHeight: 200
Layout.alignment: Qt.AlignCenter
readOnly:true
}

Button
{
text:qsTr("Retrieve")
Layout.margins: 5
onClicked:
{
pop1.isSet=false;
pop1.open();
}
Layout.alignment: Qt.AlignRight || Qt.AlignBottom
}


}
}
}




}
}

0 comments on commit 9a7fff1

Please sign in to comment.