Scribus
Open source desktop publishing at your fingertips
prefsmanager.h
1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 /***************************************************************************
8  copyright : (C) 2005 by Craig Bradney
9  email : cbradney@zip.com.au
10 ***************************************************************************/
11 
12 /***************************************************************************
13 * *
14 * This program is free software; you can redistribute it and/or modify *
15 * it under the terms of the GNU General Public License as published by *
16 * the Free Software Foundation; either version 2 of the License, or *
17 * (at your option) any later version. *
18 * *
19 ***************************************************************************/
20 #ifndef PREFSMANAGER_H
21 #define PREFSMANAGER_H
22 
23 #include <QKeySequence>
24 #include <QMap>
25 #include <QObject>
26 #include <QStringList>
27 
28 #include "prefsstructs.h"
29 #include "scribusapi.h"
30 
31 class PrefsFile;
32 class ScribusMainWindow;
33 
34 
43 class SCRIBUS_API PrefsManager : public QObject
44 {
45 Q_OBJECT
46 public:
47  PrefsManager(QObject *parent = 0);
48  ~PrefsManager();
49 
54  static PrefsManager* instance();
59  static void deleteInstance();
60 
61  void setup();
67  void initDefaults();
68  void initDefaultGUIFont(const QFont&);
69  void initDefaultCheckerPrefs(CheckerPrefsList* cp);
70  void initDefaultActionKeys();
71  void applyLoadedShortCuts();
72  void initArrowStyles();
79  QString setupPreferencesLocation();
86  bool copyOldPreferences();
93  void convert12Preferences();
98  const QString preferencesLocation();
99 
103  void ReadPrefs(const QString & fname=QString::null);
104  void ReadPrefsXML();
105 
109  void SavePrefs(const QString & fname=QString::null);
110  void SavePrefsXML();
111 
116  bool WritePref(QString ho);
122  bool ReadPref(QString ho);
124  void setupMainWindow(ScribusMainWindow* mw);
125  void setGhostscriptExecutable(const QString&);
126  void setImageEditorExecutable(const QString&);
127  void setExtBrowserExecutable(const QString&);
128  void setUniconvExecutable(const QString&);
129  void setLatexConfigs(const QStringList&);
130  void setLatexCommands(const QMap<QString, QString>& commands);
131  void setLatexEditorExecutable(const QString&);
132  QString ghostscriptExecutable() const {return appPrefs.extToolPrefs.gs_exe;};
133  QString imageEditorExecutable() const {return appPrefs.extToolPrefs.imageEditorExecutable;};
134  QString extBrowserExecutable() const {return appPrefs.extToolPrefs.extBrowserExecutable;};
135  QString uniconvExecutable() const {return appPrefs.extToolPrefs.uniconvExecutable;}
136  QStringList latexConfigs() const {return appPrefs.extToolPrefs.latexConfigs;}
137  QMap<QString, QString> latexCommands() const {return appPrefs.extToolPrefs.latexCommands;}
138  bool renderFrameConfigured();
139  QString latexEditorExecutable() const {return appPrefs.extToolPrefs.latexEditorExecutable;}
140  bool latexStartWithEmptyFrames() const {return appPrefs.extToolPrefs.latexStartWithEmptyFrames;}
142  int gsResolution();
143  int latexResolution() const {return appPrefs.extToolPrefs.latexResolution;}
144  bool latexForceDpi() const {return appPrefs.extToolPrefs.latexForceDpi;}
146  const QString documentDir();
147  void setDocumentDir(const QString& dirname);
148  int mouseWheelJump() const;
150  double displayScale() const;
152  const QString& uiLanguage() const;
154  const QString& guiStyle() const;
155  const QString& guiSystemStyle() const;
157  const int& guiFontSize() const;
158  const int& paletteFontSize() const;
159  void setKeyEntry(const QString&, const QString&, const QKeySequence&, const int&);
160  void setShowStartupDialog(const bool);
161  bool showPageShadow() const;
163  void setColorSet(const ColorList&);
165  void setColorSetName(const QString&);
167  const ColorList& colorSet();
169  ColorList* colorSetPtr();
171  const QString& colorSetName();
173  bool isToolColor(const QString& name);
174  static bool isToolColor(const struct ItemToolPrefs& settings, const QString& name);
176  QStringList toolColorNames();
177  static QStringList toolColorNames(const struct ItemToolPrefs& settings);
179  void replaceToolColors(const QMap<QString, QString> replaceMap);
180  static void replaceToolColors(struct ItemToolPrefs& settings, const QMap<QString, QString> replaceMap);
186  bool GetAllFonts(bool showFontInfo);
187 
188  ApplicationPrefs* applicationPrefs();
189  void setNewPrefs(ApplicationPrefs& newPrefs);
190  PrefsFile* applicationPrefsFile();
191  bool importingFrom12x();
192 
194  const QString & lastError() const;
195 
199  void alertSavePrefsFailed() const;
200  void alertLoadPrefsFailed() const;
201 
203  struct ApplicationPrefs appPrefs;
204  PrefsFile* prefsFile;
205 
206 public slots:
207  void languageChange();
208 
209 private:
216  static PrefsManager* _instance;
217 
218  QString prefsLocation;
219  bool importingFrom12;
220  bool firstTimeIgnoreOldPrefs;
221 
224  QString m_lastError;
225 
226 signals:
227  void prefsChanged();
228 };
229 
230 #endif
Definition: prefsstructs.h:453
Definition: prefsstructs.h:221
This Class is the base class for your application. It sets up the main window and providing a menubar...
Definition: scribus.h:123
Definition: sccolor.h:155
Definition: prefsfile.h:38
Manage Scribus preferences here, and here alone Start to move the preferences out of scribus...
Definition: prefsmanager.h:43