QBtSingleDeviceSelectorUI.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * QBtSingleDeviceSelectorUI.h
  3. *
  4. *
  5. * Author: ftylitak
  6. *
  7. * Licensed under the Apache License, Version 2.0 (the "License");
  8. * you may not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. */
  19. #ifndef QBTSINGLEDEVICESELECTORUI_H_
  20. #define QBTSINGLEDEVICESELECTORUI_H_
  21. #include <QtCore/QObject>
  22. #include <QtGui/QWidget>
  23. #include <QBtGlobal.h>
  24. #include <QBtDevice.h>
  25. QBT_NAMESPACE_BEGIN
  26. class QBtSingleDeviceSelectorUIPrivate;
  27. /**
  28. * This class provides UI for searching remote bluetooth
  29. * devices, displaying them and selecting one device.
  30. *
  31. * When a device is selected, the UI is closed and the
  32. * device instance is returned through discoveryCompleted()
  33. * signal.
  34. * (NOTE: when closed it is not destroyed, just hiden)
  35. *
  36. * To use, create an instance of the class and call
  37. * show(). When shown, discovery starts as well.
  38. *
  39. * To get the selected remote device, the discoveryCompleted()
  40. * signal must be handled.
  41. */
  42. class DLL_EXPORT QBtSingleDeviceSelectorUI : public QObject
  43. {
  44. Q_OBJECT
  45. public:
  46. /**
  47. * If parent == 0, the list will be showed as an independent
  48. * widget on the screen, thus it's not necessary for the client application
  49. * to have a GUI interface.
  50. *
  51. * For Symbian, it uses the native bluetooth search dialog. In this case, the "parent"
  52. * parameter has no effect.
  53. */
  54. QBtSingleDeviceSelectorUI (QWidget* parent = 0);
  55. /**
  56. * Destructor.
  57. */
  58. ~QBtSingleDeviceSelectorUI();
  59. public slots:
  60. /**
  61. * On show, the device discovery starts.
  62. */
  63. void show();
  64. signals:
  65. /**
  66. * Emitted after device discovery stops and user selects the desired device.
  67. */
  68. void discoveryCompleted (const QBtDevice & selectedDevice);
  69. /**
  70. * Emitted after calling show() if and only if the device discovery starts successfully
  71. */
  72. void discoveryStarted();
  73. /**
  74. * Emitted when the user closes the UI without choosing any device.
  75. */
  76. void userCanceled ();
  77. private:
  78. QBtSingleDeviceSelectorUIPrivate* _impl;
  79. friend class QBtSingleDeviceSelectorUIPrivate;
  80. };
  81. QBT_NAMESPACE_END
  82. #endif /* QBTSINGLEDEVICESELECTORUI_H_ */