mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-20 09:22:15 -07:00
remove index from ReleaseChannel
This commit is contained in:
parent
c8d49b5bf9
commit
f555f7e0d3
4 changed files with 6 additions and 12 deletions
|
|
@ -21,11 +21,8 @@
|
||||||
|
|
||||||
#define GIT_SHORT_HASH_LEN 7
|
#define GIT_SHORT_HASH_LEN 7
|
||||||
|
|
||||||
int ReleaseChannel::sharedIndex = 0;
|
|
||||||
|
|
||||||
ReleaseChannel::ReleaseChannel() : netMan(new QNetworkAccessManager(this)), response(nullptr), lastRelease(nullptr)
|
ReleaseChannel::ReleaseChannel() : netMan(new QNetworkAccessManager(this)), response(nullptr), lastRelease(nullptr)
|
||||||
{
|
{
|
||||||
index = sharedIndex++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ReleaseChannel::~ReleaseChannel()
|
ReleaseChannel::~ReleaseChannel()
|
||||||
|
|
|
||||||
|
|
@ -82,9 +82,6 @@ public:
|
||||||
~ReleaseChannel() override;
|
~ReleaseChannel() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// shared by all instances
|
|
||||||
static int sharedIndex;
|
|
||||||
int index;
|
|
||||||
QNetworkAccessManager *netMan;
|
QNetworkAccessManager *netMan;
|
||||||
QNetworkReply *response;
|
QNetworkReply *response;
|
||||||
Release *lastRelease;
|
Release *lastRelease;
|
||||||
|
|
@ -94,10 +91,6 @@ protected:
|
||||||
virtual QString getReleaseChannelUrl() const = 0;
|
virtual QString getReleaseChannelUrl() const = 0;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int getIndex() const
|
|
||||||
{
|
|
||||||
return index;
|
|
||||||
}
|
|
||||||
Release *getLastRelease()
|
Release *getLastRelease()
|
||||||
{
|
{
|
||||||
return lastRelease;
|
return lastRelease;
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ GeneralSettingsPage::GeneralSettingsPage()
|
||||||
|
|
||||||
// connect the ReleaseChannel combo box only after the entries are inserted in retranslateUi
|
// connect the ReleaseChannel combo box only after the entries are inserted in retranslateUi
|
||||||
connect(&updateReleaseChannelBox, SIGNAL(currentIndexChanged(int)), &settings, SLOT(setUpdateReleaseChannel(int)));
|
connect(&updateReleaseChannelBox, SIGNAL(currentIndexChanged(int)), &settings, SLOT(setUpdateReleaseChannel(int)));
|
||||||
updateReleaseChannelBox.setCurrentIndex(settings.getUpdateReleaseChannel()->getIndex());
|
updateReleaseChannelBox.setCurrentIndex(settings.getUpdateReleaseChannelIndex());
|
||||||
|
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
}
|
}
|
||||||
|
|
@ -309,7 +309,7 @@ void GeneralSettingsPage::retranslateUi()
|
||||||
int oldIndex = updateReleaseChannelBox.currentIndex();
|
int oldIndex = updateReleaseChannelBox.currentIndex();
|
||||||
updateReleaseChannelBox.clear();
|
updateReleaseChannelBox.clear();
|
||||||
for (ReleaseChannel *chan : settings.getUpdateReleaseChannels()) {
|
for (ReleaseChannel *chan : settings.getUpdateReleaseChannels()) {
|
||||||
updateReleaseChannelBox.insertItem(chan->getIndex(), tr(chan->getName().toUtf8()));
|
updateReleaseChannelBox.addItem(tr(chan->getName().toUtf8()));
|
||||||
}
|
}
|
||||||
updateReleaseChannelBox.setCurrentIndex(oldIndex);
|
updateReleaseChannelBox.setCurrentIndex(oldIndex);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -290,6 +290,10 @@ public:
|
||||||
{
|
{
|
||||||
return seenTips;
|
return seenTips;
|
||||||
}
|
}
|
||||||
|
int getUpdateReleaseChannelIndex() const
|
||||||
|
{
|
||||||
|
return updateReleaseChannel;
|
||||||
|
}
|
||||||
ReleaseChannel *getUpdateReleaseChannel() const
|
ReleaseChannel *getUpdateReleaseChannel() const
|
||||||
{
|
{
|
||||||
return releaseChannels.at(qMax(0, updateReleaseChannel));
|
return releaseChannels.at(qMax(0, updateReleaseChannel));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue