aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/btdeviceselectiondialog.cpp
AgeCommit message (Collapse)Author
2015-10-30Move qt-ui to desktop-widgetsGravatar Tomaz Canabrava
Since we have now destkop and mobile versions, 'qt-ui' was a very poor name choice for a folder that contains only destkop-enabled widgets. Also, move the graphicsview-common.h/cpp to subsurface-core because it doesn't depend on qgraphicsview, it merely implements all the colors that we use throughout Subsurface, and we will use colors on both desktop and mobile versions Same thing applies for metrics.h/cpp Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-20Fix build error on Windows with Qt5.5Gravatar Dirk Hohndel
I'm not quite sure why this works, but it appears to do the trick. Apparently you are supposed not to have the meta type declaration in a shared header file. Also, with Qt5.5 you can't have the declaration for QBluetoothDeviceInfo, not even on Windows. This may need more tweaking to make sure it works on all combinations of OS and Qt version. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-19Rename BTH_ADDR_STR_LEN macroGravatar Claudiu Olteanu
Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-19Fix Bluetooth address truncation issues on WindowsGravatar Claudiu Olteanu
On some Windows platforms when we convert a Bth address to a String it is formatted as "(XX:XX:XX:XX:XX:XX)". Therefore we first try to remove the round parentheses and finally we truncate the string to 17 because there are 6 two-digit hex values and 5 colons. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-18Spelling correctionsGravatar Robert C. Helling
Spell Setpoint without space in user visable strings. Explain authorized_paired. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-05Add ON and OFF strings to translationGravatar Salvador Cuñat
In btdeviceselectiondialog.cpp ON and OFF strings need to be translatables to avoid issues in the translation of the resulting displayed string, as "turn on" and "turn off" translates to a single word in most languages. Signed-off-by: Salvador Cuñat <salvador.cunat@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-05Style and readability tweaks to btdeviceselectiondialogGravatar Tim Wootton
Signed-off-by: Tim Wootton <tim@tee-jay.org.uk> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-02Translate strings for Bluetooth download modeGravatar Claudiu Olteanu
Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-27QtBT: avoid crash at exit if no BT device foundGravatar Dirk Hohndel
If localDevice isn't valid we never initialize the discory agent, so let's not dereference it in the destructor unless it is valid. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20Add implementation for device discovery agent initialization (Windows)Gravatar Claudiu Olteanu
Register the metatypes needed for Windows platforms and initialize our custom device discovery agent. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20Get a pretty print message when a device discovery error occuredGravatar Claudiu Olteanu
Try to get a pretty print message when a device discovery error is raised and it is unknown. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20Add implementation for BTH device item selection on Windows platformsGravatar Claudiu Olteanu
When a Bluetooth device is selected from the discovered list display information about its address and enable the save button. On Windows we don't need to check if the devices are paired because the pairing process is done automatically on the connection step. If the devices are not paired Windows will ask for user's permission to continue the process. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20Add implementation for add remote Bluetooth device handlerGravatar Claudiu Olteanu
On Windows we cannot determine the pairing status of the device. Therefore we print only information about its name and about its BTH address. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20Wait for BTH device discovery thread to finish on stop callGravatar Claudiu Olteanu
We should wait for the WinBluetoothDeviceDiscoveryAgent completion when the stop method was called. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20Initialize WinSock and hide the information about the local deviceGravatar Claudiu Olteanu
On Windows we cannot select a device or show information about the local device. Therefore we disable the UI section related to local device details. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20Add implementation for our custom BTH device discovery serviceGravatar Claudiu Olteanu
Implement a custom lookup service for remote Bluetooth devices discovery. This will be used on Windows platforms to collect information about the name and the address of a remote Bluetooth device. In the beginning we initialize the queryset with the necessary flags and we start the lookup service. When a device is discovered we collect information about its name and its address and we raise a signal with it using the same signature as the one emitted by QtBluetoothDeviceDiscoveryAgent implementation. Finally we end the lookup service and we reset the internal flags. This code was written with the help of the sample code documenting the relevant APIs provided by Microsoft Corporation at https://code.msdn.microsoft.com/windowsdesktop/Bluetooth-Connection-e3263296 which is under the MS-LPL. No code from the samples was copied and the code in this commit is covered by the GPL and not the MS-LPL. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20Add skeleton for Bluetooth custom serial implementation on Windows platformsGravatar Claudiu Olteanu
Add a skeleton which will be used to develop the Bluetooth custom serial implementation for Windows platforms. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20Reimplement pairingFinished methodGravatar Claudiu Olteanu
The old implementation didn't use the correct deviceLabel pattern. When the pairing status of a device was changed the name of the device was missing from the new label. With the new implementation when the pairing status is changed we replace the old state with the new one and maintain the device information from the old label. Also we set the same pairing background colors used in the addRemoteDevice callback. In this way the label's state is consistent and the UX is improved. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20Clear the BTH discovered devices list on each searchGravatar Claudiu Olteanu
Clear the Bluetooth discovered devices list on each search. In this way we will show only the devices that are in range and active during the last scannning. Also if we clear the list before each call we don't need to check anymore if the discovered device is already in the list. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20Check the last error when the BTH device scanning is finishedGravatar Claudiu Olteanu
If there is no error reported when the device scanning is finished then report to the dialog status that the scanning finished successfully. Otherwise report the last error. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20Cleanup Bluetooth local device and the discovery agent on exitGravatar Claudiu Olteanu
Do some extra cleanup when the BtDeviceSelectionDialog is destroyed. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-20Only enable Bluetooth support if building against Qt5.4 or newerGravatar Dirk Hohndel
Also remove the quick hack from commit 947fda14c5d1 ("Bluetooth support: quick build fix for Qt5.2"). I should have thought this through before pushing that commit, but oh well. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-20Bluetooth support: quick build fix for Qt5.2Gravatar Dirk Hohndel
The InvalidBluetoothAdapterError error code wasn't introduced until Qt5.3, so let's not test for it on older versions of Qt. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-20Update the message shown on pairing erorrsGravatar Claudiu Olteanu
Advice the user to use his operating system for the pairing step if the remote device requires a custom PIN code. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-20Fix typos on Bluetooth selection widgetGravatar Claudiu Olteanu
Fix "lable" typos from Bluetooth selection widget. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-20Hide the local BT combobox if there is only one deviceGravatar Claudiu Olteanu
If there is only one local Bluetooth adapter, then hide the selection combobox and the label. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-20Don't close the BT selection Widget if the local BT adapter is invalidGravatar Claudiu Olteanu
Don't close the Bluetooth selection widget if the default local Bluetooth adapter is invalid. Maybe there is a problem with the default Bluetooth device and the user has another one (a BT dongle) which can be used. If the selected device is invalid then update the UI information, disable the available buttons and announce the user about the problem. Also move the device changed logging message before we call the update information method. In this way the logging message with the problem will not be overwritten. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-20Log errors which occur during Bluetooth device discoveryGravatar Claudiu Olteanu
Register to the signal emmited when an error occurs during Bluetooth device discovery and log a description of the error which can be used to identify problem's cause. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-20Reinitialize the BT discovery agent when a new adapter is selectedGravatar Claudiu Olteanu
Reinitialize the Bluetooth device discovery agent when the user selects a new local Bluetooth adapter using the address of the selected device. Before this patch the agent was always using the local default Bluetooth adapter. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-20Add combobox for Bluetooth local device selectionGravatar Claudiu Olteanu
Add a combobox which can be used to list/select the available local Bluetooth devices. In this way, if a user has more than one local Bluetooth devices (integrated, dongles, etc.) he can choose which one he wants to use. Before this patch, only the default local Bluetooth device could be used. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-20Don't block the save button for Bluetooth device selectionGravatar Claudiu Olteanu
After commit 619e97ee4fcd ("Stop the SDP agent if the Clear/Save button was pressed") we don't need to block the save button anymore for scanning completion because the SDP agent will be stopped manually if the Save button was pressed. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-19Use itemClicked signal instead of itemActivated for BT device selectionGravatar Claudiu Olteanu
On Android platforms the system is configured to raise the itemActivated signal when the user double clicks an item. Since the items are small it is pretty hard to double click them. Therefore use the itemClicked signal instead of the itemActivated signal. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-19Stop the SDP agent if the Clear/Save button was pressedGravatar Claudiu Olteanu
If the Cancel button was pressed then we should stop the SDP agent. The same thing happens when the Save button was pressed. We don't need to add new BT remote devices to the list if the widget was closed or if the list with the discovered BT devices was cleared. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-13Wait until the BT scanning process is done on Android platformsGravatar Claudiu Olteanu
Block the Save button on Android platforms until the scanning for remote Bluetooth devices is finished. The reason we do that is because there is a bug on the Android platform or on the QtBluetooth library which stops the downloading process and blocks the devices on the Download mode. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-06Add a dialog for remote Bluetooth devices selectionGravatar Claudiu Olteanu
Implement a dialog which can be used for remote Bluetooth devices selection and to control the local Bluetooth device. Functionalities of the widget: - expose information about the local BT device - scan for remote BT devices - pair/unpair with a remote BT device - turn on/off the local BT device - logging - save the selected BT device The selection dialog is created when the bluetoothMode checkbox is enabled. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>