diff --git a/app/qml/CMakeLists.txt b/app/qml/CMakeLists.txt
index 21e80f73a..9275d9ea4 100644
--- a/app/qml/CMakeLists.txt
+++ b/app/qml/CMakeLists.txt
@@ -114,12 +114,10 @@ set(MM_QML
gps/MMPositionProviderPage.qml
gps/MMStakeoutDrawer.qml
gps/components/MMGpsDataText.qml
- inputs/MMBaseInput.qml
inputs/MMComboboxInput.qml
inputs/MMPasswordInput.qml
inputs/MMSearchInput.qml
inputs/MMTextInput.qml
- inputs/MMTextWithButtonInput.qml
inputs/MMSwitchInput.qml
layers/MMFeaturesListPage.qml
layers/MMLayerDetailPage.qml
diff --git a/app/qml/inputs/MMBaseInput.qml b/app/qml/inputs/MMBaseInput.qml
deleted file mode 100644
index 7c117a3ec..000000000
--- a/app/qml/inputs/MMBaseInput.qml
+++ /dev/null
@@ -1,198 +0,0 @@
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-import QtQuick
-import QtQuick.Controls
-import QtQml.Models
-import QtQuick.Layouts
-
-import "../components"
-import "."
-
-//! This is a base class for all inputs/form editors, do not use this in the app directly
-
-Item {
- id: root
-
- signal contentClicked()
- signal leftActionClicked()
- signal rightActionClicked()
-
- property alias title: titleItem.text
- property alias leftAction: leftActionContainer.children
- property alias content: contentContainer.children
- property alias rightAction: rightActionContainer.children
- property string warningMsg
- property string errorMsg
- property bool hasFocus: false
- property color bgColor: __style.polarColor
- property bool hasCheckbox: false
- property alias checkboxChecked: checkbox.checked
-
- property real contentItemHeight: 50 * __dp
-
- property real spacing: 15 * __dp
- property real radius: __style.radius12
-
- width: parent.width
- height: mainColumn.height
-
- Column {
- id: mainColumn
-
- spacing: 6 * __dp
- anchors.left: parent.left
- anchors.right: parent.right
-
- Row {
- id: titleRow
-
- spacing: 4 * __dp
- width: parent.width
- visible: titleItem.text.length > 0
-
- MMCheckBox {
- id: checkbox
-
- small: true
- visible: root.hasCheckbox
- }
- Text {
- id: titleItem
-
- width: parent.width - checkbox.width - titleRow.spacing
-
- font: __style.p6
- wrapMode: Text.WordWrap
- }
- }
-
- Item {
- height: root.contentItemHeight
- anchors.left: parent.left
- anchors.right: parent.right
-
- Rectangle {
- id: background
-
- width: parent.width
- height: parent.height
-
- border.width: 2 * __dp
- color: root.bgColor
- radius: root.radius
- border.color: {
- if (root.hasFocus) {
- if (errorMsg.length > 0) {
- return __style.negativeColor
- }
- else if (warningMsg.length > 0) {
- return __style.warningColor
- }
- return __style.forestColor
- }
- return __style.transparentColor
- }
- }
-
- Row {
- height: parent.height
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.leftMargin: root.spacing
- anchors.rightMargin: root.spacing
-
- Item {
- id: leftActionContainer
-
- property bool actionAllowed: leftActionContainer.children.length > 1
-
- height: parent.height
- width: actionAllowed ? height/2 : 0
-
- Item {
- width: leftActionContainer.actionAllowed ? parent.width + root.spacing/2 : 0
- height: parent.height
- anchors.centerIn: parent
-
- MouseArea {
- anchors.fill: parent
- onReleased: root.leftActionClicked()
- }
- }
- }
-
- Item {
- id: contentContainer
-
- height: parent.height
- width: parent.width - (leftActionContainer.actionAllowed ? leftActionContainer.width : 0) - (rightActionContainer.actionAllowed ? rightActionContainer.width : 0)
-
- MouseArea {
- anchors.fill: parent
-
- onClicked: {
- root.contentClicked()
- }
- }
- }
-
- Item {
- id: rightActionContainer
-
- property bool actionAllowed: rightActionContainer.children.length > 1
-
- height: parent.height
- width: actionAllowed ? height/2 : 0
-
- Item {
- width: rightActionContainer.actionAllowed ? parent.width + root.spacing/2 : 0
- height: parent.height
- anchors.centerIn: parent
-
- MouseArea {
- anchors.fill: parent
- onReleased: root.rightActionClicked()
- }
- }
- }
- }
- }
-
- Item {
- id: messageItem
-
- width: parent.width
- height: msgRow.height
-
- Row {
- id: msgRow
-
- spacing: 4 * __dp
-
- MMIcon {
- id: msgIcon
-
- source: visible ? __style.errorCircleIcon : ""
- color: errorMsg.length > 0 ? __style.negativeColor : __style.warningColor
- size: __style.icon16
- visible: errorMsg.length > 0 || warningMsg.length > 0
- }
- Text {
- width: messageItem.width - msgRow.spacing - msgIcon.width
-
- text: root.errorMsg.length > 0 ? root.errorMsg : root.warningMsg
- font: __style.t4
- wrapMode: Text.WordWrap
- visible: root.errorMsg.length > 0 || root.warningMsg.length > 0
- }
- }
- }
- }
-}
diff --git a/app/qml/inputs/MMTextWithButtonInput.qml b/app/qml/inputs/MMTextWithButtonInput.qml
deleted file mode 100644
index 9d5b9cd1d..000000000
--- a/app/qml/inputs/MMTextWithButtonInput.qml
+++ /dev/null
@@ -1,82 +0,0 @@
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
-
-import QtQuick
-import QtQuick.Controls
-import QtQuick.Controls.Basic
-import "../components"
-
-/*
- * Common text input to use in the app, with button on right
- * Disabled state can be achieved by setting `enabled: false`.
- *
- * See MMBaseInput for more properties.
- */
-
-MMBaseInput {
- id: root
-
- property alias placeholderText: textField.placeholderText
- property alias text: textField.text
- property alias buttonText: buttonText.text
- property alias buttonEnabled: rightButton.enabled
-
- signal textEdited( string text )
- signal buttonClicked()
-
- hasFocus: textField.activeFocus
-
- content: TextField {
- id: textField
-
- anchors.verticalCenter: parent.verticalCenter
- width: parent.width + rightButton.x
-
- color: root.enabled ? __style.nightColor : __style.mediumGreenColor
- placeholderTextColor: __style.darkGreyColor
- font: __style.p5
- hoverEnabled: true
-
- background: Rectangle {
- color: __style.transparentColor
- }
-
- onTextEdited: root.textEdited( textField.text )
- }
-
- rightAction: Button {
- id: rightButton
-
- property bool transparent: false
-
- x: 10 * __dp - buttonText.width
- height: 34 * __dp
- anchors.verticalCenter: parent.verticalCenter
-
- contentItem: Text {
- id: buttonText
-
- anchors.centerIn: rightButton
- font: __style.t3
- color: rightButton.enabled ? rightButton.down || rightButton.hovered ? __style.grassColor : __style.forestColor : __style.deepOceanColor
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- }
-
- background: Rectangle {
- color: rightButton.enabled ? rightButton.down || rightButton.hovered ? __style.forestColor : __style.grassColor : __style.mediumGreenColor
- radius: height / 2
- }
-
- onClicked: {
- textField.forceActiveFocus()
- root.buttonClicked()
- }
- }
-}
diff --git a/gallery/qml.qrc b/gallery/qml.qrc
index d6cd74cd4..6dc5c0bae 100644
--- a/gallery/qml.qrc
+++ b/gallery/qml.qrc
@@ -87,13 +87,11 @@
../app/qml/account/MMLoginPage.qml
../app/qml/account/MMSignUpPage.qml
../app/qml/account/MMWhichIndustryPage.qml
- ../app/qml/inputs/MMBaseInput.qml
../app/qml/inputs/MMComboboxInput.qml
../app/qml/inputs/MMPasswordInput.qml
../app/qml/inputs/MMTextInput.qml
../app/qml/inputs/MMSearchInput.qml
../app/qml/inputs/MMSwitchInput.qml
- ../app/qml/inputs/MMTextWithButtonInput.qml
../app/qml/form/components/MMFormTabBar.qml
../app/qml/form/components/MMCalendarDrawer.qml
../app/qml/form/components/MMFeaturesListPageDrawer.qml
diff --git a/gallery/qml/pages/InputsPage.qml b/gallery/qml/pages/InputsPage.qml
index 375ec8fd5..0cf9030ec 100644
--- a/gallery/qml/pages/InputsPage.qml
+++ b/gallery/qml/pages/InputsPage.qml
@@ -90,15 +90,6 @@ ScrollView {
warningMsg: text.length > 0 ? "" : "Write something"
}
- MMInputs.MMTextWithButtonInput {
- title: "MMTextWithButtonInput"
- placeholderText: "Write something"
- buttonText: "Copy"
- width: parent.width
- onButtonClicked: console.log("Copy pressed")
- buttonEnabled: text.length > 0
- }
-
MMInputs.MMPasswordInput {
title: "MMPasswordInput"
text: "Password"
diff --git a/gallery/qml/pages/NotificationPage.qml b/gallery/qml/pages/NotificationPage.qml
index d9bcb7788..4cc27a453 100644
--- a/gallery/qml/pages/NotificationPage.qml
+++ b/gallery/qml/pages/NotificationPage.qml
@@ -12,63 +12,69 @@ import QtQuick.Controls
import QtQuick.Controls.Basic
import "../../app/qml/components"
+import "../../app/qml/components/private" as MMPrivateComponents
import "../../app/qml/inputs"
+
import mm 1.0 as MM
Page {
id: pane
- Rectangle {
- anchors.fill: parent
- color: "white"
+ background: Rectangle {
+ color: __style.lightGreenColor
}
- Column {
- width: parent.width - 60
- spacing: 20
- anchors.centerIn: parent
+ contentItem: Item {
+ width: ( ApplicationWindow.window?.width ?? 0 )
- MMTextWithButtonInput {
- buttonText: "Send"
- anchors.horizontalCenter: parent.horizontalCenter
- text: "Write an informative message"
+ Column {
+ width: parent.width * 2/3
+ spacing: 20
+ x: parent.width / 2 - width / 2
- onButtonClicked: { __notificationModel.addInfo(text) }
- }
- MMTextWithButtonInput {
- buttonText: "Send"
- anchors.horizontalCenter: parent.horizontalCenter
- text: "Write a success message"
+ MMPrivateComponents.MMBaseSingleLineInput {
+ width: parent.width
+ text: "Write an informative message"
- onButtonClicked: { __notificationModel.addSuccess(text) }
- }
- MMTextWithButtonInput {
- buttonText: "Send"
- anchors.horizontalCenter: parent.horizontalCenter
- text: "Write a warning message"
+ rightContent: MMIcon { source: __style.checkmarkIcon }
+ onRightContentClicked: { __notificationModel.addInfo(text) }
+ }
- onButtonClicked: { __notificationModel.addWarning(text) }
- }
- MMTextWithButtonInput {
- buttonText: "Send"
- anchors.horizontalCenter: parent.horizontalCenter
- text: "Write an error message"
+ MMPrivateComponents.MMBaseSingleLineInput {
+ width: parent.width
+ text: "Write a success message"
- onButtonClicked: { __notificationModel.addError(text) }
- }
- MMTextWithButtonInput {
- buttonText: "Send"
- anchors.horizontalCenter: parent.horizontalCenter
- text: "Stojí, stojí mohyla, Na mohyle zlá chvíľa, Na mohyle tŕnie chrastie A v tom tŕní, chrastí rastie, Rastie, kvety rozvíja Jedna žltá ľalia. Tá ľalia smutno vzdychá: „Hlávku moju tŕnie pichá A nožičky oheň páli – Pomôžte mi v mojom žiali!“ "
+ rightContent: MMIcon { source: __style.checkmarkIcon }
+ onRightContentClicked: { __notificationModel.addSuccess(text) }
+ }
+ MMPrivateComponents.MMBaseSingleLineInput {
+ width: parent.width
+ text: "Write a warning message"
- onButtonClicked: { __notificationModel.addInfo(text) }
- }
- MMTextWithButtonInput {
- buttonText: "Send"
- anchors.horizontalCenter: parent.horizontalCenter
- text: "Click on notification to invoke action"
+ rightContent: MMIcon { source: __style.checkmarkIcon }
+ onRightContentClicked: { __notificationModel.addWarning(text) }
+ }
+ MMPrivateComponents.MMBaseSingleLineInput {
+ width: parent.width
+ text: "Write an error message"
+
+ rightContent: MMIcon { source: __style.checkmarkIcon }
+ onRightContentClicked: { __notificationModel.addError(text) }
+ }
+ MMPrivateComponents.MMBaseSingleLineInput {
+ width: parent.width
+ text: "Stojí, stojí mohyla, Na mohyle zlá chvíľa, Na mohyle tŕnie chrastie A v tom tŕní, chrastí rastie, Rastie, kvety rozvíja Jedna žltá ľalia. Tá ľalia smutno vzdychá: „Hlávku moju tŕnie pichá A nožičky oheň páli – Pomôžte mi v mojom žiali!“ "
+
+ rightContent: MMIcon { source: __style.checkmarkIcon }
+ onRightContentClicked: { __notificationModel.addInfo(text) }
+ }
+ MMPrivateComponents.MMBaseSingleLineInput {
+ width: parent.width
+ text: "Click on notification to invoke action"
- onButtonClicked: { __notificationModel.addWarning(text, MM.NotificationType.ShowProjectIssuesAction) }
+ rightContent: MMIcon { source: __style.checkmarkIcon }
+ onRightContentClicked: { __notificationModel.addWarning(text, MM.NotificationType.ShowProjectIssuesAction) }
+ }
}
}