QSapecNG
 All Classes Functions Enumerations Properties
settings.h
00001 /*
00002     SapecNG - Next Generation Symbolic Analysis Program for Electric Circuit
00003     Copyright (C) 2009, Michele Caini
00004 
00005     This program is free software: you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation, either version 3 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017 */
00018 
00019 
00020 #ifndef SETTINGS_H
00021 #define SETTINGS_H
00022 
00023 
00024 #include <QtCore/QPoint>
00025 #include <QtCore/QSize>
00026 #include <QtCore/QByteArray>
00027 #include <QtCore/QRegExp>
00028 
00029 #include <QtGui/QFont>
00030 #include <QtGui/QColor>
00031 
00032 
00033 namespace qsapecng
00034 {
00035 
00036 
00037 class SettingsManager;
00038 
00039 
00040 /*
00041  * developed as Monostate Pattern
00042  */
00043 class Settings
00044 {
00045 
00046 friend class SettingsManager;
00047 
00048 public:
00049   Settings() { }
00050 
00051   void load();
00052   void save();
00053 
00054   inline QRegExp notation() const
00055     { return notation_; }
00056 
00057   inline QPoint mwPos() const
00058     { return mwPos_; }
00059 
00060   inline QSize mwSize() const
00061     { return mwSize_; }
00062 
00063   inline QByteArray mwState() const
00064     { return mwState_; }
00065 
00066   inline QString workspace() const
00067     { return workspace_; }
00068 
00069   inline QFont appFont() const
00070     { return appFont_; }
00071 
00072   inline int logLvl() const
00073     { return logLvl_; }
00074 
00075   inline QColor debugColor() const
00076     { return debugColor_; }
00077 
00078   inline QColor infoColor() const
00079     { return infoColor_; }
00080 
00081   inline QColor warningColor() const
00082     { return warningColor_; }
00083 
00084   inline QColor errorColor() const
00085     { return errorColor_; }
00086 
00087   inline QColor fatalColor() const
00088     { return fatalColor_; }
00089 
00090   inline QStringList recentFiles() const
00091     { return recentFiles_; }
00092 
00093 private:
00094   static QRegExp notation_;
00095 
00096   static QPoint mwPos_;
00097   static QSize mwSize_;
00098   static QByteArray mwState_;
00099 
00100   static QString workspace_;
00101 
00102   static QFont appFont_;
00103 
00104   static int logLvl_;
00105   static QColor debugColor_;
00106   static QColor infoColor_;
00107   static QColor warningColor_;
00108   static QColor errorColor_;
00109   static QColor fatalColor_;
00110 
00111   static QStringList recentFiles_;
00112 
00113 };
00114 
00115 
00116 class SettingsManager
00117 {
00118 
00119 public:
00120   inline void setNotation(const QRegExp& notation)
00121     { Settings::notation_ = notation; }
00122 
00123   inline void setMWPos(const QPoint& pos)
00124     { Settings::mwPos_ = pos; }
00125 
00126   inline void setMWSize(const QSize& size)
00127     { Settings::mwSize_ = size; }
00128 
00129   inline void setMWState(const QByteArray& state)
00130     { Settings::mwState_ = state; }
00131 
00132   inline void setAppFont(const QFont& font)
00133     { Settings::appFont_ = font; }
00134 
00135   inline void setWorkspace(const QString workspace)
00136     { Settings::workspace_ = workspace; }
00137 
00138   inline void setLogLvl(int lvl)
00139     { Settings::logLvl_= lvl; }
00140 
00141   inline void setDebugColor(const QColor& color)
00142     { Settings::debugColor_ = color; }
00143 
00144   inline void setInfoColor(const QColor& color)
00145     { Settings::infoColor_ = color; }
00146 
00147   inline void setWarningColor(const QColor& color)
00148     { Settings::warningColor_ = color; }
00149 
00150   inline void setErrorColor(const QColor& color)
00151     { Settings::errorColor_ = color; }
00152 
00153   inline void setFatalColor(const QColor& color)
00154     { Settings::fatalColor_ = color; }
00155 
00156   inline void setRecentFiles(const QStringList& files)
00157     { Settings::recentFiles_ = files; }
00158 
00159 };
00160 
00161 
00162 }
00163 
00164 
00165 #endif // SETTINGS_H
 All Classes Functions Enumerations Properties