Merge pull request #695 from csoler/v0.6-ImprovedGUI

V0.6 improved gui
This commit is contained in:
csoler 2017-02-26 00:18:15 +01:00 committed by GitHub
commit cae0668083
14 changed files with 52 additions and 17 deletions

View File

@ -188,7 +188,8 @@ ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WindowFlags flags)
</p> \
"
).arg(QString::number(2*S)).arg(QString::number(S)) ;
registerHelpButton(ui.helpButton,help_str) ;
registerHelpButton(ui.helpButton,help_str,"ChatLobbyDialog") ;
}
ChatLobbyWidget::~ChatLobbyWidget()

View File

@ -489,7 +489,7 @@ TransfersDialog::TransfersDialog(QWidget *parent)
").arg(QString::number(2*S)).arg(QString::number(S)) ;
registerHelpButton(ui.helpButton,help_str) ;
registerHelpButton(ui.helpButton,help_str,"TransfersDialog") ;
}
TransfersDialog::~TransfersDialog()

View File

@ -169,7 +169,7 @@ QList<int> sizes;
</ul> </p> \
") ;
registerHelpButton(ui.helpButton, hlp_str) ;
registerHelpButton(ui.helpButton, hlp_str,"FriendsDialog") ;
}
FriendsDialog::~FriendsDialog ()

View File

@ -84,7 +84,7 @@ HomePage::HomePage(QWidget *parent) :
<p>Another option is to search the internet for \"Retroshare chat servers\" (independently administrated). These servers allow you to exchange \
certificates with a dedicated Retroshare node, through which\
you will be able to meet other people anonymously.</p> ").arg(QString::number(2*S)).arg(width()*0.5);
registerHelpButton(ui->helpButton,help_str) ;
registerHelpButton(ui->helpButton,help_str,"HomePage") ;
}
HomePage::~HomePage()

View File

@ -358,7 +358,7 @@ IdDialog::IdDialog(QWidget *parent) :
<p>An <b>circle</b> can be restricted to another circle, thereby limiting its visibility to members of that circle \
or even self-restricted, meaning that it is only visible to invited members.</p>") ;
registerHelpButton(ui->helpButton, hlp_str) ;
registerHelpButton(ui->helpButton, hlp_str,"PeopleDialog") ;
// load settings
processSettings(true);

View File

@ -1,7 +1,9 @@
#include <QToolButton>
#include <QTimer>
#include <retroshare-gui/mainpage.h>
#include "common/FloatingHelpBrowser.h"
#include "gui/settings/rsharesettings.h"
MainPage::MainPage(QWidget *parent , Qt::WindowFlags flags ) : QWidget(parent, flags)
{
@ -11,14 +13,28 @@ MainPage::MainPage(QWidget *parent , Qt::WindowFlags flags ) : QWidget(parent, f
mHelp = "";
}
void MainPage::registerHelpButton(QToolButton *button,const QString& help_html_txt)
void MainPage::registerHelpButton(QToolButton *button, const QString& help_html_text, const QString &code_name)
{
mHelpCodeName = code_name ;
if (mHelpBrowser == NULL)
mHelpBrowser = new FloatingHelpBrowser(this, button) ;
float S = QFontMetricsF(button->font()).height() ;
button->setIconSize(QSize(S,S)) ;
mHelpBrowser->setHelpText(help_html_txt) ;
mHelpBrowser->setHelpText(help_html_text) ;
}
void MainPage::showEvent(QShowEvent *s)
{
if(!Settings->getPageAlreadyDisplayed(mHelpCodeName) && mHelpBrowser!=NULL)
{
// I use a timer to make sure that the GUI is able to process that.
QTimer::singleShot(1000, mHelpBrowser,SLOT(show()));
Settings->setPageAlreadyDisplayed(mHelpCodeName,true);
}
QWidget::showEvent(s);
}

View File

@ -306,7 +306,7 @@ MessagesDialog::MessagesDialog(QWidget *parent)
to a channel's owner.</p> \
").arg(QString::number(2*S)).arg(QString::number(S)) ;
registerHelpButton(ui.helpButton,help_str) ;
registerHelpButton(ui.helpButton,help_str,"MessagesDialog") ;
}
MessagesDialog::~MessagesDialog()

View File

@ -124,7 +124,7 @@ NewsFeed::NewsFeed(QWidget *parent) :
QString hlp_str = tr(
" <h1><img width=\"32\" src=\":/icons/help_64.png\">&nbsp;&nbsp;News Feed</h1> \
<p>The News Feed displays the last events on your network, sorted by the time you received them. \
<p>The Log 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 <b>Options</b>. </p> \
<p>The various events shown are: \
@ -136,7 +136,7 @@ QString hlp_str = tr(
</ul> </p> \
") ;
registerHelpButton(ui->helpButton,hlp_str) ;
registerHelpButton(ui->helpButton,hlp_str,"NewFeed") ;
// load settings
processSettings(true);

View File

@ -27,8 +27,8 @@
#include "FloatingHelpBrowser.h"
FloatingHelpBrowser::FloatingHelpBrowser(QWidget *parent, QAbstractButton *button) :
QTextBrowser(parent), mButton(button)
FloatingHelpBrowser::FloatingHelpBrowser(QWidget *parent, QAbstractButton *button)
:QTextBrowser(parent), mButton(button)
{
QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect(this);
effect->setBlurRadius(30.0);

View File

@ -36,7 +36,7 @@ public:
void setHelpText(const QString &helpText);
public slots:
void showHelp(bool state);
void showHelp(bool state=false);
private slots:
void textChanged();

View File

@ -123,7 +123,7 @@ GxsGroupFrameDialog::~GxsGroupFrameDialog()
void GxsGroupFrameDialog::initUi()
{
registerHelpButton(ui->helpButton, getHelpString()) ;
registerHelpButton(ui->helpButton, getHelpString(),pageName()) ;
ui->titleBarPixmap->setPixmap(QPixmap(icon(ICON_NAME)));
ui->titleBarLabel->setText(text(TEXT_NAME));

View File

@ -1160,3 +1160,14 @@ void RshareSettings::setWebinterfaceAllowAllIps(bool allow_all)
{
setValueToGroup("Webinterface", "allowAllIps", allow_all);
}
bool RshareSettings::getPageAlreadyDisplayed(const QString& page_name)
{
return valueFromGroup("PageAlreadyDisplayed",page_name,false).toBool();
}
void RshareSettings::setPageAlreadyDisplayed(const QString& page_name,bool b)
{
return setValueToGroup("PageAlreadyDisplayed",page_name,b);
}

View File

@ -336,6 +336,9 @@ public:
// proxy function that computes the best icon size among sizes passed as array, to match the recommended size on screen.
int computeBestIconSize(int n_sizes, int *sizes, int recommended_size);
bool getPageAlreadyDisplayed(const QString& page_code) ;
void setPageAlreadyDisplayed(const QString& page_code,bool b) ;
protected:
/** Default constructor. */
RshareSettings();

View File

@ -58,16 +58,20 @@ public:
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;
// Call this to add some help info to the page. The way the info is
// shown is handled by showHelp() below;
//
void registerHelpButton(QToolButton *button, const QString& help_html_text) ;
void registerHelpButton(QToolButton *button, const QString& help_html_text, const QString &code_name) ;
protected:
virtual void showEvent(QShowEvent *);
private:
FloatingHelpBrowser *mHelpBrowser ;
QIcon mIcon;
QString mName;
QString mHelp;
QString mHelpCodeName;
};
#endif