mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-13 01:24:46 -07:00
Minor cleanup & set RR default for new clients (#3591)
* Minor cleanup & set RR default for new clients * Handle case of no entries Signed-off-by: Zach Halpern <ZaHalpern+github@gmail.com> * Use RR as default on rebuilds Signed-off-by: Zach Halpern <ZaHalpern+github@gmail.com>
This commit is contained in:
parent
45b16ba78d
commit
e77e439c4b
3 changed files with 10 additions and 27 deletions
|
|
@ -161,21 +161,6 @@ DlgConnect::DlgConnect(QWidget *parent) : QDialog(parent)
|
|||
|
||||
DlgConnect::~DlgConnect() = default;
|
||||
|
||||
void DlgConnect::actSaveConfig()
|
||||
{
|
||||
bool updateSuccess = settingsCache->servers().updateExistingServer(
|
||||
saveEdit->text().trimmed(), hostEdit->text().trimmed(), portEdit->text().trimmed(),
|
||||
playernameEdit->text().trimmed(), passwordEdit->text(), savePasswordCheckBox->isChecked());
|
||||
|
||||
if (!updateSuccess) {
|
||||
settingsCache->servers().addNewServer(saveEdit->text().trimmed(), hostEdit->text().trimmed(),
|
||||
portEdit->text().trimmed(), playernameEdit->text().trimmed(),
|
||||
passwordEdit->text(), savePasswordCheckBox->isChecked());
|
||||
}
|
||||
|
||||
preRebuildComboBoxList();
|
||||
}
|
||||
|
||||
void DlgConnect::downloadThePublicServers()
|
||||
{
|
||||
btnRefreshServers->setDisabled(true);
|
||||
|
|
@ -205,21 +190,19 @@ void DlgConnect::rebuildComboBoxList(int failure)
|
|||
UserConnection_Information uci;
|
||||
savedHostList = uci.getServerInfo();
|
||||
|
||||
int i = 0;
|
||||
for (auto pair : savedHostList) {
|
||||
for (const auto &pair : savedHostList) {
|
||||
auto tmp = pair.second;
|
||||
QString saveName = tmp.getSaveName();
|
||||
if (saveName.size()) {
|
||||
previousHosts->addItem(saveName);
|
||||
|
||||
if (settingsCache->servers().getPrevioushostName() == saveName) {
|
||||
previousHosts->setCurrentIndex(i);
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
// On rebuild, set to RR
|
||||
if (previousHosts->count() >= 2) {
|
||||
previousHosts->setCurrentIndex(1);
|
||||
}
|
||||
|
||||
btnRefreshServers->setDisabled(false);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue