-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathsettings.h
More file actions
163 lines (130 loc) · 4.99 KB
/
settings.h
File metadata and controls
163 lines (130 loc) · 4.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/*
Copyright 2014-2015 Vanniktech - Niklas Baudy
This file is part of SpeedReader.
SpeedReader is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
SpeedReader is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with SpeedReader. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SETTINGS_H
#define SETTINGS_H
#include <QList>
#include <QString>
#include <QColor>
#include <QUrl>
#include <QNetworkProxy>
#include <QMap>
#include <QTime>
#include "speedreadersegment.h"
#include "initializableqmap.h"
#include "speedreadertextdatasource.h"
struct Word {
QString word;
bool stopWord;
bool breakWord;
int delayWord;
};
class Settings : public QObject, public SpeedReaderTextDataSource {
Q_OBJECT
signals:
void updatedSettings();
public:
static const int NO_HTTP_NETWORK_PROXY = 0;
static const int USE_SYSTEM_HTTP_NETWORK_PROXY_CONFIGURATION = 1;
static const int CUSTOM_HTTP_NETWORK_PROXY = 2;
static const int MIN_FONT_SIZE = 8;
static const int MAX_FONT_SIZE = 100;
static const int MIN_NUMBER_OF_WORDS = 1;
static const int MAX_NUMBER_OF_WORDS = 10;
static const int MIN_WORDS_PER_MINUTE = 100;
static const int MAX_WORDS_PER_MINUTE = 3000;
static const int MIN_WORD_LENGTH = 5;
static const int MAX_WORD_LENGTH = 20;
static const InitializableQMap<int, QString> RSS_REFRESH_RATES;
static Settings* getInstance();
void synchronize();
QColor getTextColor();
void setTextColor(QColor textColor);
QColor getTextBackgroundColor();
void setTextBackgroundColor(QColor textBackgroundColor);
QColor getLinesColor();
void setLinesColor(QColor lineColor);
QString getFontFamily();
void setFontFamily(QString fontFamily);
bool shouldDisplayLongerWordsLonger();
void setShouldDisplayLongerWordsLonger(bool shouldDisplayLongerWordsLonger);
int getWordLength();
void setWordLength(int wordLength);
int getFontSize();
void setFontSize(int fontSize);
int getNumberOfWords();
void setNumberOfWords(int numberOfWords);
int getWordsPerMinute();
void setWordsPerMinute(int wordsPerMinute);
bool shouldGroupNumbers();
void setShouldGroupNumbers(bool shouldGroupNumbers);
bool shouldStallAtIndentions();
void setShouldStallAtIndentions(bool shouldStallAtIndentions);
bool changedHTTPNetworkProxy();
int getHTTPNetworkProxyType();
void setHTTPNetworkProxyType(int httpNetworkProxyType);
QNetworkProxy getHTTPNetworkProxy();
void setHTTPNetworkProxy(QNetworkProxy httpNetworkProxy);
QList<Word> getWords();
void setWords(QList<Word> stopWords);
QList<QString> getBreakWords();
QList<QString> getStopWords();
QMap<QString, int> getDelayWords();
QList<QUrl> getRSSSites();
void setRSSSites(QList<QUrl> rssSites);
bool appendRSSSite(QUrl rssSite);
bool changedRSSRefreshRate();
void setRSSRefreshRate(int rssRefreshRate);
int getRSSRefreshRate();
bool autoUpdate();
void setAutoUpdateTomorrow();
void setAutoUpdateNeverEver();
void setMainWindowGeometry(const QByteArray& geometry);
QByteArray getMainWindowGeometry() const;
void saveRSSWebViewDialogGeometry(const QByteArray& geometry);
QByteArray getRSSWebViewDialogGeometry() const;
private:
Settings();
Settings(Settings const&);
Settings& operator=(Settings const&);
static Settings* mInstance;
QColor mTextColor;
QColor mTextBackgroundColor;
QColor mLinesColor;
QString mFontFamily;
int mFontSize;
bool mDisplayLongerWordsLonger;
int mWordLength;
int mNumberOfWords;
int mWordsPerMinute;
bool mNumberGrouping;
bool mStallAtIndentions;
int mHTTPNetworkProxyType;
QNetworkProxy mHTTPNetworkProxy;
bool mChangedHTTPNetworkProxy;
QList<Word> mWords;
QList<QString> mStopWords;
QList<QString> mBreakWords;
QMap<QString, int> mDelayWords;
QList<QUrl> mRSSSites;
int mRSSRefreshRate;
bool mChangedRSSRefreshRate;
void appendWord(Word word);
uint mAutoUpdate;
void syncAutoUpdate();
QByteArray mMainWindowGeometry;
QByteArray mRSSWebViewDialogGeometry;
int minMaxValue(int min, int max, int value);
};
#endif // SETTINGS_H