diff options
author | Thomas Hartmann <Thomas.Hartmann@nokia.com> | 2012-02-23 17:50:30 +0100 |
---|---|---|
committer | hjk <qthjk@ovi.com> | 2012-02-23 18:14:56 +0100 |
commit | 9bc042e09f0f0efe44dfe2540faa4b18594400b0 (patch) | |
tree | 4eb5304e268ad8f2b42379d165e21c4f84131b43 /share/qtcreator | |
parent | 7e380e9d0cb31349f20d7fb2a5c0f07a2865dd1d (diff) | |
download | qt-creator-9bc042e09f0f0efe44dfe2540faa4b18594400b0.tar.gz |
WelcomePage: Add tooltip for sessions
The tooltip allows renaming, cloning and deleting and shows
included projects.
The following method was added to Session:
QStringList projectsForSessionName(const QString &session) const;
I moved the SessionNameInputDialog into the header to reuse it.
I added new roles to SessionModel (ProjectsPathRole, ProjectsDisplayRole).
The following slots were added to SessionModel to expose the backend
functionality:
void cloneSession(const QString &session);
void deleteSession(const QString &session);
void renameSession(const QString &session);
Change-Id: I0182a26dc63b4f051ea948756decd5413c832c60
Reviewed-by: hjk <qthjk@ovi.com>
Diffstat (limited to 'share/qtcreator')
-rw-r--r-- | share/qtcreator/welcomescreen/develop.qml | 34 | ||||
-rw-r--r-- | share/qtcreator/welcomescreen/widgets/CustomFonts.qml | 11 | ||||
-rw-r--r-- | share/qtcreator/welcomescreen/widgets/LinkedText.qml | 1 | ||||
-rw-r--r-- | share/qtcreator/welcomescreen/widgets/RecentSessions.qml | 330 | ||||
-rw-r--r-- | share/qtcreator/welcomescreen/widgets/SessionItem.qml | 12 |
5 files changed, 329 insertions, 59 deletions
diff --git a/share/qtcreator/welcomescreen/develop.qml b/share/qtcreator/welcomescreen/develop.qml index b2aad8be63..73c6a50836 100644 --- a/share/qtcreator/welcomescreen/develop.qml +++ b/share/qtcreator/welcomescreen/develop.qml @@ -64,22 +64,6 @@ Rectangle { anchors.top: parent.top anchors.topMargin: 0 - RecentSessions { - id: recentSessions - - x: 87 - y: 144 - width: 274 - - anchors.left: recentlyUsedSessions.left - anchors.right: recentlyUsedProjects.left - anchors.rightMargin: 40 - anchors.top: recentlyUsedSessions.bottom - anchors.topMargin: 20 - - model: sessionList - } - Rectangle { width: 1 height: line.height @@ -94,7 +78,7 @@ Rectangle { x: 406 y: 144 width: 481 - height: 416 + height: 432 id: recentProjects anchors.left: recentlyUsedProjects.left @@ -184,5 +168,21 @@ Rectangle { source: "widgets/images/icons/createIcon.png" } } + + RecentSessions { + id: recentSessions + + x: 87 + y: 144 + width: 274 + + anchors.left: recentlyUsedSessions.left + anchors.right: recentlyUsedProjects.left + anchors.rightMargin: 40 + anchors.top: recentlyUsedSessions.bottom + anchors.topMargin: 20 + + model: sessionList + } } } diff --git a/share/qtcreator/welcomescreen/widgets/CustomFonts.qml b/share/qtcreator/welcomescreen/widgets/CustomFonts.qml index 982c1902aa..c676ca67ca 100644 --- a/share/qtcreator/welcomescreen/widgets/CustomFonts.qml +++ b/share/qtcreator/welcomescreen/widgets/CustomFonts.qml @@ -37,6 +37,7 @@ QtObject { property alias standardCaption: standardCaptionText.font property alias standstandardDescription: standardDescriptionText.font property alias italicDescription: italicDescriptionText.font + property alias boldDescription: boldText.font property list<Item> texts: [ @@ -51,6 +52,16 @@ QtObject { }, Text { + id: boldText + + visible: false + + font.pixelSize: 13 + font.bold: true + font.family: "Helvetica" + }, + + Text { id: standardCaptionText visible: false diff --git a/share/qtcreator/welcomescreen/widgets/LinkedText.qml b/share/qtcreator/welcomescreen/widgets/LinkedText.qml index 1de1b767fe..8393d05f89 100644 --- a/share/qtcreator/welcomescreen/widgets/LinkedText.qml +++ b/share/qtcreator/welcomescreen/widgets/LinkedText.qml @@ -47,6 +47,7 @@ Text { property bool active: false + property bool hovered: mouseArea.state === "hovered" onActiveChanged: { if (active) mouseArea.state = "" diff --git a/share/qtcreator/welcomescreen/widgets/RecentSessions.qml b/share/qtcreator/welcomescreen/widgets/RecentSessions.qml index df2f3681b6..fbcf031a30 100644 --- a/share/qtcreator/welcomescreen/widgets/RecentSessions.qml +++ b/share/qtcreator/welcomescreen/widgets/RecentSessions.qml @@ -33,58 +33,306 @@ import QtQuick 1.0 import qtcomponents 1.0 -ListView { - id: root +Item { + property alias model: root.model + height: Math.min(root.count * root.delegateHeight, 276) - height: Math.min(count * delegateHeight, 276) - snapMode: ListView.SnapToItem - property int delegateHeight: currentItem.height + spacing + ListView { + id: root - clip: true - interactive: false + anchors.fill: parent + + snapMode: ListView.SnapToItem + property int delegateHeight: currentItem.height + spacing + + clip: true + interactive: false - spacing: 4 + spacing: 4 - delegate: SessionItem { - id: item + property bool delayedHide: false - function fullSessionName() - { - var newSessionName = sessionName - if (model.lastSession && sessionList.isDefaultVirgin()) - newSessionName = qsTr("%1 (last session)").arg(sessionName); - else if (model.activeSession && !sessionList.isDefaultVirgin()) - newSessionName = qsTr("%1 (current session)").arg(sessionName); - return newSessionName; + Behavior on delayedHide { + PropertyAnimation { duration: 200; } } - name: fullSessionName() - } + onDelayedHideChanged: { + panel.opacity = 0; + } - WheelArea { - id: wheelarea - anchors.fill: parent - verticalMinimumValue: vscrollbar.minimumValue - verticalMaximumValue: vscrollbar.maximumValue + delegate: SessionItem { + id: item - onVerticalValueChanged: root.contentY = Math.round(verticalValue / delegateHeight) * delegateHeight + property bool activate: hovered + + Behavior on activate { + PropertyAnimation { duration: 50 } + } + + onActivateChanged: { + if (activate) { + panel.y = item.y + 20 - root.contentY; + panel.opacity = 1; + panel.projectsPathList = projectsPath; + panel.projectsDisplayList = projectsName + panel.currentSession = sessionName; + } else { + if (!panel.hovered) + panel.opacity = 0 + } + } + + onClicked: { + root.delayedHide = !root.delayedHide + } + + function fullSessionName() + { + var newSessionName = sessionName + if (model.lastSession && sessionList.isDefaultVirgin()) + newSessionName = qsTr("%1 (last session)").arg(sessionName); + else if (model.activeSession && !sessionList.isDefaultVirgin()) + newSessionName = qsTr("%1 (current session)").arg(sessionName); + return newSessionName; + } + + name: fullSessionName() + } + + WheelArea { + id: wheelarea + anchors.fill: parent + verticalMinimumValue: vscrollbar.minimumValue + verticalMaximumValue: vscrollbar.maximumValue + + onVerticalValueChanged: root.contentY = Math.round(verticalValue / root.delegateHeight) * root.delegateHeight + } + + ScrollBar { + id: vscrollbar + orientation: Qt.Vertical + property int availableHeight : root.height + visible: root.contentHeight > availableHeight + maximumValue: root.contentHeight > availableHeight ? root.contentHeight - availableHeight : 0 + minimumValue: 0 + anchors.right: parent.right + anchors.top: parent.top + anchors.bottom: parent.bottom + singleStep: root.delegateHeight + anchors.topMargin: styleitem.style == "mac" ? 1 : 0 + onValueChanged: root.contentY = Math.round(value / root.delegateHeight) * root.delegateHeight + anchors.rightMargin: styleitem.frameoffset + anchors.bottomMargin: styleitem.frameoffset + } } - ScrollBar { - id: vscrollbar - orientation: Qt.Vertical - property int availableHeight : root.height - visible: contentHeight > availableHeight - maximumValue: contentHeight > availableHeight ? root.contentHeight - availableHeight : 0 - minimumValue: 0 - anchors.right: parent.right - anchors.top: parent.top - anchors.bottom: parent.bottom - singleStep: delegateHeight - anchors.topMargin: styleitem.style == "mac" ? 1 : 0 - onValueChanged: root.contentY = Math.round(value / delegateHeight) * delegateHeight - anchors.rightMargin: styleitem.frameoffset - anchors.bottomMargin: styleitem.frameoffset + Rectangle { + + CustomFonts { + id: fonts + } + + id: panel + + border.width: 1 + smooth: true + opacity: 0 + + property int margin: 12 + + width: panelColumn.width + margin * 2 + height: panelColumn.height + margin * 2 + + property bool hovered: false + + property variant projectsPathList + property variant projectsDisplayList + + property string currentSession + + onHoveredChanged: { + if (panel.hovered) + panel.opacity = 1; + else + panel.opacity = 0; + } + + MouseArea { + anchors.topMargin: 0 + anchors.fill: parent + id: panelMouseArea + hoverEnabled: true + onEntered: { + panel.hovered = true + } + onExited: { + panel.hovered = false + } + } + + Column { + x: panel.margin + y: panel.margin + id: panelColumn + spacing: 8 + + Repeater { + model: panel.projectsPathList + delegate: Row { + spacing: 6 + Text { + text: panel.projectsDisplayList[index] + font: fonts.boldDescription + } + Text { + text: modelData + font: fonts.linkFont + } + } + } + + Row { + x: -2 + spacing: 2 + id: add + + Item { + //place hold for an icon + width: 16 + height: 16 + + MouseArea { + id: exitMouseArea + anchors.fill: parent + hoverEnabled: true + onEntered: { + panel.hovered = true + } + onExited: { + panel.hovered = false + } + onClicked: { + //Will be uncommented once we have an icon + //model.cloneSession(panel.currentSession); + } + } + } + LinkedText { + text: qsTr("Clone this session") + onEntered: { + panel.hovered = true + } + onExited: { + panel.hovered = false + } + onClicked: { + panel.opacity = 0; + model.cloneSession(panel.currentSession); + } + } + } + Row { + x: -2 + spacing: 2 + id: clear + + Item { + //place holder for an icon + width: 16 + height: 16 + + + MouseArea { + id: clearMouseArea + anchors.fill: parent + hoverEnabled: true + onEntered: { + panel.hovered = true + } + onExited: { + panel.hovered = false + } + onClicked: { + //Will be uncommented once we have an icon + //model.deleteSession(panel.currentSession); + } + } + } + LinkedText { + text: qsTr("Delete this session") + onEntered: { + panel.hovered = true + } + onExited: { + panel.hovered = false + } + onClicked: { + panel.opacity = 0; + model.deleteSession(panel.currentSession); + } + } + } + Row { + x: -2 + spacing: 2 + id: rename + + Item { + //place holder for an icon + opacity: clearMouseArea.containsMouse ? 0.8 : 1 + Behavior on opacity { + PropertyAnimation { duration: visible ? 0 : 50; } + } + + width: 16 + height: 16 + + MouseArea { + id: renameMouseArea + anchors.fill: parent + hoverEnabled: true + onEntered: { + panel.hovered = true + } + onExited: { + panel.hovered = false + } + onClicked: { + //Will be uncommented once we have an icon + //model.renameSession(panel.currentSession); + } + } + } + LinkedText { + text: qsTr("Rename this session") + onEntered: { + panel.hovered = true + } + onExited: { + panel.hovered = false + } + onClicked: { + panel.opacity = 0; + model.renameSession(panel.currentSession); + } + } + } + } + + Behavior on opacity { + PropertyAnimation { duration: visible ? 50 : 100; } + } + radius: 2 + gradient: Gradient { + GradientStop { + position: 0.00; + color: "#ffffff"; + } + GradientStop { + position: 1.00; + color: "#e4e5f0"; + } + } } } diff --git a/share/qtcreator/welcomescreen/widgets/SessionItem.qml b/share/qtcreator/welcomescreen/widgets/SessionItem.qml index 35d8c4f81b..cd8a83dafb 100644 --- a/share/qtcreator/welcomescreen/widgets/SessionItem.qml +++ b/share/qtcreator/welcomescreen/widgets/SessionItem.qml @@ -35,6 +35,13 @@ import QtQuick 1.1 Row { spacing: 4 property alias name: sessionText.text + + property alias hovered: sessionText.hovered + + signal clicked + + id: root + Image { source: "images/bullet.png" anchors.verticalCenter: sessionText.verticalCenter @@ -42,6 +49,9 @@ Row { LinkedText { id: sessionText - onClicked: projectWelcomePage.requestSession(sessionName) + onClicked: { + projectWelcomePage.requestSession(sessionName); + root.clicked(); + } } } |