mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Added 'auto connect' checkbox to connect dialog. When the main window becomes active for the first time and auto connect is set to true, it will call connectToServer at that point.
This commit is contained in:
parent
6f319c8b63
commit
b381298981
6 changed files with 66 additions and 3 deletions
|
|
@ -359,7 +359,7 @@ void MainWindow::createMenus()
|
|||
}
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent), localServer(0)
|
||||
: QMainWindow(parent), localServer(0), bHasActivated(false)
|
||||
{
|
||||
QPixmapCache::setCacheLimit(200000);
|
||||
|
||||
|
|
@ -417,5 +417,16 @@ void MainWindow::changeEvent(QEvent *event)
|
|||
{
|
||||
if (event->type() == QEvent::LanguageChange)
|
||||
retranslateUi();
|
||||
else if(event->type() == QEvent::ActivationChange) {
|
||||
if(isActiveWindow() && !bHasActivated){
|
||||
bHasActivated = true;
|
||||
if(settingsCache->getAutoConnect()) {
|
||||
qDebug() << "Attempting auto-connect...";
|
||||
DlgConnect dlg(this);
|
||||
client->connectToServer(dlg.getHost(), dlg.getPort(), dlg.getPlayerName(), dlg.getPassword());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QMainWindow::changeEvent(event);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue