From 8c07b27cb29ae24670045eb3b822489c1307b954 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Wed, 8 May 2013 14:22:22 +0200 Subject: [PATCH] move the offset button in new file --- .../configuration/PanelConfiguration.qml | 41 ++---------- .../panelconfiguration/OffsetButton.qml | 65 +++++++++++++++++++ 2 files changed, 69 insertions(+), 37 deletions(-) create mode 100644 src/shell/qmlpackages/desktop/contents/configuration/panelconfiguration/OffsetButton.qml diff --git a/src/shell/qmlpackages/desktop/contents/configuration/PanelConfiguration.qml b/src/shell/qmlpackages/desktop/contents/configuration/PanelConfiguration.qml index f7690c008..bfa3aeb96 100644 --- a/src/shell/qmlpackages/desktop/contents/configuration/PanelConfiguration.qml +++ b/src/shell/qmlpackages/desktop/contents/configuration/PanelConfiguration.qml @@ -22,6 +22,8 @@ import org.kde.plasma.extras 2.0 as PlasmaExtras import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.configuration 2.0 import org.kde.qtextracomponents 2.0 as QtExtras +import "panelconfiguration" + //TODO: all of this will be done with desktop components Rectangle { @@ -42,46 +44,11 @@ Rectangle { } //END Connections + //BEGIN UI components // Offset - Rectangle { + OffsetButton { id: offsetHandle - width: 32 - height: 32 - - property int value - onValueChanged: { - if (panel.location == 5 || panel.location == 6) { - y = panel.offset - } else { - x = panel.offset - } - } - - MouseArea { - drag { - target: parent - axis: (panel.location == 5 || panel.location == 6) ? Drag.YAxis : Drag.XAxis - } - anchors.fill: parent - onPositionChanged: { - if (panel.location == 5 || panel.location == 6) { - panel.offset = parent.y - } else { - panel.offset = parent.x - } - } - Component.onCompleted: { - if (panel.location == 5 || panel.location == 6) { - parent.y = panel.offset - } else { - parent.x = panel.offset - } - } - } - PlasmaComponents.Label { - text: "Offset" - } } //Minimum length diff --git a/src/shell/qmlpackages/desktop/contents/configuration/panelconfiguration/OffsetButton.qml b/src/shell/qmlpackages/desktop/contents/configuration/panelconfiguration/OffsetButton.qml new file mode 100644 index 000000000..cba9373cc --- /dev/null +++ b/src/shell/qmlpackages/desktop/contents/configuration/panelconfiguration/OffsetButton.qml @@ -0,0 +1,65 @@ +/* + * Copyright 2013 Marco Martin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA. + */ + +import QtQuick 2.0 +import org.kde.plasma.components 2.0 as PlasmaComponents +import org.kde.plasma.extras 2.0 as PlasmaExtras +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.configuration 2.0 +import org.kde.qtextracomponents 2.0 as QtExtras + + +Rectangle { + id: offsetHandle + width: 32 + height: 32 + + property int value + onValueChanged: { + if (panel.location == 5 || panel.location == 6) { + y = panel.offset + } else { + x = panel.offset + } + } + + MouseArea { + drag { + target: parent + axis: (panel.location == 5 || panel.location == 6) ? Drag.YAxis : Drag.XAxis + } + anchors.fill: parent + onPositionChanged: { + if (panel.location == 5 || panel.location == 6) { + panel.offset = parent.y + } else { + panel.offset = parent.x + } + } + Component.onCompleted: { + if (panel.location == 5 || panel.location == 6) { + parent.y = panel.offset + } else { + parent.x = panel.offset + } + } + } + PlasmaComponents.Label { + text: "Offset" + } +}