//
// Copyright (c) 2012 Samsung Electronics Co., Ltd.
//
-// Licensed under the Flora License, Version 1.0 (the License);
+// Licensed under the Flora License, Version 1.1 (the License);
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
using namespace Tizen::App;
using namespace Tizen::Base;
using namespace Tizen::Io;
-using namespace std;
static const int DEFAULT_VALUE_EFFECT_SLIDE = 0;
static const int DEFAULT_VALUE_INTERVAL = 3;
+static const int DEFAULT_VALUE_REPEAT = 0;
+static const int DEFAULT_VALUE_SHUFFLE = 0;
const wchar_t* GALLERY_APP_ID = L"ijudt7w61q.Gallery";
const wchar_t* PATH_DATA_DIRECTORY = L"data/";
const wchar_t* PATH_GALLERY_DEFAULT_SETTINGS = L"GalleryDefaultSettings.ini";
-const wchar_t* PATH_GALLERY_SETTINGS = L"GalleryUserSettings.ini";
const wchar_t* SECTION_GALLERY = L"GALLRY_SETTING";
const wchar_t* SECTION_IMAGE_VIEWER = L"IMAGE_VIEWER_SETTING";
const wchar_t* SLIDESHOW_INTERVAL_VALUE = L"SLIDESHOW_INTERVAL_VALUE";
const wchar_t* TRANSITION_EFFECT_VALUE = L"TRANSITION_EFFECT_VALUE";
+const wchar_t* REPEAT_VALUE = L"REPEAT_VALUE";
+const wchar_t* SHUFFLE_VALUE = L"SHUFFLE_VALUE";
SettingPresentationModel* SettingPresentationModel::__pPresentationModelInstance = null;
SettingPresentationModel::SettingPresentationModel(void)
- :__pDefaultGalleryRegistry(null)
- ,__pAppGalleryRegistry(null)
+ : __pDefaultGalleryRegistry(null)
{
AppLogDebug("ENTER");
AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
SettingPresentationModel::~SettingPresentationModel(void)
{
AppLogDebug("ENTER");
+ delete __pDefaultGalleryRegistry;
AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
}
SettingPresentationModel::Construct(void)
{
AppLogDebug("ENTER");
- int valueRegistryNumber = 0;
- String valueRegistryString = L"";
- AppManager* pAppManager = AppManager::GetInstance();
- TryReturn(pAppManager != null, E_FAILURE, "Failed to get AppManager");
- String pathGallerySetting =
- pAppManager->GetAppSharedPath(GALLERY_APP_ID) + PATH_DATA_DIRECTORY + PATH_GALLERY_SETTINGS;
- AppLogDebug("pathGallerySetting(%ls)", pathGallerySetting.GetPointer());
-
- __pDefaultGalleryRegistry = new (std::nothrow) Registry();
- __pAppGalleryRegistry = new (std::nothrow) Registry();
-
result r = CreateDefaultRegistry();
TryCatch(r == E_SUCCESS, , "CreateDefaultRegistry() failed[%s]", GetErrorMessage(r));
- if (File::IsFileExist(pathGallerySetting) == true)
- {
- AppLogDebug("Already exist camcorder settings file");
-
- __pAppGalleryRegistry->Construct(pathGallerySetting, "r+");
- }
- else
- {
- __pAppGalleryRegistry->Construct(pathGallerySetting, "w+");
- r = __pAppGalleryRegistry->AddSection(SECTION_IMAGE_VIEWER);
- TryCatch(r == E_SUCCESS, , "Registry::AddSection() failed[%s]", GetErrorMessage(r));
-
- r = __pDefaultGalleryRegistry->GetValue(SECTION_IMAGE_VIEWER, SLIDESHOW_INTERVAL_VALUE,
- valueRegistryNumber);
- TryCatch(r == E_SUCCESS, , "Registry::GetValue() failed[%s]", GetErrorMessage(r));
- r = __pAppGalleryRegistry->AddValue(SECTION_IMAGE_VIEWER, SLIDESHOW_INTERVAL_VALUE, valueRegistryNumber);
- TryCatch(r == E_SUCCESS, , "Registry::AddValue() failed[%s]", GetErrorMessage(r));
-
- r = __pDefaultGalleryRegistry->GetValue(SECTION_IMAGE_VIEWER, TRANSITION_EFFECT_VALUE,
- valueRegistryString);
- TryCatch(r == E_SUCCESS, , "Registry::GetValue() failed[%s]", GetErrorMessage(r));
- r = __pAppGalleryRegistry->AddValue(SECTION_IMAGE_VIEWER, TRANSITION_EFFECT_VALUE, valueRegistryString);
- TryCatch(r == E_SUCCESS, , "Registry::AddValue() failed[%s]", GetErrorMessage(r));
-
- r = __pAppGalleryRegistry->Flush();
- TryCatch(r == E_SUCCESS, , "Registry::Flush() failed[%s]", GetErrorMessage(r));
- r = __pDefaultGalleryRegistry->Flush();
- TryCatch(r == E_SUCCESS, , "Registry::Flush() failed[%s]", GetErrorMessage(r));
- }
AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
return r;
CATCH:
- delete __pDefaultGalleryRegistry;
- __pDefaultGalleryRegistry = null;
-
- delete __pAppGalleryRegistry;
- __pAppGalleryRegistry = null;
AppLogDebug("EXIT with exception(%s)", GetErrorMessage(GetLastResult()));
return r;
SettingPresentationModel::GetValue(const String& strSectionName, const String& entryName, int& value) const
{
AppLogDebug("ENTER");
- result r = __pAppGalleryRegistry->GetValue(strSectionName, entryName, value);
+ result r = __pDefaultGalleryRegistry->GetValue(strSectionName, entryName, value);
TryCatch(r == E_SUCCESS, , "Registry::GetValue() failed[%s]", GetErrorMessage(r));
AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
SettingPresentationModel::GetValue(const String& strSectionName, const String& entryName, String& value) const
{
AppLogDebug("ENTER");
- result r = __pAppGalleryRegistry->GetValue(strSectionName, entryName, value);
+ result r = __pDefaultGalleryRegistry->GetValue(strSectionName, entryName, value);
TryCatch(r == E_SUCCESS, , "Registry::GetValue() failed[%s]", GetErrorMessage(r));
AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
SettingPresentationModel::SetValue(const String& strSectionName, const String& entryName, const int value)
{
AppLogDebug("ENTER");
- result r= __pAppGalleryRegistry->SetValue(strSectionName, entryName, value);
+ result r= __pDefaultGalleryRegistry->SetValue(strSectionName, entryName, value);
TryCatch(r == E_SUCCESS, , "Registry::SetValue() failed[%s]", GetErrorMessage(r));
- r = __pAppGalleryRegistry->Flush();
+ r = __pDefaultGalleryRegistry->Flush();
AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
return r;
SettingPresentationModel::SetValue(const String& strSectionName, const String& entryName, const String& value)
{
AppLogDebug("ENTER");
- result r = __pAppGalleryRegistry->SetValue(strSectionName, entryName, value);
+ result r = __pDefaultGalleryRegistry->SetValue(strSectionName, entryName, value);
TryCatch(r == E_SUCCESS, , "Registry::SetValue() failed[%s]", GetErrorMessage(r));
- r = __pAppGalleryRegistry->Flush();
+ r = __pDefaultGalleryRegistry->Flush();
AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
return r;
pAppManager->GetAppSharedPath(GALLERY_APP_ID) + PATH_DATA_DIRECTORY + PATH_GALLERY_DEFAULT_SETTINGS;
AppLogDebug("pathGalleryDefaultSetting(%ls)", pathGalleryDefaultSetting.GetPointer());
+ __pDefaultGalleryRegistry = new (std::nothrow) Registry();
if (File::IsFileExist(pathGalleryDefaultSetting))
{
AppLogDebug("Already exist default settings file");
DEFAULT_VALUE_EFFECT_SLIDE);
TryCatch(r == E_SUCCESS, , "Registry::AddValue() failed[%s]", GetErrorMessage(r));
- r = __pDefaultGalleryRegistry->Flush();
- TryCatch(r == E_SUCCESS, , "Registry::Flush() failed[%s]", GetErrorMessage(r));
- }
- AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
-
- return r;
-
-CATCH:
- AppLogDebug("EXIT with exception(%s)", GetErrorMessage(GetLastResult()));
-
- return r;
-}
+ r = __pDefaultGalleryRegistry->AddValue(SECTION_IMAGE_VIEWER, REPEAT_VALUE,
+ DEFAULT_VALUE_REPEAT);
+ TryCatch(r == E_SUCCESS, , "Registry::AddValue() failed[%s]", GetErrorMessage(r));
-result
-SettingPresentationModel::ResetGallerySettingsRegistry(void)
-{
- AppLogDebug("ENTER");
- AppManager* pAppManager = AppManager::GetInstance();
- TryReturn(pAppManager != null, E_FAILURE, "Failed to get AppManager");
- String pathGallerySetting =
- pAppManager->GetAppSharedPath(GALLERY_APP_ID) + PATH_DATA_DIRECTORY + PATH_GALLERY_SETTINGS;
+ r = __pDefaultGalleryRegistry->AddValue(SECTION_IMAGE_VIEWER, SHUFFLE_VALUE,
+ DEFAULT_VALUE_SHUFFLE);
+ TryCatch(r == E_SUCCESS, , "Registry::AddValue() failed[%s]", GetErrorMessage(r));
- if (File::IsFileExist(pathGallerySetting))
- {
- File::Remove(pathGallerySetting);
+ r = __pDefaultGalleryRegistry->Flush();
+ TryCatch(r == E_SUCCESS, , "Registry::Flush() failed[%s]", GetErrorMessage(r));
}
-
- result r = Construct();
- TryCatch(r == E_SUCCESS, , "CameraSettingsPresentationModel::Construct() failed[%s]", GetErrorMessage(r));
AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
return r;
CATCH:
+ delete __pDefaultGalleryRegistry;
+ __pDefaultGalleryRegistry = null;
AppLogDebug("EXIT with exception(%s)", GetErrorMessage(GetLastResult()));
return r;