summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--share/qtcreator/welcomescreen/develop.qml34
-rw-r--r--share/qtcreator/welcomescreen/widgets/CustomFonts.qml11
-rw-r--r--share/qtcreator/welcomescreen/widgets/LinkedText.qml1
-rw-r--r--share/qtcreator/welcomescreen/widgets/RecentSessions.qml330
-rw-r--r--share/qtcreator/welcomescreen/widgets/SessionItem.qml12
-rw-r--r--src/plugins/projectexplorer/projectwelcomepage.cpp72
-rw-r--r--src/plugins/projectexplorer/projectwelcomepage.h5
-rw-r--r--src/plugins/projectexplorer/session.cpp13
-rw-r--r--src/plugins/projectexplorer/session.h1
-rw-r--r--src/plugins/projectexplorer/sessiondialog.cpp22
-rw-r--r--src/plugins/projectexplorer/sessiondialog.h24
11 files changed, 442 insertions, 83 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();
+ }
}
}
diff --git a/src/plugins/projectexplorer/projectwelcomepage.cpp b/src/plugins/projectexplorer/projectwelcomepage.cpp
index c5f933514a..ee4c436d5a 100644
--- a/src/plugins/projectexplorer/projectwelcomepage.cpp
+++ b/src/plugins/projectexplorer/projectwelcomepage.cpp
@@ -36,9 +36,12 @@
#include <QDeclarativeEngine>
#include <QDeclarativeContext>
+#include <QFileInfo>
+#include <QDir>
#include <projectexplorer/session.h>
#include <projectexplorer/projectexplorer.h>
+#include <sessiondialog.h>
namespace ProjectExplorer {
namespace Internal {
@@ -51,6 +54,8 @@ SessionModel::SessionModel(SessionManager *manager, QObject *parent)
roleNames[DefaultSessionRole] = "defaultSession";
roleNames[ActiveSessionRole] = "activeSession";
roleNames[LastSessionRole] = "lastSession";
+ roleNames[ProjectsPathRole] = "projectsPath";
+ roleNames[ProjectsDisplayRole] = "projectsName";
setRoleNames(roleNames);
connect(manager, SIGNAL(sessionLoaded(QString)), SLOT(resetSessions()));
}
@@ -60,10 +65,28 @@ int SessionModel::rowCount(const QModelIndex &) const
return m_manager->sessions().count();
}
+QStringList pathsToBaseNames(const QStringList &paths)
+{
+ QStringList stringList;
+ foreach (const QString &path, paths)
+ stringList.append(QFileInfo(path).completeBaseName());
+ return stringList;
+}
+
+
+
+QStringList pathsWithTildeHomePath(const QStringList &paths)
+{
+ QStringList stringList;
+ foreach (const QString &path, paths)
+ stringList.append(Utils::withTildeHomePath(QDir::toNativeSeparators(path)));
+ return stringList;
+}
+
QVariant SessionModel::data(const QModelIndex &index, int role) const
{
if (role == Qt::DisplayRole || role == DefaultSessionRole ||
- role == LastSessionRole || role == ActiveSessionRole) {
+ role == LastSessionRole || role == ActiveSessionRole || role == ProjectsPathRole || role == ProjectsDisplayRole) {
QString sessionName = m_manager->sessions().at(index.row());
if (role == Qt::DisplayRole)
return sessionName;
@@ -73,6 +96,10 @@ QVariant SessionModel::data(const QModelIndex &index, int role) const
return m_manager->lastSession() == sessionName;
else if (role == ActiveSessionRole)
return m_manager->activeSession() == sessionName;
+ else if (role == ProjectsPathRole)
+ return pathsWithTildeHomePath(m_manager->projectsForSessionName(sessionName));
+ else if (role == ProjectsDisplayRole)
+ return pathsToBaseNames(m_manager->projectsForSessionName(sessionName));
}
return QVariant();
}
@@ -87,6 +114,49 @@ void SessionModel::resetSessions()
reset();
}
+void SessionModel::cloneSession(const QString &session)
+{
+ SessionNameInputDialog newSessionInputDialog(m_manager->sessions(), 0);
+ newSessionInputDialog.setWindowTitle(tr("New session name"));
+ newSessionInputDialog.setValue(session + QLatin1String(" (2)"));
+
+ if (newSessionInputDialog.exec() == QDialog::Accepted) {
+ QString newSession = newSessionInputDialog.value();
+ if (newSession.isEmpty() || m_manager->sessions().contains(newSession))
+ return;
+ m_manager->cloneSession(session, newSession);
+ reset();
+
+ if (newSessionInputDialog.isSwitchToRequested()) {
+ m_manager->loadSession(newSession);
+ }
+ }
+}
+
+void SessionModel::deleteSession(const QString &session)
+{
+ m_manager->deleteSession(session);
+ reset();
+}
+
+void SessionModel::renameSession(const QString &session)
+{
+ SessionNameInputDialog newSessionInputDialog(m_manager->sessions(), 0);
+ newSessionInputDialog.setWindowTitle(tr("New session name"));
+ newSessionInputDialog.setValue(session);
+
+ if (newSessionInputDialog.exec() == QDialog::Accepted) {
+ QString newSession = newSessionInputDialog.value();
+ if (newSession.isEmpty() || m_manager->sessions().contains(newSession))
+ return;
+ m_manager->renameSession(session, newSession);
+ reset();
+
+ if (newSessionInputDialog.isSwitchToRequested()) {
+ m_manager->loadSession(newSession);
+ }
+ }
+}
ProjectModel::ProjectModel(ProjectExplorerPlugin *plugin, QObject *parent)
: QAbstractListModel(parent), m_plugin(plugin)
diff --git a/src/plugins/projectexplorer/projectwelcomepage.h b/src/plugins/projectexplorer/projectwelcomepage.h
index 133796320c..2e85551b2e 100644
--- a/src/plugins/projectexplorer/projectwelcomepage.h
+++ b/src/plugins/projectexplorer/projectwelcomepage.h
@@ -54,7 +54,7 @@ class SessionModel : public QAbstractListModel
{
Q_OBJECT
public:
- enum { DefaultSessionRole = Qt::UserRole+1, LastSessionRole, ActiveSessionRole };
+ enum { DefaultSessionRole = Qt::UserRole+1, LastSessionRole, ActiveSessionRole, ProjectsPathRole, ProjectsDisplayRole };
SessionModel(SessionManager* manager, QObject* parent = 0);
int rowCount(const QModelIndex &parent) const;
@@ -64,6 +64,9 @@ public:
public slots:
void resetSessions();
+ void cloneSession(const QString &session);
+ void deleteSession(const QString &session);
+ void renameSession(const QString &session);
private:
SessionManager *m_manager;
diff --git a/src/plugins/projectexplorer/session.cpp b/src/plugins/projectexplorer/session.cpp
index d36933fa7e..e121ac0959 100644
--- a/src/plugins/projectexplorer/session.cpp
+++ b/src/plugins/projectexplorer/session.cpp
@@ -914,3 +914,16 @@ void SessionManager::sessionLoadingProgress()
m_future.setProgressValue(m_future.progressValue() + 1);
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
}
+
+QStringList ProjectExplorer::SessionManager::projectsForSessionName(const QString &session) const
+{
+ const QString fileName = sessionNameToFileName(session);
+ PersistentSettingsReader reader;
+ if (QFileInfo(fileName).exists()) {
+ if (!reader.load(fileName)) {
+ qWarning() << "Could not restore session" << fileName;
+ return QStringList();
+ }
+ }
+ return reader.restoreValue(QLatin1String("ProjectList")).toStringList();
+}
diff --git a/src/plugins/projectexplorer/session.h b/src/plugins/projectexplorer/session.h
index 0d9f370685..d0c5b40061 100644
--- a/src/plugins/projectexplorer/session.h
+++ b/src/plugins/projectexplorer/session.h
@@ -120,6 +120,7 @@ public:
Node *nodeForFile(const QString &fileName, Project *project = 0) const;
Project *projectForFile(const QString &fileName) const;
+ QStringList projectsForSessionName(const QString &session) const;
void reportProjectLoadingProgress();
signals:
diff --git a/src/plugins/projectexplorer/sessiondialog.cpp b/src/plugins/projectexplorer/sessiondialog.cpp
index 7598be59c2..384f8a1c9d 100644
--- a/src/plugins/projectexplorer/sessiondialog.cpp
+++ b/src/plugins/projectexplorer/sessiondialog.cpp
@@ -85,26 +85,6 @@ void SessionValidator::fixup(QString &input) const
input = copy;
}
-
-class SessionNameInputDialog : public QDialog
-{
- Q_OBJECT
-public:
- SessionNameInputDialog(const QStringList &sessions, QWidget *parent = 0);
-
- void setValue(const QString &value);
- QString value() const;
- bool isSwitchToRequested() const;
-
-private slots:
- void clicked(QAbstractButton *button);
-
-private:
- QLineEdit *m_newSessionLineEdit;
- QPushButton *m_switchToButton;
- bool m_usedSwitchTo;
-};
-
SessionNameInputDialog::SessionNameInputDialog(const QStringList &sessions, QWidget *parent)
: QDialog(parent), m_usedSwitchTo(false)
{
@@ -299,5 +279,3 @@ void SessionDialog::switchToSession()
} // namespace Internal
} // namespace ProjectExplorer
-
-#include "sessiondialog.moc"
diff --git a/src/plugins/projectexplorer/sessiondialog.h b/src/plugins/projectexplorer/sessiondialog.h
index fc181856e4..9891fd9aea 100644
--- a/src/plugins/projectexplorer/sessiondialog.h
+++ b/src/plugins/projectexplorer/sessiondialog.h
@@ -38,6 +38,11 @@
#include "ui_sessiondialog.h"
+QT_BEGIN_NAMESPACE
+class QLineEdit;
+class QPushButton;
+QT_END_NAMESPACE
+
namespace ProjectExplorer {
class SessionManager;
@@ -69,6 +74,25 @@ private:
SessionManager *m_sessionManager;
};
+class SessionNameInputDialog : public QDialog
+{
+ Q_OBJECT
+public:
+ SessionNameInputDialog(const QStringList &sessions, QWidget *parent = 0);
+
+ void setValue(const QString &value);
+ QString value() const;
+ bool isSwitchToRequested() const;
+
+private slots:
+ void clicked(QAbstractButton *button);
+
+private:
+ QLineEdit *m_newSessionLineEdit;
+ QPushButton *m_switchToButton;
+ bool m_usedSwitchTo;
+};
+
} // namespace Internal
} // namespace ProjectExplorer