Skip to content

Commit

Permalink
Merge pull request #3318 from MerginMaps/rework-base-input
Browse files Browse the repository at this point in the history
Upgrade of inputs and form editors
  • Loading branch information
tomasMizera authored Apr 19, 2024
2 parents 53b2f34 + 56cddd0 commit 5438f52
Show file tree
Hide file tree
Showing 58 changed files with 1,115 additions and 1,346 deletions.
5 changes: 5 additions & 0 deletions app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,11 @@ int main( int argc, char *argv[] )

init_qgis( appBundleDir );

#ifdef ANDROID
// See https://bugreports.qt.io/browse/QTBUG-86982 -> fix to make the predictive text disabled on Android
qputenv( "QT_ANDROID_ENABLE_WORKAROUND_TO_DISABLE_PREDICTIVE_TEXT", "1" );
#endif

// AppSettings has to be initialized after QGIS app init (because of correct reading/writing QSettings).
AppSettings as;

Expand Down
11 changes: 7 additions & 4 deletions app/mmstyle.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ class MMStyle: public QObject
Q_PROPERTY( QColor informativeColor READ informativeColor CONSTANT )

// Colors - others
Q_PROPERTY( QColor nightAlphaColor READ nightAlphaColor CONSTANT ) // placeholder input color
Q_PROPERTY( QColor errorBgInputColor READ errorBgInputColor CONSTANT ) // error bg input color
Q_PROPERTY( QColor shadowColor READ shadowColor CONSTANT )
Q_PROPERTY( QColor snappingColor READ snappingColor CONSTANT )

Expand Down Expand Up @@ -286,6 +284,7 @@ class MMStyle: public QObject

// Other
Q_PROPERTY( double row1 READ number1 CONSTANT )
Q_PROPERTY( double row4 READ number4 CONSTANT )
Q_PROPERTY( double row24 READ number24 CONSTANT )
Q_PROPERTY( double row36 READ number36 CONSTANT )
Q_PROPERTY( double row40 READ number40 CONSTANT )
Expand All @@ -297,13 +296,18 @@ class MMStyle: public QObject
Q_PROPERTY( double row67 READ number67 CONSTANT )
Q_PROPERTY( double row80 READ number80 CONSTANT )
Q_PROPERTY( double row114 READ number114 CONSTANT )
Q_PROPERTY( double row120 READ number120 CONSTANT )
Q_PROPERTY( double row160 READ number160 CONSTANT )
Q_PROPERTY( double radius2 READ number2 CONSTANT )
Q_PROPERTY( double radius6 READ number6 CONSTANT )
Q_PROPERTY( double radius8 READ number8 CONSTANT )
Q_PROPERTY( double radius12 READ number12 CONSTANT )
Q_PROPERTY( double radius16 READ number16 CONSTANT )
Q_PROPERTY( double radius20 READ number20 CONSTANT )
Q_PROPERTY( double radius30 READ number30 CONSTANT )
Q_PROPERTY( double radius40 READ number40 CONSTANT )
Q_PROPERTY( double width1 READ number1 CONSTANT )
Q_PROPERTY( double width2 READ number2 CONSTANT )
Q_PROPERTY( double scrollVelocityAndroid READ scrollVelocityAndroid CONSTANT ) // [px/s] scrolling on Android devices is too slow by default

// Breakpoint we use in some screens to differentiate mobile landscape
Expand Down Expand Up @@ -366,8 +370,6 @@ class MMStyle: public QObject
QColor informativeColor() {return QColor::fromString( "#BEDAF0" );}
QColor snappingColor() {return QColor::fromString( "#BD74FF" );}

QColor nightAlphaColor() {return QColor::fromString( "#AA12181F" );}
QColor errorBgInputColor() {return QColor::fromString( "#FEFAF9" );}
QColor shadowColor() {return QColor::fromString( "#66777777" );}

