Scribus Developer Documentation - API
logo-pen

Scribus Developer Documentation - API

prefsmanager.h

Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 /***************************************************************************
00008     copyright            : (C) 2005 by Craig Bradney
00009     email                : cbradney@zip.com.au
00010 ***************************************************************************/
00011 
00012 /***************************************************************************
00013 *                                                                         *
00014 *   This program is free software; you can redistribute it and/or modify  *
00015 *   it under the terms of the GNU General Public License as published by  *
00016 *   the Free Software Foundation; either version 2 of the License, or     *
00017 *   (at your option) any later version.                                   *
00018 *                                                                         *
00019 ***************************************************************************/
00020 #ifndef PREFSMANAGER_H
00021 #define PREFSMANAGER_H
00022 
00023 #include <QKeySequence>
00024 #include <QMap>
00025 #include <QObject>
00026 #include <QStringList>
00027 
00028 #include "prefsstructs.h"
00029 #include "scribusapi.h"
00030 
00031 class PrefsFile;
00032 class ScribusMainWindow;
00033 
00034 
00043 class SCRIBUS_API PrefsManager : public QObject
00044 {
00045 Q_OBJECT
00046 public:
00047     PrefsManager(QObject *parent = 0);
00048     ~PrefsManager();
00049 
00054     static PrefsManager* instance();
00059     static void deleteInstance();
00060 
00061     void setup();
00067     void initDefaults();
00068     void initDefaultGUIFont(const QFont&);
00069     void initDefaultCheckerPrefs(CheckerPrefsList* cp);
00070     void initDefaultActionKeys();
00071     void applyLoadedShortCuts();
00072     void initArrowStyles();
00079     QString setupPreferencesLocation();
00086     bool copyOldPreferences();
00093     void convert12Preferences();
00098     const QString preferencesLocation();
00099 
00103     void ReadPrefs(const QString & fname=QString::null);
00104     void ReadPrefsXML();
00105 
00109     void SavePrefs(const QString & fname=QString::null);
00110     void SavePrefsXML();
00111 
00116     bool WritePref(QString ho);
00122     bool ReadPref(QString ho);
00124     void setupMainWindow(ScribusMainWindow* mw);
00125     void setGhostscriptExecutable(const QString&);
00126     void setImageEditorExecutable(const QString&);
00127     void setExtBrowserExecutable(const QString&);
00128     void setLatexConfigs(const QStringList&);
00129     void setLatexEditorExecutable(const QString&);
00130     QString ghostscriptExecutable() const {return appPrefs.gs_exe;};
00131     QString imageEditorExecutable() const {return appPrefs.imageEditorExecutable;};
00132     QString extBrowserExecutable() const {return appPrefs.extBrowserExecutable;};
00133     QStringList latexConfigs() const {return appPrefs.latexConfigs;}
00134     QString latexEditorExecutable() const {return appPrefs.latexEditorExecutable;}
00135     bool latexUseEmbeddedEditor() const {return appPrefs.latexUseEmbeddedEditor;}
00136     bool latexStartWithEmptyFrames() const {return appPrefs.latexStartWithEmptyFrames;}
00138     int gsResolution();
00139     int latexResolution() const {return appPrefs.latexResolution;}
00140     bool latexForceDpi() const {return appPrefs.latexForceDpi;}
00142     const QString documentDir();
00143     void setDocumentDir(const QString& dirname);
00144     int mouseWheelValue() const;
00146     double displayScale() const;
00148     const QString& guiLanguage() const;
00150     const QString& guiStyle() const;
00151     const QString& guiSystemStyle() const;
00153     const int& guiFontSize() const;
00154     const int& paletteFontSize() const;
00155     void setKeyEntry(const QString&, const QString&, const QKeySequence&, const int&);
00156     void setShowStartupDialog(const bool);
00158     void setColorSet(const ColorList&);
00160     void setColorSetName(const QString&);
00162     const ColorList& colorSet();
00164     ColorList* colorSetPtr();
00166     const QString& colorSetName();
00168     bool isToolColor(const QString& name);
00169     static bool isToolColor(const struct toolPrefs& settings, const QString& name);
00171     QStringList toolColorNames();
00172     static QStringList toolColorNames(const struct toolPrefs& settings);
00174     void replaceToolColors(const QMap<QString, QString> replaceMap);
00175     static void replaceToolColors(struct toolPrefs& settings, const QMap<QString, QString> replaceMap);
00181     bool GetAllFonts(bool showFontInfo);
00182 
00183     ApplicationPrefs* applicationPrefs();
00184     PrefsFile* applicationPrefsFile();
00185     bool importingFrom12x();
00186 
00188     const QString & lastError() const;
00189 
00193     void alertSavePrefsFailed() const;
00194     void alertLoadPrefsFailed() const;
00195 
00197     struct ApplicationPrefs appPrefs;
00198     PrefsFile* prefsFile;
00199 private:
00206     static PrefsManager* _instance;
00207 
00208     QString prefsLocation;
00209     bool importingFrom12;
00210 
00213     QString m_lastError;
00214 
00215 signals:
00216     void prefsChanged();
00217 };
00218 
00219 #endif
Created with personalized Doxygen. This is documentation for GPL software Scribus - Open Source Desktop Publishing.