screengrabber/src/settingsview.cpp
changeset 17 4f2773374eff
parent 15 e11368ed4880
equal deleted inserted replaced
15:e11368ed4880 17:4f2773374eff
    58     mModel = new HbDataFormModel(this);
    58     mModel = new HbDataFormModel(this);
    59     
    59     
    60     // DataFormItem for mode selection
    60     // DataFormItem for mode selection
    61     mModeItem = mModel->appendDataFormItem(
    61     mModeItem = mModel->appendDataFormItem(
    62             HbDataFormModelItem::RadioButtonListItem, QString("Capture mode"), 0);
    62             HbDataFormModelItem::RadioButtonListItem, QString("Capture mode"), 0);
    63     //setting the text property of check box.
       
    64     mModeItem->setData(HbDataFormModelItem::KeyRole, QString("mode"));
       
    65     mModeItem->setContentWidgetData(QString("items"), CAPTUREMODES);
    63     mModeItem->setContentWidgetData(QString("items"), CAPTUREMODES);
    66     
    64     
    67     // Create setting model
    65     // Create setting model
    68      createSingleCaptureComponents(mModel, 0);
    66      createSingleCaptureComponents(mModel, 0);
    69      createSequentialCaptureComponents(mModel, 0);
    67      createSequentialCaptureComponents(mModel, 0);
    72     // Set created model model to form
    70     // Set created model model to form
    73     mSettingForm->setModel(mModel);
    71     mSettingForm->setModel(mModel);
    74     setWidget(mSettingForm);//takes ownership
    72     setWidget(mSettingForm);//takes ownership
    75     
    73     
    76     // Get view item of mode selection item
    74     // Get view item of mode selection item
    77     HbDataFormViewItem *viewItemVideoPage = mSettingForm->dataFormViewItem(mModel->indexFromItem(mModeItem));
    75     HbDataFormViewItem *viewItemVideoPage = static_cast<HbDataFormViewItem*>(mSettingForm->itemByIndex(mModel->indexFromItem(mModeItem)));
    78 
    76 
    79     loadSettings();
    77     loadSettings();
    80     
    78     
    81     // Connect signals from item modifications and close with this form's slots
    79     // Connect signals from item modifications and close with this form's slots
    82    
       
    83 //    connect(viewItemVideoPage, SIGNAL(itemModified(QPersistentModelIndex, QVariant)), this, SLOT(updateShownItems()));
       
    84     connect(actionSaveSettings, SIGNAL(triggered()), this, SLOT(saveAndClose()));
    80     connect(actionSaveSettings, SIGNAL(triggered()), this, SLOT(saveAndClose()));
    85     connect(actionCancel, SIGNAL(triggered()), this, SLOT(close()));
    81     connect(actionCancel, SIGNAL(triggered()), this, SLOT(close()));
    86 	
    82 	
    87 	HbAction *mDefaultNavigationAction = new HbAction(Hb::QuitNaviAction, this);
    83 	HbAction *mDefaultNavigationAction = new HbAction(Hb::QuitNaviAction, this);
    88 	connect(mDefaultNavigationAction,SIGNAL(triggered()), this, SLOT(saveAndClose()));
    84 	connect(mDefaultNavigationAction,SIGNAL(triggered()), this, SLOT(saveAndClose()));
   142     mGroupImageCapture = model->appendDataFormGroup(QString("Single image settings"), parent);
   138     mGroupImageCapture = model->appendDataFormGroup(QString("Single image settings"), parent);
   143 
   139 
   144     // DataFormItem for hotkey selection
   140     // DataFormItem for hotkey selection
   145     mImageHotKeyItem = model->appendDataFormItem(
   141     mImageHotKeyItem = model->appendDataFormItem(
   146             HbDataFormModelItem::RadioButtonListItem, QString("Capture hotkey"), mGroupImageCapture);
   142             HbDataFormModelItem::RadioButtonListItem, QString("Capture hotkey"), mGroupImageCapture);
   147     //setting the text property of check box.
       
   148     mImageHotKeyItem->setData(HbDataFormModelItem::KeyRole, QString("image_hotkey"));
       
   149     mImageHotKeyItem->setContentWidgetData(QString("items"), KEYS);
   143     mImageHotKeyItem->setContentWidgetData(QString("items"), KEYS);
   150 
   144 
   151     // DataFormItem for image format selection
   145     // DataFormItem for image format selection
   152     mImageFormatItem = model->appendDataFormItem(
   146     mImageFormatItem = model->appendDataFormItem(
   153             HbDataFormModelItem::RadioButtonListItem, QString("Image format"), mGroupImageCapture);
   147             HbDataFormModelItem::RadioButtonListItem, QString("Image format"), mGroupImageCapture);
   154     //setting the text property of check box.
       
   155     mImageFormatItem->setData(HbDataFormModelItem::KeyRole, QString("image_format"));
       
   156     mImageFormatItem->setContentWidgetData(QString("items"), IMAGEFORMATS);
   148     mImageFormatItem->setContentWidgetData(QString("items"), IMAGEFORMATS);
   157     
   149     
   158     // DataFormItem for memory in use selection
   150     // DataFormItem for memory in use selection
   159     mImageMemoryInUseItem = model->appendDataFormItem(
   151     mImageMemoryInUseItem = model->appendDataFormItem(
   160             HbDataFormModelItem::RadioButtonListItem, QString("Memory in use"), mGroupImageCapture);
   152             HbDataFormModelItem::RadioButtonListItem, QString("Memory in use"), mGroupImageCapture);
   161     //setting the text property of check box.
       
   162     mImageMemoryInUseItem->setData(HbDataFormModelItem::KeyRole, QString("image_memory"));
       
   163     mImageMemoryInUseItem->setContentWidgetData(QString("items"), MEMORYMODES);
   153     mImageMemoryInUseItem->setContentWidgetData(QString("items"), MEMORYMODES);
   164     
   154     
   165     // DataFormItem for file name
   155     // DataFormItem for file name
   166     mImageFileNameItem = model->appendDataFormItem(
   156     mImageFileNameItem = model->appendDataFormItem(
   167             HbDataFormModelItem::TextItem, QString("File name"), mGroupImageCapture);
   157             HbDataFormModelItem::TextItem, QString("File name"), mGroupImageCapture);
   168     //setting the text property of check box.
       
   169     mImageFileNameItem->setData(HbDataFormModelItem::KeyRole, QString("image_name"));
       
   170     mImageFileNameItem->setContentWidgetData(QString("text"), QString("Shot"));
   158     mImageFileNameItem->setContentWidgetData(QString("text"), QString("Shot"));
   171     
   159     
   172 }
   160 }
   173 
   161 
   174 // ---------------------------------------------------------------------------
   162 // ---------------------------------------------------------------------------
   181     mGroupSeguantialCapture = model->appendDataFormGroup(QString("Sequential image settings"), parent);
   169     mGroupSeguantialCapture = model->appendDataFormGroup(QString("Sequential image settings"), parent);
   182     
   170     
   183     // DataFormItem for hotkey selection
   171     // DataFormItem for hotkey selection
   184     mSequantialHotKeyItem = model->appendDataFormItem(
   172     mSequantialHotKeyItem = model->appendDataFormItem(
   185             HbDataFormModelItem::RadioButtonListItem, QString("Capture hotkey"), mGroupSeguantialCapture);
   173             HbDataFormModelItem::RadioButtonListItem, QString("Capture hotkey"), mGroupSeguantialCapture);
   186     //setting the text property of check box.
       
   187     mSequantialHotKeyItem->setData(HbDataFormModelItem::KeyRole, QString("seguential_hotkey"));
       
   188     mSequantialHotKeyItem->setContentWidgetData(QString("items"), KEYS);
   174     mSequantialHotKeyItem->setContentWidgetData(QString("items"), KEYS);
   189     
   175     
   190     // DataFormItem for image format selection
   176     // DataFormItem for image format selection
   191     mSequantialFormatItem = model->appendDataFormItem(
   177     mSequantialFormatItem = model->appendDataFormItem(
   192             HbDataFormModelItem::RadioButtonListItem, QString("Image format"), mGroupSeguantialCapture);
   178             HbDataFormModelItem::RadioButtonListItem, QString("Image format"), mGroupSeguantialCapture);
   193     //setting the text property of check box.
       
   194     mSequantialFormatItem->setData(HbDataFormModelItem::KeyRole, QString("seguential_format"));
       
   195     mSequantialFormatItem->setContentWidgetData(QString("items"), IMAGEFORMATS);
   179     mSequantialFormatItem->setContentWidgetData(QString("items"), IMAGEFORMATS);
   196     
   180     
   197     // DataFormItem for delay between images selection
   181     // DataFormItem for delay between images selection
   198     mSequantialDelayItem = model->appendDataFormItem(
   182     mSequantialDelayItem = model->appendDataFormItem(
   199             HbDataFormModelItem::TextItem, QString("Delay between two images(ms)"), mGroupSeguantialCapture);
   183             HbDataFormModelItem::TextItem, QString("Delay between two images(ms)"), mGroupSeguantialCapture);
   200     //setting the text property of check box.
       
   201     mSequantialDelayItem->setData(HbDataFormModelItem::KeyRole, QString("seguential_name"));
       
   202     mSequantialDelayItem->setContentWidgetData(QString("text"), QString("Shot"));
   184     mSequantialDelayItem->setContentWidgetData(QString("text"), QString("Shot"));
   203     
   185     
   204     // DataFormItem for memory selection
   186     // DataFormItem for memory selection
   205     mSequantialMemoryInUseItem = model->appendDataFormItem(
   187     mSequantialMemoryInUseItem = model->appendDataFormItem(
   206             HbDataFormModelItem::RadioButtonListItem, QString("Memory in use"), mGroupSeguantialCapture);
   188             HbDataFormModelItem::RadioButtonListItem, QString("Memory in use"), mGroupSeguantialCapture);
   207     //setting the text property of check box.
       
   208     mSequantialMemoryInUseItem->setData(HbDataFormModelItem::KeyRole, QString("seguential_memory"));
       
   209     mSequantialMemoryInUseItem->setContentWidgetData(QString("items"), MEMORYMODES);
   189     mSequantialMemoryInUseItem->setContentWidgetData(QString("items"), MEMORYMODES);
   210     
   190     
   211     // DataFormItem for file name
   191     // DataFormItem for file name
   212     mSequantialFileNameItem = model->appendDataFormItem(
   192     mSequantialFileNameItem = model->appendDataFormItem(
   213             HbDataFormModelItem::TextItem, QString("File name"), mGroupSeguantialCapture);
   193             HbDataFormModelItem::TextItem, QString("File name"), mGroupSeguantialCapture);
   214     //setting the text property of check box.
       
   215     mSequantialFileNameItem->setData(HbDataFormModelItem::KeyRole, QString("seguential_name"));
       
   216     mSequantialFileNameItem->setContentWidgetData(QString("text"), QString("Shot"));
   194     mSequantialFileNameItem->setContentWidgetData(QString("text"), QString("Shot"));
   217     
   195     
   218 }
   196 }
   219 
   197 
   220 // ---------------------------------------------------------------------------
   198 // ---------------------------------------------------------------------------
   226     mGroupVideoCapture = model->appendDataFormGroup(QString("Video settings"), parent);
   204     mGroupVideoCapture = model->appendDataFormGroup(QString("Video settings"), parent);
   227     
   205     
   228     // DataFormItem for hotkey selection
   206     // DataFormItem for hotkey selection
   229     mVideoHotKeyItem = model->appendDataFormItem(
   207     mVideoHotKeyItem = model->appendDataFormItem(
   230             HbDataFormModelItem::RadioButtonListItem, QString("Start/Stop hotkey"), mGroupVideoCapture);
   208             HbDataFormModelItem::RadioButtonListItem, QString("Start/Stop hotkey"), mGroupVideoCapture);
   231     //setting the text property of check box.
       
   232     mVideoHotKeyItem->setData(HbDataFormModelItem::KeyRole, QString("video_hotkey"));
       
   233     mVideoHotKeyItem->setContentWidgetData(QString("items"), KEYS);
   209     mVideoHotKeyItem->setContentWidgetData(QString("items"), KEYS);
   234     
   210     
   235     // DataFormItem for video format selection
   211     // DataFormItem for video format selection
   236     mVideoFormatItem = model->appendDataFormItem(
   212     mVideoFormatItem = model->appendDataFormItem(
   237             HbDataFormModelItem::RadioButtonListItem, QString("Video format"), mGroupVideoCapture);
   213             HbDataFormModelItem::RadioButtonListItem, QString("Video format"), mGroupVideoCapture);
   238     //setting the text property of check box.
       
   239     mVideoFormatItem->setData(HbDataFormModelItem::KeyRole, QString("video_format"));
       
   240     mVideoFormatItem->setContentWidgetData(QString("items"), VIDEOFORMATS);
   214     mVideoFormatItem->setContentWidgetData(QString("items"), VIDEOFORMATS);
   241     
   215     
   242     // DataFormItem for memory selection
   216     // DataFormItem for memory selection
   243     mVideoMemoryInUseItem = model->appendDataFormItem(
   217     mVideoMemoryInUseItem = model->appendDataFormItem(
   244             HbDataFormModelItem::RadioButtonListItem, QString("Memory in use"), mGroupVideoCapture);
   218             HbDataFormModelItem::RadioButtonListItem, QString("Memory in use"), mGroupVideoCapture);
   245     //setting the text property of check box.mGroupVideoCapture
       
   246     mVideoMemoryInUseItem->setData(HbDataFormModelItem::KeyRole, QString("video_memory"));
       
   247     mVideoMemoryInUseItem->setContentWidgetData(QString("items"), MEMORYMODES);
   219     mVideoMemoryInUseItem->setContentWidgetData(QString("items"), MEMORYMODES);
   248     
   220     
   249     // DataFormItem for file name
   221     // DataFormItem for file name
   250     mVideoFileNameItem = model->appendDataFormItem(
   222     mVideoFileNameItem = model->appendDataFormItem(
   251             HbDataFormModelItem::TextItem, QString("File name"), mGroupVideoCapture);
   223             HbDataFormModelItem::TextItem, QString("File name"), mGroupVideoCapture);
   252     //setting the text property of check box.
       
   253     mVideoFileNameItem->setData(HbDataFormModelItem::KeyRole, QString("video_name"));
       
   254     mVideoFileNameItem->setContentWidgetData(QString("text"), QString("Video"));
   224     mVideoFileNameItem->setContentWidgetData(QString("text"), QString("Video"));
   255     
   225     
   256 }
   226 }
   257 
   227 
   258 // ---------------------------------------------------------------------------
   228 // ---------------------------------------------------------------------------
   267     
   237     
   268     mEngineWrapper.EnableRcpOfFoc(EFalse);
   238     mEngineWrapper.EnableRcpOfFoc(EFalse);
   269     mMainWindow.setCurrentView(&mMainView);
   239     mMainWindow.setCurrentView(&mMainView);
   270 	
   240 	
   271 }
   241 }
   272 
       
   273 
       
   274 
   242 
   275 // ---------------------------------------------------------------------------
   243 // ---------------------------------------------------------------------------
   276 
   244 
   277 void SettingsView::readFormItems()
   245 void SettingsView::readFormItems()
   278 {
   246 {
   299     mSettings.mVideoCaptureFileName = mVideoFileNameItem ->contentWidgetData("text").toString();
   267     mSettings.mVideoCaptureFileName = mVideoFileNameItem ->contentWidgetData("text").toString();
   300 	
   268 	
   301    
   269    
   302 }
   270 }
   303 
   271 
   304 
       
   305 // ---------------------------------------------------------------------------
       
   306 /*
       
   307 void SettingsView::updateShownItems()
       
   308 { 
       
   309 
       
   310     if (mMainWindow.currentView() == this) {
       
   311         // Get view items of each group
       
   312         HbDataFormViewItem *viewItemImageGroup = mSettingForm->dataFormViewItem(mModel->indexFromItem(mGroupImageCapture));
       
   313         HbDataFormViewItem *viewItemSequantialGroup = mSettingForm->dataFormViewItem(mModel->indexFromItem(mGroupSeguantialCapture));
       
   314         HbDataFormViewItem *viewItemVideoGroup = mSettingForm->dataFormViewItem(mModel->indexFromItem(mGroupVideoCapture));
       
   315 
       
   316     
       
   317         // Set certain group expanded according to selected mode. 
       
   318         // TODO this does not work correctly with WK38(selectedItem is for some reason always 1)
       
   319     
       
   320         int selectedItem = mModeItem->contentWidgetData("selected").toInt();
       
   321         
       
   322         if (selectedItem == SINGLE){
       
   323             viewItemImageGroup->setExpanded(true);
       
   324             viewItemSequantialGroup->setExpanded(false);
       
   325             viewItemVideoGroup->setExpanded(false);
       
   326     
       
   327         }
       
   328         else if (selectedItem == SEQUENTIAL){
       
   329             viewItemImageGroup->setExpanded(false);
       
   330             viewItemSequantialGroup->setExpanded(true);
       
   331             viewItemVideoGroup->setExpanded(false);    
       
   332         }
       
   333         
       
   334         else if (selectedItem == VIDEO){
       
   335             viewItemImageGroup->setExpanded(false);
       
   336             viewItemSequantialGroup->setExpanded(false);
       
   337             viewItemVideoGroup->setExpanded(true);
       
   338         }
       
   339         
       
   340         
       
   341     }
       
   342     
       
   343 }
       
   344 */
       
   345 // ---------------------------------------------------------------------------
   272 // ---------------------------------------------------------------------------
   346 
   273 
   347 void SettingsView::close()
   274 void SettingsView::close()
   348 {
   275 {
   349     mEngineWrapper.EnableRcpOfFoc(EFalse);
   276     mEngineWrapper.EnableRcpOfFoc(EFalse);