From a07e8d889af63b7d82d02123c4eb9768cd7538a5 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 18 Jul 2013 19:32:12 +0000 Subject: [PATCH] added help system to the MainPage class. Each page can now derive its own help string and show it using a two-states help button. To try it, I have implemented it on the NewsFeed page git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6514 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/MainPage.cpp | 35 +++++++++++++++++++ retroshare-gui/src/gui/NewsFeed.cpp | 20 +++++++++++ retroshare-gui/src/gui/NewsFeed.h | 2 ++ retroshare-gui/src/gui/NewsFeed.ui | 23 ++++++++++++ retroshare-gui/src/gui/images.qrc | 1 + retroshare-gui/src/gui/images/64px_help.png | Bin 0 -> 6761 bytes retroshare-gui/src/retroshare-gui.pro | 1 + retroshare-gui/src/retroshare-gui/mainpage.h | 24 ++++++++++--- 8 files changed, 101 insertions(+), 5 deletions(-) create mode 100644 retroshare-gui/src/gui/MainPage.cpp create mode 100644 retroshare-gui/src/gui/images/64px_help.png diff --git a/retroshare-gui/src/gui/MainPage.cpp b/retroshare-gui/src/gui/MainPage.cpp new file mode 100644 index 000000000..2bb79a758 --- /dev/null +++ b/retroshare-gui/src/gui/MainPage.cpp @@ -0,0 +1,35 @@ +#include +#include +#include +#include + +MainPage::MainPage(QWidget *parent , Qt::WindowFlags flags ) : QWidget(parent, flags) +{ + help_browser = NULL ; +} + + +void MainPage::showHelp(bool b) +{ + if(help_browser == NULL) + { + help_browser = new QTextBrowser(this) ; + help_browser->setHtml(helpHtmlText()) ; + + QGraphicsDropShadowEffect * effect = new QGraphicsDropShadowEffect(help_browser) ; + effect->setBlurRadius(30.0); + help_browser->setGraphicsEffect(effect); + + help_browser->setSizePolicy(QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum)) ; + help_browser->resize(size()*0.5) ; + help_browser->move(width()/2 - help_browser->width()/2,height()/2 - help_browser->height()/2); + help_browser->update() ; + } + std::cerr << "Toggling help to " << b << std::endl; + if(b) + help_browser->show() ; + else + help_browser->hide() ; +} + + diff --git a/retroshare-gui/src/gui/NewsFeed.cpp b/retroshare-gui/src/gui/NewsFeed.cpp index 062034b39..acbe22be7 100644 --- a/retroshare-gui/src/gui/NewsFeed.cpp +++ b/retroshare-gui/src/gui/NewsFeed.cpp @@ -84,6 +84,7 @@ NewsFeed::NewsFeed(QWidget *parent) connect(removeAllButton, SIGNAL(clicked()), this, SLOT(removeAll())); connect(feedOptionsButton, SIGNAL(clicked()), this, SLOT(feedoptions())); + connect(helpButton, SIGNAL(toggled(bool)), (MainPage*)this, SLOT(showHelp(bool))); } NewsFeed::~NewsFeed() @@ -93,6 +94,25 @@ NewsFeed::~NewsFeed() } } +const QString& NewsFeed::helpHtmlText() const +{ + static const QString str = tr( + "

  News Feed

\ +

The News Feed displays the last events on your network, sorted by the time you received them. \ + This gives you a summary of the activity of your friends. \ + You can configure which events to show by pressing on Options.

\ +

