homescreenapp/hsdomainmodel/inc/hsdatabase.h
changeset 62 341166945d65
parent 55 03646e8da489
child 81 7dd137878ff8
equal deleted inserted replaced
57:2e2dc3d30ca8 62:341166945d65
    17 
    17 
    18 #ifndef HSDATABASE_H
    18 #ifndef HSDATABASE_H
    19 #define HSDATABASE_H
    19 #define HSDATABASE_H
    20 
    20 
    21 #include <QObject>
    21 #include <QObject>
    22 #include <QScopedPointer>
       
    23 #include <QVariantHash>
    22 #include <QVariantHash>
    24 
    23 
    25 #include "hsdomainmodel_global.h"
    24 #include "hsdomainmodel_global.h"
       
    25 #include "hstest_global.h"
    26 
    26 
    27 #include <HbFeedback>
    27 HOMESCREEN_TEST_CLASS(TestHsDomainModel)
    28 
    28 
    29 class HsSceneData;
    29 class HsSceneData;
    30 class HsPageData;
    30 class HsPageData;
    31 class HsWidgetData;
    31 class HsWidgetData;
    32 class HsWidgetPresentationData;
    32 class HsWidgetPresentationData;
    33 class HsGeneralConfiguration;
       
    34 class HsFeedbackConfiguration;
       
    35 class HsSnapConfiguration;
       
    36 
    33 
    37 class HSDOMAINMODEL_EXPORT HsDatabase : public QObject
    34 class HSDOMAINMODEL_EXPORT HsDatabase : public QObject
    38 {
    35 {
    39     Q_OBJECT
    36     Q_OBJECT
    40     Q_PROPERTY(QString connectionName READ connectionName WRITE setConnectionName)
    37     Q_PROPERTY(QString connectionName READ connectionName WRITE setConnectionName)
    55     bool transaction();
    52     bool transaction();
    56     bool rollback();
    53     bool rollback();
    57     bool commit();
    54     bool commit();
    58 
    55 
    59     bool scene(HsSceneData &data);
    56     bool scene(HsSceneData &data);
    60     bool updateScene(const HsSceneData &data);
    57     
    61 
       
    62     bool pages(QList<HsPageData> &data);
    58     bool pages(QList<HsPageData> &data);
    63     bool page(HsPageData &data);
    59     bool page(HsPageData &data);
    64     bool insertPage(HsPageData &data);
    60     bool insertPage(HsPageData &data);
    65     bool updatePage(const HsPageData &data);
    61     bool updatePage(const HsPageData &data);
    66     bool deletePage(int id);
    62     bool deletePage(int id);
    67     
    63     
    68     bool widgets(int pageId, QList<HsWidgetData> &data);
    64     bool widgets(int pageId, QList<HsWidgetData> &data);
    69     bool widgets(const QString &uri, QList<HsWidgetData> &data);
    65     bool widgets(const QString &uri, QList<HsWidgetData> &data);
       
    66     bool widgets(const QString &uri, const QVariantHash &preferences, int &count);
    70     bool widget(HsWidgetData &data);
    67     bool widget(HsWidgetData &data);
    71     bool insertWidget(HsWidgetData &data);
    68     bool insertWidget(HsWidgetData &data);
    72     bool updateWidget(const HsWidgetData &data);
    69     bool updateWidget(const HsWidgetData &data);
    73     bool deleteWidget(int id);
    70     bool deleteWidget(int id);
    74     bool deleteWidgets(const QString &uri);
    71     bool deleteWidgets(const QString &uri);
    79 
    76 
    80     bool widgetPreferences(int widgetId, QVariantHash &data);
    77     bool widgetPreferences(int widgetId, QVariantHash &data);
    81     bool widgetPreference(int widgetId, const QString &key, QVariant &value);
    78     bool widgetPreference(int widgetId, const QString &key, QVariant &value);
    82     bool setWidgetPreferences(int widgetId, const QVariantHash &data);
    79     bool setWidgetPreferences(int widgetId, const QVariantHash &data);
    83 
    80 
    84     bool generalConfiguration(HsGeneralConfiguration &data);
    81     bool configuration(QVariantHash &configuration);
    85     bool feedbackConfiguration(HsFeedbackConfiguration &data);
    82 
    86     bool snapConfiguration(HsSnapConfiguration &data);
       
    87     
       
    88 public:
    83 public:
    89     static void setInstance(HsDatabase *instance);
    84     static void setInstance(HsDatabase *instance);
    90     static HsDatabase *instance();
    85     static HsDatabase *instance();
    91     static HsDatabase *takeInstance();
    86     static HsDatabase *takeInstance();
    92 
    87 
    93 private:    
    88 private:    
    94     Q_DISABLE_COPY(HsDatabase)
    89     Q_DISABLE_COPY(HsDatabase)
    95     bool checkConnection() const;
    90     bool checkConnection() const;
       
    91     bool matchWidgetPreferences(const QVariantHash &preferences, const QMultiMap<QString, QString>& storedPreferences);
    96 
    92 
    97 private:
    93 private:
    98     QString mConnectionName;
    94     QString mConnectionName;
    99     QString mDatabaseName;
    95     QString mDatabaseName;
   100 
    96 
   101     static HsDatabase *mInstance;
    97     static HsDatabase *mInstance;
       
    98     HOMESCREEN_TEST_FRIEND_CLASS(TestHsDomainModel)
   102 };
    99 };
   103 
   100 
   104 #endif // HSDATABASE_H
   101 #endif // HSDATABASE_H