Commit 541f5f64 authored by Daniel Molkentin's avatar Daniel Molkentin
Browse files

welcome screen: add next/prev tip button, styling

parent a7ddee07
......@@ -52,6 +52,13 @@
namespace Core {
namespace Internal {
namespace {
QString htmlSkel = "<html><head><style type=\"text/css\">"
"a:link { color: #ccc;}"
"a:hover { color: black; text-decoration:underline;} "
"</style></head><body>%1</body></html>>";
}
struct WelcomeModePrivate
{
WelcomeModePrivate();
......@@ -62,6 +69,7 @@ struct WelcomeModePrivate
Ui::WelcomePage ui;
RSSFetcher *rssFetcher;
WelcomeMode::WelcomePageData lastData;
int currentTip;
};
WelcomeModePrivate::WelcomeModePrivate()
......@@ -156,7 +164,18 @@ WelcomeMode::WelcomeMode() :
m_d->ui.tutorialTreeWidget->addItem(tr("Writing test cases"),
QLatin1String("qthelp://com.trolltech.qt/qdoc/qtestlib-tutorial.html"));
m_d->ui.didYouKnowTextBrowser->setText(getTipOfTheDay());
srand(QDateTime::currentDateTime().toTime_t());
QStringList tips = tipsOfTheDay();
m_d->currentTip = rand()%tips.count();
QTextDocument *doc = m_d->ui.didYouKnowTextBrowser->document();
doc->setDefaultStyleSheet("a:link {color:black;}");
m_d->ui.didYouKnowTextBrowser->setDocument(doc);
m_d->ui.didYouKnowTextBrowser->setText(tips.at(m_d->currentTip));
connect(m_d->ui.nextTipBtn, SIGNAL(clicked()), this, SLOT(slotNextTip()));
connect(m_d->ui.prevTipBtn, SIGNAL(clicked()), this, SLOT(slotPrevTip()));
QSettings *settings = ICore::instance()->settings();
int id = settings->value("General/WelcomeTab", 0).toInt();
m_d->btnGrp->button(id)->setChecked(true);
......@@ -282,7 +301,19 @@ void WelcomeMode::slotFeedback()
"http://www.qtsoftware.com/forms/feedback-forms/qt-creator-user-feedback/view")));
}
QString WelcomeMode::getTipOfTheDay()
void WelcomeMode::slotNextTip()
{
QStringList tips = tipsOfTheDay();
m_d->ui.didYouKnowTextBrowser->setText(tips.at((++m_d->currentTip)%tips.count()));
}
void WelcomeMode::slotPrevTip()
{
QStringList tips = tipsOfTheDay();
m_d->ui.didYouKnowTextBrowser->setText(tips.at((--m_d->currentTip)%tips.count()));
}
QStringList WelcomeMode::tipsOfTheDay()
{
static QStringList tips;
if (tips.isEmpty()) {
......@@ -292,17 +323,13 @@ QString WelcomeMode::getTipOfTheDay()
tips.append(tr("You can show and hide the side bar using <tt>Alt+0<tt>."));
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 <a href=\"qthelp://com.nokia.qtcreator/doc/creator-external-library-handling.html\""
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."));
}
srand(QDateTime::currentDateTime().toTime_t());
return tips.at(rand()%tips.count());
return tips;
}
// --- WelcomeModeButton
WelcomeModeButton::WelcomeModeButton(QWidget *parent) :
......
......@@ -86,10 +86,12 @@ private slots:
void slotSessionClicked(const QString &data);
void slotProjectClicked(const QString &data);
void slotUrlClicked(const QString &data);
void slotNextTip();
void slotPrevTip();
private:
void activateEditMode();
QString getTipOfTheDay();
QStringList tipsOfTheDay();
WelcomeModePrivate *m_d;
};
......
......@@ -15,11 +15,14 @@
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(247, 247, 247, 255), stop:1 rgba(215, 215, 215, 255));
}</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<item>
<widget class="QWidget" name="gradientWidget" native="true">
<property name="styleSheet">
<string>#gradientWidget {
......@@ -27,6 +30,12 @@ background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0
}</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="1">
<spacer name="verticalSpacer_3">
<property name="orientation">
......@@ -137,7 +146,7 @@ background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0
<bool>false</bool>
</property>
<property name="styleSheet">
<string>#navFrame QToolButton {
<string notr="true">#navFrame QToolButton {
border: none;
font-size: 10pt;
color: grey;
......@@ -147,9 +156,9 @@ background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0
color: black;
}
#navFrame QToolButton:checked {
#navFrame QToolButton:checked {
color: black;
border-bottom: 1px solid palette(Text);
border-bottom: 1px solid ;
}</string>
</property>
<property name="frameShape">
......@@ -210,7 +219,7 @@ 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>0</number>
</property>
<widget class="QWidget" name="page">
<widget class="QFrame" name="recentProjectsFrame_2">
......@@ -332,42 +341,84 @@ p, li { white-space: pre-wrap; }
<property name="styleSheet">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0">
<widget class="QLabel" name="projTitleLabel_3">
<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;
<widget class="QLabel" name="projTitleLabel_3">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>251</width>
<height>36</height>
</rect>
</property>
<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;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:16px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:x-large; color:#555555;&quot;&gt;Did you know?&lt;/span&gt;&lt;/p&gt;
&lt;hr /&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QTextBrowser" name="didYouKnowTextBrowser">
<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>
</layout>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
<widget class="QTextBrowser" name="didYouKnowTextBrowser">
<property name="geometry">
<rect>
<x>9</x>
<y>51</y>
<width>256</width>
<height>131</height>
</rect>
</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>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>210</x>
<y>14</y>
<width>51</width>
<height>20</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QToolButton" name="prevTipBtn">
<property name="text">
<string>&lt;</string>
</property>
<property name="arrowType">
<enum>Qt::LeftArrow</enum>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="nextTipBtn">
<property name="text">
<string>&gt;</string>
</property>
<property name="arrowType">
<enum>Qt::RightArrow</enum>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QFrame" name="recentProjectsFrame_4">
<property name="geometry">
......@@ -401,7 +452,7 @@ p, li { white-space: pre-wrap; }
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:16px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:x-large; color:#555555;&quot;&gt;Explore Demos and Examples&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:16px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:x-large; color:#555555;&quot;&gt;Demos and Examples&lt;/span&gt;&lt;/p&gt;
&lt;hr /&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
......
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