camfeatures.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*****************************************************************
  2. * Copyright (C) 2012 Marco Bavagnoli - lil.deimos@gmail.com *
  3. ******************************************************************/
  4. #ifndef OMGCAM_H
  5. #define OMGCAM_H
  6. #include <QDeclarativeItem>
  7. #include <QCamera>
  8. class cameraFeatures : public QDeclarativeItem
  9. {
  10. Q_OBJECT
  11. Q_ENUMS(ExposureMode)
  12. Q_ENUMS(FlashMode)
  13. Q_ENUMS(State)
  14. Q_ENUMS(WhiteBalanceMode)
  15. public:
  16. enum ExposureMode {
  17. ExposureAuto = QCameraExposure::ExposureAuto,
  18. ExposureManual = QCameraExposure::ExposureManual,
  19. ExposurePortrait = QCameraExposure::ExposurePortrait,
  20. ExposureNight = QCameraExposure::ExposureNight,
  21. ExposureBacklight = QCameraExposure::ExposureBacklight,
  22. ExposureSpotlight = QCameraExposure::ExposureSpotlight,
  23. ExposureSports = QCameraExposure::ExposureSports,
  24. ExposureSnow = QCameraExposure::ExposureSnow,
  25. ExposureBeach = QCameraExposure::ExposureBeach,
  26. ExposureLargeAperture = QCameraExposure::ExposureLargeAperture,
  27. ExposureSmallAperture = QCameraExposure::ExposureSmallAperture,
  28. ExposureModeVendor = QCameraExposure::ExposureModeVendor
  29. };
  30. enum FlashMode {
  31. FlashAuto = QCameraExposure::FlashAuto,
  32. FlashOff = QCameraExposure::FlashOff,
  33. FlashOn = QCameraExposure::FlashOn,
  34. FlashRedEyeReduction = QCameraExposure::FlashRedEyeReduction,
  35. FlashFill = QCameraExposure::FlashFill,
  36. FlashTorch = QCameraExposure::FlashTorch,
  37. FlashSlowSyncFrontCurtain = QCameraExposure::FlashSlowSyncFrontCurtain,
  38. FlashSlowSyncRearCurtain = QCameraExposure::FlashSlowSyncRearCurtain,
  39. FlashManual = QCameraExposure::FlashManual
  40. };
  41. enum State {
  42. ActiveState = QCamera::ActiveState,
  43. LoadedState = QCamera::LoadedState,
  44. UnloadedState = QCamera::UnloadedState
  45. };
  46. enum WhiteBalanceMode {
  47. WhiteBalanceAuto = QCameraImageProcessing::WhiteBalanceAuto,
  48. WhiteBalanceManual = QCameraImageProcessing::WhiteBalanceManual,
  49. WhiteBalanceSunlight = QCameraImageProcessing::WhiteBalanceSunlight,
  50. WhiteBalanceCloudy = QCameraImageProcessing::WhiteBalanceCloudy,
  51. WhiteBalanceShade = QCameraImageProcessing::WhiteBalanceShade,
  52. WhiteBalanceTungsten = QCameraImageProcessing::WhiteBalanceTungsten,
  53. WhiteBalanceFluorescent = QCameraImageProcessing::WhiteBalanceFluorescent,
  54. WhiteBalanceIncandescent = QCameraImageProcessing::WhiteBalanceIncandescent,
  55. WhiteBalanceFlash = QCameraImageProcessing::WhiteBalanceFlash,
  56. WhiteBalanceSunset = QCameraImageProcessing::WhiteBalanceSunset,
  57. WhiteBalanceVendor = QCameraImageProcessing::WhiteBalanceVendor
  58. };
  59. explicit cameraFeatures(QDeclarativeItem *parent = 0);
  60. Q_INVOKABLE void startGetFeatures(QString device);
  61. Q_INVOKABLE QStringList getAvailableDevices();
  62. Q_INVOKABLE bool isExposureSupported(ExposureMode state);
  63. Q_INVOKABLE bool isFlashModeSupported(FlashMode state);
  64. Q_INVOKABLE bool isWhiteBalanceSupported(WhiteBalanceMode state);
  65. Q_INVOKABLE QList<int> getIsoModesSupportedList();
  66. Q_INVOKABLE QList<qreal> getSupportedAperturesList();
  67. Q_INVOKABLE QList<qreal> getSupportedShutterSpeedsList();
  68. Q_INVOKABLE QStringList getCompensationsModes();
  69. Q_INVOKABLE QList<QSize> getSupportedResolutionsList();
  70. public slots:
  71. void getFeatures(QCamera::State state);
  72. signals:
  73. void featuresRetrieved();
  74. protected:
  75. QCamera *m_camera;
  76. bool m_featuredAcquired;
  77. QStringList availableDevices;
  78. QList<ExposureMode> availableExposures;
  79. QList<FlashMode> availableFlashModes;
  80. QList<WhiteBalanceMode> availableWhiteBalanceModes;
  81. QList<int> availableIsoModes;
  82. QList<qreal> availableApertureModes;
  83. QList<qreal> availableShutterSpeedModes;
  84. QStringList availableCompensationModes;
  85. QList<QSize> availableResolutionsSpeedModes;
  86. };
  87. #endif // OMGCAM_H