1 // qsamplerOptions.h
2 //
3 /****************************************************************************
4    Copyright (C) 2004-2021, rncbc aka Rui Nuno Capela. All rights reserved.
5    Copyright (C) 2007,2008,2015 Christian Schoenebeck
6 
7    This program is free software; you can redistribute it and/or
8    modify it under the terms of the GNU General Public License
9    as published by the Free Software Foundation; either version 2
10    of the License, or (at your option) any later version.
11 
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16 
17    You should have received a copy of the GNU General Public License along
18    with this program; if not, write to the Free Software Foundation, Inc.,
19    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 
21 *****************************************************************************/
22 
23 #ifndef __qsamplerOptions_h
24 #define __qsamplerOptions_h
25 
26 #include <QSettings>
27 #include <QStringList>
28 
29 
30 class QWidget;
31 class QComboBox;
32 
33 namespace QSampler {
34 
35 //-------------------------------------------------------------------------
36 // QSampler::Options - Prototype settings class.
37 //
38 
39 class Options
40 {
41 public:
42 
43 	// Constructor.
44 	Options();
45 	// Default destructor.
46 	~Options();
47 
48 	// The settings object accessor.
49 	QSettings& settings();
50 
51 	// explicit I/O methods.
52 	void loadOptions();
53 	void saveOptions();
54 
55 	// Command line arguments parser.
56 	bool parse_args(const QStringList& args);
57 	// Command line usage helper.
58 	void print_usage(const QString& arg0);
59 
60 	// Startup supplied session file.
61 	QString sSessionFile;
62 
63 	// Server options...
64 	QString sServerHost;
65 	int     iServerPort;
66 	int     iServerTimeout;
67 	bool    bServerStart;
68 	QString sServerCmdLine;
69 	int     iStartDelay;
70 
71 	// Logging options...
72 	bool    bMessagesLog;
73 	QString sMessagesLogPath;
74 
75 	// Display options...
76 	QString sDisplayFont;
77 	bool    bDisplayEffect;
78 	bool    bAutoRefresh;
79 	int     iAutoRefreshTime;
80 	int     iMaxVolume;
81 	QString sMessagesFont;
82 	bool    bMessagesLimit;
83 	int     iMessagesLimitLines;
84 	bool    bConfirmRemove;
85 	bool    bConfirmReset;
86 	bool    bConfirmRestart;
87 	bool    bConfirmError;
88 	bool    bKeepOnTop;
89 	bool    bStdoutCapture;
90 	bool    bCompletePath;
91 	bool    bInstrumentNames;
92 	int     iBaseFontSize;
93 
94 	QString sCustomColorTheme;
95 	QString sCustomStyleTheme;
96 
97 	// View options...
98 	bool    bMenubar;
99 	bool    bToolbar;
100 	bool    bStatusbar;
101 	bool    bAutoArrange;
102 
103 	// Default options...
104 	QString sSessionDir;
105 	QString sInstrumentDir;
106 	QString sEngineName;
107 	QString sAudioDriver;
108 	QString sMidiDriver;
109 	int     iMidiMap;
110 	int     iMidiBank;
111 	int     iMidiProg;
112 	int     iVolume;
113 	int     iLoadMode;
114 
115 	// Recent file list.
116 	int     iMaxRecentFiles;
117 	QStringList recentFiles;
118 
119 	// Widget geometry persistence helper prototypes.
120 	void saveWidgetGeometry(QWidget *pWidget, bool bVisible = false);
121 	void loadWidgetGeometry(QWidget *pWidget, bool bVisible = false);
122 
123 	// Combo box history persistence helper prototypes.
124 	void loadComboBoxHistory(QComboBox *pComboBox, int iLimit = 8);
125 	void saveComboBoxHistory(QComboBox *pComboBox, int iLimit = 8);
126 
127 	int  getMaxVoices();
128 	int  getEffectiveMaxVoices();
129 	void setMaxVoices(int iMaxVoices);
130 
131 	int  getMaxStreams();
132 	int  getEffectiveMaxStreams();
133 	void setMaxStreams(int iMaxStreams);
134 
135 	void sendFineTuningSettings();
136 
137 private:
138 
139 	// Settings member variables.
140 	QSettings m_settings;
141 
142 	// Tuning
143 	int iMaxVoices;
144 	int iMaxStreams;
145 };
146 
147 } // namespace QSampler
148 
149 
150 #endif  // __qsamplerOptions_h
151 
152 
153 // end of qsamplerOptions.h
154 
155