diff options
author | Daniel Molkentin <daniel.molkentin@nokia.com> | 2009-07-27 13:55:30 +0200 |
---|---|---|
committer | Daniel Molkentin <daniel.molkentin@nokia.com> | 2009-07-28 16:11:55 +0200 |
commit | 5633de2ac91e2cded7895c9cf871fb2327ff18b6 (patch) | |
tree | 3ed177dfcfc8a4564ca887550021c92f000f72ad /src/plugins/welcome | |
parent | a9b521f80af025ac11f9735fc070606952894b60 (diff) | |
download | qt-creator-5633de2ac91e2cded7895c9cf871fb2327ff18b6.tar.gz |
Make the welcome screen into plugins.
This removes the all hard dependencies to and from welcome screen,
except the one to the core plugin. More in detail:
- Add IWelcomePage to add a tab to the welcome screen
- Move tabs in the modules where they belong
- Enables QHelpManager to open help fullscreen and contextually
- "Getting Started" moves to Qt4ProjectManager
- Projects & Sessions (aka "Develop") moves to ProjectExplorer
- "Community" remains in the welcome plugin for simplicity
Diffstat (limited to 'src/plugins/welcome')
-rw-r--r-- | src/plugins/welcome/communitywelcomepage.cpp | 48 | ||||
-rw-r--r-- | src/plugins/welcome/communitywelcomepage.h | 60 | ||||
-rw-r--r-- | src/plugins/welcome/communitywelcomepagewidget.cpp | 79 | ||||
-rw-r--r-- | src/plugins/welcome/communitywelcomepagewidget.h | 64 | ||||
-rw-r--r-- | src/plugins/welcome/communitywelcomepagewidget.ui | 195 | ||||
-rw-r--r-- | src/plugins/welcome/rssfetcher.cpp | 2 | ||||
-rw-r--r-- | src/plugins/welcome/rssfetcher.h | 2 | ||||
-rw-r--r-- | src/plugins/welcome/welcome.pro | 12 | ||||
-rw-r--r-- | src/plugins/welcome/welcomemode.cpp | 394 | ||||
-rw-r--r-- | src/plugins/welcome/welcomemode.h | 35 | ||||
-rw-r--r-- | src/plugins/welcome/welcomemode.ui | 872 | ||||
-rw-r--r-- | src/plugins/welcome/welcomeplugin.cpp | 15 | ||||
-rw-r--r-- | src/plugins/welcome/welcomeplugin.h | 5 |
13 files changed, 560 insertions, 1223 deletions
diff --git a/src/plugins/welcome/communitywelcomepage.cpp b/src/plugins/welcome/communitywelcomepage.cpp new file mode 100644 index 0000000000..0337fb113b --- /dev/null +++ b/src/plugins/welcome/communitywelcomepage.cpp @@ -0,0 +1,48 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +**************************************************************************/ + +#include "communitywelcomepage.h" +#include "communitywelcomepagewidget.h" + + +namespace Welcome { +namespace Internal { + +CommunityWelcomePage::CommunityWelcomePage() + : m_page(new CommunityWelcomePageWidget) +{ +} + +QWidget* CommunityWelcomePage::page() +{ + return m_page; +} + +} // namespace Internal +} // namespace Welcome diff --git a/src/plugins/welcome/communitywelcomepage.h b/src/plugins/welcome/communitywelcomepage.h new file mode 100644 index 0000000000..b6c047c3d7 --- /dev/null +++ b/src/plugins/welcome/communitywelcomepage.h @@ -0,0 +1,60 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +**************************************************************************/ + +#ifndef COMMUNITYWELCOMEPAGE_H +#define COMMUNITYWELCOMEPAGE_H + +#include "welcome_global.h" + +#include <extensionsystem/iwelcomepage.h> + +namespace Welcome { +namespace Internal { + +class CommunityWelcomePageWidget; + +class WELCOME_EXPORT CommunityWelcomePage : public ExtensionSystem::IWelcomePage +{ + Q_OBJECT +public: + CommunityWelcomePage(); + + QWidget *page(); + QString title() const { return tr("Community"); } + int priority() const { return 30; } + +private: + CommunityWelcomePageWidget *m_page; + +}; + +} // namespace Internal +} // namespace Welcome + +#endif // COMMUNITYWELCOMEPAGE_H diff --git a/src/plugins/welcome/communitywelcomepagewidget.cpp b/src/plugins/welcome/communitywelcomepagewidget.cpp new file mode 100644 index 0000000000..40c72fed57 --- /dev/null +++ b/src/plugins/welcome/communitywelcomepagewidget.cpp @@ -0,0 +1,79 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +**************************************************************************/ + +#include "communitywelcomepagewidget.h" +#include "ui_communitywelcomepagewidget.h" + +#include "rssfetcher.h" + +#include <QtGui/QDesktopServices> + +namespace Welcome { +namespace Internal { + +CommunityWelcomePageWidget::CommunityWelcomePageWidget(QWidget *parent) : + QWidget(parent), + ui(new Ui::CommunityWelcomePageWidget), + m_rssFetcher(new RSSFetcher(7)) +{ + ui->setupUi(this); + ui->labsTitleLabel->setStyledText(tr("News From the Qt Labs")); + ui->sitesTitleLabel->setStyledText(tr("Qt Websites")); + + connect(ui->newsTreeWidget, SIGNAL(activated(QString)), SLOT(slotUrlClicked(QString))); + connect(ui->sitesTreeWidget, SIGNAL(activated(QString)), SLOT(slotUrlClicked(QString))); + + connect(m_rssFetcher, SIGNAL(newsItemReady(QString, QString, QString)), + ui->newsTreeWidget, SLOT(slotAddNewsItem(QString, QString, QString))); + //: Add localized feed here only if one exists + m_rssFetcher->fetch(QUrl(tr("http://labs.trolltech.com/blogs/feed"))); + + ui->sitesTreeWidget->addItem(tr("Qt Home"), QLatin1String("http://qtsoftware.com")); + ui->sitesTreeWidget->addItem(tr("Qt Labs"), QLatin1String("http://labs.trolltech.com")); + ui->sitesTreeWidget->addItem(tr("Qt Git Hosting"), QLatin1String("http://qt.gitorious.org")); + ui->sitesTreeWidget->addItem(tr("Qt Centre"), QLatin1String("http://www.qtcentre.org")); + ui->sitesTreeWidget->addItem(tr("Qt for S60 at Forum Nokia"), QLatin1String("http://discussion.forum.nokia.com/forum/forumdisplay.php?f=196")); +} + +CommunityWelcomePageWidget::~CommunityWelcomePageWidget() +{ + delete m_rssFetcher; + delete ui; +} + + +void CommunityWelcomePageWidget::slotUrlClicked(const QString &data) +{ + QDesktopServices::openUrl(QUrl(data)); +} + + + +} // namespace Internal +} // namespace Welcome diff --git a/src/plugins/welcome/communitywelcomepagewidget.h b/src/plugins/welcome/communitywelcomepagewidget.h new file mode 100644 index 0000000000..8da68feebf --- /dev/null +++ b/src/plugins/welcome/communitywelcomepagewidget.h @@ -0,0 +1,64 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://www.qtsoftware.com/contact. +** +**************************************************************************/ + +#ifndef COMMUNITYWELCOMEPAGEWIDGET_H +#define COMMUNITYWELCOMEPAGEWIDGET_H + +#include <QWidget> + +namespace Welcome { +namespace Internal { + +class RSSFetcher; + +namespace Ui { + class CommunityWelcomePageWidget; +} + +class CommunityWelcomePageWidget : public QWidget +{ + Q_OBJECT + +public: + CommunityWelcomePageWidget(QWidget *parent = 0); + ~CommunityWelcomePageWidget(); + +private slots: + void slotUrlClicked(const QString &data); + + +private: + RSSFetcher *m_rssFetcher; + Ui::CommunityWelcomePageWidget *ui; +}; + + +} // namespace Internal +} // namespace Welcome +#endif // COMMUNITYWELCOMEPAGEWIDGET_H diff --git a/src/plugins/welcome/communitywelcomepagewidget.ui b/src/plugins/welcome/communitywelcomepagewidget.ui new file mode 100644 index 0000000000..7d05f30d70 --- /dev/null +++ b/src/plugins/welcome/communitywelcomepagewidget.ui @@ -0,0 +1,195 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>Welcome::Internal::CommunityWelcomePageWidget</class> + <widget class="QWidget" name="Welcome::Internal::CommunityWelcomePageWidget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>667</width> + <height>352</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QFrame" name="labsFrame"> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Plain</enum> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <widget class="Core::Utils::WelcomeModeLabel" name="labsTitleLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + </widget> + </item> + <item> + <widget class="Core::Utils::WelcomeModeTreeWidget" name="newsTreeWidget"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>340</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> + </widget> + </item> + <item> + <widget class="QFrame" name="sitesFrame"> + <property name="frameShape"> + <enum>QFrame::NoFrame</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Plain</enum> + </property> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <widget class="Core::Utils::WelcomeModeLabel" name="sitesTitleLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + </widget> + </item> + <item> + <widget class="Core::Utils::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> + </widget> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>Core::Utils::WelcomeModeTreeWidget</class> + <extends>QTreeWidget</extends> + <header>utils/welcomemodetreewidget.h</header> + </customwidget> + <customwidget> + <class>Core::Utils::WelcomeModeLabel</class> + <extends>QLabel</extends> + <header>utils/welcomemodetreewidget.h</header> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> diff --git a/src/plugins/welcome/rssfetcher.cpp b/src/plugins/welcome/rssfetcher.cpp index f5fc756c9b..7254c2d00b 100644 --- a/src/plugins/welcome/rssfetcher.cpp +++ b/src/plugins/welcome/rssfetcher.cpp @@ -43,7 +43,7 @@ #include <sys/utsname.h> #endif -using namespace Welcome; +using namespace Welcome::Internal; static const QString getOsString() { diff --git a/src/plugins/welcome/rssfetcher.h b/src/plugins/welcome/rssfetcher.h index 9267fdb47a..54ef87d7b6 100644 --- a/src/plugins/welcome/rssfetcher.h +++ b/src/plugins/welcome/rssfetcher.h @@ -35,6 +35,7 @@ #include <QtNetwork/QHttp> namespace Welcome { +namespace Internal { class RSSFetcher : public QObject { @@ -69,6 +70,7 @@ private: }; } // namespace Welcome +} // namespace Internal #endif // RSSFETCHER_H diff --git a/src/plugins/welcome/welcome.pro b/src/plugins/welcome/welcome.pro index 11d48e82bc..0ad5a509ab 100644 --- a/src/plugins/welcome/welcome.pro +++ b/src/plugins/welcome/welcome.pro @@ -5,11 +5,17 @@ include(../../qtcreatorplugin.pri) include(../../plugins/coreplugin/coreplugin.pri) HEADERS += welcomeplugin.h \ welcomemode.h \ - rssfetcher.h + rssfetcher.h \ + communitywelcomepagewidget.h \ + communitywelcomepage.h SOURCES += welcomeplugin.cpp \ welcomemode.cpp \ - rssfetcher.cpp -FORMS += welcomemode.ui + rssfetcher.cpp \ + communitywelcomepagewidget.cpp \ + communitywelcomepage.cpp \ + communitywelcomepage.cpp +FORMS += welcomemode.ui \ + communitywelcomepagewidget.ui RESOURCES += welcome.qrc DEFINES += WELCOME_LIBRARY OTHER_FILES += Welcome.pluginspec diff --git a/src/plugins/welcome/welcomemode.cpp b/src/plugins/welcome/welcomemode.cpp index bc6a876828..6e973eb59d 100644 --- a/src/plugins/welcome/welcomemode.cpp +++ b/src/plugins/welcome/welcomemode.cpp @@ -28,11 +28,10 @@ **************************************************************************/ #include "welcomemode.h" -#include "rssfetcher.h" +#include <extensionsystem/pluginmanager.h> +#include <extensionsystem/iwelcomepage.h> #include <coreplugin/icore.h> -#include <coreplugin/dialogs/iwizard.h> - #include <coreplugin/coreconstants.h> #include <coreplugin/uniqueidmanager.h> #include <coreplugin/modemanager.h> @@ -41,22 +40,22 @@ #include <utils/styledbar.h> #include <utils/welcomemodetreewidget.h> -#include <QtGui/QDesktopServices> #include <QtGui/QMouseEvent> #include <QtGui/QScrollArea> #include <QtGui/QButtonGroup> +#include <QtGui/QDesktopServices> +#include <QtGui/QToolButton> -#include <QtCore/QDateTime> -#include <QtCore/QDir> -#include <QtCore/QFileInfo> -#include <QtCore/QDebug> -#include <QtCore/QUrl> #include <QtCore/QSettings> +#include <QtCore/QUrl> +#include <QtCore/QDebug> #include <cstdlib> #include "ui_welcomemode.h" +using namespace ExtensionSystem; + namespace Welcome { struct WelcomeModePrivate @@ -66,10 +65,9 @@ struct WelcomeModePrivate QScrollArea *m_scrollArea; QWidget *m_widget; QWidget *m_welcomePage; - QButtonGroup *btnGrp; - Ui::WelcomePage ui; - RSSFetcher *rssFetcher; - WelcomeMode::WelcomePageData lastData; + QMap<QAbstractButton*, QWidget*> buttonMap; + QHBoxLayout * buttonLayout; + Ui::WelcomeMode ui; int currentTip; }; @@ -77,46 +75,6 @@ WelcomeModePrivate::WelcomeModePrivate() { } -// --- WelcomePageData - -bool WelcomeMode::WelcomePageData::operator==(const WelcomePageData &rhs) const -{ - return previousSession == rhs.previousSession - && activeSession == rhs.activeSession - && sessionList == rhs.sessionList - && projectList == rhs.projectList; -} - -bool WelcomeMode::WelcomePageData::operator!=(const WelcomePageData &rhs) const -{ - return previousSession != rhs.previousSession - || activeSession != rhs.activeSession - || sessionList != rhs.sessionList - || projectList != rhs.projectList; -} - -QDebug operator<<(QDebug dgb, const WelcomeMode::WelcomePageData &d) -{ - dgb.nospace() << "PreviousSession=" << d.previousSession - << " activeSession=" << d.activeSession - << " sessionList=" << d.sessionList - << " projectList=" << d.projectList; - return dgb; -} - -// Format a title + ruler for title labels -static inline QString titleLabel(const QString &text) -{ - QString rc = QLatin1String( - "<html><head><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;\">"); - rc += text; - rc += QLatin1String("</span></p><hr/></body></html>"); - return rc; -} - // --- WelcomeMode WelcomeMode::WelcomeMode() : m_d(new WelcomeModePrivate) @@ -126,22 +84,8 @@ WelcomeMode::WelcomeMode() : l->setMargin(0); l->setSpacing(0); l->addWidget(new Core::Utils::StyledBar(m_d->m_widget)); - m_d->rssFetcher = new RSSFetcher(7, this); m_d->m_welcomePage = new QWidget(m_d->m_widget); m_d->ui.setupUi(m_d->m_welcomePage); - m_d->ui.projTitleLabel->setText(titleLabel(tr("Open Recent Project"))); - m_d->ui.recentSessionsTitleLabel->setText(titleLabel(tr("Resume Session"))); - m_d->ui.tutorialsTitleLabel->setText(titleLabel(tr("Tutorials"))); - m_d->ui.demoTitleLabel->setText(titleLabel(tr("Explore Qt Examples"))); - m_d->ui.didYouKnowTitleLabel->setText(titleLabel(tr("Did You Know?"))); - m_d->ui.labsTitleLabel->setText(titleLabel(tr("News From the Qt Labs"))); - m_d->ui.sitesTitleLabel->setText(titleLabel(tr("Qt Websites"))); - 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); - m_d->ui.didYouKnowTextBrowser->viewport()->setAutoFillBackground(false); m_d->ui.helpUsLabel->setAttribute(Qt::WA_LayoutUsesWidgetRect); m_d->ui.feedbackButton->setAttribute(Qt::WA_LayoutUsesWidgetRect); l->addWidget(m_d->m_welcomePage); @@ -151,71 +95,17 @@ WelcomeMode::WelcomeMode() : m_d->m_scrollArea->setWidget(m_d->m_widget); m_d->m_scrollArea->setWidgetResizable(true); - updateWelcomePage(WelcomePageData()); - - m_d->btnGrp = new QButtonGroup(this); - m_d->btnGrp->addButton(m_d->ui.gettingStartedSectButton, 0); - m_d->btnGrp->addButton(m_d->ui.developSectButton, 1); - m_d->btnGrp->addButton(m_d->ui.communitySectButton, 2); - - connect(m_d->btnGrp, SIGNAL(buttonClicked(int)), m_d->ui.stackedWidget, SLOT(setCurrentIndex(int))); + PluginManager *pluginManager = PluginManager::instance(); + connect(pluginManager, SIGNAL(objectAdded(QObject*)), SLOT(welcomePluginAdded(QObject*))); connect(m_d->ui.feedbackButton, SIGNAL(clicked()), SLOT(slotFeedback())); - connect(m_d->ui.manageSessionsButton, SIGNAL(clicked()), SIGNAL(manageSessions())); - connect(m_d->ui.createNewProjectButton, SIGNAL(clicked()), SLOT(slotCreateNewProject())); - 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->ui.tutorialTreeWidget, SIGNAL(activated(QString)), SIGNAL(openHelpPage(const QString&))); - connect(m_d->ui.openExampleButton, SIGNAL(clicked()), SLOT(slotOpenExample())); - connect(m_d->ui.examplesComboBox, SIGNAL(currentIndexChanged(int)), SLOT(slotEnableExampleButton(int))); - - connect(m_d->rssFetcher, SIGNAL(newsItemReady(QString, QString, QString)), - m_d->ui.newsTreeWidget, SLOT(slotAddNewsItem(QString, 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 Home"), QLatin1String("http://qtsoftware.com")); - m_d->ui.sitesTreeWidget->addItem(tr("Qt Labs"), QLatin1String("http://labs.trolltech.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 for S60 at Forum Nokia"), QLatin1String("http://discussion.forum.nokia.com/forum/forumdisplay.php?f=196")); - - m_d->ui.tutorialTreeWidget->addItem(tr("<b>Qt Creator - A quick tour</b>"), - QString("qthelp://com.nokia.qtcreator.%1%2/doc/index.html").arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR)); - m_d->ui.tutorialTreeWidget->addItem(tr("Creating an address book"), - QLatin1String("qthelp://com.nokia.qtcreator/doc/tutorials-addressbook-sdk.html")); - m_d->ui.tutorialTreeWidget->addItem(tr("Understanding widgets"), - QLatin1String("qthelp://com.trolltech.qt/qdoc/widgets-tutorial.html")); - m_d->ui.tutorialTreeWidget->addItem(tr("Building with qmake"), - QLatin1String("qthelp://com.trolltech.qmake/qdoc/qmake-tutorial.html")); - m_d->ui.tutorialTreeWidget->addItem(tr("Writing test cases"), - QLatin1String("qthelp://com.trolltech.qt/qdoc/qtestlib-tutorial.html")); - - srand(QDateTime::currentDateTime().toTime_t()); - QStringList tips = tipsOfTheDay(); - m_d->currentTip = rand()%tips.count(); - - QTextDocument *doc = m_d->ui.didYouKnowTextBrowser->document(); - doc->setDefaultStyleSheet("a:link {color:black;}"); - m_d->ui.didYouKnowTextBrowser->setDocument(doc); - m_d->ui.didYouKnowTextBrowser->setText(tips.at(m_d->currentTip)); - - connect(m_d->ui.nextTipBtn, SIGNAL(clicked()), this, SLOT(slotNextTip())); - connect(m_d->ui.prevTipBtn, SIGNAL(clicked()), this, SLOT(slotPrevTip())); - QSettings *settings = Core::ICore::instance()->settings(); - int id = settings->value("General/WelcomeTab", 0).toInt(); - m_d->btnGrp->button(id)->setChecked(true); - m_d->ui.stackedWidget->setCurrentIndex(id); } WelcomeMode::~WelcomeMode() { QSettings *settings = Core::ICore::instance()->settings(); - settings->setValue("General/WelcomeTab", m_d->btnGrp->checkedId()); + settings->setValue("General/WelcomeTab", m_d->ui.stackedWidget->currentIndex()); delete m_d->m_widget; delete m_d; } @@ -252,150 +142,78 @@ QList<int> WelcomeMode::context() const return contexts; } -void WelcomeMode::updateWelcomePage(const WelcomePageData &welcomePageData) -{ - // Update only if data are modified - if (welcomePageData == m_d->lastData) - return; - m_d->lastData = welcomePageData; - - m_d->m_widget->setUpdatesEnabled(false); - m_d->ui.sessTreeWidget->clear(); - m_d->ui.projTreeWidget->clear(); - - if (welcomePageData.sessionList.count() > 0) { - foreach (const QString &s, welcomePageData.sessionList) { - QString str = s; - if (s == welcomePageData.previousSession) - str = tr("%1 (last session)").arg(s); - m_d->ui.sessTreeWidget->addItem(str, s); - } - m_d->ui.sessTreeWidget->updateGeometry(); - m_d->ui.sessTreeWidget->show(); - } else { - m_d->ui.sessTreeWidget->hide(); - } - - typedef QPair<QString, QString> QStringPair; - if (welcomePageData.projectList.count() > 0) { - foreach (const QStringPair &it, welcomePageData.projectList) { - QTreeWidgetItem *item = m_d->ui.projTreeWidget->addItem(it.second, it.first); - const QFileInfo fi(it.first); - item->setToolTip(1, QDir::toNativeSeparators(fi.absolutePath())); - } - } else { - m_d->ui.projTreeWidget->hide(); - } - m_d->ui.projTreeWidget->updateGeometry(); - m_d->m_widget->setUpdatesEnabled(true); -} - -void WelcomeMode::activateEditMode() -{ - Core::ModeManager *modeManager = Core::ModeManager::instance(); - if (modeManager->currentMode() == this) - modeManager->activateMode(Core::Constants::MODE_EDIT); -} - -void WelcomeMode::slotSessionClicked(const QString &data) -{ - emit requestSession(data); - activateEditMode(); -} - -void WelcomeMode::slotProjectClicked(const QString &data) +bool sortFunction(IWelcomePage * a, IWelcomePage *b) { - emit requestProject(data); - activateEditMode(); + return a->priority() < b->priority(); } -void WelcomeMode::slotUrlClicked(const QString &data) +void WelcomeMode::initPlugins() { - QDesktopServices::openUrl(QUrl(data)); -} - -void WelcomeMode::updateExamples(const QString& examplePath, const QString& demosPath, const QString &sourcePath) -{ - QString demoxml = demosPath + "/qtdemo/xml/examples.xml"; - if (!QFile::exists(demoxml)) { - demoxml = sourcePath + "/demos/qtdemo/xml/examples.xml"; - if (!QFile::exists(demoxml)) - return; + m_d->buttonLayout = new QHBoxLayout(m_d->ui.navFrame); + m_d->buttonLayout->setMargin(0); + m_d->buttonLayout->setSpacing(0); + delete m_d->ui.stackedWidget->currentWidget(); + QList<IWelcomePage*> plugins = PluginManager::instance()->getObjects<IWelcomePage>(); + qSort(plugins.begin(), plugins.end(), &sortFunction); + foreach (IWelcomePage* plugin, plugins) { + QToolButton * btn = new QToolButton; + btn->setCheckable(true); + btn->setText(plugin->title()); + btn->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + btn->setAutoExclusive(true); + connect (btn, SIGNAL(clicked()), SLOT(showClickedPage())); + m_d->ui.stackedWidget->addWidget(plugin->page()); + m_d->buttonLayout->addWidget(btn); + m_d->buttonMap.insert(btn, plugin->page()); } + m_d->buttonLayout->addSpacing(5); - QFile description(demoxml); - if (!description.open(QFile::ReadOnly)) - return; - - m_d->ui.examplesComboBox->clear(); - m_d->ui.examplesComboBox->setEnabled(true); - - m_d->ui.examplesComboBox->addItem(tr("Choose an example...")); - QFont f = widget()->font(); - f.setItalic(true); - m_d->ui.examplesComboBox->setItemData(0, f, Qt::FontRole); - f.setItalic(false); - bool inExamples = false; - QString dirName; - QXmlStreamReader reader(&description); - while (!reader.atEnd()) { - switch (reader.readNext()) { - case QXmlStreamReader::StartElement: - if (reader.name() == "category") { - QString name = reader.attributes().value(QLatin1String("name")).toString(); - if (name.contains("tutorial")) - break; - dirName = reader.attributes().value(QLatin1String("dirname")).toString(); - m_d->ui.examplesComboBox->addItem(name); - f.setBold(true); - m_d->ui.examplesComboBox->setItemData(m_d->ui.examplesComboBox->count()-1, f, Qt::FontRole); - f.setBold(false); - inExamples = true; - } - if (inExamples && reader.name() == "example") { - QString name = reader.attributes().value(QLatin1String("name")).toString(); - QString fn = reader.attributes().value(QLatin1String("filename")).toString(); - QString relativeProPath = '/' + dirName + '/' + fn + '/' + fn + ".pro"; - QString fileName = examplePath + relativeProPath; - if (!QFile::exists(fileName)) - fileName = sourcePath + "/examples" + relativeProPath; - QString helpPath = "qthelp://com.trolltech.qt/qdoc/" + dirName.replace("/", "-") + "-" + fn + ".html"; - - m_d->ui.examplesComboBox->addItem(" " + name, fileName); - m_d->ui.examplesComboBox->setItemData(m_d->ui.examplesComboBox->count()-1, helpPath, Qt::UserRole+1); + QSettings *settings = Core::ICore::instance()->settings(); + int tabId = settings->value("General/WelcomeTab", 0).toInt(); + + int pluginCount = m_d->ui.stackedWidget->count(); + if (tabId < pluginCount) { + m_d->ui.stackedWidget->setCurrentIndex(tabId); + QMapIterator<QAbstractButton*, QWidget*> it(m_d->buttonMap); + while (it.hasNext()) + if (it.next().value() == m_d->ui.stackedWidget->currentWidget()) { + it.key()->setChecked(true); + break; } - break; - case QXmlStreamReader::EndElement: - if (reader.name() == "category") - inExamples = false; - break; - default: - break; - } } + } -void WelcomeMode::slotEnableExampleButton(int index) -{ - QString fileName = m_d->ui.examplesComboBox->itemData(index, Qt::UserRole).toString(); - m_d->ui.openExampleButton->setEnabled(!fileName.isEmpty()); +void WelcomeMode::welcomePluginAdded(QObject *obj) +{ + if (IWelcomePage *plugin = qobject_cast<IWelcomePage*>(obj)) + { + QToolButton * btn = new QToolButton; + btn->setCheckable(true); + btn->setAutoExclusive(true); + btn->setText(plugin->title()); + btn->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + connect (btn, SIGNAL(clicked()), SLOT(showClickedPage())); + int insertPos = 0; + QList<IWelcomePage*> plugins = PluginManager::instance()->getObjects<IWelcomePage>(); + foreach (IWelcomePage* p, plugins) { + if (plugin->priority() < p->priority()) + insertPos++; + else + break; + } + m_d->ui.stackedWidget->insertWidget(insertPos, plugin->page()); + m_d->buttonMap.insert(btn, plugin->page()); + m_d->buttonLayout->insertWidget(insertPos, btn); + } } -void WelcomeMode::slotOpenExample() +void WelcomeMode::showClickedPage() { - QComboBox *box = m_d->ui.examplesComboBox; - QString proFile = box->itemData(box->currentIndex(), Qt::UserRole).toString(); - QString helpFile = box->itemData(box->currentIndex(), Qt::UserRole + 1).toString(); - QStringList files; - QFileInfo fi(proFile); - QString tryFile = fi.path() + "/main.cpp"; - files << proFile; - if(!QFile::exists(tryFile)) - tryFile = fi.path() + '/' + fi.baseName() + ".cpp"; - if(QFile::exists(tryFile)) - files << tryFile; - Core::ICore::instance()->openFiles(files); - emit openContextHelpPage(helpFile); + QAbstractButton *btn = qobject_cast<QAbstractButton*>(sender()); + QMap<QAbstractButton*, QWidget*>::iterator it = m_d->buttonMap.find(btn); + if (it.value()) + m_d->ui.stackedWidget->setCurrentWidget(it.value()); } void WelcomeMode::slotFeedback() @@ -404,71 +222,5 @@ void WelcomeMode::slotFeedback() "http://qtsoftware.com/forms/feedback-forms/qt-creator-user-feedback/view"))); } -void WelcomeMode::slotCreateNewProject() -{ - Core::ICore::instance()->showNewItemDialog(tr("New Project..."), - Core::IWizard::wizardsOfKind(Core::IWizard::ProjectWizard)); -} - -void WelcomeMode::slotNextTip() -{ - QStringList tips = tipsOfTheDay(); - m_d->currentTip = ((m_d->currentTip+1)%tips.count()); - m_d->ui.didYouKnowTextBrowser->setText(tips.at(m_d->currentTip)); -} - -void WelcomeMode::slotPrevTip() -{ - QStringList tips = tipsOfTheDay(); - m_d->currentTip = ((m_d->currentTip-1)+tips.count())%tips.count(); - m_d->ui.didYouKnowTextBrowser->setText(tips.at(m_d->currentTip)); -} - -QStringList WelcomeMode::tipsOfTheDay() -{ - static QStringList tips; - if (tips.isEmpty()) { - QString altShortcut = -#ifdef Q_WS_MAC - tr("Cmd", "Shortcut key"); -#else - tr("Alt", "Shortcut key"); -#endif - tips.append(tr("You can switch between Qt Creator's modes using <tt>Ctrl+number</tt>:<ul>" - "<li>1 - Welcome</li><li>2 - Edit</li><li>3 - Debug</li><li>4 - Projects</li><li>5 - Help</li>" - "<li></li><li>6 - Output</li></ul>")); - //:%1 gets replaced by Alt (Win/Unix) or Cmd (Mac) - tips.append(tr("You can show and hide the side bar using <tt>%1+0<tt>.").arg(altShortcut)); - tips.append(tr("You can fine tune the <tt>Find</tt> function by selecting "Whole Words" " - "or "Case Sensitive". Simply click on the icons on the right end of the line edit.")); - tips.append(tr("If you add <a href=\"qthelp://com.nokia.qtcreator/doc/creator-external-library-handling.html\"" - ">external libraries</a>, Qt Creator will automatically offer syntax highlighting " - "and code completion.")); - tips.append(tr("The code completion is CamelCase-aware. For example, to complete <tt>namespaceUri</tt> " - "you can just type <tt>nU</tt> and hit <tt>Ctrl+Space</tt>.")); - tips.append(tr("You can force code completion at any time using <tt>Ctrl+Space</tt>.")); - tips.append(tr("You can start Qt Creator with a session by calling <tt>qtcreator <sessionname></tt>.")); - tips.append(tr("You can return to edit mode from any other mode at any time by hitting <tt>Escape</tt>.")); - //:%1 gets replaced by Alt (Win/Unix) or Cmd (Mac) - tips.append(tr("You can switch between the output pane by hitting <tt>%1+n</tt> where n is the number denoted " - "on the buttons at the window bottom:" - "<ul><li>1 - Build Issues</li><li>2 - Search Results</li><li>3 - Application Output</li>" - "<li>4 - Compile Output</li></ul>").arg(altShortcut)); - tips.append(tr("You can quickly search methods, classes, help and more using the " - "<a href=\"qthelp://com.nokia.qtcreator/doc/creator-navigation.html\">Locator bar</a> (<tt>Ctrl+K</tt>).")); - tips.append(tr("You can add custom build steps in the " - "<a href=\"qthelp://com.nokia.qtcreator/doc/creator-build-settings.html\">build settings</a>.")); - tips.append(tr("Within a session, you can add " - "<a href=\"qthelp://com.nokia.qtcreator/doc/creator-build-settings.html#dependencies\">dependencies</a> between projects.")); - tips.append(tr("You can set the preferred editor encoding for every project in <tt>Projects -> Editor Settings -> Default Encoding</tt>.")); - tips.append(tr("You can modify the binary that is being executed when you press the <tt>Run</tt> button: Add a <tt>Custom Executable</tt> " - "by clicking the <tt>+</tt> button in <tt>Projects -> Run Settings -> Run Configuration</tt> and then select the new " - "target in the combo box.")); - tips.append(tr("You can use Qt Creator with a number of <a href=\"qthelp://com.nokia.qtcreator/doc/creator-version-control.html\">" - "revision control systems</a> such as Subversion, Perforce and Git.")); - tips.append(tr("In the editor, <tt>F2</tt> toggles declaration and definition while <tt>F4</tt> toggles header file and source file.")); - } - return tips; -} } // namespace Welcome diff --git a/src/plugins/welcome/welcomemode.h b/src/plugins/welcome/welcomemode.h index 0555ce60f3..1576d2489b 100644 --- a/src/plugins/welcome/welcomemode.h +++ b/src/plugins/welcome/welcomemode.h @@ -54,18 +54,6 @@ public: WelcomeMode(); ~WelcomeMode(); - struct WelcomePageData{ - bool operator==(const WelcomePageData &rhs) const; - bool operator!=(const WelcomePageData &rhs) const; - - QString previousSession; - QString activeSession; - QStringList sessionList; - QList<QPair<QString, QString> > projectList; // pair of filename, displayname - }; - - void updateWelcomePage(const WelcomePageData &welcomePageData); - // IMode QString name() const; QIcon icon() const; @@ -75,31 +63,14 @@ public: QList<int> context() const; void activated(); QString contextHelpId() const { return QLatin1String("Qt Creator"); } - - void updateExamples(const QString& examplePath, const QString& demosPath, const QString &sourcePath); - -signals: - void requestProject(const QString &project); - void requestSession(const QString &session); - void openHelpPage(const QString& url); - void openContextHelpPage(const QString& url); - void manageSessions(); + void initPlugins(); private slots: void slotFeedback(); - void slotSessionClicked(const QString &data); - void slotProjectClicked(const QString &data); - void slotUrlClicked(const QString &data); - void slotEnableExampleButton(int); - void slotOpenExample(); - void slotCreateNewProject(); - void slotNextTip(); - void slotPrevTip(); + void welcomePluginAdded(QObject*); + void showClickedPage(); private: - void activateEditMode(); - QStringList tipsOfTheDay(); - WelcomeModePrivate *m_d; }; diff --git a/src/plugins/welcome/welcomemode.ui b/src/plugins/welcome/welcomemode.ui index c70aabbafa..e1c18bde91 100644 --- a/src/plugins/welcome/welcomemode.ui +++ b/src/plugins/welcome/welcomemode.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>Welcome::WelcomePage</class> - <widget class="QWidget" name="Core::Utils::WelcomePage"> + <class>Welcome::WelcomeMode</class> + <widget class="QWidget" name="Welcome::WelcomeMode"> <property name="geometry"> <rect> <x>0</x> @@ -172,6 +172,12 @@ QToolButton:pressed, QPushButton:pressed{ <verstretch>0</verstretch> </sizepolicy> </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>10</height> + </size> + </property> <property name="font"> <font> <weight>50</weight> @@ -238,129 +244,6 @@ QToolButton:pressed { <property name="frameShadow"> <enum>QFrame::Plain</enum> </property> - <layout class="QGridLayout" name="gridLayout_2"> - <property name="margin"> - <number>0</number> - </property> - <property name="spacing"> - <number>0</number> - </property> - <item row="0" column="0"> - <widget class="QToolButton" name="gettingStartedSectButton"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="font"> - <font> - <pointsize>-1</pointsize> - </font> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="text"> - <string>Getting Started</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - <property name="checked"> - <bool>true</bool> - </property> - <property name="autoExclusive"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QToolButton" name="developSectButton"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="font"> - <font> - <pointsize>-1</pointsize> - </font> - </property> - <property name="text"> - <string>Develop</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - <property name="autoExclusive"> - <bool>false</bool> - </property> - </widget> - </item> - <item row="0" column="2"> - <widget class="QToolButton" name="communitySectButton"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>0</width> - <height>0</height> - </size> - </property> - <property name="font"> - <font> - <pointsize>-1</pointsize> - </font> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="text"> - <string>Community</string> - </property> - <property name="checkable"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="0" column="3"> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>5</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> </widget> </item> <item> @@ -368,575 +251,7 @@ QToolButton:pressed { <property name="currentIndex"> <number>0</number> </property> - <widget class="QWidget" name="gettingStartedPage"> - <layout class="QGridLayout" name="gridLayout_9"> - <property name="leftMargin"> - <number>18</number> - </property> - <property name="topMargin"> - <number>18</number> - </property> - <property name="rightMargin"> - <number>12</number> - </property> - <property name="bottomMargin"> - <number>18</number> - </property> - <property name="spacing"> - <number>24</number> - </property> - <item row="0" column="0" rowspan="2"> - <widget class="QFrame" name="tutorialsFrame"> - <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="tutorialsTitleLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="Core::Utils::WelcomeModeTreeWidget" name="tutorialTreeWidget"> - <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> - </widget> - </item> - <item row="0" column="1"> - <widget class="QFrame" name="demosExamplesFrame"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <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_8"> - <property name="rightMargin"> - <number>8</number> - </property> - <property name="horizontalSpacing"> - <number>0</number> - </property> - <item row="0" column="0" colspan="4"> - <widget class="QLabel" name="demoTitleLabel"> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QComboBox" name="examplesComboBox"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <item> - <property name="text"> - <string>Examples not installed</string> - </property> - </item> - </widget> - </item> - <item row="1" column="2"> - <widget class="QToolButton" name="openExampleButton"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Open</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>6</width> - <height>6</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - </item> - <item row="1" column="1"> - <widget class="QFrame" name="didyouKnowFrame"> - <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_11"> - <property name="rightMargin"> - <number>9</number> - </property> - <item row="0" column="0"> - <widget class="QLabel" name="didYouKnowTitleLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> - </property> - </widget> - </item> - <item row="1" column="0" colspan="2"> - <widget class="QTextBrowser" name="didYouKnowTextBrowser"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <property name="verticalScrollBarPolicy"> - <enum>Qt::ScrollBarAlwaysOff</enum> - </property> - <property name="horizontalScrollBarPolicy"> - <enum>Qt::ScrollBarAlwaysOff</enum> - </property> - <property name="openExternalLinks"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="0" column="1"> - <layout class="QGridLayout" name="gridLayout_10"> - <property name="spacing"> - <number>0</number> - </property> - <item row="0" column="0" colspan="2"> - <spacer name="verticalSpacer_4"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Preferred</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>2</height> - </size> - </property> - </spacer> - </item> - <item row="1" column="0"> - <widget class="QToolButton" name="prevTipBtn"> - <property name="styleSheet"> - <string notr="true">QToolButton{ - border-right:solid 0 px; - height:16px; - width:12px; -} -</string> - </property> - <property name="text"> - <string/> - </property> - <property name="icon"> - <iconset resource="welcome.qrc"> - <normaloff>:/welcome/images/arrow-left.png</normaloff>:/welcome/images/arrow-left.png</iconset> - </property> - <property name="arrowType"> - <enum>Qt::NoArrow</enum> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QToolButton" name="nextTipBtn"> - <property name="styleSheet"> - <string notr="true">QToolButton{ - border-left:solid 0 px; - height:16px; - width:12px; -} -</string> - </property> - <property name="text"> - <string/> - </property> - <property name="icon"> - <iconset resource="welcome.qrc"> - <normaloff>:/welcome/images/arrow-right.png</normaloff>:/welcome/images/arrow-right.png</iconset> - </property> - <property name="arrowType"> - <enum>Qt::NoArrow</enum> - </property> - </widget> - </item> - <item row="2" column="0" colspan="2"> - <spacer name="verticalSpacer_3"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>2</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="developPage"> - <layout class="QGridLayout" name="gridLayout_4"> - <property name="margin"> - <number>18</number> - </property> - <property name="spacing"> - <number>24</number> - </property> - <item row="0" column="0"> - <widget class="QFrame" name="recentSessionsFrame"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>270</width> - <height>130</height> - </size> - </property> - <property name="styleSheet"> - <string/> - </property> - <layout class="QGridLayout" name="gridLayout_3"> - <property name="horizontalSpacing"> - <number>0</number> - </property> - <property name="verticalSpacing"> - <number>3</number> - </property> - <item row="0" column="0" colspan="3"> - <widget class="QLabel" name="recentSessionsTitleLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> - </property> - </widget> - </item> - <item row="1" column="0" colspan="3"> - <widget class="Core::Utils::WelcomeModeTreeWidget" name="sessTreeWidget"> - <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> - <item row="3" column="0"> - <widget class="QPushButton" name="manageSessionsButton"> - <property name="focusPolicy"> - <enum>Qt::TabFocus</enum> - </property> - <property name="text"> - <string>Manage Sessions...</string> - </property> - </widget> - </item> - <item row="4" column="0"> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - </item> - <item row="0" column="2"> - <widget class="QFrame" name="recentProjectsFrame"> - <property name="styleSheet"> - <string/> - </property> - <layout class="QGridLayout" name="gridLayout_5"> - <property name="horizontalSpacing"> - <number>0</number> - </property> - <property name="verticalSpacing"> - <number>3</number> - </property> - <property name="rightMargin"> - <number>9</number> - </property> - <item row="0" column="0" colspan="3"> - <widget class="QLabel" name="projTitleLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> - </property> - </widget> - </item> - <item row="1" column="0" colspan="3"> - <widget class="Core::Utils::WelcomeModeTreeWidget" name="projTreeWidget"> - <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> - <item row="3" column="0"> - <widget class="QPushButton" name="createNewProjectButton"> - <property name="focusPolicy"> - <enum>Qt::TabFocus</enum> - </property> - <property name="text"> - <string>Create New Project...</string> - </property> - <property name="flat"> - <bool>true</bool> - </property> - </widget> - </item> - <item row="4" column="0"> - <spacer name="verticalSpacer_2"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> - </item> - </layout> - </widget> - <widget class="QWidget" name="communityPage"> + <widget class="QWidget" name="widget"> <layout class="QGridLayout" name="gridLayout_7"> <property name="margin"> <number>18</number> @@ -944,168 +259,6 @@ QToolButton:pressed { <property name="spacing"> <number>24</number> </property> - <item row="0" column="0"> - <widget class="QFrame" name="labsFrame"> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <item> - <widget class="QLabel" name="labsTitleLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> - </property> - </widget> - </item> - <item> - <widget class="Core::Utils::WelcomeModeTreeWidget" name="newsTreeWidget"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>340</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> - </widget> - </item> - <item row="0" column="1"> - <widget class="QFrame" name="sitesFrame"> - <property name="frameShape"> - <enum>QFrame::NoFrame</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Plain</enum> - </property> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <item> - <widget class="QLabel" name="sitesTitleLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Maximum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> - </property> - </widget> - </item> - <item> - <widget class="Core::Utils::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> - </widget> - </item> </layout> </widget> </widget> @@ -1219,13 +372,6 @@ QToolButton:pressed { </item> </layout> </widget> - <customwidgets> - <customwidget> - <class>Core::Utils::WelcomeModeTreeWidget</class> - <extends>QTreeWidget</extends> - <header>utils/welcomemodetreewidget.h</header> - </customwidget> - </customwidgets> <resources> <include location="welcome.qrc"/> </resources> diff --git a/src/plugins/welcome/welcomeplugin.cpp b/src/plugins/welcome/welcomeplugin.cpp index e9743a9428..e7906f14bc 100644 --- a/src/plugins/welcome/welcomeplugin.cpp +++ b/src/plugins/welcome/welcomeplugin.cpp @@ -31,6 +31,8 @@ #include "welcomemode.h" +#include "communitywelcomepage.h" + #include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/basemode.h> #include <coreplugin/coreconstants.h> @@ -45,11 +47,10 @@ #include <QtGui/QMessageBox> #include <QtGui/QPushButton> -using namespace Welcome; - +using namespace Welcome::Internal; WelcomePlugin::WelcomePlugin() - : m_welcomeMode(0) + : m_welcomeMode(0), m_communityWelcomePage(0) { } @@ -59,6 +60,10 @@ WelcomePlugin::~WelcomePlugin() removeObject(m_welcomeMode); delete m_welcomeMode; } + if (m_communityWelcomePage) { + removeObject(m_communityWelcomePage); + delete m_communityWelcomePage; + } } /*! Initializes the plugin. Returns true on success. @@ -72,6 +77,9 @@ bool WelcomePlugin::initialize(const QStringList &arguments, QString *error_mess Q_UNUSED(arguments) Q_UNUSED(error_message) + m_communityWelcomePage = new Internal::CommunityWelcomePage; + addObject(m_communityWelcomePage); + m_welcomeMode = new WelcomeMode; addObject(m_welcomeMode); @@ -91,6 +99,7 @@ bool WelcomePlugin::initialize(const QStringList &arguments, QString *error_mess */ void WelcomePlugin::extensionsInitialized() { + m_welcomeMode->initPlugins(); Core::ModeManager::instance()->activateMode(m_welcomeMode->uniqueModeName()); } diff --git a/src/plugins/welcome/welcomeplugin.h b/src/plugins/welcome/welcomeplugin.h index 970ec39950..54275b045c 100644 --- a/src/plugins/welcome/welcomeplugin.h +++ b/src/plugins/welcome/welcomeplugin.h @@ -36,6 +36,9 @@ namespace Welcome { class WelcomeMode; +namespace Internal { +class CommunityWelcomePage; + class WelcomePlugin : public ExtensionSystem::IPlugin { @@ -51,8 +54,10 @@ public: private: WelcomeMode *m_welcomeMode; + Internal::CommunityWelcomePage *m_communityWelcomePage; }; } // namespace Welcome +} // namespace Internal #endif // WELCOMEPLUGIN_H |