QUrl splitGeometryIcon() {return QUrl( "qrc:/SplitGeometry.svg" );}
Expand Down Expand Up @@ -675,6 +677,7 @@ class MMStyle: public QObject
double number148() {return 148 * mDp;}
double number149() {return 149 * mDp;}
double number150() {return 150 * mDp;}
double number160() {return 160 * mDp;}
double number250() {return 250 * mDp;}
double number400() {return 400 * mDp;}
double number720() {return 720 * mDp;}
Expand Down
9 changes: 4 additions & 5 deletions app/qml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,12 @@ set(MM_QML
components/MMListSpacer.qml
components/MMBusyIndicator.qml
components/MMMessage.qml
components/MMMorePhoto.qml
components/MMNotification.qml
components/MMNotificationView.qml
components/MMPage.qml
components/MMPageHeader.qml
components/MMPopup.qml
components/MMPhoto.qml
components/MMPhotoAttachment.qml
components/MMPhotoPreview.qml
components/MMProgressBar.qml
components/MMRadioButton.qml
components/MMRoundButton.qml
Expand All @@ -52,6 +49,8 @@ set(MM_QML
components/MMText.qml
components/MMToolbar.qml
components/MMToolbarButton.qml
components/private/MMBaseInput.qml
components/private/MMBaseSingleLineInput.qml
components/private/MMToolbarLongButton.qml
components/private/MMToolbarShortButton.qml
dialogs/MMCloseAccountDialog.qml
Expand Down Expand Up @@ -91,6 +90,8 @@ set(MM_QML
form/components/calendar/MMMonthGrid.qml
form/components/calendar/MMTimeTumbler.qml
form/components/calendar/MMTumbler.qml
form/components/photo/MMPhotoAttachment.qml
form/components/photo/MMPhotoPreview.qml
form/editors/MMFormCalendarEditor.qml
form/editors/MMFormComboboxBaseEditor.qml
form/editors/MMFormGalleryEditor.qml
Expand All @@ -114,12 +115,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
Expand Down
2 changes: 1 addition & 1 deletion app/qml/account/MMHowYouFoundUsPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ MMPage {

onTextChanged: root.selectedText = text

Component.onCompleted: textFieldComponent.forceActiveFocus()
Component.onCompleted: textField.forceActiveFocus()
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions app/qml/account/MMLoginPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ MMPage {
width: parent.width

title: qsTr( "Email or username" )
textFieldComponent.inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase
textField.inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase | Qt.ImhEmailCharactersOnly
}

MMPasswordInput {
Expand Down Expand Up @@ -200,10 +200,10 @@ MMPage {

title: qsTr( "Server address" )

bgColor: __style.lightGreenColor
textFieldBackground.color: __style.lightGreenColor

text: root.apiRoot
textFieldComponent.inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase
textField.inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase | Qt.ImhUrlCharactersOnly
}

MMListSpacer { height: __style.spacing40 }
Expand Down
4 changes: 2 additions & 2 deletions app/qml/account/MMSignUpPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ MMPage {
width: parent.width

title: qsTr( "Username" )
textFieldComponent.inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase
textField.inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase
}

MMTextInput {
Expand All @@ -81,7 +81,7 @@ MMPage {
width: parent.width

title: qsTr( "Email" )
textFieldComponent.inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase
textField.inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase | Qt.ImhEmailCharactersOnly
}

MMPasswordInput {
Expand Down
2 changes: 1 addition & 1 deletion app/qml/account/MMSwitchWorkspacePage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ MMComponents.MMPage {

placeholderText: qsTr( "Search" ) + "..."

onSearchTextChanged: function( searchText ) { root.searchTextChanged( searchText ) }
onSearchTextChanged: root.searchTextChanged( searchBar.searchText )
}

MMComponents.MMScrollView {
Expand Down
4 changes: 2 additions & 2 deletions app/qml/account/MMWhichIndustryPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,9 @@ MMPage {
title: qsTr( "Industry" )
placeholderText: internal.specifyIndustryText

onTextChanged: root.selectedText = text
onTextEdited: ( text ) => root.selectedText = text

Component.onCompleted: textFieldComponent.forceActiveFocus()
Component.onCompleted: textField.forceActiveFocus()
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion app/qml/components/MMCheckBox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ CheckBox {

property bool hasError: false

property color emptyStateColor: __style.transparentColor

implicitHeight: Math.max( textContent.implicitHeight, indicatorContent.height )

topPadding: __style.margin4
Expand All @@ -35,7 +37,7 @@ CheckBox {

radius: __style.radius6

color: ( root.checked && root.enabled ) ? __style.grassColor: __style.transparentColor
color: ( root.checked && root.enabled ) ? __style.grassColor : emptyStateColor

border.color: {
if ( enabled ) {
Expand Down
5 changes: 3 additions & 2 deletions app/qml/components/MMListMultiselectDrawer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@ MMDrawer {

placeholderText: qsTr( "Search" )

bgColor: __style.lightGreenColor
textFieldBackground.color: __style.lightGreenColor

visible: root.withSearch

onSearchTextChanged: ( text ) => root.searchTextChanged( text )
onSearchTextChanged: root.searchTextChanged( searchBar.searchText )
}

MMListSpacer { id: searchBarSpacer; height: __style.spacing20; visible: root.withSearch }
Expand Down
110 changes: 0 additions & 110 deletions app/qml/components/MMMorePhoto.qml

This file was deleted.

10 changes: 4 additions & 6 deletions app/qml/components/MMSwitch.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ import QtQuick.Controls
Switch {
id: root

property color checkedBgColor: enabled ? __style.grassColor : __style.mediumGreenColor
property color uncheckedBgColor: __style.polarColor
property color checkedBgColor: __style.grassColor
property color disabledFgColor: __style.mediumGreenColor
property color enabledFgColor: __style.forestColor
property color handleColor: enabled ? __style.forestColor : __style.mediumGreyColor

topPadding: 0
rightPadding: 0
Expand All @@ -26,7 +25,7 @@ Switch {
contentItem: Text {
text: root.text
font: __style.p5
color: root.enabled ? root.enabledFgColor : root.disabledFgColor
color: root.handleColor
verticalAlignment: Text.AlignVCenter
leftPadding: root.indicator.width + ( text ? root.spacing : 0 )
}
Expand All @@ -37,7 +36,6 @@ Switch {
implicitWidth: 48 * __dp
implicitHeight: 28 * __dp
x: root.leftPadding
y: parent.height / 2 - height / 2
radius: implicitHeight / 2
color: root.checked ? root.checkedBgColor : root.uncheckedBgColor

Expand All @@ -46,7 +44,7 @@ Switch {
width: 20 * __dp
height: width
radius: width / 2
color: root.enabled ? root.enabledFgColor : root.disabledFgColor
color: root.handleColor
anchors.verticalCenter: parent.verticalCenter
}
}
Expand Down
Loading

0 comments on commit 5438f52

Please sign in to comment.