Changeset View
Changeset View
Standalone View
Standalone View
kcms/desktoptheme/package/contents/ui/ThemePreview.qml
Show All 12 Lines | 1 | /* | |||
---|---|---|---|---|---|
13 | You should have received a copy of the GNU Library General Public License | 13 | You should have received a copy of the GNU Library General Public License | ||
14 | along with this library; see the file COPYING.LIB. If not, write to | 14 | along with this library; see the file COPYING.LIB. If not, write to | ||
15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
16 | Boston, MA 02110-1301, USA. | 16 | Boston, MA 02110-1301, USA. | ||
17 | */ | 17 | */ | ||
18 | import QtQuick 2.4 | 18 | import QtQuick 2.4 | ||
19 | import QtQuick.Layouts 1.1 | 19 | import QtQuick.Layouts 1.1 | ||
20 | import org.kde.plasma.core 2.0 as PlasmaCore | 20 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
21 | import org.kde.kirigami 2.4 as Kirigami | ||||
21 | import org.kde.plasma.components 2.0 as PlasmaComponents | 22 | import org.kde.plasma.components 2.0 as PlasmaComponents | ||
22 | 23 | | |||
23 | Item { | 24 | Item { | ||
24 | id: root | 25 | id: root | ||
25 | property string themeName | 26 | property string themeName | ||
26 | 27 | | |||
27 | PlasmaCore.FrameSvgItem { | 28 | PlasmaCore.FrameSvgItem { | ||
28 | id: background | 29 | id: background | ||
29 | anchors.fill: parent | 30 | // Normalize margins around background. | ||
30 | // Air theme have huge transparent margins in widgets/background svg, so use | 31 | // Some themes like "Air" have huge transparent margins which would result in too small container area. | ||
31 | // widgets/panel-background until Plasma::FrameSvg exposes the transparent margins | 32 | // Sadly all of the breathing, shadow and border sizes are in one single margin value, | ||
32 | imagePath: themeName == "air" ? "widgets/panel-background" : "widgets/background" | 33 | // but for typical themes the border is the smaller part the margin and should be in the size of | ||
34 | // Units.largeSpacing, to which we add another Units.largeSpacing for margin of the visual content | ||||
35 | // Ideally Plasma::FrameSvg exposes the transparent margins one day. | ||||
36 | readonly property int generalMargin: 2 * Kirigami.Units.largeSpacing | ||||
37 | anchors { | ||||
38 | fill: parent | ||||
39 | topMargin: -margins.top + generalMargin | ||||
40 | bottomMargin: -margins.bottom + generalMargin | ||||
41 | leftMargin: -margins.left + generalMargin | ||||
42 | rightMargin: -margins.right + generalMargin | ||||
43 | } | ||||
44 | imagePath: "widgets/background" | ||||
33 | } | 45 | } | ||
34 | 46 | | |||
35 | RowLayout { | 47 | RowLayout { | ||
36 | id: contents | 48 | id: contents | ||
37 | anchors { | 49 | anchors { | ||
38 | fill: parent | 50 | fill: parent | ||
39 | topMargin: root.height / 8 | 51 | topMargin: root.height / 8 | ||
40 | bottomMargin: root.height / 8 | 52 | bottomMargin: root.height / 8 | ||
▲ Show 20 Lines • Show All 91 Lines • Show Last 20 Lines |