Add options to control the behaviour of spreads in two-pages mode
[qcomicbook-oblomov] / src / cbsettings.h
1 /*
2  * This file is a part of QComicBook.
3  *
4  * Copyright (C) 2005-2006 Pawel Stolowski <yogin@linux.bydg.org>
5  *
6  * QComicBook is free software; you can redestribute it and/or modify it
7  * under terms of GNU General Public License by Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY. See GPL for more details.
11  */
12
13 #ifndef __SETTINGS_H
14 #define __SETTINGS_H
15
16 #include "imgview.h"
17 #include "history.h"
18 #include "enummap.h"
19 #include <qobject.h>
20 #include <qfont.h>
21
22 class QSettings;
23 class QRect;
24 class QColor;
25 class QMainWindow;
26
27 namespace QComicBook
28 {
29         using namespace Utility;
30
31         class ComicBookSettings: public QObject
32         {
33                 Q_OBJECT
34
35                 private:
36                         QSettings *cfg;
37                         bool smallcursor;
38                         bool twopages;
39                         bool twopagesstep;
40                         bool twopagesspread;
41                         bool twopagesskip;
42                         bool japanese;
43                         bool contscroll;
44                         bool scrollbars;
45                         bool preload;
46                         bool fscrhidemenu;
47                         bool fscrhidestatus;
48                         bool fscrhidetoolbar;
49                         bool stripmode;
50                         int stripmax;
51                         Size pagesize;
52                         //Scaling scaling;
53                         int x, y, w, h;
54                         QString lastdir;
55                         QColor bgcolor;
56                         History recent;
57                         int cachesize;
58                         int thumbsage;
59                         bool cachethumbs;
60                         bool autoinfo;
61                         bool confirmexit;
62                         bool statusbar;
63                         bool editsupport;
64                         bool intbrowser;
65                         bool showsplash;
66                         QString extbrowser;
67                         QString docklayout;
68                         QString tmpdir;
69                         QFont font;
70
71                         static QString bkpath; //bookmarks path
72                         static QString thpath; //thumbnails cache path
73                         static bool dirsok; //is above dirs are ok
74
75                         static const EnumMap<Size> size2string[];
76                         //static const EnumMap<Scaling> scaling2string[];
77
78                 signals:
79                         void backgroundChanged(const QColor &color);
80                         //void scalingMethodChanged(Scaling s);
81                         void cursorChanged(bool f);
82                         void stripMaxChanged(int sm);
83
84                 private:
85                         ComicBookSettings();
86                         ~ComicBookSettings();
87
88                 public:
89                         void load();
90
91                         bool smallCursor() const;
92                         bool twoPagesMode() const;
93                         bool twoPagesStep() const;
94                         bool twoPagesSpread() const;
95                         bool twoPagesSkip() const;
96                         bool japaneseMode() const;
97                         bool continuousScrolling() const;
98                         bool scrollbarsVisible() const;
99                         QRect geometry() const;
100                         Size pageSize() const;
101                         //Scaling pageScaling() const;
102                         QString lastDir() const;
103                         const History& recentlyOpened() const;
104                         QColor background() const;
105                         int cacheSize() const;
106                         bool cacheThumbnails() const;
107                         int thumbnailsAge() const;
108                         bool preloadPages() const;
109                         bool confirmExit() const;
110                         bool autoInfo() const;
111                         bool fullScreenHideMenu() const;
112                         bool fullScreenHideStatusbar() const;
113                         bool fullScreenHideToolbar() const;
114                         bool showStatusbar() const;
115                         bool useInternalBrowser() const;
116                         const QFont& infoFont() const;
117                         QString externalBrowser() const;
118                         void restoreDockLayout(QMainWindow *w);
119                         bool editSupport() const;
120                         bool showSplash() const;
121                         QString tmpDir() const;
122                         bool stripMode() const;
123                         int stripMax() const;
124
125                         void smallCursor(bool f);
126                         void twoPagesMode(bool f);
127                         void twoPagesStep(bool f);
128                         void twoPagesSpread(bool f);
129                         void twoPagesSkip(bool f);
130                         void japaneseMode(bool f);
131                         void continuousScrolling(bool f);
132                         void scrollbarsVisible(bool f);
133                         void geometry(const QRect g);
134                         void pageSize(Size s);
135                         //void pageScaling(Scaling s);
136                         void lastDir(const QString &d);
137                         void recentlyOpened(const History &hist);
138                         void background(const QColor &color);
139                         void cacheSize(int s);
140                         void cacheThumbnails(bool f);
141                         void thumbnailsAge(int n);
142                         void preloadPages(bool f);
143                         void confirmExit(bool f);
144                         void autoInfo(bool f);
145                         void fullScreenHideMenu(bool f);
146                         void fullScreenHideStatusbar(bool f);
147                         void fullScreenHideToolbar(bool f);
148                         void showStatusbar(bool f);
149                         void useInternalBrowser(bool f);
150                         void infoFont(const QFont &f);
151                         void externalBrowser(const QString &cmd);
152                         void saveDockLayout(QMainWindow *w);
153                         void editSupport(bool f);
154                         void showSplash(bool f);
155                         void tmpDir(const QString &dir);
156                         void stripMode(bool f);
157                         void stripMax(int sm);
158
159                         static ComicBookSettings& instance();
160
161                         //
162                         // checks and creates .qcomicbook/ and cache subdirectories if
163                         // necessary
164                         static bool checkDirs();
165                         static const QString& bookmarksDir();
166                         static const QString& thumbnailsDir();
167         };
168 }
169
170 #endif
171