Commit 5633de2a authored by Daniel Molkentin's avatar Daniel Molkentin

Make the welcome screen into plugins.

This removes the all hard dependencies to and from welcome screen,
except the one to the core plugin. More in detail:

- Add IWelcomePage to add a tab to the welcome screen
- Move tabs in the modules where they belong
- Enables QHelpManager to open help fullscreen and contextually
- "Getting Started" moves to Qt4ProjectManager
- Projects & Sessions (aka "Develop") moves to ProjectExplorer
- "Community" remains in the welcome plugin for simplicity
parent a9b521f8
This diff is collapsed.
......@@ -4,9 +4,7 @@ DEFINES += EXTENSIONSYSTEM_LIBRARY
include(../../qtcreatorlibrary.pri)
include(extensionsystem_dependencies.pri)
unix:!macx:!freebsd* {
LIBS += -ldl
}
unix:!macx:!freebsd*:LIBS += -ldl
DEFINES += IDE_TEST_DIR=\\\"$$IDE_SOURCE_TREE\\\"
......@@ -21,14 +19,16 @@ HEADERS += pluginerrorview.h \
pluginspec_p.h \
pluginview.h \
pluginview_p.h \
optionsparser.h
optionsparser.h \
iwelcomepage.h
SOURCES += pluginerrorview.cpp \
plugindetailsview.cpp \
iplugin.cpp \
pluginmanager.cpp \
pluginspec.cpp \
pluginview.cpp \
optionsparser.cpp
optionsparser.cpp \
iwelcomepage.cpp
FORMS += pluginview.ui \
pluginerrorview.ui \
plugindetailsview.ui
......
#include "iwelcomepage.h"
using namespace ExtensionSystem;
IWelcomePage::IWelcomePage()
{
}
#ifndef IWELCOMEPAGE_H
#define IWELCOMEPAGE_H
#include "extensionsystem_global.h"
#include <QObject>
namespace ExtensionSystem {
class IWelcomePagePrivate;
class EXTENSIONSYSTEM_EXPORT IWelcomePage : public QObject
{
Q_OBJECT
public:
IWelcomePage();
virtual QWidget *page() = 0;
virtual QString title() const = 0;
virtual int priority() const { return 0; }
private:
// not used atm
IWelcomePagePrivate *m_d;
};
}
#endif // IWELCOMEPAGE_H
......@@ -36,6 +36,18 @@
namespace Core {
namespace Utils {
void WelcomeModeLabel::setStyledText(const QString &text)
{
QString rc = QLatin1String(
"<html><head><style type=\"text/css\">p, li { white-space: pre-wrap; }</style></head>"
"<body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">"
"<p style=\" margin-top:16px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">"
"<span style=\" font-size:x-large; color:#555555;\">");
rc += text;
rc += QLatin1String("</span></p><hr/></body></html>");
setText(rc);
}
struct WelcomeModeTreeWidgetPrivate
{
WelcomeModeTreeWidgetPrivate() {}
......@@ -48,6 +60,8 @@ WelcomeModeTreeWidget::WelcomeModeTreeWidget(QWidget *parent) :
m_d->bullet = QIcon(QLatin1String(":/welcome/images/list_bullet_arrow.png"));
connect(this, SIGNAL(itemClicked(QTreeWidgetItem *, int)),
SLOT(slotItemClicked(QTreeWidgetItem *)));
viewport()->setAutoFillBackground(false);
}
WelcomeModeTreeWidget::~WelcomeModeTreeWidget()
......
......@@ -33,11 +33,22 @@
#include "utils_global.h"
#include <QtGui/QTreeWidget>
#include <QtGui/QLabel>
namespace Core {
namespace Utils {
struct WelcomeModeTreeWidgetPrivate;
struct WelcomeModeLabelPrivate;
class QTCREATOR_UTILS_EXPORT WelcomeModeLabel : public QLabel
{
Q_OBJECT
public:
WelcomeModeLabel(QWidget *parent) : QLabel(parent) {};
void setStyledText(const QString &text);
WelcomeModeLabelPrivate *m_d;
};
class QTCREATOR_UTILS_EXPORT WelcomeModeTreeWidget : public QTreeWidget
{
......
......@@ -32,10 +32,6 @@
#include <extensionsystem/iplugin.h>
namespace Core {
class IMode;
}
namespace Core {
namespace Internal {
......@@ -59,7 +55,6 @@ public slots:
private:
MainWindow *m_mainWindow;
Core::IMode *m_welcomeMode;
EditMode *m_editMode;
};
......
......@@ -22,6 +22,5 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<dependency name="Core" version="1.2.80"/>
<dependency name="Find" version="1.2.80"/>
<dependency name="QuickOpen" version="1.2.80"/>
<dependency name="Welcome" version="1.2.80"/>
</dependencyList>
</plugin>
......@@ -4,7 +4,6 @@ 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 \
......
......@@ -87,8 +87,8 @@
using namespace Help;
using namespace Help::Internal;
HelpManager::HelpManager(QHelpEngine *helpEngine)
: m_helpEngine(helpEngine)
HelpManager::HelpManager(Internal::HelpPlugin* plugin)
: m_plugin(plugin)
{
}
......@@ -96,7 +96,7 @@ void HelpManager::registerDocumentation(const QStringList &fileNames)
{
bool needsSetup = false;
{
QHelpEngineCore hc(m_helpEngine->collectionFile());
QHelpEngineCore hc(m_plugin->helpEngine()->collectionFile());
if (!hc.setupData())
qWarning() << "Could not initialize help engine:" << hc.error();
foreach (const QString &fileName, fileNames) {
......@@ -113,7 +113,17 @@ void HelpManager::registerDocumentation(const QStringList &fileNames)
}
}
if (needsSetup)
m_helpEngine->setupData();
m_plugin->helpEngine()->setupData();
}
void HelpManager::openHelpPage(const QString& url)
{
m_plugin->openHelpPage(url);
}
void HelpManager::openContextHelpPage(const QString& url)
{
m_plugin->openContextHelpPage(url);
}
HelpPlugin::HelpPlugin() :
......@@ -180,7 +190,7 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
connect(m_helpEngine, SIGNAL(setupFinished()), this,
SLOT(updateFilterComboBox()));
addAutoReleasedObject(new HelpManager(m_helpEngine));
addAutoReleasedObject(new HelpManager(this));
m_filterSettingsPage = new FilterSettingsPage(m_helpEngine);
addAutoReleasedObject(m_filterSettingsPage);
......@@ -430,6 +440,11 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
return true;
}
QHelpEngine* HelpPlugin::helpEngine() const
{
return m_helpEngine;
}
void HelpPlugin::createRightPaneSideBar()
{
QAction *switchToHelpMode = new QAction("Go to Help Mode", this);
......@@ -610,17 +625,6 @@ void HelpPlugin::extensionsInitialized()
updateFilterComboBox();
m_bookmarkManager->setupBookmarkModels();
using namespace Core::Internal;
using namespace Core::Constants;
Welcome::WelcomeMode *welcomeMode =
qobject_cast<Welcome::WelcomeMode*>(m_core->modeManager()->mode(MODE_WELCOME));
if (welcomeMode) {
connect(welcomeMode, SIGNAL(openHelpPage(QString)), this,
SLOT(openHelpPage(QString)));
connect(welcomeMode, SIGNAL(openContextHelpPage(QString)), this,
SLOT(openContextHelpPage(QString)));
}
#if !defined(QT_NO_WEBKIT)
QWebSettings* webSettings = QWebSettings::globalSettings();
QFont font(webSettings->fontFamily(QWebSettings::StandardFont),
......
......@@ -63,6 +63,7 @@ class SideBarItem;
namespace Help {
namespace Internal {
class CentralWidget;
class HelpPlugin;
}
namespace Constants {
......@@ -76,12 +77,14 @@ class HELP_EXPORT HelpManager : public QObject
{
Q_OBJECT
public:
HelpManager(QHelpEngine *helpEngine);
HelpManager(Internal::HelpPlugin*);
void registerDocumentation(const QStringList &fileNames);
void openHelpPage(const QString& url);
void openContextHelpPage(const QString &url);
private:
QHelpEngine *m_helpEngine;
Internal::HelpPlugin *m_plugin;
};
namespace Internal {
......@@ -108,6 +111,12 @@ public:
void setIndexFilter(const QString &filter);
QString indexFilter() const;
void openHelpPage(const QUrl& url);
void openHelpPage(const QString& url);
void openContextHelpPage(const QString &url);
QHelpEngine* helpEngine() const;
private slots:
void modeChanged(Core::IMode *mode);
void activateContext();
......@@ -128,10 +137,6 @@ private slots:
void slotHideRightPane();
void copyFromSideBar();
void openHelpPage(const QUrl& url);
void openHelpPage(const QString& url);
void openContextHelpPage(const QString &url);
void updateSideBarSource();
void updateSideBarSource(const QUrl &newUrl);
......
......@@ -94,7 +94,6 @@ plugin_projectexplorer.depends = plugin_quickopen
plugin_projectexplorer.depends += plugin_find
plugin_projectexplorer.depends += plugin_coreplugin
plugin_projectexplorer.depends += plugin_texteditor
plugin_projectexplorer.depends += plugin_welcome
plugin_qt4projectmanager.subdir = qt4projectmanager
plugin_qt4projectmanager.depends = plugin_texteditor
......@@ -103,7 +102,6 @@ plugin_qt4projectmanager.depends += plugin_cpptools
plugin_qt4projectmanager.depends += plugin_cppeditor
plugin_qt4projectmanager.depends += plugin_help
plugin_qt4projectmanager.depends += plugin_designer
plugin_qt4projectmanager.depends += plugin_welcome
plugin_quickopen.subdir = quickopen
plugin_quickopen.depends = plugin_coreplugin
......@@ -144,7 +142,6 @@ plugin_help.subdir = help
plugin_help.depends = plugin_find
plugin_help.depends += plugin_quickopen
plugin_help.depends += plugin_coreplugin
plugin_help.depends += plugin_welcome
plugin_resourceeditor.subdir = resourceeditor
plugin_resourceeditor.depends = plugin_coreplugin
......
......@@ -23,6 +23,5 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<dependency name="Find" version="1.2.80"/>
<dependency name="QuickOpen" version="1.2.80"/>
<dependency name="TextEditor" version="1.2.80"/>
<dependency name="Welcome" version="1.2.80"/>
</dependencyList>
</plugin>
......@@ -57,6 +57,8 @@
#include "sessiondialog.h"
#include "buildparserfactory.h"
#include "projectexplorersettingspage.h"
#include "projectwelcomepage.h"
#include "projectwelcomepagewidget.h"
#include <coreplugin/basemode.h>
#include <coreplugin/coreconstants.h>
......@@ -140,6 +142,7 @@ ProjectExplorerPlugin::ProjectExplorerPlugin()
ProjectExplorerPlugin::~ProjectExplorerPlugin()
{
removeObject(m_welcomePlugin);
removeObject(this);
}
......@@ -156,6 +159,11 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
Core::ICore *core = Core::ICore::instance();
Core::ActionManager *am = core->actionManager();
m_welcomePlugin = new ProjectWelcomePage;
m_welcomePage = qobject_cast<Internal::ProjectWelcomePageWidget*>(m_welcomePlugin->page());
Q_ASSERT(m_welcomePage);
connect(m_welcomePage, SIGNAL(manageSessions()), this, SLOT(showSessionManager()));
addObject(m_welcomePlugin);
addObject(this);
connect(core->fileManager(), SIGNAL(currentFileChanged(QString)),
......@@ -646,10 +654,6 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
m_projectExplorerSettings.showCompilerOutput = s->value("ProjectExplorer/Settings/ShowCompilerOutput", false).toBool();
}
if (Welcome::WelcomeMode *welcomeMode = qobject_cast<Welcome::WelcomeMode*>
(Core::ICore::instance()->modeManager()->mode(Core::Constants::MODE_WELCOME))) {
connect(welcomeMode, SIGNAL(manageSessions()), this, SLOT(showSessionManager()));
}
connect(m_sessionManagerAction, SIGNAL(triggered()), this, SLOT(showSessionManager()));
connect(m_newAction, SIGNAL(triggered()), this, SLOT(newProject()));
#if 0
......@@ -685,6 +689,8 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
this, SLOT(determineSessionToRestoreAtStartup()));
connect(Core::ICore::instance(), SIGNAL(coreOpened()), this, SLOT(restoreSession()));
updateWelcomePage();
return true;
}
......@@ -835,9 +841,7 @@ void ProjectExplorerPlugin::showSessionManager()
Core::ModeManager *modeManager = Core::ModeManager::instance();
Core::IMode *welcomeMode = modeManager->mode(Core::Constants::MODE_WELCOME);
if (modeManager->currentMode() == welcomeMode)
{
updateWelcomePage(qobject_cast<Welcome::WelcomeMode*>(welcomeMode));
}
updateWelcomePage();
}
void ProjectExplorerPlugin::setStartupProject(Project *project)
......@@ -1019,20 +1023,19 @@ Project *ProjectExplorerPlugin::startupProject() const
}
// update welcome page
void ProjectExplorerPlugin::updateWelcomePage(Welcome::WelcomeMode *welcomeMode)
void ProjectExplorerPlugin::updateWelcomePage()
{
Welcome::WelcomeMode::WelcomePageData welcomePageData;
ProjectWelcomePageWidget::WelcomePageData welcomePageData;
welcomePageData.sessionList = m_session->sessions();
welcomePageData.activeSession = m_session->activeSession();
welcomePageData.previousSession = m_session->lastSession();
welcomePageData.projectList = m_recentProjects;
welcomeMode->updateWelcomePage(welcomePageData);
m_welcomePage->updateWelcomePage(welcomePageData);
}
void ProjectExplorerPlugin::currentModeChanged(Core::IMode *mode)
void ProjectExplorerPlugin::currentModeChanged(Core::IMode *)
{
if (Welcome::WelcomeMode *welcomeMode = qobject_cast<Welcome::WelcomeMode*>(mode))
updateWelcomePage(welcomeMode);
updateWelcomePage();
}
void ProjectExplorerPlugin::determineSessionToRestoreAtStartup()
......@@ -1080,11 +1083,8 @@ void ProjectExplorerPlugin::restoreSession()
// update welcome page
Core::ModeManager *modeManager = Core::ModeManager::instance();
connect(modeManager, SIGNAL(currentModeChanged(Core::IMode*)), this, SLOT(currentModeChanged(Core::IMode*)));
if (Welcome::WelcomeMode *welcomeMode = qobject_cast<Welcome::WelcomeMode*>(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)));
}
connect(m_welcomePage, SIGNAL(requestSession(QString)), this, SLOT(loadSession(QString)));
connect(m_welcomePage, SIGNAL(requestProject(QString)), this, SLOT(loadProject(QString)));
Core::ICore::instance()->openFiles(arguments);
updateActions();
......
......@@ -72,6 +72,8 @@ class ApplicationOutput;
class OutputPane;
class ProjectWindow;
class ProjectFileFactory;
class ProjectWelcomePage;
class ProjectWelcomePageWidget;
struct ProjectExplorerSettings
{
......@@ -209,7 +211,7 @@ private:
void updateActions();
void addToRecentProjects(const QString &fileName, const QString &displayName);
void updateWelcomePage(Welcome::WelcomeMode *welcomeMode);
void updateWelcomePage();
Internal::ProjectFileFactory *findProjectFileFactory(const QString &filename) const;
static ProjectExplorerPlugin *m_instance;
......@@ -279,6 +281,8 @@ private:
QString m_runMode;
QString m_projectFilterString;
Internal::ProjectExplorerSettings m_projectExplorerSettings;
Internal::ProjectWelcomePage *m_welcomePlugin;
Internal::ProjectWelcomePageWidget *m_welcomePage;
};
namespace Internal {
......
......@@ -61,7 +61,9 @@ HEADERS += projectexplorer.h \
filewatcher.h \
debugginghelper.h \
abstractmakestep.h \
projectexplorersettingspage.h
projectexplorersettingspage.h \
projectwelcomepage.h \
projectwelcomepagewidget.h
SOURCES += projectexplorer.cpp \
projectwindow.cpp \
buildmanager.cpp \
......@@ -111,7 +113,9 @@ SOURCES += projectexplorer.cpp \
filewatcher.cpp \
debugginghelper.cpp \
abstractmakestep.cpp \
projectexplorersettingspage.cpp
projectexplorersettingspage.cpp \
projectwelcomepage.cpp \
projectwelcomepagewidget.cpp
FORMS += processstep.ui \
editorsettingspropertiespage.ui \
runsettingspropertiespage.ui \
......@@ -119,7 +123,8 @@ FORMS += processstep.ui \
projectwizardpage.ui \
buildstepspage.ui \
removefiledialog.ui \
projectexplorersettingspage.ui
projectexplorersettingspage.ui \
projectwelcomepagewidget.ui
win32 {
SOURCES += applicationlauncher_win.cpp \
winguiprocess.cpp
......
......@@ -3,4 +3,3 @@ 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)
/**************************************************************************
**
** 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 "projectwelcomepage.h"
#include "projectwelcomepagewidget.h"
namespace ProjectExplorer {
namespace Internal {
ProjectWelcomePage::ProjectWelcomePage()
: m_page(new ProjectWelcomePageWidget)
{
}
QWidget* ProjectWelcomePage::page()
{
return m_page;
}
} // namespace Internal
} // namespace ProjectExplorer
/**************************************************************************
**
** 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 PROJECTWELCOMEPAGE_H
#define PROJECTWELCOMEPAGE_H
#include <extensionsystem/iwelcomepage.h>
namespace ProjectExplorer {
namespace Internal {
class ProjectWelcomePageWidget;
class ProjectWelcomePage : public ExtensionSystem::IWelcomePage
{
Q_OBJECT
public:
ProjectWelcomePage();
QWidget *page();
QString title() const { return tr("Develop"); }
int priority() const { return 20; }
private:
ProjectWelcomePageWidget *m_page;
};
} // namespace Internal
} // namespace ProjectExplorer
#endif // PROJECTWELCOMEPAGE_H
/**************************************************************************
**
** 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 "projectwelcomepagewidget.h"
#include "ui_projectwelcomepagewidget.h"
#include <coreplugin/coreconstants.h>
#include <coreplugin/uniqueidmanager.h>
#include <coreplugin/modemanager.h>
#include <coreplugin/icore.h>
#include <coreplugin/dialogs/iwizard.h>
#include <QtCore/QFileInfo>
#include <QtCore/QDir>