diff options
author | Javier S. Pedro <dev.git@javispedro.com> | 2014-11-25 22:56:06 +0100 |
---|---|---|
committer | Javier S. Pedro <dev.git@javispedro.com> | 2014-11-25 22:56:06 +0100 |
commit | 2d3ce285e77ec02ed6dfb92bda273fc99164f9f4 (patch) | |
tree | 5c08ffdeaa15d0df56cef9f7463cdfeb475a15a2 /src | |
parent | 4da1532347fda7b6604c19b36ba05610aa86d4b4 (diff) | |
download | salmeta-2d3ce285e77ec02ed6dfb92bda273fc99164f9f4.tar.gz salmeta-2d3ce285e77ec02ed6dfb92bda273fc99164f9f4.zip |
port to Qt5.2/sailfish opt-in update 9
Diffstat (limited to 'src')
-rw-r--r-- | src/metawatchbttransport.cpp | 2 | ||||
-rw-r--r-- | src/metawatchbttransport.h | 4 | ||||
-rw-r--r-- | src/salmeta.cpp | 26 |
3 files changed, 14 insertions, 18 deletions
diff --git a/src/metawatchbttransport.cpp b/src/metawatchbttransport.cpp index 63996e9..a77977e 100644 --- a/src/metawatchbttransport.cpp +++ b/src/metawatchbttransport.cpp @@ -118,7 +118,7 @@ void MetaWatchBTTransport::connectDevice() // Sadly, seems that QBluetoothSocket doesn't really like been closed and reopened, // so we recreate it every time. - _socket = new QBluetoothSocket(QBluetoothSocket::RfcommSocket, this); + _socket = new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol, this); connect(_socket, &QBluetoothSocket::connected, this, &MetaWatchBTTransport::handleSocketConnected); connect(_socket, &QBluetoothSocket::disconnected, this, &MetaWatchBTTransport::handleSocketDisconnected); connect(_socket, &QBluetoothSocket::readyRead, this, &MetaWatchBTTransport::handleSocketData); diff --git a/src/metawatchbttransport.h b/src/metawatchbttransport.h index b1f3bf0..a824151 100644 --- a/src/metawatchbttransport.h +++ b/src/metawatchbttransport.h @@ -3,10 +3,6 @@ #include <QtBluetooth/QBluetoothSocket> -#ifdef QT_USE_NAMESPACE_BLUETOOTH -QT_USE_NAMESPACE_BLUETOOTH -#endif - #include "metawatchtransport.h" class MetaWatchBTTransport : public MetaWatchTransport diff --git a/src/salmeta.cpp b/src/salmeta.cpp index 7bc14ae..f782b83 100644 --- a/src/salmeta.cpp +++ b/src/salmeta.cpp @@ -1,4 +1,5 @@ #include <QtCore/QDebug> +#include <QtCore/QCommandLineParser> #include <QtGui/QGuiApplication> #include <QtGui/QFontDatabase> #include <QtQml/QQmlComponent> @@ -17,19 +18,18 @@ int main(int argc, char *argv[]) { QGuiApplication *app = SailfishApp::application(argc, argv); - // TODO: Rudimentary command line parser ahead. Move to QCommandLineParser when it's ready. - const QStringList args = app->arguments(); - auto it = args.begin(); - while (it != args.end()) { - if (*it == "--daemon") { - launch_daemon = true; - } else if (*it == "--root") { - ++it; - settings_key_prefix = *it; - } - - ++it; - } + QCommandLineParser parser; + parser.setApplicationDescription("MetaWatch client application"); + parser.addHelpOption(); + + QCommandLineOption opt_daemon("daemon", "start background daemon instead of settings UI"); + QCommandLineOption opt_root("root", "dconf path to the settings to use", "/apps/salmeta/watchX", "/apps/salmeta/watch0"); + parser.addOption(opt_daemon); + + parser.process(*app); + + launch_daemon = parser.isSet(opt_daemon); + settings_key_prefix = parser.value(opt_root); qmlRegisterUncreatableType<WidgetInfo>("com.javispedro.salmeta", 1, 0, "WidgetInfo", "Use the models, not this"); |