void SettingsDialog::AddPage(Page id, SettingsPage* page) { // Connect page's signals to the settings dialog's signals connect(page, SIGNAL(NotificationPreview(OSD::Behaviour,QString,QString)), SIGNAL(NotificationPreview(OSD::Behaviour,QString,QString))); connect(page, SIGNAL(SetWiimotedevInterfaceActived(bool)), SIGNAL(SetWiimotedevInterfaceActived(bool))); // Create the list item QListWidgetItem* item = new QListWidgetItem(page->windowIcon(), page->windowTitle()); ui_->list->addItem(item); if (!page->IsEnabled()) { item->setFlags(Qt::NoItemFlags); } // Create a scroll area containing the page QScrollArea* area = new QScrollArea; area->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); area->setWidget(page); area->setWidgetResizable(true); area->setFrameShape(QFrame::NoFrame); area->setMinimumWidth(page->layout()->minimumSize().width()); // Add the page to the stack ui_->stacked_widget->addWidget(area); // Remember where the page is PageData data; data.index_ = ui_->list->row(item); data.scroll_area_ = area; data.page_ = page; pages_[id] = data; }
void NotificationsSettingsPage::PrepareNotificationPreview() { OSD::Behaviour notificationType = OSD::Disabled; if (ui_->notifications_native->isChecked()) { notificationType = OSD::Native; } else if (ui_->notifications_pretty->isChecked()) { notificationType = OSD::Pretty; } else if (ui_->notifications_tray->isChecked()) { notificationType = OSD::TrayPopup; } // If user changes timeout or other options, that won't be reflected in the // preview emit NotificationPreview(notificationType, ui_->notifications_custom_text1->text(), ui_->notifications_custom_text2->text()); }