feat(@desktop/keycards): managing mocked keycards from the separate window
This commit is contained in:
parent
2af8e49ee3
commit
1699189cec
|
@ -8,7 +8,6 @@ import StatusQ.Core.Theme 0.1
|
|||
|
||||
import utils 1.0
|
||||
import shared.popups.keycard 1.0
|
||||
import shared.panels 1.0
|
||||
|
||||
import "controls"
|
||||
import "views"
|
||||
|
@ -31,16 +30,6 @@ OnboardingBasePage {
|
|||
loader.sourceComponent = undefined
|
||||
}
|
||||
|
||||
MockedKeycardLibFlowController {
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.topMargin: Style.current.bigPadding
|
||||
anchors.leftMargin: 4 * Style.current.bigPadding
|
||||
visible: localAppSettings.testEnvironment
|
||||
|
||||
relatedModule: root.startupStore.startupModuleInst
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: loader
|
||||
anchors.fill: parent
|
||||
|
|
|
@ -1622,20 +1622,4 @@ Item {
|
|||
onClosed: userAgreementLoader.active = false
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: mockedKeycardLibInitialController
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
active: localAppSettings.testEnvironment
|
||||
|
||||
sourceComponent: MockedKeycardLibInitialController {
|
||||
width: 450
|
||||
height: 500
|
||||
|
||||
onClose: {
|
||||
mockedKeycardLibInitialController.active = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import QtQuick 2.14
|
||||
import QtQuick.Controls 2.14
|
||||
import QtQuick.Layouts 1.14
|
||||
|
||||
import StatusQ.Core 0.1
|
||||
|
@ -9,78 +10,104 @@ import shared.controls 1.0
|
|||
|
||||
import utils 1.0
|
||||
|
||||
Rectangle {
|
||||
ApplicationWindow {
|
||||
id: root
|
||||
|
||||
color: Style.current.modalBackground
|
||||
radius: Style.current.radius
|
||||
border.color: Style.current.grey3
|
||||
border.width: 2
|
||||
property var relatedModule
|
||||
|
||||
signal close()
|
||||
title: qsTr("Mocked Keycard Lib Controller")
|
||||
minimumHeight: 600
|
||||
minimumWidth: 450
|
||||
|
||||
QtObject {
|
||||
id: d
|
||||
|
||||
property int btnWidth: 30
|
||||
property int btnHeight: 30
|
||||
property int margin: 8
|
||||
|
||||
property bool minimized: false
|
||||
property int maxWidth
|
||||
property int maxHeight
|
||||
onMinimizedChanged: {
|
||||
if (minimized) {
|
||||
d.maxWidth = root.width
|
||||
d.maxHeight = root.height
|
||||
root.width = header.implicitWidth + 2 * d.margin
|
||||
root.height = header.implicitHeight + 2 * d.margin
|
||||
return
|
||||
}
|
||||
root.width = d.maxWidth
|
||||
root.height = d.maxHeight
|
||||
}
|
||||
property int margin: 16
|
||||
property int spacing: 16
|
||||
}
|
||||
|
||||
Row {
|
||||
id: header
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: d.margin
|
||||
ColumnLayout {
|
||||
id: commands
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: d.margin
|
||||
spacing: d.margin
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.margins: d.margin
|
||||
spacing: d.spacing
|
||||
|
||||
StatusFlatRoundButton {
|
||||
type: StatusFlatRoundButton.Type.Secondary
|
||||
icon.name: d.minimized? "chevron-up" : "chevron-down"
|
||||
icon.color: Theme.palette.directColor1
|
||||
implicitWidth: d.btnWidth
|
||||
implicitHeight: d.btnHeight
|
||||
onClicked: {
|
||||
d.minimized = !d.minimized
|
||||
}
|
||||
StatusBaseText {
|
||||
text: qsTr("Use this buttons to control the flow")
|
||||
}
|
||||
|
||||
StatusFlatRoundButton {
|
||||
type: StatusFlatRoundButton.Type.Secondary
|
||||
icon.name: "close"
|
||||
icon.color: Theme.palette.directColor1
|
||||
implicitWidth: d.btnWidth
|
||||
implicitHeight: d.btnHeight
|
||||
onClicked: {
|
||||
root.close()
|
||||
Flow {
|
||||
Layout.fillWidth: true
|
||||
spacing: d.spacing
|
||||
|
||||
StatusButton {
|
||||
text: qsTr("Plugin Reader")
|
||||
|
||||
onClicked: {
|
||||
if (!!root.relatedModule) {
|
||||
root.relatedModule.pluginMockedReaderAction()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StatusButton {
|
||||
text: qsTr("Unplug Reader")
|
||||
|
||||
onClicked: {
|
||||
if (!!root.relatedModule) {
|
||||
root.relatedModule.unplugMockedReaderAction()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StatusButton {
|
||||
text: qsTr("Insert Keycard 1")
|
||||
|
||||
onClicked: {
|
||||
if (!!root.relatedModule) {
|
||||
root.relatedModule.insertMockedKeycardAction(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StatusButton {
|
||||
text: qsTr("Insert Keycard 2")
|
||||
|
||||
onClicked: {
|
||||
if (!!root.relatedModule) {
|
||||
root.relatedModule.insertMockedKeycardAction(2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StatusButton {
|
||||
text: qsTr("Remove Keycard")
|
||||
|
||||
onClicked: {
|
||||
if (!!root.relatedModule) {
|
||||
root.relatedModule.removeMockedKeycardAction()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MockedKeycardReaderStateSelector {
|
||||
id: readerState
|
||||
anchors.top: parent.top
|
||||
anchors.top: commands.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.topMargin: Style.current.bigPadding
|
||||
anchors.leftMargin: Style.current.bigPadding
|
||||
visible: !d.minimized
|
||||
title: qsTr("Initial reader state")
|
||||
anchors.margins: d.margin
|
||||
anchors.topMargin: 3 * d.margin
|
||||
title: qsTr("Set initial reader state (refers to keycard 1 only)")
|
||||
}
|
||||
|
||||
StatusTabBar {
|
||||
|
@ -88,8 +115,8 @@ Rectangle {
|
|||
anchors.top: readerState.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.margins: Style.current.bigPadding
|
||||
visible: !d.minimized
|
||||
anchors.margins: d.margin
|
||||
anchors.topMargin: 3 * d.margin
|
||||
|
||||
StatusTabButton {
|
||||
width: implicitWidth
|
||||
|
@ -109,14 +136,15 @@ Rectangle {
|
|||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.margins: Style.current.halfPadding
|
||||
visible: !d.minimized
|
||||
currentIndex: tabBar.currentIndex
|
||||
|
||||
KeycardSettingsTab {
|
||||
cardIndex: 1
|
||||
|
||||
onRegisterKeycard: {
|
||||
mainModule.registerMockedKeycard(cardIndex, readerState.selectedState, kcState, kc, kcHelper)
|
||||
if (!!root.relatedModule) {
|
||||
relatedModule.registerMockedKeycard(cardIndex, readerState.selectedState, kcState, kc, kcHelper)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,7 +152,9 @@ Rectangle {
|
|||
cardIndex: 2
|
||||
|
||||
onRegisterKeycard: {
|
||||
mainModule.registerMockedKeycard(cardIndex, MockedKeycardReaderStateSelector.NoKeycard, kcState, kc, kcHelper)
|
||||
if (!!root.relatedModule) {
|
||||
relatedModule.registerMockedKeycard(cardIndex, MockedKeycardReaderStateSelector.NoKeycard, kcState, kc, kcHelper)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -137,7 +167,7 @@ Rectangle {
|
|||
signal registerKeycard(int kcState, string kc, string kcHelper)
|
||||
|
||||
ColumnLayout {
|
||||
spacing: 16
|
||||
spacing: d.spacing
|
||||
|
||||
MockedKeycardStateSelector {
|
||||
id: keycardState
|
||||
|
@ -147,7 +177,7 @@ Rectangle {
|
|||
Column {
|
||||
id: customSection
|
||||
visible: keycardState.selectedState === MockedKeycardStateSelector.CustomKeycard
|
||||
spacing: 16
|
||||
spacing: d.spacing
|
||||
|
||||
StatusInput {
|
||||
id: mockedKeycard
|
|
@ -1,65 +0,0 @@
|
|||
import QtQuick 2.14
|
||||
import QtQuick.Layouts 1.14
|
||||
|
||||
import StatusQ.Controls 0.1
|
||||
|
||||
RowLayout {
|
||||
id: root
|
||||
|
||||
property var relatedModule
|
||||
|
||||
StatusButton {
|
||||
text: qsTr("Plugin R")
|
||||
|
||||
onClicked: {
|
||||
if (!!root.relatedModule) {
|
||||
root.relatedModule.pluginMockedReaderAction()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StatusButton {
|
||||
text: qsTr("Unplug R")
|
||||
|
||||
onClicked: {
|
||||
if (!!root.relatedModule) {
|
||||
root.relatedModule.unplugMockedReaderAction()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StatusButton {
|
||||
text: qsTr("Ins Kc 1")
|
||||
|
||||
onClicked: {
|
||||
if (!!root.relatedModule) {
|
||||
root.relatedModule.insertMockedKeycardAction(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StatusButton {
|
||||
text: qsTr("Ins Kc 2")
|
||||
|
||||
onClicked: {
|
||||
if (!!root.relatedModule) {
|
||||
root.relatedModule.insertMockedKeycardAction(2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
StatusButton {
|
||||
text: qsTr("Remove Kc")
|
||||
|
||||
onClicked: {
|
||||
if (!!root.relatedModule) {
|
||||
root.relatedModule.removeMockedKeycardAction()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 1
|
||||
}
|
||||
}
|
|
@ -25,5 +25,4 @@ StatusAssetSelector 1.0 StatusAssetSelector.qml
|
|||
StyledText 1.0 StyledText.qml
|
||||
TextWithLabel 1.0 TextWithLabel.qml
|
||||
DropAndEditImagePanel 1.0 DropAndEditImagePanel.qml
|
||||
MockedKeycardLibFlowController 1.0 MockedKeycardLibFlowController.qml
|
||||
MockedKeycardLibInitialController 1.0 MockedKeycardLibInitialController.qml
|
||||
MockedKeycardLibControllerWindow 1.0 MockedKeycardLibControllerWindow.qml
|
||||
|
|
|
@ -83,23 +83,21 @@ StatusModal {
|
|||
id: content
|
||||
width: scrollView.availableWidth
|
||||
implicitHeight: {
|
||||
let additionalHeight = localAppSettings.testEnvironment? 60 : 0
|
||||
|
||||
// for all flows
|
||||
if (root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.keycardMetadataDisplay ||
|
||||
root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.factoryResetConfirmationDisplayMetadata) {
|
||||
if (!root.sharedKeycardModule.keyPairStoredOnKeycardIsKnown) {
|
||||
return Constants.keycard.general.popupBiggerHeight + additionalHeight
|
||||
return Constants.keycard.general.popupBiggerHeight
|
||||
}
|
||||
}
|
||||
|
||||
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.importFromKeycard &&
|
||||
root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.manageKeycardAccounts &&
|
||||
root.sharedKeycardModule.keyPairHelper.accounts.count > 1) {
|
||||
return Constants.keycard.general.popupBiggerHeight + additionalHeight
|
||||
return Constants.keycard.general.popupBiggerHeight
|
||||
}
|
||||
|
||||
return Constants.keycard.general.popupHeight + additionalHeight
|
||||
return Constants.keycard.general.popupHeight
|
||||
}
|
||||
|
||||
sharedKeycardModule: root.sharedKeycardModule
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import QtQuick 2.14
|
||||
|
||||
import utils 1.0
|
||||
import shared.panels 1.0
|
||||
|
||||
import "./states"
|
||||
|
||||
|
@ -19,26 +18,9 @@ Item {
|
|||
property bool primaryButtonEnabled: false
|
||||
}
|
||||
|
||||
MockedKeycardLibFlowController {
|
||||
id: mockedLibFlowController
|
||||
anchors.top: parent.top
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.leftMargin: Style.current.padding
|
||||
anchors.rightMargin: Style.current.padding
|
||||
visible: localAppSettings.testEnvironment
|
||||
|
||||
relatedModule: mainModule
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: loader
|
||||
|
||||
anchors.top: mockedLibFlowController.visible? mockedLibFlowController.bottom : parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
anchors.fill: parent
|
||||
sourceComponent: {
|
||||
switch (root.sharedKeycardModule.currentState.stateType) {
|
||||
case Constants.keycardSharedState.biometrics:
|
||||
|
|
31
ui/main.qml
31
ui/main.qml
|
@ -95,6 +95,29 @@ StatusWindow {
|
|||
QtObject {
|
||||
id: d
|
||||
property int previousApplicationState: -1
|
||||
|
||||
property var mockedKeycardControllerWindow
|
||||
function runMockedKeycardControllerWindow() {
|
||||
if (localAppSettings.testEnvironment) {
|
||||
if (!!d.mockedKeycardControllerWindow) {
|
||||
d.mockedKeycardControllerWindow.close()
|
||||
}
|
||||
|
||||
console.info("running mocked keycard lib controller window")
|
||||
var c = Qt.createComponent("qrc:/imports/shared/panels/MockedKeycardLibControllerWindow.qml");
|
||||
if (c.status === Component.Ready) {
|
||||
d.mockedKeycardControllerWindow = c.createObject(applicationWindow, {
|
||||
"relatedModule": startupOnboarding.visible?
|
||||
startupModule :
|
||||
mainModule
|
||||
})
|
||||
if (d.mockedKeycardControllerWindow) {
|
||||
d.mockedKeycardControllerWindow.show()
|
||||
d.mockedKeycardControllerWindow.requestActivate()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Action {
|
||||
|
@ -152,6 +175,8 @@ StatusWindow {
|
|||
function onStartUpUIRaised() {
|
||||
applicationWindow.appIsReady = true;
|
||||
applicationWindow.storeAppState();
|
||||
|
||||
d.runMockedKeycardControllerWindow()
|
||||
}
|
||||
|
||||
function onAppStateChanged(state) {
|
||||
|
@ -194,6 +219,8 @@ StatusWindow {
|
|||
Style.changeTheme(localAppSettings.theme, systemPalette.isCurrentSystemThemeDark())
|
||||
Style.changeFontSize(localAccountSensitiveSettings.fontSize)
|
||||
Theme.updateFontSize(localAccountSensitiveSettings.fontSize)
|
||||
|
||||
d.runMockedKeycardControllerWindow()
|
||||
} else if(state === Constants.appState.appEncryptionProcess) {
|
||||
loader.sourceComponent = undefined
|
||||
appLoadingAnimation.active = true
|
||||
|
@ -380,11 +407,11 @@ StatusWindow {
|
|||
Qt.quit()
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
if (localAccountSensitiveSettings.quitOnClose) {
|
||||
Qt.quit();
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
applicationWindow.visible = false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue