Connect from commandline (#3556)

* - Use Qt argument parser
- Add --connect command line option.

* Better version info
This commit is contained in:
Rob Blanckaert 2019-02-06 00:08:24 -08:00 committed by Zach H
parent 9118871afb
commit 073c531855
3 changed files with 29 additions and 4 deletions

View file

@ -948,7 +948,10 @@ void MainWindow::changeEvent(QEvent *event)
else if (event->type() == QEvent::ActivationChange) {
if (isActiveWindow() && !bHasActivated) {
bHasActivated = true;
if (settingsCache->servers().getAutoConnect()) {
if (!connectTo.isEmpty()) {
qDebug() << "Command line connect to " << connectTo;
client->connectToServer(connectTo.host(), connectTo.port(), connectTo.userName(), connectTo.password());
} else if (settingsCache->servers().getAutoConnect()) {
qDebug() << "Attempting auto-connect...";
DlgConnect dlg(this);
client->connectToServer(dlg.getHost(), static_cast<unsigned int>(dlg.getPort()), dlg.getPlayerName(),