Refactor ButtonLayout module components
- Rename ButtonLayout module to just Buttons - Rename ButtonLayout into AutoDirectionLayout and move it to Base, it's useful not just for buttons - Rename OtherButton into GroupButton, which is now the base of all other Buttons buttons - Add generic (Positive|Middle|Negative)Button components, which are now the base for (Apply|Cancel)Button
This commit is contained in:
parent
67f1572a18
commit
ed030f7dd9
|
@ -2,7 +2,6 @@
|
|||
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import ".."
|
||||
|
||||
HGridLayout {
|
||||
readonly property real summedImplicitWidth: {
|
|
@ -1,14 +0,0 @@
|
|||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import ".."
|
||||
|
||||
HButton {
|
||||
text: qsTr("Apply")
|
||||
icon.name: "apply"
|
||||
icon.color: theme.colors.positiveBackground
|
||||
|
||||
Layout.preferredHeight: theme.baseElementsHeight
|
||||
Layout.fillWidth: true
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import ".."
|
||||
|
||||
HButton {
|
||||
text: qsTr("Cancel")
|
||||
icon.name: "cancel"
|
||||
icon.color: theme.colors.negativeBackground
|
||||
|
||||
Layout.preferredHeight: theme.baseElementsHeight
|
||||
Layout.fillWidth: true
|
||||
}
|
6
src/gui/Base/Buttons/ApplyButton.qml
Normal file
6
src/gui/Base/Buttons/ApplyButton.qml
Normal file
|
@ -0,0 +1,6 @@
|
|||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
PositiveButton {
|
||||
text: qsTr("Apply")
|
||||
icon.name: "apply"
|
||||
}
|
6
src/gui/Base/Buttons/CancelButton.qml
Normal file
6
src/gui/Base/Buttons/CancelButton.qml
Normal file
|
@ -0,0 +1,6 @@
|
|||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
NegativeButton {
|
||||
text: qsTr("Cancel")
|
||||
icon.name: "cancel"
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import ".."
|
||||
|
5
src/gui/Base/Buttons/MiddleButton.qml
Normal file
5
src/gui/Base/Buttons/MiddleButton.qml
Normal file
|
@ -0,0 +1,5 @@
|
|||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
GroupButton {
|
||||
icon.color: theme.colors.middleBackground
|
||||
}
|
5
src/gui/Base/Buttons/NegativeButton.qml
Normal file
5
src/gui/Base/Buttons/NegativeButton.qml
Normal file
|
@ -0,0 +1,5 @@
|
|||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
GroupButton {
|
||||
icon.color: theme.colors.negativeBackground
|
||||
}
|
5
src/gui/Base/Buttons/PositiveButton.qml
Normal file
5
src/gui/Base/Buttons/PositiveButton.qml
Normal file
|
@ -0,0 +1,5 @@
|
|||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
GroupButton {
|
||||
icon.color: theme.colors.positiveBackground
|
||||
}
|
|
@ -5,7 +5,7 @@ import QtQuick.Controls 2.12
|
|||
import QtQuick.Layouts 1.12
|
||||
import "../.."
|
||||
import "../../Base"
|
||||
import "../../Base/ButtonLayout"
|
||||
import "../../Base/Buttons"
|
||||
import "../../Dialogs"
|
||||
|
||||
HFlickableColumnPage {
|
||||
|
@ -64,7 +64,7 @@ HFlickableColumnPage {
|
|||
}
|
||||
|
||||
|
||||
footer: ButtonLayout {
|
||||
footer: AutoDirectionLayout {
|
||||
ApplyButton {
|
||||
id: saveButton
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import "../../Base"
|
||||
import "../../Base/ButtonLayout"
|
||||
import "../../Base/Buttons"
|
||||
import "../../Base/HTile"
|
||||
|
||||
HTile {
|
||||
|
@ -133,10 +133,10 @@ HTile {
|
|||
label.text: qsTr("Actions:")
|
||||
label.horizontalAlignment: Qt.AlignHCenter
|
||||
|
||||
ButtonLayout {
|
||||
AutoDirectionLayout {
|
||||
width: parent.width
|
||||
|
||||
ApplyButton {
|
||||
PositiveButton {
|
||||
enabled: model.type !== "no_keys"
|
||||
icon.name: "device-verify"
|
||||
text:
|
||||
|
@ -163,7 +163,7 @@ HTile {
|
|||
}
|
||||
}
|
||||
|
||||
CancelButton {
|
||||
NegativeButton {
|
||||
text: qsTr("Sign out")
|
||||
icon.name: "device-delete"
|
||||
onClicked: deviceTile.deleteRequest()
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import "../../Base"
|
||||
import "../../Base/ButtonLayout"
|
||||
import "../../Base/Buttons"
|
||||
|
||||
HFlickableColumnPage {
|
||||
id: page
|
||||
|
@ -15,8 +15,8 @@ HFlickableColumnPage {
|
|||
function takeFocus() { exportButton.forceActiveFocus() }
|
||||
|
||||
|
||||
footer: ButtonLayout {
|
||||
OtherButton {
|
||||
footer: AutoDirectionLayout {
|
||||
GroupButton {
|
||||
id: exportButton
|
||||
text: qsTr("Export")
|
||||
icon.name: "export-keys"
|
||||
|
@ -32,7 +32,7 @@ HFlickableColumnPage {
|
|||
)
|
||||
}
|
||||
|
||||
OtherButton {
|
||||
GroupButton {
|
||||
text: qsTr("Import")
|
||||
icon.name: "import-keys"
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import QtQuick.Controls 2.12
|
|||
import QtQuick.Layouts 1.12
|
||||
import "../.."
|
||||
import "../../Base"
|
||||
import "../../Base/ButtonLayout"
|
||||
import "../../Base/Buttons"
|
||||
import "../../PythonBridge"
|
||||
import "../../ShortcutBundles"
|
||||
|
||||
|
@ -100,15 +100,15 @@ HColumnPage {
|
|||
}
|
||||
|
||||
|
||||
footer: ButtonLayout {
|
||||
OtherButton {
|
||||
footer: AutoDirectionLayout {
|
||||
GroupButton {
|
||||
id: refreshButton
|
||||
text: qsTr("Refresh")
|
||||
icon.name: "device-refresh-list"
|
||||
onClicked: page.loadDevices()
|
||||
}
|
||||
|
||||
OtherButton {
|
||||
NegativeButton {
|
||||
id: signOutCheckedButton
|
||||
enabled: deviceList.model.count > 0
|
||||
text:
|
||||
|
@ -117,7 +117,6 @@ HColumnPage {
|
|||
qsTr("Sign out checked")
|
||||
|
||||
icon.name: "device-delete-checked"
|
||||
icon.color: theme.colors.negativeBackground
|
||||
onClicked:
|
||||
deviceList.selectedCount ?
|
||||
page.deleteDevices(...deviceList.checkedIndice) :
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import "../../Base"
|
||||
import "../../Base/ButtonLayout"
|
||||
import "../../Base/Buttons"
|
||||
|
||||
HFlickableColumnPage {
|
||||
function takeFocus() { registerButton.forceActiveFocus() }
|
||||
|
||||
|
||||
footer: ButtonLayout {
|
||||
footer: AutoDirectionLayout {
|
||||
ApplyButton {
|
||||
id: registerButton
|
||||
text: qsTr("Register from Riot")
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import "../../Base"
|
||||
import "../../Base/ButtonLayout"
|
||||
import "../../Base/Buttons"
|
||||
|
||||
HFlickableColumnPage {
|
||||
function takeFocus() { resetButton.forceActiveFocus() }
|
||||
|
||||
|
||||
footer: ButtonLayout {
|
||||
footer: AutoDirectionLayout {
|
||||
ApplyButton {
|
||||
id: resetButton
|
||||
text: qsTr("Reset password from Riot")
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import "../../Base"
|
||||
import "../../Base/ButtonLayout"
|
||||
import "../../Base/Buttons"
|
||||
|
||||
HFlickableColumnPage {
|
||||
id: page
|
||||
|
@ -77,7 +77,7 @@ HFlickableColumnPage {
|
|||
}
|
||||
|
||||
|
||||
footer: ButtonLayout {
|
||||
footer: AutoDirectionLayout {
|
||||
ApplyButton {
|
||||
enabled: page.canSignIn
|
||||
text: qsTr("Sign in")
|
||||
|
|
|
@ -4,7 +4,7 @@ import QtQuick 2.12
|
|||
import QtQuick.Layouts 1.12
|
||||
import "../.."
|
||||
import "../../Base"
|
||||
import "../../Base/ButtonLayout"
|
||||
import "../../Base/Buttons"
|
||||
|
||||
HFlickableColumnPage {
|
||||
id: page
|
||||
|
@ -52,7 +52,7 @@ HFlickableColumnPage {
|
|||
}
|
||||
|
||||
|
||||
footer: ButtonLayout {
|
||||
footer: AutoDirectionLayout {
|
||||
ApplyButton {
|
||||
id: applyButton
|
||||
text: qsTr("Create")
|
||||
|
|
|
@ -4,7 +4,7 @@ import QtQuick 2.12
|
|||
import QtQuick.Layouts 1.12
|
||||
import "../.."
|
||||
import "../../Base"
|
||||
import "../../Base/ButtonLayout"
|
||||
import "../../Base/Buttons"
|
||||
|
||||
HFlickableColumnPage {
|
||||
id: page
|
||||
|
@ -64,7 +64,7 @@ HFlickableColumnPage {
|
|||
}
|
||||
|
||||
|
||||
footer: ButtonLayout {
|
||||
footer: AutoDirectionLayout {
|
||||
ApplyButton {
|
||||
id: applyButton
|
||||
text: qsTr("Start chat")
|
||||
|
|
|
@ -4,7 +4,7 @@ import QtQuick 2.12
|
|||
import QtQuick.Layouts 1.12
|
||||
import "../.."
|
||||
import "../../Base"
|
||||
import "../../Base/ButtonLayout"
|
||||
import "../../Base/Buttons"
|
||||
|
||||
HFlickableColumnPage {
|
||||
id: page
|
||||
|
@ -57,7 +57,7 @@ HFlickableColumnPage {
|
|||
}
|
||||
|
||||
|
||||
footer: ButtonLayout {
|
||||
footer: AutoDirectionLayout {
|
||||
ApplyButton {
|
||||
id: joinButton
|
||||
text: qsTr("Join")
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import "../../../../Base"
|
||||
import "../../../../Base/ButtonLayout"
|
||||
import "../../../../Base/Buttons"
|
||||
|
||||
HFlickableColumnPage {
|
||||
id: page
|
||||
|
@ -27,8 +27,8 @@ HFlickableColumnPage {
|
|||
}
|
||||
|
||||
|
||||
footer: ButtonLayout {
|
||||
ApplyButton {
|
||||
footer: AutoDirectionLayout {
|
||||
PositiveButton {
|
||||
text: qsTr("They're the same")
|
||||
icon.name: "device-verified"
|
||||
onClicked: {
|
||||
|
@ -46,7 +46,7 @@ HFlickableColumnPage {
|
|||
}
|
||||
}
|
||||
|
||||
CancelButton {
|
||||
NegativeButton {
|
||||
text: qsTr("They differ")
|
||||
icon.name: "device-blacklisted"
|
||||
onClicked: {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import "../../../../Base"
|
||||
import "../../../../Base/ButtonLayout"
|
||||
import "../../../../Base/Buttons"
|
||||
import "../../../../Base/HTile"
|
||||
|
||||
HTile {
|
||||
|
|
|
@ -4,7 +4,7 @@ import QtQuick 2.12
|
|||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import "../../../Base"
|
||||
import "../../../Base/ButtonLayout"
|
||||
import "../../../Base/Buttons"
|
||||
|
||||
HFlickableColumnPage {
|
||||
id: settingsView
|
||||
|
@ -63,7 +63,7 @@ HFlickableColumnPage {
|
|||
color: theme.chat.roomPane.roomSettings.background
|
||||
}
|
||||
|
||||
footer: ButtonLayout {
|
||||
footer: AutoDirectionLayout {
|
||||
ApplyButton {
|
||||
enabled: anyChange
|
||||
loading: saveFuture !== null
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
import QtQuick 2.12
|
||||
import "../Base/ButtonLayout"
|
||||
import "../Base"
|
||||
import "../Base/Buttons"
|
||||
|
||||
HFlickableColumnPopup {
|
||||
id: popup
|
||||
|
@ -12,7 +13,7 @@ HFlickableColumnPopup {
|
|||
property var preClearCallback: null
|
||||
|
||||
|
||||
page.footer: ButtonLayout {
|
||||
page.footer: AutoDirectionLayout {
|
||||
ApplyButton {
|
||||
id: clearButton
|
||||
text: qsTr("Clear")
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import QtQuick 2.12
|
||||
import "../Base"
|
||||
import "../Base/ButtonLayout"
|
||||
import "../Base/Buttons"
|
||||
import "../PythonBridge"
|
||||
|
||||
PasswordPopup {
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
import QtQuick 2.12
|
||||
import "../Base/ButtonLayout"
|
||||
import "../Base"
|
||||
import "../Base/Buttons"
|
||||
|
||||
HFlickableColumnPopup {
|
||||
id: popup
|
||||
|
@ -29,7 +30,7 @@ HFlickableColumnPopup {
|
|||
}
|
||||
|
||||
|
||||
page.footer: ButtonLayout {
|
||||
page.footer: AutoDirectionLayout {
|
||||
ApplyButton {
|
||||
id: forgetButton
|
||||
text: qsTr("Forget")
|
||||
|
|
|
@ -4,7 +4,7 @@ import QtQuick 2.12
|
|||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import "../Base"
|
||||
import "../Base/ButtonLayout"
|
||||
import "../Base/Buttons"
|
||||
|
||||
HColumnPopup {
|
||||
id: popup
|
||||
|
@ -46,7 +46,7 @@ HColumnPopup {
|
|||
}
|
||||
|
||||
|
||||
page.footer: ButtonLayout {
|
||||
page.footer: AutoDirectionLayout {
|
||||
ApplyButton {
|
||||
id: inviteButton
|
||||
text: qsTr("Invite")
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import "../Base"
|
||||
import "../Base/ButtonLayout"
|
||||
import "../Base/Buttons"
|
||||
|
||||
HFlickableColumnPopup {
|
||||
id: popup
|
||||
|
@ -18,8 +18,8 @@ HFlickableColumnPopup {
|
|||
property var blacklistedCallback: null
|
||||
|
||||
|
||||
page.footer: ButtonLayout {
|
||||
ApplyButton {
|
||||
page.footer: AutoDirectionLayout {
|
||||
PositiveButton {
|
||||
visible: ! deviceIsCurrent
|
||||
text: qsTr("They match")
|
||||
icon.name: "device-verified"
|
||||
|
@ -37,7 +37,7 @@ HFlickableColumnPopup {
|
|||
}
|
||||
}
|
||||
|
||||
CancelButton {
|
||||
NegativeButton {
|
||||
visible: ! popup.deviceIsCurrent
|
||||
text: qsTr("They differ")
|
||||
icon.name: "device-blacklisted"
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
// SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
import QtQuick 2.12
|
||||
import "../Base/ButtonLayout"
|
||||
import "../Base"
|
||||
import "../Base/Buttons"
|
||||
|
||||
HFlickableColumnPopup {
|
||||
id: popup
|
||||
|
@ -13,7 +14,7 @@ HFlickableColumnPopup {
|
|||
property var leftCallback: null
|
||||
|
||||
|
||||
page.footer: ButtonLayout {
|
||||
page.footer: AutoDirectionLayout {
|
||||
ApplyButton {
|
||||
id: leaveButton
|
||||
icon.name: "room-leave"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import "../Base"
|
||||
import "../Base/ButtonLayout"
|
||||
import "../Base/Buttons"
|
||||
|
||||
HFlickableColumnPopup {
|
||||
id: popup
|
||||
|
@ -51,7 +51,7 @@ HFlickableColumnPopup {
|
|||
}
|
||||
|
||||
|
||||
page.footer: ButtonLayout {
|
||||
page.footer: AutoDirectionLayout {
|
||||
ApplyButton {
|
||||
id: validateButton
|
||||
text: qsTr("Confirm")
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import "../Base"
|
||||
import "../Base/ButtonLayout"
|
||||
import "../Base/Buttons"
|
||||
|
||||
HFlickableColumnPopup {
|
||||
id: popup
|
||||
|
@ -38,7 +38,7 @@ HFlickableColumnPopup {
|
|||
}
|
||||
|
||||
|
||||
page.footer: ButtonLayout {
|
||||
page.footer: AutoDirectionLayout {
|
||||
ApplyButton {
|
||||
text: qsTr("Remove")
|
||||
icon.name: "remove-message"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import QtQuick 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import "../Base"
|
||||
import "../Base/ButtonLayout"
|
||||
import "../Base/Buttons"
|
||||
|
||||
HFlickableColumnPopup {
|
||||
id: popup
|
||||
|
@ -30,7 +30,7 @@ HFlickableColumnPopup {
|
|||
}
|
||||
|
||||
|
||||
page.footer: ButtonLayout {
|
||||
page.footer: AutoDirectionLayout {
|
||||
ApplyButton {
|
||||
text:
|
||||
operation === "disinvite" ? qsTr("Disinvite") :
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
import QtQuick 2.12
|
||||
import ".."
|
||||
import "../Base/ButtonLayout"
|
||||
import "../Base"
|
||||
import "../Base/Buttons"
|
||||
|
||||
HFlickableColumnPopup {
|
||||
id: popup
|
||||
|
@ -11,8 +12,8 @@ HFlickableColumnPopup {
|
|||
property string userId: ""
|
||||
|
||||
|
||||
page.footer: ButtonLayout {
|
||||
ApplyButton {
|
||||
page.footer: AutoDirectionLayout {
|
||||
PositiveButton {
|
||||
id: exportButton
|
||||
text: qsTr("Export keys")
|
||||
icon.name: "export-keys"
|
||||
|
@ -29,11 +30,10 @@ HFlickableColumnPopup {
|
|||
)
|
||||
}
|
||||
|
||||
OtherButton {
|
||||
MiddleButton {
|
||||
id: signOutButton
|
||||
text: qsTr("Sign out now")
|
||||
icon.name: "sign-out"
|
||||
icon.color: theme.colors.middleBackground
|
||||
|
||||
onClicked: {
|
||||
if (ModelStore.get("accounts").count < 2 ||
|
||||
|
|
|
@ -4,7 +4,7 @@ import QtQuick 2.12
|
|||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import "../Base"
|
||||
import "../Base/ButtonLayout"
|
||||
import "../Base/Buttons"
|
||||
|
||||
HColumnPopup {
|
||||
id: popup
|
||||
|
@ -15,8 +15,8 @@ HColumnPopup {
|
|||
property string traceback: ""
|
||||
|
||||
|
||||
page.footer: ButtonLayout {
|
||||
ApplyButton {
|
||||
page.footer: AutoDirectionLayout {
|
||||
PositiveButton {
|
||||
text: qsTr("Report")
|
||||
icon.name: "report-error"
|
||||
enabled: false // TODO
|
||||
|
|
Loading…
Reference in New Issue
Block a user