Updater for websockets (#3581)
* Dont clobber password when pulling down server list. * Force download server list on client update.
This commit is contained in:
parent
1b3da22dd7
commit
d519f992d2
5 changed files with 39 additions and 25 deletions
|
@ -47,6 +47,9 @@ public:
|
|||
return passwordEdit->text();
|
||||
}
|
||||
|
||||
public slots:
|
||||
void downloadThePublicServers();
|
||||
|
||||
private slots:
|
||||
void actOk();
|
||||
void actSaveConfig();
|
||||
|
@ -57,7 +60,6 @@ private slots:
|
|||
void updateDisplayInfo(const QString &saveName);
|
||||
void preRebuildComboBoxList();
|
||||
void rebuildComboBoxList(int failure = -1);
|
||||
void downloadThePublicServers();
|
||||
|
||||
private:
|
||||
QGridLayout *newHostLayout, *connectionLayout, *loginLayout, *serverInfoLayout, *grid;
|
||||
|
|
|
@ -227,23 +227,41 @@ void ServersSettings::removeServer(QString servAddr)
|
|||
/**
|
||||
* Will only update fields with new values, ignores empty values
|
||||
*/
|
||||
bool ServersSettings::updateExistingServerWithoutLoss(QString saveName,
|
||||
QString serv,
|
||||
QString port,
|
||||
QString site,
|
||||
QString username,
|
||||
QString password,
|
||||
bool savePassword)
|
||||
bool ServersSettings::updateExistingServerWithoutLoss(QString saveName, QString serv, QString port, QString site)
|
||||
{
|
||||
int size = getValue("totalServers", "server", "server_details").toInt() + 1;
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (serv == getValue(QString("server%1").arg(i), "server", "server_details").toString()) {
|
||||
|
||||
if (!port.isEmpty()) {
|
||||
setValue(port, QString("port%1").arg(i), "server", "server_details");
|
||||
}
|
||||
|
||||
if (!site.isEmpty()) {
|
||||
setValue(site, QString("site%1").arg(i), "server", "server_details");
|
||||
}
|
||||
|
||||
setValue(saveName, QString("saveName%1").arg(i), "server", "server_details");
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ServersSettings::updateExistingServer(QString saveName,
|
||||
QString serv,
|
||||
QString port,
|
||||
QString username,
|
||||
QString password,
|
||||
bool savePassword,
|
||||
QString site)
|
||||
{
|
||||
int size = getValue("totalServers", "server", "server_details").toInt() + 1;
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (serv == getValue(QString("server%1").arg(i), "server", "server_details").toString()) {
|
||||
setValue(port, QString("port%1").arg(i), "server", "server_details");
|
||||
if (!username.isEmpty()) {
|
||||
setValue(username, QString("username%1").arg(i), "server", "server_details");
|
||||
}
|
||||
|
@ -266,15 +284,3 @@ bool ServersSettings::updateExistingServerWithoutLoss(QString saveName,
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ServersSettings::updateExistingServer(QString saveName,
|
||||
QString serv,
|
||||
QString port,
|
||||
QString username,
|
||||
QString password,
|
||||
bool savePassword,
|
||||
QString site)
|
||||
{
|
||||
return updateExistingServerWithoutLoss(std::move(saveName), std::move(serv), std::move(port), std::move(site),
|
||||
std::move(username), std::move(password), savePassword);
|
||||
}
|
||||
|
|
|
@ -58,10 +58,7 @@ public:
|
|||
bool updateExistingServerWithoutLoss(QString saveName,
|
||||
QString serv = QString(),
|
||||
QString port = QString(),
|
||||
QString site = QString(),
|
||||
QString username = QString(),
|
||||
QString password = QString(),
|
||||
bool savePassword = true);
|
||||
QString site = QString());
|
||||
void setClearDebugLogStatus(bool abIsChecked);
|
||||
bool getClearDebugLogStatus(bool abDefaultValue);
|
||||
|
||||
|
|
|
@ -864,6 +864,7 @@ void MainWindow::alertForcedOracleRun(const QString &newVersion)
|
|||
"Oracle will now launch to update your card database.")
|
||||
.arg(newVersion));
|
||||
actCheckCardUpdates();
|
||||
actCheckServerUpdates();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
|
@ -1127,6 +1128,13 @@ void MainWindow::cardUpdateFinished(int, QProcess::ExitStatus)
|
|||
QtConcurrent::run(db, &CardDatabase::loadCardDatabases);
|
||||
}
|
||||
|
||||
void MainWindow::actCheckServerUpdates()
|
||||
{
|
||||
auto hps = new HandlePublicServers(this);
|
||||
hps->downloadPublicServers();
|
||||
connect(hps, &HandlePublicServers::sigPublicServersDownloadedSuccessfully, [=]() { hps->deleteLater(); });
|
||||
}
|
||||
|
||||
void MainWindow::refreshShortcuts()
|
||||
{
|
||||
aConnect->setShortcuts(settingsCache->shortcuts().getShortcut("MainWindow/aConnect"));
|
||||
|
|
|
@ -48,6 +48,7 @@ class MainWindow : public QMainWindow
|
|||
Q_OBJECT
|
||||
public slots:
|
||||
void actCheckCardUpdates();
|
||||
void actCheckServerUpdates();
|
||||
private slots:
|
||||
void updateTabMenu(const QList<QMenu *> &newMenuList);
|
||||
void statusChanged(ClientStatus _status);
|
||||
|
|
Loading…
Reference in a new issue