Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
settings.h
Go to the documentation of this file.
1 
8 #ifndef SETTINGS_H_
9 #define SETTINGS_H_
10 
11 #include <QSettings>
12 #ifndef SWIG
13 #include <QColor>
14 #endif
15 #include <QDir>
16 #include "core/fileformats.h"
17 #include "core/typesetter.h"
18 
19 class CASettings : public QSettings {
20 public:
21  CASettings( QObject * parent = 0 );
22  CASettings( const QString & fileName, QObject * parent = 0 );
23  virtual ~CASettings();
24 
25  int readSettings();
26  void writeSettings();
27 
28  static const QString defaultSettingsPath();
29 
31  // Editor settings //
34  inline void setFinaleLyricsBehaviour( bool b ) { _finaleLyricsBehaviour = b; }
39  inline bool playInsertedNotes() { return _playInsertedNotes; }
40  inline void setPlayInsertedNotes( bool b ) { _playInsertedNotes = b; }
41  static const bool DEFAULT_PLAY_INSERTED_NOTES;
42  inline bool autoBar() { return _autoBar; }
43  inline void setAutoBar( bool b ) { _autoBar = b; }
44  static const bool DEFAULT_AUTO_BAR;
45 
47  // Loading/Saving settings //
49  inline QDir documentsDirectory() { return _documentsDirectory; }
50  inline void setDocumentsDirectory( QDir d ) { _documentsDirectory = d; }
51  static const QDir DEFAULT_DOCUMENTS_DIRECTORY;
56  inline void setAutoRecoveryInterval( int interval ) { _autoRecoveryInterval = interval; };
57  static const int DEFAULT_AUTO_RECOVERY_INTERVAL;
58  inline int maxRecentDocuments() { return _maxRecentDocuments; }
59  inline void setMaxRecentDocuments( int r ) { _maxRecentDocuments = r; }
60  static const int DEFAULT_MAX_RECENT_DOCUMENTS;
61 
63  // Appearance settings //
65 #ifndef SWIG
66  static const bool DEFAULT_ANTIALIASING;
67  inline bool antiAliasing() { return _antiAliasing; }
68  inline void setAntiAliasing( bool a ) { _antiAliasing = a; }
69  inline QColor backgroundColor() { return _backgroundColor; }
71  static const QColor DEFAULT_BACKGROUND_COLOR;
72  inline QColor foregroundColor() { return _foregroundColor; }
74  static const QColor DEFAULT_FOREGROUND_COLOR;
75  inline QColor selectionColor() { return _selectionColor; }
77  static const QColor DEFAULT_SELECTION_COLOR;
78  inline QColor selectionAreaColor() { return _selectionAreaColor; }
80  static const QColor DEFAULT_SELECTION_AREA_COLOR;
81  inline QColor selectedContextColor() { return _selectedContextColor; }
83  static const QColor DEFAULT_SELECTED_CONTEXT_COLOR;
84  inline QColor hiddenElementsColor() { return _hiddenElementsColor; }
86  static const QColor DEFAULT_HIDDEN_ELEMENTS_COLOR;
87  inline QColor disabledElementsColor() { return _disabledElementsColor; }
89  static const QColor DEFAULT_DISABLED_ELEMENTS_COLOR;
90 #endif
91 
93  // Playback settings //
95  inline int midiInPort() { return _midiInPort; }
96  void setMidiInPort( int in );
97  static const int DEFAULT_MIDI_IN_PORT;
98  inline int midiOutPort() { return _midiOutPort; }
99  inline void setMidiOutPort( int out ) { _midiOutPort = out; }
100  static const int DEFAULT_MIDI_OUT_PORT;
101 
103  // Printing settings //
108  inline QString typesetterLocation() { return _typesetterLocation; }
109  void setTypesetterLocation( QString tl ) { _typesetterLocation = tl; }
110  static const QString DEFAULT_TYPESETTER_LOCATION;
113  static const bool DEFAULT_USE_SYSTEM_TYPESETTER;
114  inline QString pdfViewerLocation() { return _pdfViewerLocation; }
115  void setPdfViewerLocation( QString pl ) { _pdfViewerLocation = pl; }
116  static const QString DEFAULT_PDF_VIEWER_LOCATION;
119  static const bool DEFAULT_USE_SYSTEM_PDF_VIEWER;
120 
121 private:
122 #ifndef SWIG
123  void writeRecentDocuments();
124  void readRecentDocuments();
125 #endif
126 
128  // Editor settings //
133  bool _autoBar;
134 
136  // Loading/Saving settings //
138  QDir _documentsDirectory; // location of directory automatically opened when File->Open is selected
140  int _autoRecoveryInterval; // auto recovery interval in minutes
141  int _maxRecentDocuments; // number of stored recently opened files
142 
144  // Appearance settings //
146 #ifndef SWIG
155 #endif
156 
157  // Playback settings //
159  int _midiOutPort; // -1 disabled, 0+ port number
160  int _midiInPort; // -1 disabled, 0+ port number
161 
163  // Printing settings //
170 };
171 
172 #endif /* SETTINGS_H_ */