Back to index

scribus-ng  1.3.4.dfsg+svn20071115
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.h>
00024 #include <qobject.h>
00025 #include <qstringlist.h>
00026 #include <qmap.h>
00027 
00028 #include "scribusapi.h"
00029 #include "prefsstructs.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, const char *name = 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 initArrowStyles();
00078        QString setupPreferencesLocation();
00085        bool copyOldPreferences();
00092        void convert12Preferences();
00097        const QString preferencesLocation();
00098 
00102        void ReadPrefs(const QString & fname=QString::null);
00103        void ReadPrefsXML();
00104 
00108        void SavePrefs(const QString & fname=QString::null);
00109        void SavePrefsXML();
00110 
00115        bool WritePref(QString ho);
00121        bool ReadPref(QString ho);
00123        void setupMainWindow(ScribusMainWindow* mw);
00124        void setGhostscriptExecutable(const QString&);
00125        void setImageEditorExecutable(const QString&);
00126        void setExtBrowserExecutable(const QString&);
00127        QString ghostscriptExecutable() const {return appPrefs.gs_exe;};
00128        QString imageEditorExecutable() const {return appPrefs.imageEditorExecutable;};
00129        QString extBrowserExecutable() const {return appPrefs.extBrowserExecutable;};
00131        const int gsResolution();
00133        const QString documentDir();
00134        void setDocumentDir(const QString& dirname);
00135        const int mouseWheelValue();
00137        const double displayScale();
00139        const QString& guiLanguage();
00141        const QString& guiStyle();
00143        const int& guiFontSize();
00144        const int& paletteFontSize();
00145        void setKeyEntry(const QString&, const QString&, const QKeySequence&, const int&);
00146        void setShowStartupDialog(const bool);
00148        void setColorSet(const ColorList&);
00150        void setColorSetName(const QString&);
00152        const ColorList& colorSet();
00154        ColorList* colorSetPtr();
00156        const QString& colorSetName();
00158        bool isToolColor(const QString& name);
00159        static bool isToolColor(const struct toolPrefs& settings, const QString& name);
00161        QStringList toolColorNames();
00162        static QStringList toolColorNames(const struct toolPrefs& settings);
00164        void replaceToolColors(const QMap<QString, QString> replaceMap);
00165        static void replaceToolColors(struct toolPrefs& settings, const QMap<QString, QString> replaceMap);
00171        bool GetAllFonts(bool showFontInfo);
00172 
00173        ApplicationPrefs* applicationPrefs();
00174        PrefsFile* applicationPrefsFile();
00175        const bool importingFrom12x();
00176 
00178        const QString & lastError() const;
00179 
00183        void alertSavePrefsFailed() const;
00184        void alertLoadPrefsFailed() const;
00185 
00187        struct ApplicationPrefs appPrefs;
00188        PrefsFile* prefsFile;
00189 private:
00196        static PrefsManager* _instance;
00197 
00198        QString prefsLocation;
00199        bool importingFrom12;
00200 
00203        QString m_lastError;
00204 
00205 signals:
00206        void prefsChanged();
00207 };
00208 
00209 #endif