Merge branch 'master' of git@scm.dev.nokia.troll.no:creator/mainline

This commit is contained in:
Erik Verbruggen
2009-07-28 16:35:13 +02:00
49 changed files with 15268 additions and 1306 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -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

View File

@@ -0,0 +1,8 @@
#include "iwelcomepage.h"
using namespace ExtensionSystem;
IWelcomePage::IWelcomePage()
{
}

View File

@@ -0,0 +1,31 @@
#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

View File

@@ -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()

View File

@@ -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
{

View File

@@ -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;
};

View File

@@ -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>

View File

@@ -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 \

View File

@@ -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),

View File

@@ -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);

View File

@@ -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

View File

@@ -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>

View File

@@ -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();

View File

@@ -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 {

View File

@@ -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

View File

@@ -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)

View File

@@ -0,0 +1,48 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://www.qtsoftware.com/contact.
**
**************************************************************************/
#include "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

View File

@@ -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 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

View File

@@ -0,0 +1,157 @@
/**************************************************************************
**
** 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>
#include <QtCore/QPair>
#include <QtGui/QLabel>
#include <QtGui/QTreeWidgetItem>
#include <QtCore/QDebug>
using namespace ProjectExplorer::Internal;
bool ProjectWelcomePageWidget::WelcomePageData::operator==(const WelcomePageData &rhs) const
{
return previousSession == rhs.previousSession
&& activeSession == rhs.activeSession
&& sessionList == rhs.sessionList
&& projectList == rhs.projectList;
}
bool ProjectWelcomePageWidget::WelcomePageData::operator!=(const WelcomePageData &rhs) const
{
return previousSession != rhs.previousSession
|| activeSession != rhs.activeSession
|| sessionList != rhs.sessionList
|| projectList != rhs.projectList;
}
QDebug operator<<(QDebug dgb, const ProjectWelcomePageWidget::WelcomePageData &d)
{
dgb.nospace() << "PreviousSession=" << d.previousSession
<< " activeSession=" << d.activeSession
<< " sessionList=" << d.sessionList
<< " projectList=" << d.projectList;
return dgb;
}
ProjectWelcomePageWidget::ProjectWelcomePageWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::ProjectWelcomePageWidget)
{
ui->setupUi(this);
ui->projTitleLabel->setStyledText(tr("Open Recent Project"));
ui->recentSessionsTitleLabel->setStyledText(tr("Resume Session"));
updateWelcomePage(WelcomePageData());
connect(ui->sessTreeWidget, SIGNAL(activated(QString)), SLOT(slotSessionClicked(QString)));
connect(ui->projTreeWidget, SIGNAL(activated(QString)), SLOT(slotProjectClicked(QString)));
connect(ui->createNewProjectButton, SIGNAL(clicked()), SLOT(slotCreateNewProject()));
connect(ui->manageSessionsButton, SIGNAL(clicked()), SIGNAL(manageSessions()));
}
ProjectWelcomePageWidget::~ProjectWelcomePageWidget()
{
delete ui;
}
void ProjectWelcomePageWidget::updateWelcomePage(const WelcomePageData &welcomePageData)
{
// Update only if data are modified
if (welcomePageData == lastData)
return;
lastData = welcomePageData;
setUpdatesEnabled(false);
ui->sessTreeWidget->clear();
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);
ui->sessTreeWidget->addItem(str, s);
}
ui->sessTreeWidget->updateGeometry();
ui->sessTreeWidget->show();
} else {
ui->sessTreeWidget->hide();
}
typedef QPair<QString, QString> QStringPair;
if (welcomePageData.projectList.count() > 0) {
foreach (const QStringPair &it, welcomePageData.projectList) {
QTreeWidgetItem *item = ui->projTreeWidget->addItem(it.second, it.first);
const QFileInfo fi(it.first);
item->setToolTip(1, QDir::toNativeSeparators(fi.absolutePath()));
}
} else {
ui->projTreeWidget->hide();
}
ui->projTreeWidget->updateGeometry();
setUpdatesEnabled(true);
}
void ProjectWelcomePageWidget::activateEditMode()
{
Core::ModeManager *modeManager = Core::ModeManager::instance();
if (modeManager->currentMode() == modeManager->mode(Core::Constants::MODE_WELCOME))
modeManager->activateMode(Core::Constants::MODE_EDIT);
}
void ProjectWelcomePageWidget::slotSessionClicked(const QString &data)
{
emit requestSession(data);
activateEditMode();
}
void ProjectWelcomePageWidget::slotProjectClicked(const QString &data)
{
emit requestProject(data);
activateEditMode();
}
void ProjectWelcomePageWidget::slotCreateNewProject()
{
Core::ICore::instance()->showNewItemDialog(tr("New Project..."),
Core::IWizard::wizardsOfKind(Core::IWizard::ProjectWizard));
}

View File

@@ -0,0 +1,81 @@
/**************************************************************************
**
** 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 PROJECTWELCOMEPAGEWIDGET_H
#define PROJECTWELCOMEPAGEWIDGET_H
#include <QtGui/QWidget>
namespace ProjectExplorer {
namespace Internal {
namespace Ui {
class ProjectWelcomePageWidget;
}
class ProjectWelcomePageWidget : public QWidget {
Q_OBJECT
public:
ProjectWelcomePageWidget(QWidget *parent = 0);
~ProjectWelcomePageWidget();
struct WelcomePageData{
bool operator==(const WelcomePageData &rhs) const;
bool operator!=(const WelcomePageData &rhs) const;
QString previousSession;
QString activeSession;
QStringList sessionList;
QList<QPair<QString, QString> > projectList; // pair of filename, displayname
};
void updateWelcomePage(const WelcomePageData &welcomePageData);
signals:
void requestProject(const QString &project);
void requestSession(const QString &session);
void manageSessions();
private slots:
void slotSessionClicked(const QString &data);
void slotProjectClicked(const QString &data);
void slotCreateNewProject();
private:
void activateEditMode();
Ui::ProjectWelcomePageWidget *ui;
WelcomePageData lastData;
};
}
}
#endif // PROJECTWELCOMEPAGEWIDGET_H

View File

@@ -0,0 +1,259 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ProjectExplorer::Internal::ProjectWelcomePageWidget</class>
<widget class="QWidget" name="ProjectExplorer::Internal::ProjectWelcomePageWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>667</width>
<height>365</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QFrame" name="recentSessionsFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>270</width>
<height>130</height>
</size>
</property>
<property name="styleSheet">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="horizontalSpacing">
<number>0</number>
</property>
<property name="verticalSpacing">
<number>3</number>
</property>
<item row="0" column="0" colspan="3">
<widget class="Core::Utils::WelcomeModeLabel" name="recentSessionsTitleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3">
<widget class="Core::Utils::WelcomeModeTreeWidget" name="sessTreeWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="uniformRowHeights">
<bool>true</bool>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<property name="columnCount">
<number>2</number>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<attribute name="headerDefaultSectionSize">
<number>24</number>
</attribute>
<attribute name="headerMinimumSectionSize">
<number>0</number>
</attribute>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
<column>
<property name="text">
<string notr="true">2</string>
</property>
</column>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="manageSessionsButton">
<property name="focusPolicy">
<enum>Qt::TabFocus</enum>
</property>
<property name="text">
<string>Manage Sessions...</string>
</property>
</widget>
</item>
<item row="4" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="recentProjectsFrame">
<property name="styleSheet">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<property name="horizontalSpacing">
<number>0</number>
</property>
<property name="verticalSpacing">
<number>3</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<item row="0" column="0" colspan="3">
<widget class="Core::Utils::WelcomeModeLabel" name="projTitleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3">
<widget class="Core::Utils::WelcomeModeTreeWidget" name="projTreeWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="uniformRowHeights">
<bool>true</bool>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<property name="columnCount">
<number>2</number>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<attribute name="headerDefaultSectionSize">
<number>24</number>
</attribute>
<attribute name="headerMinimumSectionSize">
<number>0</number>
</attribute>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
<column>
<property name="text">
<string notr="true">2</string>
</property>
</column>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="createNewProjectButton">
<property name="focusPolicy">
<enum>Qt::TabFocus</enum>
</property>
<property name="text">
<string>Create New Project...</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Core::Utils::WelcomeModeTreeWidget</class>
<extends>QTreeWidget</extends>
<header>utils/welcomemodetreewidget.h</header>
</customwidget>
<customwidget>
<class>Core::Utils::WelcomeModeLabel</class>
<extends>QLabel</extends>
<header>utils/welcomemodetreewidget.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,21 @@
<ui version="4.0" >
<author/>
<comment/>
<exportmacro/>
<class>ProjectWelcomePage</class>
<widget class="QWidget" name="ProjectWelcomePage" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle" >
<string>Form</string>
</property>
</widget>
<pixmapfunction/>
<connections/>
</ui>

View File

@@ -25,6 +25,5 @@ will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.</license>
<dependency name="CppEditor" version="1.2.80"/>
<dependency name="Help" version="1.2.80"/>
<dependency name="Designer" version="1.2.80"/>
<dependency name="Welcome" version="1.2.80"/>
</dependencyList>
</plugin>

View File

@@ -0,0 +1,47 @@
/**************************************************************************
**
** 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 "gettingstartedwelcomepage.h"
#include "gettingstartedwelcomepagewidget.h"
namespace Qt4ProjectManager {
namespace Internal {
GettingStartedWelcomePage::GettingStartedWelcomePage()
: m_page(new GettingStartedWelcomePageWidget)
{
}
QWidget* GettingStartedWelcomePage::page()
{
return m_page;
}
} // namespace Internal
} // namespace Qt4ProjectManager

View File

@@ -0,0 +1,56 @@
/**************************************************************************
**
** 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 GETTINGSTARTEDWELCOMEPLUGIN_H
#define GETTINGSTARTEDWELCOMEPLUGIN_H
#include <extensionsystem/iwelcomepage.h>
namespace Qt4ProjectManager {
namespace Internal {
class GettingStartedWelcomePageWidget;
class GettingStartedWelcomePage : public ExtensionSystem::IWelcomePage
{
public:
GettingStartedWelcomePage();
QWidget *page();
QString title() const { return tr("Getting Started");}
int priority() const { return 10; }
private:
GettingStartedWelcomePageWidget *m_page;
};
} // namespace Internal
} // namespace Qt4ProjectManager
#endif // GETTINGSTARTEDWELCOMEPLUGIN_H

View File

@@ -0,0 +1,259 @@
/**************************************************************************
**
** 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 "gettingstartedwelcomepagewidget.h"
#include "ui_gettingstartedwelcomepagewidget.h"
#include <coreplugin/icore.h>
#include <coreplugin/coreconstants.h>
#include <extensionsystem/pluginmanager.h>
#include <help/helpplugin.h>
#include <QtCore/QDateTime>
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
#include <QtCore/QDebug>
#include <QtCore/QUrl>
#include <QtCore/QXmlStreamReader>
#include <QtGui/QFont>
namespace Qt4ProjectManager {
namespace Internal {
// TODO: remove
GettingStartedWelcomePageWidget::GettingStartedWelcomePageWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::GettingStartedWelcomePageWidget)
{
ui->setupUi(this);
ui->tutorialsTitleLabel->setStyledText(tr("Tutorials"));
ui->demoTitleLabel->setStyledText(tr("Explore Qt Examples"));
ui->didYouKnowTextBrowser->viewport()->setAutoFillBackground(false);
ui->didYouKnowTitleLabel->setStyledText(tr("Did You Know?"));
connect(ui->tutorialTreeWidget, SIGNAL(activated(QString)), SLOT(slotOpenHelpPage(const QString&)));
connect(ui->openExampleButton, SIGNAL(clicked()), SLOT(slotOpenExample()));
connect(ui->examplesComboBox, SIGNAL(currentIndexChanged(int)), SLOT(slotEnableExampleButton(int)));
ui->tutorialTreeWidget->addItem(tr("<b>Qt Creator - A quick tour</b>"),
QString("qthelp://com.nokia.qtcreator.%1%2/doc/index.html").arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR));
ui->tutorialTreeWidget->addItem(tr("Creating an address book"),
QLatin1String("qthelp://com.nokia.qtcreator/doc/tutorials-addressbook-sdk.html"));
ui->tutorialTreeWidget->addItem(tr("Understanding widgets"),
QLatin1String("qthelp://com.trolltech.qt/qdoc/widgets-tutorial.html"));
ui->tutorialTreeWidget->addItem(tr("Building with qmake"),
QLatin1String("qthelp://com.trolltech.qmake/qdoc/qmake-tutorial.html"));
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_currentTip = rand()%tips.count();
QTextDocument *doc = ui->didYouKnowTextBrowser->document();
doc->setDefaultStyleSheet("a:link {color:black;}");
ui->didYouKnowTextBrowser->setDocument(doc);
ui->didYouKnowTextBrowser->setText(tips.at(m_currentTip));
connect(ui->nextTipBtn, SIGNAL(clicked()), this, SLOT(slotNextTip()));
connect(ui->prevTipBtn, SIGNAL(clicked()), this, SLOT(slotPrevTip()));
}
GettingStartedWelcomePageWidget::~GettingStartedWelcomePageWidget()
{
delete ui;
}
void GettingStartedWelcomePageWidget::updateExamples(const QString& examplePath, const QString& demosPath, const QString &sourcePath)
{
QString demoxml = demosPath + "/qtdemo/xml/examples.xml";
if (!QFile::exists(demoxml)) {
demoxml = sourcePath + "/demos/qtdemo/xml/examples.xml";
if (!QFile::exists(demoxml))
return;
}
QFile description(demoxml);
if (!description.open(QFile::ReadOnly))
return;
ui->examplesComboBox->clear();
ui->examplesComboBox->setEnabled(true);
ui->examplesComboBox->addItem(tr("Choose an example..."));
QFont f = font();
f.setItalic(true);
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();
ui->examplesComboBox->addItem(name);
f.setBold(true);
ui->examplesComboBox->setItemData(ui->examplesComboBox->count()-1, f, Qt::FontRole);
f.setBold(false);
inExamples = true;
}
if (inExamples && reader.name() == "example") {
QString name = reader.attributes().value(QLatin1String("name")).toString();
QString fn = reader.attributes().value(QLatin1String("filename")).toString();
QString relativeProPath = '/' + dirName + '/' + fn + '/' + fn + ".pro";
QString fileName = examplePath + relativeProPath;
if (!QFile::exists(fileName))
fileName = sourcePath + "/examples" + relativeProPath;
QString helpPath = "qthelp://com.trolltech.qt/qdoc/" + dirName.replace("/", "-") + "-" + fn + ".html";
ui->examplesComboBox->addItem(" " + name, fileName);
ui->examplesComboBox->setItemData(ui->examplesComboBox->count()-1, helpPath, Qt::UserRole+1);
}
break;
case QXmlStreamReader::EndElement:
if (reader.name() == "category")
inExamples = false;
break;
default:
break;
}
}
}
void GettingStartedWelcomePageWidget::slotEnableExampleButton(int index)
{
QString fileName = ui->examplesComboBox->itemData(index, Qt::UserRole).toString();
ui->openExampleButton->setEnabled(!fileName.isEmpty());
}
void GettingStartedWelcomePageWidget::slotOpenExample()
{
QComboBox *box = 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);
slotOpenContextHelpPage(helpFile);
}
void GettingStartedWelcomePageWidget::slotOpenHelpPage(const QString& url)
{
Help::HelpManager *helpManager
= ExtensionSystem::PluginManager::instance()->getObject<Help::HelpManager>();
Q_ASSERT(helpManager);
helpManager->openHelpPage(url);
}
void GettingStartedWelcomePageWidget::slotOpenContextHelpPage(const QString& url)
{
Help::HelpManager *helpManager
= ExtensionSystem::PluginManager::instance()->getObject<Help::HelpManager>();
Q_ASSERT(helpManager);
helpManager->openContextHelpPage(url);
}
void GettingStartedWelcomePageWidget::slotNextTip()
{
QStringList tips = tipsOfTheDay();
m_currentTip = ((m_currentTip+1)%tips.count());
ui->didYouKnowTextBrowser->setText(tips.at(m_currentTip));
}
void GettingStartedWelcomePageWidget::slotPrevTip()
{
QStringList tips = tipsOfTheDay();
m_currentTip = ((m_currentTip-1)+tips.count())%tips.count();
ui->didYouKnowTextBrowser->setText(tips.at(m_currentTip));
}
QStringList GettingStartedWelcomePageWidget::tipsOfTheDay()
{
static QStringList tips;
if (tips.isEmpty()) {
QString altShortcut =
#ifdef Q_WS_MAC
tr("Cmd", "Shortcut key");
#else
tr("Alt", "Shortcut key");
#endif
tips.append(tr("You can switch between Qt Creator's modes using <tt>Ctrl+number</tt>:<ul>"
"<li>1 - Welcome</li><li>2 - Edit</li><li>3 - Debug</li><li>4 - Projects</li><li>5 - Help</li>"
"<li></li><li>6 - Output</li></ul>"));
//:%1 gets replaced by Alt (Win/Unix) or Cmd (Mac)
tips.append(tr("You can show and hide the side bar using <tt>%1+0<tt>.").arg(altShortcut));
tips.append(tr("You can fine tune the <tt>Find</tt> function by selecting &quot;Whole Words&quot; "
"or &quot;Case Sensitive&quot;. Simply click on the icons on the right end of the line edit."));
tips.append(tr("If you add <a href=\"qthelp://com.nokia.qtcreator/doc/creator-external-library-handling.html\""
">external libraries</a>, Qt Creator will automatically offer syntax highlighting "
"and code completion."));
tips.append(tr("The code completion is CamelCase-aware. For example, to complete <tt>namespaceUri</tt> "
"you can just type <tt>nU</tt> and hit <tt>Ctrl+Space</tt>."));
tips.append(tr("You can force code completion at any time using <tt>Ctrl+Space</tt>."));
tips.append(tr("You can start Qt Creator with a session by calling <tt>qtcreator &lt;sessionname&gt;</tt>."));
tips.append(tr("You can return to edit mode from any other mode at any time by hitting <tt>Escape</tt>."));
//:%1 gets replaced by Alt (Win/Unix) or Cmd (Mac)
tips.append(tr("You can switch between the output pane by hitting <tt>%1+n</tt> where n is the number denoted "
"on the buttons at the window bottom:"
"<ul><li>1 - Build Issues</li><li>2 - Search Results</li><li>3 - Application Output</li>"
"<li>4 - Compile Output</li></ul>").arg(altShortcut));
tips.append(tr("You can quickly search methods, classes, help and more using the "
"<a href=\"qthelp://com.nokia.qtcreator/doc/creator-navigation.html\">Locator bar</a> (<tt>Ctrl+K</tt>)."));
tips.append(tr("You can add custom build steps in the "
"<a href=\"qthelp://com.nokia.qtcreator/doc/creator-build-settings.html\">build settings</a>."));
tips.append(tr("Within a session, you can add "
"<a href=\"qthelp://com.nokia.qtcreator/doc/creator-build-settings.html#dependencies\">dependencies</a> between projects."));
tips.append(tr("You can set the preferred editor encoding for every project in <tt>Projects -> Editor Settings -> Default Encoding</tt>."));
tips.append(tr("You can modify the binary that is being executed when you press the <tt>Run</tt> button: Add a <tt>Custom Executable</tt> "
"by clicking the <tt>+</tt> button in <tt>Projects -> Run Settings -> Run Configuration</tt> and then select the new "
"target in the combo box."));
tips.append(tr("You can use Qt Creator with a number of <a href=\"qthelp://com.nokia.qtcreator/doc/creator-version-control.html\">"
"revision control systems</a> such as Subversion, Perforce and Git."));
tips.append(tr("In the editor, <tt>F2</tt> toggles declaration and definition while <tt>F4</tt> toggles header file and source file."));
}
return tips;
}
} // namespace Internal
} // namespace Qt4ProjectManager

View File

@@ -0,0 +1,69 @@
/**************************************************************************
**
** 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 GETTINGSTARTEDWELCOMEPAGEWIDGET_H
#define GETTINGSTARTEDWELCOMEPAGEWIDGET_H
#include <QWidget>
namespace Qt4ProjectManager {
namespace Internal {
namespace Ui {
class GettingStartedWelcomePageWidget;
}
class GettingStartedWelcomePageWidget : public QWidget {
Q_OBJECT
public:
GettingStartedWelcomePageWidget(QWidget *parent = 0);
~GettingStartedWelcomePageWidget();
public slots:
void updateExamples(const QString& examplePath, const QString& demosPath, const QString &sourcePath);
private slots:
void slotOpenHelpPage(const QString& url);
void slotOpenContextHelpPage(const QString& url);
void slotEnableExampleButton(int);
void slotOpenExample();
void slotNextTip();
void slotPrevTip();
private:
QStringList tipsOfTheDay();
Ui::GettingStartedWelcomePageWidget *ui;
int m_currentTip;
};
} // namespace Internal
} // namespace Qt4ProjectManager
#endif // GETTINGSTARTEDWELCOMEPAGEWIDGET_H

View File

@@ -0,0 +1,348 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Qt4ProjectManager::Internal::GettingStartedWelcomePageWidget</class>
<widget class="QWidget" name="Qt4ProjectManager::Internal::GettingStartedWelcomePageWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>646</width>
<height>361</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" rowspan="2">
<widget class="QFrame" name="tutorialsFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>400</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
<widget class="Core::Utils::WelcomeModeLabel" name="tutorialsTitleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="Core::Utils::WelcomeModeTreeWidget" name="tutorialTreeWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="uniformRowHeights">
<bool>true</bool>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<property name="columnCount">
<number>2</number>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<attribute name="headerDefaultSectionSize">
<number>24</number>
</attribute>
<attribute name="headerMinimumSectionSize">
<number>0</number>
</attribute>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
<column>
<property name="text">
<string notr="true">2</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<widget class="QFrame" name="demosExamplesFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>400</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout_8">
<property name="rightMargin">
<number>8</number>
</property>
<property name="horizontalSpacing">
<number>0</number>
</property>
<item row="0" column="0" colspan="4">
<widget class="Core::Utils::WelcomeModeLabel" name="demoTitleLabel">
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QComboBox" name="examplesComboBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Examples not installed</string>
</property>
</item>
</widget>
</item>
<item row="1" column="2">
<widget class="QToolButton" name="openExampleButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Open</string>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>6</width>
<height>6</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="1" column="1">
<widget class="QFrame" name="didyouKnowFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>400</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout_11">
<property name="rightMargin">
<number>9</number>
</property>
<item row="0" column="0">
<widget class="Core::Utils::WelcomeModeLabel" name="didYouKnowTitleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QTextBrowser" name="didYouKnowTextBrowser">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QGridLayout" name="gridLayout_10">
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0" colspan="2">
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>2</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QToolButton" name="prevTipBtn">
<property name="styleSheet">
<string notr="true">QToolButton{
border-right:solid 0 px;
height:16px;
width:12px;
}
</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../welcome/welcome.qrc">
<normaloff>:/welcome/images/arrow-left.png</normaloff>:/welcome/images/arrow-left.png</iconset>
</property>
<property name="arrowType">
<enum>Qt::NoArrow</enum>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QToolButton" name="nextTipBtn">
<property name="styleSheet">
<string notr="true">QToolButton{
border-left:solid 0 px;
height:16px;
width:12px;
}
</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../welcome/welcome.qrc">
<normaloff>:/welcome/images/arrow-right.png</normaloff>:/welcome/images/arrow-right.png</iconset>
</property>
<property name="arrowType">
<enum>Qt::NoArrow</enum>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>2</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Core::Utils::WelcomeModeTreeWidget</class>
<extends>QTreeWidget</extends>
<header>utils/welcomemodetreewidget.h</header>
</customwidget>
<customwidget>
<class>Core::Utils::WelcomeModeLabel</class>
<extends>QLabel</extends>
<header>utils/welcomemodetreewidget.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../welcome/welcome.qrc"/>
</resources>
<connections/>
</ui>

View File

@@ -3,7 +3,6 @@ TARGET = Qt4ProjectManager
QT += network
include(../../qtcreatorplugin.pri)
include(qt4projectmanager_dependencies.pri)
HEADERS += qt4projectmanagerplugin.h \
qt4projectmanager.h \
qt4project.h \
@@ -39,7 +38,9 @@ HEADERS += qt4projectmanagerplugin.h \
qtversionmanager.h \
qtoptionspage.h \
qtuicodemodelsupport.h \
externaleditors.h
externaleditors.h \
gettingstartedwelcomepagewidget.h \
gettingstartedwelcomepage.h
SOURCES += qt4projectmanagerplugin.cpp \
qt4projectmanager.cpp \
qt4project.cpp \
@@ -73,19 +74,20 @@ SOURCES += qt4projectmanagerplugin.cpp \
qtversionmanager.cpp \
qtoptionspage.cpp \
qtuicodemodelsupport.cpp \
externaleditors.cpp
externaleditors.cpp \
gettingstartedwelcomepagewidget.cpp \
gettingstartedwelcomepage.cpp
FORMS += makestep.ui \
qmakestep.ui \
qt4projectconfigwidget.ui \
embeddedpropertiespage.ui \
qtversionmanager.ui \
showbuildlog.ui
showbuildlog.ui \
gettingstartedwelcomepagewidget.ui
RESOURCES += qt4projectmanager.qrc \
wizards/wizards.qrc
include(../../shared/proparser/proparser.pri)
include(qt-s60/qt-s60.pri)
include(customwidgetwizard/customwidgetwizard.pri)
DEFINES += QT_NO_CAST_TO_ASCII
OTHER_FILES += Qt4ProjectManager.pluginspec

View File

@@ -3,4 +3,3 @@ include(../../plugins/cpptools/cpptools.pri)
include(../../plugins/cppeditor/cppeditor.pri)
include(../../plugins/help/help.pri)
include(../../plugins/designer/designer.pri)
include(../../plugins/welcome/welcome.pri)

View File

@@ -44,6 +44,8 @@
#include "qtversionmanager.h"
#include "qtoptionspage.h"
#include "externaleditors.h"
#include "gettingstartedwelcomepage.h"
#include "gettingstartedwelcomepagewidget.h"
#ifdef QTCREATOR_WITH_S60
#include "qt-s60/s60manager.h"
@@ -82,6 +84,8 @@ Qt4ProjectManagerPlugin::~Qt4ProjectManagerPlugin()
delete m_proFileEditorFactory;
removeObject(m_qt4ProjectManager);
delete m_qt4ProjectManager;
removeObject(m_welcomePage);
delete m_welcomePage;
}
/*
static Core::Command *createSeparator(Core::ActionManager *am,
@@ -106,9 +110,16 @@ bool Qt4ProjectManagerPlugin::initialize(const QStringList &arguments, QString *
m_projectExplorer = ProjectExplorer::ProjectExplorerPlugin::instance();
Core::ActionManager *am = core->actionManager();
addAutoReleasedObject(new QtVersionManager());
QtVersionManager *mgr = new QtVersionManager();
addAutoReleasedObject(mgr);
addAutoReleasedObject(new QtOptionsPage());
m_welcomePage = new GettingStartedWelcomePage;
addObject(m_welcomePage);
GettingStartedWelcomePageWidget *gswp =
static_cast<GettingStartedWelcomePageWidget*>(m_welcomePage->page());
connect(mgr, SIGNAL(updateExamples(QString,QString,QString)),
gswp, SLOT(updateExamples(QString,QString,QString)));
//create and register objects
m_qt4ProjectManager = new Qt4Manager(this);

View File

@@ -49,6 +49,7 @@ class MakeStepFactory;
class GccParserFactory;
class MsvcParserFactory;
class EmbeddedPropertiesPage;
class GettingStartedWelcomePage;
class Qt4ProjectManagerPlugin : public ExtensionSystem::IPlugin
{
@@ -81,6 +82,7 @@ private:
QAction *m_runQMakeAction;
QAction *m_runQMakeActionContextMenu;
GettingStartedWelcomePage *m_welcomePage;
};
} // namespace Internal

View File

@@ -42,7 +42,6 @@
#include <coreplugin/coreconstants.h>
#include <coreplugin/icore.h>
#include <coreplugin/modemanager.h>
#include <welcome/welcomemode.h>
#include <extensionsystem/pluginmanager.h>
#include <help/helpplugin.h>
#include <utils/qtcassert.h>
@@ -51,6 +50,7 @@
#include <QtCore/QProcess>
#include <QtCore/QSettings>
#include <QtCore/QTime>
#include <QtCore/QTimer>
#include <QtGui/QApplication>
#include <QtGui/QDesktopServices>
@@ -122,7 +122,8 @@ QtVersionManager::QtVersionManager()
writeVersionsIntoSettings();
updateDocumentation();
updateExamples();
// cannot call from ctor, needs to get connected extenernally first
QTimer::singleShot(0, this, SLOT(updateExamples()));
}
QtVersionManager::~QtVersionManager()
@@ -185,9 +186,7 @@ void QtVersionManager::updateExamples()
if (version->hasDemos())
demosPath = version->demosPath();
if (!examplesPath.isEmpty() && !demosPath.isEmpty()) {
if (Welcome::WelcomeMode *welcomeMode = qobject_cast<Welcome::WelcomeMode*>
(Core::ICore::instance()->modeManager()->mode(Core::Constants::MODE_WELCOME)))
welcomeMode->updateExamples(examplesPath, demosPath, version->sourcePath());
emit updateExamples(examplesPath, demosPath, version->sourcePath());
return;
}
}

View File

@@ -201,6 +201,10 @@ public:
signals:
void defaultQtVersionChanged();
void qtVersionsChanged();
void updateExamples(QString, QString, QString);
private slots:
void updateExamples();
private:
static QString findQMakeLine(const QString &directory);
static QString trimLine(const QString line);
@@ -215,7 +219,6 @@ private:
void addNewVersionsFromInstaller();
void updateSystemVersion();
void updateDocumentation();
void updateExamples();
static int indexOfVersionInList(const QtVersion * const version, const QList<QtVersion *> &list);
void updateUniqueIdToIndexMap();

View File

@@ -0,0 +1,48 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://www.qtsoftware.com/contact.
**
**************************************************************************/
#include "communitywelcomepage.h"
#include "communitywelcomepagewidget.h"
namespace Welcome {
namespace Internal {
CommunityWelcomePage::CommunityWelcomePage()
: m_page(new CommunityWelcomePageWidget)
{
}
QWidget* CommunityWelcomePage::page()
{
return m_page;
}
} // namespace Internal
} // namespace Welcome

