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__) || defined(_WIN32) || 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__) || defined(_WIN32) || 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__) || defined(_WIN32) || defined(WIN32) |
429 |
WSACleanup(); |
WSACleanup(); |
430 |
#endif |
#endif |
431 |
|
|
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__) || defined(_WIN32) || 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( |