Fix saving OSD pretty settings
This commit is contained in:
@@ -60,6 +60,7 @@ const char *NotificationsSettingsPage::kSettingsGroup = "Notifications";
|
|||||||
|
|
||||||
NotificationsSettingsPage::NotificationsSettingsPage(SettingsDialog* dialog)
|
NotificationsSettingsPage::NotificationsSettingsPage(SettingsDialog* dialog)
|
||||||
: SettingsPage(dialog), ui_(new Ui_NotificationsSettingsPage), pretty_popup_(new OSDPretty(OSDPretty::Mode_Draggable)) {
|
: SettingsPage(dialog), ui_(new Ui_NotificationsSettingsPage), pretty_popup_(new OSDPretty(OSDPretty::Mode_Draggable)) {
|
||||||
|
|
||||||
ui_->setupUi(this);
|
ui_->setupUi(this);
|
||||||
setWindowIcon(IconLoader::Load("help-hint"));
|
setWindowIcon(IconLoader::Load("help-hint"));
|
||||||
|
|
||||||
@@ -121,6 +122,8 @@ NotificationsSettingsPage::NotificationsSettingsPage(SettingsDialog* dialog)
|
|||||||
ui_->notifications_exp_chooser1->setIcon(IconLoader::Load("list-add"));
|
ui_->notifications_exp_chooser1->setIcon(IconLoader::Load("list-add"));
|
||||||
ui_->notifications_exp_chooser2->setIcon(IconLoader::Load("list-add"));
|
ui_->notifications_exp_chooser2->setIcon(IconLoader::Load("list-add"));
|
||||||
|
|
||||||
|
connect(pretty_popup_, SIGNAL(PositionChanged()), SLOT(PrettyOSDChanged()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NotificationsSettingsPage::~NotificationsSettingsPage() {
|
NotificationsSettingsPage::~NotificationsSettingsPage() {
|
||||||
@@ -236,11 +239,16 @@ void NotificationsSettingsPage::Save() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void NotificationsSettingsPage::PrettyOpacityChanged(int value) {
|
void NotificationsSettingsPage::PrettyOpacityChanged(int value) {
|
||||||
|
|
||||||
pretty_popup_->set_background_opacity(qreal(value) / 100.0);
|
pretty_popup_->set_background_opacity(qreal(value) / 100.0);
|
||||||
|
set_changed();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotificationsSettingsPage::UpdatePopupVisible() {
|
void NotificationsSettingsPage::UpdatePopupVisible() {
|
||||||
|
|
||||||
pretty_popup_->setVisible(isVisible() && ui_->notifications_pretty->isChecked());
|
pretty_popup_->setVisible(isVisible() && ui_->notifications_pretty->isChecked());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotificationsSettingsPage::PrettyColorPresetChanged(int index) {
|
void NotificationsSettingsPage::PrettyColorPresetChanged(int index) {
|
||||||
@@ -262,6 +270,8 @@ void NotificationsSettingsPage::PrettyColorPresetChanged(int index) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_changed();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotificationsSettingsPage::ChooseBgColor() {
|
void NotificationsSettingsPage::ChooseBgColor() {
|
||||||
@@ -273,6 +283,8 @@ void NotificationsSettingsPage::ChooseBgColor() {
|
|||||||
pretty_popup_->set_background_color(color.rgb());
|
pretty_popup_->set_background_color(color.rgb());
|
||||||
ui_->notifications_bg_preset->setItemData(2, color, Qt::DecorationRole);
|
ui_->notifications_bg_preset->setItemData(2, color, Qt::DecorationRole);
|
||||||
|
|
||||||
|
set_changed();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotificationsSettingsPage::ChooseFgColor() {
|
void NotificationsSettingsPage::ChooseFgColor() {
|
||||||
@@ -283,13 +295,18 @@ void NotificationsSettingsPage::ChooseFgColor() {
|
|||||||
|
|
||||||
pretty_popup_->set_foreground_color(color.rgb());
|
pretty_popup_->set_foreground_color(color.rgb());
|
||||||
|
|
||||||
|
set_changed();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotificationsSettingsPage::ChooseFont() {
|
void NotificationsSettingsPage::ChooseFont() {
|
||||||
|
|
||||||
bool ok;
|
bool ok;
|
||||||
QFont font = QFontDialog::getFont(&ok, pretty_popup_->font(), this);
|
QFont font = QFontDialog::getFont(&ok, pretty_popup_->font(), this);
|
||||||
if (ok) pretty_popup_->set_font(font);
|
if (ok) {
|
||||||
|
pretty_popup_->set_font(font);
|
||||||
|
set_changed();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -355,3 +372,7 @@ void NotificationsSettingsPage::NotificationTypeChanged() {
|
|||||||
ui_->notifications_disable_duration->setEnabled(pretty);
|
ui_->notifications_disable_duration->setEnabled(pretty);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NotificationsSettingsPage::PrettyOSDChanged() {
|
||||||
|
set_changed();
|
||||||
|
}
|
||||||
|
|||||||
@@ -67,6 +67,8 @@ class NotificationsSettingsPage : public SettingsPage {
|
|||||||
|
|
||||||
void UpdatePopupVisible();
|
void UpdatePopupVisible();
|
||||||
|
|
||||||
|
void PrettyOSDChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui_NotificationsSettingsPage *ui_;
|
Ui_NotificationsSettingsPage *ui_;
|
||||||
OSDPretty *pretty_popup_;
|
OSDPretty *pretty_popup_;
|
||||||
|
|||||||
@@ -491,6 +491,7 @@ void OSDPretty::mouseReleaseEvent(QMouseEvent *) {
|
|||||||
popup_screen_ = current_screen();
|
popup_screen_ = current_screen();
|
||||||
popup_screen_name_ = current_screen()->name();
|
popup_screen_name_ = current_screen()->name();
|
||||||
popup_pos_ = current_pos();
|
popup_pos_ = current_pos();
|
||||||
|
emit PositionChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,6 +107,9 @@ class OSDPretty : public QWidget {
|
|||||||
bool toggle_mode() const { return toggle_mode_; }
|
bool toggle_mode() const { return toggle_mode_; }
|
||||||
void set_toggle_mode(bool toggle_mode) { toggle_mode_ = toggle_mode; }
|
void set_toggle_mode(bool toggle_mode) { toggle_mode_ = toggle_mode; }
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void PositionChanged();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void ReloadSettings();
|
void ReloadSettings();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user