From f8f0c4ce44fe7558ecea67669de72981af03b822 Mon Sep 17 00:00:00 2001 From: Daniel Molkentin Date: Mon, 20 Jul 2009 19:08:09 +0200 Subject: Move Welcome Page to separate plugin. --- src/plugins/coreplugin/core.qrc | 19 - src/plugins/coreplugin/coreplugin.cpp | 11 +- src/plugins/coreplugin/coreplugin.h | 7 +- src/plugins/coreplugin/coreplugin.pro | 8 +- .../coreplugin/images/welcomemode/arrow-left.png | Bin 323 -> 0 bytes .../coreplugin/images/welcomemode/arrow-right.png | Bin 304 -> 0 bytes .../images/welcomemode/background_center_frame.png | Bin 3381 -> 0 bytes .../coreplugin/images/welcomemode/btn_26.png | Bin 477 -> 0 bytes .../coreplugin/images/welcomemode/btn_26_hover.png | Bin 430 -> 0 bytes .../images/welcomemode/btn_26_pressed.png | Bin 494 -> 0 bytes .../coreplugin/images/welcomemode/btn_27.png | Bin 629 -> 0 bytes .../coreplugin/images/welcomemode/btn_27_hover.png | Bin 697 -> 0 bytes .../images/welcomemode/center_frame_header.png | Bin 13335 -> 0 bytes .../images/welcomemode/combobox_arrow.png | Bin 333 -> 0 bytes .../images/welcomemode/feedback-bar-background.png | Bin 245 -> 0 bytes .../images/welcomemode/feedback_arrow.png | Bin 327 -> 0 bytes .../images/welcomemode/feedback_arrow_hover.png | Bin 328 -> 0 bytes .../images/welcomemode/list_bullet_arrow.png | Bin 280 -> 0 bytes .../coreplugin/images/welcomemode/mode_project.png | Bin 3838 -> 0 bytes .../coreplugin/images/welcomemode/nokia_logo.png | Bin 1148 -> 0 bytes .../coreplugin/images/welcomemode/product_logo.png | Bin 18498 -> 0 bytes .../coreplugin/images/welcomemode/qt_logo.png | Bin 2662 -> 0 bytes .../coreplugin/images/welcomemode/rc_combined.png | Bin 530 -> 0 bytes src/plugins/coreplugin/rssfetcher.cpp | 185 --- src/plugins/coreplugin/rssfetcher.h | 76 -- src/plugins/coreplugin/welcomemode.cpp | 571 --------- src/plugins/coreplugin/welcomemode.h | 108 -- src/plugins/coreplugin/welcomemode.ui | 1233 -------------------- src/plugins/coreplugin/welcomemode_p.h | 91 -- src/plugins/help/Help.pluginspec | 1 + src/plugins/help/help.pro | 1 + src/plugins/help/helpplugin.cpp | 6 +- src/plugins/plugins.pro | 6 +- .../projectexplorer/ProjectExplorer.pluginspec | 1 + src/plugins/projectexplorer/projectexplorer.cpp | 15 +- src/plugins/projectexplorer/projectexplorer.h | 11 +- .../projectexplorer_dependencies.pri | 1 + .../qt4projectmanager/Qt4ProjectManager.pluginspec | 1 + src/plugins/qt4projectmanager/qtversionmanager.cpp | 4 +- src/plugins/quickopen/quickopen.cp | 0 src/plugins/welcome/Welcome.pluginspec | 24 + src/plugins/welcome/images/arrow-left.png | Bin 0 -> 323 bytes src/plugins/welcome/images/arrow-right.png | Bin 0 -> 304 bytes .../welcome/images/background_center_frame.png | Bin 0 -> 3381 bytes src/plugins/welcome/images/btn_26.png | Bin 0 -> 477 bytes src/plugins/welcome/images/btn_26_hover.png | Bin 0 -> 430 bytes src/plugins/welcome/images/btn_26_pressed.png | Bin 0 -> 494 bytes src/plugins/welcome/images/btn_27.png | Bin 0 -> 629 bytes src/plugins/welcome/images/btn_27_hover.png | Bin 0 -> 697 bytes src/plugins/welcome/images/center_frame_header.png | Bin 0 -> 13335 bytes src/plugins/welcome/images/combobox_arrow.png | Bin 0 -> 333 bytes .../welcome/images/feedback-bar-background.png | Bin 0 -> 245 bytes src/plugins/welcome/images/feedback_arrow.png | Bin 0 -> 327 bytes .../welcome/images/feedback_arrow_hover.png | Bin 0 -> 328 bytes src/plugins/welcome/images/list_bullet_arrow.png | Bin 0 -> 280 bytes src/plugins/welcome/images/mode_project.png | Bin 0 -> 3838 bytes src/plugins/welcome/images/nokia_logo.png | Bin 0 -> 1148 bytes src/plugins/welcome/images/product_logo.png | Bin 0 -> 18498 bytes src/plugins/welcome/images/qt_logo.png | Bin 0 -> 2662 bytes src/plugins/welcome/images/rc_combined.png | Bin 0 -> 530 bytes src/plugins/welcome/rssfetcher.cpp | 185 +++ src/plugins/welcome/rssfetcher.h | 74 ++ src/plugins/welcome/welcome.pri | 2 + src/plugins/welcome/welcome.pro | 22 + src/plugins/welcome/welcome.qrc | 23 + src/plugins/welcome/welcome_global.h | 12 + src/plugins/welcome/welcomemode.cpp | 571 +++++++++ src/plugins/welcome/welcomemode.h | 108 ++ src/plugins/welcome/welcomemode.ui | 1233 ++++++++++++++++++++ src/plugins/welcome/welcomemode_p.h | 89 ++ src/plugins/welcome/welcomeplugin.cpp | 97 ++ src/plugins/welcome/welcomeplugin.h | 58 + 72 files changed, 2533 insertions(+), 2321 deletions(-) delete mode 100644 src/plugins/coreplugin/images/welcomemode/arrow-left.png delete mode 100644 src/plugins/coreplugin/images/welcomemode/arrow-right.png delete mode 100644 src/plugins/coreplugin/images/welcomemode/background_center_frame.png delete mode 100644 src/plugins/coreplugin/images/welcomemode/btn_26.png delete mode 100644 src/plugins/coreplugin/images/welcomemode/btn_26_hover.png delete mode 100644 src/plugins/coreplugin/images/welcomemode/btn_26_pressed.png delete mode 100644 src/plugins/coreplugin/images/welcomemode/btn_27.png delete mode 100644 src/plugins/coreplugin/images/welcomemode/btn_27_hover.png delete mode 100644 src/plugins/coreplugin/images/welcomemode/center_frame_header.png delete mode 100644 src/plugins/coreplugin/images/welcomemode/combobox_arrow.png delete mode 100644 src/plugins/coreplugin/images/welcomemode/feedback-bar-background.png delete mode 100644 src/plugins/coreplugin/images/welcomemode/feedback_arrow.png delete mode 100644 src/plugins/coreplugin/images/welcomemode/feedback_arrow_hover.png delete mode 100644 src/plugins/coreplugin/images/welcomemode/list_bullet_arrow.png delete mode 100644 src/plugins/coreplugin/images/welcomemode/mode_project.png delete mode 100644 src/plugins/coreplugin/images/welcomemode/nokia_logo.png delete mode 100644 src/plugins/coreplugin/images/welcomemode/product_logo.png delete mode 100644 src/plugins/coreplugin/images/welcomemode/qt_logo.png delete mode 100644 src/plugins/coreplugin/images/welcomemode/rc_combined.png delete mode 100644 src/plugins/coreplugin/rssfetcher.cpp delete mode 100644 src/plugins/coreplugin/rssfetcher.h delete mode 100644 src/plugins/coreplugin/welcomemode.cpp delete mode 100644 src/plugins/coreplugin/welcomemode.h delete mode 100644 src/plugins/coreplugin/welcomemode.ui delete mode 100644 src/plugins/coreplugin/welcomemode_p.h create mode 100644 src/plugins/quickopen/quickopen.cp create mode 100644 src/plugins/welcome/Welcome.pluginspec create mode 100644 src/plugins/welcome/images/arrow-left.png create mode 100644 src/plugins/welcome/images/arrow-right.png create mode 100644 src/plugins/welcome/images/background_center_frame.png create mode 100644 src/plugins/welcome/images/btn_26.png create mode 100644 src/plugins/welcome/images/btn_26_hover.png create mode 100644 src/plugins/welcome/images/btn_26_pressed.png create mode 100644 src/plugins/welcome/images/btn_27.png create mode 100644 src/plugins/welcome/images/btn_27_hover.png create mode 100644 src/plugins/welcome/images/center_frame_header.png create mode 100644 src/plugins/welcome/images/combobox_arrow.png create mode 100644 src/plugins/welcome/images/feedback-bar-background.png create mode 100644 src/plugins/welcome/images/feedback_arrow.png create mode 100644 src/plugins/welcome/images/feedback_arrow_hover.png create mode 100644 src/plugins/welcome/images/list_bullet_arrow.png create mode 100644 src/plugins/welcome/images/mode_project.png create mode 100644 src/plugins/welcome/images/nokia_logo.png create mode 100644 src/plugins/welcome/images/product_logo.png create mode 100644 src/plugins/welcome/images/qt_logo.png create mode 100644 src/plugins/welcome/images/rc_combined.png create mode 100644 src/plugins/welcome/rssfetcher.cpp create mode 100644 src/plugins/welcome/rssfetcher.h create mode 100644 src/plugins/welcome/welcome.pri create mode 100644 src/plugins/welcome/welcome.pro create mode 100644 src/plugins/welcome/welcome.qrc create mode 100644 src/plugins/welcome/welcome_global.h create mode 100644 src/plugins/welcome/welcomemode.cpp create mode 100644 src/plugins/welcome/welcomemode.h create mode 100644 src/plugins/welcome/welcomemode.ui create mode 100644 src/plugins/welcome/welcomemode_p.h create mode 100644 src/plugins/welcome/welcomeplugin.cpp create mode 100644 src/plugins/welcome/welcomeplugin.h (limited to 'src') diff --git a/src/plugins/coreplugin/core.qrc b/src/plugins/coreplugin/core.qrc index 202ee41db4..42f59f6c1e 100644 --- a/src/plugins/coreplugin/core.qrc +++ b/src/plugins/coreplugin/core.qrc @@ -44,24 +44,5 @@ images/unlocked.png images/extension.png images/darkclosebutton.png - images/welcomemode/btn_26.png - images/welcomemode/btn_26_hover.png - images/welcomemode/btn_27.png - images/welcomemode/btn_27_hover.png - images/welcomemode/feedback_arrow.png - images/welcomemode/feedback_arrow_hover.png - images/welcomemode/feedback-bar-background.png - images/welcomemode/list_bullet_arrow.png - images/welcomemode/mode_project.png - images/welcomemode/nokia_logo.png - images/welcomemode/product_logo.png - images/welcomemode/qt_logo.png - images/welcomemode/rc_combined.png - images/welcomemode/background_center_frame.png - images/welcomemode/center_frame_header.png - images/welcomemode/btn_26_pressed.png - images/welcomemode/combobox_arrow.png - images/welcomemode/arrow-left.png - images/welcomemode/arrow-right.png diff --git a/src/plugins/coreplugin/coreplugin.cpp b/src/plugins/coreplugin/coreplugin.cpp index a7a619b768..7fb7d71c24 100644 --- a/src/plugins/coreplugin/coreplugin.cpp +++ b/src/plugins/coreplugin/coreplugin.cpp @@ -28,7 +28,6 @@ **************************************************************************/ #include "coreplugin.h" -#include "welcomemode.h" #include "editmode.h" #include "editormanager.h" #include "mainwindow.h" @@ -42,16 +41,12 @@ using namespace Core::Internal; CorePlugin::CorePlugin() : - m_mainWindow(new MainWindow), m_welcomeMode(0), m_editMode(0) + m_mainWindow(new MainWindow), m_editMode(0) { } CorePlugin::~CorePlugin() { - if (m_welcomeMode) { - removeObject(m_welcomeMode); - delete m_welcomeMode; - } if (m_editMode) { removeObject(m_editMode); delete m_editMode; @@ -68,9 +63,6 @@ bool CorePlugin::initialize(const QStringList &arguments, QString *errorMessage) Q_UNUSED(arguments) const bool success = m_mainWindow->init(errorMessage); if (success) { - m_welcomeMode = new WelcomeMode; - addObject(m_welcomeMode); - EditorManager *editorManager = m_mainWindow->editorManager(); m_editMode = new EditMode(editorManager); addObject(m_editMode); @@ -80,7 +72,6 @@ bool CorePlugin::initialize(const QStringList &arguments, QString *errorMessage) void CorePlugin::extensionsInitialized() { - m_mainWindow->modeManager()->activateMode(m_welcomeMode->uniqueModeName()); m_mainWindow->extensionsInitialized(); } diff --git a/src/plugins/coreplugin/coreplugin.h b/src/plugins/coreplugin/coreplugin.h index 4580dd6fd0..04e5be49b4 100644 --- a/src/plugins/coreplugin/coreplugin.h +++ b/src/plugins/coreplugin/coreplugin.h @@ -32,10 +32,13 @@ #include +namespace Core { + class IMode; +} + namespace Core { namespace Internal { -class WelcomeMode; class EditMode; class MainWindow; @@ -56,7 +59,7 @@ public slots: private: MainWindow *m_mainWindow; - WelcomeMode *m_welcomeMode; + Core::IMode *m_welcomeMode; EditMode *m_editMode; }; diff --git a/src/plugins/coreplugin/coreplugin.pro b/src/plugins/coreplugin/coreplugin.pro index fbe1d6cc64..8bdc845c48 100644 --- a/src/plugins/coreplugin/coreplugin.pro +++ b/src/plugins/coreplugin/coreplugin.pro @@ -20,8 +20,6 @@ DEPENDPATH += dialogs \ editormanager \ scriptmanager SOURCES += mainwindow.cpp \ - welcomemode.cpp \ - rssfetcher.cpp \ editmode.cpp \ tabpositionindicator.cpp \ fancyactionbar.cpp \ @@ -81,9 +79,6 @@ SOURCES += mainwindow.cpp \ dialogs/iwizard.cpp \ settingsdatabase.cpp HEADERS += mainwindow.h \ - welcomemode.h \ - welcomemode_p.h \ - rssfetcher.h \ editmode.h \ tabpositionindicator.h \ fancyactionbar.h \ @@ -166,8 +161,7 @@ FORMS += dialogs/newdialog.ui \ dialogs/saveitemsdialog.ui \ dialogs/openwithdialog.ui \ editormanager/openeditorsview.ui \ - generalsettings.ui \ - welcomemode.ui + generalsettings.ui RESOURCES += core.qrc \ fancyactionbar.qrc diff --git a/src/plugins/coreplugin/images/welcomemode/arrow-left.png b/src/plugins/coreplugin/images/welcomemode/arrow-left.png deleted file mode 100644 index 6a29679aec..0000000000 Binary files a/src/plugins/coreplugin/images/welcomemode/arrow-left.png and /dev/null differ diff --git a/src/plugins/coreplugin/images/welcomemode/arrow-right.png b/src/plugins/coreplugin/images/welcomemode/arrow-right.png deleted file mode 100644 index 207f7fcf21..0000000000 Binary files a/src/plugins/coreplugin/images/welcomemode/arrow-right.png and /dev/null differ diff --git a/src/plugins/coreplugin/images/welcomemode/background_center_frame.png b/src/plugins/coreplugin/images/welcomemode/background_center_frame.png deleted file mode 100644 index d1628e22c2..0000000000 Binary files a/src/plugins/coreplugin/images/welcomemode/background_center_frame.png and /dev/null differ diff --git a/src/plugins/coreplugin/images/welcomemode/btn_26.png b/src/plugins/coreplugin/images/welcomemode/btn_26.png deleted file mode 100644 index 51de8bc89d..0000000000 Binary files a/src/plugins/coreplugin/images/welcomemode/btn_26.png and /dev/null differ diff --git a/src/plugins/coreplugin/images/welcomemode/btn_26_hover.png b/src/plugins/coreplugin/images/welcomemode/btn_26_hover.png deleted file mode 100644 index 3916904310..0000000000 Binary files a/src/plugins/coreplugin/images/welcomemode/btn_26_hover.png and /dev/null differ diff --git a/src/plugins/coreplugin/images/welcomemode/btn_26_pressed.png b/src/plugins/coreplugin/images/welcomemode/btn_26_pressed.png deleted file mode 100644 index 0aa53120db..0000000000 Binary files a/src/plugins/coreplugin/images/welcomemode/btn_26_pressed.png and /dev/null differ diff --git a/src/plugins/coreplugin/images/welcomemode/btn_27.png b/src/plugins/coreplugin/images/welcomemode/btn_27.png deleted file mode 100644 index bcdf90ded2..0000000000 Binary files a/src/plugins/coreplugin/images/welcomemode/btn_27.png and /dev/null differ diff --git a/src/plugins/coreplugin/images/welcomemode/btn_27_hover.png b/src/plugins/coreplugin/images/welcomemode/btn_27_hover.png deleted file mode 100644 index 2bc8680d7f..0000000000 Binary files a/src/plugins/coreplugin/images/welcomemode/btn_27_hover.png and /dev/null differ diff --git a/src/plugins/coreplugin/images/welcomemode/center_frame_header.png b/src/plugins/coreplugin/images/welcomemode/center_frame_header.png deleted file mode 100644 index f59cc41a48..0000000000 Binary files a/src/plugins/coreplugin/images/welcomemode/center_frame_header.png and /dev/null differ diff --git a/src/plugins/coreplugin/images/welcomemode/combobox_arrow.png b/src/plugins/coreplugin/images/welcomemode/combobox_arrow.png deleted file mode 100644 index fa180a27e4..0000000000 Binary files a/src/plugins/coreplugin/images/welcomemode/combobox_arrow.png and /dev/null differ diff --git a/src/plugins/coreplugin/images/welcomemode/feedback-bar-background.png b/src/plugins/coreplugin/images/welcomemode/feedback-bar-background.png deleted file mode 100644 index 18b3a561ff..0000000000 Binary files a/src/plugins/coreplugin/images/welcomemode/feedback-bar-background.png and /dev/null differ diff --git a/src/plugins/coreplugin/images/welcomemode/feedback_arrow.png b/src/plugins/coreplugin/images/welcomemode/feedback_arrow.png deleted file mode 100644 index 8766098a5a..0000000000 Binary files a/src/plugins/coreplugin/images/welcomemode/feedback_arrow.png and /dev/null differ diff --git a/src/plugins/coreplugin/images/welcomemode/feedback_arrow_hover.png b/src/plugins/coreplugin/images/welcomemode/feedback_arrow_hover.png deleted file mode 100644 index 43d9907144..0000000000 Binary files a/src/plugins/coreplugin/images/welcomemode/feedback_arrow_hover.png and /dev/null differ diff --git a/src/plugins/coreplugin/images/welcomemode/list_bullet_arrow.png b/src/plugins/coreplugin/images/welcomemode/list_bullet_arrow.png deleted file mode 100644 index acf9f5da5e..0000000000 Binary files a/src/plugins/coreplugin/images/welcomemode/list_bullet_arrow.png and /dev/null differ diff --git a/src/plugins/coreplugin/images/welcomemode/mode_project.png b/src/plugins/coreplugin/images/welcomemode/mode_project.png deleted file mode 100644 index 05d7759cf1..0000000000 Binary files a/src/plugins/coreplugin/images/welcomemode/mode_project.png and /dev/null differ diff --git a/src/plugins/coreplugin/images/welcomemode/nokia_logo.png b/src/plugins/coreplugin/images/welcomemode/nokia_logo.png deleted file mode 100644 index 5f46512b7c..0000000000 Binary files a/src/plugins/coreplugin/images/welcomemode/nokia_logo.png and /dev/null differ diff --git a/src/plugins/coreplugin/images/welcomemode/product_logo.png b/src/plugins/coreplugin/images/welcomemode/product_logo.png deleted file mode 100644 index d48e481517..0000000000 Binary files a/src/plugins/coreplugin/images/welcomemode/product_logo.png and /dev/null differ diff --git a/src/plugins/coreplugin/images/welcomemode/qt_logo.png b/src/plugins/coreplugin/images/welcomemode/qt_logo.png deleted file mode 100644 index 3cbfca726b..0000000000 Binary files a/src/plugins/coreplugin/images/welcomemode/qt_logo.png and /dev/null differ diff --git a/src/plugins/coreplugin/images/welcomemode/rc_combined.png b/src/plugins/coreplugin/images/welcomemode/rc_combined.png deleted file mode 100644 index c395794ca3..0000000000 Binary files a/src/plugins/coreplugin/images/welcomemode/rc_combined.png and /dev/null differ diff --git a/src/plugins/coreplugin/rssfetcher.cpp b/src/plugins/coreplugin/rssfetcher.cpp deleted file mode 100644 index cceb5ceb7a..0000000000 --- a/src/plugins/coreplugin/rssfetcher.cpp +++ /dev/null @@ -1,185 +0,0 @@ -/************************************************************************** -** -** 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 -#include -#include -#include -#include -#include -#include - -#include - -#include "rssfetcher.h" - -#ifdef Q_OS_UNIX -#include -#endif - -using namespace Core::Internal; - -static const QString getOsString() -{ - QString osString; -#if defined(Q_OS_WIN) - switch (QSysInfo::WindowsVersion) { - case (QSysInfo::WV_4_0): - osString += QLatin1String("WinNT4.0"); - break; - case (QSysInfo::WV_5_0): - osString += QLatin1String("Windows NT 5.0"); - break; - case (QSysInfo::WV_5_1): - osString += QLatin1String("Windows NT 5.1"); - break; - case (QSysInfo::WV_5_2): - osString += QLatin1String("Windows NT 5.2"); - break; - case (QSysInfo::WV_6_0): - osString += QLatin1String("Windows NT 6.0"); - break; - case (QSysInfo::WV_6_1): - osString += QLatin1String("Windows NT 6.1"); - break; - default: - osString += QLatin1String("Windows NT (Unknown)"); - break; - } -#elif defined (Q_OS_MAC) - if (QSysInfo::ByteOrder == QSysInfo::BigEndian) - osString += QLatin1String("PPC "); - else - osString += QLatin1String("Intel "); - osString += QLatin1String("Mac OS X "); - switch (QSysInfo::MacintoshVersion) { - case (QSysInfo::MV_10_3): - osString += QLatin1String("10_3"); - break; - case (QSysInfo::MV_10_4): - osString += QLatin1String("10_4"); - break; - case (QSysInfo::MV_10_5): - osString += QLatin1String("10_5"); - break; - case (QSysInfo::MV_10_6): - osString += QLatin1String("10_6"); - break; - default: - osString += QLatin1String("(Unknown)"); - break; - } -#elif defined (Q_OS_UNIX) - struct utsname uts; - if (uname(&uts) == 0) - osString += QString("%1 %2").arg(QLatin1String(uts.sysname)) - .arg(QLatin1String(uts.release)); - else - osString += QLatin1String("Unix (Unknown)"); -#else - ossttring = QLatin1String("Unknown OS"); -#endif - return osString; -} - -RSSFetcher::RSSFetcher(int maxItems, QObject *parent) - : QObject(parent), m_items(0), m_maxItems(maxItems) -{ - connect(&m_http, SIGNAL(readyRead(const QHttpResponseHeader &)), - this, SLOT(readData(const QHttpResponseHeader &))); - - connect(&m_http, SIGNAL(requestFinished(int, bool)), - this, SLOT(finished(int, bool))); -} - -void RSSFetcher::fetch(const QUrl &url) -{ - m_http.setProxy(QNetworkProxyFactory::systemProxyForQuery(QNetworkProxyQuery(url)).first()); - m_http.setHost(url.host()); - QString agentStr = QString("Qt-Creator/%1 (QHttp %2; %3; %4; %5 bit)") - .arg(Core::Constants::IDE_VERSION_LONG).arg(qVersion()) - .arg(getOsString()).arg(QLocale::system().name()) - .arg(QSysInfo::WordSize); - QHttpRequestHeader header("GET", url.path()); - //qDebug() << agentStr; - header.setValue("User-Agent", agentStr); - header.setValue("Host", url.host()); - m_connectionId = m_http.request(header); -} - -void RSSFetcher::readData(const QHttpResponseHeader &resp) -{ - if (resp.statusCode() != 200) - m_http.abort(); - else { - m_xml.addData(m_http.readAll()); - parseXml(); - } -} - -void RSSFetcher::finished(int id, bool error) -{ - Q_UNUSED(id) - m_items = 0; - emit finished(error); -} - -void RSSFetcher::parseXml() -{ - while (!m_xml.atEnd()) { - m_xml.readNext(); - if (m_xml.isStartElement()) { - if (m_xml.name() == "item") { - m_titleString.clear(); - m_descriptionString.clear(); - m_linkString.clear(); - } - m_currentTag = m_xml.name().toString(); - } else if (m_xml.isEndElement()) { - if (m_xml.name() == "item") { - m_items++; - if (m_items > m_maxItems) - return; - emit newsItemReady(m_titleString, m_descriptionString, m_linkString); - } - - } else if (m_xml.isCharacters() && !m_xml.isWhitespace()) { - if (m_currentTag == "title") - m_titleString += m_xml.text().toString(); - else if (m_currentTag == "description") - m_descriptionString += m_xml.text().toString(); - else if (m_currentTag == "link") - m_linkString += m_xml.text().toString(); - } - } - if (m_xml.error() && m_xml.error() != QXmlStreamReader::PrematureEndOfDocumentError) { - qWarning() << "XML ERROR:" << m_xml.lineNumber() << ": " << m_xml.errorString(); - m_http.abort(); - } -} diff --git a/src/plugins/coreplugin/rssfetcher.h b/src/plugins/coreplugin/rssfetcher.h deleted file mode 100644 index 4f161e1517..0000000000 --- a/src/plugins/coreplugin/rssfetcher.h +++ /dev/null @@ -1,76 +0,0 @@ -/************************************************************************** -** -** 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 RSSFETCHER_H -#define RSSFETCHER_H - -#include -#include -#include - -namespace Core { -namespace Internal { - -class RSSFetcher : public QObject -{ - Q_OBJECT -public: - RSSFetcher(int maxItems, QObject *parent = 0); - -signals: - void newsItemReady(const QString& title, const QString& desciption, const QString& url); - -public slots: - void fetch(const QUrl &url); - void finished(int id, bool error); - void readData(const QHttpResponseHeader &); - - signals: - void finished(bool error); - -private: - void parseXml(); - - QXmlStreamReader m_xml; - QString m_currentTag; - QString m_linkString; - QString m_descriptionString; - QString m_titleString; - - QHttp m_http; - int m_connectionId; - int m_items; - int m_maxItems; -}; - -} // namespace Internal -} // namespace Core - -#endif // RSSFETCHER_H - diff --git a/src/plugins/coreplugin/welcomemode.cpp b/src/plugins/coreplugin/welcomemode.cpp deleted file mode 100644 index 27cbd4e9c3..0000000000 --- a/src/plugins/coreplugin/welcomemode.cpp +++ /dev/null @@ -1,571 +0,0 @@ -/************************************************************************** -** -** 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 "welcomemode.h" -#include "icore.h" -#include "iwizard.h" -#include "coreconstants.h" -#include "uniqueidmanager.h" -#include "modemanager.h" -#include "newdialog.h" -#include "rssfetcher.h" - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include - -#include "ui_welcomemode.h" - -namespace Core { -namespace Internal { - -struct WelcomeModePrivate -{ - WelcomeModePrivate(); - - QScrollArea *m_scrollArea; - QWidget *m_widget; - QWidget *m_welcomePage; - QButtonGroup *btnGrp; - Ui::WelcomePage ui; - RSSFetcher *rssFetcher; - WelcomeMode::WelcomePageData lastData; - int currentTip; -}; - -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( - "" - "" - "

