Changeset View
Changeset View
Standalone View
Standalone View
kcm/package/contents/ui/Screen.qml
Show All 11 Lines | |||||
12 | GNU General Public License for more details. | 12 | GNU General Public License for more details. | ||
13 | 13 | | |||
14 | You should have received a copy of the GNU General Public License | 14 | You should have received a copy of the GNU General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | *********************************************************************/ | 16 | *********************************************************************/ | ||
17 | import QtQuick 2.9 | 17 | import QtQuick 2.9 | ||
18 | import QtQuick.Layouts 1.1 | 18 | import QtQuick.Layouts 1.1 | ||
19 | import QtQuick.Controls 2.3 as Controls | 19 | import QtQuick.Controls 2.3 as Controls | ||
20 | import org.kde.kirigami 2.5 as Kirigami | ||||
20 | 21 | | |||
21 | Rectangle { | 22 | Rectangle { | ||
22 | property var outputs | 23 | property var outputs | ||
23 | property size totalSize | 24 | property size totalSize | ||
24 | 25 | | |||
25 | function resetTotalSize() { | 26 | function resetTotalSize() { | ||
26 | totalSize = kcm.normalizeScreen(); | 27 | totalSize = kcm.normalizeScreen(); | ||
27 | } | 28 | } | ||
28 | 29 | | |||
29 | onWidthChanged: resetTotalSize() | 30 | onWidthChanged: resetTotalSize() | ||
30 | onHeightChanged: resetTotalSize() | 31 | onHeightChanged: resetTotalSize() | ||
31 | 32 | | |||
32 | property real relativeFactor: { | 33 | property real relativeFactor: { | ||
33 | var relativeSize = Qt.size(totalSize.width / (0.6 * width), | 34 | var relativeSize = Qt.size(totalSize.width / (0.35 * width), | ||
34 | totalSize.height / (0.6 * height)); | 35 | totalSize.height / (0.35 * height)); | ||
35 | if (relativeSize.width > relativeSize.height) { | 36 | if (relativeSize.width > relativeSize.height) { | ||
36 | // Available width smaller than height, optimize for width (we have | 37 | // Available width smaller than height, optimize for width (we have | ||
37 | // '>' because the available width, height is in the denominator). | 38 | // '>' because the available width, height is in the denominator). | ||
38 | return relativeSize.width; | 39 | return relativeSize.width; | ||
39 | } else { | 40 | } else { | ||
40 | return relativeSize.height; | 41 | return relativeSize.height; | ||
41 | } | 42 | } | ||
42 | } | 43 | } | ||
43 | 44 | | |||
44 | property int xOffset: (width - totalSize.width / relativeFactor) / 2; | 45 | property int xOffset: (width - totalSize.width / relativeFactor) / 2; | ||
45 | property int yOffset: (height - totalSize.height / relativeFactor) / 2; | 46 | property int yOffset: (height - totalSize.height / relativeFactor) / 2; | ||
46 | 47 | | |||
47 | implicitHeight: root.height * 0.45 | 48 | implicitHeight: Math.max(root.height * 0.4, units.gridUnit * 13) | ||
49 | radius: units.smallSpacing | ||||
48 | color: "white" | 50 | color: "white" | ||
51 | border.color: Qt.tint(Kirigami.Theme.textColor, Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, 0.8)) | ||||
52 | border.width: 1 | ||||
49 | clip: true | 53 | clip: true | ||
50 | 54 | | |||
51 | Row { | 55 | Row { | ||
52 | z: 90 | 56 | z: 90 | ||
53 | anchors { | 57 | anchors { | ||
54 | bottom: parent.bottom | 58 | bottom: parent.bottom | ||
55 | horizontalCenter: parent.horizontalCenter | 59 | horizontalCenter: parent.horizontalCenter | ||
56 | margins: units.smallSpacing | 60 | margins: units.smallSpacing | ||
57 | } | 61 | } | ||
58 | spacing: units.smallSpacing | 62 | spacing: units.smallSpacing | ||
59 | Controls.Button { | 63 | Controls.Button { | ||
60 | onClicked: kcm.identifyOutputs() | 64 | onClicked: kcm.identifyOutputs() | ||
61 | text: i18n("Identify") | 65 | text: i18n("Identify") | ||
66 | icon.name: "documentinfo" | ||||
GB_2: Icon: "documentinfo" | |||||
62 | focusPolicy: Qt.NoFocus | 67 | focusPolicy: Qt.NoFocus | ||
68 | visible: kcm.outputModel && kcm.outputModel.rowCount() > 1 | ||||
63 | } | 69 | } | ||
64 | Controls.Button { | 70 | Controls.Button { | ||
65 | enabled: !kcm.screenNormalized | 71 | enabled: !kcm.screenNormalized | ||
66 | onClicked: resetTotalSize() | 72 | onClicked: resetTotalSize() | ||
67 | text: i18n("Center view") | 73 | text: i18n("Center View") | ||
74 | icon.name: "zoom-original" | ||||
GB_2: "Center View"
Icon: "zoom-original" | |||||
68 | focusPolicy: Qt.NoFocus | 75 | focusPolicy: Qt.NoFocus | ||
76 | visible: kcm.outputModel && kcm.outputModel.rowCount() > 1 | ||||
69 | } | 77 | } | ||
70 | } | 78 | } | ||
71 | 79 | | |||
72 | Repeater { | 80 | Repeater { | ||
73 | model: kcm.outputModel | 81 | model: kcm.outputModel | ||
74 | delegate: Output {} | 82 | delegate: Output {} | ||
75 | 83 | | |||
76 | onCountChanged: resetTotalSize() | 84 | onCountChanged: resetTotalSize() | ||
77 | } | 85 | } | ||
78 | } | 86 | } |
Icon: "documentinfo"