Add option to open deck in new tab by default (#5143)

* add comments

* add new setting for openDeckInNewTab

* implement open deck in new tab

* rename setting

* fix typo

* set default to false
This commit is contained in:
RickyRister 2024-11-10 15:16:50 -08:00 committed by GitHub
parent c54f47efbf
commit c2fe3cda35
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 64 additions and 6 deletions

View file

@ -440,6 +440,7 @@ void AppearanceSettingsPage::retranslateUi()
UserInterfaceSettingsPage::UserInterfaceSettingsPage()
{
// general settings and notification settings
notificationsEnabledCheckBox.setChecked(SettingsCache::instance().getNotificationsEnabled());
connect(&notificationsEnabledCheckBox, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), &SettingsCache::instance(),
SLOT(setNotificationsEnabled(QT_STATE_CHANGED_T)));
@ -490,6 +491,7 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
notificationsGroupBox = new QGroupBox;
notificationsGroupBox->setLayout(notificationsGrid);
// animation settings
tapAnimationCheckBox.setChecked(SettingsCache::instance().getTapAnimation());
connect(&tapAnimationCheckBox, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), &SettingsCache::instance(),
SLOT(setTapAnimation(QT_STATE_CHANGED_T)));
@ -500,10 +502,23 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
animationGroupBox = new QGroupBox;
animationGroupBox->setLayout(animationGrid);
// deck editor settings
openDeckInNewTabCheckBox.setChecked(SettingsCache::instance().getOpenDeckInNewTab());
connect(&openDeckInNewTabCheckBox, SIGNAL(QT_STATE_CHANGED(QT_STATE_CHANGED_T)), &SettingsCache::instance(),
SLOT(setOpenDeckInNewTab(QT_STATE_CHANGED_T)));
auto *deckEditorGrid = new QGridLayout;
deckEditorGrid->addWidget(&openDeckInNewTabCheckBox, 0, 0);
deckEditorGroupBox = new QGroupBox;
deckEditorGroupBox->setLayout(deckEditorGrid);
// putting it all together
auto *mainLayout = new QVBoxLayout;
mainLayout->addWidget(generalGroupBox);
mainLayout->addWidget(notificationsGroupBox);
mainLayout->addWidget(animationGroupBox);
mainLayout->addWidget(deckEditorGroupBox);
mainLayout->addStretch();
setLayout(mainLayout);
@ -532,6 +547,8 @@ void UserInterfaceSettingsPage::retranslateUi()
buddyConnectNotificationsEnabledCheckBox.setText(tr("Notify in the taskbar when users in your buddy list connect"));
animationGroupBox->setTitle(tr("Animation settings"));
tapAnimationCheckBox.setText(tr("&Tap/untap animation"));
deckEditorGroupBox->setTitle(tr("Deck editor settings"));
openDeckInNewTabCheckBox.setText(tr("Always open deck in new tab"));
}
DeckEditorSettingsPage::DeckEditorSettingsPage()