source: terepaima/terepaima-0.4.16/sources/database.h

desarrollostretch
Last change on this file was 1f4adec, checked in by aosorio <aosorio@…>, 8 years ago

Agregado proyecto base, esto luego del dh_make -f

  • Property mode set to 100644
File size: 2.3 KB
Line 
1/*
2
3Copyright 2014 S. Razi Alavizadeh
4Copyright 2013-2015 Adam Reichold
5
6This file is part of qpdfview.
7
8qpdfview is free software: you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation, either version 2 of the License, or
11(at your option) any later version.
12
13qpdfview is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16GNU General Public License for more details.
17
18You should have received a copy of the GNU General Public License
19along with qpdfview.  If not, see <http://www.gnu.org/licenses/>.
20
21*/
22
23#ifndef DATABASE_H
24#define DATABASE_H
25
26#include <QObject>
27
28#ifdef WITH_SQL
29
30#include <QSqlDatabase>
31
32#endif // WITH_SQL
33
34class QDateTime;
35
36#include "global.h"
37
38namespace qpdfview
39{
40
41class DocumentView;
42
43class Database : public QObject
44{
45    Q_OBJECT
46
47public:
48    static Database* instance();
49    ~Database();
50
51    QStringList loadInstanceNames();
52
53    struct RestoreTab
54    {
55        virtual DocumentView* operator()(const QString& absoluteFilePath) const = 0;
56    };
57
58    void restoreTabs(const RestoreTab& restoreTab);
59    void saveTabs(const QList< DocumentView* >& tabs);
60    void clearTabs();
61
62    void restoreBookmarks();
63    void saveBookmarks();
64    void clearBookmarks();
65
66    void restorePerFileSettings(DocumentView* tab);
67    void savePerFileSettings(const DocumentView* tab);
68
69private:
70    Q_DISABLE_COPY(Database)
71
72    static Database* s_instance;
73    Database(QObject* parent = 0);
74
75    static QString instanceName();
76
77#ifdef WITH_SQL
78
79    bool prepareTabs_v4();
80    bool prepareBookmarks_v3();
81    bool preparePerFileSettings_v4();
82
83    void migrateTabs_v3_v4();
84    void migrateTabs_v2_v4();
85    void migrateTabs_v1_v4();
86    void migrateBookmarks_v2_v3();
87    void migrateBookmarks_v1_v3();
88    void migratePerFileSettings_v3_v4();
89    void migratePerFileSettings_v2_v4();
90    void migratePerFileSettings_v1_v4();
91
92    bool prepareTable(const QString& prepare);
93    void migrateTable(const QString& migrate, const QString& prune, const QString& warning);
94
95    void limitPerFileSettings();
96
97    QSqlDatabase m_database;
98
99#endif // WITH_SQL
100
101};
102
103} // qpdfview
104
105#endif // DATABASE_H
Note: See TracBrowser for help on using the repository browser.