Commit f5d031bb authored by Daniel Molkentin's avatar Daniel Molkentin
Browse files

welcome screen: tutorial section works, remember last tab

parent c6df40a5
......@@ -28,6 +28,7 @@
**************************************************************************/
#include "welcomemode.h"
#include "icore.h"
#include "coreconstants.h"
#include "uniqueidmanager.h"
#include "modemanager.h"
......@@ -41,6 +42,7 @@
#include <QtCore/QFileInfo>
#include <QtCore/QDebug>
#include <QtCore/QUrl>
#include <QtCore/QSettings>
#include "ui_welcomemode.h"
......@@ -53,6 +55,7 @@ struct WelcomeModePrivate
QWidget *m_widget;
QWidget *m_welcomePage;
QButtonGroup *btnGrp;
Ui::WelcomePage ui;
RSSFetcher *rssFetcher;
WelcomeMode::WelcomePageData lastData;
......@@ -110,12 +113,12 @@ WelcomeMode::WelcomeMode() :
updateWelcomePage(WelcomePageData());
QButtonGroup *btnGrp = new QButtonGroup(this);
btnGrp->addButton(m_d->ui.gettingStartedSectButton, 0);
btnGrp->addButton(m_d->ui.developSectButton, 1);
btnGrp->addButton(m_d->ui.communitySectButton, 2);
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(btnGrp, SIGNAL(buttonClicked(int)), m_d->ui.stackedWidget, SLOT(setCurrentIndex(int)));
connect(m_d->btnGrp, SIGNAL(buttonClicked(int)), m_d->ui.stackedWidget, SLOT(setCurrentIndex(int)));
connect(m_d->ui.gettingStartedButton, SIGNAL(clicked()), SIGNAL(requestHelp()));
connect(m_d->ui.feedbackButton, SIGNAL(clicked()), SLOT(slotFeedback()));
......@@ -124,6 +127,7 @@ WelcomeMode::WelcomeMode() :
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->rssFetcher, SIGNAL(newsItemReady(QString, QString)),
m_d->ui.newsTreeWidget, SLOT(slotAddItem(QString, QString)));
......@@ -137,18 +141,26 @@ WelcomeMode::WelcomeMode() :
m_d->ui.sitesTreeWidget->addItem(tr("Qt Centre"), QLatin1String("http://www.qtcentre.org"));
m_d->ui.sitesTreeWidget->addItem(tr("Qt/S60 at Forum Nokia"), QLatin1String("http://discussion.forum.nokia.com/forum/forumdisplay.php?f=196"));
m_d->ui.tutorialTreeWidget->addItem(tr("Tutorial 1"), QLatin1String(""));
m_d->ui.tutorialTreeWidget->addItem(tr("Tutorial 2"), QLatin1String(""));
m_d->ui.tutorialTreeWidget->addItem(tr("Tutorial 3"), QLatin1String(""));
m_d->ui.tutorialTreeWidget->addItem(tr("Tutorial 4"), QLatin1String(""));
m_d->ui.tutorialTreeWidget->addItem(tr("Tutorial 5"), QLatin1String(""));
// ### check for first start, select getting started in this case
m_d->ui.developSectButton->animateClick();
m_d->ui.tutorialTreeWidget->addItem(tr("Using Qt Creator"),
QString("qthelp://com.nokia.qtcreator.%1%2/doc/index.html").arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR));
m_d->ui.tutorialTreeWidget->addItem(tr("Understanding Widgets"),
QLatin1String("qthelp://com.trolltech.qt/qdoc/widgets-tutorial.html"));
m_d->ui.tutorialTreeWidget->addItem(tr("Creating an address book"),
QLatin1String("qthelp://com.trolltech.qt/qdoc/tutorials-addressbook.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"));
QSettings *settings = ICore::instance()->settings();
int id = settings->value("General/WelcomeTab", 0).toInt();
m_d->btnGrp->button(id)->animateClick();
}
WelcomeMode::~WelcomeMode()
{
QSettings *settings = ICore::instance()->settings();
settings->setValue("General/WelcomeTab", m_d->btnGrp->checkedId());
delete m_d;
}
......
......@@ -78,6 +78,7 @@ public:
signals:
void requestProject(const QString &project);
void requestSession(const QString &session);
void openHelpPage(const QString&);
void requestHelp();
private slots:
......
......@@ -219,11 +219,11 @@ background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>2</number>
<number>1</number>
</property>
<widget class="QWidget" name="page">
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0">
<item row="0" column="0" rowspan="2">
<spacer name="horizontalSpacer_11">
<property name="orientation">
<enum>Qt::Horizontal</enum>
......@@ -239,7 +239,7 @@ background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0
</property>
</spacer>
</item>
<item row="0" column="1">
<item row="0" column="1" rowspan="2">
<widget class="QFrame" name="recentProjectsFrame_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
......@@ -258,16 +258,6 @@ background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
<widget class="QLabel" name="projIconLabel_2">
<property name="pixmap">
<pixmap resource="core.qrc">:/core/images/welcomemode/mode_project.png</pixmap>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="projTitleLabel_2">
<property name="text">
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
......@@ -282,7 +272,7 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="1" column="1">
<item row="1" column="0">
<widget class="Core::Internal::WelcomeModeTreeWidget" name="tutorialTreeWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
......@@ -338,7 +328,46 @@ p, li { white-space: pre-wrap; }
</layout>
</widget>
</item>
<item row="0" column="3">
<spacer name="verticalSpacer_7">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>192</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="3">
<widget class="QLabel" name="label">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="core.qrc">:/core/images/qtcreator_logo_128.png</pixmap>
</property>
</widget>
</item>
<item row="2" column="2">
<spacer name="horizontalSpacer_13">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="3">
<widget class="Core::Internal::WelcomeModeButton" name="gettingStartedButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
......@@ -367,22 +396,6 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_13">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_2">
......
......@@ -66,6 +66,7 @@
#include <QtGui/QStyle>
#include <QtGui/QToolBar>
#include <QtGui/QComboBox>
#include <QtGui/QDesktopServices>
#include <QtHelp/QHelpEngine>
#ifndef QT_NO_WEBKIT
......@@ -523,6 +524,7 @@ void HelpPlugin::extensionsInitialized()
if (Core::Internal::WelcomeMode *welcomeMode = qobject_cast<Core::Internal::WelcomeMode*>(m_core->modeManager()->mode(Core::Constants::MODE_WELCOME))) {
connect(welcomeMode, SIGNAL(requestHelp()), this, SLOT(openGettingStarted()));
connect(welcomeMode, SIGNAL(openHelpPage(const QString&)), this, SLOT(openHelpPage(const QString&)));
}
}
......@@ -722,11 +724,21 @@ void HelpPlugin::addNewBookmark(const QString &title, const QString &url)
void HelpPlugin::openGettingStarted()
{
activateHelpMode();
m_centralWidget->setSource(
openHelpPage(
QString("qthelp://com.nokia.qtcreator.%1%2/doc/index.html")
.arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR));
}
void HelpPlugin::openHelpPage(const QString& url)
{
activateHelpMode();
if (m_helpEngine->findFile(url).isValid())
m_centralWidget->setSource(url);
else {
QString page = url.mid(url.lastIndexOf('/')+1);
qDebug() << url << page << url.lastIndexOf('/');
QDesktopServices::openUrl(QLatin1String("http://doc.qtsoftware.com/latest/")+page);
}
}
Q_EXPORT_PLUGIN(HelpPlugin)
......@@ -129,6 +129,7 @@ private slots:
void copyFromSideBar();
void openGettingStarted();
void openHelpPage(const QString& url);
private:
QToolBar *createToolBar();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment