diff --git a/tests/resources.qrc b/tests/resources.qrc index 10f9057bd..c4a6a3d3a 100644 --- a/tests/resources.qrc +++ b/tests/resources.qrc @@ -39,15 +39,16 @@ ui/modules/Linphone/Dialog/DialogDescription.qml ui/modules/Linphone/Dialog/DialogPlus.qml ui/modules/Linphone/ForceScrollBar.qml + ui/modules/Linphone/Form/AbstractTextButton.qml ui/modules/Linphone/Form/ActionBar.qml ui/modules/Linphone/Form/ActionButton.qml ui/modules/Linphone/Form/CheckBoxText.qml - ui/modules/Linphone/Form/DarkButton.qml ui/modules/Linphone/Form/DropZone.qml ui/modules/Linphone/Form/ExclusiveButtons.qml - ui/modules/Linphone/Form/LightButton.qml ui/modules/Linphone/Form/ListForm.qml ui/modules/Linphone/Form/SmallButton.qml + ui/modules/Linphone/Form/TextButtonA.qml + ui/modules/Linphone/Form/TextButtonB.qml ui/modules/Linphone/Form/TransparentComboBox.qml ui/modules/Linphone/Image/Icon.qml ui/modules/Linphone/InvertedMouseArea.qml @@ -60,8 +61,11 @@ ui/modules/Linphone/Styles/CollapseStyle.qml ui/modules/Linphone/Styles/DialogStyle.qml ui/modules/Linphone/Styles/ForceScrollBarStyle.qml + ui/modules/Linphone/Styles/Form/AbstractTextButtonStyle.qml ui/modules/Linphone/Styles/Form/ExclusiveButtonsStyle.qml ui/modules/Linphone/Styles/Form/SmallButtonStyle.qml + ui/modules/Linphone/Styles/Form/TextButtonAStyle.qml + ui/modules/Linphone/Styles/Form/TextButtonBStyle.qml ui/modules/Linphone/Styles/MenuStyle.qml ui/modules/Linphone/Styles/PopupStyle.qml ui/modules/Linphone/Styles/qmldir diff --git a/tests/ui/modules/Linphone/Dialog/ConfirmDialog.qml b/tests/ui/modules/Linphone/Dialog/ConfirmDialog.qml index 6e03477c0..c92cc427c 100644 --- a/tests/ui/modules/Linphone/Dialog/ConfirmDialog.qml +++ b/tests/ui/modules/Linphone/Dialog/ConfirmDialog.qml @@ -9,12 +9,12 @@ DialogPlus { id: dialog buttons: [ - DarkButton { + TextButtonA { text: qsTr('cancel') onClicked: exit(0) }, - DarkButton { + TextButtonA { text: qsTr('confirm') onClicked: exit(1) diff --git a/tests/ui/modules/Linphone/Form/AbstractTextButton.qml b/tests/ui/modules/Linphone/Form/AbstractTextButton.qml new file mode 100644 index 000000000..e344f6462 --- /dev/null +++ b/tests/ui/modules/Linphone/Form/AbstractTextButton.qml @@ -0,0 +1,45 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 + +import Linphone.Styles 1.0 + +// =================================================================== + +Button { + id: button + + property color colorHovered + property color colorNormal + property color colorPressed + + // By default textColorNormal is the hovered/pressed text color. + property color textColorHovered: textColorNormal + property color textColorNormal + property color textColorPressed: textColorNormal + + background: Rectangle { + color: button.down + ? colorPressed + : (button.hovered + ? colorHovered + : colorNormal + ) + implicitHeight: AbstractTextButtonStyle.background.height + implicitWidth: AbstractTextButtonStyle.background.width + radius: AbstractTextButtonStyle.background.radius + } + contentItem: Text { + color: button.down + ? textColorPressed + : (button.hovered + ? textColorHovered + : textColorNormal + ) + font.bold: true + font.pointSize: AbstractTextButtonStyle.text.fontSize + horizontalAlignment: Text.AlignHCenter + text: button.text + verticalAlignment: Text.AlignVCenter + } + hoverEnabled: true +} diff --git a/tests/ui/modules/Linphone/Form/DarkButton.qml b/tests/ui/modules/Linphone/Form/DarkButton.qml deleted file mode 100644 index 839b9847a..000000000 --- a/tests/ui/modules/Linphone/Form/DarkButton.qml +++ /dev/null @@ -1,26 +0,0 @@ -import QtQuick 2.7 -import QtQuick.Controls 2.0 - -// =================================================================== - -Button { - property string backgroundColor: '#434343' - property string textColor: '#FFFFFF' - - background: Rectangle { - color: button.down ? '#FE5E00' : backgroundColor - implicitHeight: 30 - implicitWidth: 160 - radius: 4 - } - contentItem: Text { - color: button.down ? '#FFFFFF' : textColor - font.pointSize: 8 - font.weight: Font.DemiBold - horizontalAlignment: Text.AlignHCenter - id: text - text: button.text - verticalAlignment: Text.AlignVCenter - } - id: button -} diff --git a/tests/ui/modules/Linphone/Form/LightButton.qml b/tests/ui/modules/Linphone/Form/LightButton.qml deleted file mode 100644 index b28dec65d..000000000 --- a/tests/ui/modules/Linphone/Form/LightButton.qml +++ /dev/null @@ -1,8 +0,0 @@ -import QtQuick 2.7 - -// =================================================================== - -DarkButton { - backgroundColor: '#D1D1D1' - textColor: '#5A585B' -} diff --git a/tests/ui/modules/Linphone/Form/TextButtonA.qml b/tests/ui/modules/Linphone/Form/TextButtonA.qml new file mode 100644 index 000000000..99c81deb8 --- /dev/null +++ b/tests/ui/modules/Linphone/Form/TextButtonA.qml @@ -0,0 +1,13 @@ +import Linphone.Styles 1.0 + +// =================================================================== + +AbstractTextButton { + colorHovered: TextButtonAStyle.backgroundColor.hovered + colorNormal: TextButtonAStyle.backgroundColor.normal + colorPressed: TextButtonAStyle.backgroundColor.pressed + + textColorHovered: TextButtonAStyle.textColor.hovered + textColorNormal: TextButtonAStyle.textColor.normal + textColorPressed: TextButtonAStyle.textColor.pressed +} diff --git a/tests/ui/modules/Linphone/Form/TextButtonB.qml b/tests/ui/modules/Linphone/Form/TextButtonB.qml new file mode 100644 index 000000000..8d5d29184 --- /dev/null +++ b/tests/ui/modules/Linphone/Form/TextButtonB.qml @@ -0,0 +1,13 @@ +import Linphone.Styles 1.0 + +// =================================================================== + +AbstractTextButton { + colorHovered: TextButtonBStyle.backgroundColor.hovered + colorNormal: TextButtonBStyle.backgroundColor.normal + colorPressed: TextButtonBStyle.backgroundColor.pressed + + textColorHovered: TextButtonBStyle.textColor.hovered + textColorNormal: TextButtonBStyle.textColor.normal + textColorPressed: TextButtonBStyle.textColor.pressed +} diff --git a/tests/ui/modules/Linphone/Styles/Form/AbstractTextButtonStyle.qml b/tests/ui/modules/Linphone/Styles/Form/AbstractTextButtonStyle.qml new file mode 100644 index 000000000..d5aab303c --- /dev/null +++ b/tests/ui/modules/Linphone/Styles/Form/AbstractTextButtonStyle.qml @@ -0,0 +1,14 @@ +pragma Singleton +import QtQuick 2.7 + +QtObject { + property QtObject background: QtObject { + property int height: 30 + property int width: 160 + property int radius: 4 + } + + property QtObject text: QtObject { + property int fontSize: 8 + } +} diff --git a/tests/ui/modules/Linphone/Styles/Form/TextButtonAStyle.qml b/tests/ui/modules/Linphone/Styles/Form/TextButtonAStyle.qml new file mode 100644 index 000000000..d2685c9ff --- /dev/null +++ b/tests/ui/modules/Linphone/Styles/Form/TextButtonAStyle.qml @@ -0,0 +1,18 @@ +pragma Singleton +import QtQuick 2.7 + +import Linphone 1.0 + +QtObject { + property QtObject backgroundColor: QtObject { + property color hovered: '#232323' + property color pressed: '#FE5E00' + property color normal: '#434343' + } + + property QtObject textColor: QtObject { + property color hovered: '#FFFFFF' + property color pressed: '#FFFFFF' + property color normal: '#FFFFFF' + } +} diff --git a/tests/ui/modules/Linphone/Styles/Form/TextButtonBStyle.qml b/tests/ui/modules/Linphone/Styles/Form/TextButtonBStyle.qml new file mode 100644 index 000000000..90620c646 --- /dev/null +++ b/tests/ui/modules/Linphone/Styles/Form/TextButtonBStyle.qml @@ -0,0 +1,18 @@ +pragma Singleton +import QtQuick 2.7 + +import Linphone 1.0 + +QtObject { + property QtObject backgroundColor: QtObject { + property color hovered: '#B1B1B1' + property color pressed: '#FE5E00' + property color normal: '#D1D1D1' + } + + property QtObject textColor: QtObject { + property color hovered: '#5A585B' + property color pressed: '#FFFFFF' + property color normal: '#5A585B' + } +} diff --git a/tests/ui/modules/Linphone/Styles/qmldir b/tests/ui/modules/Linphone/Styles/qmldir index 4d6bbb846..85505b906 100644 --- a/tests/ui/modules/Linphone/Styles/qmldir +++ b/tests/ui/modules/Linphone/Styles/qmldir @@ -3,13 +3,16 @@ module Linphone.Style # Components styles. -singleton CollapseStyle 1.0 CollapseStyle.qml -singleton DialogStyle 1.0 DialogStyle.qml -singleton ForceScrollBarStyle 1.0 ForceScrollBarStyle.qml -singleton MenuStyle 1.0 MenuStyle.qml -singleton PopupStyle 1.0 PopupStyle.qml -singleton SearchBoxStyle 1.0 SearchBoxStyle.qml -singleton TimelineStyle 1.0 TimelineStyle.qml +singleton CollapseStyle 1.0 CollapseStyle.qml +singleton DialogStyle 1.0 DialogStyle.qml +singleton ForceScrollBarStyle 1.0 ForceScrollBarStyle.qml +singleton MenuStyle 1.0 MenuStyle.qml +singleton PopupStyle 1.0 PopupStyle.qml +singleton SearchBoxStyle 1.0 SearchBoxStyle.qml +singleton TimelineStyle 1.0 TimelineStyle.qml -singleton ExclusiveButtonsStyle 1.0 Form/ExclusiveButtonsStyle.qml -singleton SmallButtonStyle 1.0 Form/SmallButtonStyle.qml +singleton AbstractTextButtonStyle 1.0 Form/AbstractTextButtonStyle.qml +singleton ExclusiveButtonsStyle 1.0 Form/ExclusiveButtonsStyle.qml +singleton SmallButtonStyle 1.0 Form/SmallButtonStyle.qml +singleton TextButtonAStyle 1.0 Form/TextButtonAStyle.qml +singleton TextButtonBStyle 1.0 Form/TextButtonBStyle.qml diff --git a/tests/ui/modules/Linphone/qmldir b/tests/ui/modules/Linphone/qmldir index 5548d64ca..190d4c793 100644 --- a/tests/ui/modules/Linphone/qmldir +++ b/tests/ui/modules/Linphone/qmldir @@ -28,11 +28,12 @@ ForceScrollBar 1.0 ForceScrollBar.qml ActionBar 1.0 Form/ActionBar.qml ActionButton 1.0 Form/ActionButton.qml CheckBoxText 1.0 Form/CheckBoxText.qml -DarkButton 1.0 Form/DarkButton.qml DropZone 1.0 Form/DropZone.qml ExclusiveButtons 1.0 Form/ExclusiveButtons.qml LightButton 1.0 Form/LightButton.qml ListForm 1.0 Form/ListForm.qml +TextButtonA 1.0 Form/TextButtonA.qml +TextButtonB 1.0 Form/TextButtonB.qml TransparentComboBox 1.0 Form/TransparentComboBox.qml # Image diff --git a/tests/ui/views/MainWindow/Contacts.qml b/tests/ui/views/MainWindow/Contacts.qml index 5c33cce8d..e8fef8363 100644 --- a/tests/ui/views/MainWindow/Contacts.qml +++ b/tests/ui/views/MainWindow/Contacts.qml @@ -41,7 +41,7 @@ ColumnLayout { ] } - LightButton { + TextButtonB { text: qsTr('addContact') } } @@ -198,7 +198,7 @@ ColumnLayout { anchors.fill: parent clip: true color: '#5A585B' - font.weight: Font.DemiBold + font.bold: true text: $username verticalAlignment: Text.AlignVCenter } diff --git a/tests/ui/views/MainWindow/Home.qml b/tests/ui/views/MainWindow/Home.qml index dd1855046..581c94221 100644 --- a/tests/ui/views/MainWindow/Home.qml +++ b/tests/ui/views/MainWindow/Home.qml @@ -27,7 +27,7 @@ ColumnLayout { text: qsTr('invitContactQuestion') } - LightButton { + TextButtonB { text: qsTr('invitContact') } } @@ -43,7 +43,7 @@ ColumnLayout { text: qsTr('addContactQuestion') } - LightButton { + TextButtonB { text: qsTr('addContact') } } diff --git a/tests/ui/views/ManageAccounts.qml b/tests/ui/views/ManageAccounts.qml index 41a22f9da..485567111 100644 --- a/tests/ui/views/ManageAccounts.qml +++ b/tests/ui/views/ManageAccounts.qml @@ -10,7 +10,7 @@ DialogPlus { minimumWidth: 480 title: qsTr('manageAccountsTitle') - buttons: DarkButton { + buttons: TextButtonA { text: qsTr('validate') } diff --git a/tests/ui/views/NewCall.qml b/tests/ui/views/NewCall.qml index c18eadecf..c58bfd7fc 100644 --- a/tests/ui/views/NewCall.qml +++ b/tests/ui/views/NewCall.qml @@ -9,7 +9,7 @@ DialogPlus { minimumWidth: 420 title: qsTr('newCallTitle') - buttons: DarkButton { + buttons: TextButtonA { text: qsTr('cancel') }