The various events shown are: \ +

    \ +
  • Connection attempts (useful to make friends with new people and control who's trying to reach you)
  • \ +
  • Channel and Forum posts
  • \ +
  • New Channels and Forums you can subscribe to
  • \ +
  • Private messages from your friends
  • \ +

\ + ") ; + + return str ; +} + UserNotify *NewsFeed::getUserNotify(QObject *parent) { return new NewsFeedUserNotify(this, parent); diff --git a/retroshare-gui/src/gui/NewsFeed.h b/retroshare-gui/src/gui/NewsFeed.h index 4daf2f5d6..9ce8f82d7 100644 --- a/retroshare-gui/src/gui/NewsFeed.h +++ b/retroshare-gui/src/gui/NewsFeed.h @@ -52,6 +52,8 @@ public: virtual void openChat(std::string peerId); virtual void openComments(uint32_t type, const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, const QString &title); + virtual const QString& helpHtmlText() const ; + static void testFeeds(uint notifyFlags); static void testFeed(FeedNotify *feedNotify); diff --git a/retroshare-gui/src/gui/NewsFeed.ui b/retroshare-gui/src/gui/NewsFeed.ui index fc5d7d0e8..8ae0de9df 100644 --- a/retroshare-gui/src/gui/NewsFeed.ui +++ b/retroshare-gui/src/gui/NewsFeed.ui @@ -97,6 +97,29 @@ + + + + + 0 + 0 + + + + + + + + :/images/64px_help.png:/images/64px_help.png + + + true + + + true + + + diff --git a/retroshare-gui/src/gui/images.qrc b/retroshare-gui/src/gui/images.qrc index d3ead3723..204f667a6 100644 --- a/retroshare-gui/src/gui/images.qrc +++ b/retroshare-gui/src/gui/images.qrc @@ -10,6 +10,7 @@ images/help/addafriend.png images/help/addfriendkey.png images/help/dhtgreen.png + images/64px_help.png images/help/natgreen.png images/help/natred.png images/attach.png diff --git a/retroshare-gui/src/gui/images/64px_help.png b/retroshare-gui/src/gui/images/64px_help.png new file mode 100644 index 0000000000000000000000000000000000000000..f58d478a733a8d0fdc251b5de26f93f0e05b41dd GIT binary patch literal 6761 zcmZ{o2QXa!*Z)`VEYVA}pXjX4lIW{M?>*{TWm&8i-L96XUqtUMqODHUkRU{ah#I{` zv?W@Uc;q+#XXf{R=6UAc&pq?G=XKuao^xjI%)JQ)dKwg@%%lJSfI>@C&FJ1L{awU_ z_t!UWKFjxp(DA8;8sP5lQQT9Net(Aqp=s%NZ#DnDARj%R000c%wA7SMf)>W}f)kyG z!&VeckA8+!?mP*Ao-c1bq}58;<}{?``H7*PG7}m}pvCja?~lOON|hx6zE5!K*HZfU z%IQ6VhFf}7Nx5{67|s^pnNUt?RIcXJ`Q6rcVty&7U}?AWd2;V{k9nrz&z{}co@OF* zntfc-hIZG=H{mNQM;EtjXJ*(9Rt-fWmD~v{6fm-%o`xkV2|}7QG%!obuKwEpbeI`f z(E9o27yB6X2dX}`3EA_!ZLAe4Bi;(HK&uM7cniA%I^uFds5h0I0c0?g7a$KtZ|Kg% zFYS|0F?k+#0EWW#mDqxIif*L{RxQepOSpvUC`zYsfK(h?x7Em>Fz}XcueiLJQ}EDMLFNM`*gf$qGgu-H5L&AU=5=zCwNU; z5)Kp&pV6%fclUKfuBZ-IEyW!bIo|1{twl-ZWGF$p+~5i}9*OPQ!{-wjgo2Nz_dPhE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4nUl+5-&nm23_q)n>0|(`r)1If@jd( zDgRM(1~*TWNr!2HsW-|NcR2Si%krC_MUDPfgm@`@qbniiD&OS+ha4@lLcrU^@O9;r zxT1G#q0GAn8k#atu|+?GpIeja?Iz^vqO~qP=o_> zo}gO@l}73XS@|)nEMsjzBaYHL(XtFKa+QIA)Q-_4G=%82eFEkW{Xr|k>->;}Oa>7g z)9;+RA!mhDf68z3=bLy>_F zzAgYQxPz;Uu7j(alLv>ih_r~fur$YgN|5mVDK5cbDEr?f1qKF+xc!Ci*FF5VAfip+ z#JwQnUqKU?Kim-vR`Yi9|JxNX*x(-Z1Bg}Kb&38D=HDs7V3^C_`T=6%vgDj92KNlZ zf9U)_#@x*r3HytDNupl5N0|Nt(Y^01G8o|k`1ezZ-nUS($xQEm=;)fZ6dxYjcbd24e-xHD|5>Hh$erSu`d$s<Q4IYee literal 0 HcmV?d00001 diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro index 52e2d89f8..b4397b355 100644 --- a/retroshare-gui/src/retroshare-gui.pro +++ b/retroshare-gui/src/retroshare-gui.pro @@ -623,6 +623,7 @@ SOURCES += main.cpp \ gui/FileTransfer/TurtleRouterStatistics.cpp \ gui/FileTransfer/DetailsDialog.cpp \ gui/FileTransfer/TransferUserNotify.cpp \ + gui/MainPage.cpp \ gui/HelpDialog.cpp \ gui/LogoBar.cpp \ lang/languagesupport.cpp \ diff --git a/retroshare-gui/src/retroshare-gui/mainpage.h b/retroshare-gui/src/retroshare-gui/mainpage.h index f8dfee9e8..3b0b42e8e 100644 --- a/retroshare-gui/src/retroshare-gui/mainpage.h +++ b/retroshare-gui/src/retroshare-gui/mainpage.h @@ -24,17 +24,31 @@ #define _MAINPAGE_H #include +#include class UserNotify; class MainPage : public QWidget { -public: - /** Default Constructor */ - MainPage(QWidget *parent = 0, Qt::WindowFlags flags = 0) : QWidget(parent, flags) {} + Q_OBJECT - virtual void retranslateUi() {} - virtual UserNotify *getUserNotify(QObject */*parent*/) { return NULL; } + public: + /** Default Constructor */ + MainPage(QWidget *parent = 0, Qt::WindowFlags flags = 0) ; + + virtual void retranslateUi() {} + virtual UserNotify *getUserNotify(QObject */*parent*/) { return NULL; } + + // Overload this to add some help info to the page. The way the info is + // shown is handled by showHelp() below; + // + virtual const QString& helpHtmlText() const { static QString s ; return s ; } + + public slots: + void showHelp(bool b) ; + + private: + QTextBrowser *help_browser ; }; #endif