Merge branch 'master' into editbubble

This commit is contained in:
Sebastian Kügler 2011-11-28 23:47:48 +01:00
commit 1e8cc6c2d5
12 changed files with 132 additions and 123 deletions

View File

@ -194,7 +194,7 @@ void DialogProxy::setVisible(const bool visible)
if (m_dialog->isVisible() != visible) {
m_dialog->setVisible(visible);
if (visible) {
m_dialog->setWindowFlags(m_flags);
m_dialog->setWindowFlags(Qt::FramelessWindowHint|m_flags);
m_dialog->setVisible(visible);
m_dialog->raise();
}

View File

@ -92,12 +92,12 @@ void ToolTipProxy::syncTarget()
return;
}
if (!m_declarativeItemContainer) {
m_declarativeItemContainer = QWeakPointer<DeclarativeItemContainer>(new DeclarativeItemContainer());
if (!m_declarativeItemContainer && scene) {
m_declarativeItemContainer = QWeakPointer<DeclarativeItemContainer>(new DeclarativeItemContainer());
m_declarativeItemContainer.data()->setObjectName("DIContainer");
scene->addItem(m_declarativeItemContainer.data());
}
}
if (m_declarativeItemContainer) {
m_target.data()->setObjectName("Original Item");
m_declarativeItemContainer.data()->setDeclarativeItem(item, false);
@ -105,7 +105,7 @@ void ToolTipProxy::syncTarget()
m_declarativeItemContainer.data()->setParentItem(m_target.data());
m_widget = m_declarativeItemContainer.data();
emit targetChanged();
}
}
}
QString ToolTipProxy::mainText() const

View File

@ -112,8 +112,9 @@ Item {
onActiveWindowChanged: if (!activeWindow) dialog.visible = false
mainItem: Item {
id: mainItem
width: theme.defaultFont.mSize.width * 40
height: titleBar.childrenRect.height + contentItem.childrenRect.height + buttonItem.childrenRect.height
height: titleBar.childrenRect.height + contentItem.childrenRect.height + buttonItem.childrenRect.height + 8
// Consume all key events that are not processed by children
Keys.onPressed: event.accepted = true
@ -134,6 +135,7 @@ Item {
id: contentItem
clip: true
onChildrenRectChanged: mainItem.width = Math.max(childrenRect.width, buttonItem.childrenRect.width)
anchors {
top: titleBar.bottom
left: parent.left
@ -146,11 +148,11 @@ Item {
id: buttonItem
height: childrenRect.height
clip: true
anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
bottomMargin: 8
}
}
}

View File

@ -151,11 +151,6 @@ Item {
}
sectionLabel.text = Sections.closestSection(y/listView.height)
}
Behavior on y {
NumberAnimation {
duration: 150
}
}
}
PlasmaCore.FrameSvgItem {
imagePath: "widgets/tooltip"
@ -163,7 +158,7 @@ Item {
height: sectionLabel.paintedHeight + margins.top + margins.bottom
Label {
id: sectionLabel
font.pointSize: theme.defaultFont.pointSize*3
font.pointSize: theme.defaultFont.pointSize * 1.5
x: parent.margins.left
y: parent.margins.top
}
@ -179,14 +174,7 @@ Item {
}
}
}
/*Repeater {
id: sectionsRepeater
delegate: Label {
anchors.horizontalCenter: parent.horizontalCenter
text: Sections._sections[modelData]
y: Sections._sectionData[modelData].index*(listView.height/listView.model.count)
}
}*/
MouseArea {
id: dragArea
anchors.fill: parent
@ -200,6 +188,7 @@ Item {
onPressed: {
mouse.accepted = true
handle.y = mouse.y
fadeTimer.running = false
}
onReleased: fadeTimer.restart()
@ -231,8 +220,6 @@ Item {
if (listView.model.itemsRemoved)
listView.model.itemsRemoved.connect(dirtyObserver);
sectionsRepeater.model = Sections._sections.length
}
}
}

View File