View File

@@ -0,0 +1,60 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://www.qtsoftware.com/contact.
**
**************************************************************************/
#ifndef COMMUNITYWELCOMEPAGE_H
#define COMMUNITYWELCOMEPAGE_H
#include "welcome_global.h"
#include <extensionsystem/iwelcomepage.h>
namespace Welcome {
namespace Internal {
class CommunityWelcomePageWidget;
class WELCOME_EXPORT CommunityWelcomePage : public ExtensionSystem::IWelcomePage
{
Q_OBJECT
public:
CommunityWelcomePage();
QWidget *page();
QString title() const { return tr("Community"); }
int priority() const { return 30; }
private:
CommunityWelcomePageWidget *m_page;
};
} // namespace Internal
} // namespace Welcome
#endif // COMMUNITYWELCOMEPAGE_H

View File

@@ -0,0 +1,79 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://www.qtsoftware.com/contact.
**
**************************************************************************/
#include "communitywelcomepagewidget.h"
#include "ui_communitywelcomepagewidget.h"
#include "rssfetcher.h"
#include <QtGui/QDesktopServices>
namespace Welcome {
namespace Internal {
CommunityWelcomePageWidget::CommunityWelcomePageWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::CommunityWelcomePageWidget),
m_rssFetcher(new RSSFetcher(7))
{
ui->setupUi(this);
ui->labsTitleLabel->setStyledText(tr("News From the Qt Labs"));
ui->sitesTitleLabel->setStyledText(tr("Qt Websites"));
connect(ui->newsTreeWidget, SIGNAL(activated(QString)), SLOT(slotUrlClicked(QString)));
connect(ui->sitesTreeWidget, SIGNAL(activated(QString)), SLOT(slotUrlClicked(QString)));
connect(m_rssFetcher, SIGNAL(newsItemReady(QString, QString, QString)),
ui->newsTreeWidget, SLOT(slotAddNewsItem(QString, QString, QString)));
//: Add localized feed here only if one exists
m_rssFetcher->fetch(QUrl(tr("http://labs.trolltech.com/blogs/feed")));
ui->sitesTreeWidget->addItem(tr("Qt Home"), QLatin1String("http://qtsoftware.com"));
ui->sitesTreeWidget->addItem(tr("Qt Labs"), QLatin1String("http://labs.trolltech.com"));
ui->sitesTreeWidget->addItem(tr("Qt Git Hosting"), QLatin1String("http://qt.gitorious.org"));
ui->sitesTreeWidget->addItem(tr("Qt Centre"), QLatin1String("http://www.qtcentre.org"));
ui->sitesTreeWidget->addItem(tr("Qt for S60 at Forum Nokia"), QLatin1String("http://discussion.forum.nokia.com/forum/forumdisplay.php?f=196"));
}
CommunityWelcomePageWidget::~CommunityWelcomePageWidget()
{
delete m_rssFetcher;
delete ui;
}
void CommunityWelcomePageWidget::slotUrlClicked(const QString &data)
{
QDesktopServices::openUrl(QUrl(data));
}
} // namespace Internal
} // namespace Welcome

