added some delay in the showHelp() feature

This commit is contained in:
csoler 2017-02-26 00:16:36 +01:00
parent 12246e369b
commit 3230e55f04
4 changed files with 12 additions and 10 deletions

View File

@ -1,4 +1,5 @@
#include <QToolButton>
#include <QTimer>
#include <retroshare-gui/mainpage.h>
#include "common/FloatingHelpBrowser.h"
@ -27,11 +28,12 @@ void MainPage::registerHelpButton(QToolButton *button, const QString& help_html_
void MainPage::showEvent(QShowEvent *s)
{
if(Settings->getPageFirstTimeDisplay(mHelpCodeName) && mHelpBrowser!=NULL)
if(!Settings->getPageAlreadyDisplayed(mHelpCodeName) && mHelpBrowser!=NULL)
{
mHelpBrowser->show();
// I use a timer to make sure that the GUI is able to process that.
QTimer::singleShot(1000, mHelpBrowser,SLOT(show()));
Settings->setPageFirstTimeDisplay(mHelpCodeName,false);
Settings->setPageAlreadyDisplayed(mHelpCodeName,true);
}
QWidget::showEvent(s);

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

@ -1161,13 +1161,13 @@ void RshareSettings::setWebinterfaceAllowAllIps(bool allow_all)
setValueToGroup("Webinterface", "allowAllIps", allow_all);
}
bool RshareSettings::getPageFirstTimeDisplay(const QString& page_name)
bool RshareSettings::getPageAlreadyDisplayed(const QString& page_name)
{
return valueFromGroup("PageDisplayed",page_name,true).toBool();
return valueFromGroup("PageAlreadyDisplayed",page_name,false).toBool();
}
void RshareSettings::setPageFirstTimeDisplay(const QString& page_name,bool b)
void RshareSettings::setPageAlreadyDisplayed(const QString& page_name,bool b)
{
return setValueToGroup("PageDisplayed",page_name,b);
return setValueToGroup("PageAlreadyDisplayed",page_name,b);
}

View File

@ -336,8 +336,8 @@ 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 getPageFirstTimeDisplay(const QString& page_code) ;
void setPageFirstTimeDisplay(const QString& page_code,bool b) ;
bool getPageAlreadyDisplayed(const QString& page_code) ;
void setPageAlreadyDisplayed(const QString& page_code,bool b) ;
protected:
/** Default constructor. */