Cockatrice/libcockatrice_settings/libcockatrice/settings/servers_settings.h
BruebachL 59d90db3c7
Define Cockatrice as an editor/handler for .cod files and cockatrice:// protocol on all platforms (#6775)
* [Application] Add single instance guard and mime types.

Took 2 hours 39 minutes

Took 18 minutes

Took 5 minutes

Took 12 seconds


Took 11 seconds

* Rework

Took 30 minutes


Took 50 seconds

* Only enforce single instance if launched with arguments.

Took 5 minutes

* Prototype intents

Took 53 minutes

Took 6 seconds

* Connect/disconnect and join game/room intents.

Took 3 hours 14 minutes

Took 2 seconds

Took 15 seconds

* Fix include.

Took 1 minute


Took 23 seconds

Took 2 seconds

* Mac handling.

Took 10 minutes

Took 12 seconds

Took 3 minutes

* Lint.

Took 3 minutes

* Rebase.

Took 3 minutes

Took 17 seconds

* Implement UrlSchemeEventFilter

Took 10 minutes

Took 7 seconds

* Qt Moc

Took 3 minutes

* Modern PList.

Took 21 minutes

Took 1 minute

* Debug output.

Took 6 minutes

Took 19 minutes

* Watch file:// prefix.

Took 15 minutes

Took 7 seconds

* Better handler.

Took 6 minutes

* Don't store reference in member

Took 5 minutes

* Move impl to cpp, fix lifetime issues.

Took 11 minutes

Took 2 minutes

* Better single-instance handoff, url intent harded

copy game link context-menu
Polish for installers

Took 35 minutes

Took 8 seconds

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2026-08-08 19:02:19 +02:00

81 lines
3.1 KiB
C++

/**
* @file servers_settings.h
* @ingroup NetworkSettings
*/
//! \todo Document this file.
#ifndef SERVERSSETTINGS_H
#define SERVERSSETTINGS_H
#include "settings_manager.h"
#include <QLoggingCategory>
#include <QObject>
#define SERVERSETTINGS_DEFAULT_HOST "server.cockatrice.us"
#define SERVERSETTINGS_DEFAULT_PORT "4748"
inline Q_LOGGING_CATEGORY(ServersSettingsLog, "servers_settings");
class ServersSettings : public SettingsManager
{
Q_OBJECT
friend class SettingsCache;
public:
int getPreviousHostLogin() const;
int getPrevioushostindex(const QString &) const;
QStringList getPreviousHostList() const;
QString getPrevioushostName() const;
QString getHostname(QString defaultHost = SERVERSETTINGS_DEFAULT_HOST) const;
QString getPort(QString defaultPort = SERVERSETTINGS_DEFAULT_PORT) const;
QString getPlayerName(QString defaultName = "") const;
QString getFPHostname(QString defaultHost = SERVERSETTINGS_DEFAULT_HOST) const;
QString getFPPort(QString defaultPort = SERVERSETTINGS_DEFAULT_PORT) const;
QString getFPPlayerName(QString defaultName = "") const;
QString getPassword();
QString getSaveName(QString defaultname = "");
QString getSite(QString defaultName = "");
bool getSavePassword() const;
int getAutoConnect() const;
void setPreviousHostLogin(int previous);
void setPrevioushostName(const QString &);
void setPreviousHostList(QStringList list);
void setAutoConnect(int autoconnect);
void setSite(QString site);
void setFPHostName(QString hostname);
void setFPPort(QString port);
void setFPPlayerName(QString playerName);
void addNewServer(const QString &saveName,
const QString &serv,
const QString &port,
const QString &username,
const QString &password,
bool savePassword,
const QString &site = QString());
void removeServer(QString servAddr);
bool updateExistingServer(QString saveName,
QString serv,
QString port,
QString username,
QString password,
bool savePassword,
QString site = QString());
int findServerIndex(const QString &host, const QString &port) const;
bool hasUsername(const QString &host, const QString &port) const;
bool hasCredentials(const QString &host, const QString &port) const;
bool hasLoginData(const QString &host, const QString &port) const;
bool updateExistingServerWithoutLoss(QString saveName,
QString serv = QString(),
QString port = QString(),
QString site = QString());
void setClearDebugLogStatus(bool abIsChecked);
bool getClearDebugLogStatus(bool abDefaultValue) const;
private:
explicit ServersSettings(const QString &settingPath, QObject *parent = nullptr);
ServersSettings(const ServersSettings & /*other*/);
};
#endif // SERVERSSETTINGS_H