2016-01-19 22:59:11 -05:00
|
|
|
#include <QToolButton>
|
|
|
|
|
2013-07-18 15:32:12 -04:00
|
|
|
#include <retroshare-gui/mainpage.h>
|
2013-10-09 05:31:40 -04:00
|
|
|
#include "common/FloatingHelpBrowser.h"
|
2017-02-25 17:52:57 -05:00
|
|
|
#include "gui/settings/rsharesettings.h"
|
2013-07-18 15:32:12 -04:00
|
|
|
|
2014-05-09 22:38:47 -04:00
|
|
|
MainPage::MainPage(QWidget *parent , Qt::WindowFlags flags ) : QWidget(parent, flags)
|
2013-07-18 15:32:12 -04:00
|
|
|
{
|
2013-10-09 05:31:40 -04:00
|
|
|
mHelpBrowser = NULL ;
|
2014-05-09 22:38:47 -04:00
|
|
|
mIcon = QIcon();
|
|
|
|
mName = "";
|
|
|
|
mHelp = "";
|
2013-07-19 08:18:58 -04:00
|
|
|
}
|
|
|
|
|
2017-02-25 17:52:57 -05:00
|
|
|
void MainPage::registerHelpButton(QToolButton *button, const QString& help_html_text, const QString &code_name)
|
2013-07-18 15:32:12 -04:00
|
|
|
{
|
2017-02-25 17:52:57 -05:00
|
|
|
mHelpCodeName = code_name ;
|
|
|
|
|
2013-10-09 05:31:40 -04:00
|
|
|
if (mHelpBrowser == NULL)
|
|
|
|
mHelpBrowser = new FloatingHelpBrowser(this, button) ;
|
2016-01-19 22:59:11 -05:00
|
|
|
|
|
|
|
float S = QFontMetricsF(button->font()).height() ;
|
|
|
|
button->setIconSize(QSize(S,S)) ;
|
2013-07-18 15:32:12 -04:00
|
|
|
|
2017-02-25 17:52:57 -05:00
|
|
|
mHelpBrowser->setHelpText(help_html_text) ;
|
2013-07-19 08:18:58 -04:00
|
|
|
}
|
2013-07-18 15:32:12 -04:00
|
|
|
|
2017-02-25 17:52:57 -05:00
|
|
|
void MainPage::showEvent(QShowEvent *s)
|
|
|
|
{
|
|
|
|
if(Settings->getPageFirstTimeDisplay(mHelpCodeName) && mHelpBrowser!=NULL)
|
|
|
|
{
|
|
|
|
mHelpBrowser->show();
|
|
|
|
|
|
|
|
Settings->setPageFirstTimeDisplay(mHelpCodeName,false);
|
|
|
|
}
|
|
|
|
|
|
|
|
QWidget::showEvent(s);
|
|
|
|
}
|