View File

@@ -0,0 +1,64 @@
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://www.qtsoftware.com/contact.
**
**************************************************************************/
#ifndef COMMUNITYWELCOMEPAGEWIDGET_H
#define COMMUNITYWELCOMEPAGEWIDGET_H
#include <QWidget>
namespace Welcome {
namespace Internal {
class RSSFetcher;
namespace Ui {
class CommunityWelcomePageWidget;
}
class CommunityWelcomePageWidget : public QWidget
{
Q_OBJECT
public:
CommunityWelcomePageWidget(QWidget *parent = 0);
~CommunityWelcomePageWidget();
private slots:
void slotUrlClicked(const QString &data);
private:
RSSFetcher *m_rssFetcher;
Ui::CommunityWelcomePageWidget *ui;
};
} // namespace Internal
} // namespace Welcome
#endif // COMMUNITYWELCOMEPAGEWIDGET_H

View File

@@ -0,0 +1,195 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Welcome::Internal::CommunityWelcomePageWidget</class>
<widget class="QWidget" name="Welcome::Internal::CommunityWelcomePageWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>667</width>
<height>352</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QFrame" name="labsFrame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="Core::Utils::WelcomeModeLabel" name="labsTitleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item>
<widget class="Core::Utils::WelcomeModeTreeWidget" name="newsTreeWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>340</width>
<height>0</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="uniformRowHeights">
<bool>true</bool>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<property name="columnCount">
<number>2</number>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<attribute name="headerDefaultSectionSize">
<number>24</number>
</attribute>
<attribute name="headerMinimumSectionSize">
<number>0</number>
</attribute>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
<column>
<property name="text">
<string notr="true">2</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="sitesFrame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="Core::Utils::WelcomeModeLabel" name="sitesTitleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item>
<widget class="Core::Utils::WelcomeModeTreeWidget" name="sitesTreeWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="uniformRowHeights">
<bool>true</bool>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<property name="columnCount">
<number>2</number>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<attribute name="headerDefaultSectionSize">
<number>24</number>
</attribute>
<attribute name="headerMinimumSectionSize">
<number>0</number>
</attribute>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
<column>
<property name="text">
<string notr="true">2</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Core::Utils::WelcomeModeTreeWidget</class>
<extends>QTreeWidget</extends>
<header>utils/welcomemodetreewidget.h</header>
</customwidget>
<customwidget>
<class>Core::Utils::WelcomeModeLabel</class>
<extends>QLabel</extends>
<header>utils/welcomemodetreewidget.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@@ -43,7 +43,7 @@
#include <sys/utsname.h>
#endif
using namespace Welcome;
using namespace Welcome::Internal;
static const QString getOsString()
{

View File

@@ -35,6 +35,7 @@
#include <QtNetwork/QHttp>
namespace Welcome {
namespace Internal {
class RSSFetcher : public QObject
{
@@ -69,6 +70,7 @@ private:
};
} // namespace Welcome
} // namespace Internal
#endif // RSSFETCHER_H

View File

@@ -5,11 +5,17 @@ include(../../qtcreatorplugin.pri)
include(../../plugins/coreplugin/coreplugin.pri)
HEADERS += welcomeplugin.h \
welcomemode.h \
rssfetcher.h
rssfetcher.h \
communitywelcomepagewidget.h \
communitywelcomepage.h
SOURCES += welcomeplugin.cpp \
welcomemode.cpp \
rssfetcher.cpp
FORMS += welcomemode.ui
rssfetcher.cpp \
communitywelcomepagewidget.cpp \
communitywelcomepage.cpp
FORMS += welcomemode.ui \
communitywelcomepagewidget.ui
RESOURCES += welcome.qrc
DEFINES += WELCOME_LIBRARY
OTHER_FILES += Welcome.pluginspec

View File

@@ -28,11 +28,10 @@
**************************************************************************/
#include "welcomemode.h"
#include "rssfetcher.h"
#include <extensionsystem/pluginmanager.h>
#include <extensionsystem/iwelcomepage.h>
#include <coreplugin/icore.h>
#include <coreplugin/dialogs/iwizard.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/uniqueidmanager.h>
#include <coreplugin/modemanager.h>
@@ -41,22 +40,22 @@
#include <utils/styledbar.h>
#include <utils/welcomemodetreewidget.h>
#include <QtGui/QDesktopServices>
#include <QtGui/QMouseEvent>
#include <QtGui/QScrollArea>
#include <QtGui/QButtonGroup>
#include <QtGui/QDesktopServices>
#include <QtGui/QToolButton>
#include <QtCore/QDateTime>
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
#include <QtCore/QDebug>
#include <QtCore/QUrl>
#include <QtCore/QSettings>
#include <QtCore/QUrl>
#include <QtCore/QDebug>
#include <cstdlib>
#include "ui_welcomemode.h"
using namespace ExtensionSystem;
namespace Welcome {
struct WelcomeModePrivate
@@ -66,10 +65,9 @@ struct WelcomeModePrivate
QScrollArea *m_scrollArea;
QWidget *m_widget;
QWidget *m_welcomePage;
QButtonGroup *btnGrp;
Ui::WelcomePage ui;
RSSFetcher *rssFetcher;
WelcomeMode::WelcomePageData lastData;
QMap<QAbstractButton*, QWidget*> buttonMap;
QHBoxLayout * buttonLayout;
Ui::WelcomeMode ui;
int currentTip;
};
@@ -77,46 +75,6 @@ WelcomeModePrivate::WelcomeModePrivate()
{
}
// --- WelcomePageData
bool WelcomeMode::WelcomePageData::operator==(const WelcomePageData &rhs) const
{
return previousSession == rhs.previousSession
&& activeSession == rhs.activeSession
&& sessionList == rhs.sessionList
&& projectList == rhs.projectList;
}
bool WelcomeMode::WelcomePageData::operator!=(const WelcomePageData &rhs) const
{
return previousSession != rhs.previousSession
|| activeSession != rhs.activeSession
|| sessionList != rhs.sessionList
|| projectList != rhs.projectList;
}
QDebug operator<<(QDebug dgb, const WelcomeMode::WelcomePageData &d)
{
dgb.nospace() << "PreviousSession=" << d.previousSession
<< " activeSession=" << d.activeSession
<< " sessionList=" << d.sessionList
<< " projectList=" << d.projectList;
return dgb;
}
// Format a title + ruler for title labels
static inline QString titleLabel(const QString &text)
{
QString rc = QLatin1String(
"<html><head><style type=\"text/css\">p, li { white-space: pre-wrap; }</style></head>"
"<body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">"
"<p style=\" margin-top:16px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">"
"<span style=\" font-size:x-large; color:#555555;\">");
rc += text;
rc += QLatin1String("</span></p><hr/></body></html>");
return rc;
}
// --- WelcomeMode
WelcomeMode::WelcomeMode() :
m_d(new WelcomeModePrivate)
@@ -126,22 +84,8 @@ WelcomeMode::WelcomeMode() :
l->setMargin(0);
l->setSpacing(0);
l->addWidget(new Core::Utils::StyledBar(m_d->m_widget));
m_d->rssFetcher = new RSSFetcher(7, this);
m_d->m_welcomePage = new QWidget(m_d->m_widget);
m_d->ui.setupUi(m_d->m_welcomePage);
m_d->ui.projTitleLabel->setText(titleLabel(tr("Open Recent Project")));
m_d->ui.recentSessionsTitleLabel->setText(titleLabel(tr("Resume Session")));
m_d->ui.tutorialsTitleLabel->setText(titleLabel(tr("Tutorials")));
m_d->ui.demoTitleLabel->setText(titleLabel(tr("Explore Qt Examples")));
m_d->ui.didYouKnowTitleLabel->setText(titleLabel(tr("Did You Know?")));
m_d->ui.labsTitleLabel->setText(titleLabel(tr("News From the Qt Labs")));
m_d->ui.sitesTitleLabel->setText(titleLabel(tr("Qt Websites")));
m_d->ui.sessTreeWidget->viewport()->setAutoFillBackground(false);
m_d->ui.projTreeWidget->viewport()->setAutoFillBackground(false);
m_d->ui.newsTreeWidget->viewport()->setAutoFillBackground(false);
m_d->ui.sitesTreeWidget->viewport()->setAutoFillBackground(false);
m_d->ui.tutorialTreeWidget->viewport()->setAutoFillBackground(false);
m_d->ui.didYouKnowTextBrowser->viewport()->setAutoFillBackground(false);
m_d->ui.helpUsLabel->setAttribute(Qt::WA_LayoutUsesWidgetRect);
m_d->ui.feedbackButton->setAttribute(Qt::WA_LayoutUsesWidgetRect);
l->addWidget(m_d->m_welcomePage);
@@ -151,71 +95,17 @@ WelcomeMode::WelcomeMode() :
m_d->m_scrollArea->setWidget(m_d->m_widget);
m_d->m_scrollArea->setWidgetResizable(true);
updateWelcomePage(WelcomePageData());
m_d->btnGrp = new QButtonGroup(this);
m_d->btnGrp->addButton(m_d->ui.gettingStartedSectButton, 0);
m_d->btnGrp->addButton(m_d->ui.developSectButton, 1);
m_d->btnGrp->addButton(m_d->ui.communitySectButton, 2);
connect(m_d->btnGrp, SIGNAL(buttonClicked(int)), m_d->ui.stackedWidget, SLOT(setCurrentIndex(int)));
PluginManager *pluginManager = PluginManager::instance();
connect(pluginManager, SIGNAL(objectAdded(QObject*)), SLOT(welcomePluginAdded(QObject*)));
connect(m_d->ui.feedbackButton, SIGNAL(clicked()), SLOT(slotFeedback()));
connect(m_d->ui.manageSessionsButton, SIGNAL(clicked()), SIGNAL(manageSessions()));
connect(m_d->ui.createNewProjectButton, SIGNAL(clicked()), SLOT(slotCreateNewProject()));
connect(m_d->ui.sessTreeWidget, SIGNAL(activated(QString)), SLOT(slotSessionClicked(QString)));
connect(m_d->ui.projTreeWidget, SIGNAL(activated(QString)), SLOT(slotProjectClicked(QString)));
connect(m_d->ui.newsTreeWidget, SIGNAL(activated(QString)), SLOT(slotUrlClicked(QString)));
connect(m_d->ui.sitesTreeWidget, SIGNAL(activated(QString)), SLOT(slotUrlClicked(QString)));
connect(m_d->ui.tutorialTreeWidget, SIGNAL(activated(QString)), SIGNAL(openHelpPage(const QString&)));
connect(m_d->ui.openExampleButton, SIGNAL(clicked()), SLOT(slotOpenExample()));
connect(m_d->ui.examplesComboBox, SIGNAL(currentIndexChanged(int)), SLOT(slotEnableExampleButton(int)));
connect(m_d->rssFetcher, SIGNAL(newsItemReady(QString, QString, QString)),
m_d->ui.newsTreeWidget, SLOT(slotAddNewsItem(QString, QString, QString)));
//: Add localized feed here only if one exists
m_d->rssFetcher->fetch(QUrl(tr("http://labs.trolltech.com/blogs/feed")));
m_d->ui.sitesTreeWidget->addItem(tr("Qt Home"), QLatin1String("http://qtsoftware.com"));
m_d->ui.sitesTreeWidget->addItem(tr("Qt Labs"), QLatin1String("http://labs.trolltech.com"));
m_d->ui.sitesTreeWidget->addItem(tr("Qt Git Hosting"), QLatin1String("http://qt.gitorious.org"));
m_d->ui.sitesTreeWidget->addItem(tr("Qt Centre"), QLatin1String("http://www.qtcentre.org"));
m_d->ui.sitesTreeWidget->addItem(tr("Qt for S60 at Forum Nokia"), QLatin1String("http://discussion.forum.nokia.com/forum/forumdisplay.php?f=196"));
m_d->ui.tutorialTreeWidget->addItem(tr("<b>Qt Creator - A quick tour</b>"),
QString("qthelp://com.nokia.qtcreator.%1%2/doc/index.html").arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR));
m_d->ui.tutorialTreeWidget->addItem(tr("Creating an address book"),
QLatin1String("qthelp://com.nokia.qtcreator/doc/tutorials-addressbook-sdk.html"));
m_d->ui.tutorialTreeWidget->addItem(tr("Understanding widgets"),
QLatin1String("qthelp://com.trolltech.qt/qdoc/widgets-tutorial.html"));
m_d->ui.tutorialTreeWidget->addItem(tr("Building with qmake"),
QLatin1String("qthelp://com.trolltech.qmake/qdoc/qmake-tutorial.html"));
m_d->ui.tutorialTreeWidget->addItem(tr("Writing test cases"),
QLatin1String("qthelp://com.trolltech.qt/qdoc/qtestlib-tutorial.html"));
srand(QDateTime::currentDateTime().toTime_t());
QStringList tips = tipsOfTheDay();
m_d->currentTip = rand()%tips.count();
QTextDocument *doc = m_d->ui.didYouKnowTextBrowser->document();
doc->setDefaultStyleSheet("a:link {color:black;}");
m_d->ui.didYouKnowTextBrowser->setDocument(doc);
m_d->ui.didYouKnowTextBrowser->setText(tips.at(m_d->currentTip));
connect(m_d->ui.nextTipBtn, SIGNAL(clicked()), this, SLOT(slotNextTip()));
connect(m_d->ui.prevTipBtn, SIGNAL(clicked()), this, SLOT(slotPrevTip()));
QSettings *settings = Core::ICore::instance()->settings();
int id = settings->value("General/WelcomeTab", 0).toInt();
m_d->btnGrp->button(id)->setChecked(true);
m_d->ui.stackedWidget->setCurrentIndex(id);
}
WelcomeMode::~WelcomeMode()
{
QSettings *settings = Core::ICore::instance()->settings();
settings->setValue("General/WelcomeTab", m_d->btnGrp->checkedId());
settings->setValue("General/WelcomeTab", m_d->ui.stackedWidget->currentIndex());
delete m_d->m_widget;
delete m_d;
}
@@ -252,150 +142,78 @@ QList<int> WelcomeMode::context() const
return contexts;
}
void WelcomeMode::updateWelcomePage(const WelcomePageData &welcomePageData)
bool sortFunction(IWelcomePage * a, IWelcomePage *b)
{
// Update only if data are modified
if (welcomePageData == m_d->lastData)
return;
m_d->lastData = welcomePageData;
m_d->m_widget->setUpdatesEnabled(false);
m_d->ui.sessTreeWidget->clear();
m_d->ui.projTreeWidget->clear();
if (welcomePageData.sessionList.count() > 0) {
foreach (const QString &s, welcomePageData.sessionList) {
QString str = s;
if (s == welcomePageData.previousSession)
str = tr("%1 (last session)").arg(s);
m_d->ui.sessTreeWidget->addItem(str, s);
}
m_d->ui.sessTreeWidget->updateGeometry();
m_d->ui.sessTreeWidget->show();
} else {
m_d->ui.sessTreeWidget->hide();
}
typedef QPair<QString, QString> QStringPair;
if (welcomePageData.projectList.count() > 0) {
foreach (const QStringPair &it, welcomePageData.projectList) {
QTreeWidgetItem *item = m_d->ui.projTreeWidget->addItem(it.second, it.first);
const QFileInfo fi(it.first);
item->setToolTip(1, QDir::toNativeSeparators(fi.absolutePath()));
}
} else {
m_d->ui.projTreeWidget->hide();
}
m_d->ui.projTreeWidget->updateGeometry();
m_d->m_widget->setUpdatesEnabled(true);
return a->priority() < b->priority();
}
void WelcomeMode::activateEditMode()
void WelcomeMode::initPlugins()
{
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::updateExamples(const QString& examplePath, const QString& demosPath, const QString &sourcePath)
{
QString demoxml = demosPath + "/qtdemo/xml/examples.xml";
if (!QFile::exists(demoxml)) {
demoxml = sourcePath + "/demos/qtdemo/xml/examples.xml";
if (!QFile::exists(demoxml))
return;
m_d->buttonLayout = new QHBoxLayout(m_d->ui.navFrame);
m_d->buttonLayout->setMargin(0);
m_d->buttonLayout->setSpacing(0);
delete m_d->ui.stackedWidget->currentWidget();
QList<IWelcomePage*> plugins = PluginManager::instance()->getObjects<IWelcomePage>();
qSort(plugins.begin(), plugins.end(), &sortFunction);
foreach (IWelcomePage* plugin, plugins) {
QToolButton * btn = new QToolButton;
btn->setCheckable(true);
btn->setText(plugin->title());
btn->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
btn->setAutoExclusive(true);
connect (btn, SIGNAL(clicked()), SLOT(showClickedPage()));
m_d->ui.stackedWidget->addWidget(plugin->page());
m_d->buttonLayout->addWidget(btn);
m_d->buttonMap.insert(btn, plugin->page());
}
m_d->buttonLayout->addSpacing(5);
QFile description(demoxml);
if (!description.open(QFile::ReadOnly))
return;
QSettings *settings = Core::ICore::instance()->settings();
int tabId = settings->value("General/WelcomeTab", 0).toInt();
m_d->ui.examplesComboBox->clear();
m_d->ui.examplesComboBox->setEnabled(true);
m_d->ui.examplesComboBox->addItem(tr("Choose an example..."));
QFont f = widget()->font();
f.setItalic(true);
m_d->ui.examplesComboBox->setItemData(0, f, Qt::FontRole);
f.setItalic(false);
bool inExamples = false;
QString dirName;
QXmlStreamReader reader(&description);
while (!reader.atEnd()) {
switch (reader.readNext()) {
case QXmlStreamReader::StartElement:
if (reader.name() == "category") {
QString name = reader.attributes().value(QLatin1String("name")).toString();
if (name.contains("tutorial"))
break;
dirName = reader.attributes().value(QLatin1String("dirname")).toString();
m_d->ui.examplesComboBox->addItem(name);
f.setBold(true);
m_d->ui.examplesComboBox->setItemData(m_d->ui.examplesComboBox->count()-1, f, Qt::FontRole);
f.setBold(false);
inExamples = true;
}
if (inExamples && reader.name() == "example") {
QString name = reader.attributes().value(QLatin1String("name")).toString();
QString fn = reader.attributes().value(QLatin1String("filename")).toString();
QString relativeProPath = '/' + dirName + '/' + fn + '/' + fn + ".pro";
QString fileName = examplePath + relativeProPath;
if (!QFile::exists(fileName))
fileName = sourcePath + "/examples" + relativeProPath;
QString helpPath = "qthelp://com.trolltech.qt/qdoc/" + dirName.replace("/", "-") + "-" + fn + ".html";
m_d->ui.examplesComboBox->addItem(" " + name, fileName);
m_d->ui.examplesComboBox->setItemData(m_d->ui.examplesComboBox->count()-1, helpPath, Qt::UserRole+1);
}
break;
case QXmlStreamReader::EndElement:
if (reader.name() == "category")
inExamples = false;
break;
default:
int pluginCount = m_d->ui.stackedWidget->count();
if (tabId < pluginCount) {
m_d->ui.stackedWidget->setCurrentIndex(tabId);
QMapIterator<QAbstractButton*, QWidget*> it(m_d->buttonMap);
while (it.hasNext())
if (it.next().value() == m_d->ui.stackedWidget->currentWidget()) {
it.key()->setChecked(true);
break;
}
}
}
void WelcomeMode::slotEnableExampleButton(int index)
void WelcomeMode::welcomePluginAdded(QObject *obj)
{
QString fileName = m_d->ui.examplesComboBox->itemData(index, Qt::UserRole).toString();
m_d->ui.openExampleButton->setEnabled(!fileName.isEmpty());
if (IWelcomePage *plugin = qobject_cast<IWelcomePage*>(obj))
{
QToolButton * btn = new QToolButton;
btn->setCheckable(true);
btn->setAutoExclusive(true);
btn->setText(plugin->title());
btn->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
connect (btn, SIGNAL(clicked()), SLOT(showClickedPage()));
int insertPos = 0;
QList<IWelcomePage*> plugins = PluginManager::instance()->getObjects<IWelcomePage>();
foreach (IWelcomePage* p, plugins) {
if (plugin->priority() < p->priority())
insertPos++;
else
break;
}
m_d->ui.stackedWidget->insertWidget(insertPos, plugin->page());
m_d->buttonMap.insert(btn, plugin->page());
m_d->buttonLayout->insertWidget(insertPos, btn);
}
}
void WelcomeMode::slotOpenExample()
void WelcomeMode::showClickedPage()
{
QComboBox *box = m_d->ui.examplesComboBox;
QString proFile = box->itemData(box->currentIndex(), Qt::UserRole).toString();
QString helpFile = box->itemData(box->currentIndex(), Qt::UserRole + 1).toString();
QStringList files;
QFileInfo fi(proFile);
QString tryFile = fi.path() + "/main.cpp";
files << proFile;
if(!QFile::exists(tryFile))
tryFile = fi.path() + '/' + fi.baseName() + ".cpp";
if(QFile::exists(tryFile))
files << tryFile;
Core::ICore::instance()->openFiles(files);
emit openContextHelpPage(helpFile);
QAbstractButton *btn = qobject_cast<QAbstractButton*>(sender());
QMap<QAbstractButton*, QWidget*>::iterator it = m_d->buttonMap.find(btn);
if (it.value())
m_d->ui.stackedWidget->setCurrentWidget(it.value());
}
void WelcomeMode::slotFeedback()
@@ -404,71 +222,5 @@ void WelcomeMode::slotFeedback()
"http://qtsoftware.com/forms/feedback-forms/qt-creator-user-feedback/view")));
}
void WelcomeMode::slotCreateNewProject()
{
Core::ICore::instance()->showNewItemDialog(tr("New Project..."),
Core::IWizard::wizardsOfKind(Core::IWizard::ProjectWizard));
}
void WelcomeMode::slotNextTip()
{
QStringList tips = tipsOfTheDay();
m_d->currentTip = ((m_d->currentTip+1)%tips.count());
m_d->ui.didYouKnowTextBrowser->setText(tips.at(m_d->currentTip));
}
void WelcomeMode::slotPrevTip()
{
QStringList tips = tipsOfTheDay();
m_d->currentTip = ((m_d->currentTip-1)+tips.count())%tips.count();
m_d->ui.didYouKnowTextBrowser->setText(tips.at(m_d->currentTip));
}
QStringList WelcomeMode::tipsOfTheDay()
{
static QStringList tips;
if (tips.isEmpty()) {
QString altShortcut =
#ifdef Q_WS_MAC
tr("Cmd", "Shortcut key");
#else
tr("Alt", "Shortcut key");
#endif
tips.append(tr("You can switch between Qt Creator's modes using <tt>Ctrl+number</tt>:<ul>"
"<li>1 - Welcome</li><li>2 - Edit</li><li>3 - Debug</li><li>4 - Projects</li><li>5 - Help</li>"
"<li></li><li>6 - Output</li></ul>"));
//:%1 gets replaced by Alt (Win/Unix) or Cmd (Mac)
tips.append(tr("You can show and hide the side bar using <tt>%1+0<tt>.").arg(altShortcut));
tips.append(tr("You can fine tune the <tt>Find</tt> function by selecting &quot;Whole Words&quot; "
"or &quot;Case Sensitive&quot;. Simply click on the icons on the right end of the line edit."));
tips.append(tr("If you add <a href=\"qthelp://com.nokia.qtcreator/doc/creator-external-library-handling.html\""
">external libraries</a>, Qt Creator will automatically offer syntax highlighting "
"and code completion."));
tips.append(tr("The code completion is CamelCase-aware. For example, to complete <tt>namespaceUri</tt> "
"you can just type <tt>nU</tt> and hit <tt>Ctrl+Space</tt>."));
tips.append(tr("You can force code completion at any time using <tt>Ctrl+Space</tt>."));
tips.append(tr("You can start Qt Creator with a session by calling <tt>qtcreator &lt;sessionname&gt;</tt>."));
tips.append(tr("You can return to edit mode from any other mode at any time by hitting <tt>Escape</tt>."));
//:%1 gets replaced by Alt (Win/Unix) or Cmd (Mac)
tips.append(tr("You can switch between the output pane by hitting <tt>%1+n</tt> where n is the number denoted "
"on the buttons at the window bottom:"
"<ul><li>1 - Build Issues</li><li>2 - Search Results</li><li>3 - Application Output</li>"
"<li>4 - Compile Output</li></ul>").arg(altShortcut));
tips.append(tr("You can quickly search methods, classes, help and more using the "
"<a href=\"qthelp://com.nokia.qtcreator/doc/creator-navigation.html\">Locator bar</a> (<tt>Ctrl+K</tt>)."));
tips.append(tr("You can add custom build steps in the "
"<a href=\"qthelp://com.nokia.qtcreator/doc/creator-build-settings.html\">build settings</a>."));
tips.append(tr("Within a session, you can add "
"<a href=\"qthelp://com.nokia.qtcreator/doc/creator-build-settings.html#dependencies\">dependencies</a> between projects."));
tips.append(tr("You can set the preferred editor encoding for every project in <tt>Projects -> Editor Settings -> Default Encoding</tt>."));
tips.append(tr("You can modify the binary that is being executed when you press the <tt>Run</tt> button: Add a <tt>Custom Executable</tt> "
"by clicking the <tt>+</tt> button in <tt>Projects -> Run Settings -> Run Configuration</tt> and then select the new "
"target in the combo box."));
tips.append(tr("You can use Qt Creator with a number of <a href=\"qthelp://com.nokia.qtcreator/doc/creator-version-control.html\">"
"revision control systems</a> such as Subversion, Perforce and Git."));
tips.append(tr("In the editor, <tt>F2</tt> toggles declaration and definition while <tt>F4</tt> toggles header file and source file."));
}
return tips;
}
} // namespace Welcome

