# HG changeset patch
# User koda
# Date 1362926643 -3600
# Node ID e09633d10f167df3fc659f6148e3d8eaf03eee48
# Parent 70a586fc76fd920837858a68875769953022e4ed
hit hwplay://server:port and automatically join an unofficial server (on osx right now)
diff -r 70a586fc76fd -r e09633d10f16 QTfrontend/HWApplication.cpp
--- a/QTfrontend/HWApplication.cpp Sun Mar 10 11:29:00 2013 +0100
+++ b/QTfrontend/HWApplication.cpp Sun Mar 10 15:44:03 2013 +0100
@@ -50,23 +50,28 @@
bool HWApplication::event(QEvent *event)
{
QFileOpenEvent *openEvent;
- QString scheme, path;
+ QString scheme, path, address;
if (event->type() == QEvent::FileOpen) {
openEvent = (QFileOpenEvent *)event;
scheme = openEvent->url().scheme();
path = openEvent->url().path();
+ address = openEvent->url().host();
QFile file(path);
if (scheme == "file" && file.exists()) {
form->PlayDemoQuick(openEvent->file());
return true;
+ } else if (scheme == "hwplay") {
+ int port = openEvent->url().port(NETGAME_DEFAULT_PORT);
+ form->NetConnectQuick(address, (quint16) port);
+ return true;
} else {
const QString errmsg = tr("Not yet implemented").arg(path);
MessageDialog::ShowErrorMessage(errmsg, form);
return false;
}
- }
+ }
return QApplication::event(event);
}
diff -r 70a586fc76fd -r e09633d10f16 QTfrontend/hwform.cpp
--- a/QTfrontend/hwform.cpp Sun Mar 10 11:29:00 2013 +0100
+++ b/QTfrontend/hwform.cpp Sun Mar 10 15:44:03 2013 +0100
@@ -1000,8 +1000,14 @@
game->PlayDemo(demofilename, false);
}
+void HWForm::NetConnectQuick(const QString & host, quint16 port)
+{
+ NetConnectServer(host, port);
+}
+
void HWForm::NetConnectServer(const QString & host, quint16 port)
{
+ qDebug("connecting to %s:%d", qPrintable(host), port);
_NetConnect(host, port, ui.pageOptions->editNetNick->text().trimmed());
}
diff -r 70a586fc76fd -r e09633d10f16 QTfrontend/hwform.h
--- a/QTfrontend/hwform.h Sun Mar 10 11:29:00 2013 +0100
+++ b/QTfrontend/hwform.h Sun Mar 10 15:44:03 2013 +0100
@@ -62,12 +62,14 @@
Ui_HWForm ui;
static GameUIConfig * config;
void updateXfire();
- void PlayDemoQuick(const QString & demofilename);
void exit();
void setButtonDescription(QString desc);
void backDescription();
void GoToVideos();
+ void NetConnectQuick(const QString & host, quint16 port);
+ void PlayDemoQuick(const QString & demofilename);
+
private slots:
void GoToSaves();
void GoToDemos();
diff -r 70a586fc76fd -r e09633d10f16 share/Info.plist.in
--- a/share/Info.plist.in Sun Mar 10 11:29:00 2013 +0100
+++ b/share/Info.plist.in Sun Mar 10 15:44:03 2013 +0100
@@ -156,7 +156,6 @@
Viewer
-
+ hwplay
- -->