1 |
// qsamplerOptions.cpp |
// qsamplerOptions.cpp |
2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
Copyright (C) 2004-2010, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2015, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
Copyright (C) 2007, Christian Schoenebeck |
Copyright (C) 2007,2015 Christian Schoenebeck |
6 |
|
|
7 |
This program is free software; you can redistribute it and/or |
This program is free software; you can redistribute it and/or |
8 |
modify it under the terms of the GNU General Public License |
modify it under the terms of the GNU General Public License |
65 |
m_settings.beginGroup("/Server"); |
m_settings.beginGroup("/Server"); |
66 |
sServerHost = m_settings.value("/ServerHost", "localhost").toString(); |
sServerHost = m_settings.value("/ServerHost", "localhost").toString(); |
67 |
iServerPort = m_settings.value("/ServerPort", 8888).toInt(); |
iServerPort = m_settings.value("/ServerPort", 8888).toInt(); |
68 |
#if defined(__APPLE__) // Toshi Nagata 20080105 |
#if defined(__APPLE__) // Toshi Nagata 20080105 |
69 |
// TODO: Should this be a configure option? |
// TODO: Should this be a configure option? |
70 |
iServerTimeout = m_settings.value("/ServerTimeout", 10000).toInt(); |
iServerTimeout = m_settings.value("/ServerTimeout", 10000).toInt(); |
71 |
#else |
#else |
72 |
iServerTimeout = m_settings.value("/ServerTimeout", 1000).toInt(); |
iServerTimeout = m_settings.value("/ServerTimeout", 1000).toInt(); |
73 |
#endif |
#endif |
74 |
bServerStart = m_settings.value("/ServerStart", true).toBool(); |
bServerStart = m_settings.value("/ServerStart", true).toBool(); |
75 |
#if defined(__APPLE__) // Toshi Nagata 20080113 |
#if defined(__APPLE__) |
76 |
sServerCmdLine = m_settings.value("/ServerCmdLine", "linuxsampler.starter").toString(); |
sServerCmdLine = m_settings.value("/ServerCmdLine", "/usr/local/bin/linuxsampler").toString(); |
77 |
#else |
#else |
78 |
sServerCmdLine = m_settings.value("/ServerCmdLine", "linuxsampler").toString(); |
sServerCmdLine = m_settings.value("/ServerCmdLine", "linuxsampler").toString(); |
79 |
#endif |
#endif |
80 |
iStartDelay = m_settings.value("/StartDelay", 3).toInt(); |
iStartDelay = m_settings.value("/StartDelay", 3).toInt(); |
81 |
m_settings.endGroup(); |
m_settings.endGroup(); |
82 |
|
|
97 |
bMessagesLimit = m_settings.value("/MessagesLimit", true).toBool(); |
bMessagesLimit = m_settings.value("/MessagesLimit", true).toBool(); |
98 |
iMessagesLimitLines = m_settings.value("/MessagesLimitLines", 1000).toInt(); |
iMessagesLimitLines = m_settings.value("/MessagesLimitLines", 1000).toInt(); |
99 |
bConfirmRemove = m_settings.value("/ConfirmRemove", true).toBool(); |
bConfirmRemove = m_settings.value("/ConfirmRemove", true).toBool(); |
100 |
|
bConfirmReset = m_settings.value("/ConfirmReset", true).toBool(); |
101 |
|
bConfirmRestart = m_settings.value("/ConfirmRestart", true).toBool(); |
102 |
|
bConfirmError = m_settings.value("/ConfirmError", true).toBool(); |
103 |
bKeepOnTop = m_settings.value("/KeepOnTop", true).toBool(); |
bKeepOnTop = m_settings.value("/KeepOnTop", true).toBool(); |
104 |
bStdoutCapture = m_settings.value("/StdoutCapture", true).toBool(); |
bStdoutCapture = m_settings.value("/StdoutCapture", true).toBool(); |
105 |
bCompletePath = m_settings.value("/CompletePath", true).toBool(); |
bCompletePath = m_settings.value("/CompletePath", true).toBool(); |
107 |
iBaseFontSize = m_settings.value("/BaseFontSize", 0).toInt(); |
iBaseFontSize = m_settings.value("/BaseFontSize", 0).toInt(); |
108 |
// if libgig provides a fast way to retrieve instrument names even for large |
// if libgig provides a fast way to retrieve instrument names even for large |
109 |
// .gig files, then we enable this feature by default |
// .gig files, then we enable this feature by default |
110 |
#if HAVE_LIBGIG_SETAUTOLOAD |
#ifdef CONFIG_LIBGIG_SETAUTOLOAD |
111 |
bInstrumentNames = m_settings.value("/InstrumentNames", true).toBool(); |
bInstrumentNames = m_settings.value("/InstrumentNames", true).toBool(); |
112 |
#else |
#else |
113 |
bInstrumentNames = m_settings.value("/InstrumentNames", false).toBool(); |
bInstrumentNames = m_settings.value("/InstrumentNames", false).toBool(); |
195 |
m_settings.setValue("/MessagesLimit", bMessagesLimit); |
m_settings.setValue("/MessagesLimit", bMessagesLimit); |
196 |
m_settings.setValue("/MessagesLimitLines", iMessagesLimitLines); |
m_settings.setValue("/MessagesLimitLines", iMessagesLimitLines); |
197 |
m_settings.setValue("/ConfirmRemove", bConfirmRemove); |
m_settings.setValue("/ConfirmRemove", bConfirmRemove); |
198 |
|
m_settings.setValue("/ConfirmReset", bConfirmReset); |
199 |
|
m_settings.setValue("/ConfirmRestart", bConfirmRestart); |
200 |
|
m_settings.setValue("/ConfirmError", bConfirmError); |
201 |
m_settings.setValue("/KeepOnTop", bKeepOnTop); |
m_settings.setValue("/KeepOnTop", bKeepOnTop); |
202 |
m_settings.setValue("/StdoutCapture", bStdoutCapture); |
m_settings.setValue("/StdoutCapture", bStdoutCapture); |
203 |
m_settings.setValue("/CompletePath", bCompletePath); |
m_settings.setValue("/CompletePath", bCompletePath); |
273 |
QSAMPLER_TITLE " - " QSAMPLER_SUBTITLE "\n\n" |
QSAMPLER_TITLE " - " QSAMPLER_SUBTITLE "\n\n" |
274 |
"Options:\n\n" |
"Options:\n\n" |
275 |
" -s, --start\n\tStart linuxsampler server locally\n\n" |
" -s, --start\n\tStart linuxsampler server locally\n\n" |
276 |
" -h, --hostname\n\tSpecify linuxsampler server hostname\n\n" |
" -h, --hostname\n\tSpecify linuxsampler server hostname (default = localhost)\n\n" |
277 |
" -p, --port\n\tSpecify linuxsampler server port number\n\n" |
" -p, --port\n\tSpecify linuxsampler server port number (default = 8888)\n\n" |
278 |
" -?, --help\n\tShow help about command line options\n\n" |
" -?, --help\n\tShow help about command line options\n\n" |
279 |
" -v, --version\n\tShow version information\n\n") |
" -v, --version\n\tShow version information\n\n") |
280 |
.arg(arg0); |
.arg(arg0); |
287 |
QTextStream out(stderr); |
QTextStream out(stderr); |
288 |
const QString sEol = "\n\n"; |
const QString sEol = "\n\n"; |
289 |
int iCmdArgs = 0; |
int iCmdArgs = 0; |
290 |
int argc = args.count(); |
const int argc = args.count(); |
291 |
|
|
292 |
for (int i = 1; i < argc; i++) { |
for (int i = 1; i < argc; i++) { |
293 |
|
|
300 |
|
|
301 |
QString sArg = args.at(i); |
QString sArg = args.at(i); |
302 |
QString sVal = QString::null; |
QString sVal = QString::null; |
303 |
int iEqual = sArg.indexOf("="); |
const int iEqual = sArg.indexOf("="); |
304 |
if (iEqual >= 0) { |
if (iEqual >= 0) { |
305 |
sVal = sArg.right(sArg.length() - iEqual - 1); |
sVal = sArg.right(sArg.length() - iEqual - 1); |
306 |
sArg = sArg.left(iEqual); |
sArg = sArg.left(iEqual); |
307 |
} |
} |
308 |
else if (i < argc - 1) |
else if (i < argc - 1) { |
309 |
sVal = args.at(i + 1); |
sVal = args.at(i + 1); |
310 |
|
if (sVal[0] == '-') |
311 |
|
sVal.clear(); |
312 |
|
} |
313 |
|
|
314 |
if (sArg == "-s" || sArg == "--start") { |
if (sArg == "-s" || sArg == "--start") { |
315 |
bServerStart = true; |
bServerStart = true; |
316 |
} |
} |
317 |
else if (sArg == "-h" || sArg == "--hostname") { |
else if (sArg == "-h" || sArg == "--hostname") { |
318 |
if (sVal.isNull()) { |
if (sVal.isNull()) { |
319 |
out << QObject::tr("Option -h requires an argument (hostname).") + sEol; |
out << QObject::tr("Option -h requires an argument (host).") + sEol; |
320 |
return false; |
return false; |
321 |
} |
} |
322 |
sServerHost = sVal; |
sServerHost = sVal; |
338 |
} |
} |
339 |
else if (sArg == "-v" || sArg == "--version") { |
else if (sArg == "-v" || sArg == "--version") { |
340 |
out << QObject::tr("Qt: %1\n").arg(qVersion()); |
out << QObject::tr("Qt: %1\n").arg(qVersion()); |
341 |
#ifdef CONFIG_LIBGIG |
#ifdef CONFIG_LIBGIG |
342 |
out << QString("%1: %2\n") |
out << QString("%1: %2\n") |
343 |
.arg(gig::libraryName().c_str()) |
.arg(gig::libraryName().c_str()) |
344 |
.arg(gig::libraryVersion().c_str()); |
.arg(gig::libraryVersion().c_str()); |
345 |
#endif |
#endif |
346 |
out << QString("%1: %2\n") |
out << QString("%1: %2\n") |
347 |
.arg(::lscp_client_package()) |
.arg(::lscp_client_package()) |
348 |
.arg(::lscp_client_version()); |
.arg(::lscp_client_version()); |