Ejemplo n.º 1
0
void SettingsPageDlg::setButtonStates()
{
    SettingsPage *sp = currentPage();
    ui.buttonBox->button(QDialogButtonBox::Apply)->setEnabled(sp && sp->hasChanged());
    ui.buttonBox->button(QDialogButtonBox::Reset)->setEnabled(sp && sp->hasChanged());
    ui.buttonBox->button(QDialogButtonBox::RestoreDefaults)->setEnabled(sp && sp->hasDefaults());
}
NotificationsSettingsPage::NotificationsSettingsPage(QWidget *parent)
    : SettingsPage(tr("Interface"), tr("Notifications"), parent),
    _hasDefaults(false)
{
    QVBoxLayout *layout = new QVBoxLayout(this);
    foreach(AbstractNotificationBackend *backend, QtUi::notificationBackends()) {
        SettingsPage *cw = backend->createConfigWidget();
        if (cw) {
            cw->setParent(this);
            _configWidgets.append(cw);
            layout->addWidget(cw);
            connect(cw, SIGNAL(changed(bool)), SLOT(widgetHasChanged()));
            _hasDefaults |= cw->hasDefaults();
        }
    }