mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-01 11:03:54 -07:00
fix bug with release channel setting not being remembered (#5365)
This commit is contained in:
parent
df9c5ae53c
commit
f737d9a794
2 changed files with 12 additions and 5 deletions
|
|
@ -68,7 +68,6 @@ GeneralSettingsPage::GeneralSettingsPage()
|
||||||
showTipsOnStartup.setChecked(settings.getShowTipsOnStartup());
|
showTipsOnStartup.setChecked(settings.getShowTipsOnStartup());
|
||||||
|
|
||||||
connect(&languageBox, SIGNAL(currentIndexChanged(int)), this, SLOT(languageBoxChanged(int)));
|
connect(&languageBox, SIGNAL(currentIndexChanged(int)), this, SLOT(languageBoxChanged(int)));
|
||||||
connect(&updateReleaseChannelBox, SIGNAL(currentIndexChanged(int)), &settings, SLOT(setUpdateReleaseChannel(int)));
|
|
||||||
connect(&startupUpdateCheckCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings,
|
connect(&startupUpdateCheckCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings,
|
||||||
&SettingsCache::setCheckUpdatesOnStartup);
|
&SettingsCache::setCheckUpdatesOnStartup);
|
||||||
connect(&updateNotificationCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings, &SettingsCache::setNotifyAboutUpdate);
|
connect(&updateNotificationCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings, &SettingsCache::setNotifyAboutUpdate);
|
||||||
|
|
@ -172,6 +171,12 @@ GeneralSettingsPage::GeneralSettingsPage()
|
||||||
mainLayout->addWidget(pathsGroupBox);
|
mainLayout->addWidget(pathsGroupBox);
|
||||||
mainLayout->addStretch();
|
mainLayout->addStretch();
|
||||||
|
|
||||||
|
GeneralSettingsPage::retranslateUi();
|
||||||
|
|
||||||
|
// connect the ReleaseChannel combo box only after the entries are inserted in retranslateUi
|
||||||
|
connect(&updateReleaseChannelBox, SIGNAL(currentIndexChanged(int)), &settings, SLOT(setUpdateReleaseChannel(int)));
|
||||||
|
updateReleaseChannelBox.setCurrentIndex(settings.getUpdateReleaseChannel()->getIndex());
|
||||||
|
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -299,12 +304,14 @@ void GeneralSettingsPage::retranslateUi()
|
||||||
resetAllPathsButton->setText(tr("Reset all paths"));
|
resetAllPathsButton->setText(tr("Reset all paths"));
|
||||||
|
|
||||||
const auto &settings = SettingsCache::instance();
|
const auto &settings = SettingsCache::instance();
|
||||||
QList<ReleaseChannel *> channels = settings.getUpdateReleaseChannels();
|
|
||||||
|
// We can't change the strings after they're put into the QComboBox, so this is our workaround
|
||||||
|
int oldIndex = updateReleaseChannelBox.currentIndex();
|
||||||
updateReleaseChannelBox.clear();
|
updateReleaseChannelBox.clear();
|
||||||
for (ReleaseChannel *chan : channels) {
|
for (ReleaseChannel *chan : settings.getUpdateReleaseChannels()) {
|
||||||
updateReleaseChannelBox.insertItem(chan->getIndex(), tr(chan->getName().toUtf8()));
|
updateReleaseChannelBox.insertItem(chan->getIndex(), tr(chan->getName().toUtf8()));
|
||||||
}
|
}
|
||||||
updateReleaseChannelBox.setCurrentIndex(settings.getUpdateReleaseChannel()->getIndex());
|
updateReleaseChannelBox.setCurrentIndex(oldIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
AppearanceSettingsPage::AppearanceSettingsPage()
|
AppearanceSettingsPage::AppearanceSettingsPage()
|
||||||
|
|
|
||||||
|
|
@ -292,7 +292,7 @@ public:
|
||||||
}
|
}
|
||||||
ReleaseChannel *getUpdateReleaseChannel() const
|
ReleaseChannel *getUpdateReleaseChannel() const
|
||||||
{
|
{
|
||||||
return releaseChannels.at(updateReleaseChannel);
|
return releaseChannels.at(qMax(0, updateReleaseChannel));
|
||||||
}
|
}
|
||||||
QList<ReleaseChannel *> getUpdateReleaseChannels() const
|
QList<ReleaseChannel *> getUpdateReleaseChannels() const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue