Allow hiding API settings in notifications option page

This commit is contained in:
Martchus 2017-09-08 16:56:50 +02:00
parent bae7f7c4c8
commit 07a47f1b06
2 changed files with 17 additions and 2 deletions

View File

@ -337,8 +337,9 @@ void ConnectionOptionPage::applyAndReconnect()
}
// NotificationsOptionPage
NotificationsOptionPage::NotificationsOptionPage(QWidget *parentWidget)
NotificationsOptionPage::NotificationsOptionPage(bool noApi, QWidget *parentWidget)
: NotificationsOptionPageBase(parentWidget)
, m_noApi(noApi)
{
}
@ -346,6 +347,13 @@ NotificationsOptionPage::~NotificationsOptionPage()
{
}
QWidget *NotificationsOptionPage::setupWidget()
{
auto *w = NotificationsOptionPageBase::setupWidget();
ui()->apiGroupBox->setHidden(m_noApi);
return w;
}
bool NotificationsOptionPage::apply()
{
bool ok = true;

View File

@ -45,7 +45,14 @@ std::vector<Data::SyncthingConnectionSettings> m_secondarySettings;
int m_currentIndex;
END_DECLARE_OPTION_PAGE
DECLARE_UI_FILE_BASED_OPTION_PAGE(NotificationsOptionPage)
BEGIN_DECLARE_UI_FILE_BASED_OPTION_PAGE_CUSTOM_CTOR(NotificationsOptionPage)
public:
NotificationsOptionPage(bool noApi = false, QWidget *parentWidget = nullptr);
private:
DECLARE_SETUP_WIDGETS
bool m_noApi;
END_DECLARE_OPTION_PAGE
DECLARE_UI_FILE_BASED_OPTION_PAGE(AppearanceOptionPage)