Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
/home/iurt/rpm/BUILD/canorus-0.7.R1002/src/core/settings.h
Go to the documentation of this file.
00001 
00008 #ifndef SETTINGS_H_
00009 #define SETTINGS_H_
00010 
00011 #include <QSettings>
00012 #ifndef SWIG
00013 #include <QColor>
00014 #endif
00015 #include <QDir>
00016 #include "core/fileformats.h"
00017 #include "core/typesetter.h"
00018 
00019 class CASettings : public QSettings {
00020 public:
00021         CASettings( QObject * parent = 0 );
00022         CASettings( const QString & fileName, QObject * parent = 0 );
00023         virtual ~CASettings();
00024 
00025         int readSettings();
00026         void writeSettings();
00027 
00028         static const QString defaultSettingsPath();
00029 
00031         // Editor settings //
00033         inline bool finaleLyricsBehaviour() { return _finaleLyricsBehaviour; }
00034         inline void setFinaleLyricsBehaviour( bool b ) { _finaleLyricsBehaviour = b; }
00035         static const bool DEFAULT_FINALE_LYRICS_BEHAVIOUR;
00036         inline bool shadowNotesInOtherStaffs() { return _shadowNotesInOtherStaffs; }
00037         inline void setShadowNotesInOtherStaffs( bool b ) { _shadowNotesInOtherStaffs = b; }
00038         static const bool DEFAULT_SHADOW_NOTES_IN_OTHER_STAFFS;
00039         inline bool playInsertedNotes() { return _playInsertedNotes; }
00040         inline void setPlayInsertedNotes( bool b ) { _playInsertedNotes = b; }
00041         static const bool DEFAULT_PLAY_INSERTED_NOTES;
00042         inline bool autoBar() { return _autoBar; }
00043         inline void setAutoBar( bool b ) { _autoBar = b; }
00044         static const bool DEFAULT_AUTO_BAR;
00045 
00047         // Loading/Saving settings //
00049         inline QDir documentsDirectory() { return _documentsDirectory; }
00050         inline void setDocumentsDirectory( QDir d ) { _documentsDirectory = d; }
00051         static const QDir DEFAULT_DOCUMENTS_DIRECTORY;
00052         inline CAFileFormats::CAFileFormatType defaultSaveFormat() { return _defaultSaveFormat; }
00053         inline void setDefaultSaveFormat( CAFileFormats::CAFileFormatType t ) { _defaultSaveFormat = t; }
00054         static const CAFileFormats::CAFileFormatType DEFAULT_SAVE_FORMAT;
00055         inline int autoRecoveryInterval() { return _autoRecoveryInterval; }
00056         inline void setAutoRecoveryInterval( int interval ) { _autoRecoveryInterval = interval; };
00057         static const int DEFAULT_AUTO_RECOVERY_INTERVAL;
00058         inline int maxRecentDocuments() { return _maxRecentDocuments; }
00059         inline void setMaxRecentDocuments( int r ) { _maxRecentDocuments = r; }
00060         static const int DEFAULT_MAX_RECENT_DOCUMENTS;
00061 
00063         // Appearance settings //
00065 #ifndef SWIG
00066         static const bool DEFAULT_ANTIALIASING;
00067         inline bool antiAliasing() { return _antiAliasing; }
00068         inline void setAntiAliasing( bool a ) { _antiAliasing = a; }
00069         inline QColor backgroundColor() { return _backgroundColor; }
00070         inline void setBackgroundColor( QColor backgroundColor ) { _backgroundColor = backgroundColor; }
00071         static const QColor DEFAULT_BACKGROUND_COLOR;
00072         inline QColor foregroundColor() { return _foregroundColor; }
00073         inline void setForegroundColor( QColor foregroundColor ) { _foregroundColor = foregroundColor; }
00074         static const QColor DEFAULT_FOREGROUND_COLOR;
00075         inline QColor selectionColor() { return _selectionColor; }
00076         inline void setSelectionColor( QColor selectionColor ) { _selectionColor = selectionColor; }
00077         static const QColor DEFAULT_SELECTION_COLOR;
00078         inline QColor selectionAreaColor() { return _selectionAreaColor; }
00079         inline void setSelectionAreaColor( QColor selectionAreaColor ) { _selectionAreaColor = selectionAreaColor; }
00080         static const QColor DEFAULT_SELECTION_AREA_COLOR;
00081         inline QColor selectedContextColor() { return _selectedContextColor; }
00082         inline void setSelectedContextColor( QColor selectedContextColor ) { _selectedContextColor = selectedContextColor; }
00083         static const QColor DEFAULT_SELECTED_CONTEXT_COLOR;
00084         inline QColor hiddenElementsColor() { return _hiddenElementsColor; }
00085         inline void setDisabledElementsColor( QColor disabledElementsColor ) { _disabledElementsColor = disabledElementsColor; }
00086         static const QColor DEFAULT_HIDDEN_ELEMENTS_COLOR;
00087         inline QColor disabledElementsColor() { return _disabledElementsColor; }
00088         inline void setHiddenElementsColor( QColor hiddenElementsColor ) { _hiddenElementsColor = hiddenElementsColor; }
00089         static const QColor DEFAULT_DISABLED_ELEMENTS_COLOR;
00090 #endif
00091 
00093         // Playback settings //
00095         inline int midiInPort() { return _midiInPort; }
00096         void setMidiInPort( int in );
00097         static const int DEFAULT_MIDI_IN_PORT;
00098         inline int midiOutPort() { return _midiOutPort; }
00099         inline void setMidiOutPort( int out ) { _midiOutPort = out; }
00100         static const int DEFAULT_MIDI_OUT_PORT;
00101 
00103         // Printing settings //
00105         inline CATypesetter::CATypesetterType typesetter() { return _typesetter; }
00106         void setTypesetter( CATypesetter::CATypesetterType t ) { _typesetter = t; }
00107         static const CATypesetter::CATypesetterType DEFAULT_TYPESETTER;
00108         inline QString typesetterLocation() { return _typesetterLocation; }
00109         void setTypesetterLocation( QString tl ) { _typesetterLocation = tl; }
00110         static const QString DEFAULT_TYPESETTER_LOCATION;
00111         inline bool useSystemDefaultTypesetter() { return _useSystemDefaultTypesetter; }
00112         void setUseSystemDefaultTypesetter( bool s ) { _useSystemDefaultTypesetter = s; }
00113         static const bool DEFAULT_USE_SYSTEM_TYPESETTER;
00114         inline QString pdfViewerLocation() { return _pdfViewerLocation; }
00115         void setPdfViewerLocation( QString pl ) { _pdfViewerLocation = pl; }
00116         static const QString DEFAULT_PDF_VIEWER_LOCATION;
00117         inline bool useSystemDefaultPdfViewer() { return _useSystemDefaultPdfViewer; }
00118         void setUseSystemDefaultPdfViewer( bool s ) { _useSystemDefaultPdfViewer= s; }
00119         static const bool DEFAULT_USE_SYSTEM_PDF_VIEWER;
00120 
00121 private:
00122 #ifndef SWIG
00123         void writeRecentDocuments();
00124         void readRecentDocuments();
00125 #endif
00126 
00128         // Editor settings //
00130         bool _finaleLyricsBehaviour;
00131         bool _shadowNotesInOtherStaffs;
00132         bool _playInsertedNotes;
00133         bool _autoBar;
00134 
00136         // Loading/Saving settings //
00138         QDir _documentsDirectory;  // location of directory automatically opened when File->Open is selected
00139         CAFileFormats::CAFileFormatType _defaultSaveFormat;
00140         int _autoRecoveryInterval; // auto recovery interval in minutes
00141         int _maxRecentDocuments;   // number of stored recently opened files
00142 
00144         // Appearance settings //
00146 #ifndef SWIG
00147         bool   _antiAliasing;
00148         QColor _backgroundColor;
00149         QColor _foregroundColor;
00150         QColor _selectionColor;
00151         QColor _selectionAreaColor;
00152         QColor _selectedContextColor;
00153         QColor _hiddenElementsColor;
00154         QColor _disabledElementsColor;
00155 #endif
00156 
00157         // Playback settings //
00159         int _midiOutPort; // -1 disabled, 0+ port number
00160         int _midiInPort;  // -1 disabled, 0+ port number
00161 
00163         // Printing settings //
00165         CATypesetter::CATypesetterType _typesetter;
00166         QString                        _typesetterLocation;
00167         bool                           _useSystemDefaultTypesetter;
00168         QString                        _pdfViewerLocation;
00169         bool                           _useSystemDefaultPdfViewer;
00170 };
00171 
00172 #endif /* SETTINGS_H_ */