View File

@@ -54,18 +54,6 @@ public:
WelcomeMode();
~WelcomeMode();
struct WelcomePageData{
bool operator==(const WelcomePageData &rhs) const;
bool operator!=(const WelcomePageData &rhs) const;
QString previousSession;
QString activeSession;
QStringList sessionList;
QList<QPair<QString, QString> > projectList; // pair of filename, displayname
};
void updateWelcomePage(const WelcomePageData &welcomePageData);
// IMode
QString name() const;
QIcon icon() const;
@@ -75,31 +63,14 @@ public:
QList<int> context() const;
void activated();
QString contextHelpId() const { return QLatin1String("Qt Creator"); }
void updateExamples(const QString& examplePath, const QString& demosPath, const QString &sourcePath);
signals:
void requestProject(const QString &project);
void requestSession(const QString &session);
void openHelpPage(const QString& url);
void openContextHelpPage(const QString& url);
void manageSessions();
void initPlugins();
private slots:
void slotFeedback();
void slotSessionClicked(const QString &data);
void slotProjectClicked(const QString &data);
void slotUrlClicked(const QString &data);
void slotEnableExampleButton(int);
void slotOpenExample();
void slotCreateNewProject();
void slotNextTip();
void slotPrevTip();
void welcomePluginAdded(QObject*);
void showClickedPage();
private:
void activateEditMode();
QStringList tipsOfTheDay();
WelcomeModePrivate *m_d;
};

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Welcome::WelcomePage</class>
<widget class="QWidget" name="Core::Utils::WelcomePage">
<class>Welcome::WelcomeMode</class>
<widget class="QWidget" name="Welcome::WelcomeMode">
<property name="geometry">
<rect>
<x>0</x>
@@ -172,6 +172,12 @@ QToolButton:pressed, QPushButton:pressed{
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>10</height>
</size>
</property>
<property name="font">
<font>
<weight>50</weight>
@@ -238,129 +244,6 @@ QToolButton:pressed {
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QToolButton" name="gettingStartedSectButton">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>-1</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Getting Started</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="autoExclusive">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QToolButton" name="developSectButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>-1</pointsize>
</font>
</property>
<property name="text">
<string>Develop</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoExclusive">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QToolButton" name="communitySectButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>-1</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string>Community</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="3">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>5</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
@@ -368,575 +251,7 @@ QToolButton:pressed {
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="gettingStartedPage">
<layout class="QGridLayout" name="gridLayout_9">
<property name="leftMargin">
<number>18</number>
</property>
<property name="topMargin">
<number>18</number>
</property>
<property name="rightMargin">
<number>12</number>
</property>
<property name="bottomMargin">
<number>18</number>
</property>
<property name="spacing">
<number>24</number>
</property>
<item row="0" column="0" rowspan="2">
<widget class="QFrame" name="tutorialsFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>400</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
<widget class="QLabel" name="tutorialsTitleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="Core::Utils::WelcomeModeTreeWidget" name="tutorialTreeWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="uniformRowHeights">
<bool>true</bool>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<property name="columnCount">
<number>2</number>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<attribute name="headerDefaultSectionSize">
<number>24</number>
</attribute>
<attribute name="headerMinimumSectionSize">
<number>0</number>
</attribute>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
<column>
<property name="text">
<string notr="true">2</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<widget class="QFrame" name="demosExamplesFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>400</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout_8">
<property name="rightMargin">
<number>8</number>
</property>
<property name="horizontalSpacing">
<number>0</number>
</property>
<item row="0" column="0" colspan="4">
<widget class="QLabel" name="demoTitleLabel">
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QComboBox" name="examplesComboBox">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Examples not installed</string>
</property>
</item>
</widget>
</item>
<item row="1" column="2">
<widget class="QToolButton" name="openExampleButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Open</string>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>6</width>
<height>6</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="1" column="1">
<widget class="QFrame" name="didyouKnowFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>400</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout_11">
<property name="rightMargin">
<number>9</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="didYouKnowTitleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QTextBrowser" name="didYouKnowTextBrowser">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QGridLayout" name="gridLayout_10">
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0" colspan="2">
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>2</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QToolButton" name="prevTipBtn">
<property name="styleSheet">
<string notr="true">QToolButton{
border-right:solid 0 px;
height:16px;
width:12px;
}
</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="welcome.qrc">
<normaloff>:/welcome/images/arrow-left.png</normaloff>:/welcome/images/arrow-left.png</iconset>
</property>
<property name="arrowType">
<enum>Qt::NoArrow</enum>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QToolButton" name="nextTipBtn">
<property name="styleSheet">
<string notr="true">QToolButton{
border-left:solid 0 px;
height:16px;
width:12px;
}
</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="welcome.qrc">
<normaloff>:/welcome/images/arrow-right.png</normaloff>:/welcome/images/arrow-right.png</iconset>
</property>
<property name="arrowType">
<enum>Qt::NoArrow</enum>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>2</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="developPage">
<layout class="QGridLayout" name="gridLayout_4">
<property name="margin">
<number>18</number>
</property>
<property name="spacing">
<number>24</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="recentSessionsFrame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>270</width>
<height>130</height>
</size>
</property>
<property name="styleSheet">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<property name="horizontalSpacing">
<number>0</number>
</property>
<property name="verticalSpacing">
<number>3</number>
</property>
<item row="0" column="0" colspan="3">
<widget class="QLabel" name="recentSessionsTitleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3">
<widget class="Core::Utils::WelcomeModeTreeWidget" name="sessTreeWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="uniformRowHeights">
<bool>true</bool>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<property name="columnCount">
<number>2</number>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<attribute name="headerDefaultSectionSize">
<number>24</number>
</attribute>
<attribute name="headerMinimumSectionSize">
<number>0</number>
</attribute>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
<column>
<property name="text">
<string notr="true">2</string>
</property>
</column>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="manageSessionsButton">
<property name="focusPolicy">
<enum>Qt::TabFocus</enum>
</property>
<property name="text">
<string>Manage Sessions...</string>
</property>
</widget>
</item>
<item row="4" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="0" column="2">
<widget class="QFrame" name="recentProjectsFrame">
<property name="styleSheet">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<property name="horizontalSpacing">
<number>0</number>
</property>
<property name="verticalSpacing">
<number>3</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<item row="0" column="0" colspan="3">
<widget class="QLabel" name="projTitleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3">
<widget class="Core::Utils::WelcomeModeTreeWidget" name="projTreeWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="uniformRowHeights">
<bool>true</bool>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<property name="columnCount">
<number>2</number>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<attribute name="headerDefaultSectionSize">
<number>24</number>
</attribute>
<attribute name="headerMinimumSectionSize">
<number>0</number>
</attribute>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
<column>
<property name="text">
<string notr="true">2</string>
</property>
</column>
</widget>
</item>
<item row="3" column="0">
<widget class="QPushButton" name="createNewProjectButton">
<property name="focusPolicy">
<enum>Qt::TabFocus</enum>
</property>
<property name="text">
<string>Create New Project...</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="communityPage">
<widget class="QWidget" name="widget">
<layout class="QGridLayout" name="gridLayout_7">
<property name="margin">
<number>18</number>
@@ -944,168 +259,6 @@ QToolButton:pressed {
<property name="spacing">
<number>24</number>
</property>
<item row="0" column="0">
<widget class="QFrame" name="labsFrame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="labsTitleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item>
<widget class="Core::Utils::WelcomeModeTreeWidget" name="newsTreeWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>340</width>
<height>0</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="uniformRowHeights">
<bool>true</bool>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<property name="columnCount">
<number>2</number>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<attribute name="headerDefaultSectionSize">
<number>24</number>
</attribute>
<attribute name="headerMinimumSectionSize">
<number>0</number>
</attribute>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
<column>
<property name="text">
<string notr="true">2</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<widget class="QFrame" name="sitesFrame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QLabel" name="sitesTitleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item>
<widget class="Core::Utils::WelcomeModeTreeWidget" name="sitesTreeWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::NoSelection</enum>
</property>
<property name="verticalScrollMode">
<enum>QAbstractItemView::ScrollPerPixel</enum>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<property name="uniformRowHeights">
<bool>true</bool>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<property name="columnCount">
<number>2</number>
</property>
<attribute name="headerVisible">
<bool>false</bool>
</attribute>
<attribute name="headerDefaultSectionSize">
<number>24</number>
</attribute>
<attribute name="headerMinimumSectionSize">
<number>0</number>
</attribute>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
<column>
<property name="text">
<string notr="true">2</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
@@ -1219,13 +372,6 @@ QToolButton:pressed {
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Core::Utils::WelcomeModeTreeWidget</class>
<extends>QTreeWidget</extends>
<header>utils/welcomemodetreewidget.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="welcome.qrc"/>
</resources>

View File

@@ -31,6 +31,8 @@
#include "welcomemode.h"
#include "communitywelcomepage.h"
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/basemode.h>
#include <coreplugin/coreconstants.h>
@@ -45,11 +47,10 @@
#include <QtGui/QMessageBox>
#include <QtGui/QPushButton>
using namespace Welcome;
using namespace Welcome::Internal;
WelcomePlugin::WelcomePlugin()
: m_welcomeMode(0)
: m_welcomeMode(0), m_communityWelcomePage(0)
{
}
@@ -59,6 +60,10 @@ WelcomePlugin::~WelcomePlugin()
removeObject(m_welcomeMode);
delete m_welcomeMode;
}
if (m_communityWelcomePage) {
removeObject(m_communityWelcomePage);
delete m_communityWelcomePage;
}
}
/*! Initializes the plugin. Returns true on success.
@@ -72,6 +77,9 @@ bool WelcomePlugin::initialize(const QStringList &arguments, QString *error_mess
Q_UNUSED(arguments)
Q_UNUSED(error_message)
m_communityWelcomePage = new Internal::CommunityWelcomePage;
addObject(m_communityWelcomePage);
m_welcomeMode = new WelcomeMode;
addObject(m_welcomeMode);
@@ -91,6 +99,7 @@ bool WelcomePlugin::initialize(const QStringList &arguments, QString *error_mess
*/
void WelcomePlugin::extensionsInitialized()
{
m_welcomeMode->initPlugins();
Core::ModeManager::instance()->activateMode(m_welcomeMode->uniqueModeName());
}

View File

@@ -36,6 +36,9 @@ namespace Welcome {
class WelcomeMode;
namespace Internal {
class CommunityWelcomePage;
class WelcomePlugin
: public ExtensionSystem::IPlugin
{
@@ -51,8 +54,10 @@ public:
private:
WelcomeMode *m_welcomeMode;
Internal::CommunityWelcomePage *m_communityWelcomePage;
};
} // namespace Welcome
} // namespace Internal
#endif // WELCOMEPLUGIN_H

View File

@@ -118,7 +118,7 @@ public:
void setServerName(const QString &name) { m_serverName = name; }
void setMemoryDumpName(const QString &source) { m_memoryDumpName = source; }
void setVerbose(int v) { m_verbose = v; }
void startServer();
bool startServer();
private slots:
void handleConnection();
@@ -157,25 +157,29 @@ TrkServer::~TrkServer()
m_server.close();
}
void TrkServer::startServer()
bool TrkServer::startServer()
{
QFile file(m_memoryDumpName);
file.open(QIODevice::ReadOnly);
if (!file.open(QIODevice::ReadOnly)) {
logMessage(QString::fromLatin1("Unable to read %1: %2").arg(m_memoryDumpName, file.errorString()), true);
return false;
}
m_memoryData = file.readAll();
file.close();
logMessage(QString("Read %1 bytes of data from %2")
.arg(m_memoryData.size()).arg(m_memoryDumpName));
.arg(m_memoryData.size()).arg(m_memoryDumpName), true);
m_lastSent = 0;
if (!m_server.listen(m_serverName)) {
logMessage(QString("Error: Unable to start the TRK server %1: %2.")
.arg(m_serverName).arg(m_server.errorString()), true);
return;
return false;
}
logMessage("The TRK server '" + m_serverName + "'is running. Run the adapter now.", true);
connect(&m_server, SIGNAL(newConnection()), this, SLOT(handleConnection()));
return true;
}
void TrkServer::logMessage(const QString &msg, bool force)
@@ -384,7 +388,8 @@ int main(int argc, char *argv[])
server.setServerName(options.serverName);
server.setMemoryDumpName(options.dumpName);
server.setVerbose(options.verbose);
server.startServer();
if (!server.startServer())
return -1;
return app.exec();
}