move the offset button in new file

This commit is contained in:
Marco Martin 2013-05-08 14:22:22 +02:00
parent 9f88d14d73
commit 8c07b27cb2
2 changed files with 69 additions and 37 deletions

View File

@ -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

View File

@ -0,0 +1,65 @@
/*
* Copyright 2013 Marco Martin <mart@kde.org>
*
* 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"
}
}