mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Add debug setting to start local game on startup (#5408)
* new properties * refactor * start local game on startup * disable autoconnect
This commit is contained in:
parent
bb4214e28a
commit
8a427955e7
4 changed files with 26 additions and 1 deletions
|
|
@ -223,6 +223,11 @@ void MainWindow::actSinglePlayer()
|
|||
if (!ok)
|
||||
return;
|
||||
|
||||
startLocalGame(numberPlayers);
|
||||
}
|
||||
|
||||
void MainWindow::startLocalGame(int numberPlayers)
|
||||
{
|
||||
aConnect->setEnabled(false);
|
||||
aRegister->setEnabled(false);
|
||||
aForgotPassword->setEnabled(false);
|
||||
|
|
@ -881,6 +886,10 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
|
||||
void MainWindow::startupConfigCheck()
|
||||
{
|
||||
if (SettingsCache::instance().debug().getLocalGameOnStartup()) {
|
||||
startLocalGame(SettingsCache::instance().debug().getLocalGamePlayerCount());
|
||||
}
|
||||
|
||||
if (SettingsCache::instance().getCheckUpdatesOnStartup()) {
|
||||
actCheckClientUpdates();
|
||||
}
|
||||
|
|
@ -1021,7 +1030,8 @@ void MainWindow::changeEvent(QEvent *event)
|
|||
if (!connectTo.isEmpty()) {
|
||||
qDebug() << "Command line connect to " << connectTo;
|
||||
client->connectToServer(connectTo.host(), connectTo.port(), connectTo.userName(), connectTo.password());
|
||||
} else if (SettingsCache::instance().servers().getAutoConnect()) {
|
||||
} else if (SettingsCache::instance().servers().getAutoConnect() &&
|
||||
!SettingsCache::instance().debug().getLocalGameOnStartup()) {
|
||||
qDebug() << "Attempting auto-connect...";
|
||||
DlgConnect dlg(this);
|
||||
client->connectToServer(dlg.getHost(), static_cast<unsigned int>(dlg.getPort()), dlg.getPlayerName(),
|
||||
|
|
|
|||
|
|
@ -126,6 +126,8 @@ private:
|
|||
};
|
||||
void exitCardDatabaseUpdate();
|
||||
|
||||
void startLocalGame(int numberPlayers);
|
||||
|
||||
QList<QMenu *> tabMenus;
|
||||
QMenu *cockatriceMenu, *dbMenu, *helpMenu, *trayIconMenu;
|
||||
QAction *aConnect, *aDisconnect, *aSinglePlayer, *aWatchReplay, *aDeckEditor, *aFullScreen, *aSettings, *aExit,
|
||||
|
|
|
|||
|
|
@ -15,3 +15,13 @@ bool DebugSettings::getShowCardId()
|
|||
{
|
||||
return getValue("showCardId", "debug").toBool();
|
||||
}
|
||||
|
||||
bool DebugSettings::getLocalGameOnStartup()
|
||||
{
|
||||
return getValue("onStartup", "localgame").toBool();
|
||||
}
|
||||
|
||||
int DebugSettings::getLocalGamePlayerCount()
|
||||
{
|
||||
return getValue("playerCount", "localgame").toInt();
|
||||
}
|
||||
|
|
@ -12,6 +12,9 @@ class DebugSettings : public SettingsManager
|
|||
|
||||
public:
|
||||
bool getShowCardId();
|
||||
|
||||
bool getLocalGameOnStartup();
|
||||
int getLocalGamePlayerCount();
|
||||
};
|
||||
|
||||
#endif // DEBUG_SETTINGS_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue