summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@digia.com>2013-03-21 16:36:00 +0100
committerGunnar Sletta <gunnar.sletta@digia.com>2013-03-21 16:36:00 +0100
commitc7c95d95771abb8f69ac44c7f9701b8225af7824 (patch)
treea5514c2d09f00c7ed4d397cf0de9179af27d3d60
parent3bab79ccafe79105c1c3d7dc6fe1e87d80628bd9 (diff)
Moved wifi to its own importable module
-rw-r--r--src/imports/wifi/qmldir2
-rw-r--r--src/imports/wifi/qwifimanager.cpp (renamed from wifi/qwifimanager.cpp)0
-rw-r--r--src/imports/wifi/qwifimanager.h (renamed from wifi/qwifimanager.h)0
-rw-r--r--src/imports/wifi/qwifimodule.pro (renamed from wifi/wifitest.pro)18
-rw-r--r--src/imports/wifi/qwifinetwork.cpp (renamed from wifi/qwifinetwork.cpp)0
-rw-r--r--src/imports/wifi/qwifinetwork.h (renamed from wifi/qwifinetwork.h)0
-rw-r--r--src/imports/wifi/qwifinetworklist.cpp (renamed from wifi/qwifinetworklist.cpp)0
-rw-r--r--src/imports/wifi/qwifinetworklist.h (renamed from wifi/qwifinetworklist.h)0
-rw-r--r--wifi/main.cpp23
-rw-r--r--wifi/main.qml158
10 files changed, 10 insertions, 191 deletions
diff --git a/src/imports/wifi/qmldir b/src/imports/wifi/qmldir
new file mode 100644
index 0000000..4c36784
--- /dev/null
+++ b/src/imports/wifi/qmldir
@@ -0,0 +1,2 @@
+module Qt.labs.wifi
+plugin qwifimodule
diff --git a/wifi/qwifimanager.cpp b/src/imports/wifi/qwifimanager.cpp
index 984e8da..984e8da 100644
--- a/wifi/qwifimanager.cpp
+++ b/src/imports/wifi/qwifimanager.cpp
diff --git a/wifi/qwifimanager.h b/src/imports/wifi/qwifimanager.h
index a2fdb99..a2fdb99 100644
--- a/wifi/qwifimanager.h
+++ b/src/imports/wifi/qwifimanager.h
diff --git a/wifi/wifitest.pro b/src/imports/wifi/qwifimodule.pro
index a18afeb..311baba 100644
--- a/wifi/wifitest.pro
+++ b/src/imports/wifi/qwifimodule.pro
@@ -4,16 +4,14 @@
#
#-------------------------------------------------
-QT = core gui qml quick
-
-TARGET = wifitest
-CONFIG += console
-CONFIG -= app_bundle
-
-TEMPLATE = app
+CXX_MODULE = qml
+QT += qml quick
+TARGET = qwifimodule
+TARGETPATH = Qt/labs/wifi
+IMPORT_VERSION = 0.1
SOURCES += \
- main.cpp \
+ pluginmain.cpp \
qwifimanager.cpp \
qwifinetwork.cpp \
qwifinetworklist.cpp
@@ -25,5 +23,5 @@ HEADERS += \
LIBS += -lhardware_legacy -lcutils
-OTHER_FILES += \
- main.qml
+load(qml_plugin)
+
diff --git a/wifi/qwifinetwork.cpp b/src/imports/wifi/qwifinetwork.cpp
index a3fc038..a3fc038 100644
--- a/wifi/qwifinetwork.cpp
+++ b/src/imports/wifi/qwifinetwork.cpp
diff --git a/wifi/qwifinetwork.h b/src/imports/wifi/qwifinetwork.h
index 7a28a58..7a28a58 100644
--- a/wifi/qwifinetwork.h
+++ b/src/imports/wifi/qwifinetwork.h
diff --git a/wifi/qwifinetworklist.cpp b/src/imports/wifi/qwifinetworklist.cpp
index e7fa92d..e7fa92d 100644
--- a/wifi/qwifinetworklist.cpp
+++ b/src/imports/wifi/qwifinetworklist.cpp
diff --git a/wifi/qwifinetworklist.h b/src/imports/wifi/qwifinetworklist.h
index f6e134c..f6e134c 100644
--- a/wifi/qwifinetworklist.h
+++ b/src/imports/wifi/qwifinetworklist.h
diff --git a/wifi/main.cpp b/wifi/main.cpp
deleted file mode 100644
index 79489ab..0000000
--- a/wifi/main.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <QtGui>
-#include <QtQml>
-#include <QtQuick>
-
-#include "qwifimanager.h"
-
-#include <hardware_legacy/wifi.h>
-
-int main(int argc, char *argv[])
-{
- QGuiApplication app(argc, argv);
-
- qmlRegisterType<QWifiManager>("QtWifi", 0, 1, "QWifiManager");
- qmlRegisterType<QWifiNetwork>();
- qmlRegisterType<QWifiNetworkList>();
-
- QQuickView view;
- view.setResizeMode(QQuickView::SizeRootObjectToView);
- view.setSource(QUrl::fromLocalFile("main.qml"));
- view.show();
-
- return app.exec();
-}
diff --git a/wifi/main.qml b/wifi/main.qml
deleted file mode 100644
index 2627947..0000000
--- a/wifi/main.qml
+++ /dev/null
@@ -1,158 +0,0 @@
-import QtQuick 2.0
-
-import QtWifi 0.1
-
-Rectangle
-{
- id: root
-
- color: Qt.rgba(Math.random(), Math.random(), Math.random(), 1);
-
- QWifiManager {
- id: wifiManager;
-
- Component.onCompleted: start();
-
- onReadyChanged: {
- print("QML: QWifiManager is now connected...");
- }
-
- onOnlineChanged: print(online ? "QML: WifiManager is online" : "QML: WifiManager is not online...");
-
- scanning: ready && connectedSSID == "";
- }
-
- Component {
- id: listDelegate
-
- Rectangle {
- id: delegateBackground
- property bool expanded: false
- height: expanded ? 300 : 70
- clip: true // ### fixme
-
- Behavior on height { NumberAnimation { duration: 500; easing.type: Easing.InOutCubic } }
-
- width: parent.width
-
- gradient: Gradient {
- GradientStop { position: 0; color: "white" }
- GradientStop { position: 67 / delegateBackground.height; color: "lightgray" }
- GradientStop { position: 1; color: "gray" }
- }
-
- Text {
- id: ssidLabel
- anchors.top: parent.top
- anchors.left: parent.left
- anchors.margins: 10
- font.pixelSize: 24
- font.bold: true
- text: network.ssid + (wifiManager.connectedSSID == network.ssid ? " (connected)" : "");
- }
-
- Text {
- id: bssidLabel
- anchors.top: ssidLabel.bottom
- anchors.left: parent.left
- anchors.margins: 5
- anchors.leftMargin: 40
- text: network.bssid
- color: "gray"
- font.pixelSize: ssidLabel.font.pixelSize * 0.5
- }
-
- Text {
- id: flagsLabel
- x: 200
- anchors.top: bssidLabel.top
- text: (network.supportsWPA2 ? "WPA2 " : "")
- + (network.supportsWPA ? "WPA " : "")
- + (network.supportsWEP ? "WEP " : "")
- + (network.supportsWPS ? "WPS " : "");
- color: "gray"
- font.pixelSize: ssidLabel.font.pixelSize * 0.5
- font.italic: true
- }
-
- Rectangle {
- width: Math.max(100 + network.signalStrength, 0) / 100 * parent.width;
- height: 20
- radius: 10
- antialiasing: true
- anchors.margins: 20
- anchors.right: parent.right
- anchors.top: parent.top
- color: "white"
- border.color: "lightgray"
- }
-
- MouseArea {
- anchors.fill: parent
- onClicked: {
- parent.expanded = !expanded
- }
- }
-
- Rectangle {
- id: passwordInputBackground
- anchors.fill: passwordInput
- anchors.margins: -5
- color: "white"
- radius: 5
- border.color: "gray"
- }
-
- TextInput {
- id: passwordInput
- y: 100
- width: 300
- height: 50
- anchors.horizontalCenter: parent.horizontalCenter
- font.pixelSize: 14
- }
-
- Rectangle {
- id: connectButton
- anchors.top: passwordInput.bottom
- anchors.margins: 20
- anchors.horizontalCenter: parent.horizontalCenter
- width: passwordInput.width
- height: passwordInputBackground.height
-
- gradient: Gradient {
- GradientStop { position: 0; color: "white" }
- GradientStop { position: 1; color: buttonMouse.pressed ? "steelblue" : "lightsteelblue" }
- }
-
- border.color: "gray"
-
- Text {
- anchors.centerIn: parent
- font.pixelSize: 24
- text: "Connect"
- }
- MouseArea {
- id: buttonMouse
- anchors.fill: parent
- onClicked: wifiManager.connect(network, passwordInput.text);
- }
- }
-
- }
- }
-
- ListView {
- anchors.fill: root
- model: wifiManager.networks
- delegate: listDelegate;
- }
-
- Image {
- source: wifiManager.online ? "http://img3.imageshack.us/img3/9870/magepicture.jpg" : ""
- anchors.bottom: parent.bottom
-
- width: parent.width
- height: sourceSize.height * (width / sourceSize.width);
- }
-}