// WidgetStartFileInfo
#include <dpl/localization/localization_utils.h>
-enum WidgetStandard
-{
- WidgetStandard_Unknown,
- WidgetStandard_Wac20
-};
-
typedef std::list<WarpIRI> WarpIRIList;
/**
// WidgetExecutionPhase_Invoke = 1 << 3
//};
-/**
- * Widget version is optional
- */
-typedef DPL::Optional<WidgetVersion> OptionalWidgetVersion;
-
class WidgetModel;
class WidgetAccessList
bool m_isAccessAll;
};
-struct WidgetStorageSize
-{
- WidgetStorageSize() :
- applicationStorage(0),
- dataStorage(0)
- {
- }
- WidgetStorageSize(size_t pApplicationStorage,
- size_t pDataStorage) :
- applicationStorage(pApplicationStorage),
- dataStorage(pDataStorage)
- {
- }
- size_t applicationStorage;
- size_t dataStorage;
-};
-
static const DPL::String SETTING_NAME_SCREEN_ORIENTATION =
L"screen-orientation";
static const DPL::String SETTING_NAME_INDICATOR_PRESENCE =
WidgetConfig::GetWidgetTemporaryStoragePath(
this->TizenId + getTimestamp()))
),
- GUID(
- this,
- &BindToWidgetDAO<WidgetGUID, &WidgetDAOReadOnly::getGUID>::Get),
defaultlocale(
this,
&BindToWidgetDAO<DPL::OptionalString,
&WidgetDAOReadOnly::getDefaultlocale>::Get),
- Version(this, &WidgetModel::readVersion),
Name(this),
//localized, so not binded
ShortName(this),
&BindToWidgetDAO<WindowModeList,
&WidgetDAOReadOnly::getWindowModes>::Get),
//localized, so not binded
- Standard(this, &WidgetModel::readStandard),
- ApplicationStorage(this, &WidgetModel::getApplicationStorage),
// AccessNetwork(this, false),
// WarpDefinitionEmpty(this),
BackSupported(
return TizenId;
}
-WidgetStorageSize WidgetModel::getApplicationStorage(DPL::Event::Model *model)
-{
- Assert(model);
- WidgetModel *widgetModel = static_cast<WidgetModel *>(model);
- WidgetDAOReadOnly widgetDao(widgetModel->TizenId);
-
- const DPL::String installPath = widgetDao.getPath();
- const DPL::String persistentPath =
- widgetModel->PersistentStoragePath.Get();
- const DPL::String temporaryPath =
- widgetModel->TemporaryStoragePath.Get();
-
- size_t appSize =
- Utils::getFolderSize(DPL::ToUTF8String(installPath));
-
- auto isPrefix =
- [&installPath](const DPL::String& possiblePrefix)
- {
- return possiblePrefix.length() <= installPath.length() &&
- std::equal(possiblePrefix.begin(),
- possiblePrefix.end(),
- installPath.begin());
- };
-
- size_t persistanceSize =
- Utils::getFolderSize(DPL::ToUTF8String(persistentPath));
- // we have to remember that persistance path can be inside install path
- if (isPrefix(persistentPath)) {
- appSize -= persistanceSize;
- }
-
- size_t temporarySize =
- Utils::getFolderSize(DPL::ToUTF8String(temporaryPath));
- // we have to remember that persistance path can be inside install path
- if (isPrefix(temporaryPath)) {
- appSize -= temporarySize;
- }
-
- LogDebug("App size: " << appSize);
- LogDebug("Persistance size: " << persistanceSize);
- LogDebug("Temporary size: " << temporaryPath);
- return WidgetStorageSize(appSize, persistanceSize + temporarySize);
-}
-
-namespace { //anonymous
-const float FLOAT_WAC20_REPRESENTATION = 2.0;
-} //namespace anonymous
-
-WidgetStandard WidgetModel::readStandard(DPL::Event::Model *model)
-{
- WidgetModel *widgetModel = static_cast<WidgetModel *>(model);
-
- DPL::OptionalString minWacVersionString =
- WidgetDAOReadOnly(widgetModel->TizenId).getMinimumWacVersion();
-
- if (!minWacVersionString) {
- return WidgetStandard_Unknown;
- } else {
- float minWacVersion;
- std::stringstream minWacVersionStream(DPL::ToUTF8String(
- *minWacVersionString));
- minWacVersionStream >> minWacVersion;
- if (minWacVersionStream.fail()) {
- return WidgetStandard_Unknown;
- } else if (minWacVersion == FLOAT_WAC20_REPRESENTATION) {
- return WidgetStandard_Wac20;
- } else {
- return WidgetStandard_Unknown;
- }
- }
-}
-
-OptionalWidgetVersion WidgetModel::readVersion(DPL::Event::Model *model)
-{
- WidgetModel *widgetModel = static_cast<WidgetModel *>(model);
-
- DPL::OptionalString optionalVersionString =
- WidgetDAOReadOnly(widgetModel->TizenId).getVersion();
-
- if (!optionalVersionString) {
- return OptionalWidgetVersion();
- } else {
- return OptionalWidgetVersion(WidgetVersion(*optionalVersionString));
- }
-}
-
DPL::String WidgetModel::getTimestamp()
{
struct timeval tv;
DPL::Event::Property<DPL::String, DPL::Event::PropertyReadOnly> TemporaryStoragePath;
/**
- * @brief Widget GUID
- */
- DPL::Event::Property<WrtDB::WidgetGUID,
- DPL::Event::PropertyReadOnly,
- DPL::Event::PropertyStorageDynamicCached> GUID;
-
- /**
* @brief Widget defaultlocale
*/
DPL::Event::Property<DPL::OptionalString,
DPL::Event::PropertyStorageDynamicCached> defaultlocale;
/**
- * @brief Widget version
- */
- DPL::Event::Property<OptionalWidgetVersion,
- DPL::Event::PropertyReadOnly,
- DPL::Event::PropertyStorageDynamicCached> Version;
-
- /**
* @brief Widget name
*/
DPL::Event::Property<DPL::OptionalString> Name;
DPL::Event::PropertyReadOnly,
DPL::Event::PropertyStorageDynamic> WindowModes;
- /**
- * @brief Minimum of the WAC Engine Standard required to run widget.
- */
- DPL::Event::Property<WidgetStandard,
- DPL::Event::PropertyReadOnly,
- DPL::Event::PropertyStorageDynamicCached> Standard;
-
- /**
- * @brief How much space application and its storage takes.
- */
- DPL::Event::Property<WidgetStorageSize,
- DPL::Event::PropertyReadOnly,
- DPL::Event::PropertyStorageDynamicCached> ApplicationStorage;
// /**
// * @brief Value of network element.
// */
private:
// Custom read write delegates
- static WidgetStandard readStandard(DPL::Event::Model *model);
- static OptionalWidgetVersion readVersion(DPL::Event::Model *model);
- static WidgetStorageSize getApplicationStorage(DPL::Event::Model *model);
static DPL::String getTimestamp();
DPL::String getTizenId() const;