@ -26,8 +26,8 @@ Item {
// Commmon API
property bool flat: true
property bool checked: false
property bool checkable: false
property bool checked: defaultAction ? defaultAction.checked : false
property bool checkable: defaultAction ? defaultAction.checkable : false
property alias pressed: mouse.pressed
property alias text: label.text
property alias iconSource: icon.source
@ -35,11 +35,16 @@ Item {
signal clicked()
// Plasma extensiuons
property QtObject defaultAction
onFlatChanged: {
delegate.opacity = 1
if (!flat) {
delegate.opacity = 1
}
}
enabled: defaultAction==undefined||defaultAction.enabled
implicitWidth: {
if (label.paintedWidth == 0) {
@ -54,46 +59,37 @@ Item {
// disabled buttons
opacity: enabled ? 1.0 : 0.5
Keys.onSpacePressed: internal.pressButton()
Keys.onReturnPressed: internal.pressButton()
Keys.onSpacePressed: internal.userPressed = true
Keys.onReturnPressed: internal.userPressed = true
Keys.onReleased: {
internal.userPressed = false
if (event.key == Qt.Key_Space ||
event.key == Qt.Key_Return)
internal.releaseButton()
}
onActiveFocusChanged: {
if (activeFocus) {
shadow.state = "focus"
} else if (checked) {
shadow.state = "hidden"
} else {
shadow.state = "shadow"
}
internal.clickButton()
}
QtObject {
id: internal
property bool userPressed: false
function pressButton()
function clickButton()
{
userPressed = true
}
function releaseButton()
{
userPressed = false
if (!button.enabled) {
return
}
if (button.checkable) {
if (defaultAction && defaultAction.checkable) {
defaultAction.checked = !defaultAction.checked
} else if (button.checkable) {
button.checked = !button.checked
}
button.clicked()
button.forceActiveFocus()
if (defaultAction) {
defaultAction.trigger()
}
}
}
@ -142,10 +138,10 @@ Item {
Item {
anchors.fill: parent
property QtObject margins: QtObject {
property int left: 16
property int top: 16
property int right: 16
property int bottom: 16
property int left: 8
property int top: 8
property int right: 8
property int bottom: 8
}
RoundShadow {
anchors.fill: parent
@ -175,6 +171,10 @@ Item {
rightMargin: delegate.margins.right
bottomMargin: delegate.margins.bottom
}
scale: internal.userPressed ? 0.9 : 1
Behavior on scale {
PropertyAnimation { duration: 100 }
}
IconLoader {
id: icon
@ -184,6 +184,8 @@ Item {
left: label.text ? parent.left : undefined
horizontalCenter: label.text ? undefined : parent.horizontalCenter
}
width: label.text ? implicitWidth : roundToStandardSize(parent.width)
height: width
}
Text {
@ -222,26 +224,9 @@ Item {
anchors.fill: parent
hoverEnabled: true
onPressed: internal.pressButton();
onReleased: internal.releaseButton();
onEntered: {
if (!flat) {
shadow.state = "hover"
}
}
onExited: {
if (!flat) {
if (button.activeFocus) {
shadow.state = "focus"
} else if (checked) {
shadow.state = "hidden"
} else {
shadow.state = "shadow"
}
}
}
onPressed: internal.userPressed = true
onReleased: internal.userPressed = false
onClicked: internal.clickButton()
}
}

View File

@ -60,12 +60,7 @@ Item {
&& button.parent.exclusive
}
function pressButton()
{
userPressed = true
}
function releaseButton()
function clickButton()
{
userPressed = false
if (!button.enabled) {
@ -81,12 +76,13 @@ Item {
}
}
Keys.onSpacePressed: internal.pressButton()
Keys.onReturnPressed: internal.pressButton()
Keys.onSpacePressed: internal.userPressed = true
Keys.onReturnPressed: internal.userPressed = true
Keys.onReleased: {
internal.userPressed = false
if (event.key == Qt.Key_Space ||
event.key == Qt.Key_Return)
internal.releaseButton();
internal.clickButton();
}
ButtonShadow {
@ -127,6 +123,10 @@ Item {
Item {
id: buttonContent
state: (internal.userPressed || checked) ? "pressed" : "normal"
scale: state == "pressed" ? 0.9 : 1
Behavior on scale {
PropertyAnimation { duration: 100 }
}
states: [
State { name: "normal" },
@ -206,8 +206,9 @@ Item {
anchors.fill: parent
hoverEnabled: true
onPressed: internal.pressButton()
onReleased: internal.releaseButton()
onCanceled: internal.releaseButton()
onPressed: internal.userPressed = true
onReleased: internal.userPressed = false
onCanceled: internal.userPressed = false
onClicked: internal.clickButton()
}
}

View File

@ -82,14 +82,14 @@ Dialog {
QtObject {
id: internal
function buttonWidth() {
/*function buttonWidth() {
switch (buttonTexts.length) {
case 0: return 0
case 1: return Math.round((800 - 3 * 4) / 2)
default: return (buttonContainer.width - (buttonTexts.length + 1) *
4) / buttonTexts.length
}
}
}*/
function iconSource() {
return root.titleIcon
@ -145,20 +145,13 @@ Dialog {
}
}
buttons: Item {
id: buttonContainer
buttons: Row {
id: buttonRow
LayoutMirroring.enabled: false
LayoutMirroring.childrenInherit: true
width: parent.width
height: buttonTexts.length ? 48 + 2 * 2 : 0
Row {
id: buttonRow
objectName: "buttonRow"
anchors.centerIn: parent
spacing: 4
}
objectName: "buttonRow"
anchors.centerIn: parent
spacing: 4
}
}

View File

@ -112,8 +112,9 @@ Item {
}
mainItem: Item {
id: mainItem
width: theme.defaultFont.mSize.width * 40
height: titleBar.childrenRect.height + contentItem.childrenRect.height + buttonItem.childrenRect.height
height: titleBar.childrenRect.height + contentItem.childrenRect.height + buttonItem.childrenRect.height + 8
// Consume all key events that are not processed by children
Keys.onPressed: event.accepted = true
@ -133,12 +134,15 @@ Item {
Item {
id: contentItem
onChildrenRectChanged: mainItem.width = Math.max(childrenRect.width, buttonItem.childrenRect.width)
clip: true
anchors {
top: titleBar.bottom
left: parent.left
right: parent.right
bottom: buttonItem.top
bottomMargin: 8
}
}
@ -146,15 +150,15 @@ Item {
id: buttonItem
height: childrenRect.height
clip: true
anchors {
left: parent.left
right: parent.right
bottom: parent.bottom
bottomMargin: 4
}
}
}
Component.onCompleted: {
rootItem = Utils.rootObject()
}

View File

@ -56,6 +56,23 @@ Item {
id: svgIcon
}
function roundToStandardSize(size)
{
if (size >= theme.enormousIconSize) {
return theme.enormousIconSize
} else if (size >= theme.hugeIconSize) {
return theme.hugeIconSize
} else if (size >= theme.largeIconSize) {
return theme.largeIconSize
} else if (size >= theme.mediumIconSize) {
return theme.mediumIconSize
} else if (size >= theme.smallMediumIconSize) {
return theme.smallMediumIconSize
} else {
return theme.smallIconSize
}
}
Loader {
id: imageLoader
anchors.fill: parent
@ -67,9 +84,10 @@ Item {
svg: svgIcon
elementId: root.source
anchors.fill: parent
smooth: true
}
}
Component {
id: iconComponent

View File

@ -121,17 +121,23 @@ Item {
}
onInitialPageChanged: {
if (!internal.completed) {
return
}
if (initialPage) {
if (depth == 0)
if (depth == 0) {
push(initialPage, null, true)
else if (depth == 1)
} else if (depth == 1) {
replace(initialPage, null, true)
else
} else {
console.log("Cannot update PageStack.initialPage")
}
}
}
Component.onCompleted: {
internal.completed = true
if (initialPage && depth == 0)
push(initialPage, null, true)
}
@ -142,6 +148,9 @@ Item {
// The number of ongoing transitions.
property int ongoingTransitionCount: 0
//FIXME: there should be a way to access to theh without storing it in an ugly way
property bool completed: false
// Sets the page status.
function setPageStatus(page, status)
{

View File

@ -23,7 +23,7 @@ import org.kde.plasma.core 0.1 as PlasmaCore
Item{
id: toolBar
width: parent.width
height: (tools && enabled) ? theme.defaultFont.mSize.height*2 + frameSvg.margins.top + frameSvg.margins.bottom : 0
height: (tools && enabled) ? tools.height + frameSvg.margins.top + frameSvg.margins.bottom : 0
visible: height > 0
Behavior on height {
PropertyAnimation {

View File

@ -26,8 +26,8 @@ Item {
// Commmon API
property bool flat: true
property bool checked: false
property bool checkable: false
property bool checked: defaultAction ? defaultAction.checked : false
property bool checkable: defaultAction ? defaultAction.checkable : false
property alias pressed: mouse.pressed
property alias text: label.text
property alias iconSource: icon.source
@ -35,6 +35,11 @@ Item {
signal clicked()
// Plasma extensiuons
property QtObject defaultAction
enabled: defaultAction==undefined||defaultAction.enabled
onFlatChanged: {
surface.opacity = 1
@ -54,12 +59,13 @@ Item {
// disabled buttons
opacity: enabled ? 1.0 : 0.5
Keys.onSpacePressed: internal.pressButton()
Keys.onReturnPressed: internal.pressButton()
Keys.onSpacePressed: internal.userPressed = true
Keys.onReturnPressed: internal.userPressed = true
Keys.onReleased: {
internal.userPressed = false
if (event.key == Qt.Key_Space ||
event.key == Qt.Key_Return)
internal.releaseButton()
internal.clickButton()
}
onActiveFocusChanged: {
@ -76,24 +82,24 @@ Item {
id: internal
property bool userPressed: false
function pressButton()
function clickButton()
{
userPressed = true
}
function releaseButton()
{
userPressed = false
if (!button.enabled) {
return
}
if (button.checkable) {
if (defaultAction && defaultAction.checkable) {
defaultAction.checked = !defaultAction.checked
} else if (button.checkable) {
button.checked = !button.checked
}
button.clicked()
button.forceActiveFocus()
if (defaultAction) {
defaultAction.trigger()
}
}
}
@ -112,7 +118,7 @@ Item {
//internal: if there is no hover status, don't paint on mouse over in touchscreens
opacity: (internal.userPressed || checked || !flat || (shadow.hasOverState && mouse.containsMouse)) ? 1 : 0
Behavior on opacity {
PropertyAnimation { duration: 250 }
PropertyAnimation { duration: 100 }
}
}
@ -124,6 +130,10 @@ Item {
rightMargin: surface.margins.right
bottomMargin: surface.margins.bottom
}
scale: internal.userPressed ? 0.9 : 1
Behavior on scale {
PropertyAnimation { duration: 250 }
}
IconLoader {
id: icon
@ -171,9 +181,9 @@ Item {
anchors.fill: parent
hoverEnabled: true
onPressed: internal.pressButton();
onReleased: internal.releaseButton();
onPressed: internal.userPressed = true
onReleased: internal.userPressed = false
onClicked: internal.clickButton()
onEntered: {
if (!flat) {