From c6df40a51d9d87f951300c6a3ded3013c33d98b9 Mon Sep 17 00:00:00 2001 From: Daniel Molkentin <daniel.molkentin@nokia.com> Date: Mon, 11 May 2009 15:43:36 +0200 Subject: [PATCH] Add more sections. Getting started is still a stub. --- src/plugins/coreplugin/coreplugin.pro | 3 + src/plugins/coreplugin/welcomemode.cpp | 41 ++- src/plugins/coreplugin/welcomemode.h | 1 + src/plugins/coreplugin/welcomemode.ui | 467 ++++++++++++++++++++++--- src/plugins/coreplugin/welcomemode_p.h | 3 + 5 files changed, 467 insertions(+), 48 deletions(-) diff --git a/src/plugins/coreplugin/coreplugin.pro b/src/plugins/coreplugin/coreplugin.pro index bda8d8d3ae1..9faebcc42be 100644 --- a/src/plugins/coreplugin/coreplugin.pro +++ b/src/plugins/coreplugin/coreplugin.pro @@ -2,6 +2,7 @@ TEMPLATE = lib TARGET = Core DEFINES += CORE_LIBRARY QT += xml \ + network \ script \ svg include(../../qtcreatorplugin.pri) @@ -19,6 +20,7 @@ DEPENDPATH += dialogs \ scriptmanager SOURCES += mainwindow.cpp \ welcomemode.cpp \ + rssfetcher.cpp \ editmode.cpp \ tabpositionindicator.cpp \ fancyactionbar.cpp \ @@ -78,6 +80,7 @@ SOURCES += mainwindow.cpp \ HEADERS += mainwindow.h \ welcomemode.h \ welcomemode_p.h \ + rssfetcher.h \ editmode.h \ tabpositionindicator.h \ fancyactionbar.h \ diff --git a/src/plugins/coreplugin/welcomemode.cpp b/src/plugins/coreplugin/welcomemode.cpp index c3ae4245d60..4038bedeb11 100644 --- a/src/plugins/coreplugin/welcomemode.cpp +++ b/src/plugins/coreplugin/welcomemode.cpp @@ -31,6 +31,7 @@ #include "coreconstants.h" #include "uniqueidmanager.h" #include "modemanager.h" +#include "rssfetcher.h" #include <QtGui/QToolBar> #include <QtGui/QDesktopServices> @@ -53,7 +54,7 @@ struct WelcomeModePrivate QWidget *m_widget; QWidget *m_welcomePage; Ui::WelcomePage ui; - + RSSFetcher *rssFetcher; WelcomeMode::WelcomePageData lastData; }; @@ -97,11 +98,14 @@ WelcomeMode::WelcomeMode() : l->setMargin(0); l->setSpacing(0); l->addWidget(new QToolBar(m_d->m_widget)); - + m_d->rssFetcher = new RSSFetcher(6, this); m_d->m_welcomePage = new QWidget(m_d->m_widget); m_d->ui.setupUi(m_d->m_welcomePage); m_d->ui.sessTreeWidget->viewport()->setAutoFillBackground(false); m_d->ui.projTreeWidget->viewport()->setAutoFillBackground(false); + m_d->ui.newsTreeWidget->viewport()->setAutoFillBackground(false); + m_d->ui.sitesTreeWidget->viewport()->setAutoFillBackground(false); + m_d->ui.tutorialTreeWidget->viewport()->setAutoFillBackground(false); l->addWidget(m_d->m_welcomePage); updateWelcomePage(WelcomePageData()); @@ -118,6 +122,29 @@ WelcomeMode::WelcomeMode() : connect(m_d->ui.restoreSessionButton, SIGNAL(clicked()), SLOT(slotRestoreLastSession())); connect(m_d->ui.sessTreeWidget, SIGNAL(activated(QString)), SLOT(slotSessionClicked(QString))); connect(m_d->ui.projTreeWidget, SIGNAL(activated(QString)), SLOT(slotProjectClicked(QString))); + connect(m_d->ui.newsTreeWidget, SIGNAL(activated(QString)), SLOT(slotUrlClicked(QString))); + connect(m_d->ui.sitesTreeWidget, SIGNAL(activated(QString)), SLOT(slotUrlClicked(QString))); + + connect(m_d->rssFetcher, SIGNAL(newsItemReady(QString, QString)), + m_d->ui.newsTreeWidget, SLOT(slotAddItem(QString, QString))); + + //: Add localized feed here only if one exists + m_d->rssFetcher->fetch(QUrl(tr("http://labs.trolltech.com/blogs/feed"))); + + m_d->ui.sitesTreeWidget->addItem(tr("Qt Software"), QLatin1String("http://www.qtsoftware.com")); + m_d->ui.sitesTreeWidget->addItem(tr("Qt Labs"), QLatin1String("http://labs.qtsoftware.com")); + m_d->ui.sitesTreeWidget->addItem(tr("Qt Git Hosting"), QLatin1String("http://qt.gitorious.org")); + m_d->ui.sitesTreeWidget->addItem(tr("Qt Centre"), QLatin1String("http://www.qtcentre.org")); + m_d->ui.sitesTreeWidget->addItem(tr("Qt/S60 at Forum Nokia"), QLatin1String("http://discussion.forum.nokia.com/forum/forumdisplay.php?f=196")); + + m_d->ui.tutorialTreeWidget->addItem(tr("Tutorial 1"), QLatin1String("")); + m_d->ui.tutorialTreeWidget->addItem(tr("Tutorial 2"), QLatin1String("")); + m_d->ui.tutorialTreeWidget->addItem(tr("Tutorial 3"), QLatin1String("")); + m_d->ui.tutorialTreeWidget->addItem(tr("Tutorial 4"), QLatin1String("")); + m_d->ui.tutorialTreeWidget->addItem(tr("Tutorial 5"), QLatin1String("")); + + // ### check for first start, select getting started in this case + m_d->ui.developSectButton->animateClick(); } WelcomeMode::~WelcomeMode() @@ -218,6 +245,11 @@ void WelcomeMode::slotProjectClicked(const QString &data) activateEditMode(); } +void WelcomeMode::slotUrlClicked(const QString &data) +{ + QDesktopServices::openUrl(QUrl(data)); +} + void WelcomeMode::slotRestoreLastSession() { emit requestSession(m_d->lastData.previousSession); @@ -310,6 +342,11 @@ QTreeWidgetItem *WelcomeModeTreeWidget::addItem(const QString &label, const QStr return item; } +void WelcomeModeTreeWidget::slotAddItem(const QString &label, const QString &data) +{ + addTopLevelItem(addItem(label,data)); +} + void WelcomeModeTreeWidget::slotItemClicked(QTreeWidgetItem *item) { emit activated(item->data(0, Qt::UserRole).toString()); diff --git a/src/plugins/coreplugin/welcomemode.h b/src/plugins/coreplugin/welcomemode.h index 52e009acca5..7d78c3435a3 100644 --- a/src/plugins/coreplugin/welcomemode.h +++ b/src/plugins/coreplugin/welcomemode.h @@ -85,6 +85,7 @@ private slots: void slotRestoreLastSession(); void slotSessionClicked(const QString &data); void slotProjectClicked(const QString &data); + void slotUrlClicked(const QString &data); private: void activateEditMode(); diff --git a/src/plugins/coreplugin/welcomemode.ui b/src/plugins/coreplugin/welcomemode.ui index 89a6ac417fd..b4b5d8a3fcd 100644 --- a/src/plugins/coreplugin/welcomemode.ui +++ b/src/plugins/coreplugin/welcomemode.ui @@ -219,20 +219,135 @@ background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 <item> <widget class="QStackedWidget" name="stackedWidget"> <property name="currentIndex"> - <number>1</number> + <number>2</number> </property> <widget class="QWidget" name="page"> - <widget class="Core::Internal::WelcomeModeButton" name="gettingStartedButton"> - <property name="geometry"> - <rect> - <x>280</x> - <y>150</y> - <width>128</width> - <height>25</height> - </rect> - </property> - <property name="styleSheet"> - <string>* { + <layout class="QGridLayout" name="gridLayout_7"> + <item row="0" column="0"> + <spacer name="horizontalSpacer_11"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>326</height> + </size> + </property> + </spacer> + </item> + <item row="0" column="1"> + <widget class="QFrame" name="recentProjectsFrame_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>400</width> + <height>16777215</height> + </size> + </property> + <property name="styleSheet"> + <string/> + </property> + <layout class="QGridLayout" name="gridLayout_6"> + <item row="0" column="0"> + <widget class="QLabel" name="projIconLabel_2"> + <property name="pixmap"> + <pixmap resource="core.qrc">:/core/images/welcomemode/mode_project.png</pixmap> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="projTitleLabel_2"> + <property name="text"> + <string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:16px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:x-large; color:#555555;">Tutorials</span></p> +<hr /></body></html></string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="Core::Internal::WelcomeModeTreeWidget" name="tutorialTreeWidget"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="selectionMode"> + <enum>QAbstractItemView::NoSelection</enum> + </property> + <property name="verticalScrollMode"> + <enum>QAbstractItemView::ScrollPerPixel</enum> + </property> + <property name="rootIsDecorated"> + <bool>false</bool> + </property> + <property name="uniformRowHeights"> + <bool>true</bool> + </property> + <property name="allColumnsShowFocus"> + <bool>true</bool> + </property> + <property name="columnCount"> + <number>2</number> + </property> + <attribute name="headerVisible"> + <bool>false</bool> + </attribute> + <attribute name="headerDefaultSectionSize"> + <number>24</number> + </attribute> + <attribute name="headerMinimumSectionSize"> + <number>0</number> + </attribute> + <column> + <property name="text"> + <string notr="true">1</string> + </property> + </column> + <column> + <property name="text"> + <string notr="true">2</string> + </property> + </column> + </widget> + </item> + </layout> + </widget> + </item> + <item row="1" column="3"> + <widget class="Core::Internal::WelcomeModeButton" name="gettingStartedButton"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="styleSheet"> + <string>* { border-image: url(:/core/images/welcomemode/btn_27.png) 7; border-width: 7; padding: -2px 0; @@ -246,11 +361,29 @@ background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 color: white; } </string> - </property> - <property name="text"> - <string><qt>Getting Started &gt;&gt;</string> - </property> - </widget> + </property> + <property name="text"> + <string><qt>Getting Started &gt;&gt;</string> + </property> + </widget> + </item> + <item row="1" column="2"> + <spacer name="horizontalSpacer_13"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::MinimumExpanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> </widget> <widget class="QWidget" name="page_2"> <layout class="QGridLayout" name="gridLayout_3"> @@ -571,27 +704,268 @@ p, li { white-space: pre-wrap; } </layout> </widget> <widget class="QWidget" name="Seite"> - <widget class="QWidget" name="layoutWidget"> - <property name="geometry"> - <rect> - <x>180</x> - <y>160</y> - <width>281</width> - <height>27</height> - </rect> - </property> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QLabel" name="helpUsLabel"> - <property name="text"> - <string>Help us make Qt Creator even better</string> - </property> - </widget> - </item> - <item> - <widget class="Core::Internal::WelcomeModeButton" name="feedbackButton"> - <property name="styleSheet"> - <string>* { + <layout class="QVBoxLayout" name="verticalLayout_6"> + <item> + <spacer name="verticalSpacer_6"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>35</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <spacer name="horizontalSpacer_7"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::MinimumExpanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>19</width> + <height>228</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <widget class="QLabel" name="titleLabel_2"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:16px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:x-large; color:#555555;">Qt Community News</span></p> +<hr /></body></html></string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + </widget> + </item> + <item> + <widget class="Core::Internal::WelcomeModeTreeWidget" name="newsTreeWidget"> + <property name="minimumSize"> + <size> + <width>280</width> + <height>0</height> + </size> + </property> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="selectionMode"> + <enum>QAbstractItemView::NoSelection</enum> + </property> + <property name="verticalScrollMode"> + <enum>QAbstractItemView::ScrollPerPixel</enum> + </property> + <property name="rootIsDecorated"> + <bool>false</bool> + </property> + <property name="uniformRowHeights"> + <bool>true</bool> + </property> + <property name="allColumnsShowFocus"> + <bool>true</bool> + </property> + <property name="columnCount"> + <number>2</number> + </property> + <attribute name="headerVisible"> + <bool>false</bool> + </attribute> + <attribute name="headerDefaultSectionSize"> + <number>24</number> + </attribute> + <attribute name="headerMinimumSectionSize"> + <number>0</number> + </attribute> + <column> + <property name="text"> + <string notr="true">1</string> + </property> + </column> + <column> + <property name="text"> + <string notr="true">2</string> + </property> + </column> + </widget> + </item> + </layout> + </item> + <item> + <spacer name="horizontalSpacer_8"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>156</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <item> + <widget class="QLabel" name="titleLabel_3"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string notr="true"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:16px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:x-large; color:#555555;">Qt Websites</span></p> +<hr /></body></html></string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + </widget> + </item> + <item> + <widget class="Core::Internal::WelcomeModeTreeWidget" name="sitesTreeWidget"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="selectionMode"> + <enum>QAbstractItemView::NoSelection</enum> + </property> + <property name="verticalScrollMode"> + <enum>QAbstractItemView::ScrollPerPixel</enum> + </property> + <property name="rootIsDecorated"> + <bool>false</bool> + </property> + <property name="uniformRowHeights"> + <bool>true</bool> + </property> + <property name="allColumnsShowFocus"> + <bool>true</bool> + </property> + <property name="columnCount"> + <number>2</number> + </property> + <attribute name="headerVisible"> + <bool>false</bool> + </attribute> + <attribute name="headerDefaultSectionSize"> + <number>24</number> + </attribute> + <attribute name="headerMinimumSectionSize"> + <number>0</number> + </attribute> + <column> + <property name="text"> + <string notr="true">1</string> + </property> + </column> + <column> + <property name="text"> + <string notr="true">2</string> + </property> + </column> + </widget> + </item> + </layout> + </item> + </layout> + </item> + <item> + <spacer name="horizontalSpacer_9"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::MinimumExpanding</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>19</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <spacer name="verticalSpacer_5"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>34</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <spacer name="horizontalSpacer_10"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>633</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="helpUsLabel"> + <property name="text"> + <string>Help us make Qt Creator even better</string> + </property> + </widget> + </item> + <item> + <widget class="Core::Internal::WelcomeModeButton" name="feedbackButton"> + <property name="styleSheet"> + <string>* { border-image: url(:/core/images/welcomemode/btn_26.png) 7; border-width: 7; padding: -2px 2px; @@ -604,14 +978,15 @@ p, li { white-space: pre-wrap; } color: white; } </string> - </property> - <property name="text"> - <string><qt>Feedback&nbsp;&nbsp;<img src=":/core/images/welcomemode/feedback_arrow.png" /></string> - </property> - </widget> - </item> - </layout> - </widget> + </property> + <property name="text"> + <string><qt>Feedback&nbsp;&nbsp;<img src=":/core/images/welcomemode/feedback_arrow.png" /></string> + </property> + </widget> + </item> + </layout> + </item> + </layout> </widget> </widget> </item> diff --git a/src/plugins/coreplugin/welcomemode_p.h b/src/plugins/coreplugin/welcomemode_p.h index 49e4642da23..929f9bd8212 100644 --- a/src/plugins/coreplugin/welcomemode_p.h +++ b/src/plugins/coreplugin/welcomemode_p.h @@ -68,6 +68,9 @@ public: WelcomeModeTreeWidget(QWidget *parent = 0); QTreeWidgetItem *addItem(const QString &label, const QString &data); +public slots: + void slotAddItem(const QString &label, const QString &data); + signals: void activated(const QString &data); -- GitLab