diff options
author | Jamie Fraser <jamie.f@sabrienix.com> | 2011-03-19 07:32:11 +0300 |
---|---|---|
committer | Jamie Fraser <jamie.f@sabrienix.com> | 2011-03-19 07:32:11 +0300 |
commit | b752ea0cde54dc6168a3ba5c1a73c81c2d7f1f3c (patch) | |
tree | db333812d33d3bd2fce47a91a9a1a9f491380897 | |
parent | 0e1a3513fad7e22147c6dd06d85e3dd172e4574b (diff) |
Added a macro "DEFAULT_MUMBLE_PORT" in src/Net.h so that its a one-line change should the default port ever change.
-rw-r--r-- | src/Net.h | 4 | ||||
-rw-r--r-- | src/mumble/ConnectDialog.cpp | 6 | ||||
-rw-r--r-- | src/mumble/ConnectDialog.h | 3 | ||||
-rw-r--r-- | src/mumble/Database.cpp | 4 | ||||
-rw-r--r-- | src/mumble/MainWindow.cpp | 3 | ||||
-rw-r--r-- | src/murmur/Meta.cpp | 3 |
6 files changed, 16 insertions, 7 deletions
@@ -31,6 +31,10 @@ #ifndef _NET_H #define _NET_H +#ifndef DEFAULT_MUMBLE_PORT +#define DEFAULT_MUMBLE_PORT 64738 +#endif + #include "murmur_pch.h" struct HostAddress { diff --git a/src/mumble/ConnectDialog.cpp b/src/mumble/ConnectDialog.cpp index f66e1b660..9b32ef141 100644 --- a/src/mumble/ConnectDialog.cpp +++ b/src/mumble/ConnectDialog.cpp @@ -409,7 +409,7 @@ ServerItem *ServerItem::fromMimeData(const QMimeData *mime, QWidget *p) { if (! url.hasQueryItem(QLatin1String("title"))) url.addQueryItem(QLatin1String("title"), url.host()); - ServerItem *si = new ServerItem(url.queryItemValue(QLatin1String("title")), url.host(), static_cast<unsigned short>(url.port(64738)), url.userName(), url.password()); + ServerItem *si = new ServerItem(url.queryItemValue(QLatin1String("title")), url.host(), static_cast<unsigned short>(url.port(DEFAULT_MUMBLE_PORT)), url.userName(), url.password()); if (url.hasQueryItem(QLatin1String("url"))) si->qsUrl = url.queryItemValue(QLatin1String("url")); @@ -594,7 +594,7 @@ QMimeData *ServerItem::toMimeData(const QString &name, const QString &host, unsi QUrl url; url.setScheme(QLatin1String("mumble")); url.setHost(host); - if (port != 64738) + if (port != DEFAULT_MUMBLE_PORT) url.setPort(port); url.setPath(channel); url.addQueryItem(QLatin1String("title"), name); @@ -942,7 +942,7 @@ void ConnectDialog::on_qaFavoriteAdd_triggered() { void ConnectDialog::on_qaFavoriteAddNew_triggered() { QString host, user, pw; QString name; - unsigned short port = 64738; + unsigned short port = DEFAULT_MUMBLE_PORT; // Try to fill out fields if possible { diff --git a/src/mumble/ConnectDialog.h b/src/mumble/ConnectDialog.h index e64451399..4e695f479 100644 --- a/src/mumble/ConnectDialog.h +++ b/src/mumble/ConnectDialog.h @@ -34,6 +34,7 @@ #include "mumble_pch.hpp" #include "Timer.h" #include "Database.h" +#include "Net.h" #ifdef USE_BONJOUR #include "BonjourClient.h" @@ -187,7 +188,7 @@ class ConnectDialogEdit : public QDialog, protected Ui::ConnectDialogEdit { public: QString qsName, qsHostname, qsUsername, qsPassword; unsigned short usPort; - ConnectDialogEdit(QWidget *parent, const QString &name = QString(), const QString &host = QString(), const QString &user = QString(), unsigned short port = 64738, const QString &password = QString(), bool add = false); + ConnectDialogEdit(QWidget *parent, const QString &name = QString(), const QString &host = QString(), const QString &user = QString(), unsigned short port = DEFAULT_MUMBLE_PORT, const QString &password = QString(), bool add = false); }; class ConnectDialog : public QDialog, public Ui::ConnectDialog { diff --git a/src/mumble/Database.cpp b/src/mumble/Database.cpp index 4bd9d8d01..5449fbeb8 100644 --- a/src/mumble/Database.cpp +++ b/src/mumble/Database.cpp @@ -31,6 +31,8 @@ #include "Database.h" #include "Global.h" #include "Message.h" +#include "Net.h" +#include "Version.h" Database::Database() { QSqlDatabase db = QSqlDatabase::addDatabase(QLatin1String("QSQLITE")); @@ -94,7 +96,7 @@ Database::Database() { QSqlQuery query; - query.exec(QLatin1String("CREATE TABLE IF NOT EXISTS `servers` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `name` TEXT, `hostname` TEXT, `port` INTEGER DEFAULT 64738, `username` TEXT, `password` TEXT)")); + query.exec(QLatin1String("CREATE TABLE IF NOT EXISTS `servers` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `name` TEXT, `hostname` TEXT, `port` INTEGER DEFAULT " MUMTEXT(DEFAULT_MUMBLE_PORT) ", `username` TEXT, `password` TEXT)")); query.exec(QLatin1String("ALTER TABLE `servers` ADD COLUMN `url` TEXT")); query.exec(QLatin1String("CREATE TABLE IF NOT EXISTS `comments` (`who` TEXT, `comment` BLOB, `seen` DATE)")); diff --git a/src/mumble/MainWindow.cpp b/src/mumble/MainWindow.cpp index befb4b06d..d73a210f0 100644 --- a/src/mumble/MainWindow.cpp +++ b/src/mumble/MainWindow.cpp @@ -49,6 +49,7 @@ #include "AudioStats.h" #include "Plugins.h" #include "Log.h" +#include "Net.h" #include "Overlay.h" #include "Global.h" #include "Database.h" @@ -692,7 +693,7 @@ void MainWindow::openUrl(const QUrl &url) { } QString host = url.host(); - unsigned short port = static_cast<unsigned short>(url.port(64738)); + unsigned short port = static_cast<unsigned short>(url.port(DEFAULT_MUMBLE_PORT)); QString user = url.userName(); QString pw = url.password(); qsDesiredChannel = url.path(); diff --git a/src/murmur/Meta.cpp b/src/murmur/Meta.cpp index 04164fddf..5a6dea565 100644 --- a/src/murmur/Meta.cpp +++ b/src/murmur/Meta.cpp @@ -31,6 +31,7 @@ #include "ServerDB.h" #include "Server.h" #include "Meta.h" +#include "Net.h" #include "DBus.h" #include "OSInfo.h" @@ -42,7 +43,7 @@ HANDLE Meta::hQoS = NULL; MetaParams::MetaParams() { qsPassword = QString(); - usPort = 64738; + usPort = DEFAULT_MUMBLE_PORT; iTimeout = 30; iMaxBandwidth = 72000; iMaxUsers = 1000; |