" - ""); - rc += text; - rc += QLatin1String("


"); - return rc; -} - -// --- WelcomeMode -WelcomeMode::WelcomeMode() : - m_d(new WelcomeModePrivate) -{ - m_d->m_widget = new QWidget; - QVBoxLayout *l = new QVBoxLayout(m_d->m_widget); - 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); - - m_d->m_scrollArea = new QScrollArea; - m_d->m_scrollArea->setFrameStyle(QFrame::NoFrame); - 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))); - - 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(this, SIGNAL(updatedExamples(QString, QString)), - this, SLOT(slotUpdateExamples(QString, QString))); - - 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("Qt Creator - A quick tour"), - 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 = 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 = ICore::instance()->settings(); - settings->setValue("General/WelcomeTab", m_d->btnGrp->checkedId()); - delete m_d->m_widget; - delete m_d; -} - -QString WelcomeMode::name() const -{ - return tr("Welcome"); -} - -QIcon WelcomeMode::icon() const -{ - return QIcon(QLatin1String(":/core/images/qtcreator_logo_32.png")); -} - -int WelcomeMode::priority() const -{ - return Constants::P_MODE_WELCOME; -} - -QWidget* WelcomeMode::widget() -{ - return m_d->m_scrollArea; -} - -const char* WelcomeMode::uniqueModeName() const -{ - return Constants::MODE_WELCOME; -} - -QList WelcomeMode::context() const -{ - static QList contexts = QList() - << UniqueIDManager::instance()->uniqueIdentifier(Constants::C_WELCOME_MODE); - 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 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 = 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) -{ - emit requestProject(data); - activateEditMode(); -} - -void WelcomeMode::slotUrlClicked(const QString &data) -{ - QDesktopServices::openUrl(QUrl(data)); -} - -void WelcomeMode::slotUpdateExamples(const QString& examplePath, const QString& demosPath) -{ - QString demoxml = demosPath + "/qtdemo/xml/examples.xml"; - if (!QFile::exists(demoxml)) - return; - - 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 fileName = examplePath + '/' + dirName + '/' + fn + '/' + fn + ".pro"; - 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); - } - 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::slotOpenExample() -{ - 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); -} - -void WelcomeMode::slotFeedback() -{ - QDesktopServices::openUrl(QUrl(QLatin1String( - "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 Ctrl+number:
    " - "
  • 1 - Welcome
  • 2 - Edit
  • 3 - Debug
  • 4 - Projects
  • 5 - Help
  • " - "
  • 6 - Output
