From f1d884b6dad5a93d7a3077b6b05d3ec7fcd9a6ea Mon Sep 17 00:00:00 2001 From: Teemu Holappa Date: Thu, 11 Feb 2016 11:50:55 +0200 Subject: Refactored Qml plugins into modules. Separated C++ and Qml interfaces. All the UI's from plugins are moved to the settingsui folder. Change-Id: Id6a6623346b18321357bc42d24121c4d9cdfd098 Reviewed-by: Kimmo Ollila --- .../bluetoothsettingsplugin/Bluetooth.qml | 89 --- .../bluetoothsettingsplugin/Discovery.qml | 142 ----- .../bluetoothsettingsplugin/bluetoothdevice.cpp | 169 ------ .../bluetoothsettingsplugin/bluetoothdevice.h | 85 --- .../bluetoothsettingsplugin.pro | 33 -- .../bluez/bluetoothdevice_p.cpp | 98 ---- .../bluez/bluetoothdevice_p.h | 56 -- .../bluetoothsettingsplugin/bluez/bluez.pri | 21 - .../bluetoothsettingsplugin/bluez/datatypes.h | 53 -- .../bluetoothsettingsplugin/bluez/device1.xml | 31 - .../bluez/objectmanager.xml | 20 - .../bluetoothsettingsplugin/discoverymodel.cpp | 246 -------- .../bluetoothsettingsplugin/discoverymodel.h | 130 ----- .../bluetoothsettingsplugin/icons.qrc | 16 - .../bluetoothsettingsplugin/plugin.cpp | 70 --- .../bluetoothsettingsplugin/qml.qrc | 6 - .../bluetoothsettingsplugin/qmldir | 3 - .../generalsettingsplugin/Display.qml | 137 ----- .../generalsettingsplugin/Sound.qml | 86 --- .../generalsettingsplugin.pro | 24 - .../generalsettingsplugin/icons.qrc | 7 - .../generalsettingsplugin/plugin.cpp | 53 -- src/qtdevicesettings/generalsettingsplugin/qml.qrc | 6 - src/qtdevicesettings/generalsettingsplugin/qmldir | 2 - src/qtdevicesettings/icons/Alert_yellow_1x.png | Bin 775 -> 0 bytes src/qtdevicesettings/icons/Audio_qt_6x.png | Bin 444 -> 0 bytes src/qtdevicesettings/icons/Bluetooth_qt_1x.png | Bin 858 -> 0 bytes src/qtdevicesettings/icons/Bluetooth_qt_6x.png | Bin 2349 -> 0 bytes src/qtdevicesettings/icons/Camcorder_qt_1x.png | Bin 719 -> 0 bytes src/qtdevicesettings/icons/Camera_qt_1x.png | Bin 1003 -> 0 bytes .../icons/Chevron-left_black_1x.png | Bin 707 -> 0 bytes src/qtdevicesettings/icons/Clock_qt_1x.png | Bin 1185 -> 0 bytes src/qtdevicesettings/icons/Clock_qt_6x.png | Bin 3438 -> 0 bytes src/qtdevicesettings/icons/Display_qt_6x.png | Bin 1157 -> 0 bytes src/qtdevicesettings/icons/Flag_qt_6x.png | Bin 1888 -> 0 bytes src/qtdevicesettings/icons/Headphones_qt_1x.png | Bin 1041 -> 0 bytes src/qtdevicesettings/icons/Heartbeat_qt_1x.png | Bin 1061 -> 0 bytes src/qtdevicesettings/icons/Keyboard_qt_1x.png | Bin 1116 -> 0 bytes src/qtdevicesettings/icons/Laptop_qt_1x.png | Bin 861 -> 0 bytes src/qtdevicesettings/icons/Microphone_qt_1x.png | Bin 943 -> 0 bytes src/qtdevicesettings/icons/MobilePhone_qt_1x.png | Bin 785 -> 0 bytes src/qtdevicesettings/icons/Mouse_qt_1x.png | Bin 732 -> 0 bytes src/qtdevicesettings/icons/Power_black_1x.png | Bin 1161 -> 0 bytes src/qtdevicesettings/icons/Tablet_qt_1x.png | Bin 721 -> 0 bytes src/qtdevicesettings/icons/Volume_down_qt_1x.png | Bin 571 -> 0 bytes src/qtdevicesettings/icons/Volume_mute_qt_1x.png | Bin 778 -> 0 bytes src/qtdevicesettings/icons/Volume_up_qt_1x.png | Bin 632 -> 0 bytes src/qtdevicesettings/icons/WifiAnim_black_2x.png | Bin 1673 -> 0 bytes src/qtdevicesettings/icons/Wifi_lightgray_2x.png | Bin 924 -> 0 bytes src/qtdevicesettings/icons/World_qt_6x.png | Bin 5789 -> 0 bytes src/qtdevicesettings/icons/generate_icons.sh | 27 - src/qtdevicesettings/icons/ref/Audio.png | Bin 135 -> 0 bytes src/qtdevicesettings/icons/ref/Back.png | Bin 1725 -> 0 bytes src/qtdevicesettings/icons/ref/Bluetooth.png | Bin 1364 -> 0 bytes src/qtdevicesettings/icons/ref/Camcorder.png | Bin 1036 -> 0 bytes src/qtdevicesettings/icons/ref/Camera.png | Bin 1889 -> 0 bytes src/qtdevicesettings/icons/ref/Chevron-left.png | Bin 1475 -> 0 bytes src/qtdevicesettings/icons/ref/Chevron-right.png | Bin 1463 -> 0 bytes src/qtdevicesettings/icons/ref/Circle-x.png | Bin 3358 -> 0 bytes src/qtdevicesettings/icons/ref/Clock.png | Bin 2438 -> 0 bytes src/qtdevicesettings/icons/ref/Cogs.png | Bin 2756 -> 0 bytes src/qtdevicesettings/icons/ref/Connections.png | Bin 3226 -> 0 bytes src/qtdevicesettings/icons/ref/Display.png | Bin 754 -> 0 bytes src/qtdevicesettings/icons/ref/Flag.png | Bin 1395 -> 0 bytes src/qtdevicesettings/icons/ref/Headphones.png | Bin 2141 -> 0 bytes src/qtdevicesettings/icons/ref/Heartbeat.png | Bin 2280 -> 0 bytes src/qtdevicesettings/icons/ref/Keyboard.png | Bin 571 -> 0 bytes src/qtdevicesettings/icons/ref/Laptop.png | Bin 753 -> 0 bytes src/qtdevicesettings/icons/ref/Lock.png | Bin 1043 -> 0 bytes src/qtdevicesettings/icons/ref/Microphone.png | Bin 1891 -> 0 bytes src/qtdevicesettings/icons/ref/MobilePhone.png | Bin 1034 -> 0 bytes src/qtdevicesettings/icons/ref/Mouse.png | Bin 1560 -> 0 bytes src/qtdevicesettings/icons/ref/Plus.png | Bin 2888 -> 0 bytes src/qtdevicesettings/icons/ref/Power.png | Bin 2466 -> 0 bytes src/qtdevicesettings/icons/ref/Settings.png | Bin 2630 -> 0 bytes src/qtdevicesettings/icons/ref/Tablet.png | Bin 892 -> 0 bytes src/qtdevicesettings/icons/ref/Volume_down.png | Bin 505 -> 0 bytes src/qtdevicesettings/icons/ref/Volume_mute.png | Bin 1000 -> 0 bytes src/qtdevicesettings/icons/ref/Volume_up.png | Bin 513 -> 0 bytes src/qtdevicesettings/icons/ref/Wifi.png | Bin 2102 -> 0 bytes src/qtdevicesettings/icons/ref/Wifi1.png | Bin 824 -> 0 bytes src/qtdevicesettings/icons/ref/Wifi2.png | Bin 987 -> 0 bytes src/qtdevicesettings/icons/ref/Wifi3.png | Bin 1195 -> 0 bytes src/qtdevicesettings/icons/ref/Wifi4.png | Bin 2102 -> 0 bytes src/qtdevicesettings/icons/ref/WifiAnim.png | Bin 2830 -> 0 bytes src/qtdevicesettings/icons/ref/World.png | Bin 4559 -> 0 bytes src/qtdevicesettings/icons/ref/Wrench.png | Bin 1677 -> 0 bytes src/qtdevicesettings/icons/ref/extra/Alert.png | Bin 1502 -> 0 bytes src/qtdevicesettings/icons/scripts/cimage.sh | 45 -- src/qtdevicesettings/icons/scripts/cimages.sh | 28 - src/qtdevicesettings/icons/scripts/rimage.sh | 37 -- src/qtdevicesettings/icons/scripts/rimages.sh | 25 - .../localesettingsplugin/Language.qml | 111 ---- .../localesettingsplugin/RegionSelect.qml | 96 --- .../localesettingsplugin/icons.qrc | 4 - .../localesettingsplugin/locale.xml | 12 - .../localesettingsplugin/localefiltermodel.cpp | 96 --- .../localesettingsplugin/localefiltermodel.h | 59 -- .../localesettingsplugin/localemodel.cpp | 167 ------ .../localesettingsplugin/localemodel.h | 96 --- .../localesettingsplugin/localesettingsplugin.pro | 36 -- .../localesettingsplugin/plugin.cpp | 75 --- src/qtdevicesettings/localesettingsplugin/qml.qrc | 6 - src/qtdevicesettings/localesettingsplugin/qmldir | 3 - .../localesettingsplugin/systemlocale.cpp | 57 -- .../localesettingsplugin/systemlocale.h | 62 -- .../localesettingsplugin/systemlocale_p.h | 87 --- .../networksettingsplugin/icons.qrc | 6 - .../imports/NetworkSettings/EditWiredSettings.qml | 641 --------------------- .../imports/NetworkSettings/IpAddressTextField.qml | 43 -- .../imports/NetworkSettings/NetworkDetails.qml | 42 -- .../imports/NetworkSettings/NetworkSettings.qml | 137 ----- .../NetworkSettings/WifiSelectorDelegate.qml | 90 --- .../imports/NetworkSettings/WifiSettings.qml | 190 ------ .../imports/NetworkSettings/WifiSignalMonitor.qml | 83 --- .../imports/NetworkSettings/WiredSettings.qml | 207 ------- .../networksettings/connman.pri | 22 - .../networksettings/connman/connman_manager.xml | 108 ---- .../networksettings/connman/connman_service.xml | 41 -- .../networksettings/connman/connman_technology.xml | 23 - .../networksettings/connman/connmancommon.cpp | 97 ---- .../networksettings/connman/connmancommon.h | 77 --- .../connman/qnetworksettingsinterface_p.cpp | 105 ---- .../connman/qnetworksettingsinterface_p.h | 92 --- .../connman/qnetworksettingsmanager_p.cpp | 168 ------ .../connman/qnetworksettingsmanager_p.h | 71 --- .../connman/qnetworksettingsservice_p.cpp | 402 ------------- .../connman/qnetworksettingsservice_p.h | 84 --- .../connman/qnetworksettingsuseragent_p.cpp | 101 ---- .../connman/qnetworksettingsuseragent_p.h | 77 --- .../networksettings/qnetworksettings.h | 411 ------------- .../qnetworksettingsaddressmodel.cpp | 83 --- .../networksettings/qnetworksettingsaddressmodel.h | 60 -- .../networksettings/qnetworksettingsinterface.cpp | 81 --- .../networksettings/qnetworksettingsinterface.h | 75 --- .../qnetworksettingsinterfacemodel.cpp | 119 ---- .../qnetworksettingsinterfacemodel.h | 72 --- .../networksettings/qnetworksettingsmanager.cpp | 77 --- .../networksettings/qnetworksettingsmanager.h | 74 --- .../networksettings/qnetworksettingsservice.cpp | 147 ----- .../networksettings/qnetworksettingsservice.h | 99 ---- .../qnetworksettingsservicemodel.cpp | 176 ------ .../networksettings/qnetworksettingsservicemodel.h | 89 --- .../networksettings/qnetworksettingsuseragent.cpp | 67 --- .../networksettings/qnetworksettingsuseragent.h | 63 -- .../networksettings/wpasupplicant.pri | 28 - .../wpasupplicant/qnetworksettingsinterface_p.cpp | 71 --- .../wpasupplicant/qnetworksettingsinterface_p.h | 88 --- .../wpasupplicant/qnetworksettingsmanager_p.cpp | 433 -------------- .../wpasupplicant/qnetworksettingsmanager_p.h | 94 --- .../wpasupplicant/qnetworksettingsservice_p.cpp | 127 ---- .../wpasupplicant/qnetworksettingsservice_p.h | 87 --- .../wpasupplicant/qnetworksettingsuseragent_p.cpp | 57 -- .../wpasupplicant/qnetworksettingsuseragent_p.h | 56 -- .../wpasupplicant/qwificontroller.cpp | 285 --------- .../wpasupplicant/qwificontroller_p.h | 116 ---- .../networksettings/wpasupplicant/qwifidevice.cpp | 94 --- .../networksettings/wpasupplicant/qwifidevice.h | 44 -- .../wpasupplicant/qwifisupplicant.cpp | 443 -------------- .../wpasupplicant/qwifisupplicant_p.h | 65 --- .../networksettingsplugin.pro | 74 --- .../networksettingsplugin_plugin.cpp | 67 --- .../networksettingsplugin_plugin.h | 52 -- src/qtdevicesettings/networksettingsplugin/qml.qrc | 10 - src/qtdevicesettings/networksettingsplugin/qmldir | 4 - src/qtdevicesettings/qtdevicesettings.pro | 11 - src/qtdevicesettings/settingscomponents/icons.qrc | 21 - .../imports/Settings/CustomCombobox.qml | 185 ------ .../Settings/FlatStyledDropdownDelegate.qml | 78 --- .../imports/Settings/IconButton.qml | 54 -- .../imports/Settings/TextLabel.qml | 48 -- .../settingscomponents/imports/Settings/qmldir | 5 - .../settingscomponents/settingscomponents.pro | 26 - src/qtdevicesettings/settingsui/deployment.pri | 27 - src/qtdevicesettings/settingsui/icons.qrc | 12 - src/qtdevicesettings/settingsui/main.cpp | 41 -- src/qtdevicesettings/settingsui/main.qml | 170 ------ src/qtdevicesettings/settingsui/qml.qrc | 6 - src/qtdevicesettings/settingsui/settingsui.pro | 17 - src/qtdevicesettings/settingsui/settingsview.xml | 41 -- .../timedateplugin/AnalogClock.qml | 255 -------- src/qtdevicesettings/timedateplugin/TimeDate.qml | 167 ------ .../timedateplugin/TimezonesView.qml | 94 --- src/qtdevicesettings/timedateplugin/icons.qrc | 4 - src/qtdevicesettings/timedateplugin/plugin.cpp | 77 --- src/qtdevicesettings/timedateplugin/qml.qrc | 7 - src/qtdevicesettings/timedateplugin/qmldir | 3 - src/qtdevicesettings/timedateplugin/systemtime.cpp | 85 --- src/qtdevicesettings/timedateplugin/systemtime.h | 73 --- src/qtdevicesettings/timedateplugin/systemtime_p.h | 88 --- src/qtdevicesettings/timedateplugin/timedated.xml | 30 - .../timedateplugin/timedateplugin.pro | 42 -- .../timedateplugin/timezonefiltermodel.cpp | 104 ---- .../timedateplugin/timezonefiltermodel.h | 59 -- .../timedateplugin/timezonemodel.cpp | 140 ----- .../timedateplugin/timezonemodel.h | 89 --- 196 files changed, 11666 deletions(-) delete mode 100644 src/qtdevicesettings/bluetoothsettingsplugin/Bluetooth.qml delete mode 100644 src/qtdevicesettings/bluetoothsettingsplugin/Discovery.qml delete mode 100644 src/qtdevicesettings/bluetoothsettingsplugin/bluetoothdevice.cpp delete mode 100644 src/qtdevicesettings/bluetoothsettingsplugin/bluetoothdevice.h delete mode 100644 src/qtdevicesettings/bluetoothsettingsplugin/bluetoothsettingsplugin.pro delete mode 100644 src/qtdevicesettings/bluetoothsettingsplugin/bluez/bluetoothdevice_p.cpp delete mode 100644 src/qtdevicesettings/bluetoothsettingsplugin/bluez/bluetoothdevice_p.h delete mode 100644 src/qtdevicesettings/bluetoothsettingsplugin/bluez/bluez.pri delete mode 100644 src/qtdevicesettings/bluetoothsettingsplugin/bluez/datatypes.h delete mode 100644 src/qtdevicesettings/bluetoothsettingsplugin/bluez/device1.xml delete mode 100644 src/qtdevicesettings/bluetoothsettingsplugin/bluez/objectmanager.xml delete mode 100644 src/qtdevicesettings/bluetoothsettingsplugin/discoverymodel.cpp delete mode 100644 src/qtdevicesettings/bluetoothsettingsplugin/discoverymodel.h delete mode 100644 src/qtdevicesettings/bluetoothsettingsplugin/icons.qrc delete mode 100644 src/qtdevicesettings/bluetoothsettingsplugin/plugin.cpp delete mode 100644 src/qtdevicesettings/bluetoothsettingsplugin/qml.qrc delete mode 100644 src/qtdevicesettings/bluetoothsettingsplugin/qmldir delete mode 100644 src/qtdevicesettings/generalsettingsplugin/Display.qml delete mode 100644 src/qtdevicesettings/generalsettingsplugin/Sound.qml delete mode 100644 src/qtdevicesettings/generalsettingsplugin/generalsettingsplugin.pro delete mode 100644 src/qtdevicesettings/generalsettingsplugin/icons.qrc delete mode 100644 src/qtdevicesettings/generalsettingsplugin/plugin.cpp delete mode 100644 src/qtdevicesettings/generalsettingsplugin/qml.qrc delete mode 100644 src/qtdevicesettings/generalsettingsplugin/qmldir delete mode 100644 src/qtdevicesettings/icons/Alert_yellow_1x.png delete mode 100644 src/qtdevicesettings/icons/Audio_qt_6x.png delete mode 100644 src/qtdevicesettings/icons/Bluetooth_qt_1x.png delete mode 100644 src/qtdevicesettings/icons/Bluetooth_qt_6x.png delete mode 100644 src/qtdevicesettings/icons/Camcorder_qt_1x.png delete mode 100644 src/qtdevicesettings/icons/Camera_qt_1x.png delete mode 100644 src/qtdevicesettings/icons/Chevron-left_black_1x.png delete mode 100644 src/qtdevicesettings/icons/Clock_qt_1x.png delete mode 100644 src/qtdevicesettings/icons/Clock_qt_6x.png delete mode 100644 src/qtdevicesettings/icons/Display_qt_6x.png delete mode 100644 src/qtdevicesettings/icons/Flag_qt_6x.png delete mode 100644 src/qtdevicesettings/icons/Headphones_qt_1x.png delete mode 100644 src/qtdevicesettings/icons/Heartbeat_qt_1x.png delete mode 100644 src/qtdevicesettings/icons/Keyboard_qt_1x.png delete mode 100644 src/qtdevicesettings/icons/Laptop_qt_1x.png delete mode 100644 src/qtdevicesettings/icons/Microphone_qt_1x.png delete mode 100644 src/qtdevicesettings/icons/MobilePhone_qt_1x.png delete mode 100644 src/qtdevicesettings/icons/Mouse_qt_1x.png delete mode 100644 src/qtdevicesettings/icons/Power_black_1x.png delete mode 100644 src/qtdevicesettings/icons/Tablet_qt_1x.png delete mode 100644 src/qtdevicesettings/icons/Volume_down_qt_1x.png delete mode 100644 src/qtdevicesettings/icons/Volume_mute_qt_1x.png delete mode 100644 src/qtdevicesettings/icons/Volume_up_qt_1x.png delete mode 100644 src/qtdevicesettings/icons/WifiAnim_black_2x.png delete mode 100644 src/qtdevicesettings/icons/Wifi_lightgray_2x.png delete mode 100644 src/qtdevicesettings/icons/World_qt_6x.png delete mode 100755 src/qtdevicesettings/icons/generate_icons.sh delete mode 100644 src/qtdevicesettings/icons/ref/Audio.png delete mode 100644 src/qtdevicesettings/icons/ref/Back.png delete mode 100644 src/qtdevicesettings/icons/ref/Bluetooth.png delete mode 100644 src/qtdevicesettings/icons/ref/Camcorder.png delete mode 100644 src/qtdevicesettings/icons/ref/Camera.png delete mode 100644 src/qtdevicesettings/icons/ref/Chevron-left.png delete mode 100644 src/qtdevicesettings/icons/ref/Chevron-right.png delete mode 100644 src/qtdevicesettings/icons/ref/Circle-x.png delete mode 100644 src/qtdevicesettings/icons/ref/Clock.png delete mode 100644 src/qtdevicesettings/icons/ref/Cogs.png delete mode 100644 src/qtdevicesettings/icons/ref/Connections.png delete mode 100644 src/qtdevicesettings/icons/ref/Display.png delete mode 100644 src/qtdevicesettings/icons/ref/Flag.png delete mode 100644 src/qtdevicesettings/icons/ref/Headphones.png delete mode 100644 src/qtdevicesettings/icons/ref/Heartbeat.png delete mode 100644 src/qtdevicesettings/icons/ref/Keyboard.png delete mode 100644 src/qtdevicesettings/icons/ref/Laptop.png delete mode 100644 src/qtdevicesettings/icons/ref/Lock.png delete mode 100644 src/qtdevicesettings/icons/ref/Microphone.png delete mode 100644 src/qtdevicesettings/icons/ref/MobilePhone.png delete mode 100644 src/qtdevicesettings/icons/ref/Mouse.png delete mode 100644 src/qtdevicesettings/icons/ref/Plus.png delete mode 100644 src/qtdevicesettings/icons/ref/Power.png delete mode 100644 src/qtdevicesettings/icons/ref/Settings.png delete mode 100644 src/qtdevicesettings/icons/ref/Tablet.png delete mode 100644 src/qtdevicesettings/icons/ref/Volume_down.png delete mode 100644 src/qtdevicesettings/icons/ref/Volume_mute.png delete mode 100644 src/qtdevicesettings/icons/ref/Volume_up.png delete mode 100644 src/qtdevicesettings/icons/ref/Wifi.png delete mode 100644 src/qtdevicesettings/icons/ref/Wifi1.png delete mode 100644 src/qtdevicesettings/icons/ref/Wifi2.png delete mode 100644 src/qtdevicesettings/icons/ref/Wifi3.png delete mode 100644 src/qtdevicesettings/icons/ref/Wifi4.png delete mode 100644 src/qtdevicesettings/icons/ref/WifiAnim.png delete mode 100644 src/qtdevicesettings/icons/ref/World.png delete mode 100644 src/qtdevicesettings/icons/ref/Wrench.png delete mode 100644 src/qtdevicesettings/icons/ref/extra/Alert.png delete mode 100755 src/qtdevicesettings/icons/scripts/cimage.sh delete mode 100755 src/qtdevicesettings/icons/scripts/cimages.sh delete mode 100755 src/qtdevicesettings/icons/scripts/rimage.sh delete mode 100755 src/qtdevicesettings/icons/scripts/rimages.sh delete mode 100644 src/qtdevicesettings/localesettingsplugin/Language.qml delete mode 100644 src/qtdevicesettings/localesettingsplugin/RegionSelect.qml delete mode 100644 src/qtdevicesettings/localesettingsplugin/icons.qrc delete mode 100644 src/qtdevicesettings/localesettingsplugin/locale.xml delete mode 100644 src/qtdevicesettings/localesettingsplugin/localefiltermodel.cpp delete mode 100644 src/qtdevicesettings/localesettingsplugin/localefiltermodel.h delete mode 100644 src/qtdevicesettings/localesettingsplugin/localemodel.cpp delete mode 100644 src/qtdevicesettings/localesettingsplugin/localemodel.h delete mode 100644 src/qtdevicesettings/localesettingsplugin/localesettingsplugin.pro delete mode 100644 src/qtdevicesettings/localesettingsplugin/plugin.cpp delete mode 100644 src/qtdevicesettings/localesettingsplugin/qml.qrc delete mode 100644 src/qtdevicesettings/localesettingsplugin/qmldir delete mode 100644 src/qtdevicesettings/localesettingsplugin/systemlocale.cpp delete mode 100644 src/qtdevicesettings/localesettingsplugin/systemlocale.h delete mode 100644 src/qtdevicesettings/localesettingsplugin/systemlocale_p.h delete mode 100644 src/qtdevicesettings/networksettingsplugin/icons.qrc delete mode 100644 src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/EditWiredSettings.qml delete mode 100644 src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/IpAddressTextField.qml delete mode 100644 src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/NetworkDetails.qml delete mode 100644 src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/NetworkSettings.qml delete mode 100644 src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/WifiSelectorDelegate.qml delete mode 100644 src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/WifiSettings.qml delete mode 100644 src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/WifiSignalMonitor.qml delete mode 100644 src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/WiredSettings.qml delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/connman.pri delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/connman/connman_manager.xml delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/connman/connman_service.xml delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/connman/connman_technology.xml delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/connman/connmancommon.cpp delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/connman/connmancommon.h delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsinterface_p.cpp delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsinterface_p.h delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsmanager_p.cpp delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsmanager_p.h delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsservice_p.cpp delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsservice_p.h delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsuseragent_p.cpp delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsuseragent_p.h delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettings.h delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsaddressmodel.cpp delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsaddressmodel.h delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsinterface.cpp delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsinterface.h delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsinterfacemodel.cpp delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsinterfacemodel.h delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsmanager.cpp delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsmanager.h delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsservice.cpp delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsservice.h delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsservicemodel.cpp delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsservicemodel.h delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsuseragent.cpp delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsuseragent.h delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant.pri delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qnetworksettingsinterface_p.cpp delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qnetworksettingsinterface_p.h delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qnetworksettingsmanager_p.cpp delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qnetworksettingsmanager_p.h delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qnetworksettingsservice_p.cpp delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qnetworksettingsservice_p.h delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qnetworksettingsuseragent_p.cpp delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qnetworksettingsuseragent_p.h delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qwificontroller.cpp delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qwificontroller_p.h delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qwifidevice.cpp delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qwifidevice.h delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qwifisupplicant.cpp delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qwifisupplicant_p.h delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettingsplugin.pro delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettingsplugin_plugin.cpp delete mode 100644 src/qtdevicesettings/networksettingsplugin/networksettingsplugin_plugin.h delete mode 100644 src/qtdevicesettings/networksettingsplugin/qml.qrc delete mode 100644 src/qtdevicesettings/networksettingsplugin/qmldir delete mode 100644 src/qtdevicesettings/qtdevicesettings.pro delete mode 100644 src/qtdevicesettings/settingscomponents/icons.qrc delete mode 100644 src/qtdevicesettings/settingscomponents/imports/Settings/CustomCombobox.qml delete mode 100644 src/qtdevicesettings/settingscomponents/imports/Settings/FlatStyledDropdownDelegate.qml delete mode 100644 src/qtdevicesettings/settingscomponents/imports/Settings/IconButton.qml delete mode 100644 src/qtdevicesettings/settingscomponents/imports/Settings/TextLabel.qml delete mode 100644 src/qtdevicesettings/settingscomponents/imports/Settings/qmldir delete mode 100644 src/qtdevicesettings/settingscomponents/settingscomponents.pro delete mode 100644 src/qtdevicesettings/settingsui/deployment.pri delete mode 100644 src/qtdevicesettings/settingsui/icons.qrc delete mode 100644 src/qtdevicesettings/settingsui/main.cpp delete mode 100644 src/qtdevicesettings/settingsui/main.qml delete mode 100644 src/qtdevicesettings/settingsui/qml.qrc delete mode 100644 src/qtdevicesettings/settingsui/settingsui.pro delete mode 100644 src/qtdevicesettings/settingsui/settingsview.xml delete mode 100644 src/qtdevicesettings/timedateplugin/AnalogClock.qml delete mode 100644 src/qtdevicesettings/timedateplugin/TimeDate.qml delete mode 100644 src/qtdevicesettings/timedateplugin/TimezonesView.qml delete mode 100644 src/qtdevicesettings/timedateplugin/icons.qrc delete mode 100644 src/qtdevicesettings/timedateplugin/plugin.cpp delete mode 100644 src/qtdevicesettings/timedateplugin/qml.qrc delete mode 100644 src/qtdevicesettings/timedateplugin/qmldir delete mode 100644 src/qtdevicesettings/timedateplugin/systemtime.cpp delete mode 100644 src/qtdevicesettings/timedateplugin/systemtime.h delete mode 100644 src/qtdevicesettings/timedateplugin/systemtime_p.h delete mode 100644 src/qtdevicesettings/timedateplugin/timedated.xml delete mode 100644 src/qtdevicesettings/timedateplugin/timedateplugin.pro delete mode 100644 src/qtdevicesettings/timedateplugin/timezonefiltermodel.cpp delete mode 100644 src/qtdevicesettings/timedateplugin/timezonefiltermodel.h delete mode 100644 src/qtdevicesettings/timedateplugin/timezonemodel.cpp delete mode 100644 src/qtdevicesettings/timedateplugin/timezonemodel.h (limited to 'src/qtdevicesettings') diff --git a/src/qtdevicesettings/bluetoothsettingsplugin/Bluetooth.qml b/src/qtdevicesettings/bluetoothsettingsplugin/Bluetooth.qml deleted file mode 100644 index 88a7d7c..0000000 --- a/src/qtdevicesettings/bluetoothsettingsplugin/Bluetooth.qml +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.5 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles.Flat 1.0 as Flat -import com.theqtcompany.settings.common 1.0 -import com.theqtcompany.settings.bluetooth 1.0 - -Item { - id: root - property string title: qsTr("Bluetooth Settings") - - Column { - id: content - anchors.fill: parent - anchors.margins: Math.round(40 * Flat.FlatStyle.scaleFactor) - - GroupBox { - id: groupBox - width: parent.width - title: qsTr("Bluetooth status") - Layout.fillWidth: true - - ColumnLayout { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - width: parent.width - Layout.fillWidth: true - - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - id: off - text: qsTr("Off") - } - - Switch { - checked: BtDevice.powered - onCheckedChanged: BtDevice.powered = checked - } - - TextLabel { - text: qsTr("On") - } - } - } - } - - Discovery { - id: discovery - visible: BtDevice.powered - width: parent.width - height: Math.round(content.height - 100 * Flat.FlatStyle.scaleFactor) - } - } -} diff --git a/src/qtdevicesettings/bluetoothsettingsplugin/Discovery.qml b/src/qtdevicesettings/bluetoothsettingsplugin/Discovery.qml deleted file mode 100644 index d40ccbe..0000000 --- a/src/qtdevicesettings/bluetoothsettingsplugin/Discovery.qml +++ /dev/null @@ -1,142 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.5 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.4 -import QtBluetooth 5.2 -import QtQuick.Controls.Styles.Flat 1.0 as Flat -import com.theqtcompany.settings.common 1.0 -import com.theqtcompany.settings.bluetooth 1.0 - -Item { - id: top - property BluetoothService currentService - - GroupBox { - id: groupBox - title: qsTr("Devices") - width: parent.width - - ListView { - id: mainList - width: parent.width - height: top.height - - function getIcon(deviceType) { - switch (deviceType) { - case BtDeviceItem.Computer: - return "../icons/Laptop_qt_1x.png" - case BtDeviceItem.Headphones: - return "../icons/Headphones_qt_1x.png" - case BtDeviceItem.Microphone: - return "../icons/Microphone_qt_1x.png" - case BtDeviceItem.Mouse: - return "../icons/Mouse_qt_1x.png" - case BtDeviceItem.Keyboard: - return "../icons/Keyboard_qt_1x.png" - default: - return "../icons/Bluetooth_qt_1x.png" - } - } - - model: BtDevice.deviceModel - delegate: Rectangle { - id: btDelegate - width: parent.width - height: Math.round(column.height + 10 * Flat.FlatStyle.scaleFactor) - - property bool expended: false; - clip: true - - MouseArea { - anchors.fill: parent - onClicked: btDelegate.expended = !btDelegate.expended - } - - RowLayout { - anchors.top: parent.top - anchors.left: parent.left - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - - Image { - id: bticon - source: mainList.getIcon(type) - } - - Column { - id: column - TextLabel { - id: bttext - text: name - } - - TextLabel { - id: details - opacity: btDelegate.expended ? 1 : 0.0 - text: address - Behavior on opacity { - NumberAnimation { duration: 200} - } - } - } - } - - Button { - anchors.right: parent.right - anchors.rightMargin: Math.round(10 * Flat.FlatStyle.scaleFactor) - visible: !BtDevice.scanning - text: connected ? qsTr("Disconnect") : qsTr("Connect") - - onClicked : connected ? BtDevice.requestDisconnect(address) : BtDevice.requestPairing(address); - } - - Behavior on height { NumberAnimation { duration: 200} } - - } - focus: true - } - } - - BusyIndicator { - anchors.right: groupBox.right - anchors.top: groupBox.top - anchors.topMargin: Math.round(40 * Flat.FlatStyle.scaleFactor) - anchors.rightMargin: Math.round(10 * Flat.FlatStyle.scaleFactor) - height: Math.round(20 * Flat.FlatStyle.scaleFactor) - width: Math.round(20 * Flat.FlatStyle.scaleFactor) - running: BtDevice.scanning - } -} diff --git a/src/qtdevicesettings/bluetoothsettingsplugin/bluetoothdevice.cpp b/src/qtdevicesettings/bluetoothsettingsplugin/bluetoothdevice.cpp deleted file mode 100644 index 65a7422..0000000 --- a/src/qtdevicesettings/bluetoothsettingsplugin/bluetoothdevice.cpp +++ /dev/null @@ -1,169 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include "bluetoothdevice.h" -#include "bluez/bluetoothdevice_p.h" - -BluetoothDevice::BluetoothDevice(QObject *parent) : QObject(parent) - ,m_localDevice(new QBluetoothLocalDevice(this)) - ,m_deviceModel(new DiscoveryModel(this)) - ,m_powered(false) - ,m_scanning(true) -{ - m_powered = m_localDevice->hostMode() != QBluetoothLocalDevice::HostPoweredOff; - - connect(m_localDevice, &QBluetoothLocalDevice::hostModeStateChanged, this, &BluetoothDevice::deviceStateChanged); - connect(m_localDevice, &QBluetoothLocalDevice::deviceConnected, this, &BluetoothDevice::deviceConnected); - connect(m_localDevice, &QBluetoothLocalDevice::deviceDisconnected, this, &BluetoothDevice::deviceDisconnected); - connect(m_deviceModel, &DiscoveryModel::scanFinished, this, &BluetoothDevice::scanFinished); - - if (m_powered) { - m_deviceModel->scanDevices(); - } - -} - -void BluetoothDevice::deviceStateChanged(QBluetoothLocalDevice::HostMode state) -{ - m_powered = state != QBluetoothLocalDevice::HostPoweredOff; - emit poweredChanged(); -} - -bool BluetoothDevice::powered() const -{ - return m_powered; -} - -void BluetoothDevice::setPowered(const bool& aPowered) -{ - if (aPowered) { - m_localDevice->powerOn(); - } - else { - m_localDevice->setHostMode(QBluetoothLocalDevice::HostPoweredOff); - } -} - -QObject* BluetoothDevice::deviceModel() const -{ - return static_cast(m_deviceModel); -} - -void BluetoothDevice::scanFinished() -{ - m_scanning = false; - emit scanningChanged(); - updateConnectionStatuses(); -} - -bool BluetoothDevice::scanning() const -{ - return m_scanning; -} - -void BluetoothDevice::setScanning(const bool& aScan) -{ - if (m_scanning && !aScan) { - //TODO m_deviceModel->cancel(); - } - else if (aScan && !m_scanning) { - m_deviceModel->scanDevices(); - m_scanning = true; - emit scanningChanged(); - } -} - -void BluetoothDevice::updateConnectionStatuses() -{ - QList connectedDevices = - m_localDevice->connectedDevices(); - - foreach (QBluetoothAddress addr, connectedDevices) { - m_deviceModel->setConnected(addr.toString(), true); - } -} - -void BluetoothDevice::requestPairing(const QString& address) -{ - QBluetoothAddress addr(address); - m_localDevice->requestPairing(addr, QBluetoothLocalDevice::Paired); - connect(m_localDevice, &QBluetoothLocalDevice::pairingDisplayConfirmation, this, &BluetoothDevice::pairingDisplayConfirmation); - - connect(m_localDevice, &QBluetoothLocalDevice::pairingDisplayPinCode, this, &BluetoothDevice::pairingDisplayPinCode); - - connect(m_localDevice, &QBluetoothLocalDevice::pairingFinished, this, &BluetoothDevice::pairingFinished); -} - -void BluetoothDevice::requestConnect(const QString &address) -{ - QScopedPointer connectionHandler(new BluetoothDevicePrivate(address)); - connectionHandler->connectDevice(); -} - -void BluetoothDevice::requestDisconnect(const QString& address) -{ - QScopedPointer connectionHandler(new BluetoothDevicePrivate(address)); - connectionHandler->disconnectDevice(); -} - -void BluetoothDevice::pairingDisplayConfirmation(const QBluetoothAddress & address, QString pin) -{ - Q_UNUSED(address); - Q_UNUSED(pin); -} - -void BluetoothDevice::pairingDisplayPinCode(const QBluetoothAddress & address, QString pin) -{ - Q_UNUSED(address); - Q_UNUSED(pin); -} - -void BluetoothDevice::pairingFinished(const QBluetoothAddress & address, QBluetoothLocalDevice::Pairing pairing) -{ - if (pairing == QBluetoothLocalDevice::Paired) { - requestConnect(address.toString()); - } -} - -void BluetoothDevice::deviceConnected(const QBluetoothAddress & address) -{ - m_deviceModel->setConnected(address.toString(), true); -} - -void BluetoothDevice::deviceDisconnected(const QBluetoothAddress & address) -{ - m_deviceModel->setConnected(address.toString(), false); -} diff --git a/src/qtdevicesettings/bluetoothsettingsplugin/bluetoothdevice.h b/src/qtdevicesettings/bluetoothsettingsplugin/bluetoothdevice.h deleted file mode 100644 index 370b2bc..0000000 --- a/src/qtdevicesettings/bluetoothsettingsplugin/bluetoothdevice.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef BLUETOOTHDEVICE_H -#define BLUETOOTHDEVICE_H - -#include -#include - -class DiscoveryModel; - -class BluetoothDevice : public QObject -{ - Q_OBJECT - Q_PROPERTY(bool scanning READ scanning WRITE setScanning NOTIFY scanningChanged) - Q_PROPERTY(bool powered READ powered WRITE setPowered NOTIFY poweredChanged) - Q_PROPERTY(QObject* deviceModel READ deviceModel CONSTANT) -public: - explicit BluetoothDevice(QObject *parent = 0); - bool powered() const; - void setPowered(const bool& aPowered); - QObject* deviceModel() const; - bool scanning() const; - void setScanning(const bool& aScan); - Q_INVOKABLE void requestPairing(const QString& address); - Q_INVOKABLE void requestConnect(const QString& address); - Q_INVOKABLE void requestDisconnect(const QString& address); -signals: - void poweredChanged(); - void scanningChanged(); - -public slots: - void deviceStateChanged(QBluetoothLocalDevice::HostMode state); - void scanFinished(); - //These are not yet signaled - //See bug https://bugreports.qt.io/browse/QTBUG-38401 - void pairingDisplayConfirmation(const QBluetoothAddress & address, QString pin); - void pairingDisplayPinCode(const QBluetoothAddress & address, QString pin); - void pairingFinished(const QBluetoothAddress & address, QBluetoothLocalDevice::Pairing pairing); - void deviceConnected(const QBluetoothAddress & address); - void deviceDisconnected(const QBluetoothAddress & address); - -private: - void updateConnectionStatuses(); - -private: - QBluetoothLocalDevice* m_localDevice; - DiscoveryModel *m_deviceModel; - bool m_powered; - bool m_scanning; -}; - -#endif // BLUETOOTHDEVICE_H diff --git a/src/qtdevicesettings/bluetoothsettingsplugin/bluetoothsettingsplugin.pro b/src/qtdevicesettings/bluetoothsettingsplugin/bluetoothsettingsplugin.pro deleted file mode 100644 index 1ffc6c5..0000000 --- a/src/qtdevicesettings/bluetoothsettingsplugin/bluetoothsettingsplugin.pro +++ /dev/null @@ -1,33 +0,0 @@ -TEMPLATE = lib -CONFIG += plugin -QT += qml bluetooth -uri = com.theqtcompany.settings.bluetooth - -TARGET = btsettingsplugin - -include(bluez/bluez.pri) - -HEADERS = \ - bluetoothdevice.h \ - discoverymodel.h - -SOURCES += plugin.cpp \ - bluetoothdevice.cpp \ - discoverymodel.cpp - - -pluginfiles.files += \ - qmldir \ - - -installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /) - -target.path = $$installPath -pluginfiles.path += $$installPath -INSTALLS += target pluginfiles - - -RESOURCES += \ - icons.qrc \ - qml.qrc - diff --git a/src/qtdevicesettings/bluetoothsettingsplugin/bluez/bluetoothdevice_p.cpp b/src/qtdevicesettings/bluetoothsettingsplugin/bluez/bluetoothdevice_p.cpp deleted file mode 100644 index ded84f2..0000000 --- a/src/qtdevicesettings/bluetoothsettingsplugin/bluez/bluetoothdevice_p.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "bluetoothdevice_p.h" -#include "datatypes.h" -#include "objectmanager_interface.cpp" -#include "moc_objectmanager_interface.cpp" -#include "device1_interface.h" - - -BluetoothDevicePrivate::BluetoothDevicePrivate(const QString& address, QObject *parent) - :QObject(parent) - ,m_address(address) -{ - -} - -OrgBluezDevice1Interface* BluetoothDevicePrivate::findDevice() -{ - OrgFreedesktopDBusObjectManagerInterface manager(QStringLiteral("org.bluez"), - QStringLiteral("/"), - QDBusConnection::systemBus()); - QDBusPendingReply reply = manager.GetManagedObjects(); - reply.waitForFinished(); - if (reply.isError()) { - qWarning() << "Failed to get objects"; - return NULL; - } - - ManagedObjectList managedObjectList = reply.value(); - for (ManagedObjectList::const_iterator it = managedObjectList.constBegin(); it != managedObjectList.constEnd(); ++it) { - const QDBusObjectPath &path = it.key(); - - const InterfaceList &ifaceList = it.value(); - for (InterfaceList::const_iterator jt = ifaceList.constBegin(); jt != ifaceList.constEnd(); ++jt) { - const QString &iface = jt.key(); - const QVariantMap &ifaceValues = jt.value(); - if (iface == QStringLiteral("org.bluez.Device1")) { - if (ifaceValues["Address"] == m_address) { - OrgBluezDevice1Interface *devIf = new OrgBluezDevice1Interface("org.bluez", path.path(), QDBusConnection::systemBus()); - return devIf; - } - } - } - } - return NULL; -} - - -void BluetoothDevicePrivate::connectDevice() -{ - OrgBluezDevice1Interface *dev = findDevice(); - if (dev) { - dev->Connect(); - dev->deleteLater(); - } -} - -void BluetoothDevicePrivate::disconnectDevice() -{ - OrgBluezDevice1Interface *dev = findDevice(); - if (dev) { - dev->Disconnect(); - dev->deleteLater(); - } -} diff --git a/src/qtdevicesettings/bluetoothsettingsplugin/bluez/bluetoothdevice_p.h b/src/qtdevicesettings/bluetoothsettingsplugin/bluez/bluetoothdevice_p.h deleted file mode 100644 index 0bd9599..0000000 --- a/src/qtdevicesettings/bluetoothsettingsplugin/bluez/bluetoothdevice_p.h +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utils module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef BLUETOOTHDEVICE__P_H -#define BLUETOOTHDEVICE__P_H - -#include -#include - -class OrgBluezDevice1Interface; - -class BluetoothDevicePrivate : public QObject -{ -public: - explicit BluetoothDevicePrivate(const QString& address, QObject *parent=0); - void connectDevice(); - void disconnectDevice(); - -private: - OrgBluezDevice1Interface* findDevice(); - QString m_address; -}; - -#endif // BLUETOOTHDEVICE__P_H diff --git a/src/qtdevicesettings/bluetoothsettingsplugin/bluez/bluez.pri b/src/qtdevicesettings/bluetoothsettingsplugin/bluez/bluez.pri deleted file mode 100644 index f20be87..0000000 --- a/src/qtdevicesettings/bluetoothsettingsplugin/bluez/bluez.pri +++ /dev/null @@ -1,21 +0,0 @@ -#------------------------------------------------- -# -# Project created by QtCreator 2015-11-03T13:52:45 -# -#------------------------------------------------- - -QT += core dbus - -INCLUDEPATH += $${PWD} -INCLUDEPATH += $${PWD}/bluez - -DBUS_INTERFACES = \ - $${PWD}/objectmanager.xml \ - $${PWD}/device1.xml \ - -HEADERS += \ - $$PWD/bluetoothdevice_p.h \ - $$PWD/dbusdatatypes.h - -SOURCES += \ - $$PWD/bluetoothdevice_p.cpp diff --git a/src/qtdevicesettings/bluetoothsettingsplugin/bluez/datatypes.h b/src/qtdevicesettings/bluetoothsettingsplugin/bluez/datatypes.h deleted file mode 100644 index b794c47..0000000 --- a/src/qtdevicesettings/bluetoothsettingsplugin/bluez/datatypes.h +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utils module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef DATATYPES_H -#define DATATYPES_H - -#include -#include -#include -#include -#include -#include - -typedef QMap InterfaceList; -typedef QMap ManagedObjectList; - -Q_DECLARE_METATYPE(InterfaceList) -Q_DECLARE_METATYPE(ManagedObjectList) - - -#endif // DATATYPES_H diff --git a/src/qtdevicesettings/bluetoothsettingsplugin/bluez/device1.xml b/src/qtdevicesettings/bluetoothsettingsplugin/bluez/device1.xml deleted file mode 100644 index 5b16992..0000000 --- a/src/qtdevicesettings/bluetoothsettingsplugin/bluez/device1.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/qtdevicesettings/bluetoothsettingsplugin/bluez/objectmanager.xml b/src/qtdevicesettings/bluetoothsettingsplugin/bluez/objectmanager.xml deleted file mode 100644 index e52d6fe..0000000 --- a/src/qtdevicesettings/bluetoothsettingsplugin/bluez/objectmanager.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/src/qtdevicesettings/bluetoothsettingsplugin/discoverymodel.cpp b/src/qtdevicesettings/bluetoothsettingsplugin/discoverymodel.cpp deleted file mode 100644 index 36d3a2e..0000000 --- a/src/qtdevicesettings/bluetoothsettingsplugin/discoverymodel.cpp +++ /dev/null @@ -1,246 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include "discoverymodel.h" - -BtDeviceItem::BtDeviceItem(const QBluetoothDeviceInfo& bt, QObject *parent) - : QObject(parent) - ,m_name(bt.name()) - ,m_address(bt.address().toString()) - ,m_connected(false) -{ - m_type = getDeviceType(bt.majorDeviceClass(), bt.minorDeviceClass()); -} - -QString BtDeviceItem::name() const -{ - return m_name; -} - -QString BtDeviceItem::address() const -{ - return m_address; -} - -bool BtDeviceItem::connected() const -{ - return m_connected; -} - -void BtDeviceItem::setConnected(bool aConnected) -{ - m_connected = aConnected; - emit connectedChanged(); -} - -BtDeviceItem::DeviceType BtDeviceItem::type() const -{ - return m_type; -} - -BtDeviceItem::DeviceType BtDeviceItem::getDeviceType(const QBluetoothDeviceInfo::MajorDeviceClass major, const quint8 minor) const -{ - switch (major) { - case QBluetoothDeviceInfo::ComputerDevice: - return getComputerDeviceType(minor); - break; - case QBluetoothDeviceInfo::PhoneDevice: - return getPhoneDeviceType(minor); - break; - case QBluetoothDeviceInfo::AudioVideoDevice: - return getAudioDeviceType(minor); - break; - case QBluetoothDeviceInfo::PeripheralDevice: - return getPeripheralDeviceType(minor); - break; - case QBluetoothDeviceInfo::ImagingDevice: - return getImagingDeviceType(minor); - break; - default: - return GenericDevice; - } - return GenericDevice; -} - -BtDeviceItem::DeviceType BtDeviceItem::getComputerDeviceType(const quint8 minor) const -{ - Q_UNUSED(minor); - return Computer; -} - -BtDeviceItem::DeviceType BtDeviceItem::getAudioDeviceType(const quint8 minor) const -{ - switch (minor) { - case QBluetoothDeviceInfo::Microphone: - return Microphone; - break; - case QBluetoothDeviceInfo::WearableHeadsetDevice: - case QBluetoothDeviceInfo::Headphones: - return Headphones; - break; - case QBluetoothDeviceInfo::Camcorder: - case QBluetoothDeviceInfo::VideoCamera: - return Camcorder; - break; - default: - return GenericDevice; - break; - } -} - -BtDeviceItem::DeviceType BtDeviceItem::getPeripheralDeviceType(const quint8 minor) const -{ - switch (minor) { - case QBluetoothDeviceInfo::KeyboardPeripheral: - return Keyboard; - break; - case QBluetoothDeviceInfo::PointingDevicePeripheral: - return Mouse; - break; - default: - return GenericDevice; - break; - } -} - -BtDeviceItem::DeviceType BtDeviceItem::getImagingDeviceType(const quint8 minor) const -{ - switch (minor) { - case QBluetoothDeviceInfo::ImageCamera: - return Camera; - break; - default: - return GenericDevice; - break; - } -} - -BtDeviceItem::DeviceType BtDeviceItem::getPhoneDeviceType(const quint8 minor) const -{ - Q_UNUSED(minor); - return Phone; -} - - -DiscoveryModel::DiscoveryModel(QObject *parent) - : QAbstractListModel(parent) - ,m_discoveryAgent(new QBluetoothDeviceDiscoveryAgent(this)) -{ - m_roleNames.insert(Qt::UserRole, "modelData"); - m_roleNames.insert(Address, "address"); - m_roleNames.insert(Name, "name"); - m_roleNames.insert(Type, "type"); - m_roleNames.insert(Connected, "connected"); - - connect(m_discoveryAgent, SIGNAL(deviceDiscovered(QBluetoothDeviceInfo)), - this, SLOT(deviceDiscovered(QBluetoothDeviceInfo))); - - connect(m_discoveryAgent, SIGNAL(finished()), - this, SIGNAL(scanFinished())); - -} - -void DiscoveryModel::deviceDiscovered(const QBluetoothDeviceInfo &device) -{ - beginInsertRows(QModelIndex(), m_items.count(), m_items.count()); - BtDeviceItem *item = new BtDeviceItem(device); - m_items.append(item); - endInsertRows(); -} - -DiscoveryModel::~DiscoveryModel() -{ - -} - -void DiscoveryModel::scanDevices() -{ - m_discoveryAgent->start(); -} - -QHash DiscoveryModel::roleNames() const -{ - return m_roleNames; -} - -int DiscoveryModel::rowCount(const QModelIndex & parent) const -{ - Q_UNUSED(parent); - return m_items.count(); -} - -QVariant DiscoveryModel::data(const QModelIndex & index, int role) const -{ - if (!index.isValid()) return QVariant(); - - BtDeviceItem *item = m_items[index.row()]; - - switch (role) { - case DiscoveryModel::Name: - return item->name(); - break; - case DiscoveryModel::Address: - return item->address(); - break; - case DiscoveryModel::Type: - return item->type(); - break; - case DiscoveryModel::Connected: - return item->connected(); - default: - return ""; - } -} - -void DiscoveryModel::setConnected(const QString &aAddress, bool connected) -{ - bool found = false; - int i = 0; - QVector role; - role.append(DiscoveryModel::Connected); - foreach (BtDeviceItem *item, m_items) { - if (item->address() == aAddress) { - item->setConnected(connected); - found = true; - break; - } - i++; - } - - if (found) - emit dataChanged(index(i, 0), index(i, 0), role); -} diff --git a/src/qtdevicesettings/bluetoothsettingsplugin/discoverymodel.h b/src/qtdevicesettings/bluetoothsettingsplugin/discoverymodel.h deleted file mode 100644 index de30c4c..0000000 --- a/src/qtdevicesettings/bluetoothsettingsplugin/discoverymodel.h +++ /dev/null @@ -1,130 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef DISCOVERYMODEL_H -#define DISCOVERYMODEL_H - - -#include -#include -#include -#include - -class BtDeviceItem : public QObject -{ - Q_OBJECT - Q_ENUMS(DeviceType) - Q_PROPERTY(QString address READ address CONSTANT) - Q_PROPERTY(QString name READ name CONSTANT) - Q_PROPERTY(bool connected READ connected NOTIFY connectedChanged) - Q_PROPERTY(DeviceType type READ type CONSTANT) -public: - explicit BtDeviceItem(const QBluetoothDeviceInfo& id, QObject *parent=0); - //The list of device type we want to show the icon - enum DeviceType { - Phone, - Computer, - Mouse, - Keyboard, - Headphones, - Microphone, - Camera, - Camcorder, - Clock, - HealthDevice, - GenericDevice=1000 - }; - QString name() const; - QString address() const; - DeviceType type() const; - bool connected() const; - void setConnected(bool aConnected); - -signals: - void connectedChanged(); - -protected: - DeviceType getDeviceType(const QBluetoothDeviceInfo::MajorDeviceClass major, - const quint8 minor) const; - DeviceType getComputerDeviceType(const quint8 minor) const; - DeviceType getAudioDeviceType(const quint8 minor) const; - DeviceType getPeripheralDeviceType(const quint8 minor) const; - DeviceType getImagingDeviceType(const quint8 minor) const; - DeviceType getHealthDeviceType(const quint8 minor) const; - DeviceType getPhoneDeviceType(const quint8 minor) const; - -private: - QString m_name; - QString m_address; - bool m_connected; - DeviceType m_type; -}; - -class DiscoveryModel : public QAbstractListModel -{ - Q_OBJECT - Q_ENUMS(DeviceType) -public: - explicit DiscoveryModel(QObject *parent=0); - virtual ~DiscoveryModel(); - // from QAbstractItemModel - int rowCount(const QModelIndex & parent = QModelIndex()) const; - QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const; - QHash roleNames() const; - Q_INVOKABLE QVariant itemFromRow(const int row) const; - void setConnected(const QString& aAddress, bool connected); - void scanDevices(); - - enum Roles { - Name = Qt::UserRole, - Address, - Type, - Connected - }; - -signals: - void scanFinished(); - -private slots: - void deviceDiscovered(const QBluetoothDeviceInfo &device); - void canceled(); - void error(QBluetoothDeviceDiscoveryAgent::Error error); - void finished(); -private: - QList m_items; - QHash m_roleNames; - QBluetoothDeviceDiscoveryAgent *m_discoveryAgent; -}; -#endif // DISCOVERYMODEL_H diff --git a/src/qtdevicesettings/bluetoothsettingsplugin/icons.qrc b/src/qtdevicesettings/bluetoothsettingsplugin/icons.qrc deleted file mode 100644 index a7c8d7e..0000000 --- a/src/qtdevicesettings/bluetoothsettingsplugin/icons.qrc +++ /dev/null @@ -1,16 +0,0 @@ - - - ../icons/Bluetooth_qt_1x.png - ../icons/Camcorder_qt_1x.png - ../icons/Camera_qt_1x.png - ../icons/Clock_qt_1x.png - ../icons/Headphones_qt_1x.png - ../icons/Heartbeat_qt_1x.png - ../icons/Keyboard_qt_1x.png - ../icons/Laptop_qt_1x.png - ../icons/Microphone_qt_1x.png - ../icons/MobilePhone_qt_1x.png - ../icons/Mouse_qt_1x.png - ../icons/Tablet_qt_1x.png - - diff --git a/src/qtdevicesettings/bluetoothsettingsplugin/plugin.cpp b/src/qtdevicesettings/bluetoothsettingsplugin/plugin.cpp deleted file mode 100644 index 24e9705..0000000 --- a/src/qtdevicesettings/bluetoothsettingsplugin/plugin.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include - -#include "bluetoothdevice.h" -#include "discoverymodel.h" - -class BluetoothSettingsQmlPlugin : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") - -public: - void registerTypes(const char *uri) - { - Q_ASSERT(QLatin1String(uri) == QLatin1String("com.theqtcompany.settings.bluetooth")); - qmlRegisterUncreatableType(uri, 1, 0, "BtDeviceItem", "Cannot be instantiated directly."); - const QString prefix = "qrc:"; - qmlRegisterType(QUrl(prefix + "Bluetooth.qml"), uri, 1, 0, "Bluetooth"); - qmlRegisterType(QUrl(prefix + "Discovery.qml"), uri, 1, 0, "Discovery"); - - } - - void initializeEngine(QQmlEngine * engine, const char * uri) - { - Q_ASSERT(QLatin1String(uri) == QLatin1String("com.theqtcompany.settings.bluetooth")); - BluetoothDevice *device = new BluetoothDevice(engine); - engine->rootContext()->setContextProperty("BtDevice", device); - } -}; - -#include "plugin.moc" diff --git a/src/qtdevicesettings/bluetoothsettingsplugin/qml.qrc b/src/qtdevicesettings/bluetoothsettingsplugin/qml.qrc deleted file mode 100644 index 1d36902..0000000 --- a/src/qtdevicesettings/bluetoothsettingsplugin/qml.qrc +++ /dev/null @@ -1,6 +0,0 @@ - - - Bluetooth.qml - Discovery.qml - - diff --git a/src/qtdevicesettings/bluetoothsettingsplugin/qmldir b/src/qtdevicesettings/bluetoothsettingsplugin/qmldir deleted file mode 100644 index febebc2..0000000 --- a/src/qtdevicesettings/bluetoothsettingsplugin/qmldir +++ /dev/null @@ -1,3 +0,0 @@ -module com.theqtcompany.settings.bluetooth -Bluetooth 1.0 Bluetooth.qml -plugin btsettingsplugin diff --git a/src/qtdevicesettings/generalsettingsplugin/Display.qml b/src/qtdevicesettings/generalsettingsplugin/Display.qml deleted file mode 100644 index 33bdba8..0000000 --- a/src/qtdevicesettings/generalsettingsplugin/Display.qml +++ /dev/null @@ -1,137 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.5 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles.Flat 1.0 as Flat -import com.theqtcompany.settings.common 1.0 -import B2Qt.Utils 1.0 -import QtQuick.Enterprise.VirtualKeyboard.Settings 1.2 - -Item { - id: root - - property string title: qsTr("Display Settings") - - GroupBox { - title: qsTr("Display Settings") - anchors.fill: parent - anchors.margins: Math.round(40 * Flat.FlatStyle.scaleFactor) - Layout.fillWidth: true - - Column { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - RowLayout { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - - TextLabel { - text: qsTr("Brighness: ") - } - - Slider { - id: brightnessSlider - value: B2QtDevice.displayBrightness - Layout.fillWidth: true - } - } - - Binding { - target: B2QtDevice - property: "displayBrightness" - value: brightnessSlider.value - } - - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - - TextLabel { - text: qsTr("Physical screen size: ") - } - - ColumnLayout { - ExclusiveGroup { id: exgroup } - RadioButton { - text: qsTr("Default") - exclusiveGroup: exgroup - checked: !B2QtDevice.physicalScreenSizeOverride - } - RadioButton { - id: custom - text: qsTr("Custom") - exclusiveGroup: exgroup - checked: B2QtDevice.physicalScreenSizeOverride - - onCheckedChanged: B2QtDevice.physicalScreenSizeOverride = checked - } - - GroupBox { - title: qsTr("Size (in inches): " + sizeSlider.value) - Layout.fillWidth: true - flat: true - visible: custom.checked - - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: sizeSlider.minimumValue - } - - Slider { - id: sizeSlider - value: B2QtDevice.physicalScreenSizeInch - Layout.fillWidth: true - stepSize: 1 - minimumValue: 4 - maximumValue: 60 - } - - TextLabel { - text: sizeSlider.maximumValue - } - - Binding { - target: B2QtDevice - property: "physicalScreenSizeInch" - value: sizeSlider.value - } - } - } - } - } - } - } -} - diff --git a/src/qtdevicesettings/generalsettingsplugin/Sound.qml b/src/qtdevicesettings/generalsettingsplugin/Sound.qml deleted file mode 100644 index 7d854f4..0000000 --- a/src/qtdevicesettings/generalsettingsplugin/Sound.qml +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.5 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles.Flat 1.0 as Flat -import com.theqtcompany.settings.common 1.0 -import B2Qt.Utils 1.0 - -Item { - id: root - property string title: qsTr("Audio Settings") - - GroupBox { - title: qsTr("Audio Settings") - anchors.fill: parent - anchors.margins: Math.round(40 * Flat.FlatStyle.scaleFactor) - Layout.fillWidth: true - - Column { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - - RowLayout { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - - TextLabel { - text: qsTr("Master volume: ") - } - - Image { - source: "../icons/Volume_down_qt_1x.png" - } - - Slider { - id: volumeSlider - value: B2QtDevice.masterVolume - Layout.fillWidth: true - } - - Image { - source: "../icons/Volume_up_qt_1x.png" - } - } - - Binding { - target: B2QtDevice - property: "masterVolume" - value: volumeSlider.value - } - } - } -} - diff --git a/src/qtdevicesettings/generalsettingsplugin/generalsettingsplugin.pro b/src/qtdevicesettings/generalsettingsplugin/generalsettingsplugin.pro deleted file mode 100644 index 884437f..0000000 --- a/src/qtdevicesettings/generalsettingsplugin/generalsettingsplugin.pro +++ /dev/null @@ -1,24 +0,0 @@ -TEMPLATE = lib -CONFIG += plugin -QT += qml - -uri = com.theqtcompany.settings.general - -DESTDIR = imports/GeneralSettings -TARGET = qmlgeneralsettingsplugin - -SOURCES += plugin.cpp - -pluginfiles.files += \ - qmldir \ - -installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /) - -target.path = $$installPath -pluginfiles.path += $$installPath -INSTALLS += target pluginfiles - -RESOURCES += \ - icons.qrc \ - qml.qrc - diff --git a/src/qtdevicesettings/generalsettingsplugin/icons.qrc b/src/qtdevicesettings/generalsettingsplugin/icons.qrc deleted file mode 100644 index 540913c..0000000 --- a/src/qtdevicesettings/generalsettingsplugin/icons.qrc +++ /dev/null @@ -1,7 +0,0 @@ - - - ../icons/Volume_down_qt_1x.png - ../icons/Volume_mute_qt_1x.png - ../icons/Volume_up_qt_1x.png - - diff --git a/src/qtdevicesettings/generalsettingsplugin/plugin.cpp b/src/qtdevicesettings/generalsettingsplugin/plugin.cpp deleted file mode 100644 index c7c6f40..0000000 --- a/src/qtdevicesettings/generalsettingsplugin/plugin.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include - -class GeneralSettingsQmlPlugin : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") - -public: - void registerTypes(const char *uri) - { - qmlRegisterType(QUrl("qrc:/Display.qml"), uri, 1, 0, "Display"); - } -}; - -#include "plugin.moc" diff --git a/src/qtdevicesettings/generalsettingsplugin/qml.qrc b/src/qtdevicesettings/generalsettingsplugin/qml.qrc deleted file mode 100644 index 03083d5..0000000 --- a/src/qtdevicesettings/generalsettingsplugin/qml.qrc +++ /dev/null @@ -1,6 +0,0 @@ - - - Display.qml - Sound.qml - - diff --git a/src/qtdevicesettings/generalsettingsplugin/qmldir b/src/qtdevicesettings/generalsettingsplugin/qmldir deleted file mode 100644 index 410dcca..0000000 --- a/src/qtdevicesettings/generalsettingsplugin/qmldir +++ /dev/null @@ -1,2 +0,0 @@ -module com.theqtcompany.settings.general -plugin qmlgeneralsettingsplugin diff --git a/src/qtdevicesettings/icons/Alert_yellow_1x.png b/src/qtdevicesettings/icons/Alert_yellow_1x.png deleted file mode 100644 index 2306ff6..0000000 Binary files a/src/qtdevicesettings/icons/Alert_yellow_1x.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/Audio_qt_6x.png b/src/qtdevicesettings/icons/Audio_qt_6x.png deleted file mode 100644 index 8251129..0000000 Binary files a/src/qtdevicesettings/icons/Audio_qt_6x.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/Bluetooth_qt_1x.png b/src/qtdevicesettings/icons/Bluetooth_qt_1x.png deleted file mode 100644 index af6968d..0000000 Binary files a/src/qtdevicesettings/icons/Bluetooth_qt_1x.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/Bluetooth_qt_6x.png b/src/qtdevicesettings/icons/Bluetooth_qt_6x.png deleted file mode 100644 index 55e4fb1..0000000 Binary files a/src/qtdevicesettings/icons/Bluetooth_qt_6x.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/Camcorder_qt_1x.png b/src/qtdevicesettings/icons/Camcorder_qt_1x.png deleted file mode 100644 index 7ffb2c8..0000000 Binary files a/src/qtdevicesettings/icons/Camcorder_qt_1x.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/Camera_qt_1x.png b/src/qtdevicesettings/icons/Camera_qt_1x.png deleted file mode 100644 index b84e53a..0000000 Binary files a/src/qtdevicesettings/icons/Camera_qt_1x.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/Chevron-left_black_1x.png b/src/qtdevicesettings/icons/Chevron-left_black_1x.png deleted file mode 100644 index 225176b..0000000 Binary files a/src/qtdevicesettings/icons/Chevron-left_black_1x.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/Clock_qt_1x.png b/src/qtdevicesettings/icons/Clock_qt_1x.png deleted file mode 100644 index ee58f95..0000000 Binary files a/src/qtdevicesettings/icons/Clock_qt_1x.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/Clock_qt_6x.png b/src/qtdevicesettings/icons/Clock_qt_6x.png deleted file mode 100644 index aba8b60..0000000 Binary files a/src/qtdevicesettings/icons/Clock_qt_6x.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/Display_qt_6x.png b/src/qtdevicesettings/icons/Display_qt_6x.png deleted file mode 100644 index e45c45c..0000000 Binary files a/src/qtdevicesettings/icons/Display_qt_6x.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/Flag_qt_6x.png b/src/qtdevicesettings/icons/Flag_qt_6x.png deleted file mode 100644 index f549ebd..0000000 Binary files a/src/qtdevicesettings/icons/Flag_qt_6x.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/Headphones_qt_1x.png b/src/qtdevicesettings/icons/Headphones_qt_1x.png deleted file mode 100644 index 82b04e7..0000000 Binary files a/src/qtdevicesettings/icons/Headphones_qt_1x.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/Heartbeat_qt_1x.png b/src/qtdevicesettings/icons/Heartbeat_qt_1x.png deleted file mode 100644 index 16a94bc..0000000 Binary files a/src/qtdevicesettings/icons/Heartbeat_qt_1x.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/Keyboard_qt_1x.png b/src/qtdevicesettings/icons/Keyboard_qt_1x.png deleted file mode 100644 index cc6417d..0000000 Binary files a/src/qtdevicesettings/icons/Keyboard_qt_1x.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/Laptop_qt_1x.png b/src/qtdevicesettings/icons/Laptop_qt_1x.png deleted file mode 100644 index 2924015..0000000 Binary files a/src/qtdevicesettings/icons/Laptop_qt_1x.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/Microphone_qt_1x.png b/src/qtdevicesettings/icons/Microphone_qt_1x.png deleted file mode 100644 index f76a963..0000000 Binary files a/src/qtdevicesettings/icons/Microphone_qt_1x.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/MobilePhone_qt_1x.png b/src/qtdevicesettings/icons/MobilePhone_qt_1x.png deleted file mode 100644 index 363d667..0000000 Binary files a/src/qtdevicesettings/icons/MobilePhone_qt_1x.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/Mouse_qt_1x.png b/src/qtdevicesettings/icons/Mouse_qt_1x.png deleted file mode 100644 index 24d057d..0000000 Binary files a/src/qtdevicesettings/icons/Mouse_qt_1x.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/Power_black_1x.png b/src/qtdevicesettings/icons/Power_black_1x.png deleted file mode 100644 index cca0fe8..0000000 Binary files a/src/qtdevicesettings/icons/Power_black_1x.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/Tablet_qt_1x.png b/src/qtdevicesettings/icons/Tablet_qt_1x.png deleted file mode 100644 index e218184..0000000 Binary files a/src/qtdevicesettings/icons/Tablet_qt_1x.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/Volume_down_qt_1x.png b/src/qtdevicesettings/icons/Volume_down_qt_1x.png deleted file mode 100644 index 2068819..0000000 Binary files a/src/qtdevicesettings/icons/Volume_down_qt_1x.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/Volume_mute_qt_1x.png b/src/qtdevicesettings/icons/Volume_mute_qt_1x.png deleted file mode 100644 index 1a41927..0000000 Binary files a/src/qtdevicesettings/icons/Volume_mute_qt_1x.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/Volume_up_qt_1x.png b/src/qtdevicesettings/icons/Volume_up_qt_1x.png deleted file mode 100644 index 45a8b61..0000000 Binary files a/src/qtdevicesettings/icons/Volume_up_qt_1x.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/WifiAnim_black_2x.png b/src/qtdevicesettings/icons/WifiAnim_black_2x.png deleted file mode 100644 index 76c850d..0000000 Binary files a/src/qtdevicesettings/icons/WifiAnim_black_2x.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/Wifi_lightgray_2x.png b/src/qtdevicesettings/icons/Wifi_lightgray_2x.png deleted file mode 100644 index 3e6183a..0000000 Binary files a/src/qtdevicesettings/icons/Wifi_lightgray_2x.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/World_qt_6x.png b/src/qtdevicesettings/icons/World_qt_6x.png deleted file mode 100644 index 9024031..0000000 Binary files a/src/qtdevicesettings/icons/World_qt_6x.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/generate_icons.sh b/src/qtdevicesettings/icons/generate_icons.sh deleted file mode 100755 index 55867b8..0000000 --- a/src/qtdevicesettings/icons/generate_icons.sh +++ /dev/null @@ -1,27 +0,0 @@ -############################################################################ -## -## Copyright (C) 2015 Digia Plc -## All rights reserved. -## For any questions to Digia, please use the contact form at -## http://www.qt.io -## -## This file is part of Qt Enterprise Embedded. -## -## Licensees holding valid Qt Enterprise licenses may use this file in -## accordance with the Qt Enterprise License Agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and Digia. -## -## If you have questions regarding the use of this file, please use -## the contact form at http://www.qt.io -## -############################################################################# -#!/bin/bash -# -# This script resizes and sets correct brand colors for the icons in ref folder -# - -./scripts/cimages.sh ./ref/*.png -./scripts/cimage.sh ./ref/extra/Alert.png red -./scripts/cimage.sh ./ref/extra/Alert.png yellow -./scripts/rimages.sh *.png diff --git a/src/qtdevicesettings/icons/ref/Audio.png b/src/qtdevicesettings/icons/ref/Audio.png deleted file mode 100644 index 8434f0a..0000000 Binary files a/src/qtdevicesettings/icons/ref/Audio.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/Back.png b/src/qtdevicesettings/icons/ref/Back.png deleted file mode 100644 index 9029fd0..0000000 Binary files a/src/qtdevicesettings/icons/ref/Back.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/Bluetooth.png b/src/qtdevicesettings/icons/ref/Bluetooth.png deleted file mode 100644 index e7c80a9..0000000 Binary files a/src/qtdevicesettings/icons/ref/Bluetooth.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/Camcorder.png b/src/qtdevicesettings/icons/ref/Camcorder.png deleted file mode 100644 index 8c317a2..0000000 Binary files a/src/qtdevicesettings/icons/ref/Camcorder.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/Camera.png b/src/qtdevicesettings/icons/ref/Camera.png deleted file mode 100644 index c71ab25..0000000 Binary files a/src/qtdevicesettings/icons/ref/Camera.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/Chevron-left.png b/src/qtdevicesettings/icons/ref/Chevron-left.png deleted file mode 100644 index 95006f4..0000000 Binary files a/src/qtdevicesettings/icons/ref/Chevron-left.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/Chevron-right.png b/src/qtdevicesettings/icons/ref/Chevron-right.png deleted file mode 100644 index 2860e9a..0000000 Binary files a/src/qtdevicesettings/icons/ref/Chevron-right.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/Circle-x.png b/src/qtdevicesettings/icons/ref/Circle-x.png deleted file mode 100644 index 2bbfa97..0000000 Binary files a/src/qtdevicesettings/icons/ref/Circle-x.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/Clock.png b/src/qtdevicesettings/icons/ref/Clock.png deleted file mode 100644 index 1dae63e..0000000 Binary files a/src/qtdevicesettings/icons/ref/Clock.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/Cogs.png b/src/qtdevicesettings/icons/ref/Cogs.png deleted file mode 100644 index feaae50..0000000 Binary files a/src/qtdevicesettings/icons/ref/Cogs.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/Connections.png b/src/qtdevicesettings/icons/ref/Connections.png deleted file mode 100644 index b042d3c..0000000 Binary files a/src/qtdevicesettings/icons/ref/Connections.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/Display.png b/src/qtdevicesettings/icons/ref/Display.png deleted file mode 100644 index cf1251a..0000000 Binary files a/src/qtdevicesettings/icons/ref/Display.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/Flag.png b/src/qtdevicesettings/icons/ref/Flag.png deleted file mode 100644 index 485ed48..0000000 Binary files a/src/qtdevicesettings/icons/ref/Flag.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/Headphones.png b/src/qtdevicesettings/icons/ref/Headphones.png deleted file mode 100644 index 9e5c483..0000000 Binary files a/src/qtdevicesettings/icons/ref/Headphones.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/Heartbeat.png b/src/qtdevicesettings/icons/ref/Heartbeat.png deleted file mode 100644 index 168135e..0000000 Binary files a/src/qtdevicesettings/icons/ref/Heartbeat.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/Keyboard.png b/src/qtdevicesettings/icons/ref/Keyboard.png deleted file mode 100644 index c814e8e..0000000 Binary files a/src/qtdevicesettings/icons/ref/Keyboard.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/Laptop.png b/src/qtdevicesettings/icons/ref/Laptop.png deleted file mode 100644 index 465bb54..0000000 Binary files a/src/qtdevicesettings/icons/ref/Laptop.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/Lock.png b/src/qtdevicesettings/icons/ref/Lock.png deleted file mode 100644 index 6afb6ac..0000000 Binary files a/src/qtdevicesettings/icons/ref/Lock.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/Microphone.png b/src/qtdevicesettings/icons/ref/Microphone.png deleted file mode 100644 index 63cb500..0000000 Binary files a/src/qtdevicesettings/icons/ref/Microphone.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/MobilePhone.png b/src/qtdevicesettings/icons/ref/MobilePhone.png deleted file mode 100644 index b186c09..0000000 Binary files a/src/qtdevicesettings/icons/ref/MobilePhone.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/Mouse.png b/src/qtdevicesettings/icons/ref/Mouse.png deleted file mode 100644 index 146305b..0000000 Binary files a/src/qtdevicesettings/icons/ref/Mouse.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/Plus.png b/src/qtdevicesettings/icons/ref/Plus.png deleted file mode 100644 index 391fe94..0000000 Binary files a/src/qtdevicesettings/icons/ref/Plus.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/Power.png b/src/qtdevicesettings/icons/ref/Power.png deleted file mode 100644 index b54a084..0000000 Binary files a/src/qtdevicesettings/icons/ref/Power.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/Settings.png b/src/qtdevicesettings/icons/ref/Settings.png deleted file mode 100644 index d8b255c..0000000 Binary files a/src/qtdevicesettings/icons/ref/Settings.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/Tablet.png b/src/qtdevicesettings/icons/ref/Tablet.png deleted file mode 100644 index 71b0065..0000000 Binary files a/src/qtdevicesettings/icons/ref/Tablet.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/Volume_down.png b/src/qtdevicesettings/icons/ref/Volume_down.png deleted file mode 100644 index 0773b1d..0000000 Binary files a/src/qtdevicesettings/icons/ref/Volume_down.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/Volume_mute.png b/src/qtdevicesettings/icons/ref/Volume_mute.png deleted file mode 100644 index 36ab384..0000000 Binary files a/src/qtdevicesettings/icons/ref/Volume_mute.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/Volume_up.png b/src/qtdevicesettings/icons/ref/Volume_up.png deleted file mode 100644 index 61eebbd..0000000 Binary files a/src/qtdevicesettings/icons/ref/Volume_up.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/Wifi.png b/src/qtdevicesettings/icons/ref/Wifi.png deleted file mode 100644 index 5d1e0d9..0000000 Binary files a/src/qtdevicesettings/icons/ref/Wifi.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/Wifi1.png b/src/qtdevicesettings/icons/ref/Wifi1.png deleted file mode 100644 index f1b1489..0000000 Binary files a/src/qtdevicesettings/icons/ref/Wifi1.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/Wifi2.png b/src/qtdevicesettings/icons/ref/Wifi2.png deleted file mode 100644 index a22b472..0000000 Binary files a/src/qtdevicesettings/icons/ref/Wifi2.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/Wifi3.png b/src/qtdevicesettings/icons/ref/Wifi3.png deleted file mode 100644 index 76d412b..0000000 Binary files a/src/qtdevicesettings/icons/ref/Wifi3.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/Wifi4.png b/src/qtdevicesettings/icons/ref/Wifi4.png deleted file mode 100644 index 5d1e0d9..0000000 Binary files a/src/qtdevicesettings/icons/ref/Wifi4.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/WifiAnim.png b/src/qtdevicesettings/icons/ref/WifiAnim.png deleted file mode 100644 index 0694f63..0000000 Binary files a/src/qtdevicesettings/icons/ref/WifiAnim.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/World.png b/src/qtdevicesettings/icons/ref/World.png deleted file mode 100644 index cf6eaf0..0000000 Binary files a/src/qtdevicesettings/icons/ref/World.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/Wrench.png b/src/qtdevicesettings/icons/ref/Wrench.png deleted file mode 100644 index 5b6e1c6..0000000 Binary files a/src/qtdevicesettings/icons/ref/Wrench.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/ref/extra/Alert.png b/src/qtdevicesettings/icons/ref/extra/Alert.png deleted file mode 100644 index 80914fc..0000000 Binary files a/src/qtdevicesettings/icons/ref/extra/Alert.png and /dev/null differ diff --git a/src/qtdevicesettings/icons/scripts/cimage.sh b/src/qtdevicesettings/icons/scripts/cimage.sh deleted file mode 100755 index ae73622..0000000 --- a/src/qtdevicesettings/icons/scripts/cimage.sh +++ /dev/null @@ -1,45 +0,0 @@ -############################################################################ -## -## Copyright (C) 2015 Digia Plc -## All rights reserved. -## For any questions to Digia, please use the contact form at -## http://www.qt.io -## -## This file is part of Qt Enterprise Embedded. -## -## Licensees holding valid Qt Enterprise licenses may use this file in -## accordance with the Qt Enterprise License Agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and Digia. -## -## If you have questions regarding the use of this file, please use -## the contact form at http://www.qt.io -## -############################################################################# -#!/bin/bash - -fullfile=$1 -filename=$(basename "$fullfile") -extension="${filename##*.}" -filename="${filename%.*}" - -color=$2 -if [ "$color" = "qt" ]; then - fill='rgb(128,195,66)' -elif [ "$color" = "black" ]; then - fill='rgb(32,40,42)' -elif [ "$color" = "white" ]; then - fill='rgb(255,255,255)' -elif [ "$color" = "lightgray" ]; then - fill='rgb(214,214,214)' -elif [ "$color" = "red" ]; then - fill='rgb(228,30,37)' -elif [ "$color" = "yellow" ]; then - fill='rgb(250,206,32)' -else - fill="black" -fi - -separator="_" - -convert $fullfile -fuzz 100% -fill $fill -opaque black $filename$separator$color.$extension diff --git a/src/qtdevicesettings/icons/scripts/cimages.sh b/src/qtdevicesettings/icons/scripts/cimages.sh deleted file mode 100755 index 94ac1cd..0000000 --- a/src/qtdevicesettings/icons/scripts/cimages.sh +++ /dev/null @@ -1,28 +0,0 @@ -############################################################################ -## -## Copyright (C) 2015 Digia Plc -## All rights reserved. -## For any questions to Digia, please use the contact form at -## http://www.qt.io -## -## This file is part of Qt Enterprise Embedded. -## -## Licensees holding valid Qt Enterprise licenses may use this file in -## accordance with the Qt Enterprise License Agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and Digia. -## -## If you have questions regarding the use of this file, please use -## the contact form at http://www.qt.io -## -############################################################################# -#!/bin/bash - -for dir in "$@" -do - echo "$dir" - scripts/cimage.sh $dir qt - scripts/cimage.sh $dir black - scripts/cimage.sh $dir white - scripts/cimage.sh $dir lightgray -done diff --git a/src/qtdevicesettings/icons/scripts/rimage.sh b/src/qtdevicesettings/icons/scripts/rimage.sh deleted file mode 100755 index d98088f..0000000 --- a/src/qtdevicesettings/icons/scripts/rimage.sh +++ /dev/null @@ -1,37 +0,0 @@ -############################################################################ -## -## Copyright (C) 2015 Digia Plc -## All rights reserved. -## For any questions to Digia, please use the contact form at -## http://www.qt.io -## -## This file is part of Qt Enterprise Embedded. -## -## Licensees holding valid Qt Enterprise licenses may use this file in -## accordance with the Qt Enterprise License Agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and Digia. -## -## If you have questions regarding the use of this file, please use -## the contact form at http://www.qt.io -## -############################################################################# -#!/bin/bash -fullfile=$1 -filename=$(basename "$fullfile") -extension="${filename##*.}" -filename="${filename%.*}" - -postix="_1x" -convert $fullfile -resize x16 $filename$postix.$extension -postix="_2x" -convert $fullfile -resize x32 $filename$postix.$extension -postix="_3x" -convert $fullfile -resize x48 $filename$postix.$extension -postix="_4x" -convert $fullfile -resize x64 $filename$postix.$extension -postix="_5x" -convert $fullfile -resize x80 $filename$postix.$extension -postix="_6x" -convert $fullfile -resize x96 $filename$postix.$extension - diff --git a/src/qtdevicesettings/icons/scripts/rimages.sh b/src/qtdevicesettings/icons/scripts/rimages.sh deleted file mode 100755 index 7b76da8..0000000 --- a/src/qtdevicesettings/icons/scripts/rimages.sh +++ /dev/null @@ -1,25 +0,0 @@ -############################################################################ -## -## Copyright (C) 2015 Digia Plc -## All rights reserved. -## For any questions to Digia, please use the contact form at -## http://www.qt.io -## -## This file is part of Qt Enterprise Embedded. -## -## Licensees holding valid Qt Enterprise licenses may use this file in -## accordance with the Qt Enterprise License Agreement provided with the -## Software or, alternatively, in accordance with the terms contained in -## a written agreement between you and Digia. -## -## If you have questions regarding the use of this file, please use -## the contact form at http://www.qt.io -## -############################################################################# -#!/bin/bash - -for dir in "$@" -do - echo "$dir" - scripts/rimage.sh $dir -done diff --git a/src/qtdevicesettings/localesettingsplugin/Language.qml b/src/qtdevicesettings/localesettingsplugin/Language.qml deleted file mode 100644 index e630b00..0000000 --- a/src/qtdevicesettings/localesettingsplugin/Language.qml +++ /dev/null @@ -1,111 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.5 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles.Flat 1.0 as Flat -import com.theqtcompany.settings.common 1.0 -import com.theqtcompany.settings.locale 1.0 - -Item { - id: root - property string title: qsTr("Language and Region") - - Column { - id: content - anchors.fill: parent - anchors.margins: Math.round(40 * Flat.FlatStyle.scaleFactor) - - GroupBox { - id: groupBox - width: parent.width - title: qsTr("Regional Format") - Layout.fillWidth: true - property var currentRegion: Qt.locale(LocaleManager.locale) - - ColumnLayout { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - width: parent.width - Layout.fillWidth: true - - Component { - id: regionSelect - RegionSelect { } - } - - GroupBox { - width: parent.width - title: { - if (groupBox.currentRegion.name === "C" || groupBox.currentRegion.name === "POSIX") { - return qsTr("Default"); - } - else if (groupBox.currentRegion.name !== "") { - return qsTr("%L1/%L2").arg(groupBox.currentRegion.nativeLanguageName).arg(groupBox.currentRegion.nativeCountryName) - } - else { - return qsTr("Region not set"); - } - } - - flat: true - - ColumnLayout { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - Layout.fillWidth: true - width: parent.width - - TextLabel { - text: Date().toLocaleString(groupBox.currentRegion) - } - - TextLabel { - text: Number(2343.34).toLocaleString(groupBox.currentRegion) - } - - TextLabel { - text: Number(41334.34).toLocaleCurrencyString(groupBox.currentRegion) - } - } - } - - Button { - text: qsTr("Change region") - onClicked: stackView.push(regionSelect) - } - } - } - } -} diff --git a/src/qtdevicesettings/localesettingsplugin/RegionSelect.qml b/src/qtdevicesettings/localesettingsplugin/RegionSelect.qml deleted file mode 100644 index 9247630..0000000 --- a/src/qtdevicesettings/localesettingsplugin/RegionSelect.qml +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.5 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles.Flat 1.0 as Flat -import com.theqtcompany.settings.common 1.0 -import com.theqtcompany.settings.locale 1.0 - -Item { - id: root - property string title: qsTr("Select language") - - Component.onCompleted: country.text = LocaleFilter.filter - - Column { - id: content - anchors.fill: parent - anchors.margins: Math.round(20 * Flat.FlatStyle.scaleFactor) - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - - TextLabel { - text: qsTr("Search region: ") - } - - TextField { - id: country - text: "" - onTextChanged: LocaleFilter.filter = country.text - } - } - - TableView { - width: parent.width - height: Math.round(parent.height - 40 * Flat.FlatStyle.scaleFactor) - Layout.fillWidth: true - model: LocaleFilter - headerVisible: true - - TableViewColumn { - role: "language" - title: qsTr("Language") - width: Math.round(parent.width * 0.66) - } - - TableViewColumn { - role: "country" - title: qsTr("Region") - width: Math.round(parent.width * 0.33) - } - - onClicked: { - var val = model.itemFromRow(row); - if (val !== "") { - LocaleManager.locale = val; - stackView.pop(); - } - } - } - } -} diff --git a/src/qtdevicesettings/localesettingsplugin/icons.qrc b/src/qtdevicesettings/localesettingsplugin/icons.qrc deleted file mode 100644 index af8a564..0000000 --- a/src/qtdevicesettings/localesettingsplugin/icons.qrc +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/qtdevicesettings/localesettingsplugin/locale.xml b/src/qtdevicesettings/localesettingsplugin/locale.xml deleted file mode 100644 index b722456..0000000 --- a/src/qtdevicesettings/localesettingsplugin/locale.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/src/qtdevicesettings/localesettingsplugin/localefiltermodel.cpp b/src/qtdevicesettings/localesettingsplugin/localefiltermodel.cpp deleted file mode 100644 index 027caba..0000000 --- a/src/qtdevicesettings/localesettingsplugin/localefiltermodel.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "localemodel.h" -#include "localefiltermodel.h" - -LocaleFilterModel::LocaleFilterModel(QObject* parent) - :QSortFilterProxyModel(parent) -{ - connect(this, &LocaleFilterModel::filterChanged, this, &LocaleFilterModel::invalidate); -} - -LocaleFilterModel::~LocaleFilterModel() -{ - -} - -QString LocaleFilterModel::filter() const -{ - return m_filter; -} - -void LocaleFilterModel::setFilter(const QString& aFilter) -{ - m_filter = aFilter; - emit filterChanged(); -} - -bool LocaleFilterModel::filterAcceptsRow( int source_row, const QModelIndex& source_parent ) const -{ - bool ret = false; - if (this->sourceModel()) - { - QModelIndex index = this->sourceModel()->index( source_row, 0, source_parent ); - if (index.isValid()) - { - QVariant nameRole = index.data(LocaleModel::Country); - if (nameRole.isValid()) - { - QString name = nameRole.toString(); - if (name.contains(m_filter, Qt::CaseInsensitive)) { - ret = true; - } - } - } - } - return ret; -} - -QVariant LocaleFilterModel::itemFromRow(const int row) const -{ - QModelIndex idx = index(row, 0); - QModelIndex mapped = mapToSource(idx); - if (mapped.isValid()) - { - QVariant nameRole = mapped.data(LocaleModel::Code); - if (nameRole.isValid()) - { - return nameRole; - } - } - return QVariant::fromValue(QString("")); -} - diff --git a/src/qtdevicesettings/localesettingsplugin/localefiltermodel.h b/src/qtdevicesettings/localesettingsplugin/localefiltermodel.h deleted file mode 100644 index f4dce1b..0000000 --- a/src/qtdevicesettings/localesettingsplugin/localefiltermodel.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef LOCALEFILTERMODEL_H -#define LOCALEFILTERMODEL_H - -#include - -class LocaleFilterModel : public QSortFilterProxyModel -{ - Q_OBJECT - Q_PROPERTY(QString filter READ filter WRITE setFilter NOTIFY filterChanged) -public: - explicit LocaleFilterModel(QObject* parent); - virtual ~LocaleFilterModel(); - bool filterAcceptsRow( int source_row, const QModelIndex& source_parent ) const override; - QString filter() const; - void setFilter(const QString& aFilter); - Q_INVOKABLE QVariant itemFromRow(const int row) const; -signals: - void filterChanged(); -private: - QString m_filter; - -}; - -#endif // LOCALEFILTERMODEL_H diff --git a/src/qtdevicesettings/localesettingsplugin/localemodel.cpp b/src/qtdevicesettings/localesettingsplugin/localemodel.cpp deleted file mode 100644 index be24e02..0000000 --- a/src/qtdevicesettings/localesettingsplugin/localemodel.cpp +++ /dev/null @@ -1,167 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include "localemodel.h" - - -LocaleItem::LocaleItem(const QLocale& locale, QObject *parent) - :QObject(parent) -{ - m_code = locale.name(); - m_country = locale.nativeCountryName(); - if (m_country.isEmpty()) { - m_country = locale.countryToString(locale.country()); - } - - m_language = locale.nativeLanguageName(); - if (m_language.isEmpty()) { - m_language = locale.languageToString(locale.language()); - } -} - -QString LocaleItem::language() const -{ - return m_language; -} - -QString LocaleItem::country() const -{ - return m_country; -} - -QString LocaleItem::code() const -{ - return m_code; -} - -LocaleModel::LocaleModel(QObject *parent) - : QAbstractListModel(parent) -{ - m_roleNames.insert(Qt::UserRole, "modelData"); - m_roleNames.insert(Country, "country"); - m_roleNames.insert(Language, "language"); - m_roleNames.insert(Code, "code"); - - QFutureWatcher *watcher = new QFutureWatcher(this); - QFuture future = QtConcurrent::run(LocaleModel::generateModel, this); - watcher->setFuture(future); - connect(watcher, SIGNAL(finished()), this, SLOT(modelReady())); -} - -void LocaleModel::modelReady() -{ - beginResetModel(); - sort(0); - endResetModel(); -} - -void LocaleModel::generateModel(LocaleModel* model) -{ - QList allLocales = QLocale::matchingLocales(QLocale::AnyLanguage, QLocale::AnyScript, QLocale::AnyCountry); - - for (const QLocale &locale : allLocales) { - if (locale.name() != "C") { - LocaleItem *l = new LocaleItem(locale); - l->moveToThread(model->thread()); - QMetaObject::invokeMethod(model, "addNewItem", Q_ARG( QObject*, qobject_cast(l))); - } - } - -} - -void LocaleModel::addNewItem(QObject *item) -{ - beginInsertRows(QModelIndex(), m_items.count(), m_items.count()); - LocaleItem* newItem = qobject_cast(item); - if (newItem) - m_items.append(newItem); - endInsertRows(); -} - -LocaleModel::~LocaleModel() -{ - qDeleteAll(m_items); -} - -QHash LocaleModel::roleNames() const -{ - return m_roleNames; -} - -int LocaleModel::rowCount(const QModelIndex & parent) const -{ - Q_UNUSED(parent); - return m_items.count(); -} - -QVariant LocaleModel::data(const QModelIndex & index, int role) const -{ - if (!index.isValid()) return QVariant(); - - LocaleItem *item = m_items[index.row()]; - - switch (role) { - case Country: - return item->country(); - break; - case Language: - return item->language(); - break; - case Code: - return item->code(); - break; - default: - return ""; - } -} - -bool LocaleModel::variantLessThan(const LocaleItem* v1, const LocaleItem* v2) -{ - return v1->language() < v2->language(); -} - -void LocaleModel::sort(int column, Qt::SortOrder order) -{ - Q_UNUSED(column); - Q_UNUSED(order); - qSort(m_items.begin(), m_items.end(), LocaleModel::variantLessThan); -} diff --git a/src/qtdevicesettings/localesettingsplugin/localemodel.h b/src/qtdevicesettings/localesettingsplugin/localemodel.h deleted file mode 100644 index b83286e..0000000 --- a/src/qtdevicesettings/localesettingsplugin/localemodel.h +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef LOCALEMODEL_H -#define LOCALEMODEL_H - -#include -#include -#include -#include - -class LocaleItem : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString code READ code CONSTANT) - Q_PROPERTY(QString country READ country CONSTANT) - Q_PROPERTY(QString language READ language CONSTANT) -public: - explicit LocaleItem(const QLocale &locale, QObject *parent=0); - QString country() const; - QString language() const; - QString code() const; - -private: - QString m_country; - QString m_language; - QString m_code; -}; - -class LocaleModel : public QAbstractListModel -{ - Q_OBJECT - -public: - explicit LocaleModel(QObject *parent=0); - virtual ~LocaleModel(); - // from QAbstractItemModel - int rowCount(const QModelIndex & parent = QModelIndex()) const; - QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const; - QHash roleNames() const; - Q_INVOKABLE QVariant itemFromRow(const int row) const; - void sort(int column, Qt::SortOrder order=Qt::AscendingOrder); - static bool variantLessThan(const LocaleItem* v1, const LocaleItem* v2); - - enum Roles { - Language = Qt::DisplayPropertyRole, - Country = Qt::UserRole, - Code - }; - - static void generateModel(LocaleModel* model); - -signals: - void addItem(LocaleItem* item); - -private slots: - void addNewItem(QObject* item); - void modelReady(); - -private: - QList m_items; - QHash m_roleNames; -}; -#endif // LOCALEMODEL_H diff --git a/src/qtdevicesettings/localesettingsplugin/localesettingsplugin.pro b/src/qtdevicesettings/localesettingsplugin/localesettingsplugin.pro deleted file mode 100644 index 8ff9157..0000000 --- a/src/qtdevicesettings/localesettingsplugin/localesettingsplugin.pro +++ /dev/null @@ -1,36 +0,0 @@ -TEMPLATE = lib -CONFIG += plugin -QT += qml dbus - -uri = com.theqtcompany.settings.locale - -DBUS_INTERFACES = locale.xml - -DESTDIR = imports/Locale -TARGET = localesettingsplugin - -HEADERS = \ - systemlocale.h \ - systemlocale_p.h \ - localemodel.h \ - localefiltermodel.h -SOURCES += plugin.cpp \ - systemlocale.cpp \ - localemodel.cpp \ - localefiltermodel.cpp - -pluginfiles.files += \ - qmldir \ - Language.qml \ - RegionSelect.qml - -installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /) - -target.path = $$installPath -pluginfiles.path += $$installPath -INSTALLS += target pluginfiles - - -RESOURCES += \ - icons.qrc - diff --git a/src/qtdevicesettings/localesettingsplugin/plugin.cpp b/src/qtdevicesettings/localesettingsplugin/plugin.cpp deleted file mode 100644 index a050615..0000000 --- a/src/qtdevicesettings/localesettingsplugin/plugin.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include - -#include "systemlocale.h" -#include "localemodel.h" -#include "localefiltermodel.h" - -template -QObject *instance(QQmlEngine *engine, QJSEngine *) { - T *t = new T(engine); - t->setObjectName(T::staticMetaObject.className()); - return t; -} - -class LanguageSettingsQmlPlugin : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") - -public: - void registerTypes(const char *uri) - { - qmlRegisterSingletonType(uri, 1, 0, "LocaleManager", &instance); - } - - void initializeEngine(QQmlEngine * engine, const char * uri) - { - Q_ASSERT(QLatin1String(uri) == QLatin1String("com.theqtcompany.settings.locale")); - LocaleModel*localeModel = new LocaleModel(engine); - LocaleFilterModel* filter = new LocaleFilterModel(engine); - filter->setSourceModel(localeModel); - engine->rootContext()->setContextProperty("LocaleFilter", filter); - } -}; - -#include "plugin.moc" diff --git a/src/qtdevicesettings/localesettingsplugin/qml.qrc b/src/qtdevicesettings/localesettingsplugin/qml.qrc deleted file mode 100644 index 27fef3d..0000000 --- a/src/qtdevicesettings/localesettingsplugin/qml.qrc +++ /dev/null @@ -1,6 +0,0 @@ - - - Language.qml - RegionSelect.qml - - diff --git a/src/qtdevicesettings/localesettingsplugin/qmldir b/src/qtdevicesettings/localesettingsplugin/qmldir deleted file mode 100644 index e915482..0000000 --- a/src/qtdevicesettings/localesettingsplugin/qmldir +++ /dev/null @@ -1,3 +0,0 @@ -module com.theqtcompany.settings.locale -Language 1.0 Language.qml -plugin localesettingsplugin diff --git a/src/qtdevicesettings/localesettingsplugin/systemlocale.cpp b/src/qtdevicesettings/localesettingsplugin/systemlocale.cpp deleted file mode 100644 index 21a1105..0000000 --- a/src/qtdevicesettings/localesettingsplugin/systemlocale.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include "systemlocale.h" -#include "systemlocale_p.h" - -SystemLocale::SystemLocale(QObject *parent) - :QObject(parent) - ,d_ptr(new SystemLocalePrivate(this)) -{ -} - -QString SystemLocale::locale() const -{ - Q_D(const SystemLocale); - return d->locale(); -} - -void SystemLocale::setLocale(const QString& aLocale) -{ - Q_D(SystemLocale); - d->setLocale(aLocale); - emit localeChanged(); -} diff --git a/src/qtdevicesettings/localesettingsplugin/systemlocale.h b/src/qtdevicesettings/localesettingsplugin/systemlocale.h deleted file mode 100644 index c02fdd3..0000000 --- a/src/qtdevicesettings/localesettingsplugin/systemlocale.h +++ /dev/null @@ -1,62 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef LOCALE_H -#define LOCALE_H - -#include - -class SystemLocalePrivate; - -class SystemLocale : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString locale READ locale WRITE setLocale NOTIFY localeChanged) -public: - explicit SystemLocale(QObject *parent = 0); - QString locale() const; - void setLocale(const QString& aLocale); -signals: - void localeChanged(); -public slots: - -protected: - SystemLocalePrivate *d_ptr; - - Q_DISABLE_COPY(SystemLocale) - Q_DECLARE_PRIVATE(SystemLocale) -}; - -#endif // LOCALE_H diff --git a/src/qtdevicesettings/localesettingsplugin/systemlocale_p.h b/src/qtdevicesettings/localesettingsplugin/systemlocale_p.h deleted file mode 100644 index 417b958..0000000 --- a/src/qtdevicesettings/localesettingsplugin/systemlocale_p.h +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef LOCALE_P_H -#define LOCALE_P_H - -#include "systemlocale.h" -#include "locale_interface.h" - -class SystemLocalePrivate -{ - Q_DECLARE_PUBLIC(SystemLocale) -public: - SystemLocalePrivate(SystemLocale *qq) - :q_ptr(qq) - { - m_localeInterface = new OrgFreedesktopLocale1Interface(QStringLiteral("org.freedesktop.locale1"), - QStringLiteral("/org/freedesktop/locale1"), - QDBusConnection::systemBus(), qq); - - QStringList locale = m_localeInterface->locale(); - foreach (QString l, locale) { - QStringList nameValue = l.split('='); - if (nameValue.length() == 2) - m_localeCache[nameValue.at(0)] = nameValue.at(1); - } - } - - QString locale() const { - return m_localeCache["LANG"]; - } - - void setLocale(const QString& aLocale) { - m_localeCache["LANG"] = aLocale; - updateLocale(); - } - - void updateLocale() { - QStringList newLocale; - QMap::iterator i; - for (i = m_localeCache.begin(); i != m_localeCache.end(); ++i) { - QString val = i.key() + "=" + i.value(); - newLocale.append(val); - } - m_localeInterface->SetLocale(newLocale, true); - } - - -private: - QMap m_localeCache; - OrgFreedesktopLocale1Interface *m_localeInterface; - SystemLocale *q_ptr; -}; - -#endif // LOCALE_P_H diff --git a/src/qtdevicesettings/networksettingsplugin/icons.qrc b/src/qtdevicesettings/networksettingsplugin/icons.qrc deleted file mode 100644 index 4b07cca..0000000 --- a/src/qtdevicesettings/networksettingsplugin/icons.qrc +++ /dev/null @@ -1,6 +0,0 @@ - - - ../icons/Wifi_lightgray_2x.png - ../icons/WifiAnim_black_2x.png - - diff --git a/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/EditWiredSettings.qml b/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/EditWiredSettings.qml deleted file mode 100644 index c678c67..0000000 --- a/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/EditWiredSettings.qml +++ /dev/null @@ -1,641 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.5 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles.Flat 1.0 as Flat -import com.theqtcompany.settings.common 1.0 -import com.theqtcompany.settings.network 1.0 - -Item { - id: root - property string title: qsTr("Ethernet Settings") - property var service: undefined - - property bool ipv4Changed: false - property bool ipv6Changed: false - property bool nameserversChanged: false - property bool domainsChanged: false - property bool proxyChanged: false - - Component.onDestruction: { - //Clear all unsaved changes from models - service.proxy.excludes.resetChanges(); - service.nameservers.resetChanges(); - service.domains.resetChanges(); - } - - Component.onCompleted: titlebar.title = service.name; - - Flickable { - anchors.fill: parent - anchors.top: saveButton.bottom - anchors.margins: Math.round(40 * Flat.FlatStyle.scaleFactor) - anchors.bottomMargin: Math.round(20 * Flat.FlatStyle.scaleFactor) - contentHeight: content.height - contentWidth: width - interactive: !ipv4Method.popupVisible && !ipv6Method.popupVisible && !proxyMethodSel.popupVisible - Column { - id: content - width: parent.width - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - property int titleWidth: Math.round(width * 0.382) - property int groupWidth: Math.round(width - saveButton.width - 10 * Flat.FlatStyle.scaleFactor) - - //IPv4 Config - GroupBox { - flat: false - width: content.groupWidth - Layout.fillWidth: true - title: qsTr("IPv4") - - ColumnLayout { - anchors.fill: parent - - ListModel { - id: methodsModel - - ListElement { - text: "DHCP" - method: NetworkSettingsIPv4.Dhcp - } - ListElement { - text: "Manual" - method: NetworkSettingsIPv4.Manual - } - ListElement { - text: "Off" - method: NetworkSettingsIPv4.Off - } - } - - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Connection method") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - - CustomCombobox { - id: ipv4Method - model: methodsModel - Component.onCompleted: selectedIndex = service.ipv4.method - - onSelectedIndexChanged : { - ipv4Changed = true; - service.ipv4.method = model.get(selectedIndex).method; - } - delegate: FlatStyledDropdownDelegate { } - } - } - - Column { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - visible: service.ipv4.method === NetworkSettingsIPv4.Dhcp - - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Address") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - TextLabel { - text: service.ipv4.address - } - } - - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Mask") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - TextLabel { - text: service.ipv4.mask - } - } - - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Router") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - TextLabel { - text: service.ipv4.gateway - } - } - } - - Column { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - visible: service.ipv4.method === NetworkSettingsIPv4.Manual - - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Address") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - IpAddressTextField { - id: ipv4Address - text: service.ipv4.address - onTextChanged: ipv4Changed = true; - - onAccepted: if (text.length > 0) service.ipv4.address = text - } - } - - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Mask") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - IpAddressTextField { - id: ipv4Mask - text: service.ipv4.mask - onTextChanged: ipv4Changed = true; - onAccepted: if (text.length > 0) service.ipv4.mask = text - } - } - - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Router") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - IpAddressTextField { - id: ipv4Gateway - text: service.ipv4.gateway - - onTextChanged: ipv4Changed = true - - onAccepted: if (text.length > 0) service.ipv4.gateway = text - } - } - } - } - } - - //IPv6 Config - GroupBox { - flat: false - width: content.groupWidth - Layout.fillWidth: true - title: qsTr("IPv6") - - ColumnLayout { - anchors.fill: parent - - ListModel { - id: ipv6methodsmodel - - ListElement { - text: qsTr("Auto") - method: NetworkSettingsIPv6.Auto - } - ListElement { - text: qsTr("Manual") - method: NetworkSettingsIPv6.Manual - } - ListElement { - text: qsTr("Off") - method: NetworkSettingsIPv6.Off - } - } - - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Connection method: ") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - - CustomCombobox { - id: ipv6Method - model: ipv6methodsmodel - Component.onCompleted: selectedIndex = service.ipv6.method - onSelectedIndexChanged : { - ipv6Changed = true; - service.ipv6.method = model.get(selectedIndex).method; - } - delegate: FlatStyledDropdownDelegate { } - } - } - - Column { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - visible: service.ipv6.method === NetworkSettingsIPv6.Auto - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Address") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - TextLabel { - text: service.ipv6.address - } - } - - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Router") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - TextLabel { - text: service.ipv6.gateway - } - } - - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Prefix length") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - TextLabel { - text: service.ipv6.prefixLength - } - } - } - - Column { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - visible: service.ipv6.method === NetworkSettingsIPv6.Manual - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Address") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - TextField { - id: ipv6Address - text: service.ipv6.address - onTextChanged: ipv6Changed = true; - onAccepted: if (text.length > 0) service.ipv6.address = text - } - } - - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Router") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - TextField { - id: ipv6Gateway - text: service.ipv6.gateway - onTextChanged: ipv6Changed = true; - onAccepted: if (text.length > 0) service.ipv4.gateway = text - } - } - - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Prefix length") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - TextField { - id: ipv6PrefixLength - text: service.ipv6.prefixLength - validator: IntValidator { bottom: 0; top: 255 } - - onTextChanged: ipv6Changed = true - - onAccepted: if (text.length > 0) service.ipv6.prefixLength = parseInt(text) - } - } - } - } - } - - GroupBox { - flat: false - width: content.groupWidth - Layout.fillWidth: true - title: qsTr("Name servers") - - ColumnLayout { - anchors.fill: parent - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Address") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - Column { - Repeater { - model: service.nameservers - - Row { - TextField { - text: edit - onTextChanged: { - nameserversChanged = true; - edit = text; - } - } - Button { - implicitWidth: height - text: "-" - onClicked: { - service.nameservers.remove(index); - nameserversChanged = true; - } - } - Button { - implicitWidth: height - visible: index==service.nameservers.count-1 - text: "+" - onClicked: service.nameservers.append("") - } - } - } - } - Row { - TextField { - id: nameServerEntryItem - visible: service.nameservers.count === 0 - text: "" - onAccepted: service.nameservers.append(text) - } - Button { - implicitWidth: height - visible: nameServerEntryItem.visible - text: "+" - onClicked: nameServerEntryItem.accepted() - } - } - } - } - } - - GroupBox { - flat: false - width: content.groupWidth - Layout.fillWidth: true - title: qsTr("Domains") - - ColumnLayout { - anchors.fill: parent - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Address") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - Column { - Repeater { - model: service.domains - Row { - TextField { - text: edit - onTextChanged: { - root.domainsChanged = true; - edit = text; - } - } - Button { - implicitWidth: height - text: "-" - onClicked: { - service.domains.remove(index); - domainsChanged.domainsChanged = true; - } - } - Button { - implicitWidth: height - visible: index==service.domains.count-1 - text: "+" - onClicked: service.domains.append("") - } - } - } - } - Row { - TextField { - id: domainsEntryItem - visible: service.domains.count === 0 - text: "" - onAccepted: service.domains.append(text) - } - Button { - implicitWidth: height - visible: domainsEntryItem.visible - text: "+" - onClicked: domainsEntryItem.accepted() - } - } - } - } - } - - GroupBox { - flat: false - width: content.groupWidth - Layout.fillWidth: true - title: qsTr("Proxy Settings") - - ColumnLayout { - anchors.fill: parent - - ListModel { - id: proxyMethodModel - - ListElement { - text: qsTr("Direct") - method: NetworkSettingsProxy.Direct - } - ListElement { - text: qsTr("Auto") - method: NetworkSettingsProxy.Auto - } - ListElement { - text: qsTr("Manual") - method: NetworkSettingsProxy.Manual - } - } - - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Configuration") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - - CustomCombobox { - id: proxyMethodSel - model: proxyMethodModel - Component.onCompleted: selectedIndex = service.proxy.method - onSelectedIndexChanged : { - proxyChanged = true; - service.proxy.method = model.get(selectedIndex).method; - } - delegate: FlatStyledDropdownDelegate { } - } - } - - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - visible: service.proxy.method !== NetworkSettingsProxy.Direct - TextLabel { - text: service.proxy.method === NetworkSettingsProxy.Manual ? qsTr("Proxy address") : qsTr("Automatic configuration URL") - - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - TextField { - id: proxyUrl - text: service.proxy.url - onTextChanged: proxyChanged = true; - onAccepted: service.proxy.url = text; - } - } - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - visible: service.proxy.method === NetworkSettingsProxy.Manual - - TextLabel { - text: qsTr("No proxy for") - width: content.titleWidth - horizontalAlignment: Text.AlignRight - } - - Column { - Repeater { - model: service.proxy.excludes - - Row { - TextField { - text: edit - onTextChanged: edit = text - } - Button { - implicitWidth: height - text: "-" - onClicked: { - service.proxy.excludes.remove(index); - proxyChanged = true; - } - } - Button { - implicitWidth: height - visible: index==service.proxy.excludes.count-1 - text: "+" - onClicked: service.proxy.excludes.append("") - } - } - } - } - Row { - TextField { - id: proxyEntryItem - visible: service.proxy.excludes.count === 0 - text: "" - onAccepted: service.proxy.excludes.append(text) - } - Button { - implicitWidth: height - visible: proxyEntryItem.visible - text: "+" - onClicked: proxyEntryItem.accepted() - } - } - } - } - } - } - } - - Button { - id: saveButton - anchors.right: parent.right - anchors.top: parent.top - anchors.margins: Math.round(10 * Flat.FlatStyle.scaleFactor) - anchors.rightMargin: Math.round(40 * Flat.FlatStyle.scaleFactor) - text: qsTr("Save") - - onClicked: { - if (ipv4Changed) { - ipv4Address.accepted(); - ipv4Mask.accepted(); - ipv4Gateway.accepted(); - service.setupIpv4Config(); - } - - if (ipv6Changed) { - ipv6Address.accepted(); - ipv6Gateway.accepted(); - ipv6PrefixLength.accepted(); - service.setupIpv6Config(); - } - - if (nameserversChanged) { - service.setupNameserversConfig(); - } - - if (domainsChanged) { - service.setupDomainsConfig(); - } - if (proxyChanged) { - proxyUrl.accepted(); - service.setupNetworkSettingsProxy(); - } - stackView.pop(); - } - } -} diff --git a/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/IpAddressTextField.qml b/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/IpAddressTextField.qml deleted file mode 100644 index 102d458..0000000 --- a/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/IpAddressTextField.qml +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.5 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.4 - -TextField { - Layout.fillWidth: true - validator: RegExpValidator { regExp: /^(\d|[1-9]\d|1\d\d|2([0-4]\d|5[0-5]))\.(\d|[1-9]\d|1\d\d|2([0-4]\d|5[0-5]))\.(\d|[1-9]\d|1\d\d|2([0-4]\d|5[0-5]))\.(\d|[1-9]\d|1\d\d|2([0-4]\d|5[0-5]))$/ } -} diff --git a/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/NetworkDetails.qml b/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/NetworkDetails.qml deleted file mode 100644 index 3e71be0..0000000 --- a/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/NetworkDetails.qml +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.5 - -Loader { - id: root - property var selectedInterface:undefined - anchors.fill: parent -} diff --git a/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/NetworkSettings.qml b/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/NetworkSettings.qml deleted file mode 100644 index dcda5e0..0000000 --- a/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/NetworkSettings.qml +++ /dev/null @@ -1,137 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.5 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles.Flat 1.0 as Flat -import com.theqtcompany.settings.common 1.0 -import com.theqtcompany.settings.network 1.0 - -Item { - property string title: qsTr("Network Settings") - GroupBox { - id: networkSelect - anchors.fill: parent - anchors.rightMargin: parent.width * 0.618 - anchors.leftMargin: Math.round(20 * Flat.FlatStyle.scaleFactor) - anchors.topMargin: Math.round(20 * Flat.FlatStyle.scaleFactor) - title: qsTr("Select Connection") - - function stateToStr(serviceState) { - switch (serviceState) { - case NetworkService.Idle: - return qsTr("Idle"); - case NetworkService.Failure: - return qsTr("Failure"); - case NetworkService.Association: - return qsTr("Association"); - case NetworkService.Configuration: - return qsTr("Configuration"); - case NetworkService.Ready: - return qsTr("Ready"); - case NetworkService.Disconnect: - return qsTr("Disconnect"); - case NetworkService.Online: - return qsTr("Online"); - default: - return qsTr("Undefined"); - } - } - - ColumnLayout { - width: networkSelect.width - ExclusiveGroup { - id: exgroup - } - - Repeater { - model: NetworkSettingsManager.interfaces - - Button { - implicitWidth: networkSelect.width - Math.round(20 * Flat.FlatStyle.scaleFactor) - implicitHeight: Math.round(54 * Flat.FlatStyle.scaleFactor) - checkable: true - exclusiveGroup: exgroup - - Row { - anchors.fill: parent - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - - Image { - id: typeId - height: parent.height - width: height - } - - Column { - height: Math.round(parent.height * 0.7) - spacing: 0 - anchors.verticalCenter: parent.verticalCenter - TextLabel { - text: name - } - - TextLabel { - text: networkSelect.stateToStr(modelData.state) - font.pixelSize: Math.round(12 * Flat.FlatStyle.scaleFactor) - } - - } - } - - onCheckedChanged: { - if (checked) { - networkDetails.selectedInterface = modelData - networkDetails.selectedInterface.scanServices() - if (type === NetworkSettingsType.Wired) { - networkDetails.source = "WiredSettings.qml"; - } - else if (type === NetworkSettingsType.Wifi) { - networkDetails.source = "WifiSettings.qml"; - } - } - } - } - } - } - } - - NetworkDetails { - id: networkDetails - anchors.fill: parent - anchors.leftMargin: networkSelect.width + Math.round(20 * Flat.FlatStyle.scaleFactor) - } -} diff --git a/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/WifiSelectorDelegate.qml b/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/WifiSelectorDelegate.qml deleted file mode 100644 index bc39ebd..0000000 --- a/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/WifiSelectorDelegate.qml +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.5 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.4 -import com.theqtcompany.settings.common 1.0 -import com.theqtcompany.settings.network 1.0 -import QtQuick.Controls.Styles.Flat 1.0 as Flat - -Item { - id: root - property bool checkable: true - property bool checked: false - property bool pressed: false - property bool connect: modelData["connected"] - signal clicked() - - MouseArea { - id: delegateButton - anchors.fill: parent - hoverEnabled: true - onPressed: root.pressed = true - onClicked: root.clicked() - onEntered: checked = !checked - - Rectangle { - anchors.fill: parent - color: root.checked ? Flat.FlatStyle.disabledColor : "transparent" - opacity: root.checked ? 0.15 : 1.0 - } - Rectangle { - color: Flat.FlatStyle.darkFrameColor - width: parent.width - height: Flat.FlatStyle.onePixel - anchors.bottom: parent.bottom - } - TextLabel { - id: text - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.margins: Math.round(10 * Flat.FlatStyle.scaleFactor) - horizontalAlignment: Text.AlignLeft - text: modelData["name"] - } - WifiSignalMonitor { - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - anchors.margins: Math.round(10 * Flat.FlatStyle.scaleFactor) - height: Math.round(parent.height * .8) - width: height - signalStrength: modelData["signalStrength"] - connected: modelData["connected"] - } - } -} diff --git a/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/WifiSettings.qml b/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/WifiSettings.qml deleted file mode 100644 index e7c2bda..0000000 --- a/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/WifiSettings.qml +++ /dev/null @@ -1,190 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.5 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles.Flat 1.0 as Flat -import com.theqtcompany.settings.common 1.0 -import com.theqtcompany.settings.network 1.0 - -Item { - id: root - anchors.fill: parent - anchors.margins: Math.round(20 * Flat.FlatStyle.scaleFactor) - - Component.onCompleted: { - NetworkSettingsManager.services.type = NetworkSettingsType.Wifi; - } - GroupBox { - id: content - title: qsTr("Wireless Settings") - anchors.fill: parent - Layout.fillWidth: true - flat: true - - ColumnLayout { - spacing: Math.round(20 * Flat.FlatStyle.scaleFactor) - width: parent.width - Row { - id: enableSwitch - width: parent.width - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - width: root.width*0.382 - horizontalAlignment: Text.AlignRight - text: selectedInterface.powered ? qsTr("Disable Wifi") : qsTr("Enable Wifi") - } - Switch { - checked: selectedInterface.powered - onCheckedChanged: selectedInterface.powered = checked - } - } - - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - width: parent.width - - TextLabel { - id: labelText - text: qsTr("Selected network ") - width: content.width*0.382 - horizontalAlignment: Text.AlignRight - } - - CustomCombobox { - id: networkSelection - model: NetworkSettingsManager.services - visible: selectedInterface.powered - width: Math.round(200 * Flat.FlatStyle.scaleFactor) - textRole: "name" - onSelectedIndexChanged : if (selectedIndex >= 0) model.itemFromRow(selectedIndex).connectService(); - - delegate: WifiSelectorDelegate { - id: delegate - onConnectChanged: if (connect) networkSelection.setSelectIndexToVal(modelData.name, "name"); - } - } - } - - GroupBox { - id: connectView - title: qsTr("Enter a password") - flat: false - visible: false - ColumnLayout { - Row { - id: errorView - property alias text: text.text - visible: text.text !== "" - - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - Image { - source: "../icons/Alert_yellow_1x.png" - } - Text { - id: text - color: "#face20" - text: "" - } - } - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - visible: false - TextLabel { - text: qsTr("User name") - width: root.width*0.382 - horizontalAlignment: Text.AlignRight - } - TextField { - text: "" - inputMethodHints: Qt.ImhNoPredictiveText - } - } - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: qsTr("Password") - horizontalAlignment: Text.AlignRight - } - TextField { - id: password - text: "" - echoMode: TextInput.Password - inputMethodHints: Qt.ImhNoPredictiveText - } - } - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - Button { - text: qsTr("Connect") - onClicked: { - connectView.visible = false - NetworkSettingsUserAgent.setUserCredentials("", password.text) - } - } - Button { - text: qsTr("Cancel") - onClicked:connectView.visible = false - } - } - } - } - - Button { - id: disconnect - text: qsTr("Disconnect") - visible: selectedInterface.state === NetworkSettingsState.Online || - selectedInterface.state === NetworkSettingsState.Ready - onClicked: { - console.log("disconnect"); - NetworkSettingsManager.services.itemFromRow(networkSelection.selectedIndex).disconnectService(); - networkSelection.selectedIndex = -1; - } - } - } - - Connections { - target: NetworkSettingsUserAgent - onShowUserCredentialsInput : { - connectView.visible = true - } - onError: { - errorView.visible = true - connectView.visible = true - } - } - } -} diff --git a/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/WifiSignalMonitor.qml b/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/WifiSignalMonitor.qml deleted file mode 100644 index 35d9e53..0000000 --- a/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/WifiSignalMonitor.qml +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.5 - -Item { - id: root - - property bool scanning: false - property int signalStrength: 100 - property bool connected: false - - onSignalStrengthChanged: { - sprite.visible = true; - - if (signalStrength < 10) { - sprite.visible = false; - } - else if (signalStrength < 30) { - sprite.currentFrame = 0; - } - else if (signalStrength < 60) { - sprite.currentFrame = 1; - } - else if (signalStrength < 80) { - sprite.currentFrame = 2; - } - else if (signalStrength <= 100) { - sprite.currentFrame = 3; - } - } - - Image { - anchors.fill: parent - source: "Wifi_lightgray_2x.png" - } - - AnimatedSprite { - id: sprite - anchors.fill: parent - source: connected ? "WifiAnim_qt_2x.png" : "WifiAnim_black_2x.png" - frameDuration: 500 - frameCount: 4 - currentFrame: 3 - frameSync: false - frameWidth: 32 - frameHeight: 32 - loops: 40 - running: scanning - } -} diff --git a/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/WiredSettings.qml b/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/WiredSettings.qml deleted file mode 100644 index 4c07baa..0000000 --- a/src/qtdevicesettings/networksettingsplugin/imports/NetworkSettings/WiredSettings.qml +++ /dev/null @@ -1,207 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.5 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles.Flat 1.0 as Flat -import com.theqtcompany.settings.common 1.0 -import com.theqtcompany.settings.network 1.0 - -Item { - id: root - anchors.fill: parent - anchors.margins: Math.round(20 * Flat.FlatStyle.scaleFactor) - property bool editMode: false - property var service: null - property string title: qsTr("Network"); - - Component.onCompleted: { - NetworkSettingsManager.services.type = NetworkSettingsType.Wired; - root.service = NetworkSettingsManager.services.itemFromRow(0); - } - - ListModel { - id: methodsModel - - ListElement { - text: "DHCP" - method: NetworkSettingsIPv4.Dhcp - } - ListElement { - text: "Manual" - method: NetworkSettingsIPv4.Manual - } - ListElement { - text: "Off" - method: NetworkSettingsIPv4.Off - } - } - - GroupBox { - title: qsTr("Ethernet Connection") - anchors.fill: parent - Layout.fillWidth: true - flat: true - Column { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - Row { - TextLabel { - text: qsTr("Connection method: ") - } - - CustomCombobox { - id: ipv4Method - model: methodsModel - Component.onCompleted: selectedIndex = service.ipv4.method - onSelectedIndexChanged : { - if (model.get(selectedIndex).method !== NetworkSettingsIPv4.Dhcp) { - service.ipv4.method = model.get(selectedIndex).method; - editMode = true; - } - else { - //Enable DHCP - if (service.ipv4.method !== model.get(selectedIndex).method) { - service.ipv4.method = model.get(selectedIndex).method; - service.setupIpv4Config(); - } - - editMode = false; - } - } - delegate: FlatStyledDropdownDelegate { } - } - } - - Row { - visible: service.ipv4.method !== NetworkSettingsIPv4.Off - TextLabel { - text: qsTr("IP Address: ") - } - TextLabel { - text: service.ipv4.address - visible: !editMode - } - IpAddressTextField { - id: ipv4Address - placeholderText: service.ipv4.address - visible: editMode - onAccepted: if (text.length > 0) service.ipv4.address = text - } - } - - Row { - visible: service.ipv4.method !== NetworkSettingsIPv4.Off - TextLabel { - text: qsTr("Mask: ") - } - TextLabel { - text: service.ipv4.mask - visible: !editMode - } - IpAddressTextField { - id: ipv4Mask - placeholderText: service.ipv4.mask - visible: editMode - onAccepted: if (text.length > 0) service.ipv4.mask = text - } - } - - Row { - visible: service.ipv4.method !== NetworkSettingsIPv4.Off - TextLabel { - text: qsTr("Router: ") - } - TextLabel { - text: service.ipv4.gateway - visible: !editMode - } - IpAddressTextField { - id: ipv4Gateway - placeholderText: service.ipv4.gateway - visible: editMode - onAccepted: if (text.length > 0) service.ipv4.gateway = text - } - } - - Row { - visible: service.ipv4.method !== NetworkSettingsIPv4.Off - TextLabel { - text: qsTr("DNS server: ") - } - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - Repeater { - model: service.nameservers - - TextLabel { - text: display - } - } - } - } - - Row { - Button { - text: qsTr("Save") - visible: editMode - - onClicked: { - ipv4Address.accepted(); - ipv4Mask.accepted(); - ipv4Gateway.accepted(); - service.setupIpv4Config(); - editMode = false; - } - } - Button { - text: qsTr("Cancel") - visible: editMode - onClicked: { - editMode = false; - methodSelection.currentIndex = service.ipv4.method - } - } - } - Button { - text: qsTr("Edit") - visible: !editMode - - onClicked: stackView.push({item: Qt.resolvedUrl("EditWiredSettings.qml"), properties: {service: root.service}}); - } - } - } -} - diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman.pri b/src/qtdevicesettings/networksettingsplugin/networksettings/connman.pri deleted file mode 100644 index 4e9e6b3..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/connman.pri +++ /dev/null @@ -1,22 +0,0 @@ -QT += core network dbus - -INCLUDEPATH += $${PWD}/connman - -DBUS_INTERFACES = \ - networksettings/connman/connman_manager.xml \ - networksettings/connman/connman_service.xml \ - networksettings/connman/connman_technology.xml - -SOURCES += \ - $$PWD/connman/qnetworksettingsinterface_p.cpp \ - $$PWD/connman/qnetworksettingsservice_p.cpp \ - $$PWD/connman/qnetworksettingsuseragent_p.cpp \ - $$PWD/connman/qnetworksettingsmanager_p.cpp \ - $$PWD/connman/connmancommon.cpp - -HEADERS += \ - $$PWD/connman/qnetworksettingsinterface_p.h \ - $$PWD/connman/qnetworksettingsservice_p.h \ - $$PWD/connman/qnetworksettingsuseragent_p.h \ - $$PWD/connman/qnetworksettingsmanager_p.h \ - $$PWD/connman/connmancommon.h diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connman_manager.xml b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connman_manager.xml deleted file mode 100644 index 5c52b27..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connman_manager.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connman_service.xml b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connman_service.xml deleted file mode 100644 index c41aca4..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connman_service.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connman_technology.xml b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connman_technology.xml deleted file mode 100644 index 08d780f..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connman_technology.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connmancommon.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connmancommon.cpp deleted file mode 100644 index 94a1fa1..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connmancommon.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "connmancommon.h" - -//Conversion operations for datatypes -const QDBusArgument &operator>>(const QDBusArgument &argument, ConnmanMap &obj) -{ - argument.beginStructure(); - argument >> obj.objectPath >> obj.propertyMap; - argument.endStructure(); - return argument; -} - -QDBusArgument &operator<<(QDBusArgument &argument, const ConnmanMap &obj) -{ - argument.beginStructure(); - argument << obj.objectPath << obj.propertyMap; - argument.endStructure(); - return argument; -} - -const QString &operator>>(const QString &argument, QNetworkSettingsType &obj) -{ - if (argument == AttributeEthernet) { - obj.setType(QNetworkSettingsType::Wired); - } - else if (argument == AttributeWifi) { - obj.setType(QNetworkSettingsType::Wifi); - } - else { - obj.setType(QNetworkSettingsType::Unknown); - } - - return argument; -} - -const QString &operator>>(const QString &argument, QNetworkSettingsState &obj) -{ - if (argument == AttributeIdle) { - obj.setState(QNetworkSettingsState::Idle); - } - else if (argument == AttributeFailure) { - obj.setState(QNetworkSettingsState::Failure); - } - else if (argument == AttributeAssociation) { - obj.setState(QNetworkSettingsState::Association); - } - else if (argument == AttributeConfiguration) { - obj.setState(QNetworkSettingsState::Configuration); - } - else if (argument == AttributeReady) { - obj.setState(QNetworkSettingsState::Ready); - } - else if (argument == AttributeDisconnect) { - obj.setState(QNetworkSettingsState::Disconnect); - } - else if (argument == AttributeOneline) { - obj.setState(QNetworkSettingsState::Online); - } - else { - obj.setState(QNetworkSettingsState::Undefined); - } - return argument; -} diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connmancommon.h b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connmancommon.h deleted file mode 100644 index dd3e7af..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/connmancommon.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef CONNMANCOMMON_H -#define CONNMANCOMMON_H - -#include -#include -#include - -#define AgentPath "/ConnmanAgent" -#define PropertyState "State" -#define PropertyName "Name" -#define PropertyType "Type" -#define PropertyConnected "Connected" -#define PropertyPowered "Powered" - -#define AttributeWifi "wifi" -#define AttributeEthernet "ethernet" -#define AttributeIdle "idle" -#define AttributeFailure "failure" -#define AttributeAssociation "association" -#define AttributeConfiguration "configuration" -#define AttributeReady "ready" -#define AttributeDisconnect "disconnect" -#define AttributeOneline "online" - -struct ConnmanMap { - QDBusObjectPath objectPath; - QVariantMap propertyMap; -}; - -QDBusArgument &operator<<(QDBusArgument &argument, const ConnmanMap &obj); -const QDBusArgument &operator>>(const QDBusArgument &argument, ConnmanMap &obj); - -const QString &operator>>(const QString &argument, QNetworkSettingsType &obj); -const QString &operator>>(const QString &argument, QNetworkSettingsState &obj); - -typedef QList ConnmanMapList; - -Q_DECLARE_METATYPE( ConnmanMap ) -Q_DECLARE_METATYPE( ConnmanMapList ) - - -#endif // CONNMANCOMMON_H diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsinterface_p.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsinterface_p.cpp deleted file mode 100644 index 9a034d0..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsinterface_p.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "qnetworksettingsinterface_p.h" -#include "qnetworksettingsinterface.h" -#include "connman_technology_interface.h" -#include "connmancommon.h" - -QNetworkSettingsInterfacePrivate::QNetworkSettingsInterfacePrivate(QNetworkSettingsInterface* parent) - : QObject(parent) - ,q_ptr(parent) -{ - -} - -void QNetworkSettingsInterfacePrivate::initialize(const QString& path, const QVariantMap& properties) -{ - m_technology = new NetConnmanTechnologyInterface("net.connman", path, - QDBusConnection::systemBus(), this); - connect(m_technology, SIGNAL(PropertyChanged(QString,QDBusVariant)), - this, SLOT(updateProperty(QString,QDBusVariant))); - - updateProperty(PropertyName, properties[PropertyName]); - updateProperty(PropertyType, properties[PropertyType]); - updateProperty(PropertyConnected, properties[PropertyConnected]); - updateProperty(PropertyPowered, properties[PropertyPowered]); -} - -void QNetworkSettingsInterfacePrivate::updateProperty(const QString &name, const QDBusVariant &value) -{ - updateProperty(name, value.variant()); -} - -void QNetworkSettingsInterfacePrivate::updateProperty(const QString &name, const QVariant &value) -{ - Q_Q(QNetworkSettingsInterface); - if (name == PropertyName) { - m_name = qdbus_cast(value); - } - else if (name == PropertyType) { - qdbus_cast(value) >> m_type; - emit q->typeChanged(); - } - else if (name == PropertyConnected) { - bool connected = qdbus_cast(value); - if (connected) - m_state.setState(QNetworkSettingsState::Online); - else - m_state.setState(QNetworkSettingsState::Disconnect); - emit q->stateChanged(); - } - else if (name == PropertyPowered) { - m_powered = qdbus_cast(value); - emit q->poweredChanged(); - } -} - -void QNetworkSettingsInterfacePrivate::setState(QNetworkSettingsState::States aState) -{ - Q_Q(QNetworkSettingsInterface); - m_state.setState(aState); - emit q->stateChanged(); -} - -void QNetworkSettingsInterfacePrivate::setPowered(const bool aPowered) -{ - m_technology->SetProperty(PropertyPowered, QDBusVariant(QVariant(aPowered))); -} - -void QNetworkSettingsInterfacePrivate::scan() -{ - m_technology->Scan(); -} diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsinterface_p.h b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsinterface_p.h deleted file mode 100644 index 6e1d5ca..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsinterface_p.h +++ /dev/null @@ -1,92 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QNETWORKSETTINGSINTERFACEPRIVATE_H -#define QNETWORKSETTINGSINTERFACEPRIVATE_H - -#include -#include -#include "qnetworksettings.h" -#include "qnetworksettingsinterface.h" - -class NetConnmanTechnologyInterface; - -class QNetworkSettingsInterfacePrivate : public QObject -{ - Q_OBJECT - Q_DECLARE_PUBLIC(QNetworkSettingsInterface) -public: - explicit QNetworkSettingsInterfacePrivate(QNetworkSettingsInterface* parent); - void initialize(const QString& path, const QVariantMap& properties); - void setPowered(const bool power); - void setState(QNetworkSettingsState::States aState); - void scan(); - -public slots: - void updateProperty(const QString &name, const QDBusVariant &value); -protected: - void updateProperty(const QString &name, const QVariant &value); - -protected: - NetConnmanTechnologyInterface *m_technology; - QString m_name; - QNetworkSettingsType m_type; - QNetworkSettingsState m_state; - bool m_powered; - QNetworkSettingsInterface *q_ptr; -}; - - -class ConnmanSettingsInterface : public QNetworkSettingsInterface -{ - Q_OBJECT -public: - ConnmanSettingsInterface(const QString& path, const QVariantMap& properties, QObject *parent=0) - :QNetworkSettingsInterface(parent) - { - if (d_ptr) - d_ptr->initialize(path, properties); - } - - void setState(QNetworkSettingsState::States aState) { - Q_D(QNetworkSettingsInterface); - d->setState(aState); - } - - virtual ~ConnmanSettingsInterface() { - - } -}; -#endif // QNETWORKSETTINGSINTERFACEPRIVATE_H diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsmanager_p.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsmanager_p.cpp deleted file mode 100644 index 8df7276..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsmanager_p.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "qnetworksettingsmanager_p.h" -#include "connman_manager_interface.cpp" -#include "moc_connman_manager_interface.cpp" -#include "qnetworksettingsinterface.h" -#include "qnetworksettingsinterface_p.h" - -QNetworkSettingsManagerPrivate::QNetworkSettingsManagerPrivate(QNetworkSettingsManager *parent) - :QObject(parent) - ,q_ptr(parent) -{ - m_serviceFilter.setSourceModel(&m_serviceModel); - m_manager = new NetConnmanManagerInterface("net.connman", "/", - QDBusConnection::systemBus(), this); - - if (m_manager->isValid()) { - //List technologies - QDBusPendingReply reply = m_manager->GetTechnologies(); - QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this); - connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), - this, SLOT(getTechnologiesFinished(QDBusPendingCallWatcher*))); - - reply = m_manager->GetServices(); - watcher = new QDBusPendingCallWatcher(reply, this); - connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), - this, SLOT(getServicesFinished(QDBusPendingCallWatcher*))); - - connect(m_manager, &NetConnmanManagerInterface::ServicesChanged, this, &QNetworkSettingsManagerPrivate::servicesChanged); - - m_manager->RegisterAgent(QDBusObjectPath(AgentPath)); - } - else { - delete m_manager; - m_manager = NULL; - } -} - -void QNetworkSettingsManagerPrivate::requestInput(const QString& service, const QString& type) -{ - Q_UNUSED(type); - foreach (QNetworkSettingsService* servicePtr, m_serviceModel.getModel()) { - if (servicePtr->id() == service) - emit servicePtr->showCrendentialInput(); - } -} - -void QNetworkSettingsManagerPrivate::getServicesFinished(QDBusPendingCallWatcher *watcher) -{ - Q_Q(QNetworkSettingsManager); - QDBusPendingReply reply = *watcher; - watcher->deleteLater(); - if (reply.isError()) - return; - - foreach (const ConnmanMap &object, reply.value()) { - const QString servicePath = object.objectPath.path(); - QNetworkSettingsService *service = new QNetworkSettingsService(servicePath, this); - m_serviceModel.append(service); - - //Update status property - QString n = qdbus_cast(object.propertyMap[PropertyName]); - QString t = qdbus_cast(object.propertyMap[PropertyType]); - QString s = qdbus_cast(object.propertyMap[PropertyState]); - - QNetworkSettingsType type; - t >> type; - QNetworkSettingsState state; - s >> state; - - foreach (QNetworkSettingsInterface* item, m_interfaceModel.getModel()) { - ConnmanSettingsInterface* technology = qobject_cast(item); - if (technology->name() == n && technology->type() == type.type()) { - technology->setState(state.state()); - } - } - } - emit q->servicesChanged(); -} - -void QNetworkSettingsManagerPrivate::getTechnologiesFinished(QDBusPendingCallWatcher *watcher) -{ - Q_Q(QNetworkSettingsManager); - - QDBusPendingReply reply = *watcher; - watcher->deleteLater(); - if (reply.isError()) - return; - - foreach (const ConnmanMap &object, reply.value()) { - ConnmanSettingsInterface *item = new ConnmanSettingsInterface(object.objectPath.path(), object.propertyMap, this); - - if (item->type() == QNetworkSettingsType::Wired) { - m_interfaceModel.insert(0, item); - } - else if (item->type() == QNetworkSettingsType::Wifi) { - m_interfaceModel.append(item); - } - emit q->interfacesChanged(); - } -} - -void QNetworkSettingsManagerPrivate::servicesChanged(ConnmanMapList changed, const QList &removed) -{ - foreach (QDBusObjectPath path, removed) { - QList serviceList = m_serviceModel.getModel(); - QMutableListIterator i(serviceList); - while (i.hasNext()) { - if (i.next()->id() == path.path()) - i.remove(); - } - } - - QStringList newServices; - foreach (ConnmanMap map, changed) { - bool found = false; - foreach (QNetworkSettingsService* service, m_serviceModel.getModel()) { - if (service->id() == map.objectPath.path()) { - found =true; - break; - } - } - if (!found) - newServices.append(map.objectPath.path()); - } - foreach (QString newService, newServices) { - QNetworkSettingsService *service = new QNetworkSettingsService(newService, this); - m_serviceModel.append(service); - } -} - -void QNetworkSettingsManagerPrivate::setUserAgent(QNetworkSettingsUserAgent *agent) -{ - -} diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsmanager_p.h b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsmanager_p.h deleted file mode 100644 index cadf63f..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsmanager_p.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QNETWORKSETTINGSMANAGERPRIVATE_H -#define QNETWORKSETTINGSMANAGERPRIVATE_H - -#include -#include -#include "connmancommon.h" -#include "qnetworksettingsmanager.h" -#include "qnetworksettingsinterfacemodel.h" -#include "qnetworksettingsservicemodel.h" - -class NetConnmanManagerInterface; - -class QNetworkSettingsManagerPrivate : public QObject -{ - Q_OBJECT - Q_DECLARE_PUBLIC(QNetworkSettingsManager) -public: - explicit QNetworkSettingsManagerPrivate(QNetworkSettingsManager *parent); - QNetworkSettingsManager *q_ptr; - void setUserAgent(QNetworkSettingsUserAgent *agent); - -public slots: - void getServicesFinished(QDBusPendingCallWatcher *watcher); - void getTechnologiesFinished(QDBusPendingCallWatcher *watcher); - void requestInput(const QString& service, const QString& type); - void servicesChanged(ConnmanMapList changed, const QList &removed); - -protected: - QNetworkSettingsInterfaceModel m_interfaceModel; - QNetworkSettingsServiceModel m_serviceModel; - QNetworkSettingsServiceFilter m_serviceFilter; -private: - NetConnmanManagerInterface *m_manager; -}; - -#endif // QNETWORKSETTINGSMANAGERPRIVATE_H diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsservice_p.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsservice_p.cpp deleted file mode 100644 index 9e2e83c..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsservice_p.cpp +++ /dev/null @@ -1,402 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "qnetworksettingsservice_p.h" -#include "connman_service_interface.h" -#include "connmancommon.h" - -const QString PropertyIPv4("IPv4"); -const QString PropertyQNetworkSettingsIPv4("IPv4.Configuration"); -const QString PropertyIPv6("IPv6"); -const QString PropertyQNetworkSettingsIPv6("IPv6.Configuration"); -const QString PropertyNameservers("Nameservers"); -const QString PropertyNameserversConfig("Nameservers.Configuration"); -const QString PropertyDomains("Domains"); -const QString PropertyDomainsConfig("Domains.Configuration"); -const QString PropertyProxy("Proxy"); -const QString PropertyQNetworkSettingsProxy("Proxy.Configuration"); -const QString PropertyAddress("Address"); -const QString PropertyNetMask("Netmask"); -const QString PropertyGateway("Gateway"); -const QString PropertyPrefixLength("PrefixLength"); -const QString PropertyMethod("Method"); -const QString PropertyPrivacy("Privacy"); -const QString PropertyUrl("Url"); -const QString PropertyServers("Servers"); -const QString PropertyExcludes("Excludes"); -const QString PropertyStrength("Strength"); -const QString PropertySecurity("Security"); - -const QString AttributeAuto("auto"); -const QString AttributeDhcp("dhcp"); -const QString AttributeManual("manual"); -const QString AttributeOff("off"); -const QString AttributeDisabled("disabled"); -const QString AttributeEnabled("enabled"); -const QString AttributePreferred("preferred"); -const QString AttributeDirect("direct"); -const QString AttributeNone("none"); -const QString AttributeWep("wep"); -const QString AttributePsk("psk"); -const QString AttributeIeee("ieee8021x"); -const QString AttributeWps("wps"); -const QString AttributeInvalidKey("invalid-key"); - -const QVariantMap &operator>>(const QVariantMap &argument, QNetworkSettingsIPv4 &obj) -{ - obj.setAddress(argument[PropertyAddress].toString()); - obj.setMask(argument[PropertyNetMask].toString()); - obj.setGateway(argument[PropertyGateway].toString()); - - QString method = argument[PropertyMethod].toString(); - - if (method == AttributeDhcp) { - obj.setMethod(QNetworkSettingsIPv4::Dhcp); - } - else if (method == AttributeManual) { - obj.setMethod(QNetworkSettingsIPv4::Manual); - } - else if (method == AttributeOff) { - obj.setMethod(QNetworkSettingsIPv4::Off); - } - else { - obj.setMethod(QNetworkSettingsIPv4::Off); - } - return argument; -} - -const QVariantMap &operator<<(QVariantMap &argument, const QNetworkSettingsIPv4 &obj) -{ - argument.insert(PropertyAddress, QVariant::fromValue(obj.address())); - - argument.insert(PropertyNetMask, QVariant::fromValue(obj.mask())); - - argument.insert(PropertyGateway, QVariant::fromValue(obj.gateway())); - - QString method; - switch (obj.method()) { - case QNetworkSettingsIPv4::Dhcp: - method = AttributeDhcp; - break; - case QNetworkSettingsIPv4::Manual: - method = AttributeManual; - break; - case QNetworkSettingsIPv4::Off: - method = AttributeOff; - break; - default: - break; - } - argument.insert(PropertyMethod, QVariant::fromValue(method)); - return argument; -} - -const QVariantMap &operator>>(const QVariantMap &argument, QNetworkSettingsIPv6 &obj) -{ - obj.setAddress(argument[PropertyAddress].toString()); - obj.setGateway(argument[PropertyGateway].toString()); - obj.setPrefixLength(argument[PropertyPrefixLength].toInt()); - QString method = argument[PropertyMethod].toString(); - if (method == AttributeAuto) { - obj.setMethod(QNetworkSettingsIPv6::Auto); - } - else if (method == AttributeManual) { - obj.setMethod(QNetworkSettingsIPv6::Manual); - } - else if (method == AttributeOff) { - obj.setMethod(QNetworkSettingsIPv6::Off); - } - QString privacy = argument[PropertyPrivacy].toString(); - - if (privacy == AttributeDisabled) { - obj.setPrivacy(QNetworkSettingsIPv6::Disabled); - } - else if (privacy == AttributeEnabled) { - obj.setPrivacy(QNetworkSettingsIPv6::Enabled); - } - else if (privacy == AttributePreferred) { - obj.setPrivacy(QNetworkSettingsIPv6::Preferred); - } - return argument; -} - - -const QVariantMap &operator<<(QVariantMap &argument, const QNetworkSettingsIPv6 &obj) -{ - argument.insert(PropertyAddress, QVariant::fromValue(obj.address())); - argument.insert(PropertyGateway, QVariant::fromValue(obj.address())); - argument.insert(PropertyPrefixLength, QVariant::fromValue(obj.prefixLength())); - - QString method; - switch (obj.method()) { - case QNetworkSettingsIPv6::Auto: - method = AttributeAuto; - break; - case QNetworkSettingsIPv6::Manual: - method = AttributeManual; - break; - case QNetworkSettingsIPv6::Off: - method = AttributeOff; - break; - default: - break; - } - argument.insert(PropertyMethod, QVariant::fromValue(method)); - - QString privacy; - switch (obj.privacy()) { - case QNetworkSettingsIPv6::Disabled: - method = AttributeDisabled; - break; - case QNetworkSettingsIPv6::Enabled: - method = AttributeEnabled; - break; - case QNetworkSettingsIPv6::Preferred: - method = AttributePreferred; - break; - default: - break; - } - argument.insert(PropertyPrivacy, QVariant::fromValue(privacy)); - - return argument; -} - - -const QVariantMap &operator>>(const QVariantMap &argument, QNetworkSettingsProxy &obj) -{ - QString method = argument[PropertyMethod].toString(); - if (method == AttributeDirect) { - obj.setMethod(QNetworkSettingsProxy::Direct); - } - else if (method == AttributeAuto) { - obj.setMethod(QNetworkSettingsProxy::Auto); - } - else if (method == AttributeManual) { - obj.setMethod(QNetworkSettingsProxy::Manual); - } - - QString urlStr = argument[PropertyUrl].toString(); - obj.setUrl(QUrl(urlStr)); - - obj.setServers(argument[PropertyServers].toStringList()); - obj.setExcludes(argument[PropertyExcludes].toStringList()); - - return argument; -} - -const QVariantMap &operator<<(QVariantMap &argument, const QNetworkSettingsProxy &obj) -{ - QString method; - switch (obj.method()) { - case QNetworkSettingsProxy::Direct: - method = AttributeDirect; - break; - case QNetworkSettingsProxy::Auto: - method = AttributeAuto; - break; - case QNetworkSettingsProxy::Manual: - method = AttributeManual; - break; - default: - break; - } - argument.insert(PropertyMethod, QVariant::fromValue(method)); - argument.insert(PropertyUrl, QVariant::fromValue(obj.url().toString())); - argument.insert(PropertyServers, QVariant::fromValue(obj.servers())); - argument.insert(PropertyServers, QVariant::fromValue(obj.excludes())); - - return argument; -} - -QNetworkSettingsServicePrivate::QNetworkSettingsServicePrivate(const QString& id, QNetworkSettingsService *parent) : - QObject(parent) - ,q_ptr(parent) - ,m_id(id) -{ - qDBusRegisterMetaType(); - qDBusRegisterMetaType(); - - m_service = new NetConnmanServiceInterface("net.connman", m_id, - QDBusConnection::systemBus(), this); - - connect(m_service, SIGNAL(PropertyChanged(QString,QDBusVariant)), - this, SLOT(updateProperty(QString,QDBusVariant))); - - QDBusPendingReply reply = m_service->GetProperties(); - QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this); - - connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), - this, SLOT(propertiesUpdated(QDBusPendingCallWatcher*))); -} - -void QNetworkSettingsServicePrivate::setupIpv6Config() -{ - QVariantMap param; - param << m_ipv6config; - if (m_service) - m_service->SetProperty(PropertyQNetworkSettingsIPv6, QDBusVariant(QVariant(param))); -} - -void QNetworkSettingsServicePrivate::setupNameserversConfig() -{ - QVariant param = QVariant::fromValue(m_nameserverConfig.stringList()); - if (m_service) - m_service->SetProperty(PropertyNameserversConfig, QDBusVariant(QVariant(param))); -} - -void QNetworkSettingsServicePrivate::setupDomainsConfig() -{ - QVariant param = QVariant::fromValue(m_domainsConfig.stringList()); - if (m_service) - m_service->SetProperty(PropertyDomainsConfig, QDBusVariant(QVariant(param))); -} - -void QNetworkSettingsServicePrivate::setupQNetworkSettingsProxy() -{ - QVariantMap param; - param << m_proxyConfig; - if (m_service) - m_service->SetProperty(PropertyQNetworkSettingsProxy, QDBusVariant(QVariant(param))); -} - -void QNetworkSettingsServicePrivate::setupIpv4Config() -{ - QVariantMap param; - param << m_ipv4config; - if (m_service) - m_service->SetProperty(PropertyQNetworkSettingsIPv4, QDBusVariant(QVariant(param))); -} - -void QNetworkSettingsServicePrivate::connectService() -{ - if (m_service) { - m_service->Connect(); - } -} - -void QNetworkSettingsServicePrivate::disconnectService() -{ - if (m_service) - m_service->Disconnect(); - -} - -void QNetworkSettingsServicePrivate::propertiesUpdated(QDBusPendingCallWatcher *call) -{ - QDBusPendingReply reply = *call; - call->deleteLater(); - - if (!reply.isError()) - setupConfiguration(reply.value()); -} - -void QNetworkSettingsServicePrivate::updateProperty(const QString &name, const QDBusVariant &value) -{ - updateProperty(name, value.variant()); -} - -void QNetworkSettingsServicePrivate::updateProperty(const QString& key, const QVariant& val) -{ - Q_Q(QNetworkSettingsService); - - if (key == PropertyIPv4) { - QVariantMap value = qdbus_cast(val); - value >> m_ipv4config; - emit q->ipv4Changed(); - } - else if (key == PropertyIPv6) { - QVariantMap value = qdbus_cast(val); - value >> m_ipv6config; - emit q->ipv6Changed(); - } - else if (key == PropertyNameservers) { - QStringList value = qdbus_cast(val); - m_nameserverConfig.setStringList(value); - emit q->nameserversChanged(); - } - else if (key == PropertyDomains) { - QStringList value = qdbus_cast(val); - m_domainsConfig.setStringList(value); - emit q->domainsChanged(); - } - else if (key == PropertyProxy) { - QVariantMap value = qdbus_cast(val); - value >> m_proxyConfig; - emit q->proxyChanged(); - } - else if (key == PropertyState) { - QString value = qdbus_cast(val); - value >> m_state; - emit q->stateChanged(); - } - else if (key == PropertyName) { - m_name = qdbus_cast(val); - emit q->nameChanged(); - } - else if (key == PropertyType) { - QString value = qdbus_cast(val); - value >> m_type; - } - else if (key == PropertyStrength) { - m_wifiConfig.setSignalStrength(val.toInt()); - } - else if (key == PropertySecurity) { - QStringList value = qdbus_cast(val); - foreach (const QString str, value) { - if (str == AttributeNone || str == AttributeWps) { - m_wifiConfig.setSecurity(QNetworkSettingsWireless::None); - } - else if (str == AttributeWep) { - m_wifiConfig.setSecurity(QNetworkSettingsWireless::WEP); - } - else if (str == AttributePsk) { - m_wifiConfig.setSecurity(QNetworkSettingsWireless::WPA); - } - else if (str == AttributeIeee) { - m_wifiConfig.setSecurity(QNetworkSettingsWireless::WPA2); - } - } - } -} - -void QNetworkSettingsServicePrivate::setupConfiguration(const QVariantMap &properties) -{ - QVariantMap::const_iterator it = properties.constBegin(), end = properties.constEnd(); - for ( ; it != end; ++it) { - updateProperty(it.key(), it.value()); - } -} - diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsservice_p.h b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsservice_p.h deleted file mode 100644 index 39a04bd..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsservice_p.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QNETWORKSETTINGSSERVICEPRIVATE_H -#define QNETWORKSETTINGSSERVICEPRIVATE_H - -#include -#include "qnetworksettingsservice.h" -#include "qnetworksettings.h" - -class NetConnmanServiceInterface; - -class QNetworkSettingsServicePrivate : public QObject -{ - Q_OBJECT - Q_DECLARE_PUBLIC(QNetworkSettingsService) -public: - QNetworkSettingsServicePrivate(const QString& aPath, QNetworkSettingsService *parent=0); - - QNetworkSettingsService *q_ptr; -private slots: - void propertiesUpdated(QDBusPendingCallWatcher *call); - void updateProperty(const QString &name, const QDBusVariant &value); - -private: - void setupConfiguration(const QVariantMap &properties); - void updateProperty(const QString& key, const QVariant& value); - -protected: - void setAutoConnect(const bool autoconnect); - void setupIpv4Config(); - void setupIpv6Config(); - void setupNameserversConfig(); - void setupDomainsConfig(); - void setupQNetworkSettingsProxy(); - void connectService(); - void disconnectService(); - - QString m_id; - QString m_name; - QNetworkSettingsState m_state; - QNetworkSettingsIPv4 m_ipv4config; - QNetworkSettingsIPv6 m_ipv6config; - QNetworkSettingsAddressModel m_domainsConfig; - QNetworkSettingsAddressModel m_nameserverConfig; - QNetworkSettingsProxy m_proxyConfig; - QNetworkSettingsWireless m_wifiConfig; - QNetworkSettingsType m_type; - NetConnmanServiceInterface *m_service; -}; - -#endif // QNETWORKSETTINGSSERVICEPRIVATE_H diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsuseragent_p.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsuseragent_p.cpp deleted file mode 100644 index 3b10bed..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsuseragent_p.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "qnetworksettingsuseragent_p.h" -#include "connmancommon.h" - -const QString PropertyPassphrase("Passphrase"); - -QNetworkSettingsUserAgentPrivate::QNetworkSettingsUserAgentPrivate(QNetworkSettingsUserAgent *parent) - :QDBusAbstractAdaptor(parent) - ,q_ptr(parent) - ,m_pendingReply(false) -{ - - setAutoRelaySignals(true); - QMetaObject::invokeMethod(this, "registerAgent", Qt::QueuedConnection); -} - -void QNetworkSettingsUserAgentPrivate::cancel() -{ - // handle method call net.connman.Agent.Cancel - m_pendingReply = false; - QMetaObject::invokeMethod(parent(), "Cancel"); -} - -void QNetworkSettingsUserAgentPrivate::release() -{ - // handle method call net.connman.Agent.Release - QMetaObject::invokeMethod(parent(), "Release"); -} - -void QNetworkSettingsUserAgentPrivate::ReportError(const QDBusObjectPath &path, const QString ¶m) -{ - Q_Q(QNetworkSettingsUserAgent); - Q_UNUSED(path); - Q_UNUSED(param); - emit q->error(); -} - -void QNetworkSettingsUserAgentPrivate::registerAgent() -{ - Q_Q(QNetworkSettingsUserAgent); - QDBusConnection::systemBus().registerObject(AgentPath, q_ptr); -} - -QVariantMap QNetworkSettingsUserAgentPrivate::RequestInput(const QDBusObjectPath &path, const QVariantMap ¶ms, const QDBusMessage &msg) -{ - Q_Q(QNetworkSettingsUserAgent); - Q_UNUSED(path); - Q_UNUSED(params); - msg.setDelayedReply(true); - m_reply = msg.createReply(); - m_pendingReply = true; - emit q->showUserCredentialsInput(); - return QVariantMap(); -} - -void QNetworkSettingsUserAgentPrivate::setUserCredentials(const QString& username, - const QString& password) -{ - m_username = username; - m_passphrase = password; - QVariantMap response; - response[PropertyName] = m_username; - response[PropertyPassphrase] = m_passphrase; - m_reply << response; - m_pendingReply = false; - QDBusConnection::systemBus().send(m_reply); -} diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsuseragent_p.h b/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsuseragent_p.h deleted file mode 100644 index 92e1516..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/connman/qnetworksettingsuseragent_p.h +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QNETWORKSETTINGSUSERAGENTPRIVATE_H -#define QNETWORKSETTINGSUSERAGENTPRIVATE_H - -#include -#include -#include "qnetworksettingsuseragent.h" - -QT_BEGIN_NAMESPACE -class QByteArray; -template class QList; -template class QMap; -class QString; -class QStringList; -class QVariant; -QT_END_NAMESPACE - -const QString AgentPath("/ConnmanAgent"); - -class QNetworkSettingsUserAgentPrivate : public QDBusAbstractAdaptor -{ - Q_OBJECT - Q_CLASSINFO("D-Bus Interface", "net.connman.Agent") - Q_DECLARE_PUBLIC(QNetworkSettingsUserAgent) -public: - QNetworkSettingsUserAgentPrivate(QNetworkSettingsUserAgent *parent=0); - void setUserCredentials(const QString& aUsername, const QString& aPassword); - void cancel(); - void release(); -public Q_SLOTS: // Dbus methods - void ReportError(const QDBusObjectPath &path, const QString ¶m); - QVariantMap RequestInput(const QDBusObjectPath &path, const QVariantMap ¶ms, - const QDBusMessage &message); - void registerAgent(); -private: - QNetworkSettingsUserAgent *q_ptr; - QDBusMessage m_reply; - bool m_pendingReply; - QString m_passphrase; - QString m_username; -}; - -#endif // QNETWORKSETTINGSUSERAGENTPRIVATE_H diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettings.h b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettings.h deleted file mode 100644 index fdf677b..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettings.h +++ /dev/null @@ -1,411 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QNETWORKSETTINGS_H -#define QNETWORKSETTINGS_H - -#include -#include -#include -#include "qnetworksettingsaddressmodel.h" - -class QNetworkSettingsState : public QObject -{ - Q_OBJECT - Q_ENUMS(States) - Q_PROPERTY(States state READ state WRITE setState NOTIFY stateChanged) - -public: - enum States {Idle, Failure, Association, Configuration, Ready, Disconnect, Online, Undefined}; - - explicit QNetworkSettingsState(States state, QObject *parent = 0) - : QObject(parent) - { - m_state = state; - } - - explicit QNetworkSettingsState(QObject *parent = 0) - : QObject(parent) - { - m_state = Undefined; - } - - States state() const { - return m_state; - } - - void setState(const States state) { - m_state = state; - emit stateChanged(); - } - -signals: - void stateChanged(); - -private: - States m_state; -}; - -class QNetworkSettingsType : public QObject -{ - Q_OBJECT - Q_ENUMS(Types) - Q_PROPERTY(Types type READ type WRITE setType NOTIFY typeChanged) - -public: - enum Types { - Wired, - Wifi, - Bluetooth, - Unknown - }; - - explicit QNetworkSettingsType(Types type, QObject *parent = 0) - : QObject(parent) - { - m_type = type; - } - - explicit QNetworkSettingsType(QObject *parent = 0) - : QObject(parent) - { - m_type = Unknown; - } - - - Types type() const { - return m_type; - } - - void setType(const Types type) { - m_type = type; - emit typeChanged(); - } - -signals: - void typeChanged(); - -private: - Types m_type; -}; - -class QNetworkSettingsIPv4 : public QObject -{ - Q_OBJECT - Q_ENUMS(MethodType) - Q_PROPERTY(QString address READ address WRITE setAddress NOTIFY addressChanged) - Q_PROPERTY(QString gateway READ gateway WRITE setGateway NOTIFY gatewayChanged) - Q_PROPERTY(MethodType method READ method WRITE setMethod NOTIFY methodChanged) - Q_PROPERTY(QString mask READ mask WRITE setMask NOTIFY maskChanged) - -public: - explicit QNetworkSettingsIPv4(QObject *parent = 0) - : QObject(parent) - { - - } - - enum MethodType {Dhcp, Manual, Off}; - - QString address() const { - return m_address; - } - void setAddress(const QString& adderess) { - m_address = adderess; - emit addressChanged(); - } - - QString gateway() const { - return m_gateway; - } - - void setGateway(const QString& gateway) { - m_gateway = gateway; - emit gatewayChanged(); - } - - MethodType method() const { - return m_method; - } - - void setMethod(const MethodType method) { - m_method = method; - emit methodChanged(); - } - - QString mask() const { - return m_mask; - } - - void setMask(const QString& mask) { - m_mask = mask; - emit maskChanged(); - } - -signals: - void addressChanged(); - void gatewayChanged(); - void methodChanged(); - void maskChanged(); - -private: - QString m_address; - QString m_gateway; - MethodType m_method; - QString m_mask; -}; - - -class QNetworkSettingsIPv6 : public QObject -{ - Q_OBJECT - Q_ENUMS(MethodType PrivacyType) - Q_PROPERTY(QString address READ address WRITE setAddress NOTIFY addressChanged) - Q_PROPERTY(QString gateway READ gateway WRITE setGateway NOTIFY gatewayChanged) - Q_PROPERTY(MethodType method READ method WRITE setMethod NOTIFY methodChanged) - Q_PROPERTY(PrivacyType privacy READ privacy WRITE setPrivacy NOTIFY privacyChanged) - Q_PROPERTY(int prefixLength READ prefixLength WRITE setPrefixLength NOTIFY prefixLengthChanged) - -public: - explicit QNetworkSettingsIPv6(QObject *parent = 0) - : QObject(parent) - { - - } - - enum MethodType {Auto, Manual, Off}; - enum PrivacyType {Disabled, Enabled, Preferred}; - - QString address() const { - return m_address; - } - void setAddress(const QString& adderess) { - m_address = adderess; - emit addressChanged(); - } - - QString gateway() const { - return m_gateway; - } - - void setGateway(const QString& gateway) { - m_gateway = gateway; - emit gatewayChanged(); - } - - MethodType method() const { - return m_method; - } - - void setMethod(const MethodType method) { - m_method = method; - emit methodChanged(); - } - - PrivacyType privacy() const { - return m_privacy; - } - - void setPrivacy(const PrivacyType privacy) { - m_privacy = privacy; - emit privacyChanged(); - } - - int prefixLength() const { - return m_prefixLength; - } - - void setPrefixLength(const int& prefixLength) { - m_prefixLength = prefixLength; - emit prefixLengthChanged(); - } - -signals: - void addressChanged(); - void gatewayChanged(); - void methodChanged(); - void privacyChanged(); - void prefixLengthChanged(); - -private: - QString m_address; - QString m_gateway; - MethodType m_method; - PrivacyType m_privacy; - int m_prefixLength; -}; - -class QNetworkSettingsProxy : public QObject -{ - Q_OBJECT - Q_ENUMS(MethodType) -public: - Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged) - Q_PROPERTY(QAbstractItemModel* servers READ servers NOTIFY serversChanged) - Q_PROPERTY(QAbstractItemModel* excludes READ excludes NOTIFY excludesChanged) - Q_PROPERTY(MethodType method READ method WRITE setMethod NOTIFY methodChanged) - - explicit QNetworkSettingsProxy(QObject *parent=NULL) - : QObject(parent) - { - - } - - enum MethodType {Direct, Auto, Manual}; - - QUrl url() const { - return m_url; - } - - void setUrl(const QUrl& url) { - m_url = url; - emit urlChanged(); - } - - QAbstractItemModel* servers(void) { - return &m_servers; - } - - void setServers(const QStringList& servers) { - m_servers.setStringList(servers); - emit serversChanged(); - } - - QStringList servers() const { - return m_servers.stringList(); - } - - QAbstractItemModel* excludes(void) { - return &m_excludes; - } - - QStringList excludes() const { - return m_excludes.stringList(); - } - - void setExcludes(const QStringList& excludes) { - m_excludes.setStringList(excludes); - emit excludesChanged(); - } - - MethodType method(void) const { - return m_method; - } - - void setMethod(const MethodType& method) { - m_method = method; - emit methodChanged(); - } - -signals: - void urlChanged(); - void serversChanged(); - void excludesChanged(); - void methodChanged(); -private: - QUrl m_url; - QNetworkSettingsAddressModel m_servers; - QNetworkSettingsAddressModel m_excludes; - MethodType m_method; -}; - -class QNetworkSettingsWireless : public QObject -{ - Q_OBJECT - Q_PROPERTY(int signalStrength READ signalStrength WRITE setSignalStrength NOTIFY signalStrengthChanged) - Q_PROPERTY(bool hidden READ hidden NOTIFY hiddenChanged) - Q_PROPERTY(bool isOutOfRange READ outOfRange WRITE setOutOfRange NOTIFY outOfRangeChanged) -public: - explicit QNetworkSettingsWireless(QObject* parent = 0) : - QObject(parent) { - } - - enum SecurityFlags {None=1, WEP=2, WPA=4, WPA2=8}; - - Q_INVOKABLE bool supportsSecurity(SecurityFlags security) { - if (m_securityFlags & security) { - return true; - } - return false; - } - - bool hidden() const { - return m_hidden; - } - - void setHidden(const bool hidden) { - m_hidden = hidden; - emit hiddenChanged(); - } - - int signalStrength() const { - return m_signalStrength; - } - - void setSignalStrength(const int signalStrength) { - m_signalStrength = signalStrength; - emit signalStrengthChanged(); - } - - void setSecurity(const SecurityFlags security) { - if (security == None) { - m_securityFlags = None; - } - else { - m_securityFlags |= security; - } - } - - void setOutOfRange(const bool aOutOfRange) { - m_isOutOfRange = aOutOfRange; - emit outOfRangeChanged(); - } - - bool outOfRange() const { - return m_isOutOfRange; - } - -signals: - void hiddenChanged(); - void signalStrengthChanged(); - void passwordChanged(); - void outOfRangeChanged(); -private: - quint16 m_securityFlags; - bool m_hidden; - int m_signalStrength; - bool m_isOutOfRange; -}; -#endif //QNETWORKSETTINGS_H diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsaddressmodel.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsaddressmodel.cpp deleted file mode 100644 index b70278b..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsaddressmodel.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "qnetworksettingsaddressmodel.h" - -QNetworkSettingsAddressModel::QNetworkSettingsAddressModel(QObject *parent) - :QStringListModel(parent) -{ -} - -QNetworkSettingsAddressModel::QNetworkSettingsAddressModel(const QStringList &strings, QObject *parent) - :QStringListModel(parent) -{ - setStringList(strings); -} - -void QNetworkSettingsAddressModel::setStringList(const QStringList &addresses) -{ - m_addresses = addresses; - QStringListModel::setStringList(m_addresses); - emit countChanged(); -} - -void QNetworkSettingsAddressModel::append(const QString& address) -{ - int row = rowCount(); - - bool succeed = insertRows(row, 1); - if (succeed) - succeed = setData(index(row), QVariant::fromValue(address)); - - Q_ASSERT(succeed == true); - - emit countChanged(); -} - -void QNetworkSettingsAddressModel::remove(int index) -{ - removeRows(index, 1); - emit countChanged(); -} - -int QNetworkSettingsAddressModel::count() const -{ - return rowCount(); -} - -void QNetworkSettingsAddressModel::resetChanges() -{ - QStringListModel::setStringList(m_addresses); -} diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsaddressmodel.h b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsaddressmodel.h deleted file mode 100644 index b7a1c2e..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsaddressmodel.h +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QNETWORKSETTINGSADDRESSMODEL_H -#define QNETWORKSETTINGSADDRESSMODEL_H - -#include - -class QNetworkSettingsAddressModel : public QStringListModel -{ - Q_OBJECT - Q_PROPERTY(int count READ count NOTIFY countChanged) -public: - explicit QNetworkSettingsAddressModel(QObject *parent = 0); - explicit QNetworkSettingsAddressModel(const QStringList &strings, QObject *parent = 0); - Q_INVOKABLE void append(const QString& address); - Q_INVOKABLE void remove(int index); - Q_INVOKABLE void resetChanges(); - void setStringList(const QStringList &addresses); - int count() const; - -signals: - void countChanged(); -private: - QStringList m_addresses; -}; - -#endif // QNETWORKSETTINGSADDRESSMODEL_H diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsinterface.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsinterface.cpp deleted file mode 100644 index 893311a..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsinterface.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "qnetworksettingsinterface.h" -#include "qnetworksettingsinterface_p.h" -#include "qnetworksettings.h" - -QNetworkSettingsInterface::QNetworkSettingsInterface(QObject *parent) : - QObject(parent) - ,d_ptr(new QNetworkSettingsInterfacePrivate(this)) -{ - -} - -QString QNetworkSettingsInterface::name() const -{ - Q_D(const QNetworkSettingsInterface); - return d->m_name; -} - -QNetworkSettingsState::States QNetworkSettingsInterface::state() -{ - Q_D(QNetworkSettingsInterface); - return d->m_state.state(); -} - -QNetworkSettingsType::Types QNetworkSettingsInterface::type() -{ - Q_D(QNetworkSettingsInterface); - return d->m_type.type(); -} - -bool QNetworkSettingsInterface::powered() const -{ - Q_D(const QNetworkSettingsInterface); - return d->m_powered; -} - -void QNetworkSettingsInterface::setPowered(const bool powered) -{ - Q_D(QNetworkSettingsInterface); - d->setPowered(powered); -} - -void QNetworkSettingsInterface::scanServices() -{ - Q_D(QNetworkSettingsInterface); - d->scan(); -} diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsinterface.h b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsinterface.h deleted file mode 100644 index bce4848..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsinterface.h +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QNETWORKSETTINGSINTERFACE_H -#define QNETWORKSETTINGSINTERFACE_H - -#include -#include "qnetworksettings.h" - -QT_FORWARD_DECLARE_CLASS(QNetworkSettingsInterfacePrivate) - -class QNetworkSettingsInterface : public QObject { - Q_OBJECT - Q_PROPERTY(QString name READ name NOTIFY nameChanged) - Q_PROPERTY(QNetworkSettingsState::States state READ state NOTIFY stateChanged) - Q_PROPERTY(QNetworkSettingsType::Types type READ type NOTIFY typeChanged) - Q_PROPERTY(bool powered READ powered WRITE setPowered NOTIFY poweredChanged) - -public: - explicit QNetworkSettingsInterface(QObject* parent=0); - QString name() const; - QNetworkSettingsState::States state(); - QNetworkSettingsType::Types type(); - bool powered() const; - void setPowered(const bool powered); - Q_INVOKABLE void scanServices(); - -signals: - void nameChanged(); - void stateChanged(); - void typeChanged(); - void poweredChanged(); - -protected: - friend class NetworksInterfaceModel; - QNetworkSettingsInterfacePrivate *d_ptr; - - Q_DISABLE_COPY(QNetworkSettingsInterface) - Q_DECLARE_PRIVATE(QNetworkSettingsInterface) -}; - -#endif // QNETWORKSETTINGSINTERFACE_H diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsinterfacemodel.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsinterfacemodel.cpp deleted file mode 100644 index a539756..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsinterfacemodel.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include "qnetworksettingsinterfacemodel.h" -#include "qnetworksettingsinterface.h" - -QNetworkSettingsInterfaceModel::QNetworkSettingsInterfaceModel(QObject *parent) - : QAbstractListModel(parent) -{ - m_roleNames.insert(Qt::UserRole, "modelData"); - m_roleNames.insert(Type, "type"); - m_roleNames.insert(Status, "status"); - m_roleNames.insert(Name, "name"); -} - -QNetworkSettingsInterfaceModel::~QNetworkSettingsInterfaceModel() -{ - -} - -QHash QNetworkSettingsInterfaceModel::roleNames() const -{ - return m_roleNames; -} - - -int QNetworkSettingsInterfaceModel::rowCount(const QModelIndex & parent) const -{ - Q_UNUSED(parent); - return m_items.count(); -} - -QVariant QNetworkSettingsInterfaceModel::data(const QModelIndex & index, int role) const -{ - if (!index.isValid()) return QVariant(); - - QNetworkSettingsInterface *item = m_items[index.row()]; - if (role == Qt::UserRole) { - return QVariant::fromValue(static_cast(item)); - } - - switch (role) { - case Type: - return item->type(); - break; - case Name: - return item->name(); - break; - case Status: - return item->state(); - break; - default: - return ""; - } - -} - -void QNetworkSettingsInterfaceModel::append(QNetworkSettingsInterface* item) -{ - item->setParent(this); - - beginInsertRows(QModelIndex(), rowCount(), rowCount()); - m_items.append(item); - endInsertRows(); -} - -void QNetworkSettingsInterfaceModel::insert(int row, QNetworkSettingsInterface* item) -{ - item->setParent(this); - - beginInsertRows(QModelIndex(), row, row); - m_items.insert(row, item); - endInsertRows(); -} - -void QNetworkSettingsInterfaceModel::remove(int row) -{ - beginRemoveRows(QModelIndex(), row, row); - m_items.removeFirst(); - endRemoveRows(); -} - -QList QNetworkSettingsInterfaceModel::getModel() -{ - return m_items; -} diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsinterfacemodel.h b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsinterfacemodel.h deleted file mode 100644 index 2105061..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsinterfacemodel.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QNETWORKSETTINGSINTERFACEMODEL_H -#define QNETWORKSETTINGSINTERFACEMODEL_H - -#include -#include "qnetworksettings.h" - -class QNetworkSettingsInterface; - -class QNetworkSettingsInterfaceModel : public QAbstractListModel -{ - Q_OBJECT - -public: - explicit QNetworkSettingsInterfaceModel(QObject *parent=0); - virtual ~QNetworkSettingsInterfaceModel(); - // from QAbstractItemModel - int rowCount(const QModelIndex & parent = QModelIndex()) const; - QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const; - QHash roleNames() const; - - void append(QNetworkSettingsInterface* networkInterface); - void insert(int row, QNetworkSettingsInterface* networkInterface); - void remove(int row); - QList getModel(); - - enum Roles { - Type = Qt::UserRole + 1, - Status, - Name - }; - -private: - QList m_items; - QHash m_roleNames; -}; - -#endif // QNETWORKSETTINGSINTERFACEMODEL_H diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsmanager.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsmanager.cpp deleted file mode 100644 index 954d639..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsmanager.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "qnetworksettingsmanager.h" -#include "qnetworksettingsservice.h" -#include "qnetworksettingsservicemodel.h" -#include "qnetworksettingsinterfacemodel.h" -#include "qnetworksettingsmanager_p.h" -#include - -QNetworkSettingsManager::QNetworkSettingsManager(QObject *parent) : - QObject(parent) - ,d_ptr(new QNetworkSettingsManagerPrivate(this)) -{ -} - -QAbstractItemModel* QNetworkSettingsManager::services() -{ - Q_D(QNetworkSettingsManager); - return &d->m_serviceFilter; -} - -QAbstractItemModel* QNetworkSettingsManager::interfaces() -{ - Q_D(QNetworkSettingsManager); - return &d->m_interfaceModel; -} - -QNetworkSettingsService* QNetworkSettingsManager::getService(const QString& name, const int type) -{ - Q_D(QNetworkSettingsManager); - - foreach (QNetworkSettingsService* service, d->m_serviceModel.getModel()) { - if (service->name() == name && service->type() == type) { - return service; - } - } - return NULL; -} - -void QNetworkSettingsManager::setUserAgent(QNetworkSettingsUserAgent *agent) -{ - Q_D(QNetworkSettingsManager); - d->setUserAgent(agent); -} diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsmanager.h b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsmanager.h deleted file mode 100644 index b0cb7fe..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsmanager.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QNETWORKSETTINGSMANAGER_H -#define QNETWORKSETTINGSMANAGER_H - -#include "qnetworksettings.h" -#include -#include -#include - -QT_FORWARD_DECLARE_CLASS(QNetworkSettingsManagerPrivate) -QT_FORWARD_DECLARE_CLASS(QNetworkSettingsService) -QT_FORWARD_DECLARE_CLASS(QNetworkSettingsUserAgent) - -class QNetworkSettingsManager : public QObject -{ - Q_OBJECT - Q_ENUMS(StateTypes NetworkTypeTypes) - Q_PROPERTY(QAbstractItemModel* services READ services NOTIFY servicesChanged) - Q_PROPERTY(QAbstractItemModel* interfaces READ interfaces NOTIFY interfacesChanged) -public: - explicit QNetworkSettingsManager(QObject* parent = 0); - QAbstractItemModel* services(); - QAbstractItemModel* interfaces(); - void setUserAgent(QNetworkSettingsUserAgent *agent); - - Q_INVOKABLE QNetworkSettingsService* getService(const QString& name, const int type); - -Q_SIGNALS: - void servicesChanged(); - void interfacesChanged(); - -protected: - QNetworkSettingsManagerPrivate *d_ptr; - -private: - Q_DISABLE_COPY(QNetworkSettingsManager) - Q_DECLARE_PRIVATE(QNetworkSettingsManager) -}; - -#endif // QNETWORKSETTINGSMANAGER_H diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsservice.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsservice.cpp deleted file mode 100644 index 8ade875..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsservice.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qnetworksettingsservice.h" -#include "qnetworksettingsservice_p.h" - -QNetworkSettingsService::QNetworkSettingsService(const QString& aServiceId, QObject* parent) : - QObject(parent) - ,d_ptr(new QNetworkSettingsServicePrivate(aServiceId, this)) -{ - -} - -QString QNetworkSettingsService::id() const -{ - Q_D(const QNetworkSettingsService); - return d->m_id; -} - -QString QNetworkSettingsService::name() const -{ - Q_D(const QNetworkSettingsService); - return d->m_name; -} - -QNetworkSettingsState::States QNetworkSettingsService::state() -{ - Q_D(QNetworkSettingsService); - return d->m_state.state(); -} - -QNetworkSettingsType::Types QNetworkSettingsService::type() -{ - Q_D(QNetworkSettingsService); - return d->m_type.type(); -} - -QNetworkSettingsIPv4* QNetworkSettingsService::ipv4() -{ - Q_D(QNetworkSettingsService); - return &d->m_ipv4config; -} - -QNetworkSettingsIPv6* QNetworkSettingsService::ipv6() -{ - Q_D(QNetworkSettingsService); - return &d->m_ipv6config; -} - -QNetworkSettingsProxy* QNetworkSettingsService::proxy() -{ - Q_D(QNetworkSettingsService); - return &d->m_proxyConfig; -} - -QNetworkSettingsWireless* QNetworkSettingsService::wirelessConfig() -{ - Q_D(QNetworkSettingsService); - return &d->m_wifiConfig; -} - -QAbstractItemModel* QNetworkSettingsService::domains() -{ - Q_D(QNetworkSettingsService); - return &d->m_domainsConfig; -} - -QAbstractItemModel* QNetworkSettingsService::nameservers() -{ - Q_D(QNetworkSettingsService); - return &d->m_nameserverConfig; -} - -void QNetworkSettingsService::setupIpv4Config() -{ - Q_D(QNetworkSettingsService); - d->setupIpv4Config(); -} - -void QNetworkSettingsService::setupIpv6Config() -{ - Q_D(QNetworkSettingsService); - d->setupIpv6Config(); -} - -void QNetworkSettingsService::setupNameserversConfig() -{ - Q_D(QNetworkSettingsService); - d->setupNameserversConfig(); -} - -void QNetworkSettingsService::setupDomainsConfig() -{ - Q_D(QNetworkSettingsService); - d->setupDomainsConfig(); -} - -void QNetworkSettingsService::setupNetworkSettingsProxy() -{ - Q_D(QNetworkSettingsService); - d->setupQNetworkSettingsProxy(); -} - -void QNetworkSettingsService::connectService() -{ - Q_D(QNetworkSettingsService); - d->connectService(); -} - -void QNetworkSettingsService::disconnectService() -{ - Q_D(QNetworkSettingsService); - d->disconnectService(); -} diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsservice.h b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsservice.h deleted file mode 100644 index 96d4244..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsservice.h +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QNETWORKSETTINGSSERVICE_H -#define QNETWORKSETTINGSSERVICE_H - -#include -#include "qnetworksettings.h" - -QT_FORWARD_DECLARE_CLASS(QNetworkSettingsServicePrivate) - -class QNetworkSettingsService : public QObject -{ - Q_OBJECT - Q_ENUMS(StateTypes) - Q_PROPERTY(QString id READ id CONSTANT) - Q_PROPERTY(QString name READ name NOTIFY nameChanged) - Q_PROPERTY(QNetworkSettingsState::States state READ state NOTIFY stateChanged) - Q_PROPERTY(QNetworkSettingsType::Types type READ type NOTIFY typeChanged) - Q_PROPERTY(QNetworkSettingsIPv4* ipv4 READ ipv4 NOTIFY ipv4Changed) - Q_PROPERTY(QNetworkSettingsIPv6* ipv6 READ ipv6 NOTIFY ipv6Changed) - Q_PROPERTY(QNetworkSettingsProxy* proxy READ proxy NOTIFY proxyChanged) - Q_PROPERTY(QNetworkSettingsWireless* wirelessConfig READ wirelessConfig NOTIFY wirelessChanged) - Q_PROPERTY(QAbstractItemModel* domains READ domains NOTIFY domainsChanged) - Q_PROPERTY(QAbstractItemModel* nameservers READ nameservers NOTIFY nameserversChanged) -public: - explicit QNetworkSettingsService(const QString& aServiceId, QObject* parent = 0); - - QString id() const; - QString name() const; - QNetworkSettingsState::States state(); - QNetworkSettingsType::Types type(); - QNetworkSettingsIPv4* ipv4(); - QNetworkSettingsIPv6* ipv6(); - QNetworkSettingsProxy* proxy(); - QAbstractItemModel* domains(); - QAbstractItemModel* nameservers(); - QNetworkSettingsWireless* wirelessConfig(); - - Q_INVOKABLE void setAutoConnect(const bool autoconnect); - Q_INVOKABLE void setupIpv4Config(); - Q_INVOKABLE void setupIpv6Config(); - Q_INVOKABLE void setupNameserversConfig(); - Q_INVOKABLE void setupDomainsConfig(); - Q_INVOKABLE void setupNetworkSettingsProxy(); - //Wireless config - Q_INVOKABLE void connectService(); - Q_INVOKABLE void disconnectService(); -Q_SIGNALS: - void nameChanged(); - void stateChanged(); - void typeChanged(); - void proxyChanged(); - void ipv4Changed(); - void ipv6Changed(); - void domainsChanged(); - void nameserversChanged(); - void wirelessChanged(); - void showCrendentialInput(); -protected: - QNetworkSettingsServicePrivate *d_ptr; - - Q_DISABLE_COPY(QNetworkSettingsService) - Q_DECLARE_PRIVATE(QNetworkSettingsService) -}; - -#endif // QNETWORKSETTINGSSERVICE_H diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsservicemodel.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsservicemodel.cpp deleted file mode 100644 index 6a80369..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsservicemodel.cpp +++ /dev/null @@ -1,176 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "qnetworksettingsservicemodel.h" -#include "qnetworksettings.h" - -QNetworkSettingsServiceModel::QNetworkSettingsServiceModel(QObject *parent) - : QAbstractListModel(parent) -{ - m_roleNames.insert(Qt::UserRole, "modelData"); - m_roleNames.insert(Name, "name"); - m_roleNames.insert(SignalStrength, "signalStrength"); - m_roleNames.insert(Connected, "connected"); -} - -QNetworkSettingsServiceModel::~QNetworkSettingsServiceModel() -{ - -} - -QHash QNetworkSettingsServiceModel::roleNames() const -{ - return m_roleNames; -} - - -int QNetworkSettingsServiceModel::rowCount(const QModelIndex & parent) const -{ - Q_UNUSED(parent); - return m_items.count(); -} - -QVariant QNetworkSettingsServiceModel::data(const QModelIndex & index, int role) const -{ - if (!index.isValid()) return QVariant(); - - QNetworkSettingsService *item = m_items[index.row()]; - if (role == Qt::UserRole) { - return QVariant::fromValue(static_cast(item)); - } - else if (role == Name) { - return item->name(); - } - else if (role == SignalStrength) { - return item->wirelessConfig()->signalStrength(); - } - else if (role == Connected) { - return item->state() == QNetworkSettingsState::Online || item->state() == QNetworkSettingsState::Ready; - } - return QVariant(); -} - -void QNetworkSettingsServiceModel::append(QNetworkSettingsService* item) -{ - item->setParent(this); - - beginInsertRows(QModelIndex(), rowCount(), rowCount()); - m_items.append(item); - endInsertRows(); -} - -void QNetworkSettingsServiceModel::insert(int row, QNetworkSettingsService* item) -{ - item->setParent(this); - - beginInsertRows(QModelIndex(), row, row); - m_items.insert(row, item); - endInsertRows(); -} - -void QNetworkSettingsServiceModel::remove(int row) -{ - beginRemoveRows(QModelIndex(), row, row); - m_items.removeAt(row); - endRemoveRows(); -} - -void QNetworkSettingsServiceModel::updated(int row) -{ - dataChanged(createIndex(row, 0), createIndex(row, 0)); -} - -QList QNetworkSettingsServiceModel::getModel() -{ - return m_items; -} - -//Filter model - -QNetworkSettingsServiceFilter::QNetworkSettingsServiceFilter(QObject* parent) - :QSortFilterProxyModel(parent) -{ - connect(this, &QNetworkSettingsServiceFilter::typeChanged, this, &QNetworkSettingsServiceFilter::invalidate); -} - -QNetworkSettingsServiceFilter::~QNetworkSettingsServiceFilter() -{ - -} - -QNetworkSettingsType::Types QNetworkSettingsServiceFilter::type() const -{ - return m_type; -} - -void QNetworkSettingsServiceFilter::setType(const QNetworkSettingsType::Types type) -{ - m_type = type; - emit typeChanged(); -} - -bool QNetworkSettingsServiceFilter::filterAcceptsRow( int source_row, const QModelIndex& source_parent ) const -{ - if (this->sourceModel()) - { - QModelIndex index = this->sourceModel()->index( source_row, 0, source_parent ); - if (index.isValid()) - { - if (index.isValid()) - { - QObject * obj = qvariant_cast(index.data(Qt::UserRole)); - QNetworkSettingsService * service = qobject_cast(obj); - if (service->type() == m_type) - return true; - } - } - } - return false; -} - -QVariant QNetworkSettingsServiceFilter::itemFromRow(const int row) const -{ - QModelIndex idx = index(row, 0); - QModelIndex mapped = mapToSource(idx); - if (mapped.isValid()) - { - QVariant serviceItem = mapped.data(Qt::UserRole); - if (serviceItem.isValid()) - { - return serviceItem; - } - } - return QVariant::fromValue(QString("")); -} diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsservicemodel.h b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsservicemodel.h deleted file mode 100644 index 50b0242..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsservicemodel.h +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QNETWORKSETTINGSSERVICEMODEL_H -#define QNETWORKSETTINGSSERVICEMODEL_H - -#include -#include "qnetworksettings.h" -#include "qnetworksettingsservice.h" - -class QNetworkSettingsServiceModel : public QAbstractListModel -{ - Q_OBJECT -public: - explicit QNetworkSettingsServiceModel(QObject *parent=0); - virtual ~QNetworkSettingsServiceModel(); - // from QAbstractItemModel - int rowCount(const QModelIndex & parent = QModelIndex()) const; - QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const; - QHash roleNames() const; - - void append(QNetworkSettingsService* networkService); - void insert(int row, QNetworkSettingsService* networkInterface); - void remove(int row); - void updated(int row); - QList getModel(); - - enum Roles { - Type = Qt::UserRole + 1, - Name, - SignalStrength, - Connected - }; - -private: - QList m_items; - QHash m_roleNames; -}; - -class QNetworkSettingsServiceFilter : public QSortFilterProxyModel -{ - Q_OBJECT - Q_PROPERTY(QNetworkSettingsType::Types type READ type WRITE setType NOTIFY typeChanged) -public: - explicit QNetworkSettingsServiceFilter(QObject* parent=0); - virtual ~QNetworkSettingsServiceFilter(); - bool filterAcceptsRow( int source_row, const QModelIndex& source_parent ) const override; - QNetworkSettingsType::Types type() const; - void setType(QNetworkSettingsType::Types type); - Q_INVOKABLE QVariant itemFromRow(const int row) const; -signals: - void typeChanged(); -private: - QNetworkSettingsType::Types m_type; -}; - -#endif // QNETWORKSETTINGSSERVICEMODEL_H diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsuseragent.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsuseragent.cpp deleted file mode 100644 index f1b0590..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsuseragent.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "qnetworksettingsuseragent.h" -#include "qnetworksettingsuseragent_p.h" - -QNetworkSettingsUserAgent::QNetworkSettingsUserAgent(QObject *parent) - :QObject(parent) - ,d_ptr(new QNetworkSettingsUserAgentPrivate(this)) -{ -} - -void QNetworkSettingsUserAgent::setUserCredentials(const QString& username, const QString& passphrase) -{ - Q_D(QNetworkSettingsUserAgent); - d->setUserCredentials(username, passphrase); -} - -void QNetworkSettingsUserAgent::cancelInput() -{ - Q_D(QNetworkSettingsUserAgent); - d->cancel(); -} - -QString QNetworkSettingsUserAgent::passPhrase() const -{ - Q_D(const QNetworkSettingsUserAgent); - return d->m_passphrase; -} - -QString QNetworkSettingsUserAgent::userName() const -{ - Q_D(const QNetworkSettingsUserAgent); - return d->m_username; -} diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsuseragent.h b/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsuseragent.h deleted file mode 100644 index be6dff3..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/qnetworksettingsuseragent.h +++ /dev/null @@ -1,63 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QNETWORKSETTINGSUSERAGENT_H -#define QNETWORKSETTINGSUSERAGENT_H - -#include - -QT_FORWARD_DECLARE_CLASS(QNetworkSettingsUserAgentPrivate) - -class QNetworkSettingsUserAgent : public QObject -{ - Q_OBJECT -public: - explicit QNetworkSettingsUserAgent(QObject *parent = 0); - Q_INVOKABLE void setUserCredentials(const QString& username, const QString& passphrase); - Q_INVOKABLE void cancelInput(); - QString passPhrase() const; - QString userName() const; - -signals: - void showUserCredentialsInput(); - void error(); - void ready(bool cancel); -private: - QNetworkSettingsUserAgentPrivate *d_ptr; - - Q_DISABLE_COPY(QNetworkSettingsUserAgent) - Q_DECLARE_PRIVATE(QNetworkSettingsUserAgent) -}; -#endif // QNETWORKSETTINGSUSERAGENT_H diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant.pri b/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant.pri deleted file mode 100644 index db89315..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant.pri +++ /dev/null @@ -1,28 +0,0 @@ -QT += core network - -INCLUDEPATH += $${PWD}/wpasupplicant - -HEADERS += \ - $$PWD/wpasupplicant/qnetworksettingsinterface_p.h \ - $$PWD/wpasupplicant/qnetworksettingsmanager_p.h \ - $$PWD/wpasupplicant/qwifisupplicant_p.h \ - $$PWD/wpasupplicant/qwificontroller_p.h \ - $$PWD/wpasupplicant/qnetworksettingsservice_p.h \ - $$PWD/wpasupplicant/qnetworksettingsuseragent_p.h \ - $$PWD/wpasupplicant/qwifidevice.h - -SOURCES += \ - $$PWD/wpasupplicant/qnetworksettingsinterface_p.cpp \ - $$PWD/wpasupplicant/qnetworksettingsmanager_p.cpp \ - $$[QT_SYSROOT]/usr/include/wpa-supplicant/wpa_ctrl.c \ - $$[QT_SYSROOT]/usr/include/wpa-supplicant/os_unix.c \ - $$PWD/wpasupplicant/qwifisupplicant.cpp \ - $$PWD/wpasupplicant/qwificontroller.cpp \ - $$PWD/wpasupplicant/qnetworksettingsservice_p.cpp \ - $$PWD/wpasupplicant/qnetworksettingsuseragent_p.cpp \ - $$PWD/wpasupplicant/qwifidevice.cpp - -DEFINES += \ - CONFIG_CTRL_IFACE \ - CONFIG_CTRL_IFACE_UNIX - diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qnetworksettingsinterface_p.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qnetworksettingsinterface_p.cpp deleted file mode 100644 index 7370421..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qnetworksettingsinterface_p.cpp +++ /dev/null @@ -1,71 +0,0 @@ - -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "qnetworksettingsinterface_p.h" -#include "qnetworksettingsmanager_p.h" -#include "qwifidevice.h" - -QNetworkSettingsInterfacePrivate::QNetworkSettingsInterfacePrivate(QNetworkSettingsInterface* parent) - :QObject(parent) - ,q_ptr(parent) -{ - m_name = QWifiDevice::wifiInterfaceName(); - m_type.setType(QNetworkSettingsType::Wifi); - m_powered = true; //We don't really know -} - -void QNetworkSettingsInterfacePrivate::setManager(QNetworkSettingsManagerPrivate *manager) -{ - m_manager = manager; -} - -void QNetworkSettingsInterfacePrivate::setPowered(const bool power) -{ - //Not supported - Q_UNUSED(power); -} - -void QNetworkSettingsInterfacePrivate::setState(QNetworkSettingsState::States aState) -{ - Q_Q(QNetworkSettingsInterface); - m_state.setState(aState); - emit q->stateChanged(); -} - -void QNetworkSettingsInterfacePrivate::scan() -{ - m_manager->call(QStringLiteral("SCAN")); -} diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qnetworksettingsinterface_p.h b/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qnetworksettingsinterface_p.h deleted file mode 100644 index d8964c3..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qnetworksettingsinterface_p.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QNETWORKSETTINGSINTERFACEPRIVATE_H -#define QNETWORKSETTINGSINTERFACEPRIVATE_H - -#include -#include "qnetworksettings.h" -#include "qnetworksettingsinterface.h" -#include "qnetworksettingsmanager_p.h" - -class QNetworkSettingsInterfacePrivate : public QObject -{ - Q_OBJECT - Q_DECLARE_PUBLIC(QNetworkSettingsInterface) -public: - explicit QNetworkSettingsInterfacePrivate(QNetworkSettingsInterface* parent); - void initialize(const QString& path, const QVariantMap& properties); - void setPowered(const bool power); - void setState(QNetworkSettingsState::States aState); - void setManager(QNetworkSettingsManagerPrivate *manager); - void scan(); - -signals: - -protected: - QString m_name; - QNetworkSettingsType m_type; - QNetworkSettingsState m_state; - bool m_powered; - QNetworkSettingsManagerPrivate *m_manager; //not owned - QNetworkSettingsInterface *q_ptr; -}; - -class WpaSupplicantSettingsInterface : public QNetworkSettingsInterface -{ - Q_OBJECT -public: - WpaSupplicantSettingsInterface(QNetworkSettingsManagerPrivate* manager) - :QNetworkSettingsInterface(manager) - { - Q_D(QNetworkSettingsInterface); - d->setManager(manager); - } - - void setState(QNetworkSettingsState::States aState) { - Q_D(QNetworkSettingsInterface); - d->setState(aState); - } - - virtual ~WpaSupplicantSettingsInterface() { - } -}; - -#endif // QNETWORKSETTINGSINTERFACEPRIVATE_H - diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qnetworksettingsmanager_p.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qnetworksettingsmanager_p.cpp deleted file mode 100644 index 17a1f2f..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qnetworksettingsmanager_p.cpp +++ /dev/null @@ -1,433 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include -#include "qnetworksettingsmanager_p.h" -#include "qwificontroller_p.h" -#include "qnetworksettingsinterface_p.h" -#include "qnetworksettingsservice_p.h" -#include "qnetworksettingsuseragent.h" -#include "qwifisupplicant_p.h" - -QNetworkSettingsManagerPrivate::QNetworkSettingsManagerPrivate(QNetworkSettingsManager *parent) - :QObject(parent) - ,q_ptr(parent) -{ - m_serviceFilter.setSourceModel(&m_serviceModel); - m_wifiController = new QWifiController(this); - m_wifiController->asyncCall(QWifiController::InitializeBackend); - - QObject::connect(m_wifiController, &QWifiController::backendStateChanged, - this, &QNetworkSettingsManagerPrivate::handleBackendStateChanged); - QObject::connect(m_wifiController, &QWifiController::dhcpRequestFinished, - this, &QNetworkSettingsManagerPrivate::handleDhcpRequestFinished); - - QObject::connect(m_wifiController, &QWifiController::raiseError, this, &QNetworkSettingsManagerPrivate::updateLastError); - m_wifiController->start(); - - updateWifiState(); -} - -QNetworkSettingsManagerPrivate::~QNetworkSettingsManagerPrivate() -{ - m_wifiController->asyncCall(QWifiController::ExitEventLoop); - m_wifiController->wait(); - delete m_wifiController; -} - -bool QNetworkSettingsManagerPrivate::event(QEvent *event) -{ - switch ((int) event->type()) { - case WIFI_SCAN_RESULTS: - parseScanResults(call(QStringLiteral("SCAN_RESULTS"))); - return true; - case WIFI_CONNECTED: - handleConnected(); - return true; - case WIFI_DISCONNECTED: - handleDisconneced(); - return true; - case WIFI_AUTHENTICATING: - handleAuthenticating(static_cast(event)); - return true; - case WIFI_HANDSHAKE_FAILED: - updateNetworkState(QNetworkSettingsState::Failure); - return true; - } - return QObject::event(event); -} - -void QNetworkSettingsManagerPrivate::connectNetwork(const QString& ssid) -{ - if (m_backendState != QWifiController::Running) { - qCWarning(B2QT_WIFI) << "start wifi backend before calling connect()"; - return; - } - - call(QStringLiteral("DISABLE_NETWORK all")); - m_currentSSID = ssid; - emit m_agent->showUserCredentialsInput(); -} - -void QNetworkSettingsManagerPrivate::userInteractionReady(bool cancel) -{ - if (cancel) { - m_currentSSID = ""; - return; - } - bool networkKnown = false; - QString id; - const QStringList configuredNetworks = call(QStringLiteral("LIST_NETWORKS")).split('\n'); - for (int i = 1; i < configuredNetworks.length(); ++i) { - const QStringList networkFields = configuredNetworks.at(i).split('\t'); - const QString ssid = QWifiSupplicant::decodeSsid(networkFields.at(1)); - if (ssid == m_currentSSID) { - id = networkFields.at(0); - networkKnown = true; - break; - } - } - - if (!networkKnown) { - bool ok; - id = call(QStringLiteral("ADD_NETWORK")); - id.toInt(&ok); - if (!ok) { - updateLastError(QStringLiteral("failed to add network")); - return; - } - } - - bool ok = true; - QChar q = QLatin1Char('"'); - QString setNetworkCommand = QLatin1String("SET_NETWORK ") + id; - if (!networkKnown) { - ok = ok && checkedCall(setNetworkCommand + QLatin1String(" ssid ") + q + m_currentSSID + q); - } - - QString key_mgmt; - WpaSupplicantService *service = networkForSSID(m_currentSSID); - if (!service) { - return; - } - QString psk = m_agent->passPhrase(); - - // --------------------- configure network ------------------------------ - // ref: http://w1.fi/cgit/hostap/plain/wpa_supplicant/wpa_supplicant.conf - // ref: https://www.freebsd.org/cgi/man.cgi?wpa_supplicant.conf - // ---------------------------------------------------------------------- - if (service->wirelessConfig()->supportsSecurity(QNetworkSettingsWireless::WPA) || - service->wirelessConfig()->supportsSecurity(QNetworkSettingsWireless::WPA2)) { - // ### TODO - password length has limits (see IEEE 802.11), we need to check - // for those limits here. Supplicant gives only a meaningless "fail" message. - ok = ok && checkedCall(setNetworkCommand + QLatin1String(" psk ") + q + psk + q); - key_mgmt = QLatin1String("WPA-PSK"); - } else if (service->wirelessConfig()->supportsSecurity(QNetworkSettingsWireless::WEP)) { - ok = ok && checkedCall(setNetworkCommand + QLatin1String(" wep_key0 ") + q + psk + q); - ok = ok && checkedCall(setNetworkCommand + QLatin1String(" auth_alg OPEN SHARED")); - key_mgmt = QLatin1String("NONE"); - } else if (service->wirelessConfig()->supportsSecurity(QNetworkSettingsWireless::None)) { - // open network - key_mgmt = QLatin1String("NONE"); - } - - if (service->wirelessConfig()->hidden()) - ok = ok && checkedCall(setNetworkCommand + QLatin1String(" scan_ssid 1")); - - ok = ok && checkedCall(setNetworkCommand + QLatin1String(" key_mgmt ") + key_mgmt); - if (!ok) { - if (!networkKnown) - call(QLatin1String("REMOVE_NETWORK ") + id); - updateLastError(QLatin1String("failed to set properties on network: ") + id); - return; - } - - call(QLatin1String("SELECT_NETWORK ") + id); - call(QStringLiteral("RECONNECT")); -} - -void QNetworkSettingsManagerPrivate::disconnectNetwork() -{ - call(QStringLiteral("DISCONNECT")); - m_wifiController->asyncCall(QWifiController::StopDhcp); -} - -void QNetworkSettingsManagerPrivate::handleBackendStateChanged(QWifiController::BackendState backendState) -{ - switch (backendState) { - case QWifiController::NotRunning: - updateNetworkState(QNetworkSettingsState::Disconnect); - break; - default: - break; - } - updateBackendState(backendState); -} - -void QNetworkSettingsManagerPrivate::handleDhcpRequestFinished(const QString &status) -{ - qCDebug(B2QT_WIFI) << "handleDhcpRequestFinished: " << status << " for " << m_currentSSID; - if (status == QLatin1String("success")) { - updateNetworkState(QNetworkSettingsState::Online); - call(QStringLiteral("SAVE_CONFIG")); - } else { - updateNetworkState(QNetworkSettingsState::Failure); - } -} - -void QNetworkSettingsManagerPrivate::setUserAgent(QNetworkSettingsUserAgent *agent) -{ - m_agent = agent; - connect(m_agent, &QNetworkSettingsUserAgent::ready, this, &QNetworkSettingsManagerPrivate::userInteractionReady); -} - -void QNetworkSettingsManagerPrivate::setCurrentSSID(const QString &ssid) -{ - qCDebug(B2QT_WIFI) << "current SSID: " << m_currentSSID << " -> " << ssid; - if (m_currentSSID == ssid) - return; - - m_currentSSID = ssid; -} - -void QNetworkSettingsManagerPrivate::handleAuthenticating(QWifiEvent *event) -{ - QString data = event->data().trimmed(); - QString ssid = data.mid(data.indexOf(QLatin1String("SSID")) + 6); - ssid = ssid.left(ssid.lastIndexOf(QLatin1Char('\''))); - - setCurrentSSID(QWifiSupplicant::decodeSsid(ssid)); - updateNetworkState(QNetworkSettingsState::Association); -} - -void QNetworkSettingsManagerPrivate::handleConnected() -{ - qCDebug(B2QT_WIFI) << "connected network: " << m_currentSSID; - updateNetworkState(QNetworkSettingsState::Ready); - m_wifiController->asyncCall(QWifiController::AcquireIPAddress); -} - -void QNetworkSettingsManagerPrivate::handleDisconneced() -{ - updateNetworkState(QNetworkSettingsState::Disconnect); -} - -void QNetworkSettingsManagerPrivate::updateNetworkState(QNetworkSettingsState::States networkState) -{ - //Update interface - if (!m_interfaceModel.getModel().isEmpty()) { - WpaSupplicantSettingsInterface* interface = qobject_cast(m_interfaceModel.getModel().first()); - if (interface && interface->state() != networkState) { - interface->setState(networkState); - } - } - - //Update service state - WpaSupplicantService *service = networkForSSID(m_currentSSID); - if (service) { - service->setState(networkState); - } -} - -void QNetworkSettingsManagerPrivate::updateBackendState(QWifiController::BackendState backendState) -{ - if (m_backendState == backendState) - return; - - m_backendState = backendState; - - if (m_backendState == QWifiController::Running && m_interfaceModel.getModel().isEmpty()) { - WpaSupplicantSettingsInterface *interface = new WpaSupplicantSettingsInterface(this); - m_interfaceModel.append(interface); - } else if (m_backendState == QWifiController::NotRunning && m_interfaceModel.getModel().size() > 0){ - m_interfaceModel.remove(0); - } -} - -void QNetworkSettingsManagerPrivate::updateWifiState() -{ - QProcess ps; - ps.start(QStringLiteral("ps")); - if (!ps.waitForStarted()) { - updateLastError(ps.program() + QLatin1String(": ") + ps.errorString()); - return; - } - - ps.waitForFinished(); - bool supplicantRunning = ps.readAll().contains("wpa_supplicant"); - if (supplicantRunning && m_wifiController->resetSupplicantSocket()) - m_backendState = QWifiController::Running; -} - -QString QNetworkSettingsManagerPrivate::call(const QString &command) -{ - if (m_backendState != QWifiController::Running) - return QString(); - - QByteArray reply; - bool success = m_wifiController->supplicant()->sendCommand(command, &reply); - if (!success) { - qCDebug(B2QT_WIFI) << "call to supplicant failed"; - return QString(); - } - - return QLatin1String(reply.trimmed()); -} - -bool QNetworkSettingsManagerPrivate::checkedCall(const QString &command) -{ - return call(command).toUpper() == QLatin1String("OK"); -} - -void QNetworkSettingsManagerPrivate::updateLastError(const QString &error) -{ - qCWarning(B2QT_WIFI) << error; - if (!m_interfaceModel.getModel().isEmpty()) { - WpaSupplicantSettingsInterface* interface = qobject_cast(m_interfaceModel.getModel().first()); - if (interface) { - interface->setState(QNetworkSettingsState::Failure); - } - } -} - -WpaSupplicantService* QNetworkSettingsManagerPrivate::networkForSSID(const QString& ssid) -{ - int pos = 0; - return networkForSSID(ssid, pos); -} - -WpaSupplicantService* QNetworkSettingsManagerPrivate::networkForSSID(const QString& ssid, int& pos) -{ - QList services = m_serviceModel.getModel(); - pos = 0; - foreach (QNetworkSettingsService *service, services) { - if (service->name() == ssid) { - return qobject_cast(service); - } - pos++; - } - pos = -1; - return NULL; -} - -WpaSupplicantService* QNetworkSettingsManagerPrivate::outOfRangeListContains(const QString& ssid) -{ - QList services = m_outOfRangeServiceModel.getModel(); - foreach (QNetworkSettingsService *service, services) { - if (service->name() == ssid) { - return qobject_cast(service); - } - } - return NULL; -} - -void QNetworkSettingsManagerPrivate::parseScanResults(const QString &results) -{ - QStringList lines = results.split('\n'); - QSet sensibleNetworks; - - for (int i = 1; i < lines.size(); ++i) { - QStringList info = lines.at(i).split('\t'); - if (info.size() < 5 || info.at(4).isEmpty() || info.at(0).isEmpty()) - continue; - int pos = 0; - - QString ssid = QWifiSupplicant::decodeSsid(info.at(4)); - if (ssid.isEmpty()) - continue; - - sensibleNetworks.insert(ssid); - WpaSupplicantService *knownNetwork = networkForSSID(ssid, pos); - - if (!knownNetwork) { - knownNetwork = outOfRangeListContains(ssid); - m_outOfRangeServiceModel.getModel().removeOne(knownNetwork); - } - - int signalStrength = info.at(2).trimmed().toInt(); - if (signalStrength < 0) { - // signal is reported in dBm, rough conversion: best = -40, worst = -100 - int val = qAbs(qMax(-100, qMin(signalStrength, -40)) + 40); // clamp and normalize to 0 - signalStrength = 100 - (int) ((100.0 * (double) val) / 60.0); - } else if (signalStrength > 100) { - qCWarning(B2QT_WIFI) << "unexpected value for a signal level: " << signalStrength; - } - - if (!knownNetwork) { - WpaSupplicantService *network = new WpaSupplicantService(this); - network->setId(info.at(0)); - network->setFlags(info.at(3)); - network->wirelessConfig()->setSignalStrength(signalStrength); - network->setName(ssid); - m_serviceModel.append(network); - } else { - if (knownNetwork->wirelessConfig()->outOfRange()) { - // known network has come back into a range - knownNetwork->wirelessConfig()->setOutOfRange(false); - m_serviceModel.append(knownNetwork); - pos = m_serviceModel.getModel().size() - 1; - } - // ssids are the same, compare bssids.. - if (knownNetwork->id() == info.at(0)) { - // same access point, simply update the signal strength - knownNetwork->wirelessConfig()->setSignalStrength(signalStrength); - knownNetwork->wirelessConfig()->setOutOfRange(false); - m_serviceModel.updated(pos); - } else if (knownNetwork->wirelessConfig()->signalStrength() < signalStrength) { - // replace with a stronger access point within the same network - knownNetwork->wirelessConfig()->setOutOfRange(false); - knownNetwork->setId(info.at(0)); - knownNetwork->setFlags(info.at(3)); - knownNetwork->wirelessConfig()->setSignalStrength(signalStrength); - knownNetwork->setName(ssid); - m_serviceModel.updated(pos); - } - } - } - // remove out-of-range networks from the data model - QList networks; - for (int i = 0; i < networks.size();) { - if (!sensibleNetworks.contains(networks.at(i)->name())) { - WpaSupplicantService *n = qobject_cast(networks.at(i)); - m_serviceModel.remove(i); - if (n) { - n->wirelessConfig()->setOutOfRange(true); - m_outOfRangeServiceModel.append(n); - } - } else { - ++i; - } - } -} diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qnetworksettingsmanager_p.h b/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qnetworksettingsmanager_p.h deleted file mode 100644 index fa20fb4..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qnetworksettingsmanager_p.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QNETWORKSETTINGSMANAGERPRIVATE_H -#define QNETWORKSETTINGSMANAGERPRIVATE_H - -#include -#include "qnetworksettings.h" -#include "qnetworksettingsmanager.h" -#include "qnetworksettingsinterfacemodel.h" -#include "qnetworksettingsservicemodel.h" -#include "qwificontroller_p.h" - -class WpaSupplicantService; - -class QNetworkSettingsManagerPrivate : public QObject -{ - Q_OBJECT - Q_DECLARE_PUBLIC(QNetworkSettingsManager) -public: - explicit QNetworkSettingsManagerPrivate(QNetworkSettingsManager *parent); - virtual ~QNetworkSettingsManagerPrivate(); - QNetworkSettingsManager *q_ptr; - void setUserAgent(QNetworkSettingsUserAgent *agent); - void connectNetwork(const QString& ssid); - void disconnectNetwork(); - QString call(const QString &command); - bool checkedCall(const QString &command); -protected: - bool event(QEvent *event); - -private slots: - void handleBackendStateChanged(QWifiController::BackendState backendState); - void handleDhcpRequestFinished(const QString &status); - void userInteractionReady(bool cancel); - void updateLastError(const QString &error); -private: - void setCurrentSSID(const QString &ssid); - void handleConnected(); - void handleDisconneced(); - void handleAuthenticating(QWifiEvent *event); - void updateNetworkState(QNetworkSettingsState::States networkState); - void updateBackendState(QWifiController::BackendState backendState); - void updateWifiState(); - void parseScanResults(const QString &results); - WpaSupplicantService* networkForSSID(const QString& ssid); - WpaSupplicantService* networkForSSID(const QString& ssid, int& pos); - WpaSupplicantService* outOfRangeListContains(const QString& ssid); - - QNetworkSettingsInterfaceModel m_interfaceModel; - QNetworkSettingsServiceModel m_serviceModel; - QNetworkSettingsServiceModel m_outOfRangeServiceModel; - QNetworkSettingsServiceFilter m_serviceFilter; - QWifiController *m_wifiController; - QNetworkSettingsUserAgent *m_agent; //Not owned - - QWifiController::BackendState m_backendState; - QString m_currentSSID; -}; - - -#endif // QNETWORKSETTINGSMANAGERPRIVATE_H diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qnetworksettingsservice_p.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qnetworksettingsservice_p.cpp deleted file mode 100644 index b5d4545..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qnetworksettingsservice_p.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "qnetworksettingsservice_p.h" -#include "qnetworksettingsmanager_p.h" - -QNetworkSettingsServicePrivate::QNetworkSettingsServicePrivate(const QString& bssid, QNetworkSettingsService *parent) : - QObject(parent) - ,q_ptr(parent) - ,m_id(bssid) -{ - m_type.setType(QNetworkSettingsType::Wifi); -} - -void QNetworkSettingsServicePrivate::setManager(QNetworkSettingsManagerPrivate *manager) -{ - m_manager = manager; -} - -void QNetworkSettingsServicePrivate::connectService() -{ - m_manager->connectNetwork(m_name); -} - -void QNetworkSettingsServicePrivate::disconnectService() -{ - m_manager->disconnectNetwork(); -} - -void QNetworkSettingsServicePrivate::setupIpv6Config() -{ - //Not supported -} - -void QNetworkSettingsServicePrivate::setupNameserversConfig() -{ - //Not supported -} - -void QNetworkSettingsServicePrivate::setupDomainsConfig() -{ - //Not supported -} - -void QNetworkSettingsServicePrivate::setupQNetworkSettingsProxy() -{ - //Not supported -} - -void QNetworkSettingsServicePrivate::setupIpv4Config() -{ - //Not supported -} - -WpaSupplicantService::WpaSupplicantService(QNetworkSettingsManagerPrivate* manager, QObject* parent) - :QNetworkSettingsService("", parent) -{ - Q_D(QNetworkSettingsService); - d->setManager(manager); -} - -void WpaSupplicantService::setId(const QString& aId) -{ - Q_D(QNetworkSettingsService); - d->m_id = aId; -} - -void WpaSupplicantService::setName(const QString& aName) -{ - Q_D(QNetworkSettingsService); - d->m_name = aName; - emit nameChanged(); -} - -void WpaSupplicantService::setFlags(const QString& aFlags) -{ - Q_D(QNetworkSettingsService); - - if (aFlags.contains("WPA-")) { - d->m_wifiConfig.setSecurity(QNetworkSettingsWireless::WPA); - } - if (aFlags.contains("WPA2-")) { - d->m_wifiConfig.setSecurity(QNetworkSettingsWireless::WPA2); - } - if (aFlags.contains("WEP-")) { - d->m_wifiConfig.setSecurity(QNetworkSettingsWireless::WEP); - } -} - -void WpaSupplicantService::setState(QNetworkSettingsState::States aState) -{ - Q_D(QNetworkSettingsService); - d->m_state.setState(aState); - emit stateChanged(); -} diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qnetworksettingsservice_p.h b/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qnetworksettingsservice_p.h deleted file mode 100644 index 12cc193..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qnetworksettingsservice_p.h +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QNETWORKSETTINGSSERVICEPRIVATE_H -#define QNETWORKSETTINGSSERVICEPRIVATE_H - -#include -#include "qnetworksettings.h" -#include "qnetworksettingsservice.h" - -class QNetworkSettingsManagerPrivate; - -class QNetworkSettingsServicePrivate : public QObject -{ - Q_OBJECT - Q_DECLARE_PUBLIC(QNetworkSettingsService) -public: - QNetworkSettingsServicePrivate(const QString& aServiceId, QNetworkSettingsService *parent=0); - void setManager(QNetworkSettingsManagerPrivate *manager); - QNetworkSettingsService *q_ptr; - - void setAutoConnect(const bool autoconnect); - void setupIpv4Config(); - void setupIpv6Config(); - void setupNameserversConfig(); - void setupDomainsConfig(); - void setupQNetworkSettingsProxy(); - void connectService(); - void disconnectService(); - - QString m_id; - QString m_name; - QNetworkSettingsState m_state; - QNetworkSettingsIPv4 m_ipv4config; - QNetworkSettingsIPv6 m_ipv6config; - QNetworkSettingsAddressModel m_domainsConfig; - QNetworkSettingsAddressModel m_nameserverConfig; - QNetworkSettingsProxy m_proxyConfig; - QNetworkSettingsWireless m_wifiConfig; - QNetworkSettingsType m_type; - QNetworkSettingsManagerPrivate *m_manager; //Not owned -}; - -class WpaSupplicantService : public QNetworkSettingsService -{ - Q_OBJECT -public: - explicit WpaSupplicantService(QNetworkSettingsManagerPrivate* manager, QObject* parent=0); - void setId(const QString& aId); - void setName(const QString& aName); - void setFlags(const QString& aFlags); - void setState(QNetworkSettingsState::States aState); -}; - -#endif // QNETWORKSETTINGSSERVICEPRIVATE_H diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qnetworksettingsuseragent_p.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qnetworksettingsuseragent_p.cpp deleted file mode 100644 index 4e636c0..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qnetworksettingsuseragent_p.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "qnetworksettingsuseragent_p.h" - -QNetworkSettingsUserAgentPrivate::QNetworkSettingsUserAgentPrivate(QNetworkSettingsUserAgent* parent) - :QObject(parent) - ,q_ptr(parent) -{ - -} - -void QNetworkSettingsUserAgentPrivate::setUserCredentials(const QString& aUsername, const QString& aPassword) -{ - Q_Q(QNetworkSettingsUserAgent); - m_passphrase = aPassword; - m_username = aUsername; - emit q->ready(false); -} - -void QNetworkSettingsUserAgentPrivate::cancel() -{ - Q_Q(QNetworkSettingsUserAgent); - emit q->ready(true); -} diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qnetworksettingsuseragent_p.h b/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qnetworksettingsuseragent_p.h deleted file mode 100644 index fc717dc..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qnetworksettingsuseragent_p.h +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef QNETWORKSETTINGSUSERAGENTPRIVATE_H -#define QNETWORKSETTINGSUSERAGENTPRIVATE_H - -#include -#include "qnetworksettingsuseragent.h" - -class QNetworkSettingsUserAgentPrivate : public QObject -{ - Q_OBJECT - Q_DECLARE_PUBLIC(QNetworkSettingsUserAgent) -public: - explicit QNetworkSettingsUserAgentPrivate(QNetworkSettingsUserAgent* parent); - virtual ~QNetworkSettingsUserAgentPrivate() {} - void setUserCredentials(const QString& aUsername, const QString& aPassword); - void cancel(); - QString m_passphrase; - QString m_username; - QNetworkSettingsUserAgent *q_ptr; -}; - -#endif // QNETWORKSETTINGSUSERAGENTPRIVATE_H diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qwificontroller.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qwificontroller.cpp deleted file mode 100644 index 8e6cfff..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qwificontroller.cpp +++ /dev/null @@ -1,285 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use the contact form at -** http://www.qt.io -** -** This file is part of Qt Enterprise Embedded. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** the contact form at http://www.qt.io -** -****************************************************************************/ -#include "qwificontroller_p.h" -#include "qnetworksettingsmanager_p.h" -#include "qwifisupplicant_p.h" -#include "qwifidevice.h" - -#include -#include - -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -Q_LOGGING_CATEGORY(B2QT_WIFI, "qt.b2qt.wifi") - -class QWifiEventThread : public QThread -{ -public: - QWifiEventThread(QWifiController *controller) - : m_controller(controller) - { - } - - void run() { - qCDebug(B2QT_WIFI) << "running wifi event thread"; - QWifiEvent *event = 0; - char buffer[2048]; - forever { - int size = m_controller->supplicant()->waitForEvent(buffer, sizeof(buffer) - 1); - if (size > 0) { - buffer[size] = 0; - event = 0; - qCDebug(B2QT_WIFI) << "[event]: " << buffer; - - if (m_controller->isWifiThreadExitRequested()) { - qCDebug(B2QT_WIFI) << "exit wifi event thread"; - return; - } - - if (strstr(buffer, "SCAN-RESULTS")) { - event = new QWifiEvent(WIFI_SCAN_RESULTS); - } else if (strstr(buffer, "CTRL-EVENT-CONNECTED")) { - event = new QWifiEvent(WIFI_CONNECTED); - } else if (strstr(buffer, "CTRL-EVENT-DISCONNECTED")) { - event = new QWifiEvent(WIFI_DISCONNECTED); - } else if (strstr(buffer, "Trying to associate")) { - event = new QWifiEvent(WIFI_AUTHENTICATING, QLatin1String(buffer)); - } else if (strstr(buffer, "Handshake failed")) { - event = new QWifiEvent(WIFI_HANDSHAKE_FAILED); - } - - if (event) { - QCoreApplication::postEvent(m_controller->manager(), event); - } - } - } - } - -private: - QWifiController *m_controller; -}; - - -QWifiController::QWifiController(QNetworkSettingsManagerPrivate *manager) : - m_manager(manager), - m_exitEventThread(false), - m_interface(QWifiDevice::wifiInterfaceName()), - m_eventThread(new QWifiEventThread(this)), - m_supplicant(new QWifiSupplicant(this)) -{ - qRegisterMetaType("BackendState"); - connect(m_supplicant, &QWifiSupplicant::raiseError, this, &QWifiController::raiseError); -} - -QWifiController::~QWifiController() -{ - exitWifiEventThread(); - delete m_eventThread; -} - -void QWifiController::run() -{ - qCDebug(B2QT_WIFI) << "running wifi backend controller thread"; - Method method; - forever { - m_methodsMutex.lock(); - if (m_methods.isEmpty()) - methodCallRequested.wait(&m_methodsMutex); - method = m_methods.takeFirst(); - m_methodsMutex.unlock(); - switch (method) { - case InitializeBackend: - initializeBackend(); - break; - case TerminateBackend: - terminateBackend(); - break; - case AcquireIPAddress: - acquireIPAddress(); - break; - case StopDhcp: - stopDhcp(); - break; - case ExitEventLoop: - qCDebug(B2QT_WIFI) << "exit wifi backend controller thread"; - return; - } - } -} - -void QWifiController::asyncCall(Method method) -{ - QMutexLocker locker(&m_methodsMutex); - m_methods.append(method); - methodCallRequested.wakeOne(); -} - -void QWifiController::initializeBackend() -{ - qCDebug(B2QT_WIFI) << "initializing wifi backend"; - emit backendStateChanged(QWifiController::Initializing); - - QProcess rfkill; - rfkill.start(QStringLiteral("rfkill"), - QStringList() << QStringLiteral("unblock") << QStringLiteral("wifi")); - rfkill.waitForFinished(); - - QProcess ifconfig; - ifconfig.start(QStringLiteral("ifconfig"), - QStringList() << QLatin1String(m_interface) << QStringLiteral("up")); - if (!ifconfig.waitForStarted()) { - emit raiseError(ifconfig.program() + QLatin1String(": ") + ifconfig.errorString()); - return; - } - - ifconfig.waitForFinished(); - bool initFailed = false; - QByteArray error = ifconfig.readAllStandardError(); - if (!error.isEmpty()) { - emit raiseError(QLatin1String("failed to bring up wifi interface: " + error)); - initFailed = true; - } - if (!initFailed && resetSupplicantSocket()) - emit backendStateChanged(QWifiController::Running); - else - emit backendStateChanged(QWifiController::NotRunning); -} - -bool QWifiController::resetSupplicantSocket() -{ - qCDebug(B2QT_WIFI) << "reset supplicant socket"; - exitWifiEventThread(); - m_supplicant->stopSupplicant(); - m_supplicant->closeSupplicantConnection(); - if (!m_supplicant->startSupplicant()) - return false; - if (!m_supplicant->connectToSupplicant()) - return false; - - startWifiEventThread(); - return true; -} - -void QWifiController::terminateBackend() -{ - qCDebug(B2QT_WIFI) << "terminating wifi backend"; - emit backendStateChanged(QWifiController::Terminating); - - exitWifiEventThread(); - m_supplicant->stopSupplicant(); - m_supplicant->closeSupplicantConnection(); - - QProcess ifconfig; - ifconfig.start(QStringLiteral("ifconfig"), - QStringList() << QLatin1String(m_interface) << QStringLiteral("down")); - if (!ifconfig.waitForStarted()) { - emit raiseError(ifconfig.program() + QLatin1String(": ") + ifconfig.errorString()); - return; - } - - ifconfig.waitForFinished(); - QByteArray error = ifconfig.readAllStandardError(); - if (!error.isEmpty()) - emit raiseError(QLatin1String("failed to bring down wifi interface: " + error)); - - stopDhcp(); - emit backendStateChanged(QWifiController::NotRunning); -} - -void QWifiController::startWifiEventThread() -{ - m_exitEventThread = false; - m_eventThread->start(); -} - -void QWifiController::exitWifiEventThread() -{ - if (m_eventThread->isRunning()) { - m_exitEventThread = true; - m_manager->call(QStringLiteral("SCAN")); - if (!m_eventThread->wait(8000)) - qCWarning(B2QT_WIFI, "timed out waiting for wifi event thread to exit"); - } -} - -void QWifiController::killDhcpProcess(const QString &path) const -{ - QFile pidFile(path); - if (!pidFile.exists()) - return; - - if (!pidFile.open(QIODevice::ReadOnly)) { - qCWarning(B2QT_WIFI) << "could not open pid file: " << path; - return; - } - - bool ok; - int pid = pidFile.readAll().trimmed().toInt(&ok); - if (!ok) { - qCWarning(B2QT_WIFI) << "pid is not a number"; - return; - } - - kill(pid, 9); -} - -void QWifiController::acquireIPAddress() -{ - qCDebug(B2QT_WIFI, "acquireIPAddress"); - QString filePath = QLatin1String("/var/run/udhcpc." + m_interface + ".pid"); - killDhcpProcess(filePath); - QStringList args; - args << QStringLiteral("-R") << QStringLiteral("-n") << QStringLiteral("-p") - << filePath << QStringLiteral("-i") << QLatin1String(m_interface); - - QProcess udhcpc; - udhcpc.start(QStringLiteral("udhcpc"), args); - if (!udhcpc.waitForStarted()) { - emit raiseError(udhcpc.program() + QLatin1String(": ") + udhcpc.errorString()); - emit dhcpRequestFinished(QLatin1String("failed")); - return; - } - - udhcpc.waitForFinished(); - QByteArray error = udhcpc.readAllStandardError(); - QString status = QLatin1String("success"); - if (!error.isEmpty()) { - emit raiseError(QLatin1String("udhcpc failed: " + error)); - status = QLatin1String("failed"); - } else { - if (udhcpc.readAllStandardOutput().contains("No lease")) - status = QLatin1String("failed"); - } - - emit dhcpRequestFinished(status); -} - -void QWifiController::stopDhcp() const -{ - qCDebug(B2QT_WIFI, "stopDhcp"); - QString filePath = QLatin1String("/var/run/udhcpc." + m_interface + ".pid"); - killDhcpProcess(filePath); -} - -QT_END_NAMESPACE diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qwificontroller_p.h b/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qwificontroller_p.h deleted file mode 100644 index 902bc6e..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qwificontroller_p.h +++ /dev/null @@ -1,116 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use the contact form at -** http://www.qt.io -** -** This file is part of Qt Enterprise Embedded. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** the contact form at http://www.qt.io -** -****************************************************************************/ -#ifndef QWIFICONTROLLER_H -#define QWIFICONTROLLER_H - -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -Q_DECLARE_LOGGING_CATEGORY(B2QT_WIFI) - -const QEvent::Type WIFI_SCAN_RESULTS = (QEvent::Type) (QEvent::User + 2001); -const QEvent::Type WIFI_CONNECTED = (QEvent::Type) (QEvent::User + 2002); -const QEvent::Type WIFI_HANDSHAKE_FAILED = (QEvent::Type) (QEvent::User + 2003); -const QEvent::Type WIFI_AUTHENTICATING = (QEvent::Type) (QEvent::User + 2004); -const QEvent::Type WIFI_DISCONNECTED = (QEvent::Type) (QEvent::User + 2005); - -class QWifiEventThread; -class QWifiSupplicant; -class QNetworkSettingsManagerPrivate; - -class QWifiEvent : public QEvent -{ -public: - QWifiEvent(QEvent::Type type, const QString &data = QString()) - : QEvent(type) - , m_data(data) - { - } - QString data() const { return m_data; } - -private: - QString m_data; -}; - -class QWifiController : public QThread -{ - Q_OBJECT - Q_ENUMS(BackendState) -public: - enum Method { - InitializeBackend, - TerminateBackend, - AcquireIPAddress, - StopDhcp, - ExitEventLoop - }; - - enum BackendState { - Initializing, - Running, - Terminating, - NotRunning - }; - - explicit QWifiController(QNetworkSettingsManagerPrivate *manager); - ~QWifiController(); - - void asyncCall(Method method); - QNetworkSettingsManagerPrivate *manager() const { return m_manager; } - bool isWifiThreadExitRequested() const { return m_exitEventThread; } - void startWifiEventThread(); - void acquireIPAddress(); - void stopDhcp() const; - bool resetSupplicantSocket(); - QWifiSupplicant *supplicant() const { return m_supplicant; } - -signals: - void backendStateChanged(BackendState backendState); - void dhcpRequestFinished(const QString &status); - void raiseError(const QString &error); - -protected: - void run(); - void initializeBackend(); - void terminateBackend(); - void exitWifiEventThread(); - void killDhcpProcess(const QString &path) const; - -private: - QNetworkSettingsManagerPrivate *m_manager; //not owned - bool m_exitEventThread; - QByteArray m_interface; - QVector m_methods; - QWifiEventThread *m_eventThread; - QMutex m_methodsMutex; - QWaitCondition methodCallRequested; - QWifiSupplicant *m_supplicant; -}; - -Q_DECLARE_METATYPE(QWifiController::BackendState) - -QT_END_NAMESPACE - -#endif // QWIFICONTROLLER_H diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qwifidevice.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qwifidevice.cpp deleted file mode 100644 index a6812e7..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qwifidevice.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use the contact form at -** http://www.qt.io -** -** This file is part of Qt Enterprise Embedded. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** the contact form at http://www.qt.io -** -****************************************************************************/ -#include "qwifidevice.h" - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -/*! - \class QWifiDevice - \inmodule B2Qt.Wifi.Cpp - \ingroup wifi-cppclasses - \brief Represents a physical device. - - Use this class to query if a device is Wifi capable, before attempting - to use the functionality of QWifiManager. - - \code - QWifiManager *m_wifiManager = 0; - if (QWifiDevice::wifiSupported()) - m_wifiManager = QWifiManager::instance(); - - if (m_wifiManager) { - m_wifiManager->start(); - // and other wifi related code - } - \endcode - */ - -QWifiDevice::QWifiDevice() -{ -} - -QWifiDevice::~QWifiDevice() -{ -} - -/*! - Returns \c true if a device is Wifi capable - Wifi driver and firmware has been - successfully loaded by the system, otherwise returns \c false. -*/ -bool QWifiDevice::wifiSupported() -{ - QByteArray ifc = wifiInterfaceName(); - bool hasInterface = QDir().exists(QString::fromLatin1("/sys/class/net/" + ifc)); - if (!hasInterface) - qCWarning(B2QT_WIFI) << "could not find wifi interface in \"/sys/class/net/\", " - "looking for interface named: " << ifc; - return hasInterface; -} - -/*! - Returns Wifi interface name. - - Interface name is read from the \c B2QT_WIFI_INTERFACE - environment variable if it is set, otherwise, the default interface - name ("\e{wlan0}") is used. - - \sa setWifiInterfaceName() - */ -QByteArray QWifiDevice::wifiInterfaceName() -{ - return qEnvironmentVariableIsSet("B2QT_WIFI_INTERFACE") ? qgetenv("B2QT_WIFI_INTERFACE") : "wlan0"; -} - -/*! - A conveniece method to set the Wifi interface \a name. - - \sa wifiInterfaceName() - */ -void QWifiDevice::setWifiInterfaceName(const QByteArray &name) -{ - qputenv("B2QT_WIFI_INTERFACE", name); -} - -QT_END_NAMESPACE diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qwifidevice.h b/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qwifidevice.h deleted file mode 100644 index 80b4891..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qwifidevice.h +++ /dev/null @@ -1,44 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use the contact form at -** http://www.qt.io -** -** This file is part of Qt Enterprise Embedded. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** the contact form at http://www.qt.io -** -****************************************************************************/ -#ifndef QWIFIDEVICE_H -#define QWIFIDEVICE_H - -#include -#include -#include - -QT_BEGIN_NAMESPACE - -Q_DECLARE_LOGGING_CATEGORY(B2QT_WIFI) - -class Q_DECL_EXPORT QWifiDevice : public QObject -{ - Q_OBJECT -public: - explicit QWifiDevice(); - virtual ~QWifiDevice(); - - Q_INVOKABLE static bool wifiSupported(); - static QByteArray wifiInterfaceName(); - static void setWifiInterfaceName(const QByteArray &name); -}; - -QT_END_NAMESPACE - -#endif // QWIFIDEVICE_H diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qwifisupplicant.cpp b/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qwifisupplicant.cpp deleted file mode 100644 index 779475e..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qwifisupplicant.cpp +++ /dev/null @@ -1,443 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use the contact form at -** http://www.qt.io -** -** This file is part of Qt Enterprise Embedded. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** the contact form at http://www.qt.io -** -****************************************************************************/ -#include "qwifisupplicant_p.h" -#include "qwifidevice.h" - -#include -#include -#include -#include - -#include -#include - -QT_BEGIN_NAMESPACE - -Q_LOGGING_CATEGORY(B2QT_WIFI_VERBOSE, "qt.b2qt.wifi.verbose") - -#define CONFIG_FILE "/etc/wpa_supplicant.qtwifi.conf" -#define CONTROL_INTERFACE_PATH "/var/run/wpa_supplicant/" - -QWifiSupplicant::QWifiSupplicant(QObject *parent) : - QObject(parent), - ctrl_conn(0), - monitor_conn(0), - interface(QWifiDevice::wifiInterfaceName()) -{ - createSupplicantConfig(); -} - -void QWifiSupplicant::createSupplicantConfig() -{ - QFile supplicantConfig(QLatin1String(CONFIG_FILE)); - if (supplicantConfig.exists()) - return; - - if (supplicantConfig.open(QIODevice::WriteOnly)) { - supplicantConfig.write("ctrl_interface=" CONTROL_INTERFACE_PATH "\n" - "ctrl_interface_group=0\n" - "update_config=1\n"); - } else { - emit raiseError(QLatin1String("failed to create wpa_supplicant configuration file.")); - } -} - -bool QWifiSupplicant::startSupplicant() -{ - QString pidFile = QLatin1String("/var/run/wpa_supplicant." + interface + ".pid"); - QString driver(QStringLiteral("nl80211,wext")); - - QStringList arg; - arg << QStringLiteral("--start") << QStringLiteral("--quiet") << QStringLiteral("--name"); - arg << QStringLiteral("wpa_supplicant") << QStringLiteral("--startas"); - arg << QStringLiteral("/usr/sbin/wpa_supplicant") << QStringLiteral("--pidfile") << pidFile; - arg << QStringLiteral("--") << QStringLiteral("-B") << QStringLiteral("-P") << pidFile; - arg << QStringLiteral("-i") << QLatin1String(interface) << QStringLiteral("-c"); - arg << QLatin1String(CONFIG_FILE) << QStringLiteral("-D") << driver; - - QProcess startStopDaemon; - startStopDaemon.setProcessChannelMode(QProcess::MergedChannels); - startStopDaemon.start(QStringLiteral("start-stop-daemon"), arg); - if (!startStopDaemon.waitForStarted()) { - emit raiseError(startStopDaemon.program() + QLatin1String(": ") + startStopDaemon.errorString()); - return false; - } - startStopDaemon.waitForFinished(); - // if the interface socket exists then wpa-supplicant was invoked successfully - if (!QFile(QLatin1String(CONTROL_INTERFACE_PATH + interface)).exists()) { - emit raiseError(QLatin1String("failed to invoke wpa_supplicant: " - + startStopDaemon.readAll())); - return false; - } - // reset sockets used for exiting from hung state - exit_sockets[0] = exit_sockets[1] = -1; - return true; -} - -bool QWifiSupplicant::stopSupplicant() -{ - QString pidFile = QLatin1String("/var/run/wpa_supplicant." + interface + ".pid"); - - if (QFile(pidFile).exists()) { - QStringList arg; - arg << QStringLiteral("--stop") << QStringLiteral("--quiet") << QStringLiteral("--name"); - arg << QStringLiteral("wpa_supplicant") << QStringLiteral("--pidfile") << pidFile; - - QProcess startStopDaemon; - startStopDaemon.start(QStringLiteral("start-stop-daemon"), arg); - if (!startStopDaemon.waitForStarted()) { - emit raiseError(startStopDaemon.program() + QLatin1String(": ") + startStopDaemon.errorString()); - return false; - } - startStopDaemon.waitForFinished(); - QByteArray error = startStopDaemon.readAllStandardError(); - if (!error.isEmpty()) { - emit raiseError(QLatin1String("failed to stop a wpa_supplicant process" + error)); - return false; - } - - QFile::remove(pidFile); - } - - QFile::remove(QLatin1String(CONTROL_INTERFACE_PATH + interface)); - - // workaround for QTEE-957 - QProcess killall; - killall.start(QStringLiteral("killall"), QStringList() << QStringLiteral("-9") << QStringLiteral("wpa_supplicant")); - killall.waitForFinished(); - - return true; -} - -/*! \internal - * - wpa_supplicant socket communication code (Apache License 2.0) with few modifications - from https://android.googlesource.com/platform/hardware/libhardware_legacy/ - - */ -bool QWifiSupplicant::connectToSupplicant() -{ - static char path[4096]; - snprintf(path, sizeof(path), "%s/%s", CONTROL_INTERFACE_PATH, interface.constData()); - bool connected = true; - - ctrl_conn = wpa_ctrl_open(path); - if (ctrl_conn == NULL) { - qCWarning(B2QT_WIFI, "Unable to open connection to wpa_supplicant on \"%s\": %s", - path, strerror(errno)); - connected = false; - } - monitor_conn = wpa_ctrl_open(path); - if (monitor_conn == NULL) { - wpa_ctrl_close(ctrl_conn); - ctrl_conn = NULL; - connected = false; - } - if (wpa_ctrl_attach(monitor_conn) != 0) { - wpa_ctrl_close(monitor_conn); - wpa_ctrl_close(ctrl_conn); - ctrl_conn = monitor_conn = NULL; - connected = false; - } - - if (socketpair(AF_UNIX, SOCK_STREAM, 0, exit_sockets) == -1) { - wpa_ctrl_close(monitor_conn); - wpa_ctrl_close(ctrl_conn); - ctrl_conn = monitor_conn = NULL; - connected = false; - } - - if (!connected) - emit raiseError(QLatin1String("failed to connect to wpa_supplicant")); - return connected; -} - -void QWifiSupplicant::closeSupplicantConnection() -{ - if (ctrl_conn != NULL) { - wpa_ctrl_close(ctrl_conn); - ctrl_conn = NULL; - } - - if (monitor_conn != NULL) { - wpa_ctrl_close(monitor_conn); - monitor_conn = NULL; - } - - if (exit_sockets[0] >= 0) { - close(exit_sockets[0]); - exit_sockets[0] = -1; - } - - if (exit_sockets[1] >= 0) { - close(exit_sockets[1]); - exit_sockets[1] = -1; - } -} - -int QWifiSupplicant::waitForEvent(char *buf, size_t buflen) -{ - size_t nread = buflen - 1; - int result; - char *match, *match2; - - if (monitor_conn == NULL) - return snprintf(buf, buflen, WPA_EVENT_TERMINATING " - connection closed"); - - result = receiveEvent(buf, &nread); - - // Terminate reception on exit socket - if (result == -2) - return snprintf(buf, buflen, WPA_EVENT_TERMINATING " - connection closed"); - - if (result < 0) { - qCWarning(B2QT_WIFI, "receiveEvent failed: %s", strerror(errno)); - return snprintf(buf, buflen, WPA_EVENT_TERMINATING " - recv error"); - } - - buf[nread] = '\0'; - // Check for EOF on the socket - if (result == 0 && nread == 0) { - // Fabricate an event to pass up - qCWarning(B2QT_WIFI, "Received EOF on supplicant socket"); - return snprintf(buf, buflen, WPA_EVENT_TERMINATING " - signal 0 received"); - } - - /* - * Events strings are in the format - * - * IFNAME=iface CTRL-EVENT-XXX - * or - * CTRL-EVENT-XXX - * - * where N is the message level in numerical form (0=VERBOSE, 1=DEBUG, - * etc.) and XXX is the event name. The level information is not useful - * to us, so strip it off. - */ - - if (strncmp(buf, "IFNAME=", (sizeof("IFNAME=") - 1)) == 0) { - match = strchr(buf, ' '); - if (match != NULL) { - if (match[1] == '<') { - match2 = strchr(match + 2, '>'); - if (match2 != NULL) { - nread -= (match2 - match); - memmove(match + 1, match2 + 1, nread - (match - buf) + 1); - } - } - } else { - return snprintf(buf, buflen, "%s", "CTRL-EVENT-IGNORE "); - } - } else if (buf[0] == '<') { - match = strchr(buf, '>'); - if (match != NULL) { - nread -= (match + 1 - buf); - memmove(buf, match + 1, nread + 1); - //qCWarning(B2QT_WIFI, "supplicant generated event without interface - %s", buf); - } - } else { - // let the event go as is! - qCWarning(B2QT_WIFI, "supplicant generated event without interface and without message level - %s", buf); - } - - return nread; -} - -bool QWifiSupplicant::sendCommand(const QString &command, QByteArray *reply) -{ - QByteArray cmd = command.toLocal8Bit(); - qCDebug(B2QT_WIFI) << "[command]: " << cmd; - - if (ctrl_conn == NULL) { - qCWarning(B2QT_WIFI, "Not connected to wpa_supplicant"); - return false; - } - - char data[8192]; - size_t len = sizeof(data) - 1; // -1: room to add a 0-terminator - int ret = wpa_ctrl_request(ctrl_conn, cmd, strlen(cmd), data, &len, NULL); - if (ret == -2) { - qCWarning(B2QT_WIFI) << "command timed out"; - // unblocks the monitor receive socket for termination - TEMP_FAILURE_RETRY(write(exit_sockets[0], "T", 1)); - return false; - } else if (ret < 0 || strncmp(data, "FAIL", 4) == 0) { - return false; - } - - if (len == sizeof(data) - 1) { - qCWarning(B2QT_WIFI) << "possible buffer overflow detected"; - return false; - } - - data[len] = 0; - qCDebug(B2QT_WIFI_VERBOSE) << "[response]: " << data; - *reply = QByteArray(data, len); - - return true; -} - -int QWifiSupplicant::receiveEvent(char *reply, size_t *reply_len) -{ - int res = 0; - int ctrlfd = wpa_ctrl_get_fd(monitor_conn); - struct pollfd rfds[2]; - - memset(rfds, 0, 2 * sizeof(struct pollfd)); - rfds[0].fd = ctrlfd; - rfds[0].events |= POLLIN; - rfds[1].fd = exit_sockets[1]; - rfds[1].events |= POLLIN; - res = TEMP_FAILURE_RETRY(poll(rfds, 2, -1)); - if (res < 0) { - qCWarning(B2QT_WIFI, "Error poll = %d", res); - return res; - } - if (rfds[0].revents & POLLIN) { - return wpa_ctrl_recv(monitor_conn, reply, reply_len); - } - - /* it is not rfds[0], then it must be rfts[1] (i.e. the exit socket) - * or we timed out. In either case, this call has failed .. - */ - return -2; -} - -static inline int hex2num(char c) -{ - if (c >= '0' && c <= '9') - return c - '0'; - if (c >= 'a' && c <= 'f') - return c - 'a' + 10; - if (c >= 'A' && c <= 'F') - return c - 'A' + 10; - return -1; -} - -static inline int hex2byte(const char *hex) -{ - int a, b; - a = hex2num(*hex++); - if (a < 0) - return -1; - b = hex2num(*hex++); - if (b < 0) - return -1; - return (a << 4) | b; -} - -static inline int printf_decode(char *buf, int maxlen, const char *str) -{ - const char *pos = str; - int len = 0; - int val; - - while (*pos) { - if (len + 1 >= maxlen) - break; - switch (*pos) { - case '\\': - pos++; - switch (*pos) { - case '\\': - buf[len++] = '\\'; - pos++; - break; - case '"': - buf[len++] = '"'; - pos++; - break; - case 'n': - buf[len++] = '\n'; - pos++; - break; - case 'r': - buf[len++] = '\r'; - pos++; - break; - case 't': - buf[len++] = '\t'; - pos++; - break; - case 'e': - buf[len++] = '\033'; - pos++; - break; - case 'x': - pos++; - val = hex2byte(pos); - if (val < 0) { - val = hex2num(*pos); - if (val < 0) - break; - buf[len++] = val; - pos++; - } else { - buf[len++] = val; - pos += 2; - } - break; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - val = *pos++ - '0'; - if (*pos >= '0' && *pos <= '7') - val = val * 8 + (*pos++ - '0'); - if (*pos >= '0' && *pos <= '7') - val = val * 8 + (*pos++ - '0'); - buf[len++] = val; - break; - default: - break; - } - break; - default: - buf[len++] = *pos++; - break; - } - } - if (maxlen > len) - buf[len] = '\0'; - - return len; -} - -/*! \internal - * - Decode wpa_supplicant encoded string, see file hostapd/src/utils/common.c - in git://w1.fi/hostap.git repository. - - For Ascii encoded string, any octet < 32 or > 127 is encoded as a "\\x" - followed by the hex representation of the octet. Exception chars are ", - \\, \\e, \\n, \\r, \\t which are escaped by a backslash - - */ -QString QWifiSupplicant::decodeSsid(const QString &encoded) -{ - static char ssid[2048]; - printf_decode(ssid, sizeof(ssid), encoded.toLatin1().constData()); - return QString::fromUtf8(ssid); -} - -QT_END_NAMESPACE diff --git a/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qwifisupplicant_p.h b/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qwifisupplicant_p.h deleted file mode 100644 index 13855c0..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettings/wpasupplicant/qwifisupplicant_p.h +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Digia Plc -** All rights reserved. -** For any questions to Digia, please use the contact form at -** http://www.qt.io -** -** This file is part of Qt Enterprise Embedded. -** -** Licensees holding valid Qt Enterprise licenses may use this file in -** accordance with the Qt Enterprise License Agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. -** -** If you have questions regarding the use of this file, please use -** the contact form at http://www.qt.io -** -****************************************************************************/ -#ifndef QWIFISUPPLICANT_H -#define QWIFISUPPLICANT_H - -#include -#include -#include - -#include "wpa-supplicant/wpa_ctrl.h" - -QT_BEGIN_NAMESPACE - -Q_DECLARE_LOGGING_CATEGORY(B2QT_WIFI) -Q_DECLARE_LOGGING_CATEGORY(B2QT_WIFI_VERBOSE) - -class QWifiManagerPrivate; - -class QWifiSupplicant : public QObject -{ - Q_OBJECT -public: - explicit QWifiSupplicant(QObject *parent); - - void createSupplicantConfig(); - bool startSupplicant(); - bool stopSupplicant(); - bool connectToSupplicant(); - void closeSupplicantConnection(); - int waitForEvent(char *buf, size_t buflen); - bool sendCommand(const QString &command, QByteArray *reply); - static QString decodeSsid(const QString &encoded); - -signals: - void raiseError(const QString& error); - -protected: - int receiveEvent(char *reply, size_t *reply_len); - -private: - wpa_ctrl *ctrl_conn; - wpa_ctrl *monitor_conn; - int exit_sockets[2]; - QByteArray interface; -}; - -QT_END_NAMESPACE - -#endif // QWIFISUPPLICANT_H diff --git a/src/qtdevicesettings/networksettingsplugin/networksettingsplugin.pro b/src/qtdevicesettings/networksettingsplugin/networksettingsplugin.pro deleted file mode 100644 index 1fb23e6..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettingsplugin.pro +++ /dev/null @@ -1,74 +0,0 @@ -TEMPLATE = lib -TARGET = networksettingsplugin -QT += qml quick -CONFIG += qt plugin - -uri = com.theqtcompany.settings.network - -wpasupplicant { - include(networksettings/wpasupplicant.pri) -} -else { - include(networksettings/connman.pri) -} - - -INCLUDEPATH += $${PWD}/networksettings - -# Input -SOURCES += \ - networksettingsplugin_plugin.cpp \ - networksettings/qnetworksettingsinterfacemodel.cpp \ - networksettings/qnetworksettingsmanager.cpp \ - networksettings/qnetworksettingsaddressmodel.cpp \ - networksettings/qnetworksettingsservicemodel.cpp \ - networksettings/qnetworksettingsservice.cpp \ - networksettings/qnetworksettingsuseragent.cpp \ - networksettings/qnetworksettingsinterface.cpp \ - -HEADERS += \ - networksettingsplugin_plugin.h \ - networksettings/qnetworksettingsinterfacemodel.h \ - networksettings/qnetworksettings.h \ - networksettings/qnetworksettingsmanager.h \ - networksettings/qnetworksettingsaddressmodel.h \ - networksettings/qnetworksettingsservicemodel.h \ - networksettings/qnetworksettingsservice.h \ - networksettings/qnetworksettingsuseragent.h \ - networksettings/qnetworksettingsinterface.h \ - -DISTFILES = qmldir - -!equals(_PRO_FILE_PWD_, $$OUT_PWD) { - copy_qmldir.target = $$OUT_PWD/qmldir - copy_qmldir.depends = $$_PRO_FILE_PWD_/qmldir - copy_qmldir.commands = $(COPY_FILE) \"$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)\" - QMAKE_EXTRA_TARGETS += copy_qmldir - PRE_TARGETDEPS += $$copy_qmldir.target -} - -qmldir.files = qmldir - -pluginfiles.files += \ - imports/NetworkSettings/EditWiredSettings.qml \ - imports/NetworkSettings/NetworkDetails.qml \ - imports/NetworkSettings/WifiSettings.qml \ - imports/NetworkSettings/IpAddressTextField.qml \ - imports/NetworkSettings/NetworkSettings.qml \ - imports/NetworkSettings/WiredSettings.qml \ - imports/NetworkSettings/WifiSelectorDelegate.qml \ - imports/NetworkSettings/WifiSignalMonitor.qml \ - ../icons/WifiAnim_black_2x.png \ - ../icons/WifiAnim_qt_2x.png \ - ../icons/Wifi_lightgray_2x.png \ - -installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /) - -pluginfiles.path = $$installPath -qmldir.path = $$installPath -target.path = $$installPath -INSTALLS += target qmldir pluginfiles - -RESOURCES += \ - icons.qrc - diff --git a/src/qtdevicesettings/networksettingsplugin/networksettingsplugin_plugin.cpp b/src/qtdevicesettings/networksettingsplugin/networksettingsplugin_plugin.cpp deleted file mode 100644 index badb5ef..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettingsplugin_plugin.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "networksettingsplugin_plugin.h" -#include "qnetworksettings.h" -#include "qnetworksettingsmanager.h" -#include "qnetworksettingsservice.h" -#include "qnetworksettingsuseragent.h" - -#include -#include -#include - -void NetworksettingspluginPlugin::registerTypes(const char *uri) -{ - Q_ASSERT(QLatin1String(uri) == QLatin1String("com.theqtcompany.settings.network")); - qmlRegisterUncreatableType(uri, 1, 0, "NetworkService", "Cannot be instantiated directly."); - qmlRegisterUncreatableType(uri, 1, 0, "NetworkSettingsIPv4", "Cannot be instantiated directly."); - qmlRegisterUncreatableType(uri, 1, 0, "NetworkSettingsIPv6", "Cannot be instantiated directly."); - qmlRegisterUncreatableType(uri, 1, 0, "NetworkSettingsProxy", "Cannot be instantiated directly."); - qmlRegisterUncreatableType(uri, 1, 0, "NetworkSettingsType", "Cannot be instantiated directly."); - qmlRegisterUncreatableType(uri, 1, 0, "NetworkSettingsState", "Cannot be instantiated directly."); -} - - -void NetworksettingspluginPlugin::initializeEngine(QQmlEngine * engine, const char * uri) -{ - Q_ASSERT(QLatin1String(uri) == QLatin1String("com.theqtcompany.settings.network")); - QNetworkSettingsManager* networkManager = new QNetworkSettingsManager(engine); - QNetworkSettingsUserAgent* userAgent = new QNetworkSettingsUserAgent(engine); - networkManager->setUserAgent(userAgent); - - engine->rootContext()->setContextProperty("NetworkSettingsManager", networkManager); - engine->rootContext()->setContextProperty("NetworkSettingsUserAgent", userAgent); -} diff --git a/src/qtdevicesettings/networksettingsplugin/networksettingsplugin_plugin.h b/src/qtdevicesettings/networksettingsplugin/networksettingsplugin_plugin.h deleted file mode 100644 index f47b964..0000000 --- a/src/qtdevicesettings/networksettingsplugin/networksettingsplugin_plugin.h +++ /dev/null @@ -1,52 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef NETWORKSETTINGSPLUGIN_PLUGIN_H -#define NETWORKSETTINGSPLUGIN_PLUGIN_H - -#include - -class NetworksettingspluginPlugin : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") - -public: - void registerTypes(const char *uri); - void initializeEngine(QQmlEngine * engine, const char * uri); -}; - -#endif // NETWORKSETTINGSPLUGIN_PLUGIN_H - diff --git a/src/qtdevicesettings/networksettingsplugin/qml.qrc b/src/qtdevicesettings/networksettingsplugin/qml.qrc deleted file mode 100644 index 87c3639..0000000 --- a/src/qtdevicesettings/networksettingsplugin/qml.qrc +++ /dev/null @@ -1,10 +0,0 @@ - - - qml/EditWiredSettings.qml - qml/IpAddressTextField.qml - qml/NetworkDetails.qml - qml/NetworkSettings.qml - qml/WifiSettings.qml - qml/WiredSettings.qml - - diff --git a/src/qtdevicesettings/networksettingsplugin/qmldir b/src/qtdevicesettings/networksettingsplugin/qmldir deleted file mode 100644 index 71f3726..0000000 --- a/src/qtdevicesettings/networksettingsplugin/qmldir +++ /dev/null @@ -1,4 +0,0 @@ -module com.theqtcompany.settings.network -NetworkSettings 1.0 NetworkSettings.qml -plugin networksettingsplugin - diff --git a/src/qtdevicesettings/qtdevicesettings.pro b/src/qtdevicesettings/qtdevicesettings.pro deleted file mode 100644 index c49e6fb..0000000 --- a/src/qtdevicesettings/qtdevicesettings.pro +++ /dev/null @@ -1,11 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS += \ - settingscomponents \ - networksettingsplugin \ - generalsettingsplugin \ - timedateplugin \ - settingsui \ - localesettingsplugin \ - bluetoothsettingsplugin \ - -CONFIG += ordered diff --git a/src/qtdevicesettings/settingscomponents/icons.qrc b/src/qtdevicesettings/settingscomponents/icons.qrc deleted file mode 100644 index d6ff9da..0000000 --- a/src/qtdevicesettings/settingscomponents/icons.qrc +++ /dev/null @@ -1,21 +0,0 @@ - - - imports/Settings/Back.png - imports/Settings/Chevron-left.png - imports/Settings/Chevron-right.png - imports/Settings/Circle-x.png - imports/Settings/Cogs.png - imports/Settings/Connections.png - imports/Settings/Display.png - imports/Settings/Lock.png - imports/Settings/Plus.png - imports/Settings/Settings.png - imports/Settings/Wifi.png - imports/Settings/World.png - imports/Settings/Wrench.png - imports/Settings/Chevron-left-med.png - imports/Settings/Chevron-left-big.png - imports/Settings/Settings-big.png - imports/Settings/Connections-big.png - - diff --git a/src/qtdevicesettings/settingscomponents/imports/Settings/CustomCombobox.qml b/src/qtdevicesettings/settingscomponents/imports/Settings/CustomCombobox.qml deleted file mode 100644 index 37c7871..0000000 --- a/src/qtdevicesettings/settingscomponents/imports/Settings/CustomCombobox.qml +++ /dev/null @@ -1,185 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.5 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles.Flat 1.0 as Flat -import QtQml.Models 2.1 - -Item { - id: control - property alias popupParent: popupView.parent - property bool popupVisible: popupView.visible - property int selectedIndex: -1 - property alias model: comboboxModel.model - property string textRole: "text" - property bool modified: false - property alias popupVisibility: popupView.visible - property alias textValue: label.text - property int popupHeight: comboboxModel.items.count * height - property bool enabled: true - property bool editable: true - property Component delegate - - implicitWidth: Math.round(100 * Flat.FlatStyle.scaleFactor) - implicitHeight: Math.round(26 * Flat.FlatStyle.scaleFactor) - - Component.onCompleted: { - //Find root window for parent - var p = control.parent - while (p.parent) { - p = p.parent; - } - popupParent = p; - } - - function hide() { - popupView.visible = false - button.checked = false - } - - function setSelectIndexToVal(value, role) { - if (model) { - for (var i=0, len=comboboxModel.items.count;i=0 ? comboboxModel.items.count>0 ? comboboxModel.items.get(selectedIndex).model[textRole]:"":"" - } - - Flat.LeftArrowIcon { - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - anchors.rightMargin: Math.round(10 * Flat.FlatStyle.scaleFactor) - width: Math.round(14 * Flat.FlatStyle.scaleFactor) - height: Math.round(14 * Flat.FlatStyle.scaleFactor) - rotation: popupVisibility ? 90 : -90 - color: button.hovered || button.checked ? Flat.FlatStyle.selectedTextColor:Flat.FlatStyle.styleColor - opacity: control.enabled || control.editable ? 1.0 : 0.2 - } - } - - Item { - id: popupView - y: 0 - x: 0 - height: control.popupHeight - width: control.width - visible: false - onVisibleChanged: { - if (visible) { - var pos = control.mapToItem(popupView.parent, 0, 0) - x = pos.x - y = pos.y + button.height - - if (y + control.popupHeight > popupParent.height) { - y = popupParent.height - control.popupHeight; - } - } - } - - Rectangle { - anchors.fill: parent - border.color: Flat.FlatStyle.darkFrameColor - border.width: 1 - color: "white" - - Column { - ExclusiveGroup { - id: exgroup - } - - DelegateModel { - id: comboboxModel - delegate: comboboxDelegate - } - - Repeater { - id: comboboxView - model: comboboxModel - } - } - } - } - - Component { - id: comboboxDelegate - Item { - id: comboboxViewDelegate - property bool checked - width: control.width - height: control.height - - Loader { - id: loader - sourceComponent: delegate - anchors.fill: parent - property var modelData: model - property string textRole: textRole - onLoaded : exgroup.bindCheckable(item) - } - - Connections { - target: loader.item - onClicked: { - popupView.visible = false; - button.checked = false - selectedIndex = index - } - } - } - } -} diff --git a/src/qtdevicesettings/settingscomponents/imports/Settings/FlatStyledDropdownDelegate.qml b/src/qtdevicesettings/settingscomponents/imports/Settings/FlatStyledDropdownDelegate.qml deleted file mode 100644 index c1bd24c..0000000 --- a/src/qtdevicesettings/settingscomponents/imports/Settings/FlatStyledDropdownDelegate.qml +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.5 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles.Flat 1.0 as Flat - -Item { - id: root - property bool checkable: true - property bool checked: false - property bool pressed: false - signal clicked() - - MouseArea { - id: delegateButton - anchors.fill: parent - hoverEnabled: true - - onPressed: root.pressed = true - onClicked: root.clicked(); - onEntered: checked = !checked; - - Rectangle { - anchors.fill: parent - color: root.checked ? Flat.FlatStyle.disabledColor : "transparent" - opacity: root.checked ? 0.15 : 1.0 - } - Rectangle { - color: Flat.FlatStyle.darkFrameColor - width: parent.width - height: Flat.FlatStyle.onePixel - anchors.bottom: parent.bottom - } - TextLabel { - anchors.left: parent.left - anchors.right: parent.right - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.margins: Math.round(10 * Flat.FlatStyle.scaleFactor) - horizontalAlignment: Text.AlignLeft - text: modelData.name - } - } -} diff --git a/src/qtdevicesettings/settingscomponents/imports/Settings/IconButton.qml b/src/qtdevicesettings/settingscomponents/imports/Settings/IconButton.qml deleted file mode 100644 index 898e5e0..0000000 --- a/src/qtdevicesettings/settingscomponents/imports/Settings/IconButton.qml +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.5 - -MouseArea { - id: root - property alias pressedIcon: pressedImage.source - property alias releasedIcon: releasedImage.source - width: pressedImage.sourceSize.width - height: pressedImage.sourceSize.height - - Image { - id: pressedImage - visible: root.pressed - } - - Image { - id: releasedImage - visible: !root.pressed - } -} diff --git a/src/qtdevicesettings/settingscomponents/imports/Settings/TextLabel.qml b/src/qtdevicesettings/settingscomponents/imports/Settings/TextLabel.qml deleted file mode 100644 index e9f5d12..0000000 --- a/src/qtdevicesettings/settingscomponents/imports/Settings/TextLabel.qml +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.5 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles.Flat 1.0 as Flat - -Text { - color: systemPalette.text - font.family: Flat.FlatStyle.fontFamily - font.pixelSize: Math.round(12 * Flat.FlatStyle.scaleFactor) - renderType: Text.QtRendering - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter -} diff --git a/src/qtdevicesettings/settingscomponents/imports/Settings/qmldir b/src/qtdevicesettings/settingscomponents/imports/Settings/qmldir deleted file mode 100644 index 2810983..0000000 --- a/src/qtdevicesettings/settingscomponents/imports/Settings/qmldir +++ /dev/null @@ -1,5 +0,0 @@ -module com.theqtcompany.settings.common -TextLabel 1.0 TextLabel.qml -IconButton 1.0 IconButton.qml -CustomCombobox 1.0 CustomCombobox.qml -FlatStyledDropdownDelegate 1.0 FlatStyledDropdownDelegate.qml diff --git a/src/qtdevicesettings/settingscomponents/settingscomponents.pro b/src/qtdevicesettings/settingscomponents/settingscomponents.pro deleted file mode 100644 index 9d2567e..0000000 --- a/src/qtdevicesettings/settingscomponents/settingscomponents.pro +++ /dev/null @@ -1,26 +0,0 @@ -TEMPLATE = lib -CONFIG += plugin -QT += qml - -uri = com.theqtcompany.settings.common - -DESTDIR = imports/Settings -TARGET = qmlsettingsplugin - -pluginfiles.files += \ - imports/Settings/qmldir \ - imports/Settings/TextLabel.qml \ - imports/Settings/IconButton.qml \ - imports/Settings/CustomCombobox.qml \ - imports/Settings/FlatStyledDropdownDelegate.qml - -installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /) - -target.path = $$installPath -pluginfiles.path += $$installPath -INSTALLS += target pluginfiles - -RESOURCES += - -DISTFILES += - diff --git a/src/qtdevicesettings/settingsui/deployment.pri b/src/qtdevicesettings/settingsui/deployment.pri deleted file mode 100644 index 5441b63..0000000 --- a/src/qtdevicesettings/settingsui/deployment.pri +++ /dev/null @@ -1,27 +0,0 @@ -android-no-sdk { - target.path = /data/user/qt - export(target.path) - INSTALLS += target -} else:android { - x86 { - target.path = /libs/x86 - } else: armeabi-v7a { - target.path = /libs/armeabi-v7a - } else { - target.path = /libs/armeabi - } - export(target.path) - INSTALLS += target -} else:unix { - isEmpty(target.path) { - qnx { - target.path = /tmp/$${TARGET}/bin - } else { - target.path = /opt/$${TARGET}/bin - } - export(target.path) - } - INSTALLS += target -} - -export(INSTALLS) diff --git a/src/qtdevicesettings/settingsui/icons.qrc b/src/qtdevicesettings/settingsui/icons.qrc deleted file mode 100644 index 8656aa4..0000000 --- a/src/qtdevicesettings/settingsui/icons.qrc +++ /dev/null @@ -1,12 +0,0 @@ - - - ../icons/Chevron-left_black_1x.png - ../icons/Power_black_1x.png - ../icons/Display_qt_6x.png - ../icons/Clock_qt_6x.png - ../icons/Flag_qt_6x.png - ../icons/World_qt_6x.png - ../icons/Audio_qt_6x.png - ../icons/Bluetooth_qt_6x.png - - diff --git a/src/qtdevicesettings/settingsui/main.cpp b/src/qtdevicesettings/settingsui/main.cpp deleted file mode 100644 index b345225..0000000 --- a/src/qtdevicesettings/settingsui/main.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the FOO module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -int main(int argc, char *argv[]) -{ - QGuiApplication app(argc, argv); - - QQmlApplicationEngine engine; - engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); - - return app.exec(); -} diff --git a/src/qtdevicesettings/settingsui/main.qml b/src/qtdevicesettings/settingsui/main.qml deleted file mode 100644 index 4c8080a..0000000 --- a/src/qtdevicesettings/settingsui/main.qml +++ /dev/null @@ -1,170 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the FOO module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 or (at your option) any later version -** approved by the KDE Free Qt Foundation. The licenses are as published by -** the Free Software Foundation and appearing in the file LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.5 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles.Flat 1.0 as Flat -import QtQuick.XmlListModel 2.0 -import com.theqtcompany.settings.common 1.0 - -ApplicationWindow { - id: root - title: qsTr("Device settings") - width: 800 - height: 600 - visible: true - property var service - - SystemPalette { id: systemPalette; colorGroup: SystemPalette.Active } - - toolBar:ToolBar { - id: titlebar - property string title: "" - implicitWidth: parent.width - implicitHeight: Math.round(40 * Flat.FlatStyle.scaleFactor) - Item { - anchors.fill: parent - - ToolButton { - iconSource: "../icons/Chevron-left_black_1x.png" - text: "" - visible: stackView.depth > 1 - height: parent.height - width: parent.height - onClicked: stackView.pop(); - } - TextLabel { - id: titleText - font.pixelSize: Math.round(16 * Flat.FlatStyle.scaleFactor) - anchors.fill: parent - text: stackView.currentItem.title - } - - - ToolButton { - iconSource: "../icons/Power_black_1x.png" - text: "" - visible: stackView.depth == 1 - height: parent.height - width: parent.height - anchors.right: parent.right - onClicked: { - menu.__xOffset = Math.round(-100 * Flat.FlatStyle.scaleFactor); - menu.popup(); - } - } - } - } - - Menu { - id: menu - title: "" - enabled: false - - MenuItem { - text: qsTr("Reboot") - onTriggered: B2QtDevice.reboot() - } - - MenuItem { - text: qsTr("Shutdown") - onTriggered: B2QtDevice.powerOff() - } - } - - StackView { - id: stackView - initialItem: mainView - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.right: parent.right - - Component { - id: mainView - Item { - property string title: qsTr("Device Settings") - XmlListModel { - id: xmlModel - source: "settingsview.xml" - query: "/xml/settings/item" - XmlRole { name: "title"; query: "title/string()"} - XmlRole { name: "icon"; query: "icon/string()"} - XmlRole { name: "plugin"; query: "plugin/string()"} - XmlRole { name: "view"; query: "view/string()"} - } - - GridView { - id: grid - anchors.fill: parent - anchors.margins: Math.round(40 * Flat.FlatStyle.scaleFactor) - cellHeight: Math.round(133 * Flat.FlatStyle.scaleFactor) + spacing - cellWidth: Math.round(117 * Flat.FlatStyle.scaleFactor) + spacing - property int spacing: Math.round(20 * Flat.FlatStyle.scaleFactor) - - model: xmlModel - delegate: - MouseArea { - width: grid.cellWidth - grid.spacing - height: grid.cellHeight - grid.spacing - - Rectangle { - anchors.fill: parent - color: "#d6d6d6" - radius: 5 - visible: pressed - } - - Column { - anchors.fill: parent - anchors.topMargin: Math.round(10 * Flat.FlatStyle.scaleFactor) - Image { - id: image - source: icon - anchors.horizontalCenter: parent.horizontalCenter - } - - TextLabel { - text: title - anchors.horizontalCenter: parent.horizontalCenter - font.pixelSize: Math.round(16 * Flat.FlatStyle.scaleFactor) - } - } - - onClicked: { - var url = 'import ' + plugin + '; ' + view + ' {}'; - stackView.push({item: Qt.createQmlObject(url,stackView)}); - titlebar.title = title - } - } - } - } - } - } -} diff --git a/src/qtdevicesettings/settingsui/qml.qrc b/src/qtdevicesettings/settingsui/qml.qrc deleted file mode 100644 index 7b1f07b..0000000 --- a/src/qtdevicesettings/settingsui/qml.qrc +++ /dev/null @@ -1,6 +0,0 @@ - - - main.qml - settingsview.xml - - diff --git a/src/qtdevicesettings/settingsui/settingsui.pro b/src/qtdevicesettings/settingsui/settingsui.pro deleted file mode 100644 index 026d911..0000000 --- a/src/qtdevicesettings/settingsui/settingsui.pro +++ /dev/null @@ -1,17 +0,0 @@ -TEMPLATE = app - -QT += qml quick -SOURCES += main.cpp - -RESOURCES += \ - qml.qrc \ - icons.qrc - -# Additional import path used to resolve QML modules in Qt Creator's code model -QML_IMPORT_PATH = - -# Default rules for deployment. -include(deployment.pri) - -DISTFILES += \ - settingsview.xml diff --git a/src/qtdevicesettings/settingsui/settingsview.xml b/src/qtdevicesettings/settingsui/settingsview.xml deleted file mode 100644 index b2cfc51..0000000 --- a/src/qtdevicesettings/settingsui/settingsview.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - Network - com.theqtcompany.settings.network 1.0 - NetworkSettings - ../icons/World_qt_6x.png - - - Display - com.theqtcompany.settings.general 1.0 - Display - ../icons/Display_qt_6x.png - - - Audio - com.theqtcompany.settings.general 1.0 - Sound - ../icons/Audio_qt_6x.png - - - Date and Time - com.theqtcompany.settings.timedate 1.0 - TimeDate - ../icons/Clock_qt_6x.png - - - Language - com.theqtcompany.settings.locale 1.0 - Language - ../icons/Flag_qt_6x.png - - - Bluetooth - com.theqtcompany.settings.bluetooth 1.0 - Bluetooth - ../icons/Bluetooth_qt_6x.png - - - diff --git a/src/qtdevicesettings/timedateplugin/AnalogClock.qml b/src/qtdevicesettings/timedateplugin/AnalogClock.qml deleted file mode 100644 index 2b89401..0000000 --- a/src/qtdevicesettings/timedateplugin/AnalogClock.qml +++ /dev/null @@ -1,255 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.5 -import com.theqtcompany.settings.common 1.0 -import com.theqtcompany.settings.timedate 1.0 - -Item { - property var currentTime: TimeManager.time - property var newTime: new Date - property bool editMode: false - - function showTime(time) { - return time.getHours() + ":" + time.getMinutes() - } - - onEditModeChanged: if (editMode) newTime = new Date - - Rectangle { - border.color: "#bdbebf" - border.width: 1 - color: "white" - anchors.fill: parent - - Connections { - target: TimeManager - onTimeChanged : newTime.setSeconds(currentTime.getSeconds()) - onTimeZoneChanged : Date.timeZoneUpdated() - } - - TextLabel { - anchors.horizontalCenter: parent.horizontalCenter - anchors.topMargin: 10 - anchors.top: parent.top - text: editMode ? newTime.toTimeString() : currentTime.toTimeString() - } - - Rectangle { - id: root - anchors.fill: parent - anchors.margins: Math.round(40 * Flat.FlatStyle.scaleFactor) - color: "white" - border.color: editMode ? "#d6d6d6" : "#5caa15" - border.width: Math.round(root.width * 0.120) - radius: parent.width / 2 - property int handOffset: Math.round(root.width * 0.040) - antialiasing: true - - Rectangle { - id: minutes - x: root.height / 2 - width / 2 - y: root.height / 2 - height + root.handOffset - color: editMode ? "#d6d6d6" : "#5caa15" - width: Math.round(root.width * 0.080) - height: Math.round(root.height / 2 * 0.65 + root.handOffset) - antialiasing: true - transform: Rotation { - id: minuteRotation - origin.x: Math.round(minutes.width / 2) - origin.y: Math.round(minutes.height - root.handOffset) - angle: currentTime.getMinutes() * 6 - Behavior on angle { - SpringAnimation { spring: 2; damping: 0.2; modulus: 360 } - } - } - } - - Rectangle { - id: hours - x: Math.round(root.height / 2 - width / 2) - y: Math.round(root.height / 2 - height + root.handOffset) - height: Math.round(root.height / 2 * 0.4 + root.handOffset) - width: Math.round(root.width * 0.080) - color: editMode ? "#d6d6d6" : "#80c342" - antialiasing: true - transform: Rotation { - id: hourRotation - origin.x: Math.round(hours.width / 2) - origin.y: hours.height - root.handOffset; - angle: (currentTime.getHours() * 30) + (currentTime.getMinutes() * 0.5) - Behavior on angle { - SpringAnimation { spring: 2; damping: 0.2; modulus: 360 } - } - } - } - - Rectangle { - id: seconds - x: root.height / 2 - width / 2 - y: root.height / 2 - height + root.handOffset - visible: !editMode - color: "#46a2da" - width: Math.round(root.width * 0.0128) - height: Math.round(root.height / 2 * 0.74) - radius: Math.round(width / 2) - antialiasing: true - transform: Rotation { - id: secondRotation - origin.x: Math.round(seconds.width / 2) - origin.y: Math.round(seconds.height - root.handOffset) - angle: currentTime.getSeconds() * 6 - Behavior on angle { - SpringAnimation { spring: 2; damping: 0.2; modulus: 360 } - } - } - } - - Component { - id: editor - - Rectangle { - id: rect - property var angle: mouseArea.drag ? mouseArea.angle : defaultAngle - property var defaultAngle: angleBinding - x: Math.round(Math.cos((-90+ angle)*Math.PI/180) * - (pos - root.handOffset - width /2 + radius) + root.width / 2 - width / 2) - y: Math.round(Math.sin((-90+ angle)*Math.PI/180) * - (pos - root.handOffset - width /2 + radius) + root.height / 2 - width / 2) - color: "#5caa15" - width: size - radius: width / 2 - height: width - antialiasing: true - - function calcAngle(mouse) { - var mouseGlobal = mapToItem(root, mouse.x, mouse.y) - var origin = root.width/2 - var angle = (90+Math.atan2((mouseGlobal.y-origin), (mouseGlobal.x-origin))*180/Math.PI) - if (angle < 0) - angle += 360; - updateAngle(angle); - return angle; - } - - MouseArea { - id: mouseArea - anchors.fill: parent - property int startX: 0 - property int startY: 0 - property bool drag: false - property var angle: 0.0 - preventStealing: true - - onPressed: { - var mouseGlobal = mapToItem(root, mouse.x, mouse.y); - startX = mouseGlobal.x; - startY = mouseGlobal.y; - angle = calcAngle(mouse); - drag = true; - } - onReleased: { - drag = false; - ready(angle) - } - onMouseXChanged: if (drag) angle = calcAngle(mouse) - } - } - } - - Loader { - property var angleBinding: (currentTime.getHours() * 30) + (currentTime.getMinutes() * 0.5) - property int size: Math.round(root.width * 0.120) - property int pos: hours.height - property bool pm: false - visible: editMode - - function updateAngle(angle) { - var newHour = Math.floor(angle / 30); - var preHour = newTime.getHours(); - - if (preHour == 11 && newHour == 0) { - newHour = 12; - pm = true; - } - else if (preHour === 23 && newHour === 0) { - pm = false; - } - else if (preHour == 0 && newHour === 11) { - pm = true; - } - else if (preHour == 12 && newHour == 11) { - pm = false; - } - - if (pm == true) { - newHour += 12; - } - - newTime.setHours(newHour); - } - - function ready(val) { - var newhours = Math.round(val / 30); - currentTime.setHours(newhours); - TimeManager.time = currentTime; - } - sourceComponent: editor - } - - Loader { - property var angleBinding: currentTime.getMinutes() * 6 - property int size: Math.round(root.width * 0.120) - property int pos: minutes.height - visible: editMode - sourceComponent: editor - - function updateAngle(angle) { - var newMin = Math.round(angle / 6); - var hours = newTime.getHours(); - newTime.setMinutes(newMin); - newTime.setHours(hours); - } - - function ready(val) { - var newmins = Math.round(val / 6); - currentTime.setMinutes(newmins); - TimeManager.time = currentTime; - } - } - } - } -} - diff --git a/src/qtdevicesettings/timedateplugin/TimeDate.qml b/src/qtdevicesettings/timedateplugin/TimeDate.qml deleted file mode 100644 index 6731805..0000000 --- a/src/qtdevicesettings/timedateplugin/TimeDate.qml +++ /dev/null @@ -1,167 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.5 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles.Flat 1.0 as Flat -import com.theqtcompany.settings.common 1.0 -import com.theqtcompany.settings.timedate 1.0 - -Item { - id: root - property string title: qsTr("Time and Date settings") - - Flickable { - anchors.fill: parent - anchors.margins: Math.round(40 * Flat.FlatStyle.scaleFactor) - anchors.bottomMargin: Math.round(20 * Flat.FlatStyle.scaleFactor) - contentHeight: content.height - contentWidth: width - - Column { - id: content - width: parent.width - - GroupBox { - width: parent.width - title: qsTr("Time Settings") - Layout.fillWidth: true - - ColumnLayout { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - width: parent.width - Layout.fillWidth: true - - ExclusiveGroup { id: exgroup } - - RadioButton { - id: automatic - text: qsTr("Automatic time set") - exclusiveGroup: exgroup - checked: TimeManager.ntp - onCheckedChanged: if (checked) calloader.reload(); - } - RadioButton { - id: custom - text: qsTr("Manual") - exclusiveGroup: exgroup - checked: !TimeManager.ntp - onCheckedChanged: TimeManager.ntp = !checked - } - RowLayout { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - Layout.fillWidth: true - - Component { - id: calendar - - Item { - width: cal.width - height: cal.height - - Timer { - id: timer - } - function delay(delayTime, cb) { - timer.interval = delayTime; - timer.repeat = false; - timer.triggered.connect(cb); - timer.start(); - } - - Calendar { - id: cal - weekNumbersVisible: false - enabled: !automatic.checked - onClicked: { - var currentTime = TimeManager.time; - var newDate = date; - newDate.setHours(currentTime.getHours()); - newDate.setMinutes(currentTime.getMinutes()); - newDate.setSeconds(currentTime.getSeconds()); - TimeManager.time = newDate; - delay(100, function() { - calloader.reload(); - }); - } - } - } - } - - Loader { - id: calloader - sourceComponent: calendar - function reload() { - calloader.sourceComponent = undefined; - calloader.sourceComponent = calendar; - } - } - - AnalogClock { - id: clock - width: calloader.width - height: width - editMode: !automatic.checked - } - } - - Component { - id: zoneselect - TimezonesView { } - } - - GroupBox { - title: qsTr("Timezone Settings") - Layout.fillWidth: true - width: parent.width - visible: true - flat: true - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - TextLabel { - text: TimeManager.timeZone - } - Button { - text: "Change" - onClicked : stackView.push(zoneselect) - } - } - } - } - } - } - } -} diff --git a/src/qtdevicesettings/timedateplugin/TimezonesView.qml b/src/qtdevicesettings/timedateplugin/TimezonesView.qml deleted file mode 100644 index 458d611..0000000 --- a/src/qtdevicesettings/timedateplugin/TimezonesView.qml +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -import QtQuick 2.5 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.4 -import QtQuick.Controls.Styles.Flat 1.0 as Flat -import com.theqtcompany.settings.common 1.0 -import com.theqtcompany.settings.timedate 1.0 - - -Item { - id: root - Component.onCompleted: timezone.text = TimezonesFilter.filter - - Column { - id: content - anchors.fill: parent - anchors.margins: Math.round(20 * Flat.FlatStyle.scaleFactor) - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - Row { - spacing: Math.round(10 * Flat.FlatStyle.scaleFactor) - - TextLabel { - text: qsTr("Search area: ") - } - - TextField { - id: timezone - text: "" - onTextChanged: TimezonesFilter.filter = timezone.text - } - } - - TableView { - width: parent.width - height: Math.round(parent.height - 40 * Flat.FlatStyle.scaleFactor) - Layout.fillWidth: true - model: TimezonesFilter - headerVisible: true - - TableViewColumn { - role: "name" - title: qsTr("Timezone") - width: Math.round(parent.width * 0.66) - } - TableViewColumn { - role: "country" - title: qsTr("Country") - width: Math.round(parent.width * 0.33) - } - - onClicked: { - var val = model.itemFromRow(row); - if (val !== "") { - TimeManager.timeZone = val; - stackView.pop(); - } - } - } - } -} diff --git a/src/qtdevicesettings/timedateplugin/icons.qrc b/src/qtdevicesettings/timedateplugin/icons.qrc deleted file mode 100644 index af8a564..0000000 --- a/src/qtdevicesettings/timedateplugin/icons.qrc +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/qtdevicesettings/timedateplugin/plugin.cpp b/src/qtdevicesettings/timedateplugin/plugin.cpp deleted file mode 100644 index b092c2c..0000000 --- a/src/qtdevicesettings/timedateplugin/plugin.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include - -#include "systemtime.h" -#include "timezonemodel.h" -#include "timezonefiltermodel.h" - -template -QObject *instance(QQmlEngine *engine, QJSEngine *) { - T *t = new T(engine); - t->setObjectName(T::staticMetaObject.className()); - return t; -} - -class TimeDateSettingsQmlPlugin : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") - -public: - void registerTypes(const char *uri) - { - qmlRegisterSingletonType(uri, 1, 0, "TimeManager", &instance); - } - - void initializeEngine(QQmlEngine * engine, const char * uri) - { - Q_ASSERT(QLatin1String(uri) == QLatin1String("com.theqtcompany.settings.timedate")); - TimezoneModel* timezoneModel = new TimezoneModel(engine); - TimezoneFilterModel* filter = new TimezoneFilterModel(engine); - filter->setSourceModel(timezoneModel); - - engine->rootContext()->setContextProperty("Timezones", timezoneModel); - engine->rootContext()->setContextProperty("TimezonesFilter", filter); - } -}; - -#include "plugin.moc" diff --git a/src/qtdevicesettings/timedateplugin/qml.qrc b/src/qtdevicesettings/timedateplugin/qml.qrc deleted file mode 100644 index e04454d..0000000 --- a/src/qtdevicesettings/timedateplugin/qml.qrc +++ /dev/null @@ -1,7 +0,0 @@ - - - TimeDate.qml - AnalogClock.qml - TimezonesView.qml - - diff --git a/src/qtdevicesettings/timedateplugin/qmldir b/src/qtdevicesettings/timedateplugin/qmldir deleted file mode 100644 index 2d7a8a6..0000000 --- a/src/qtdevicesettings/timedateplugin/qmldir +++ /dev/null @@ -1,3 +0,0 @@ -module com.theqtcompany.settings.timedate -TimeDate 1.0 TimeDate.qml -plugin qmltimedatesettingsplugin diff --git a/src/qtdevicesettings/timedateplugin/systemtime.cpp b/src/qtdevicesettings/timedateplugin/systemtime.cpp deleted file mode 100644 index c84b036..0000000 --- a/src/qtdevicesettings/timedateplugin/systemtime.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "systemtime.h" -#include "systemtime_p.h" - -SystemTime::SystemTime(QObject *parent) : - QObject(parent) - ,d_ptr(new SystemTimePrivate(this)) -{ - QTimer *secTimer = new QTimer(this); - connect(secTimer, &QTimer::timeout, this, &SystemTime::timeChanged); - secTimer->setInterval(1001); - secTimer->setSingleShot(false); - secTimer->start(); -} - -bool SystemTime::ntp() const -{ - const Q_D(SystemTime); - return d->ntp(); -} - -void SystemTime::setNtp(const bool aNtp) -{ - Q_D(SystemTime); - d->setNtp(aNtp); -} - -void SystemTime::setTime(const QDateTime& aTime) -{ - Q_D(SystemTime); - d->setTime(aTime.toMSecsSinceEpoch()*1000); - emit timeChanged(); -} - -QString SystemTime::timeZone() const -{ - Q_D(const SystemTime); - return d->timeZone(); -} - -void SystemTime::setTimeZone(const QString& aTimeZone) -{ - Q_D(SystemTime); - d->setTimeZone(aTimeZone); - emit timeZoneChanged(); -} - -QDateTime SystemTime::time() const -{ - return QDateTime::currentDateTime(); -} diff --git a/src/qtdevicesettings/timedateplugin/systemtime.h b/src/qtdevicesettings/timedateplugin/systemtime.h deleted file mode 100644 index 092712c..0000000 --- a/src/qtdevicesettings/timedateplugin/systemtime.h +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef SYSTEMTIME_H -#define SYSTEMTIME_H - -#include -#include - -class SystemTimePrivate; - -class SystemTime : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString timeZone READ timeZone WRITE setTimeZone NOTIFY timeZoneChanged) - Q_PROPERTY(bool ntp READ ntp WRITE setNtp NOTIFY ntpChanged) - Q_PROPERTY(QDateTime time READ time WRITE setTime NOTIFY timeChanged) -public: - explicit SystemTime(QObject *parent = 0); - bool ntp() const; - void setNtp(const bool aNtp); - void setTime(const QDateTime& aTime); - QString timeZone() const; - QDateTime time() const; - void setTimeZone(const QString& aTimeZone); - -signals: - void timeZoneChanged(); - void ntpChanged(); - void timeChanged(); - -public slots: - -protected: - SystemTimePrivate *d_ptr; - - Q_DISABLE_COPY(SystemTime) - Q_DECLARE_PRIVATE(SystemTime) -}; - -#endif // SYSTEMTIME_H diff --git a/src/qtdevicesettings/timedateplugin/systemtime_p.h b/src/qtdevicesettings/timedateplugin/systemtime_p.h deleted file mode 100644 index 5ee6eef..0000000 --- a/src/qtdevicesettings/timedateplugin/systemtime_p.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef SYSTEMTIME_P_H -#define SYSTEMTIME_P_H - -#include "systemtime.h" -#include "timedated_interface.h" - -class SystemTimePrivate -{ - Q_DECLARE_PUBLIC(SystemTime) -public: - SystemTimePrivate(SystemTime *qq) - :q_ptr(qq) - { - m_timeInterface = new OrgFreedesktopTimedate1Interface(QStringLiteral("org.freedesktop.timedate1"), - QStringLiteral("/org/freedesktop/timedate1"), - QDBusConnection::systemBus(), qq); - - } - - bool ntp() const { - if (m_timeInterface) - return m_timeInterface->nTP(); - return false; - } - - void setNtp(bool val) { - if (m_timeInterface) - m_timeInterface->SetNTP(val, true); - } - - QString timeZone() const { - if (m_timeInterface) - return m_timeInterface->timezone(); - return ""; - } - - void setTimeZone(const QString& aTimeZone) { - if (m_timeInterface) - m_timeInterface->SetTimezone(aTimeZone, true); - } - - void setTime(qlonglong usecsSinceEpoch) { - if (m_timeInterface) - m_timeInterface->SetTime(usecsSinceEpoch, false, true); - } - -private: - OrgFreedesktopTimedate1Interface *m_timeInterface; - SystemTime *q_ptr; -}; - - -#endif // SYSTEMTIME_P_H diff --git a/src/qtdevicesettings/timedateplugin/timedated.xml b/src/qtdevicesettings/timedateplugin/timedated.xml deleted file mode 100644 index 95bafb8..0000000 --- a/src/qtdevicesettings/timedateplugin/timedated.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/qtdevicesettings/timedateplugin/timedateplugin.pro b/src/qtdevicesettings/timedateplugin/timedateplugin.pro deleted file mode 100644 index d82529d..0000000 --- a/src/qtdevicesettings/timedateplugin/timedateplugin.pro +++ /dev/null @@ -1,42 +0,0 @@ -TEMPLATE = lib -CONFIG += plugin -QT += qml dbus - -uri = com.theqtcompany.settings.timedate - -DBUS_INTERFACES = timedated.xml - -DESTDIR = imports/TimeDate -TARGET = qmltimedatesettingsplugin - -SOURCES += plugin.cpp \ - systemtime.cpp \ - timezonemodel.cpp \ - timezonefiltermodel.cpp - -pluginfiles.files += \ - qmldir - - -pluginfiles.files += \ - AnalogClock.qml \ - TimeDate.qml \ - TimezonesView.qml \ - -installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /) - -target.path = $$installPath -pluginfiles.path += $$installPath -INSTALLS += target pluginfiles - - -RESOURCES += \ - icons.qrc - -HEADERS += \ - systemtime.h \ - systemtime_p.h \ - timezonemodel.h \ - timezonefiltermodel.h - - diff --git a/src/qtdevicesettings/timedateplugin/timezonefiltermodel.cpp b/src/qtdevicesettings/timedateplugin/timezonefiltermodel.cpp deleted file mode 100644 index 3d1c0a4..0000000 --- a/src/qtdevicesettings/timedateplugin/timezonefiltermodel.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "timezonemodel.h" -#include "timezonefiltermodel.h" - -TimezoneFilterModel::TimezoneFilterModel(QObject* parent) - :QSortFilterProxyModel(parent) -{ - connect(this, &TimezoneFilterModel::filterChanged, this, &TimezoneFilterModel::invalidate); -} - -TimezoneFilterModel::~TimezoneFilterModel() -{ - -} - -QString TimezoneFilterModel::filter() const -{ - return m_filter; -} - -void TimezoneFilterModel::setFilter(const QString& aFilter) -{ - m_filter = aFilter; - emit filterChanged(); -} - -bool TimezoneFilterModel::filterAcceptsRow( int source_row, const QModelIndex& source_parent ) const -{ - bool ret = false; - if (this->sourceModel()) - { - QModelIndex index = this->sourceModel()->index( source_row, 0, source_parent ); - if (index.isValid()) - { - QVariant nameRole = index.data(TimezoneModel::Name); - if (nameRole.isValid()) - { - QString name = nameRole.toString(); - if (name.contains(m_filter, Qt::CaseInsensitive)) { - ret = true; - } - } - QVariant countryRole = index.data(TimezoneModel::Country); - if (ret == false && countryRole.isValid()) - { - QString country = countryRole.toString(); - if (country.contains(m_filter, Qt::CaseInsensitive)) { - ret = true; - } - } - } - } - return ret; -} - -QVariant TimezoneFilterModel::itemFromRow(const int row) const -{ - QModelIndex idx = index(row, 0); - QModelIndex mapped = mapToSource(idx); - if (mapped.isValid()) - { - QVariant nameRole = mapped.data(TimezoneModel::Name); - if (nameRole.isValid()) - { - return nameRole; - } - } - return QVariant::fromValue(QString("")); -} - diff --git a/src/qtdevicesettings/timedateplugin/timezonefiltermodel.h b/src/qtdevicesettings/timedateplugin/timezonefiltermodel.h deleted file mode 100644 index dd9009f..0000000 --- a/src/qtdevicesettings/timedateplugin/timezonefiltermodel.h +++ /dev/null @@ -1,59 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef TIMEZONEFILTERMODEL_H -#define TIMEZONEFILTERMODEL_H - -#include - -class TimezoneFilterModel : public QSortFilterProxyModel -{ - Q_OBJECT - Q_PROPERTY(QString filter READ filter WRITE setFilter NOTIFY filterChanged) -public: - explicit TimezoneFilterModel(QObject* parent); - virtual ~TimezoneFilterModel(); - bool filterAcceptsRow( int source_row, const QModelIndex& source_parent ) const override; - QString filter() const; - void setFilter(const QString& aFilter); - Q_INVOKABLE QVariant itemFromRow(const int row) const; -signals: - void filterChanged(); -private: - QString m_filter; - -}; - -#endif // TIMEZONEFILTERMODEL_H diff --git a/src/qtdevicesettings/timedateplugin/timezonemodel.cpp b/src/qtdevicesettings/timedateplugin/timezonemodel.cpp deleted file mode 100644 index b6cf27b..0000000 --- a/src/qtdevicesettings/timedateplugin/timezonemodel.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -#include "timezonemodel.h" - -TimezoneItem::TimezoneItem(const QByteArray& id, QObject *parent) - :QObject(parent) -{ - QTimeZone tz = QTimeZone(id); - m_name = tz.displayName(QTimeZone::StandardTime); - m_country = QLocale::countryToString(tz.country()); - m_id = id; -} - -QString TimezoneItem::name() const -{ - return m_name; -} - -QString TimezoneItem::country() const -{ - return m_country; -} - -QString TimezoneItem::id() const -{ - return m_id; -} - -TimezoneModel::TimezoneModel(QObject *parent) - : QAbstractListModel(parent) -{ - m_roleNames.insert(Qt::UserRole, "modelData"); - m_roleNames.insert(Country, "country"); - m_roleNames.insert(Name, "name"); - m_roleNames.insert(Id, "id"); - - QFuture t1 = QtConcurrent::run(TimezoneModel::generateModel, this); -} - -void TimezoneModel::generateModel(TimezoneModel* model) -{ - QList ids = QTimeZone::availableTimeZoneIds(); - foreach (QByteArray id, ids) { - TimezoneItem *zone = new TimezoneItem(id); - zone->moveToThread(model->thread()); - QMetaObject::invokeMethod(model, "addNewItem", Q_ARG( QObject*, qobject_cast(zone))); - } -} - -void TimezoneModel::addNewItem(QObject* item) -{ - beginInsertRows(QModelIndex(), m_items.count(), m_items.count()); - TimezoneItem* newItem = qobject_cast(item); - if (newItem) - m_items.append(newItem); - endInsertRows(); -} - -TimezoneModel::~TimezoneModel() -{ - qDeleteAll(m_items); -} - -QHash TimezoneModel::roleNames() const -{ - return m_roleNames; -} - - -int TimezoneModel::rowCount(const QModelIndex & parent) const -{ - Q_UNUSED(parent); - return m_items.count(); -} - -QVariant TimezoneModel::data(const QModelIndex & index, int role) const -{ - if (!index.isValid()) return QVariant(); - - TimezoneItem *item = m_items[index.row()]; - if (role == Qt::UserRole) { - return item->id(); - } - - switch (role) { - case Name: - return item->id(); - break; - case Country: - return item->country(); - break; - case Id: - return item->id(); - break; - case Qt::DisplayRole: - return item->id(); - break; - default: - return ""; - } -} diff --git a/src/qtdevicesettings/timedateplugin/timezonemodel.h b/src/qtdevicesettings/timedateplugin/timezonemodel.h deleted file mode 100644 index af86c75..0000000 --- a/src/qtdevicesettings/timedateplugin/timezonemodel.h +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Device Utilities module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef TIMEZONEMODEL_H -#define TIMEZONEMODEL_H - -#include -#include -#include -#include - -class TimezoneItem : public QObject -{ - Q_OBJECT - Q_PROPERTY(QString id READ id CONSTANT) -public: - explicit TimezoneItem(const QByteArray& id, QObject *parent=0); - QString name() const; - QString country() const; - QString id() const; - -private: - QString m_name; - QString m_country; - QString m_id; -}; - -class TimezoneModel : public QAbstractListModel -{ - Q_OBJECT - -public: - explicit TimezoneModel(QObject *parent=0); - virtual ~TimezoneModel(); - // from QAbstractItemModel - int rowCount(const QModelIndex & parent = QModelIndex()) const; - QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const; - QHash roleNames() const; - Q_INVOKABLE QVariant itemFromRow(const int row) const; - - enum Roles { - Name = Qt::UserRole + 1, - Country, - Id - }; - - static void generateModel(TimezoneModel* model); - -private slots: - void addNewItem(QObject* item); - -private: - QList m_items; - QHash m_roleNames; -}; - -#endif // TIMEZONEMODEL_H -- cgit v1.2.3