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();
|
return passwordEdit->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void downloadThePublicServers();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void actOk();
|
void actOk();
|
||||||
void actSaveConfig();
|
void actSaveConfig();
|
||||||
|
@ -57,7 +60,6 @@ private slots:
|
||||||
void updateDisplayInfo(const QString &saveName);
|
void updateDisplayInfo(const QString &saveName);
|
||||||
void preRebuildComboBoxList();
|
void preRebuildComboBoxList();
|
||||||
void rebuildComboBoxList(int failure = -1);
|
void rebuildComboBoxList(int failure = -1);
|
||||||
void downloadThePublicServers();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QGridLayout *newHostLayout, *connectionLayout, *loginLayout, *serverInfoLayout, *grid;
|
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
|
* Will only update fields with new values, ignores empty values
|
||||||
*/
|
*/
|
||||||
bool ServersSettings::updateExistingServerWithoutLoss(QString saveName,
|
bool ServersSettings::updateExistingServerWithoutLoss(QString saveName, QString serv, QString port, QString site)
|
||||||
QString serv,
|
|
||||||
QString port,
|
|
||||||
QString site,
|
|
||||||
QString username,
|
|
||||||
QString password,
|
|
||||||
bool savePassword)
|
|
||||||
{
|
{
|
||||||
int size = getValue("totalServers", "server", "server_details").toInt() + 1;
|
int size = getValue("totalServers", "server", "server_details").toInt() + 1;
|
||||||
|
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
if (serv == getValue(QString("server%1").arg(i), "server", "server_details").toString()) {
|
if (serv == getValue(QString("server%1").arg(i), "server", "server_details").toString()) {
|
||||||
|
|
||||||
if (!port.isEmpty()) {
|
if (!port.isEmpty()) {
|
||||||
setValue(port, QString("port%1").arg(i), "server", "server_details");
|
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()) {
|
if (!username.isEmpty()) {
|
||||||
setValue(username, QString("username%1").arg(i), "server", "server_details");
|
setValue(username, QString("username%1").arg(i), "server", "server_details");
|
||||||
}
|
}
|
||||||
|
@ -266,15 +284,3 @@ bool ServersSettings::updateExistingServerWithoutLoss(QString saveName,
|
||||||
}
|
}
|
||||||
return false;
|
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,
|
bool updateExistingServerWithoutLoss(QString saveName,
|
||||||
QString serv = QString(),
|
QString serv = QString(),
|
||||||
QString port = QString(),
|
QString port = QString(),
|
||||||
QString site = QString(),
|
QString site = QString());
|
||||||
QString username = QString(),
|
|
||||||
QString password = QString(),
|
|
||||||
bool savePassword = true);
|
|
||||||
void setClearDebugLogStatus(bool abIsChecked);
|
void setClearDebugLogStatus(bool abIsChecked);
|
||||||
bool getClearDebugLogStatus(bool abDefaultValue);
|
bool getClearDebugLogStatus(bool abDefaultValue);
|
||||||
|
|
||||||
|
|
|
@ -864,6 +864,7 @@ void MainWindow::alertForcedOracleRun(const QString &newVersion)
|
||||||
"Oracle will now launch to update your card database.")
|
"Oracle will now launch to update your card database.")
|
||||||
.arg(newVersion));
|
.arg(newVersion));
|
||||||
actCheckCardUpdates();
|
actCheckCardUpdates();
|
||||||
|
actCheckServerUpdates();
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
|
@ -1127,6 +1128,13 @@ void MainWindow::cardUpdateFinished(int, QProcess::ExitStatus)
|
||||||
QtConcurrent::run(db, &CardDatabase::loadCardDatabases);
|
QtConcurrent::run(db, &CardDatabase::loadCardDatabases);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::actCheckServerUpdates()
|
||||||
|
{
|
||||||
|
auto hps = new HandlePublicServers(this);
|
||||||
|
hps->downloadPublicServers();
|
||||||
|
connect(hps, &HandlePublicServers::sigPublicServersDownloadedSuccessfully, [=]() { hps->deleteLater(); });
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::refreshShortcuts()
|
void MainWindow::refreshShortcuts()
|
||||||
{
|
{
|
||||||
aConnect->setShortcuts(settingsCache->shortcuts().getShortcut("MainWindow/aConnect"));
|
aConnect->setShortcuts(settingsCache->shortcuts().getShortcut("MainWindow/aConnect"));
|
||||||
|
|
|
@ -48,6 +48,7 @@ class MainWindow : public QMainWindow
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public slots:
|
public slots:
|
||||||
void actCheckCardUpdates();
|
void actCheckCardUpdates();
|
||||||
|
void actCheckServerUpdates();
|
||||||
private slots:
|
private slots:
|
||||||
void updateTabMenu(const QList<QMenu *> &newMenuList);
|
void updateTabMenu(const QList<QMenu *> &newMenuList);
|
||||||
void statusChanged(ClientStatus _status);
|
void statusChanged(ClientStatus _status);
|
||||||
|
|
Loading…
Reference in a new issue