")); - //:%1 gets replaced by Alt (Win/Unix) or Cmd (Mac) - tips.append(tr("You can show and hide the side bar using %1+0.").arg(altShortcut)); - tips.append(tr("You can fine tune the Find 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 external libraries, Qt Creator will automatically offer syntax highlighting " - "and code completion.")); - tips.append(tr("The code completion is CamelCase-aware. For example, to complete namespaceUri " - "you can just type nU and hit Ctrl+Space.")); - tips.append(tr("You can force code completion at any time using Ctrl+Space.")); - tips.append(tr("You can start Qt Creator with a session by calling qtcreator <sessionname>.")); - tips.append(tr("You can return to edit mode from any other mode at any time by hitting Escape.")); - //:%1 gets replaced by Alt (Win/Unix) or Cmd (Mac) - tips.append(tr("You can switch between the output pane by hitting %1+n where n is the number denoted " - "on the buttons at the window bottom:" - "
  • 1 - Build Issues
  • 2 - Search Results
  • 3 - Application Output
  • " - "
  • 4 - Compile Output
").arg(altShortcut)); - tips.append(tr("You can quickly search methods, classes, help and more using the " - "Locator bar (Ctrl+K).")); - tips.append(tr("You can add custom build steps in the " - "build settings.")); - tips.append(tr("Within a session, you can add " - "dependencies between projects.")); - tips.append(tr("You can set the preferred editor encoding for every project in Projects -> Editor Settings -> Default Encoding.")); - tips.append(tr("You can modify the binary that is being executed when you press the Run button: Add a Custom Executable " - "by clicking the + button in Projects -> Run Settings -> Run Configuration and then select the new " - "target in the combo box.")); - tips.append(tr("You can use Qt Creator with a number of " - "revision control systems such as Subversion, Perforce and Git.")); - tips.append(tr("In the editor, F2 toggles declaration and definition while F4 toggles header file and source file.")); - } - return tips; -} - -// --- WelcomeModeButton - -WelcomeModeButton::WelcomeModeButton(QWidget *parent) : - QLabel(parent), - m_isPressed(false), - m_isInited(false) -{ - setCursor(QCursor(Qt::PointingHandCursor)); -} - -void WelcomeModeButton::mousePressEvent(QMouseEvent *event) -{ - if (event->button() == Qt::LeftButton) - m_isPressed = true; -} - -void WelcomeModeButton::mouseReleaseEvent(QMouseEvent *event) -{ - if (event->button() == Qt::LeftButton && m_isPressed) { - m_isPressed = false; - if (rect().contains(event->pos())) - emit clicked(); - } -} - -void WelcomeModeButton::enterEvent(QEvent *) -{ - if (!m_isInited) { - m_isInited = true; - m_text = text(); - m_hoverText = m_text; - m_hoverText.replace(QLatin1String(".png"), QLatin1String("_hover.png")); - if (m_text == m_hoverText) { - m_text.clear(); - m_hoverText.clear(); - } - } - if (!m_hoverText.isEmpty()) - setText(m_hoverText); -} - -void WelcomeModeButton::leaveEvent(QEvent *) -{ - if (!m_text.isEmpty()) - setText(m_text); -} - -// --- WelcomeModeTreeWidget - -WelcomeModeTreeWidget::WelcomeModeTreeWidget(QWidget *parent) : - QTreeWidget(parent), - m_bullet(QLatin1String(":/core/images/welcomemode/list_bullet_arrow.png")) -{ - connect(this, SIGNAL(itemClicked(QTreeWidgetItem *, int)), - SLOT(slotItemClicked(QTreeWidgetItem *))); -} - -QSize WelcomeModeTreeWidget::minimumSizeHint() const -{ - return QSize(); -} - -QSize WelcomeModeTreeWidget::sizeHint() const -{ - return QSize(QTreeWidget::sizeHint().width(), 30 * topLevelItemCount()); -} - -QTreeWidgetItem *WelcomeModeTreeWidget::addItem(const QString &label, const QString &data) -{ - QTreeWidgetItem *item = new QTreeWidgetItem(this); - item->setIcon(0, m_bullet); - item->setSizeHint(0, QSize(24, 30)); - QLabel *lbl = new QLabel(label); - lbl->setTextInteractionFlags(Qt::NoTextInteraction); - lbl->setCursor(QCursor(Qt::PointingHandCursor)); - lbl->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - QBoxLayout *lay = new QVBoxLayout; - lay->setContentsMargins(3, 2, 0, 0); - lay->addWidget(lbl); - QWidget *wdg = new QWidget; - wdg->setLayout(lay); - setItemWidget(item, 1, wdg); - item->setData(0, Qt::UserRole, data); - return item; -} - -void WelcomeModeTreeWidget::slotAddNewsItem(const QString &title, const QString &description, const QString &link) -{ - int itemWidth = width()-header()->sectionSize(0); - QFont f = font(); - QString elidedText = QFontMetrics(f).elidedText(description, Qt::ElideRight, itemWidth); - f.setBold(true); - QString elidedTitle = QFontMetrics(f).elidedText(title, Qt::ElideRight, itemWidth); - QString data = QString::fromLatin1("%1
%2").arg(elidedTitle).arg(elidedText); - addTopLevelItem(addItem(data,link)); -} - -void WelcomeModeTreeWidget::slotItemClicked(QTreeWidgetItem *item) -{ - emit activated(item->data(0, Qt::UserRole).toString()); -} - -} // namespace Internal -} // namespace Core diff --git a/src/plugins/coreplugin/welcomemode.h b/src/plugins/coreplugin/welcomemode.h deleted file mode 100644 index 46215998ee..0000000000 --- a/src/plugins/coreplugin/welcomemode.h +++ /dev/null @@ -1,108 +0,0 @@ -/************************************************************************** -** -** 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 WELCOMEMODE_H -#define WELCOMEMODE_H - -#include - -#include -#include - -QT_BEGIN_NAMESPACE -class QWidget; -class QUrl; -QT_END_NAMESPACE - -namespace Core { -namespace Internal { - -struct WelcomeModePrivate; - -class CORE_EXPORT WelcomeMode : public Core::IMode -{ - Q_OBJECT - -public: - WelcomeMode(); - ~WelcomeMode(); - - struct WelcomePageData{ - bool operator==(const WelcomePageData &rhs) const; - bool operator!=(const WelcomePageData &rhs) const; - - QString previousSession; - QString activeSession; - QStringList sessionList; - QList > projectList; // pair of filename, displayname - }; - - void updateWelcomePage(const WelcomePageData &welcomePageData); - - // IMode - QString name() const; - QIcon icon() const; - int priority() const; - QWidget *widget(); - const char *uniqueModeName() const; - QList context() const; - void activated(); - QString contextHelpId() const { return QLatin1String("Qt Creator"); } - -signals: - void requestProject(const QString &project); - void requestSession(const QString &session); - void openHelpPage(const QString& url); - void openContextHelpPage(const QString& url); - void manageSessions(); - void updatedExamples(const QString& examplePath, const QString& demosPath); - -private slots: - void slotFeedback(); - void slotSessionClicked(const QString &data); - void slotProjectClicked(const QString &data); - void slotUrlClicked(const QString &data); - void slotUpdateExamples(const QString& examplePath, const QString& demosPath); - void slotEnableExampleButton(int); - void slotOpenExample(); - void slotCreateNewProject(); - void slotNextTip(); - void slotPrevTip(); - -private: - void activateEditMode(); - QStringList tipsOfTheDay(); - - WelcomeModePrivate *m_d; -}; - -} // namespace Internal -} // namespace Core - -#endif // WELCOMEMODE_H diff --git a/src/plugins/coreplugin/welcomemode.ui b/src/plugins/coreplugin/welcomemode.ui deleted file mode 100644 index c1471f65d7..0000000000 --- a/src/plugins/coreplugin/welcomemode.ui +++ /dev/null @@ -1,1233 +0,0 @@ - - - Core::Internal::WelcomePage - - - - 0 - 0 - 864 - 690 - - - - #Core--Internal--WelcomePage { -background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(247, 247, 247, 255), stop:1 rgba(215, 215, 215, 255)); -} - -QToolButton, QPushButton, QComboBox { - border-image: url(:/core/images/welcomemode/btn_26.png) 4; - border-width: 4; - padding: 0px 6px; - font-size: 12px; -} - -*{ - color: black; -} - - QComboBox QAbstractItemView { - background-color:white; -} - - QComboBox::down-arrow { - image: url(:/core/images/welcomemode/combobox_arrow.png); - } - -QComboBox:drop-down -{ - subcontrol-origin: padding; - subcontrol-position: top right; - border-left-style: none; - border-top-right-radius: 1px; - border-bottom-right-radius: 1px; -} - -QToolButton:hover, QPushButton:hover, QComboBox:hover { - border-image: url(:/core/images/welcomemode/btn_26_hover.png) 4; -} - -QToolButton:disabled, QPushButton:disabled, QComboBox::disabled { - color:gray; -} - -QToolButton:pressed, QPushButton:pressed{ - border-image: url(:/core/images/welcomemode/btn_26_pressed.png) 4; -} - - - - - 0 - - - 0 - - - - - #gradientWidget { - background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(247, 247, 247, 255), stop:1 rgba(215, 215, 215, 255)); -} - - - - 4 - - - 4 - - - 0 - - - 0 - - - 0 - - - - - - 662 - 515 - - - - - 662 - 16777215 - - - - #mainFrame { - border-image: url(:/core/images/welcomemode/background_center_frame.png) 4; - border-width: 4; -} - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - 0 - - - 0 - - - 9 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 649 - 74 - - - - - 649 - 89 - - - - #headerFrame { - border-image: url(:/core/images/welcomemode/center_frame_header.png) 0; - border-width: 0; -} - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - - 0 - 0 - - - - - 50 - false - - - - PointingHandCursor - - - false - - - QToolButton { - border-image:none; - background-color: qlineargradient(x1: 0, y1: 0, x2: 0.0, y2: 1.0, - stop: 0 #838383, - stop: 0.4 #707070, - stop: 0.401 #636363, - stop: 1 #4a4a4a); - border: 0px solid black; - border-top: 1px solid #303030; - border-bottom: 1px solid #202020; - color: white; - height:20px; -} - -QToolButton:hover { - border-image:none; - background-color: qlineargradient(x1: 0, y1: 0, x2: 0.0, y2: 1.0, - stop: 0 #909090, - stop: 0.4 #808080, - stop: 0.401 #707070, - stop: 1 #555555); -} - -QToolButton:checked, QToolButton:checked:pressed { - border-image:none; - background-color: qlineargradient(x1: 0, y1: 0, x2: 0.0, y2: 1.0, - stop: 0 #ffffff, - stop: 0.4 #eeeeee, - stop: 0.401 #e2e2e2, - stop: 1 #dddddd); - color: black; - border-top: 1px solid #606060; - border-bottom: 1px solid #404040; -} - -QToolButton:pressed { - border-image:none; - background-color: qlineargradient(x1: 0, y1: 0, x2: 0.0, y2: 1.0, - stop: 0 #383838, - stop: 0.2 #404040, - stop: 0.201 #484848, - stop: 1 #505050); -} - - - - - - QFrame::NoFrame - - - QFrame::Plain - - - - 0 - - - 0 - - - - - true - - - - 0 - 0 - - - - - 0 - 0 - - - - - -1 - - - - - - - Getting Started - - - true - - - true - - - false - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - -1 - - - - Develop - - - true - - - false - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - -1 - - - - - - - Community - - - true - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 5 - 20 - - - - - - - - - - - 0 - - - - - 18 - - - 18 - - - 12 - - - 18 - - - 24 - - - - - - 0 - 0 - - - - - 400 - 16777215 - - - - - - - - - - - 0 - 0 - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - - 0 - 0 - - - - Qt::NoFocus - - - QFrame::NoFrame - - - QAbstractItemView::NoSelection - - - QAbstractItemView::ScrollPerPixel - - - false - - - true - - - true - - - 2 - - - false - - - 24 - - - 0 - - - - 1 - - - - - 2 - - - - - - - - - - - - 0 - 0 - - - - - 400 - 16777215 - - - - - - - - 8 - - - 0 - - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - false - - - - 0 - 0 - - - - - Examples not installed - - - - - - - - false - - - - 0 - 0 - - - - Open - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 6 - 6 - - - - - - - - - - - - 0 - 0 - - - - - 400 - 16777215 - - - - - - - - 9 - - - - - - 0 - 0 - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - - 0 - 0 - - - - QFrame::NoFrame - - - QFrame::Plain - - - Qt::ScrollBarAlwaysOff - - - Qt::ScrollBarAlwaysOff - - - true - - - - - - - 0 - - - - - Qt::Vertical - - - QSizePolicy::Preferred - - - - 20 - 2 - - - - - - - - QToolButton{ - border-right:solid 0 px; - height:16px; - width:12px; -} - - - - - - - - :/core/images/welcomemode/arrow-left.png:/core/images/welcomemode/arrow-left.png - - - Qt::NoArrow - - - - - - - QToolButton{ - border-left:solid 0 px; - height:16px; - width:12px; -} - - - - - - - - :/core/images/welcomemode/arrow-right.png:/core/images/welcomemode/arrow-right.png - - - Qt::NoArrow - - - - - - - Qt::Vertical - - - - 20 - 2 - - - - - - - - - - - - - - - 18 - - - 24 - - - - - - 0 - 0 - - - - - 270 - 130 - - - - - - - - 0 - - - 3 - - - - - - 0 - 0 - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - - 0 - 0 - - - - Qt::NoFocus - - - QFrame::NoFrame - - - QAbstractItemView::NoSelection - - - QAbstractItemView::ScrollPerPixel - - - false - - - true - - - true - - - 2 - - - false - - - 24 - - - 0 - - - - 1 - - - - - 2 - - - - - - - - Qt::TabFocus - - - Manage Sessions... - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - - - 0 - - - 3 - - - 9 - - - - - - 0 - 0 - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - - 0 - 0 - - - - Qt::NoFocus - - - QFrame::NoFrame - - - QAbstractItemView::NoSelection - - - QAbstractItemView::ScrollPerPixel - - - false - - - true - - - true - - - 2 - - - false - - - 24 - - - 0 - - - - 1 - - - - - 2 - - - - - - - - Qt::TabFocus - - - Create New Project... - - - true - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - 18 - - - 24 - - - - - QFrame::NoFrame - - - QFrame::Plain - - - - - - - 0 - 0 - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - - 0 - 0 - - - - - 340 - 0 - - - - Qt::NoFocus - - - QFrame::NoFrame - - - QAbstractItemView::NoSelection - - - QAbstractItemView::ScrollPerPixel - - - false - - - true - - - true - - - 2 - - - false - - - 24 - - - 0 - - - - 1 - - - - - 2 - - - - - - - - - - - QFrame::NoFrame - - - QFrame::Plain - - - - - - - 0 - 0 - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - - 0 - 0 - - - - Qt::NoFocus - - - QFrame::NoFrame - - - QAbstractItemView::NoSelection - - - QAbstractItemView::ScrollPerPixel - - - false - - - true - - - true - - - 2 - - - false - - - 24 - - - 0 - - - - 1 - - - - - 2 - - - - - - - - - - - - - - - 20 - - - 17 - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Help us make Qt Creator even better - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 6 - 0 - - - - - - - - Qt::TabFocus - - - height:19px; - - - Feedback - - - - :/core/images/welcomemode/feedback_arrow.png:/core/images/welcomemode/feedback_arrow.png - - - - - - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 40 - - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 40 - - - - - - - - - - - - - - - - - - Core::Internal::WelcomeModeTreeWidget - QTreeWidget -
welcomemode_p.h
-
-
- - - - -
diff --git a/src/plugins/coreplugin/welcomemode_p.h b/src/plugins/coreplugin/welcomemode_p.h deleted file mode 100644 index 75c75361d6..0000000000 --- a/src/plugins/coreplugin/welcomemode_p.h +++ /dev/null @@ -1,91 +0,0 @@ -/************************************************************************** -** -** 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 WELCOMEMODE_P_H -#define WELCOMEMODE_P_H - -#include -#include -#include - -namespace Core { -namespace Internal { - -class WelcomeModeButton : public QLabel -{ - Q_OBJECT - -public: - WelcomeModeButton(QWidget *parent = 0); - -signals: - void clicked(); - -protected: - virtual void mousePressEvent(QMouseEvent *event); - virtual void mouseReleaseEvent(QMouseEvent *event); - virtual void enterEvent(QEvent *event); - virtual void leaveEvent(QEvent *event); - -private: - bool m_isPressed; - bool m_isInited; - QString m_text; - QString m_hoverText; -}; - -class WelcomeModeTreeWidget : public QTreeWidget -{ - Q_OBJECT - -public: - WelcomeModeTreeWidget(QWidget *parent = 0); - QTreeWidgetItem *addItem(const QString &label, const QString &data); - -public slots: - void slotAddNewsItem(const QString &title, const QString &description, const QString &link); - -signals: - void activated(const QString &data); - -protected: - virtual QSize minimumSizeHint() const; - virtual QSize sizeHint() const; - -private slots: - void slotItemClicked(QTreeWidgetItem *item); - -private: - QIcon m_bullet; -}; - -} -} - -#endif // WELCOMEMODE_P_H diff --git a/src/plugins/help/Help.pluginspec b/src/plugins/help/Help.pluginspec index 29f1b46961..d7ccc070fd 100644 --- a/src/plugins/help/Help.pluginspec +++ b/src/plugins/help/Help.pluginspec @@ -22,5 +22,6 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. + diff --git a/src/plugins/help/help.pro b/src/plugins/help/help.pro index b733a1fa70..1f5ec5585e 100644 --- a/src/plugins/help/help.pro +++ b/src/plugins/help/help.pro @@ -4,6 +4,7 @@ include(../../qtcreatorplugin.pri) include(../../plugins/coreplugin/coreplugin.pri) include(../../plugins/find/find.pri) include(../../plugins/quickopen/quickopen.pri) +include(../../plugins/welcome/welcome.pri) QT += network CONFIG += help DEFINES += QT_CLUCENE_SUPPORT \ diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index ee516a3df0..ec5b7887fa 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -56,6 +56,8 @@ #include #include +#include + #include #include @@ -611,8 +613,8 @@ void HelpPlugin::extensionsInitialized() using namespace Core::Internal; using namespace Core::Constants; - WelcomeMode *welcomeMode = - qobject_cast(m_core->modeManager()->mode(MODE_WELCOME)); + Welcome::WelcomeMode *welcomeMode = + qobject_cast(m_core->modeManager()->mode(MODE_WELCOME)); if (welcomeMode) { connect(welcomeMode, SIGNAL(openHelpPage(QString)), this, SLOT(openHelpPage(QString))); diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index 4ee1549085..b8ae5ecafa 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -4,6 +4,7 @@ TEMPLATE = subdirs SUBDIRS = plugin_coreplugin \ + plugin_welcome \ plugin_find \ plugin_texteditor \ plugin_cppeditor \ @@ -30,13 +31,16 @@ SUBDIRS = plugin_coreplugin \ plugin_fakevim \ plugin_designer \ plugin_resourceeditor \ - plugin_genericprojectmanager \ + plugin_genericprojectmanager \ plugin_duieditor \ plugin_qmlprojectmanager \ debugger/dumper.pro plugin_coreplugin.subdir = coreplugin +plugin_welcome.subdir = welcome +plugin_welcome.depends = plugin_coreplugin + plugin_find.subdir = find plugin_find.depends += plugin_coreplugin diff --git a/src/plugins/projectexplorer/ProjectExplorer.pluginspec b/src/plugins/projectexplorer/ProjectExplorer.pluginspec index 8b5a7c317a..6a66cfe1b8 100644 --- a/src/plugins/projectexplorer/ProjectExplorer.pluginspec +++ b/src/plugins/projectexplorer/ProjectExplorer.pluginspec @@ -23,5 +23,6 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. + diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index b71afb3835..f10b628aad 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -74,11 +74,10 @@ #include #include #include -#include #include #include #include -#include +#include #include #include #include @@ -647,7 +646,7 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er m_projectExplorerSettings.showCompilerOutput = s->value("ProjectExplorer/Settings/ShowCompilerOutput", false).toBool(); } - if (Core::Internal::WelcomeMode *welcomeMode = qobject_cast + if (Welcome::WelcomeMode *welcomeMode = qobject_cast (Core::ICore::instance()->modeManager()->mode(Core::Constants::MODE_WELCOME))) { connect(welcomeMode, SIGNAL(manageSessions()), this, SLOT(showSessionManager())); } @@ -837,7 +836,7 @@ void ProjectExplorerPlugin::showSessionManager() Core::IMode *welcomeMode = modeManager->mode(Core::Constants::MODE_WELCOME); if (modeManager->currentMode() == welcomeMode) { - updateWelcomePage(qobject_cast(welcomeMode)); + updateWelcomePage(qobject_cast(welcomeMode)); } } @@ -1020,9 +1019,9 @@ Project *ProjectExplorerPlugin::startupProject() const } // update welcome page -void ProjectExplorerPlugin::updateWelcomePage(Core::Internal::WelcomeMode *welcomeMode) +void ProjectExplorerPlugin::updateWelcomePage(Welcome::WelcomeMode *welcomeMode) { - Core::Internal::WelcomeMode::WelcomePageData welcomePageData; + Welcome::WelcomeMode::WelcomePageData welcomePageData; welcomePageData.sessionList = m_session->sessions(); welcomePageData.activeSession = m_session->activeSession(); welcomePageData.previousSession = m_session->lastSession(); @@ -1032,7 +1031,7 @@ void ProjectExplorerPlugin::updateWelcomePage(Core::Internal::WelcomeMode *welco void ProjectExplorerPlugin::currentModeChanged(Core::IMode *mode) { - if (Core::Internal::WelcomeMode *welcomeMode = qobject_cast(mode)) + if (Welcome::WelcomeMode *welcomeMode = qobject_cast(mode)) updateWelcomePage(welcomeMode); } @@ -1081,7 +1080,7 @@ void ProjectExplorerPlugin::restoreSession() // update welcome page Core::ModeManager *modeManager = Core::ModeManager::instance(); connect(modeManager, SIGNAL(currentModeChanged(Core::IMode*)), this, SLOT(currentModeChanged(Core::IMode*))); - if (Core::Internal::WelcomeMode *welcomeMode = qobject_cast(modeManager->mode(Core::Constants::MODE_WELCOME))) { + if (Welcome::WelcomeMode *welcomeMode = qobject_cast(modeManager->mode(Core::Constants::MODE_WELCOME))) { updateWelcomePage(welcomeMode); connect(welcomeMode, SIGNAL(requestSession(QString)), this, SLOT(loadSession(QString))); connect(welcomeMode, SIGNAL(requestProject(QString)), this, SLOT(loadProject(QString))); diff --git a/src/plugins/projectexplorer/projectexplorer.h b/src/plugins/projectexplorer/projectexplorer.h index 78c1d3c3ba..0f781eac88 100644 --- a/src/plugins/projectexplorer/projectexplorer.h +++ b/src/plugins/projectexplorer/projectexplorer.h @@ -46,21 +46,20 @@ #include #include - namespace Core { class IContext; class IMode; class IFileFactory; -namespace Internal { - class WelcomeMode; -} namespace Utils { class ParameterAction; } } -namespace ProjectExplorer { +namespace Welcome { + class WelcomeMode; +} +namespace ProjectExplorer { class BuildManager; class PersistentSettings; class RunConfiguration; @@ -210,7 +209,7 @@ private: void updateActions(); void addToRecentProjects(const QString &fileName, const QString &displayName); - void updateWelcomePage(Core::Internal::WelcomeMode *welcomeMode); + void updateWelcomePage(Welcome::WelcomeMode *welcomeMode); Internal::ProjectFileFactory *findProjectFileFactory(const QString &filename) const; static ProjectExplorerPlugin *m_instance; diff --git a/src/plugins/projectexplorer/projectexplorer_dependencies.pri b/src/plugins/projectexplorer/projectexplorer_dependencies.pri index 674c8bbb36..ecbb7a4b97 100644 --- a/src/plugins/projectexplorer/projectexplorer_dependencies.pri +++ b/src/plugins/projectexplorer/projectexplorer_dependencies.pri @@ -3,3 +3,4 @@ include(../../plugins/quickopen/quickopen.pri) include(../../plugins/find/find.pri) include(../../plugins/coreplugin/coreplugin.pri) include(../../plugins/texteditor/texteditor.pri) +include(../../plugins/welcome/welcome.pri) diff --git a/src/plugins/qt4projectmanager/Qt4ProjectManager.pluginspec b/src/plugins/qt4projectmanager/Qt4ProjectManager.pluginspec index c4b8d4455f..3b515bd60e 100644 --- a/src/plugins/qt4projectmanager/Qt4ProjectManager.pluginspec +++ b/src/plugins/qt4projectmanager/Qt4ProjectManager.pluginspec @@ -25,5 +25,6 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. + diff --git a/src/plugins/qt4projectmanager/qtversionmanager.cpp b/src/plugins/qt4projectmanager/qtversionmanager.cpp index e1f4451dbb..e844f768e3 100644 --- a/src/plugins/qt4projectmanager/qtversionmanager.cpp +++ b/src/plugins/qt4projectmanager/qtversionmanager.cpp @@ -42,7 +42,7 @@ #include #include #include -#include +#include #include #include #include @@ -121,7 +121,7 @@ QtVersionManager::QtVersionManager() writeVersionsIntoSettings(); - if (Core::Internal::WelcomeMode *welcomeMode = qobject_cast + if (Welcome::WelcomeMode *welcomeMode = qobject_cast (Core::ICore::instance()->modeManager()->mode(Core::Constants::MODE_WELCOME))) { connect(this, SIGNAL(updatedExamples(QString, QString)), welcomeMode, SIGNAL(updatedExamples(QString, QString))); diff --git a/src/plugins/quickopen/quickopen.cp b/src/plugins/quickopen/quickopen.cp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/plugins/welcome/Welcome.pluginspec b/src/plugins/welcome/Welcome.pluginspec new file mode 100644 index 0000000000..ab310c396e --- /dev/null +++ b/src/plugins/welcome/Welcome.pluginspec @@ -0,0 +1,24 @@ + + Nokia Corporation + (C) 2008-2009 Nokia Corporation + +Commercial Usage + +Licensees holding valid Qt Commercial licenses may use this plugin 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 plugin may be used under the terms of the GNU Lesser +General Public License version 2.1 as published by the Free Software +Foundation. 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. + Default Welcome Screen Plugin + http://www.qtsoftware.com + + + + diff --git a/src/plugins/welcome/images/arrow-left.png b/src/plugins/welcome/images/arrow-left.png new file mode 100644 index 0000000000..6a29679aec Binary files /dev/null and b/src/plugins/welcome/images/arrow-left.png differ diff --git a/src/plugins/welcome/images/arrow-right.png b/src/plugins/welcome/images/arrow-right.png new file mode 100644 index 0000000000..207f7fcf21 Binary files /dev/null and b/src/plugins/welcome/images/arrow-right.png differ diff --git a/src/plugins/welcome/images/background_center_frame.png b/src/plugins/welcome/images/background_center_frame.png new file mode 100644 index 0000000000..d1628e22c2 Binary files /dev/null and b/src/plugins/welcome/images/background_center_frame.png differ diff --git a/src/plugins/welcome/images/btn_26.png b/src/plugins/welcome/images/btn_26.png new file mode 100644 index 0000000000..51de8bc89d Binary files /dev/null and b/src/plugins/welcome/images/btn_26.png differ diff --git a/src/plugins/welcome/images/btn_26_hover.png b/src/plugins/welcome/images/btn_26_hover.png new file mode 100644 index 0000000000..3916904310 Binary files /dev/null and b/src/plugins/welcome/images/btn_26_hover.png differ diff --git a/src/plugins/welcome/images/btn_26_pressed.png b/src/plugins/welcome/images/btn_26_pressed.png new file mode 100644 index 0000000000..0aa53120db Binary files /dev/null and b/src/plugins/welcome/images/btn_26_pressed.png differ diff --git a/src/plugins/welcome/images/btn_27.png b/src/plugins/welcome/images/btn_27.png new file mode 100644 index 0000000000..bcdf90ded2 Binary files /dev/null and b/src/plugins/welcome/images/btn_27.png differ diff --git a/src/plugins/welcome/images/btn_27_hover.png b/src/plugins/welcome/images/btn_27_hover.png new file mode 100644 index 0000000000..2bc8680d7f Binary files /dev/null and b/src/plugins/welcome/images/btn_27_hover.png differ diff --git a/src/plugins/welcome/images/center_frame_header.png b/src/plugins/welcome/images/center_frame_header.png new file mode 100644 index 0000000000..f59cc41a48 Binary files /dev/null and b/src/plugins/welcome/images/center_frame_header.png differ diff --git a/src/plugins/welcome/images/combobox_arrow.png b/src/plugins/welcome/images/combobox_arrow.png new file mode 100644 index 0000000000..fa180a27e4 Binary files /dev/null and b/src/plugins/welcome/images/combobox_arrow.png differ diff --git a/src/plugins/welcome/images/feedback-bar-background.png b/src/plugins/welcome/images/feedback-bar-background.png new file mode 100644 index 0000000000..18b3a561ff Binary files /dev/null and b/src/plugins/welcome/images/feedback-bar-background.png differ diff --git a/src/plugins/welcome/images/feedback_arrow.png b/src/plugins/welcome/images/feedback_arrow.png new file mode 100644 index 0000000000..8766098a5a Binary files /dev/null and b/src/plugins/welcome/images/feedback_arrow.png differ diff --git a/src/plugins/welcome/images/feedback_arrow_hover.png b/src/plugins/welcome/images/feedback_arrow_hover.png new file mode 100644 index 0000000000..43d9907144 Binary files /dev/null and b/src/plugins/welcome/images/feedback_arrow_hover.png differ diff --git a/src/plugins/welcome/images/list_bullet_arrow.png b/src/plugins/welcome/images/list_bullet_arrow.png new file mode 100644 index 0000000000..acf9f5da5e Binary files /dev/null and b/src/plugins/welcome/images/list_bullet_arrow.png differ diff --git a/src/plugins/welcome/images/mode_project.png b/src/plugins/welcome/images/mode_project.png new file mode 100644 index 0000000000..05d7759cf1 Binary files /dev/null and b/src/plugins/welcome/images/mode_project.png differ diff --git a/src/plugins/welcome/images/nokia_logo.png b/src/plugins/welcome/images/nokia_logo.png new file mode 100644 index 0000000000..5f46512b7c Binary files /dev/null and b/src/plugins/welcome/images/nokia_logo.png differ diff --git a/src/plugins/welcome/images/product_logo.png b/src/plugins/welcome/images/product_logo.png new file mode 100644 index 0000000000..d48e481517 Binary files /dev/null and b/src/plugins/welcome/images/product_logo.png differ diff --git a/src/plugins/welcome/images/qt_logo.png b/src/plugins/welcome/images/qt_logo.png new file mode 100644 index 0000000000..3cbfca726b Binary files /dev/null and b/src/plugins/welcome/images/qt_logo.png differ diff --git a/src/plugins/welcome/images/rc_combined.png b/src/plugins/welcome/images/rc_combined.png new file mode 100644 index 0000000000..c395794ca3 Binary files /dev/null and b/src/plugins/welcome/images/rc_combined.png differ diff --git a/src/plugins/welcome/rssfetcher.cpp b/src/plugins/welcome/rssfetcher.cpp new file mode 100644 index 0000000000..f5fc756c9b --- /dev/null +++ b/src/plugins/welcome/rssfetcher.cpp @@ -0,0 +1,185 @@ +/************************************************************************** +** +** 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 +#include +#include +#include +#include +#include +#include + +#include + +#include "rssfetcher.h" + +#ifdef Q_OS_UNIX +#include +#endif + +using namespace Welcome; + +static const QString getOsString() +{ + QString osString; +#if defined(Q_OS_WIN) + switch (QSysInfo::WindowsVersion) { + case (QSysInfo::WV_4_0): + osString += QLatin1String("WinNT4.0"); + break; + case (QSysInfo::WV_5_0): + osString += QLatin1String("Windows NT 5.0"); + break; + case (QSysInfo::WV_5_1): + osString += QLatin1String("Windows NT 5.1"); + break; + case (QSysInfo::WV_5_2): + osString += QLatin1String("Windows NT 5.2"); + break; + case (QSysInfo::WV_6_0): + osString += QLatin1String("Windows NT 6.0"); + break; + case (QSysInfo::WV_6_1): + osString += QLatin1String("Windows NT 6.1"); + break; + default: + osString += QLatin1String("Windows NT (Unknown)"); + break; + } +#elif defined (Q_OS_MAC) + if (QSysInfo::ByteOrder == QSysInfo::BigEndian) + osString += QLatin1String("PPC "); + else + osString += QLatin1String("Intel "); + osString += QLatin1String("Mac OS X "); + switch (QSysInfo::MacintoshVersion) { + case (QSysInfo::MV_10_3): + osString += QLatin1String("10_3"); + break; + case (QSysInfo::MV_10_4): + osString += QLatin1String("10_4"); + break; + case (QSysInfo::MV_10_5): + osString += QLatin1String("10_5"); + break; + case (QSysInfo::MV_10_6): + osString += QLatin1String("10_6"); + break; + default: + osString += QLatin1String("(Unknown)"); + break; + } +#elif defined (Q_OS_UNIX) + struct utsname uts; + if (uname(&uts) == 0) + osString += QString("%1 %2").arg(QLatin1String(uts.sysname)) + .arg(QLatin1String(uts.release)); + else + osString += QLatin1String("Unix (Unknown)"); +#else + ossttring = QLatin1String("Unknown OS"); +#endif + return osString; +} + +RSSFetcher::RSSFetcher(int maxItems, QObject *parent) + : QObject(parent), m_items(0), m_maxItems(maxItems) +{ + connect(&m_http, SIGNAL(readyRead(const QHttpResponseHeader &)), + this, SLOT(readData(const QHttpResponseHeader &))); + + connect(&m_http, SIGNAL(requestFinished(int, bool)), + this, SLOT(finished(int, bool))); +} + +void RSSFetcher::fetch(const QUrl &url) +{ + m_http.setProxy(QNetworkProxyFactory::systemProxyForQuery(QNetworkProxyQuery(url)).first()); + m_http.setHost(url.host()); + QString agentStr = QString("Qt-Creator/%1 (QHttp %2; %3; %4; %5 bit)") + .arg(Core::Constants::IDE_VERSION_LONG).arg(qVersion()) + .arg(getOsString()).arg(QLocale::system().name()) + .arg(QSysInfo::WordSize); + QHttpRequestHeader header("GET", url.path()); + //qDebug() << agentStr; + header.setValue("User-Agent", agentStr); + header.setValue("Host", url.host()); + m_connectionId = m_http.request(header); +} + +void RSSFetcher::readData(const QHttpResponseHeader &resp) +{ + if (resp.statusCode() != 200) + m_http.abort(); + else { + m_xml.addData(m_http.readAll()); + parseXml(); + } +} + +void RSSFetcher::finished(int id, bool error) +{ + Q_UNUSED(id) + m_items = 0; + emit finished(error); +} + +void RSSFetcher::parseXml() +{ + while (!m_xml.atEnd()) { + m_xml.readNext(); + if (m_xml.isStartElement()) { + if (m_xml.name() == "item") { + m_titleString.clear(); + m_descriptionString.clear(); + m_linkString.clear(); + } + m_currentTag = m_xml.name().toString(); + } else if (m_xml.isEndElement()) { + if (m_xml.name() == "item") { + m_items++; + if (m_items > m_maxItems) + return; + emit newsItemReady(m_titleString, m_descriptionString, m_linkString); + } + + } else if (m_xml.isCharacters() && !m_xml.isWhitespace()) { + if (m_currentTag == "title") + m_titleString += m_xml.text().toString(); + else if (m_currentTag == "description") + m_descriptionString += m_xml.text().toString(); + else if (m_currentTag == "link") + m_linkString += m_xml.text().toString(); + } + } + if (m_xml.error() && m_xml.error() != QXmlStreamReader::PrematureEndOfDocumentError) { + qWarning() << "XML ERROR:" << m_xml.lineNumber() << ": " << m_xml.errorString(); + m_http.abort(); + } +} diff --git a/src/plugins/welcome/rssfetcher.h b/src/plugins/welcome/rssfetcher.h new file mode 100644 index 0000000000..9267fdb47a --- /dev/null +++ b/src/plugins/welcome/rssfetcher.h @@ -0,0 +1,74 @@ +/************************************************************************** +** +** 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 RSSFETCHER_H +#define RSSFETCHER_H + +#include +#include +#include + +namespace Welcome { + +class RSSFetcher : public QObject +{ + Q_OBJECT +public: + RSSFetcher(int maxItems, QObject *parent = 0); + +signals: + void newsItemReady(const QString& title, const QString& desciption, const QString& url); + +public slots: + void fetch(const QUrl &url); + void finished(int id, bool error); + void readData(const QHttpResponseHeader &); + + signals: + void finished(bool error); + +private: + void parseXml(); + + QXmlStreamReader m_xml; + QString m_currentTag; + QString m_linkString; + QString m_descriptionString; + QString m_titleString; + + QHttp m_http; + int m_connectionId; + int m_items; + int m_maxItems; +}; + +} // namespace Welcome + +#endif // RSSFETCHER_H + diff --git a/src/plugins/welcome/welcome.pri b/src/plugins/welcome/welcome.pri new file mode 100644 index 0000000000..5e0a99bca8 --- /dev/null +++ b/src/plugins/welcome/welcome.pri @@ -0,0 +1,2 @@ +include(coreplugin_dependencies.pri) +LIBS *= -l$$qtLibraryTarget(Welcome) diff --git a/src/plugins/welcome/welcome.pro b/src/plugins/welcome/welcome.pro new file mode 100644 index 0000000000..51e66a573f --- /dev/null +++ b/src/plugins/welcome/welcome.pro @@ -0,0 +1,22 @@ +TEMPLATE = lib +TARGET = Welcome +QT += network +include(../../qtcreatorplugin.pri) +include(../../plugins/coreplugin/coreplugin.pri) + +HEADERS += welcomeplugin.h \ + welcomemode.h \ + welcomemode_p.h \ + rssfetcher.h + +SOURCES += welcomeplugin.cpp \ + welcomemode.cpp \ + rssfetcher.cpp + +FORMS += welcomemode.ui + +RESOURCES += welcome.qrc + +DEFINES += WELCOME_LIBRARY + +OTHER_FILES += Welcome.pluginspec diff --git a/src/plugins/welcome/welcome.qrc b/src/plugins/welcome/welcome.qrc new file mode 100644 index 0000000000..f478674327 --- /dev/null +++ b/src/plugins/welcome/welcome.qrc @@ -0,0 +1,23 @@ + + + images/btn_26.png + images/btn_26_hover.png + images/btn_27.png + images/btn_27_hover.png + images/feedback_arrow.png + images/feedback_arrow_hover.png + images/feedback-bar-background.png + images/list_bullet_arrow.png + images/mode_project.png + images/nokia_logo.png + images/product_logo.png + images/qt_logo.png + images/rc_combined.png + images/background_center_frame.png + images/center_frame_header.png + images/btn_26_pressed.png + images/combobox_arrow.png + images/arrow-left.png + images/arrow-right.png + + diff --git a/src/plugins/welcome/welcome_global.h b/src/plugins/welcome/welcome_global.h new file mode 100644 index 0000000000..8629323fda --- /dev/null +++ b/src/plugins/welcome/welcome_global.h @@ -0,0 +1,12 @@ +#ifndef WELCOME_GLOBAL_H +#define WELCOME_GLOBAL_H + +#include + +#if defined(WELCOME_LIBRARY) +# define WELCOME_EXPORT Q_DECL_EXPORT +#else +# define WELCOME_EXPORT Q_DECL_IMPORT +#endif + +#endif // CPPEDITOR_GLOBAL_H diff --git a/src/plugins/welcome/welcomemode.cpp b/src/plugins/welcome/welcomemode.cpp new file mode 100644 index 0000000000..f712399dcc --- /dev/null +++ b/src/plugins/welcome/welcomemode.cpp @@ -0,0 +1,571 @@ +/************************************************************************** +** +** 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 "welcomemode.h" +#include "rssfetcher.h" + +#include +#include + +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include "ui_welcomemode.h" + +namespace Welcome { + +struct WelcomeModePrivate +{ + WelcomeModePrivate(); + + QScrollArea *m_scrollArea; + QWidget *m_widget; + QWidget *m_welcomePage; + QButtonGroup *btnGrp; + Ui::WelcomePage ui; + RSSFetcher *rssFetcher; + WelcomeMode::WelcomePageData lastData; + int currentTip; +}; + +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( + "" + "" + "

" + ""); + rc += text; + rc += QLatin1String("


"); + return rc; +} + +// --- WelcomeMode +WelcomeMode::WelcomeMode() : + m_d(new WelcomeModePrivate) +{ + m_d->m_widget = new QWidget; + QVBoxLayout *l = new QVBoxLayout(m_d->m_widget); + 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); + + m_d->m_scrollArea = new QScrollArea; + m_d->m_scrollArea->setFrameStyle(QFrame::NoFrame); + 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))); + + 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(this, SIGNAL(updatedExamples(QString, QString)), + this, SLOT(slotUpdateExamples(QString, QString))); + + 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("Qt Creator - A quick tour"), + 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()); + delete m_d->m_widget; + delete m_d; +} + +QString WelcomeMode::name() const +{ + return tr("Welcome"); +} + +QIcon WelcomeMode::icon() const +{ + return QIcon(QLatin1String(":/core/images/qtcreator_logo_32.png")); +} + +int WelcomeMode::priority() const +{ + return Core::Constants::P_MODE_WELCOME; +} + +QWidget* WelcomeMode::widget() +{ + return m_d->m_scrollArea; +} + +const char* WelcomeMode::uniqueModeName() const +{ + return Core::Constants::MODE_WELCOME; +} + +QList WelcomeMode::context() const +{ + static QList contexts = QList() + << Core::UniqueIDManager::instance()->uniqueIdentifier(Core::Constants::C_WELCOME_MODE); + 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 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) +{ + emit requestProject(data); + activateEditMode(); +} + +void WelcomeMode::slotUrlClicked(const QString &data) +{ + QDesktopServices::openUrl(QUrl(data)); +} + +void WelcomeMode::slotUpdateExamples(const QString& examplePath, const QString& demosPath) +{ + QString demoxml = demosPath + "/qtdemo/xml/examples.xml"; + if (!QFile::exists(demoxml)) + return; + + 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 fileName = examplePath + '/' + dirName + '/' + fn + '/' + fn + ".pro"; + 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); + } + 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::slotOpenExample() +{ + 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); +} + +void WelcomeMode::slotFeedback() +{ + QDesktopServices::openUrl(QUrl(QLatin1String( + "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 Ctrl+number:
    " + "
  • 1 - Welcome
  • 2 - Edit
  • 3 - Debug
  • 4 - Projects
  • 5 - Help
  • " + "
  • 6 - Output
")); + //:%1 gets replaced by Alt (Win/Unix) or Cmd (Mac) + tips.append(tr("You can show and hide the side bar using %1+0.").arg(altShortcut)); + tips.append(tr("You can fine tune the Find 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 external libraries, Qt Creator will automatically offer syntax highlighting " + "and code completion.")); + tips.append(tr("The code completion is CamelCase-aware. For example, to complete namespaceUri " + "you can just type nU and hit Ctrl+Space.")); + tips.append(tr("You can force code completion at any time using Ctrl+Space.")); + tips.append(tr("You can start Qt Creator with a session by calling qtcreator <sessionname>.")); + tips.append(tr("You can return to edit mode from any other mode at any time by hitting Escape.")); + //:%1 gets replaced by Alt (Win/Unix) or Cmd (Mac) + tips.append(tr("You can switch between the output pane by hitting %1+n where n is the number denoted " + "on the buttons at the window bottom:" + "
  • 1 - Build Issues
  • 2 - Search Results
  • 3 - Application Output
  • " + "
  • 4 - Compile Output
").arg(altShortcut)); + tips.append(tr("You can quickly search methods, classes, help and more using the " + "Locator bar (Ctrl+K).")); + tips.append(tr("You can add custom build steps in the " + "build settings.")); + tips.append(tr("Within a session, you can add " + "dependencies between projects.")); + tips.append(tr("You can set the preferred editor encoding for every project in Projects -> Editor Settings -> Default Encoding.")); + tips.append(tr("You can modify the binary that is being executed when you press the Run button: Add a Custom Executable " + "by clicking the + button in Projects -> Run Settings -> Run Configuration and then select the new " + "target in the combo box.")); + tips.append(tr("You can use Qt Creator with a number of " + "revision control systems such as Subversion, Perforce and Git.")); + tips.append(tr("In the editor, F2 toggles declaration and definition while F4 toggles header file and source file.")); + } + return tips; +} + +// --- WelcomeModeButton + +WelcomeModeButton::WelcomeModeButton(QWidget *parent) : + QLabel(parent), + m_isPressed(false), + m_isInited(false) +{ + setCursor(QCursor(Qt::PointingHandCursor)); +} + +void WelcomeModeButton::mousePressEvent(QMouseEvent *event) +{ + if (event->button() == Qt::LeftButton) + m_isPressed = true; +} + +void WelcomeModeButton::mouseReleaseEvent(QMouseEvent *event) +{ + if (event->button() == Qt::LeftButton && m_isPressed) { + m_isPressed = false; + if (rect().contains(event->pos())) + emit clicked(); + } +} + +void WelcomeModeButton::enterEvent(QEvent *) +{ + if (!m_isInited) { + m_isInited = true; + m_text = text(); + m_hoverText = m_text; + m_hoverText.replace(QLatin1String(".png"), QLatin1String("_hover.png")); + if (m_text == m_hoverText) { + m_text.clear(); + m_hoverText.clear(); + } + } + if (!m_hoverText.isEmpty()) + setText(m_hoverText); +} + +void WelcomeModeButton::leaveEvent(QEvent *) +{ + if (!m_text.isEmpty()) + setText(m_text); +} + +// --- WelcomeModeTreeWidget + +WelcomeModeTreeWidget::WelcomeModeTreeWidget(QWidget *parent) : + QTreeWidget(parent), + m_bullet(QLatin1String(":/welcome/images/list_bullet_arrow.png")) +{ + connect(this, SIGNAL(itemClicked(QTreeWidgetItem *, int)), + SLOT(slotItemClicked(QTreeWidgetItem *))); +} + +QSize WelcomeModeTreeWidget::minimumSizeHint() const +{ + return QSize(); +} + +QSize WelcomeModeTreeWidget::sizeHint() const +{ + return QSize(QTreeWidget::sizeHint().width(), 30 * topLevelItemCount()); +} + +QTreeWidgetItem *WelcomeModeTreeWidget::addItem(const QString &label, const QString &data) +{ + QTreeWidgetItem *item = new QTreeWidgetItem(this); + item->setIcon(0, m_bullet); + item->setSizeHint(0, QSize(24, 30)); + QLabel *lbl = new QLabel(label); + lbl->setTextInteractionFlags(Qt::NoTextInteraction); + lbl->setCursor(QCursor(Qt::PointingHandCursor)); + lbl->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + QBoxLayout *lay = new QVBoxLayout; + lay->setContentsMargins(3, 2, 0, 0); + lay->addWidget(lbl); + QWidget *wdg = new QWidget; + wdg->setLayout(lay); + setItemWidget(item, 1, wdg); + item->setData(0, Qt::UserRole, data); + return item; +} + +void WelcomeModeTreeWidget::slotAddNewsItem(const QString &title, const QString &description, const QString &link) +{ + int itemWidth = width()-header()->sectionSize(0); + QFont f = font(); + QString elidedText = QFontMetrics(f).elidedText(description, Qt::ElideRight, itemWidth); + f.setBold(true); + QString elidedTitle = QFontMetrics(f).elidedText(title, Qt::ElideRight, itemWidth); + QString data = QString::fromLatin1("%1
%2").arg(elidedTitle).arg(elidedText); + addTopLevelItem(addItem(data,link)); +} + +void WelcomeModeTreeWidget::slotItemClicked(QTreeWidgetItem *item) +{ + emit activated(item->data(0, Qt::UserRole).toString()); +} + +} // namespace Welcome diff --git a/src/plugins/welcome/welcomemode.h b/src/plugins/welcome/welcomemode.h new file mode 100644 index 0000000000..3825b9dbef --- /dev/null +++ b/src/plugins/welcome/welcomemode.h @@ -0,0 +1,108 @@ +/************************************************************************** +** +** 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 WELCOMEMODE_H +#define WELCOMEMODE_H + +#include "welcome_global.h" + +#include + +#include +#include + +QT_BEGIN_NAMESPACE +class QWidget; +class QUrl; +QT_END_NAMESPACE + +namespace Welcome { + +struct WelcomeModePrivate; + +class WELCOME_EXPORT WelcomeMode : public Core::IMode +{ + Q_OBJECT + +public: + WelcomeMode(); + ~WelcomeMode(); + + struct WelcomePageData{ + bool operator==(const WelcomePageData &rhs) const; + bool operator!=(const WelcomePageData &rhs) const; + + QString previousSession; + QString activeSession; + QStringList sessionList; + QList > projectList; // pair of filename, displayname + }; + + void updateWelcomePage(const WelcomePageData &welcomePageData); + + // IMode + QString name() const; + QIcon icon() const; + int priority() const; + QWidget *widget(); + const char *uniqueModeName() const; + QList context() const; + void activated(); + QString contextHelpId() const { return QLatin1String("Qt Creator"); } + +signals: + void requestProject(const QString &project); + void requestSession(const QString &session); + void openHelpPage(const QString& url); + void openContextHelpPage(const QString& url); + void manageSessions(); + void updatedExamples(const QString& examplePath, const QString& demosPath); + +private slots: + void slotFeedback(); + void slotSessionClicked(const QString &data); + void slotProjectClicked(const QString &data); + void slotUrlClicked(const QString &data); + void slotUpdateExamples(const QString& examplePath, const QString& demosPath); + void slotEnableExampleButton(int); + void slotOpenExample(); + void slotCreateNewProject(); + void slotNextTip(); + void slotPrevTip(); + +private: + void activateEditMode(); + QStringList tipsOfTheDay(); + + WelcomeModePrivate *m_d; +}; + +} // namespace Welcome + +#endif // WELCOMEMODE_H diff --git a/src/plugins/welcome/welcomemode.ui b/src/plugins/welcome/welcomemode.ui new file mode 100644 index 0000000000..9ad6ad3ab5 --- /dev/null +++ b/src/plugins/welcome/welcomemode.ui @@ -0,0 +1,1233 @@ + + + Welcome::WelcomePage + + + + 0 + 0 + 864 + 690 + + + + #Welcome--WelcomePage { +background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(247, 247, 247, 255), stop:1 rgba(215, 215, 215, 255)); +} + +QToolButton, QPushButton, QComboBox { + border-image: url(:/welcome/images/btn_26.png) 4; + border-width: 4; + padding: 0px 6px; + font-size: 12px; +} + +*{ + color: black; +} + + QComboBox QAbstractItemView { + background-color:white; +} + + QComboBox::down-arrow { + image: url(:/welcome/images/combobox_arrow.png); + } + +QComboBox:drop-down +{ + subcontrol-origin: padding; + subcontrol-position: top right; + border-left-style: none; + border-top-right-radius: 1px; + border-bottom-right-radius: 1px; +} + +QToolButton:hover, QPushButton:hover, QComboBox:hover { + border-image: url(:/welcome/images/btn_26_hover.png) 4; +} + +QToolButton:disabled, QPushButton:disabled, QComboBox::disabled { + color:gray; +} + +QToolButton:pressed, QPushButton:pressed{ + border-image: url(:/welcome/images/btn_26_pressed.png) 4; +} + + + + + 0 + + + 0 + + + + + #gradientWidget { + background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(247, 247, 247, 255), stop:1 rgba(215, 215, 215, 255)); +} + + + + 4 + + + 4 + + + 0 + + + 0 + + + 0 + + + + + + 662 + 515 + + + + + 662 + 16777215 + + + + #mainFrame { + border-image: url(:/welcome/images/background_center_frame.png) 4; + border-width: 4; +} + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + 0 + + + 9 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + 649 + 74 + + + + + 649 + 89 + + + + #headerFrame { + border-image: url(:/welcome/images/center_frame_header.png) 0; + border-width: 0; +} + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + + 0 + 0 + + + + + 50 + false + + + + PointingHandCursor + + + false + + + QToolButton { + border-image:none; + background-color: qlineargradient(x1: 0, y1: 0, x2: 0.0, y2: 1.0, + stop: 0 #838383, + stop: 0.4 #707070, + stop: 0.401 #636363, + stop: 1 #4a4a4a); + border: 0px solid black; + border-top: 1px solid #303030; + border-bottom: 1px solid #202020; + color: white; + height:20px; +} + +QToolButton:hover { + border-image:none; + background-color: qlineargradient(x1: 0, y1: 0, x2: 0.0, y2: 1.0, + stop: 0 #909090, + stop: 0.4 #808080, + stop: 0.401 #707070, + stop: 1 #555555); +} + +QToolButton:checked, QToolButton:checked:pressed { + border-image:none; + background-color: qlineargradient(x1: 0, y1: 0, x2: 0.0, y2: 1.0, + stop: 0 #ffffff, + stop: 0.4 #eeeeee, + stop: 0.401 #e2e2e2, + stop: 1 #dddddd); + color: black; + border-top: 1px solid #606060; + border-bottom: 1px solid #404040; +} + +QToolButton:pressed { + border-image:none; + background-color: qlineargradient(x1: 0, y1: 0, x2: 0.0, y2: 1.0, + stop: 0 #383838, + stop: 0.2 #404040, + stop: 0.201 #484848, + stop: 1 #505050); +} + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + + 0 + + + 0 + + + + + true + + + + 0 + 0 + + + + + 0 + 0 + + + + + -1 + + + + + + + Getting Started + + + true + + + true + + + false + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + -1 + + + + Develop + + + true + + + false + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + -1 + + + + + + + Community + + + true + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 5 + 20 + + + + + + + + + + + 0 + + + + + 18 + + + 18 + + + 12 + + + 18 + + + 24 + + + + + + 0 + 0 + + + + + 400 + 16777215 + + + + + + + + + + + 0 + 0 + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + 0 + 0 + + + + Qt::NoFocus + + + QFrame::NoFrame + + + QAbstractItemView::NoSelection + + + QAbstractItemView::ScrollPerPixel + + + false + + + true + + + true + + + 2 + + + false + + + 24 + + + 0 + + + + 1 + + + + + 2 + + + + + + + + + + + + 0 + 0 + + + + + 400 + 16777215 + + + + + + + + 8 + + + 0 + + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + false + + + + 0 + 0 + + + + + Examples not installed + + + + + + + + false + + + + 0 + 0 + + + + Open + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 6 + 6 + + + + + + + + + + + + 0 + 0 + + + + + 400 + 16777215 + + + + + + + + 9 + + + + + + 0 + 0 + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + 0 + 0 + + + + QFrame::NoFrame + + + QFrame::Plain + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + true + + + + + + + 0 + + + + + Qt::Vertical + + + QSizePolicy::Preferred + + + + 20 + 2 + + + + + + + + QToolButton{ + border-right:solid 0 px; + height:16px; + width:12px; +} + + + + + + + + :/welcome/images/arrow-left.png:/welcome/images/arrow-left.png + + + Qt::NoArrow + + + + + + + QToolButton{ + border-left:solid 0 px; + height:16px; + width:12px; +} + + + + + + + + :/welcome/images/arrow-right.png:/welcome/images/arrow-right.png + + + Qt::NoArrow + + + + + + + Qt::Vertical + + + + 20 + 2 + + + + + + + + + + + + + + + 18 + + + 24 + + + + + + 0 + 0 + + + + + 270 + 130 + + + + + + + + 0 + + + 3 + + + + + + 0 + 0 + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + 0 + 0 + + + + Qt::NoFocus + + + QFrame::NoFrame + + + QAbstractItemView::NoSelection + + + QAbstractItemView::ScrollPerPixel + + + false + + + true + + + true + + + 2 + + + false + + + 24 + + + 0 + + + + 1 + + + + + 2 + + + + + + + + Qt::TabFocus + + + Manage Sessions... + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + + 0 + + + 3 + + + 9 + + + + + + 0 + 0 + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + 0 + 0 + + + + Qt::NoFocus + + + QFrame::NoFrame + + + QAbstractItemView::NoSelection + + + QAbstractItemView::ScrollPerPixel + + + false + + + true + + + true + + + 2 + + + false + + + 24 + + + 0 + + + + 1 + + + + + 2 + + + + + + + + Qt::TabFocus + + + Create New Project... + + + true + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + 18 + + + 24 + + + + + QFrame::NoFrame + + + QFrame::Plain + + + + + + + 0 + 0 + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + 0 + 0 + + + + + 340 + 0 + + + + Qt::NoFocus + + + QFrame::NoFrame + + + QAbstractItemView::NoSelection + + + QAbstractItemView::ScrollPerPixel + + + false + + + true + + + true + + + 2 + + + false + + + 24 + + + 0 + + + + 1 + + + + + 2 + + + + + + + + + + + QFrame::NoFrame + + + QFrame::Plain + + + + + + + 0 + 0 + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + 0 + 0 + + + + Qt::NoFocus + + + QFrame::NoFrame + + + QAbstractItemView::NoSelection + + + QAbstractItemView::ScrollPerPixel + + + false + + + true + + + true + + + 2 + + + false + + + 24 + + + 0 + + + + 1 + + + + + 2 + + + + + + + + + + + + + + + 20 + + + 17 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Help us make Qt Creator even better + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 6 + 0 + + + + + + + + Qt::TabFocus + + + height:19px; + + + Feedback + + + + :/welcome/images/feedback_arrow.png:/welcome/images/feedback_arrow.png + + + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 20 + 40 + + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 20 + 40 + + + + + + + + + + + + + + + + + + Welcome::WelcomeModeTreeWidget + QTreeWidget +
welcomemode_p.h
+
+
+ + + + +
diff --git a/src/plugins/welcome/welcomemode_p.h b/src/plugins/welcome/welcomemode_p.h new file mode 100644 index 0000000000..efe80b3685 --- /dev/null +++ b/src/plugins/welcome/welcomemode_p.h @@ -0,0 +1,89 @@ +/************************************************************************** +** +** 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 WELCOMEMODE_P_H +#define WELCOMEMODE_P_H + +#include +#include +#include + +namespace Welcome { + +class WelcomeModeButton : public QLabel +{ + Q_OBJECT + +public: + WelcomeModeButton(QWidget *parent = 0); + +signals: + void clicked(); + +protected: + virtual void mousePressEvent(QMouseEvent *event); + virtual void mouseReleaseEvent(QMouseEvent *event); + virtual void enterEvent(QEvent *event); + virtual void leaveEvent(QEvent *event); + +private: + bool m_isPressed; + bool m_isInited; + QString m_text; + QString m_hoverText; +}; + +class WelcomeModeTreeWidget : public QTreeWidget +{ + Q_OBJECT + +public: + WelcomeModeTreeWidget(QWidget *parent = 0); + QTreeWidgetItem *addItem(const QString &label, const QString &data); + +public slots: + void slotAddNewsItem(const QString &title, const QString &description, const QString &link); + +signals: + void activated(const QString &data); + +protected: + virtual QSize minimumSizeHint() const; + virtual QSize sizeHint() const; + +private slots: + void slotItemClicked(QTreeWidgetItem *item); + +private: + QIcon m_bullet; +}; + +} + +#endif // WELCOMEMODE_P_H diff --git a/src/plugins/welcome/welcomeplugin.cpp b/src/plugins/welcome/welcomeplugin.cpp new file mode 100644 index 0000000000..e9743a9428 --- /dev/null +++ b/src/plugins/welcome/welcomeplugin.cpp @@ -0,0 +1,97 @@ +/************************************************************************** +** +** 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 "welcomeplugin.h" + +#include "welcomemode.h" + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +using namespace Welcome; + + +WelcomePlugin::WelcomePlugin() + : m_welcomeMode(0) +{ +} + +WelcomePlugin::~WelcomePlugin() +{ + if (m_welcomeMode) { + removeObject(m_welcomeMode); + delete m_welcomeMode; + } +} + +/*! Initializes the plugin. Returns true on success. + Plugins want to register objects with the plugin manager here. + + \a error_message can be used to pass an error message to the plugin system, + if there was any. +*/ +bool WelcomePlugin::initialize(const QStringList &arguments, QString *error_message) +{ + Q_UNUSED(arguments) + Q_UNUSED(error_message) + + m_welcomeMode = new WelcomeMode; + addObject(m_welcomeMode); + + return true; +} + +/*! Notification that all extensions that this plugin depends on have been + initialized. The dependencies are defined in the plugins .qwp file. + + Normally this method is used for things that rely on other plugins to have + added objects to the plugin manager, that implement interfaces that we're + interested in. These objects can now be requested through the + PluginManagerInterface. + + The WelcomePlugin doesn't need things from other plugins, so it does + nothing here. +*/ +void WelcomePlugin::extensionsInitialized() +{ + Core::ModeManager::instance()->activateMode(m_welcomeMode->uniqueModeName()); +} + +Q_EXPORT_PLUGIN(WelcomePlugin) diff --git a/src/plugins/welcome/welcomeplugin.h b/src/plugins/welcome/welcomeplugin.h new file mode 100644 index 0000000000..970ec39950 --- /dev/null +++ b/src/plugins/welcome/welcomeplugin.h @@ -0,0 +1,58 @@ +/************************************************************************** +** +** 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 WELCOMEPLUGIN_H +#define WELCOMEPLUGIN_H + +#include + +namespace Welcome { + +class WelcomeMode; + +class WelcomePlugin + : public ExtensionSystem::IPlugin +{ + Q_OBJECT + +public: + WelcomePlugin(); + ~WelcomePlugin(); + + bool initialize(const QStringList &arguments, QString *error_message); + + void extensionsInitialized(); + +private: + WelcomeMode *m_welcomeMode; +}; + +} // namespace Welcome + +#endif // WELCOMEPLUGIN_H -- cgit v1.2.1