1 |
capela |
106 |
// qsamplerOptions.cpp |
2 |
|
|
// |
3 |
|
|
/**************************************************************************** |
4 |
capela |
1738 |
Copyright (C) 2004-2008, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
capela |
1464 |
Copyright (C) 2007, Christian Schoenebeck |
6 |
capela |
106 |
|
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 |
capela |
920 |
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 |
capela |
106 |
|
21 |
|
|
*****************************************************************************/ |
22 |
|
|
|
23 |
capela |
753 |
#include "qsamplerAbout.h" |
24 |
capela |
106 |
#include "qsamplerOptions.h" |
25 |
|
|
|
26 |
capela |
1499 |
#include <QTextStream> |
27 |
|
|
#include <QComboBox> |
28 |
capela |
106 |
|
29 |
capela |
264 |
#include <lscp/client.h> |
30 |
capela |
106 |
|
31 |
capela |
605 |
#ifdef CONFIG_LIBGIG |
32 |
|
|
#include <gig.h> |
33 |
|
|
#endif |
34 |
capela |
106 |
|
35 |
capela |
605 |
|
36 |
capela |
1558 |
namespace QSampler { |
37 |
|
|
|
38 |
capela |
106 |
//------------------------------------------------------------------------- |
39 |
capela |
1558 |
// QSampler::Options - Prototype settings structure. |
40 |
capela |
106 |
// |
41 |
|
|
|
42 |
|
|
// Constructor. |
43 |
capela |
1558 |
Options::Options (void) |
44 |
capela |
1504 |
: m_settings(QSAMPLER_DOMAIN, QSAMPLER_TITLE) |
45 |
capela |
106 |
{ |
46 |
capela |
1509 |
// Begin into general options group. |
47 |
|
|
m_settings.beginGroup("/Options"); |
48 |
capela |
106 |
|
49 |
capela |
1509 |
// Load server options... |
50 |
|
|
m_settings.beginGroup("/Server"); |
51 |
|
|
sServerHost = m_settings.value("/ServerHost", "localhost").toString(); |
52 |
|
|
iServerPort = m_settings.value("/ServerPort", 8888).toInt(); |
53 |
nagata |
1643 |
#if defined(__APPLE__) // Toshi Nagata 20080105 |
54 |
|
|
// TODO: Should this be a configure option? |
55 |
|
|
iServerTimeout = m_settings.value("/ServerTimeout", 10000).toInt(); |
56 |
|
|
#else |
57 |
capela |
1509 |
iServerTimeout = m_settings.value("/ServerTimeout", 1000).toInt(); |
58 |
nagata |
1643 |
#endif |
59 |
capela |
1509 |
bServerStart = m_settings.value("/ServerStart", true).toBool(); |
60 |
nagata |
1643 |
#if defined(__APPLE__) // Toshi Nagata 20080113 |
61 |
|
|
sServerCmdLine = m_settings.value("/ServerCmdLine", "linuxsampler.starter").toString(); |
62 |
|
|
#else |
63 |
capela |
1509 |
sServerCmdLine = m_settings.value("/ServerCmdLine", "linuxsampler").toString(); |
64 |
nagata |
1643 |
#endif |
65 |
capela |
1509 |
iStartDelay = m_settings.value("/StartDelay", 3).toInt(); |
66 |
|
|
m_settings.endGroup(); |
67 |
capela |
106 |
|
68 |
capela |
1738 |
// Load logging options... |
69 |
|
|
m_settings.beginGroup("/Logging"); |
70 |
|
|
bMessagesLog = m_settings.value("/MessagesLog", false).toBool(); |
71 |
|
|
sMessagesLogPath = m_settings.value("/MessagesLogPath", "qsampler.log").toString(); |
72 |
|
|
m_settings.endGroup(); |
73 |
|
|
|
74 |
capela |
1509 |
// Load display options... |
75 |
|
|
m_settings.beginGroup("/Display"); |
76 |
|
|
sDisplayFont = m_settings.value("/DisplayFont").toString(); |
77 |
|
|
bDisplayEffect = m_settings.value("/DisplayEffect", true).toBool(); |
78 |
|
|
bAutoRefresh = m_settings.value("/AutoRefresh", true).toBool(); |
79 |
|
|
iAutoRefreshTime = m_settings.value("/AutoRefreshTime", 1000).toInt(); |
80 |
|
|
iMaxVolume = m_settings.value("/MaxVolume", 100).toInt(); |
81 |
|
|
sMessagesFont = m_settings.value("/MessagesFont").toString(); |
82 |
|
|
bMessagesLimit = m_settings.value("/MessagesLimit", true).toBool(); |
83 |
|
|
iMessagesLimitLines = m_settings.value("/MessagesLimitLines", 1000).toInt(); |
84 |
|
|
bConfirmRemove = m_settings.value("/ConfirmRemove", true).toBool(); |
85 |
|
|
bKeepOnTop = m_settings.value("/KeepOnTop", true).toBool(); |
86 |
|
|
bStdoutCapture = m_settings.value("/StdoutCapture", true).toBool(); |
87 |
|
|
bCompletePath = m_settings.value("/CompletePath", true).toBool(); |
88 |
|
|
iMaxRecentFiles = m_settings.value("/MaxRecentFiles", 5).toInt(); |
89 |
schoenebeck |
1527 |
// if libgig provides a fast way to retrieve instrument names even for large |
90 |
|
|
// .gig files, then we enable this feature by default |
91 |
|
|
#if HAVE_LIBGIG_SETAUTOLOAD |
92 |
|
|
bInstrumentNames = m_settings.value("/InstrumentNames", true).toBool(); |
93 |
|
|
#else |
94 |
capela |
1509 |
bInstrumentNames = m_settings.value("/InstrumentNames", false).toBool(); |
95 |
schoenebeck |
1527 |
#endif |
96 |
capela |
1509 |
m_settings.endGroup(); |
97 |
capela |
106 |
|
98 |
capela |
1509 |
// And go into view options group. |
99 |
|
|
m_settings.beginGroup("/View"); |
100 |
|
|
bMenubar = m_settings.value("/Menubar", true).toBool(); |
101 |
|
|
bToolbar = m_settings.value("/Toolbar", true).toBool(); |
102 |
|
|
bStatusbar = m_settings.value("/Statusbar", true).toBool(); |
103 |
|
|
bAutoArrange = m_settings.value("/AutoArrange", true).toBool(); |
104 |
|
|
m_settings.endGroup(); |
105 |
capela |
106 |
|
106 |
capela |
1509 |
m_settings.endGroup(); // Options group. |
107 |
capela |
106 |
|
108 |
capela |
1499 |
// Recent file list. |
109 |
|
|
recentFiles.clear(); |
110 |
|
|
m_settings.beginGroup("/RecentFiles"); |
111 |
|
|
for (int iFile = 0; iFile < iMaxRecentFiles; iFile++) { |
112 |
|
|
QString sFilename = m_settings.value( |
113 |
|
|
"/File" + QString::number(iFile + 1)).toString(); |
114 |
|
|
if (!sFilename.isEmpty()) |
115 |
|
|
recentFiles.append(sFilename); |
116 |
|
|
} |
117 |
|
|
m_settings.endGroup(); |
118 |
capela |
106 |
|
119 |
capela |
1509 |
// Last but not least, get the default directories. |
120 |
|
|
m_settings.beginGroup("/Default"); |
121 |
|
|
sSessionDir = m_settings.value("/SessionDir").toString(); |
122 |
|
|
sInstrumentDir = m_settings.value("/InstrumentDir").toString(); |
123 |
|
|
sEngineName = m_settings.value("/EngineName").toString(); |
124 |
|
|
sAudioDriver = m_settings.value("/AudioDriver").toString(); |
125 |
|
|
sMidiDriver = m_settings.value("/MidiDriver").toString(); |
126 |
|
|
iMidiMap = m_settings.value("/MidiMap", 0).toInt(); |
127 |
|
|
iMidiBank = m_settings.value("/MidiBank", 0).toInt(); |
128 |
|
|
iMidiProg = m_settings.value("/MidiProg", 0).toInt(); |
129 |
|
|
iVolume = m_settings.value("/Volume", 100).toInt(); |
130 |
|
|
iLoadMode = m_settings.value("/Loadmode", 0).toInt(); |
131 |
|
|
m_settings.endGroup(); |
132 |
capela |
106 |
} |
133 |
|
|
|
134 |
|
|
|
135 |
|
|
// Default Destructor. |
136 |
capela |
1558 |
Options::~Options (void) |
137 |
capela |
106 |
{ |
138 |
capela |
1509 |
// Make program version available in the future. |
139 |
|
|
m_settings.beginGroup("/Program"); |
140 |
|
|
m_settings.setValue("/Version", QSAMPLER_VERSION); |
141 |
|
|
m_settings.endGroup(); |
142 |
capela |
106 |
|
143 |
capela |
1509 |
// And go into general options group. |
144 |
|
|
m_settings.beginGroup("/Options"); |
145 |
capela |
106 |
|
146 |
capela |
1509 |
// Save server options. |
147 |
|
|
m_settings.beginGroup("/Server"); |
148 |
|
|
m_settings.setValue("/ServerHost", sServerHost); |
149 |
|
|
m_settings.setValue("/ServerPort", iServerPort); |
150 |
|
|
m_settings.setValue("/ServerTimeout", iServerTimeout); |
151 |
|
|
m_settings.setValue("/ServerStart", bServerStart); |
152 |
|
|
m_settings.setValue("/ServerCmdLine", sServerCmdLine); |
153 |
|
|
m_settings.setValue("/StartDelay", iStartDelay); |
154 |
|
|
m_settings.endGroup(); |
155 |
capela |
106 |
|
156 |
capela |
1738 |
// Save logging options... |
157 |
|
|
m_settings.beginGroup("/Logging"); |
158 |
|
|
m_settings.setValue("/MessagesLog", bMessagesLog); |
159 |
|
|
m_settings.setValue("/MessagesLogPath", sMessagesLogPath); |
160 |
|
|
m_settings.endGroup(); |
161 |
|
|
|
162 |
capela |
1509 |
// Save display options. |
163 |
|
|
m_settings.beginGroup("/Display"); |
164 |
|
|
m_settings.setValue("/DisplayFont", sDisplayFont); |
165 |
|
|
m_settings.setValue("/DisplayEffect", bDisplayEffect); |
166 |
|
|
m_settings.setValue("/AutoRefresh", bAutoRefresh); |
167 |
|
|
m_settings.setValue("/AutoRefreshTime", iAutoRefreshTime); |
168 |
|
|
m_settings.setValue("/MaxVolume", iMaxVolume); |
169 |
|
|
m_settings.setValue("/MessagesFont", sMessagesFont); |
170 |
|
|
m_settings.setValue("/MessagesLimit", bMessagesLimit); |
171 |
|
|
m_settings.setValue("/MessagesLimitLines", iMessagesLimitLines); |
172 |
|
|
m_settings.setValue("/ConfirmRemove", bConfirmRemove); |
173 |
|
|
m_settings.setValue("/KeepOnTop", bKeepOnTop); |
174 |
|
|
m_settings.setValue("/StdoutCapture", bStdoutCapture); |
175 |
|
|
m_settings.setValue("/CompletePath", bCompletePath); |
176 |
|
|
m_settings.setValue("/MaxRecentFiles", iMaxRecentFiles); |
177 |
|
|
m_settings.setValue("/InstrumentNames", bInstrumentNames); |
178 |
|
|
m_settings.endGroup(); |
179 |
capela |
106 |
|
180 |
capela |
1509 |
// View options group. |
181 |
|
|
m_settings.beginGroup("/View"); |
182 |
|
|
m_settings.setValue("/Menubar", bMenubar); |
183 |
|
|
m_settings.setValue("/Toolbar", bToolbar); |
184 |
|
|
m_settings.setValue("/Statusbar", bStatusbar); |
185 |
|
|
m_settings.setValue("/AutoArrange", bAutoArrange); |
186 |
|
|
m_settings.endGroup(); |
187 |
capela |
106 |
|
188 |
capela |
1509 |
m_settings.endGroup(); // Options group. |
189 |
capela |
106 |
|
190 |
capela |
1509 |
// Recent file list. |
191 |
capela |
1499 |
int iFile = 0; |
192 |
|
|
m_settings.beginGroup("/RecentFiles"); |
193 |
|
|
QStringListIterator iter(recentFiles); |
194 |
|
|
while (iter.hasNext()) |
195 |
|
|
m_settings.setValue("/File" + QString::number(++iFile), iter.next()); |
196 |
|
|
m_settings.endGroup(); |
197 |
capela |
106 |
|
198 |
capela |
1509 |
// Default directories. |
199 |
|
|
m_settings.beginGroup("/Default"); |
200 |
|
|
m_settings.setValue("/SessionDir", sSessionDir); |
201 |
|
|
m_settings.setValue("/InstrumentDir", sInstrumentDir); |
202 |
|
|
m_settings.setValue("/EngineName", sEngineName); |
203 |
|
|
m_settings.setValue("/AudioDriver", sAudioDriver); |
204 |
|
|
m_settings.setValue("/MidiDriver", sMidiDriver); |
205 |
|
|
m_settings.setValue("/MidiMap", iMidiMap); |
206 |
|
|
m_settings.setValue("/MidiBank", iMidiBank); |
207 |
|
|
m_settings.setValue("/MidiProg", iMidiProg); |
208 |
|
|
m_settings.setValue("/Volume", iVolume); |
209 |
|
|
m_settings.setValue("/Loadmode", iLoadMode); |
210 |
|
|
m_settings.endGroup(); |
211 |
capela |
106 |
} |
212 |
|
|
|
213 |
|
|
//------------------------------------------------------------------------- |
214 |
|
|
// Settings accessor. |
215 |
|
|
// |
216 |
|
|
|
217 |
capela |
1558 |
QSettings& Options::settings (void) |
218 |
capela |
106 |
{ |
219 |
capela |
1509 |
return m_settings; |
220 |
capela |
106 |
} |
221 |
|
|
|
222 |
|
|
|
223 |
|
|
//------------------------------------------------------------------------- |
224 |
|
|
// Command-line argument stuff. |
225 |
|
|
// |
226 |
|
|
|
227 |
|
|
// Help about command line options. |
228 |
capela |
1558 |
void Options::print_usage ( const char *arg0 ) |
229 |
capela |
106 |
{ |
230 |
capela |
1499 |
QTextStream out(stderr); |
231 |
|
|
out << QObject::tr("Usage: %1 [options] [session-file]\n\n" |
232 |
|
|
QSAMPLER_TITLE " - " QSAMPLER_SUBTITLE "\n\n" |
233 |
|
|
"Options:\n\n" |
234 |
|
|
" -s, --start\n\tStart linuxsampler server locally\n\n" |
235 |
|
|
" -h, --hostname\n\tSpecify linuxsampler server hostname\n\n" |
236 |
|
|
" -p, --port\n\tSpecify linuxsampler server port number\n\n" |
237 |
|
|
" -?, --help\n\tShow help about command line options\n\n" |
238 |
|
|
" -v, --version\n\tShow version information\n\n") |
239 |
|
|
.arg(arg0); |
240 |
capela |
106 |
} |
241 |
|
|
|
242 |
|
|
|
243 |
|
|
// Parse command line arguments into m_settings. |
244 |
capela |
1558 |
bool Options::parse_args ( int argc, char **argv ) |
245 |
capela |
106 |
{ |
246 |
capela |
1499 |
QTextStream out(stderr); |
247 |
capela |
1509 |
const QString sEol = "\n\n"; |
248 |
|
|
int iCmdArgs = 0; |
249 |
capela |
106 |
|
250 |
capela |
1509 |
for (int i = 1; i < argc; i++) { |
251 |
capela |
106 |
|
252 |
capela |
1509 |
if (iCmdArgs > 0) { |
253 |
|
|
sSessionFile += " "; |
254 |
|
|
sSessionFile += argv[i]; |
255 |
|
|
iCmdArgs++; |
256 |
|
|
continue; |
257 |
|
|
} |
258 |
capela |
106 |
|
259 |
capela |
1509 |
QString sArg = argv[i]; |
260 |
|
|
QString sVal = QString::null; |
261 |
|
|
int iEqual = sArg.indexOf("="); |
262 |
|
|
if (iEqual >= 0) { |
263 |
|
|
sVal = sArg.right(sArg.length() - iEqual - 1); |
264 |
|
|
sArg = sArg.left(iEqual); |
265 |
|
|
} |
266 |
|
|
else if (i < argc) |
267 |
|
|
sVal = argv[i + 1]; |
268 |
capela |
106 |
|
269 |
capela |
1509 |
if (sArg == "-s" || sArg == "--start") { |
270 |
|
|
bServerStart = true; |
271 |
|
|
} |
272 |
|
|
else if (sArg == "-h" || sArg == "--hostname") { |
273 |
|
|
if (sVal.isNull()) { |
274 |
|
|
out << QObject::tr("Option -h requires an argument (hostname).") + sEol; |
275 |
|
|
return false; |
276 |
|
|
} |
277 |
|
|
sServerHost = sVal; |
278 |
|
|
if (iEqual < 0) |
279 |
|
|
i++; |
280 |
|
|
} |
281 |
|
|
else if (sArg == "-p" || sArg == "--port") { |
282 |
|
|
if (sVal.isNull()) { |
283 |
|
|
out << QObject::tr("Option -p requires an argument (port).") + sEol; |
284 |
|
|
return false; |
285 |
|
|
} |
286 |
|
|
iServerPort = sVal.toInt(); |
287 |
|
|
if (iEqual < 0) |
288 |
|
|
i++; |
289 |
|
|
} |
290 |
|
|
else if (sArg == "-?" || sArg == "--help") { |
291 |
|
|
print_usage(argv[0]); |
292 |
|
|
return false; |
293 |
|
|
} |
294 |
|
|
else if (sArg == "-v" || sArg == "--version") { |
295 |
capela |
1499 |
out << QObject::tr("Qt: %1\n").arg(qVersion()); |
296 |
capela |
605 |
#ifdef CONFIG_LIBGIG |
297 |
capela |
1499 |
out << QString("%1: %2\n") |
298 |
|
|
.arg(gig::libraryName().c_str()) |
299 |
|
|
.arg(gig::libraryVersion().c_str()); |
300 |
|
|
#endif |
301 |
|
|
out << QString("%1: %2\n") |
302 |
|
|
.arg(::lscp_client_package()) |
303 |
|
|
.arg(::lscp_client_version()); |
304 |
|
|
out << QObject::tr(QSAMPLER_TITLE ": %1\n").arg(QSAMPLER_VERSION); |
305 |
capela |
1509 |
return false; |
306 |
|
|
} |
307 |
|
|
else { |
308 |
|
|
// If we don't have one by now, |
309 |
|
|
// this will be the startup sesion file... |
310 |
|
|
sSessionFile += sArg; |
311 |
|
|
iCmdArgs++; |
312 |
|
|
} |
313 |
|
|
} |
314 |
capela |
106 |
|
315 |
capela |
1509 |
// Alright with argument parsing. |
316 |
|
|
return true; |
317 |
capela |
106 |
} |
318 |
|
|
|
319 |
|
|
|
320 |
|
|
//--------------------------------------------------------------------------- |
321 |
|
|
// Widget geometry persistence helper methods. |
322 |
|
|
|
323 |
capela |
1558 |
void Options::loadWidgetGeometry ( QWidget *pWidget ) |
324 |
capela |
106 |
{ |
325 |
capela |
1499 |
// Try to restore old form window positioning. |
326 |
|
|
if (pWidget) { |
327 |
|
|
QPoint fpos; |
328 |
|
|
QSize fsize; |
329 |
|
|
bool bVisible; |
330 |
|
|
m_settings.beginGroup("/Geometry/" + pWidget->objectName()); |
331 |
|
|
fpos.setX(m_settings.value("/x", -1).toInt()); |
332 |
|
|
fpos.setY(m_settings.value("/y", -1).toInt()); |
333 |
|
|
fsize.setWidth(m_settings.value("/width", -1).toInt()); |
334 |
|
|
fsize.setHeight(m_settings.value("/height", -1).toInt()); |
335 |
|
|
bVisible = m_settings.value("/visible", false).toBool(); |
336 |
|
|
m_settings.endGroup(); |
337 |
|
|
if (fpos.x() > 0 && fpos.y() > 0) |
338 |
|
|
pWidget->move(fpos); |
339 |
|
|
if (fsize.width() > 0 && fsize.height() > 0) |
340 |
|
|
pWidget->resize(fsize); |
341 |
|
|
else |
342 |
|
|
pWidget->adjustSize(); |
343 |
|
|
if (bVisible) |
344 |
|
|
pWidget->show(); |
345 |
|
|
else |
346 |
|
|
pWidget->hide(); |
347 |
|
|
} |
348 |
capela |
106 |
} |
349 |
|
|
|
350 |
|
|
|
351 |
capela |
1558 |
void Options::saveWidgetGeometry ( QWidget *pWidget ) |
352 |
capela |
106 |
{ |
353 |
capela |
1499 |
// Try to save form window position... |
354 |
|
|
// (due to X11 window managers ideossincrasies, we better |
355 |
|
|
// only save the form geometry while its up and visible) |
356 |
|
|
if (pWidget) { |
357 |
|
|
m_settings.beginGroup("/Geometry/" + pWidget->objectName()); |
358 |
|
|
bool bVisible = pWidget->isVisible(); |
359 |
|
|
const QPoint& fpos = pWidget->pos(); |
360 |
|
|
const QSize& fsize = pWidget->size(); |
361 |
|
|
m_settings.setValue("/x", fpos.x()); |
362 |
|
|
m_settings.setValue("/y", fpos.y()); |
363 |
|
|
m_settings.setValue("/width", fsize.width()); |
364 |
|
|
m_settings.setValue("/height", fsize.height()); |
365 |
|
|
m_settings.setValue("/visible", bVisible); |
366 |
|
|
m_settings.endGroup(); |
367 |
|
|
} |
368 |
capela |
106 |
} |
369 |
|
|
|
370 |
|
|
|
371 |
|
|
//--------------------------------------------------------------------------- |
372 |
|
|
// Combo box history persistence helper implementation. |
373 |
|
|
|
374 |
capela |
1558 |
void Options::loadComboBoxHistory ( QComboBox *pComboBox, int iLimit ) |
375 |
capela |
106 |
{ |
376 |
capela |
1499 |
// Load combobox list from configuration settings file... |
377 |
|
|
m_settings.beginGroup("/History/" + pComboBox->objectName()); |
378 |
capela |
106 |
|
379 |
capela |
1499 |
if (m_settings.childKeys().count() > 0) { |
380 |
|
|
pComboBox->setUpdatesEnabled(false); |
381 |
|
|
pComboBox->setDuplicatesEnabled(false); |
382 |
|
|
pComboBox->clear(); |
383 |
|
|
for (int i = 0; i < iLimit; i++) { |
384 |
|
|
const QString& sText = m_settings.value( |
385 |
|
|
"/Item" + QString::number(i + 1)).toString(); |
386 |
|
|
if (sText.isEmpty()) |
387 |
|
|
break; |
388 |
|
|
pComboBox->addItem(sText); |
389 |
|
|
} |
390 |
|
|
pComboBox->setUpdatesEnabled(true); |
391 |
|
|
} |
392 |
capela |
106 |
|
393 |
capela |
1499 |
m_settings.endGroup(); |
394 |
capela |
106 |
} |
395 |
|
|
|
396 |
|
|
|
397 |
capela |
1558 |
void Options::saveComboBoxHistory ( QComboBox *pComboBox, int iLimit ) |
398 |
capela |
106 |
{ |
399 |
capela |
1499 |
// Add current text as latest item... |
400 |
|
|
const QString& sCurrentText = pComboBox->currentText(); |
401 |
|
|
int iCount = pComboBox->count(); |
402 |
|
|
for (int i = 0; i < iCount; i++) { |
403 |
|
|
const QString& sText = pComboBox->itemText(i); |
404 |
|
|
if (sText == sCurrentText) { |
405 |
|
|
pComboBox->removeItem(i); |
406 |
|
|
iCount--; |
407 |
|
|
break; |
408 |
|
|
} |
409 |
|
|
} |
410 |
|
|
while (iCount >= iLimit) |
411 |
|
|
pComboBox->removeItem(--iCount); |
412 |
|
|
pComboBox->insertItem(0, sCurrentText); |
413 |
|
|
iCount++; |
414 |
capela |
106 |
|
415 |
capela |
1499 |
// Save combobox list to configuration settings file... |
416 |
|
|
m_settings.beginGroup("/History/" + pComboBox->objectName()); |
417 |
|
|
for (int i = 0; i < iCount; i++) { |
418 |
|
|
const QString& sText = pComboBox->itemText(i); |
419 |
|
|
if (sText.isEmpty()) |
420 |
|
|
break; |
421 |
|
|
m_settings.setValue("/Item" + QString::number(i + 1), sText); |
422 |
|
|
} |
423 |
|
|
m_settings.endGroup(); |
424 |
capela |
106 |
} |
425 |
|
|
|
426 |
capela |
1558 |
} // namespace QSampler |
427 |
capela |
106 |
|
428 |
capela |
1558 |
|
429 |
capela |
106 |
// end of qsamplerOptions.cpp |