1 |
// qsamplerMainForm.cpp |
// qsamplerMainForm.cpp |
2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
Copyright (C) 2004-2016, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2017, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
Copyright (C) 2007,2008,2015 Christian Schoenebeck |
Copyright (C) 2007,2008,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 |
91 |
|
|
92 |
|
|
93 |
// All winsock apps needs this. |
// All winsock apps needs this. |
94 |
#if defined(WIN32) |
#if defined(_WIN32) |
95 |
static WSADATA _wsaData; |
static WSADATA _wsaData; |
96 |
#endif |
#endif |
97 |
|
|
324 |
m_statusItem[QSAMPLER_STATUS_SESSION] = pLabel; |
m_statusItem[QSAMPLER_STATUS_SESSION] = pLabel; |
325 |
statusBar()->addWidget(pLabel); |
statusBar()->addWidget(pLabel); |
326 |
|
|
327 |
#if defined(WIN32) |
#if defined(_WIN32) |
328 |
WSAStartup(MAKEWORD(1, 1), &_wsaData); |
WSAStartup(MAKEWORD(1, 1), &_wsaData); |
329 |
#endif |
#endif |
330 |
|
|
425 |
// Do final processing anyway. |
// Do final processing anyway. |
426 |
processServerExit(); |
processServerExit(); |
427 |
|
|
428 |
#if defined(WIN32) |
#if defined(_WIN32) |
429 |
WSACleanup(); |
WSACleanup(); |
430 |
#endif |
#endif |
431 |
|
|
1046 |
int iErrors = 0; |
int iErrors = 0; |
1047 |
QTextStream ts(&file); |
QTextStream ts(&file); |
1048 |
ts << "# " << QSAMPLER_TITLE " - " << tr(QSAMPLER_SUBTITLE) << endl; |
ts << "# " << QSAMPLER_TITLE " - " << tr(QSAMPLER_SUBTITLE) << endl; |
1049 |
ts << "# " << tr("Version") |
ts << "# " << tr("Version") << ": " CONFIG_BUILD_VERSION << endl; |
1050 |
<< ": " QSAMPLER_VERSION << endl; |
// ts << "# " << tr("Build") << ": " CONFIG_BUILD_DATE << endl; |
|
ts << "# " << tr("Build") |
|
|
<< ": " CONFIG_BUILD_DATE << endl; |
|
1051 |
ts << "#" << endl; |
ts << "#" << endl; |
1052 |
ts << "# " << tr("File") |
ts << "# " << tr("File") |
1053 |
<< ": " << QFileInfo(sFilename).fileName() << endl; |
<< ": " << QFileInfo(sFilename).fileName() << endl; |
1958 |
// Show information about application program. |
// Show information about application program. |
1959 |
void MainForm::helpAbout (void) |
void MainForm::helpAbout (void) |
1960 |
{ |
{ |
1961 |
// Stuff the about box text... |
QStringList list; |
|
QString sText = "<p>\n"; |
|
|
sText += "<b>" QSAMPLER_TITLE " - " + tr(QSAMPLER_SUBTITLE) + "</b><br />\n"; |
|
|
sText += "<br />\n"; |
|
|
sText += tr("Version") + ": <b>" QSAMPLER_VERSION "</b><br />\n"; |
|
|
sText += "<small>" + tr("Build") + ": " CONFIG_BUILD_DATE "</small><br />\n"; |
|
1962 |
#ifdef CONFIG_DEBUG |
#ifdef CONFIG_DEBUG |
1963 |
sText += "<small><font color=\"red\">"; |
list << tr("Debugging option enabled."); |
|
sText += tr("Debugging option enabled."); |
|
|
sText += "</font></small><br />"; |
|
1964 |
#endif |
#endif |
1965 |
#ifndef CONFIG_LIBGIG |
#ifndef CONFIG_LIBGIG |
1966 |
sText += "<small><font color=\"red\">"; |
list << tr("GIG (libgig) file support disabled."); |
|
sText += tr("GIG (libgig) file support disabled."); |
|
|
sText += "</font></small><br />"; |
|
1967 |
#endif |
#endif |
1968 |
#ifndef CONFIG_INSTRUMENT_NAME |
#ifndef CONFIG_INSTRUMENT_NAME |
1969 |
sText += "<small><font color=\"red\">"; |
list << tr("LSCP (liblscp) instrument_name support disabled."); |
|
sText += tr("LSCP (liblscp) instrument_name support disabled."); |
|
|
sText += "</font></small><br />"; |
|
1970 |
#endif |
#endif |
1971 |
#ifndef CONFIG_MUTE_SOLO |
#ifndef CONFIG_MUTE_SOLO |
1972 |
sText += "<small><font color=\"red\">"; |
list << tr("Sampler channel Mute/Solo support disabled."); |
|
sText += tr("Sampler channel Mute/Solo support disabled."); |
|
|
sText += "</font></small><br />"; |
|
1973 |
#endif |
#endif |
1974 |
#ifndef CONFIG_AUDIO_ROUTING |
#ifndef CONFIG_AUDIO_ROUTING |
1975 |
sText += "<small><font color=\"red\">"; |
list << tr("LSCP (liblscp) audio_routing support disabled."); |
|
sText += tr("LSCP (liblscp) audio_routing support disabled."); |
|
|
sText += "</font></small><br />"; |
|
1976 |
#endif |
#endif |
1977 |
#ifndef CONFIG_FXSEND |
#ifndef CONFIG_FXSEND |
1978 |
sText += "<small><font color=\"red\">"; |
list << tr("Sampler channel Effect Sends support disabled."); |
|
sText += tr("Sampler channel Effect Sends support disabled."); |
|
|
sText += "</font></small><br />"; |
|
1979 |
#endif |
#endif |
1980 |
#ifndef CONFIG_VOLUME |
#ifndef CONFIG_VOLUME |
1981 |
sText += "<small><font color=\"red\">"; |
list << tr("Global volume support disabled."); |
|
sText += tr("Global volume support disabled."); |
|
|
sText += "</font></small><br />"; |
|
1982 |
#endif |
#endif |
1983 |
#ifndef CONFIG_MIDI_INSTRUMENT |
#ifndef CONFIG_MIDI_INSTRUMENT |
1984 |
sText += "<small><font color=\"red\">"; |
list << tr("MIDI instrument mapping support disabled."); |
|
sText += tr("MIDI instrument mapping support disabled."); |
|
|
sText += "</font></small><br />"; |
|
1985 |
#endif |
#endif |
1986 |
#ifndef CONFIG_EDIT_INSTRUMENT |
#ifndef CONFIG_EDIT_INSTRUMENT |
1987 |
sText += "<small><font color=\"red\">"; |
list << tr("Instrument editing support disabled."); |
|
sText += tr("Instrument editing support disabled."); |
|
|
sText += "</font></small><br />"; |
|
1988 |
#endif |
#endif |
1989 |
#ifndef CONFIG_EVENT_CHANNEL_MIDI |
#ifndef CONFIG_EVENT_CHANNEL_MIDI |
1990 |
sText += "<small><font color=\"red\">"; |
list << tr("Channel MIDI event support disabled."); |
|
sText += tr("Channel MIDI event support disabled."); |
|
|
sText += "</font></small><br />"; |
|
1991 |
#endif |
#endif |
1992 |
#ifndef CONFIG_EVENT_DEVICE_MIDI |
#ifndef CONFIG_EVENT_DEVICE_MIDI |
1993 |
sText += "<small><font color=\"red\">"; |
list << tr("Device MIDI event support disabled."); |
|
sText += tr("Device MIDI event support disabled."); |
|
|
sText += "</font></small><br />"; |
|
1994 |
#endif |
#endif |
1995 |
#ifndef CONFIG_MAX_VOICES |
#ifndef CONFIG_MAX_VOICES |
1996 |
sText += "<small><font color=\"red\">"; |
list << tr("Runtime max. voices / disk streams support disabled."); |
|
sText += tr("Runtime max. voices / disk streams support disabled."); |
|
|
sText += "</font></small><br />"; |
|
1997 |
#endif |
#endif |
1998 |
|
|
1999 |
|
// Stuff the about box text... |
2000 |
|
QString sText = "<p>\n"; |
2001 |
|
sText += "<b>" QSAMPLER_TITLE " - " + tr(QSAMPLER_SUBTITLE) + "</b><br />\n"; |
2002 |
|
sText += "<br />\n"; |
2003 |
|
sText += tr("Version") + ": <b>" CONFIG_BUILD_VERSION "</b><br />\n"; |
2004 |
|
// sText += "<small>" + tr("Build") + ": " CONFIG_BUILD_DATE "</small><br />\n"; |
2005 |
|
if (!list.isEmpty()) { |
2006 |
|
sText += "<small><font color=\"red\">"; |
2007 |
|
sText += list.join("<br />\n"); |
2008 |
|
sText += "</font></small>"; |
2009 |
|
} |
2010 |
sText += "<br />\n"; |
sText += "<br />\n"; |
2011 |
sText += tr("Using") + ": "; |
sText += tr("Using") + ": "; |
2012 |
sText += ::lscp_client_package(); |
sText += ::lscp_client_package(); |
2801 |
|
|
2802 |
// OK. Let's build the startup process... |
// OK. Let's build the startup process... |
2803 |
m_pServer = new QProcess(); |
m_pServer = new QProcess(); |
2804 |
bForceServerStop = true; |
m_bForceServerStop = true; |
2805 |
|
|
2806 |
// Setup stdout/stderr capture... |
// Setup stdout/stderr capture... |
2807 |
m_pServer->setProcessChannelMode(QProcess::ForwardedChannels); |
m_pServer->setProcessChannelMode(QProcess::ForwardedChannels); |
2845 |
|
|
2846 |
|
|
2847 |
// Stop linuxsampler server... |
// Stop linuxsampler server... |
2848 |
void MainForm::stopServer (bool bInteractive) |
void MainForm::stopServer ( bool bInteractive ) |
2849 |
{ |
{ |
2850 |
// Stop client code. |
// Stop client code. |
2851 |
stopClient(); |
stopClient(); |
2859 |
"sampler session at any time by relaunching QSampler.\n\n" |
"sampler session at any time by relaunching QSampler.\n\n" |
2860 |
"Do you want LinuxSampler to stop?"), |
"Do you want LinuxSampler to stop?"), |
2861 |
QMessageBox::Yes | QMessageBox::No, |
QMessageBox::Yes | QMessageBox::No, |
2862 |
QMessageBox::Yes) == QMessageBox::No) |
QMessageBox::Yes) == QMessageBox::No) { |
2863 |
{ |
m_bForceServerStop = false; |
|
bForceServerStop = false; |
|
2864 |
} |
} |
2865 |
} |
} |
2866 |
|
|
2867 |
// And try to stop server. |
// And try to stop server. |
2868 |
if (m_pServer && bForceServerStop) { |
if (m_pServer && m_bForceServerStop) { |
2869 |
appendMessages(tr("Server is stopping...")); |
appendMessages(tr("Server is stopping...")); |
2870 |
if (m_pServer->state() == QProcess::Running) { |
if (m_pServer->state() == QProcess::Running) { |
2871 |
#if defined(WIN32) |
#if defined(_WIN32) |
2872 |
// Try harder... |
// Try harder... |
2873 |
m_pServer->kill(); |
m_pServer->kill(); |
2874 |
#else |
#else |
2905 |
if (m_pMessages) |
if (m_pMessages) |
2906 |
m_pMessages->flushStdoutBuffer(); |
m_pMessages->flushStdoutBuffer(); |
2907 |
|
|
2908 |
if (m_pServer && bForceServerStop) { |
if (m_pServer && m_bForceServerStop) { |
2909 |
if (m_pServer->state() != QProcess::NotRunning) { |
if (m_pServer->state() != QProcess::NotRunning) { |
2910 |
appendMessages(tr("Server is being forced...")); |
appendMessages(tr("Server is being forced...")); |
2911 |
// Force final server shutdown... |
// Force final server shutdown... |
2982 |
stabilizeForm(); |
stabilizeForm(); |
2983 |
return false; |
return false; |
2984 |
} |
} |
2985 |
|
|
2986 |
// Just set receive timeout value, blindly. |
// Just set receive timeout value, blindly. |
2987 |
::lscp_client_set_timeout(m_pClient, m_pOptions->iServerTimeout); |
::lscp_client_set_timeout(m_pClient, m_pOptions->iServerTimeout); |
2988 |
appendMessages( |
appendMessages( |