/[svn]/qsampler/trunk/src/qsamplerMainForm.cpp
ViewVC logotype

Diff of /qsampler/trunk/src/qsamplerMainForm.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1515 by capela, Fri Nov 23 18:15:33 2007 UTC revision 1626 by schoenebeck, Sat Jan 5 13:29:11 2008 UTC
# Line 77  static inline long lroundf ( float x ) Line 77  static inline long lroundf ( float x )
77  }  }
78  #endif  #endif
79    
80    
81    // All winsock apps needs this.
82    #if defined(WIN32)
83    static WSADATA _wsaData;
84    #endif
85    
86    
87    namespace QSampler {
88    
89  // Timer constant stuff.  // Timer constant stuff.
90  #define QSAMPLER_TIMER_MSECS    200  #define QSAMPLER_TIMER_MSECS    200
91    
# Line 87  static inline long lroundf ( float x ) Line 96  static inline long lroundf ( float x )
96  #define QSAMPLER_STATUS_SESSION 3       // Current session modification state.  #define QSAMPLER_STATUS_SESSION 3       // Current session modification state.
97    
98    
 // All winsock apps needs this.  
 #if defined(WIN32)  
 static WSADATA _wsaData;  
 #endif  
   
   
99  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
100  // qsamplerCustomEvent -- specialty for callback comunication.  // CustomEvent -- specialty for callback comunication.
101    
102  #define QSAMPLER_CUSTOM_EVENT   QEvent::Type(QEvent::User + 0)  #define QSAMPLER_CUSTOM_EVENT   QEvent::Type(QEvent::User + 0)
103    
104  class qsamplerCustomEvent : public QEvent  class CustomEvent : public QEvent
105  {  {
106  public:  public:
107    
108          // Constructor.          // Constructor.
109          qsamplerCustomEvent(lscp_event_t event, const char *pchData, int cchData)          CustomEvent(lscp_event_t event, const char *pchData, int cchData)
110                  : QEvent(QSAMPLER_CUSTOM_EVENT)                  : QEvent(QSAMPLER_CUSTOM_EVENT)
111          {          {
112                  m_event = event;                  m_event = event;
# Line 126  private: Line 129  private:
129  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
130  // qsamplerMainForm -- Main window form implementation.  // qsamplerMainForm -- Main window form implementation.
131    
 namespace QSampler {  
   
132  // Kind of singleton reference.  // Kind of singleton reference.
133  MainForm* MainForm::g_pMainForm = NULL;  MainForm* MainForm::g_pMainForm = NULL;
134    
# Line 366  MainForm::~MainForm() Line 367  MainForm::~MainForm()
367    
368    
369  // Make and set a proper setup options step.  // Make and set a proper setup options step.
370  void MainForm::setup ( qsamplerOptions *pOptions )  void MainForm::setup ( Options *pOptions )
371  {  {
372          // We got options?          // We got options?
373          m_pOptions = pOptions;          m_pOptions = pOptions;
# Line 382  void MainForm::setup ( qsamplerOptions * Line 383  void MainForm::setup ( qsamplerOptions *
383          if (m_pOptions->bKeepOnTop)          if (m_pOptions->bKeepOnTop)
384                  wflags |= Qt::Tool;                  wflags |= Qt::Tool;
385          // Some child forms are to be created right now.          // Some child forms are to be created right now.
386          m_pMessages = new qsamplerMessages(this);          m_pMessages = new Messages(this);
387          m_pDeviceForm = new DeviceForm(this, wflags);          m_pDeviceForm = new DeviceForm(this, wflags);
388  #ifdef CONFIG_MIDI_INSTRUMENT  #ifdef CONFIG_MIDI_INSTRUMENT
389          m_pInstrumentListForm = new InstrumentListForm(this, wflags);          m_pInstrumentListForm = new InstrumentListForm(this, wflags);
# Line 470  bool MainForm::queryClose (void) Line 471  bool MainForm::queryClose (void)
471                          if (m_pDeviceForm)                          if (m_pDeviceForm)
472                                  m_pDeviceForm->close();                                  m_pDeviceForm->close();
473                          // Stop client and/or server, gracefully.                          // Stop client and/or server, gracefully.
474                          stopServer();                          stopServer(true /*interactive*/);
475                  }                  }
476          }          }
477    
# Line 511  void MainForm::dropEvent ( QDropEvent* p Line 512  void MainForm::dropEvent ( QDropEvent* p
512                  QListIterator<QUrl> iter(pMimeData->urls());                  QListIterator<QUrl> iter(pMimeData->urls());
513                  while (iter.hasNext()) {                  while (iter.hasNext()) {
514                          const QString& sPath = iter.next().toLocalFile();                          const QString& sPath = iter.next().toLocalFile();
515                          if (qsamplerChannel::isInstrumentFile(sPath)) {                          if (Channel::isInstrumentFile(sPath)) {
516                                  // Try to create a new channel from instrument file...                                  // Try to create a new channel from instrument file...
517                                  qsamplerChannel *pChannel = new qsamplerChannel();                                  Channel *pChannel = new Channel();
518                                  if (pChannel == NULL)                                  if (pChannel == NULL)
519                                          return;                                          return;
520                                  // Start setting the instrument filename...                                  // Start setting the instrument filename...
# Line 549  void MainForm::customEvent(QEvent* pCust Line 550  void MainForm::customEvent(QEvent* pCust
550  {  {
551          // For the time being, just pump it to messages.          // For the time being, just pump it to messages.
552          if (pCustomEvent->type() == QSAMPLER_CUSTOM_EVENT) {          if (pCustomEvent->type() == QSAMPLER_CUSTOM_EVENT) {
553                  qsamplerCustomEvent *pEvent = (qsamplerCustomEvent *) pCustomEvent;                  CustomEvent *pEvent = static_cast<CustomEvent *> (pCustomEvent);
554                  if (pEvent->event() == LSCP_EVENT_CHANNEL_INFO) {                  if (pEvent->event() == LSCP_EVENT_CHANNEL_INFO) {
555                          int iChannelID = pEvent->data().toInt();                          int iChannelID = pEvent->data().toInt();
556                          ChannelStrip *pChannelStrip = channelStrip(iChannelID);                          ChannelStrip *pChannelStrip = channelStrip(iChannelID);
# Line 576  void MainForm::contextMenuEvent( QContex Line 577  void MainForm::contextMenuEvent( QContex
577  // qsamplerMainForm -- Brainless public property accessors.  // qsamplerMainForm -- Brainless public property accessors.
578    
579  // The global options settings property.  // The global options settings property.
580  qsamplerOptions *MainForm::options (void) const  Options *MainForm::options (void) const
581  {  {
582          return m_pOptions;          return m_pOptions;
583  }  }
# Line 737  bool MainForm::closeSession ( bool bForc Line 738  bool MainForm::closeSession ( bool bForc
738                  for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {                  for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
739                          ChannelStrip *pChannelStrip = (ChannelStrip*) wlist.at(iChannel);                          ChannelStrip *pChannelStrip = (ChannelStrip*) wlist.at(iChannel);
740                          if (pChannelStrip) {                          if (pChannelStrip) {
741                                  qsamplerChannel *pChannel = pChannelStrip->channel();                                  Channel *pChannel = pChannelStrip->channel();
742                                  if (bForce && pChannel)                                  if (bForce && pChannel)
743                                          pChannel->removeChannel();                                          pChannel->removeChannel();
744                                  delete pChannelStrip;                                  delete pChannelStrip;
# Line 877  bool MainForm::saveSessionFile ( const Q Line 878  bool MainForm::saveSessionFile ( const Q
878    
879          // Audio device mapping.          // Audio device mapping.
880          QMap<int, int> audioDeviceMap;          QMap<int, int> audioDeviceMap;
881          piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Audio);          piDeviceIDs = Device::getDevices(m_pClient, Device::Audio);
882          for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {          for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {
883                  ts << endl;                  ts << endl;
884                  qsamplerDevice device(qsamplerDevice::Audio, piDeviceIDs[iDevice]);                  Device device(Device::Audio, piDeviceIDs[iDevice]);
885                  // Audio device specification...                  // Audio device specification...
886                  ts << "# " << device.deviceTypeName() << " " << device.driverName()                  ts << "# " << device.deviceTypeName() << " " << device.driverName()
887                          << " " << tr("Device") << " " << iDevice << endl;                          << " " << tr("Device") << " " << iDevice << endl;
888                  ts << "CREATE AUDIO_OUTPUT_DEVICE " << device.driverName();                  ts << "CREATE AUDIO_OUTPUT_DEVICE " << device.driverName();
889                  qsamplerDeviceParamMap::ConstIterator deviceParam;                  DeviceParamMap::ConstIterator deviceParam;
890                  for (deviceParam = device.params().begin();                  for (deviceParam = device.params().begin();
891                                  deviceParam != device.params().end();                                  deviceParam != device.params().end();
892                                          ++deviceParam) {                                          ++deviceParam) {
893                          const qsamplerDeviceParam& param = deviceParam.value();                          const DeviceParam& param = deviceParam.value();
894                          if (param.value.isEmpty()) ts << "# ";                          if (param.value.isEmpty()) ts << "# ";
895                          ts << " " << deviceParam.key() << "='" << param.value << "'";                          ts << " " << deviceParam.key() << "='" << param.value << "'";
896                  }                  }
897                  ts << endl;                  ts << endl;
898                  // Audio channel parameters...                  // Audio channel parameters...
899                  int iPort = 0;                  int iPort = 0;
900                  QListIterator<qsamplerDevicePort *> iter(device.ports());                  QListIterator<DevicePort *> iter(device.ports());
901                  while (iter.hasNext()) {                  while (iter.hasNext()) {
902                          qsamplerDevicePort *pPort = iter.next();                          DevicePort *pPort = iter.next();
903                          qsamplerDeviceParamMap::ConstIterator portParam;                          DeviceParamMap::ConstIterator portParam;
904                          for (portParam = pPort->params().begin();                          for (portParam = pPort->params().begin();
905                                          portParam != pPort->params().end();                                          portParam != pPort->params().end();
906                                                  ++portParam) {                                                  ++portParam) {
907                                  const qsamplerDeviceParam& param = portParam.value();                                  const DeviceParam& param = portParam.value();
908                                  if (param.fix || param.value.isEmpty()) ts << "# ";                                  if (param.fix || param.value.isEmpty()) ts << "# ";
909                                  ts << "SET AUDIO_OUTPUT_CHANNEL_PARAMETER " << iDevice                                  ts << "SET AUDIO_OUTPUT_CHANNEL_PARAMETER " << iDevice
910                                          << " " << iPort << " " << portParam.key()                                          << " " << iPort << " " << portParam.key()
# Line 919  bool MainForm::saveSessionFile ( const Q Line 920  bool MainForm::saveSessionFile ( const Q
920    
921          // MIDI device mapping.          // MIDI device mapping.
922          QMap<int, int> midiDeviceMap;          QMap<int, int> midiDeviceMap;
923          piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Midi);          piDeviceIDs = Device::getDevices(m_pClient, Device::Midi);
924          for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {          for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {
925                  ts << endl;                  ts << endl;
926                  qsamplerDevice device(qsamplerDevice::Midi, piDeviceIDs[iDevice]);                  Device device(Device::Midi, piDeviceIDs[iDevice]);
927                  // MIDI device specification...                  // MIDI device specification...
928                  ts << "# " << device.deviceTypeName() << " " << device.driverName()                  ts << "# " << device.deviceTypeName() << " " << device.driverName()
929                          << " " << tr("Device") << " " << iDevice << endl;                          << " " << tr("Device") << " " << iDevice << endl;
930                  ts << "CREATE MIDI_INPUT_DEVICE " << device.driverName();                  ts << "CREATE MIDI_INPUT_DEVICE " << device.driverName();
931                  qsamplerDeviceParamMap::ConstIterator deviceParam;                  DeviceParamMap::ConstIterator deviceParam;
932                  for (deviceParam = device.params().begin();                  for (deviceParam = device.params().begin();
933                                  deviceParam != device.params().end();                                  deviceParam != device.params().end();
934                                          ++deviceParam) {                                          ++deviceParam) {
935                          const qsamplerDeviceParam& param = deviceParam.value();                          const DeviceParam& param = deviceParam.value();
936                          if (param.value.isEmpty()) ts << "# ";                          if (param.value.isEmpty()) ts << "# ";
937                          ts << " " << deviceParam.key() << "='" << param.value << "'";                          ts << " " << deviceParam.key() << "='" << param.value << "'";
938                  }                  }
939                  ts << endl;                  ts << endl;
940                  // MIDI port parameters...                  // MIDI port parameters...
941                  int iPort = 0;                  int iPort = 0;
942                  QListIterator<qsamplerDevicePort *> iter(device.ports());                  QListIterator<DevicePort *> iter(device.ports());
943                  while (iter.hasNext()) {                  while (iter.hasNext()) {
944                          qsamplerDevicePort *pPort = iter.next();                          DevicePort *pPort = iter.next();
945                          qsamplerDeviceParamMap::ConstIterator portParam;                          DeviceParamMap::ConstIterator portParam;
946                          for (portParam = pPort->params().begin();                          for (portParam = pPort->params().begin();
947                                          portParam != pPort->params().end();                                          portParam != pPort->params().end();
948                                                  ++portParam) {                                                  ++portParam) {
949                                  const qsamplerDeviceParam& param = portParam.value();                                  const DeviceParam& param = portParam.value();
950                                  if (param.fix || param.value.isEmpty()) ts << "# ";                                  if (param.fix || param.value.isEmpty()) ts << "# ";
951                                  ts << "SET MIDI_INPUT_PORT_PARAMETER " << iDevice                                  ts << "SET MIDI_INPUT_PORT_PARAMETER " << iDevice
952                                  << " " << iPort << " " << portParam.key()                                  << " " << iPort << " " << portParam.key()
# Line 1037  bool MainForm::saveSessionFile ( const Q Line 1038  bool MainForm::saveSessionFile ( const Q
1038                  ChannelStrip* pChannelStrip                  ChannelStrip* pChannelStrip
1039                          = static_cast<ChannelStrip *> (wlist.at(iChannel));                          = static_cast<ChannelStrip *> (wlist.at(iChannel));
1040                  if (pChannelStrip) {                  if (pChannelStrip) {
1041                          qsamplerChannel *pChannel = pChannelStrip->channel();                          Channel *pChannel = pChannelStrip->channel();
1042                          if (pChannel) {                          if (pChannel) {
1043                                  ts << "# " << tr("Channel") << " " << iChannel << endl;                                  ts << "# " << tr("Channel") << " " << iChannel << endl;
1044                                  ts << "ADD CHANNEL" << endl;                                  ts << "ADD CHANNEL" << endl;
# Line 1069  bool MainForm::saveSessionFile ( const Q Line 1070  bool MainForm::saveSessionFile ( const Q
1070                                  ts << "LOAD INSTRUMENT NON_MODAL '"                                  ts << "LOAD INSTRUMENT NON_MODAL '"
1071                                          << pChannel->instrumentFile() << "' "                                          << pChannel->instrumentFile() << "' "
1072                                          << pChannel->instrumentNr() << " " << iChannel << endl;                                          << pChannel->instrumentNr() << " " << iChannel << endl;
1073                                  qsamplerChannelRoutingMap::ConstIterator audioRoute;                                  ChannelRoutingMap::ConstIterator audioRoute;
1074                                  for (audioRoute = pChannel->audioRouting().begin();                                  for (audioRoute = pChannel->audioRouting().begin();
1075                                                  audioRoute != pChannel->audioRouting().end();                                                  audioRoute != pChannel->audioRouting().end();
1076                                                          ++audioRoute) {                                                          ++audioRoute) {
# Line 1314  void MainForm::editAddChannel (void) Line 1315  void MainForm::editAddChannel (void)
1315                  return;                  return;
1316    
1317          // Just create the channel instance...          // Just create the channel instance...
1318          qsamplerChannel *pChannel = new qsamplerChannel();          Channel *pChannel = new Channel();
1319          if (pChannel == NULL)          if (pChannel == NULL)
1320                  return;                  return;
1321    
# Line 1352  void MainForm::editRemoveChannel (void) Line 1353  void MainForm::editRemoveChannel (void)
1353          if (pChannelStrip == NULL)          if (pChannelStrip == NULL)
1354                  return;                  return;
1355    
1356          qsamplerChannel *pChannel = pChannelStrip->channel();          Channel *pChannel = pChannelStrip->channel();
1357          if (pChannel == NULL)          if (pChannel == NULL)
1358                  return;                  return;
1359    
# Line 1924  void MainForm::updateSession (void) Line 1925  void MainForm::updateSession (void)
1925                  for (int iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) {                  for (int iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) {
1926                          // Check if theres already a channel strip for this one...                          // Check if theres already a channel strip for this one...
1927                          if (!channelStrip(piChannelIDs[iChannel]))                          if (!channelStrip(piChannelIDs[iChannel]))
1928                                  createChannelStrip(new qsamplerChannel(piChannelIDs[iChannel]));                                  createChannelStrip(new Channel(piChannelIDs[iChannel]));
1929                  }                  }
1930                  m_pWorkspace->setUpdatesEnabled(true);                  m_pWorkspace->setUpdatesEnabled(true);
1931          }          }
# Line 2176  void MainForm::updateMessagesCapture (vo Line 2177  void MainForm::updateMessagesCapture (vo
2177  // qsamplerMainForm -- MDI channel strip management.  // qsamplerMainForm -- MDI channel strip management.
2178    
2179  // The channel strip creation executive.  // The channel strip creation executive.
2180  ChannelStrip* MainForm::createChannelStrip ( qsamplerChannel *pChannel )  ChannelStrip* MainForm::createChannelStrip ( Channel *pChannel )
2181  {  {
2182          if (m_pClient == NULL || pChannel == NULL)          if (m_pClient == NULL || pChannel == NULL)
2183                  return NULL;                  return NULL;
# Line 2248  ChannelStrip* MainForm::channelStrip ( i Line 2249  ChannelStrip* MainForm::channelStrip ( i
2249                  ChannelStrip* pChannelStrip                  ChannelStrip* pChannelStrip
2250                          = static_cast<ChannelStrip*> (wlist.at(iChannel));                          = static_cast<ChannelStrip*> (wlist.at(iChannel));
2251                  if (pChannelStrip) {                  if (pChannelStrip) {
2252                          qsamplerChannel *pChannel = pChannelStrip->channel();                          Channel *pChannel = pChannelStrip->channel();
2253                          if (pChannel && pChannel->channelID() == iChannelID)                          if (pChannel && pChannel->channelID() == iChannelID)
2254                                  return pChannelStrip;                                  return pChannelStrip;
2255                  }                  }
# Line 2389  void MainForm::startServer (void) Line 2390  void MainForm::startServer (void)
2390                  switch (QMessageBox::warning(this,                  switch (QMessageBox::warning(this,
2391                          QSAMPLER_TITLE ": " + tr("Warning"),                          QSAMPLER_TITLE ": " + tr("Warning"),
2392                          tr("Could not start the LinuxSampler server.\n\n"                          tr("Could not start the LinuxSampler server.\n\n"
2393                          "Maybe it ss already started."),                          "Maybe it is already started."),
2394                          tr("Stop"), tr("Kill"), tr("Cancel"))) {                          tr("Stop"), tr("Kill"), tr("Cancel"))) {
2395                  case 0:                  case 0:
2396                          m_pServer->terminate();                          m_pServer->terminate();
# Line 2409  void MainForm::startServer (void) Line 2410  void MainForm::startServer (void)
2410                  return;                  return;
2411    
2412          // OK. Let's build the startup process...          // OK. Let's build the startup process...
2413          m_pServer = new QProcess(this);          m_pServer = new QProcess();
2414            bForceServerStop = true;
2415    
2416          // Setup stdout/stderr capture...          // Setup stdout/stderr capture...
2417  //      if (m_pOptions->bStdoutCapture) {  //      if (m_pOptions->bStdoutCapture) {
2418                  //m_pServer->setProcessChannelMode(  #if QT_VERSION >= 0x040200
2419                  //      QProcess::StandardOutput);                  m_pServer->setProcessChannelMode(QProcess::ForwardedChannels);
2420    #endif
2421                  QObject::connect(m_pServer,                  QObject::connect(m_pServer,
2422                          SIGNAL(readyReadStandardOutput()),                          SIGNAL(readyReadStandardOutput()),
2423                          SLOT(readServerStdout()));                          SLOT(readServerStdout()));
# Line 2425  void MainForm::startServer (void) Line 2428  void MainForm::startServer (void)
2428    
2429          // The unforgiveable signal communication...          // The unforgiveable signal communication...
2430          QObject::connect(m_pServer,          QObject::connect(m_pServer,
2431                  SIGNAL(finished(int,QProcess::ExitStatus)),                  SIGNAL(finished(int, QProcess::ExitStatus)),
2432                  SLOT(processServerExit()));                  SLOT(processServerExit()));
2433    
2434          // Build process arguments...          // Build process arguments...
# Line 2456  void MainForm::startServer (void) Line 2459  void MainForm::startServer (void)
2459    
2460    
2461  // Stop linuxsampler server...  // Stop linuxsampler server...
2462  void MainForm::stopServer (void)  void MainForm::stopServer (bool bInteractive)
2463  {  {
2464          // Stop client code.          // Stop client code.
2465          stopClient();          stopClient();
2466    
2467            if (m_pServer && bInteractive) {
2468                    if (QMessageBox::question(this,
2469                            QSAMPLER_TITLE ": " + tr("The backend's fate ..."),
2470                            tr("You have the option to keep the sampler backend (LinuxSampler)\n"
2471                            "running in the background. The sampler would continue to work\n"
2472                            "according to your current sampler session and you could alter the\n"
2473                            "sampler session at any time by relaunching QSampler.\n\n"
2474                            "Do you want LinuxSampler to stop or to keep running in\n"
2475                            "the background?"),
2476                            tr("Stop"), tr("Keep Running")) == 1)
2477                    {
2478                            bForceServerStop = false;
2479                    }
2480            }
2481    
2482          // And try to stop server.          // And try to stop server.
2483          if (m_pServer) {          if (m_pServer && bForceServerStop) {
2484                  appendMessages(tr("Server is stopping..."));                  appendMessages(tr("Server is stopping..."));
2485                  if (m_pServer->state() == QProcess::Running)                  if (m_pServer->state() == QProcess::Running) {
2486    #if defined(WIN32)
2487                            // Try harder...
2488                            m_pServer->kill();
2489    #else
2490                            // Try softly...
2491                          m_pServer->terminate();                          m_pServer->terminate();
2492          }  #endif
2493                    }
2494            }       // Do final processing anyway.
2495            else processServerExit();
2496    
2497          // Give it some time to terminate gracefully and stabilize...          // Give it some time to terminate gracefully and stabilize...
2498          QTime t;          QTime t;
2499          t.start();          t.start();
2500          while (t.elapsed() < QSAMPLER_TIMER_MSECS)          while (t.elapsed() < QSAMPLER_TIMER_MSECS)
2501                  QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);                  QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
   
         // Do final processing anyway.  
         processServerExit();  
2502  }  }
2503    
2504    
# Line 2497  void MainForm::processServerExit (void) Line 2520  void MainForm::processServerExit (void)
2520          if (m_pMessages)          if (m_pMessages)
2521                  m_pMessages->flushStdoutBuffer();                  m_pMessages->flushStdoutBuffer();
2522    
2523          if (m_pServer) {          if (m_pServer && bForceServerStop) {
2524                    if (m_pServer->state() != QProcess::NotRunning) {
2525                            appendMessages(tr("Server is being forced..."));
2526                            // Force final server shutdown...
2527                            m_pServer->kill();
2528                            // Give it some time to terminate gracefully and stabilize...
2529                            QTime t;
2530                            t.start();
2531                            while (t.elapsed() < QSAMPLER_TIMER_MSECS)
2532                                    QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
2533                    }
2534                  // Force final server shutdown...                  // Force final server shutdown...
2535                  appendMessages(                  appendMessages(
2536                          tr("Server was stopped with exit status %1.")                          tr("Server was stopped with exit status %1.")
2537                          .arg(m_pServer->exitStatus()));                          .arg(m_pServer->exitStatus()));
                 m_pServer->terminate();  
                 if (!m_pServer->waitForFinished(2000))  
                         m_pServer->kill();  
                 // Destroy it.  
2538                  delete m_pServer;                  delete m_pServer;
2539                  m_pServer = NULL;                  m_pServer = NULL;
2540          }          }
# Line 2530  lscp_status_t qsampler_client_callback ( Line 2559  lscp_status_t qsampler_client_callback (
2559          // as this is run under some other thread context.          // as this is run under some other thread context.
2560          // A custom event must be posted here...          // A custom event must be posted here...
2561          QApplication::postEvent(pMainForm,          QApplication::postEvent(pMainForm,
2562                  new qsamplerCustomEvent(event, pchData, cchData));                  new CustomEvent(event, pchData, cchData));
2563    
2564          return LSCP_OK;          return LSCP_OK;
2565  }  }

Legend:
Removed from v.1515  
changed lines
  Added in v.1626

  ViewVC Help
Powered by ViewVC