setIntValue does not set the value if it's equal to the old one. Added a force flag...
[harmattan/cameraplus] / lib / qtcamscene.cpp
1 #include "qtcamscene.h"
2 #include "qtcamcapability_p.h"
3
4 QtCamScene::QtCamScene(QtCamDevice *dev, QObject *parent) :
5   QtCamCapability(new QtCamCapabilityPrivate(dev, QtCamCapability::Scene, "scene-mode"), parent) {
6
7 }
8
9 QtCamScene::~QtCamScene() {
10
11 }
12
13 QtCamScene::SceneMode QtCamScene::value() {
14   int val = 0;
15   if (!d_ptr->intValue(&val)) {
16     return QtCamScene::Auto;
17   }
18
19   switch (val) {
20   case QtCamScene::Manual:
21   case QtCamScene::Closeup:
22   case QtCamScene::Portrait:
23   case QtCamScene::Landscape:
24   case QtCamScene::Sport:
25   case QtCamScene::Night:
26     return (QtCamScene::SceneMode)val;
27
28   default:
29     return QtCamScene::Auto;
30   }
31 }
32
33 bool QtCamScene::setValue(const QtCamScene::SceneMode& mode) {
34   // Scene mode is always forced in order to reset the other capabilities.
35   return d_ptr->setIntValue(mode, true);
36 }