LunaSysMgr
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
pagesaver.h
Go to the documentation of this file.
1 /* @@@LICENSE
2 *
3 * Copyright (c) 2011-2012 Hewlett-Packard Development Company, L.P.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 * LICENSE@@@ */
18 
19 
20 
21 
22 #ifndef PAGESAVER_H_
23 #define PAGESAVER_H_
24 
25 #include <QObject>
26 #include <QPointer>
27 #include <QVariant>
28 #include <QString>
29 #include <QList>
30 
31 class LauncherObject;
32 class QuickLaunchBar;
33 class Page;
34 class ReorderablePage;
35 
36 namespace DimensionsSystemInterface
37 {
38 
39 class PageSaver : public QObject
40 {
41  Q_OBJECT
42 public:
43 
44  static QString SaveTagKey_PageType;
45  static QString SaveTagKey_PageName;
46  static QString SaveTagKey_PageDesignator; //a "category" like name to keep track of pages that serve a particular purpose
47  static QString SaveTagKey_PageUid;
48  static QString SaveTagKey_PageFile;
49  static QString SaveTagKey_PageIndex;
50  static QString SaveTagKey_PageNumIcons;
52 
58 
63 
64  //this is used to prevent issues from older versions of save files from causing problems
65  // with newer versions of code. It's expected to be changed pretty heavily during development, and
66  // not so much afterwards...but it's far easier to do this than have to explain company-wide on how to
67  // remove saved files and the whole gamut of issues that manifest if this isn't done at the necessary times
68  static quint32 SaveSystemVersion;
69 
70  PageSaver();
71  virtual ~PageSaver();
72 
73  static QVariantMap savePage(Page * p_page,LauncherObject * p_uiContext);
74  static bool saveLauncher(LauncherObject * p_uiContext);
75  static bool saveQuickLaunch(LauncherObject * p_uiContext,QuickLaunchBar * p_quickLauncher);
76 
77  static quint32 saveSystemVersion() { return SaveSystemVersion; }
78 
79  static PageSaver * instance();
80 
81  static void filesForBackup(QList<QString> * pFileList);
82 
83  static void dbgPackUpAndSaveCurrentLauncher3Dir(const QString& extraFilenameTag,QList<QVariantMap> * p_dbgLauncherConf = 0);
84 
85 protected:
86 
87  static QPointer<PageSaver> s_qp_instance;
88  static QVariantMap saveReorderablePage(ReorderablePage * p_reorderPage,LauncherObject * p_uiContext);
89 
90 };
91 
92 } //end namespace
93 
94 #endif /* PAGESAVER_H_ */