Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: dialog set fix size #1955

Merged
merged 2 commits into from
Dec 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/dde-control-center/frame/dccrepeater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ void DccRepeater::initItem(int index, QObject *object)
if (!d->delegateValidated) {
d->delegateValidated = true;
QObject* delegate = this->delegate();
qmlWarning(delegate ? delegate : this) << tr("Delegate must be of `DccObject` type");
qmlWarning(delegate ? delegate : this) << "Delegate must be of `DccObject` type";
}
}
return;
Expand Down
2 changes: 1 addition & 1 deletion src/plugin-accounts/qml/AccountSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ DccObject {
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
Layout.rightMargin: 10
text: groupSettings.isEditing ? qsTr("done") : qsTr("edit")
font.pointSize: 13
font.pointSize: 12
background: null
textColor: Palette {
normal {
Expand Down
1 change: 1 addition & 0 deletions src/plugin-accounts/qml/AvatarGridView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ GridView {
font.pointSize: 16
anchors.left: parent.left
anchors.leftMargin: 10
color: palette.text
}
}
}
Expand Down
42 changes: 37 additions & 5 deletions src/plugin-accounts/qml/AvatarSettingsDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,21 @@ import QtQml.Models
import QtQuick.Layouts 1.15
import Qt.labs.qmlmodels
import org.deepin.dtk 1.0 as D
import org.deepin.dtk.style 1.0 as DS

D.DialogWindow {
id: dialog
property string userId: dccData.currentUserId()
property string currentAvatar: dccData.avatar()
width: 640
height: 500
width: 630
minimumWidth: width
minimumHeight: height
maximumWidth: minimumWidth
maximumHeight: minimumHeight
icon: "preferences-system"
modality: Qt.WindowModal
D.DWindow.enableSystemMove: !cropper.dragActived
color: "transparent"

signal accepted();

Expand All @@ -45,14 +50,39 @@ D.DialogWindow {
}
}

header: D.DialogTitleBar {
// titlebar do not enbale blur again
// enableInWindowBlendBlur: true
icon.name: dialog.icon
}

RowLayout {
anchors.fill: parent
width: dialog.width
Rectangle {
id: leftBar
color: "transparent"
Layout.preferredWidth: 160
Layout.preferredWidth: 150
Layout.preferredHeight: dialog.height - 100
Layout.alignment: Qt.AlignTop

Rectangle {
x: -DS.Style.dialogWindow.contentHMargin
y: -DS.Style.dialogWindow.titleBarHeight
width: leftBar.width - x
height: dialog.height + 10
color: "transparent"
D.StyledBehindWindowBlur {
anchors.fill: parent
}
}
Rectangle {
x: leftView.width
y: -DS.Style.dialogWindow.titleBarHeight
width: scrollView.width + DS.Style.dialogWindow.contentHMargin * 2
height: dialog.height
color: palette.window
}

ListModel {
id: listModel
ListElement {
Expand Down Expand Up @@ -108,7 +138,7 @@ D.DialogWindow {
width: 16
height: 16
}
implicitWidth: 160
implicitWidth: leftView.width - 10
checked: model.checked
normalBackgroundVisible: false
onCheckedChanged: {
Expand Down Expand Up @@ -237,6 +267,8 @@ D.DialogWindow {
Layout.alignment: Qt.AlignBottom | Qt.AlignHCenter
Layout.bottomMargin: 10
Layout.topMargin: 20
Layout.leftMargin: 30
Layout.rightMargin: 60

Button {
Layout.fillWidth: true
Expand Down
10 changes: 7 additions & 3 deletions src/plugin-accounts/qml/ComfirmDeleteDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ D.DialogWindow {
id: dialog
icon: "preferences-system"
width: 400
minimumWidth: width
minimumHeight: height
maximumWidth: minimumWidth
maximumHeight: minimumHeight

signal requestDelete(bool deleteHome)
ColumnLayout {
// width: 400
width: dialog.width - 20
Label {
Layout.alignment: Qt.AlignHCenter
font: D.DTK.fontManager.t5
Expand All @@ -33,7 +37,7 @@ D.DialogWindow {
Layout.fillWidth: true
Button {
text: qsTr("Cancel")
Layout.preferredWidth: 175
Layout.preferredWidth: 180
onClicked: {
close()
}
Expand All @@ -43,7 +47,7 @@ D.DialogWindow {
}
D.WarningButton {
text: qsTr("Delete")
Layout.preferredWidth: 175
Layout.preferredWidth: 180
Layout.alignment: Qt.AlignRight
onClicked: {
requestDelete(deleteHomeCheckbox.checked)
Expand Down
9 changes: 7 additions & 2 deletions src/plugin-accounts/qml/ComfirmSafePage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,29 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import org.deepin.dcc 1.0
import org.deepin.dtk 1.0 as D

D.DialogWindow {
id: dialog
icon: "preferences-system"
width: 600
height: 180
minimumWidth: 600
minimumHeight: 180
maximumWidth: minimumWidth
maximumHeight: minimumHeight
property string msg

signal requestShowSafePage()
ColumnLayout {
// width: 400
Label {
Layout.alignment: Qt.AlignHCenter
verticalAlignment: Text.AlignVCenter
font: D.DTK.fontManager.t5
text: msg
wrapMode: Text.WordWrap
Layout.preferredWidth: dialog.width - 10
Layout.preferredHeight: 60
leftPadding: 10
rightPadding: 10
}
Expand Down
11 changes: 8 additions & 3 deletions src/plugin-accounts/qml/CreateAccountDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,18 @@ import org.deepin.dcc 1.0
D.DialogWindow {
id: dialog
width: 450
height: 500
minimumWidth: width
minimumHeight: height
maximumWidth: minimumWidth
maximumHeight: minimumHeight
icon: "preferences-system"
modality: Qt.WindowModal
title: qsTr("Create a new account")

signal accepted()

ColumnLayout {
anchors.fill: parent

width: dialog.width - 20
Label {
text: dialog.title
font.bold: true
Expand Down Expand Up @@ -162,6 +164,7 @@ D.DialogWindow {
PasswordLayout {
id: pwdLayout
currentPwdVisible: false
Layout.fillWidth: true
name: {
let nameEdit = namesContainter.eidtItems[0]
if (nameEdit === undefined)
Expand All @@ -175,6 +178,8 @@ D.DialogWindow {
spacing: 10
Layout.alignment: Qt.AlignBottom | Qt.AlignHCenter
Layout.bottomMargin: 10
Layout.leftMargin: 10
Layout.rightMargin: 10

Button {
Layout.fillWidth: true
Expand Down
17 changes: 8 additions & 9 deletions src/plugin-accounts/qml/PasswordLayout.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ ColumnLayout {
property string userId
property string name: dccData.userName(pwdLayout.userId)
property bool currentPwdVisible: true
// property alas pwdContainter: pwdContainter
Layout.fillWidth: true

signal requestClose();
Expand All @@ -23,7 +22,7 @@ ColumnLayout {

function minWidth(font, text, width) {
fm.font = font
return Math.min(width, fm.advanceWidth(text))
return Math.min(width, fm.advanceWidth(text) + 20)
}

function getPwdInfo() {
Expand All @@ -47,8 +46,8 @@ ColumnLayout {
visible: pwdLayout.currentPwdVisible
label.text: qsTr("Current password")
edit.placeholderText: qsTr("Required")
Layout.leftMargin: 10
Layout.rightMargin: 20
Layout.leftMargin: 0
Layout.rightMargin: 16
Layout.bottomMargin: 10

Loader {
Expand Down Expand Up @@ -106,8 +105,8 @@ ColumnLayout {
RowLayout {
id: pwdIndicator
spacing: 4
Layout.alignment: Qt.AlignRight
Layout.rightMargin: 30
Layout.alignment: Qt.AlignRight | Qt.AlignBottom
Layout.rightMargin: pwdLayout.currentPwdVisible ? 30 : 20
Label {
id: pwdStrengthHintText
text: ""
Expand Down Expand Up @@ -182,7 +181,7 @@ ColumnLayout {
radius: 8
Layout.fillWidth: true
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
Layout.rightMargin: 10
Layout.rightMargin: pwdLayout.currentPwdVisible ? 10 : 0
Layout.bottomMargin: 30
implicitHeight: 150
color: "transparent"
Expand Down Expand Up @@ -261,7 +260,7 @@ ColumnLayout {
backgroundVisible: false
checkable: false
implicitHeight: 50
leftPadding: 10
leftPadding: pwdLayout.currentPwdVisible ? 0 : 10
rightPadding: 10

contentItem: PasswordItem {
Expand Down Expand Up @@ -297,7 +296,7 @@ ColumnLayout {
Layout.preferredWidth: pwdLayout.minWidth(font, text, dialog.width - 20)
Layout.alignment: Qt.AlignRight
Layout.rightMargin: 10
Layout.leftMargin: 10
Layout.leftMargin: 0
}
}
}
Expand Down
13 changes: 9 additions & 4 deletions src/plugin-accounts/qml/PasswordModifyDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ D.DialogWindow {
id: dialog
property string userId
width: 520
height: 480
minimumWidth: width
minimumHeight: height
maximumWidth: minimumWidth
maximumHeight: minimumHeight
icon: "preferences-system"
modality: Qt.WindowModal
title: isCurrent() ? qsTr("Modify password") : qsTr("Reset password")
Expand All @@ -24,8 +27,7 @@ D.DialogWindow {
}

ColumnLayout {
anchors.fill: parent

width: dialog.width - 20
Label {
text: dialog.title
font.bold: true
Expand All @@ -41,14 +43,16 @@ D.DialogWindow {
wrapMode: Text.WordWrap
rightPadding: 10
leftPadding: 10
Layout.preferredWidth: pwdLayout.minWidth(font, text, dialog.width - 10)
// horizontalAlignment: Text.AlignHCenter
Layout.preferredWidth: pwdLayout.minWidth(font, text, dialog.width - 20)
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
Layout.bottomMargin: 10
}

PasswordLayout {
id: pwdLayout
userId: dialog.userId
Layout.leftMargin: 10
onRequestClose: {
// no error, close dialog
close()
Expand All @@ -59,6 +63,7 @@ D.DialogWindow {
spacing: 10
Layout.alignment: Qt.AlignBottom | Qt.AlignHCenter
Layout.bottomMargin: 10
Layout.leftMargin: 10
Layout.rightMargin: 20

Button {
Expand Down
7 changes: 5 additions & 2 deletions src/plugin-datetime/qml/DateTimeSettingDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ import QtQuick.Layouts 1.15
import org.deepin.dtk 1.0 as D

D.DialogWindow {
id: ddialog
id: ddialog
width: 400
height: 220
minimumWidth: width
minimumHeight: height
maximumWidth: minimumWidth
maximumHeight: minimumHeight
icon: "preferences-system"
modality: Qt.WindowModal
property date currentDate: new Date()
Expand Down
8 changes: 6 additions & 2 deletions src/plugin-datetime/qml/LangAndFormat.qml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ DccObject {
Button {
id: button
checkable: true
visible: langRepeater.count > 1
font.pointSize: 12
checked: languageListTiltle.isEditing
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
Layout.rightMargin: 10
Expand Down Expand Up @@ -66,6 +68,7 @@ DccObject {
onParentItemChanged: item => { if (item) item.topPadding = 10 }

DccRepeater {
id: langRepeater
model: dccData.langList
delegate: DccObject {
name: "languageItem" + index
Expand Down Expand Up @@ -230,7 +233,7 @@ DccObject {
IconLabel {
Layout.alignment: Qt.AlignRight | Qt.AlignHCenter
icon.name: "arrow_ordinary_right"
icon.palette: DTK.makeIconPalette(palette)
icon.palette: DTK.makeIconPalette(regionLabel.palette)
icon.mode: ColorSelector.controlState
icon.theme: ColorSelector.controlTheme
}
Expand Down Expand Up @@ -279,12 +282,13 @@ DccObject {
RowLayout {
id: layout
Label {
id: currentLabel
text: dccData.currentLanguageAndRegion
}
IconLabel {
Layout.alignment: Qt.AlignRight | Qt.AlignHCenter
icon.name: "arrow_ordinary_right"
icon.palette: DTK.makeIconPalette(palette)
icon.palette: DTK.makeIconPalette(currentLabel.palette)
icon.mode: ColorSelector.controlState
icon.theme: ColorSelector.controlTheme
}
Expand Down
Loading
Loading