Index: src/app/qgstipfactory.h =================================================================== --- src/app/qgstipfactory.h (revision 15216) +++ src/app/qgstipfactory.h (working copy) @@ -32,7 +32,7 @@ * @see also QgsTipOfTheDay, QgsTip */ -class QgsTipFactory : public QObject +class QgsTipFactory : public QObject { Q_OBJECT; //used for tr() so we dont need to do QObject::tr() public: @@ -45,9 +45,9 @@ */ QgsTip getTip(); /** Get a specific tip (generic or gui-centric). - * @param thePosition The tip returned will be based on the + * @param thePosition The tip returned will be based on the * number passed in as thePosition. If the - * position is invalid, an empty string will be + * position is invalid, an empty string will be * returned. * @return An QgsTip containing the tip */ @@ -61,6 +61,9 @@ */ QgsTip getGuiTip(); + int position( QgsTip ); + int count(); + private: void addGenericTip(QgsTip); void addGuiTip(QgsTip); Index: src/app/qgstipfactory.cpp =================================================================== --- src/app/qgstipfactory.cpp (revision 15216) +++ src/app/qgstipfactory.cpp (working copy) @@ -145,3 +145,20 @@ return 0; } +int QgsTipFactory::position(QgsTip tip) +{ + for(int i = 0; i < mAllTips.count(); ++i) + { + QgsTip myTip = mAllTips.at( i ); + if ( myTip.title() == tip.title() ) + { + return i; + } + } + return -1; +} + +int QgsTipFactory::count() +{ + return mAllTips.count(); +} Index: src/app/qgstipgui.cpp =================================================================== --- src/app/qgstipgui.cpp (revision 15216) +++ src/app/qgstipgui.cpp (working copy) @@ -46,16 +46,42 @@ qgisIcon->setPixmap( icon ); QgsTipFactory myFactory; QgsTip myTip = myFactory.getTip(); + mTipPosition = myFactory.position( myTip ); lblTitle->setText(myTip.title()); txtTip->setHtml(myTip.content()); - } void QgsTipGui::on_cbxDisableTips_toggled(bool theFlag) { QSettings settings; - //note the ! below as when the cbx is checked (true) we want to + //note the ! below as when the cbx is checked (true) we want to //change the setting to false settings.setValue( "/qgis/showTips", !theFlag ); hide(); } + +void QgsTipGui::on_btnNext_clicked() +{ + mTipPosition += 1; + QgsTipFactory myFactory; + if ( mTipPosition >= myFactory.count() ) + { + mTipPosition = 0; + } + QgsTip myTip = myFactory.getTip( mTipPosition ); + lblTitle->setText( myTip.title() ); + txtTip->setHtml( myTip.content() ); +} + +void QgsTipGui::on_btnPrev_clicked() +{ + mTipPosition -= 1; + QgsTipFactory myFactory; + if ( mTipPosition < 0 ) + { + mTipPosition = myFactory.count() - 1; + } + QgsTip myTip = myFactory.getTip( mTipPosition ); + lblTitle->setText( myTip.title() ); + txtTip->setHtml( myTip.content() ); +} Index: src/app/qgstipgui.h =================================================================== --- src/app/qgstipgui.h (revision 15216) +++ src/app/qgstipgui.h (working copy) @@ -30,8 +30,12 @@ private: void init(); + int mTipPosition; + private slots: void on_cbxDisableTips_toggled(bool theFlag); + void on_btnPrev_clicked(); + void on_btnNext_clicked(); }; #endif Index: src/ui/qgstipguibase.ui =================================================================== --- src/ui/qgstipguibase.ui (revision 15216) +++ src/ui/qgstipguibase.ui (working copy) @@ -21,7 +21,7 @@ - + font-weight: bold; @@ -34,7 +34,7 @@ - + @@ -46,15 +46,15 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Ubuntu'; font-size:10pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">A nice tip goes here...</p></body></html> +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:10pt;">A nice tip goes here...</span></p></body></html> true - + I've had enough tips, don't show this on start up any more! @@ -62,6 +62,20 @@ + + + Previous tip + + + + + + + Next tip + + + + Qt::Horizontal