/[svn]/qsampler/trunk/src/qsamplerMainForm.ui.h
ViewVC logotype

Diff of /qsampler/trunk/src/qsamplerMainForm.ui.h

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

revision 127 by capela, Mon Jun 14 21:05:20 2004 UTC revision 395 by capela, Sun Feb 20 19:13:33 2005 UTC
# Line 2  Line 2 
2  //  //
3  // ui.h extension file, included from the uic-generated form implementation.  // ui.h extension file, included from the uic-generated form implementation.
4  /****************************************************************************  /****************************************************************************
5     Copyright (C) 2004, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2005, rncbc aka Rui Nuno Capela. All rights reserved.
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
# Line 26  Line 26 
26  #include <qprocess.h>  #include <qprocess.h>
27  #include <qmessagebox.h>  #include <qmessagebox.h>
28  #include <qdragobject.h>  #include <qdragobject.h>
29    #include <qregexp.h>
30  #include <qfiledialog.h>  #include <qfiledialog.h>
31  #include <qfileinfo.h>  #include <qfileinfo.h>
32  #include <qfile.h>  #include <qfile.h>
# Line 36  Line 37 
37    
38  #include "qsamplerAbout.h"  #include "qsamplerAbout.h"
39  #include "qsamplerOptions.h"  #include "qsamplerOptions.h"
40    #include "qsamplerChannel.h"
41  #include "qsamplerMessages.h"  #include "qsamplerMessages.h"
42    
43  #include "qsamplerChannelStrip.h"  #include "qsamplerChannelStrip.h"
# Line 43  Line 45 
45    
46  #include "config.h"  #include "config.h"
47    
48    #ifdef HAVE_SIGNAL_H
49    #include <signal.h>
50    #endif
51    
52  // Timer constant stuff.  // Timer constant stuff.
53  #define QSAMPLER_TIMER_MSECS    200  #define QSAMPLER_TIMER_MSECS    200
# Line 54  Line 59 
59  #define QSAMPLER_STATUS_SESSION 3       // Current session modification state.  #define QSAMPLER_STATUS_SESSION 3       // Current session modification state.
60    
61    
62    // All winsock apps needs this.
63  #if defined(WIN32)  #if defined(WIN32)
64  static WSADATA _wsaData;  static WSADATA _wsaData;
65  #endif  #endif
66    
67    
68    //-------------------------------------------------------------------------
69    // qsamplerCustomEvent -- specialty for callback comunication.
70    
71    #define QSAMPLER_CUSTOM_EVENT   1000
72    
73    class qsamplerCustomEvent : public QCustomEvent
74    {
75    public:
76    
77        // Constructor.
78        qsamplerCustomEvent(lscp_event_t event, const char *pchData, int cchData)
79            : QCustomEvent(QSAMPLER_CUSTOM_EVENT)
80        {
81            m_event = event;
82            m_data.setLatin1(pchData, cchData);
83        }
84    
85        // Accessors.
86        lscp_event_t event() { return m_event; }
87        QString&     data()  { return m_data;  }
88    
89    private:
90    
91        // The proper event type.
92        lscp_event_t m_event;
93        // The event data as a string.
94        QString      m_data;
95    };
96    
97    
98  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
99  // qsamplerMainForm -- Main window form implementation.  // qsamplerMainForm -- Main window form implementation.
100    
# Line 71  void qsamplerMainForm::init (void) Line 108  void qsamplerMainForm::init (void)
108      m_pMessages = NULL;      m_pMessages = NULL;
109    
110      // We'll start clean.      // We'll start clean.
111      m_iUntitled = 0;      m_iUntitled    = 0;
112      m_iDirtyCount = 0;      m_iDirtyCount  = 0;
113        m_iChangeCount = 0;
114    
115      m_pServer = NULL;      m_pServer = NULL;
116      m_pClient = NULL;      m_pClient = NULL;
# Line 82  void qsamplerMainForm::init (void) Line 120  void qsamplerMainForm::init (void)
120    
121      m_iTimerSlot = 0;      m_iTimerSlot = 0;
122    
123    #ifdef HAVE_SIGNAL_H
124            // Set to ignore any fatal "Broken pipe" signals.
125            ::signal(SIGPIPE, SIG_IGN);
126    #endif
127    
128      // Make it an MDI workspace.      // Make it an MDI workspace.
129      m_pWorkspace = new QWorkspace(this);      m_pWorkspace = new QWorkspace(this);
130      m_pWorkspace->setScrollBarsEnabled(true);      m_pWorkspace->setScrollBarsEnabled(true);
# Line 252  void qsamplerMainForm::closeEvent ( QClo Line 295  void qsamplerMainForm::closeEvent ( QClo
295  }  }
296    
297    
298  // Window drag-n-drop event handlers.  // Drag'n'drop file handler.
299  void qsamplerMainForm::dragEnterEvent ( QDragEnterEvent* pDragEnterEvent )  bool qsamplerMainForm::decodeDragFiles ( const QMimeSource *pEvent, QStringList& files )
300  {  {
301      bool bAccept = false;      bool bDecode = false;
302    
303      if (QTextDrag::canDecode(pDragEnterEvent)) {      if (QTextDrag::canDecode(pEvent)) {
304          QString sUrl;          QString sText;
305          if (QTextDrag::decode(pDragEnterEvent, sUrl) && m_pClient)          bDecode = QTextDrag::decode(pEvent, sText);
306              bAccept = QFileInfo(QUrl(sUrl).path()).exists();          if (bDecode) {
307                files = QStringList::split('\n', sText);
308                for (QStringList::Iterator iter = files.begin(); iter != files.end(); iter++)
309                    *iter = (*iter).stripWhiteSpace().replace(QRegExp("^file:"), QString::null);
310            }
311      }      }
312    
313      pDragEnterEvent->accept(bAccept);      return bDecode;
314    }
315    
316    
317    // Window drag-n-drop event handlers.
318    void qsamplerMainForm::dragEnterEvent ( QDragEnterEvent* pDragEnterEvent )
319    {
320            QStringList files;
321            pDragEnterEvent->accept(decodeDragFiles(pDragEnterEvent, files));
322  }  }
323    
324    
325  void qsamplerMainForm::dropEvent ( QDropEvent* pDropEvent )  void qsamplerMainForm::dropEvent ( QDropEvent* pDropEvent )
326  {  {
327      if (QTextDrag::canDecode(pDropEvent)) {      QStringList files;
328          QString sUrl;  
329          if (QTextDrag::decode(pDropEvent, sUrl) && closeSession(true))      if (!decodeDragFiles(pDropEvent, files))
330              loadSessionFile(QUrl(sUrl).path());          return;
331    
332        for (QStringList::Iterator iter = files.begin(); iter != files.end(); iter++) {
333                    const QString& sPath = QUrl(*iter).path();
334                    if (qsamplerChannel::isInstrumentFile(sPath)) {
335                            // Try to create a new channel from instrument file...
336                        qsamplerChannel *pChannel = new qsamplerChannel(this);
337                        if (pChannel == NULL)
338                            return;
339                            // Start setting the instrument filename...
340                            pChannel->setInstrument(sPath, 0);
341                        // Before we show it up, may be we'll
342                        // better ask for some initial values?
343                        if (!pChannel->channelSetup(this)) {
344                            delete pChannel;
345                            return;
346                        }
347                        // Finally, give it to a new channel strip...
348                            if (!createChannelStrip(pChannel)) {
349                            delete pChannel;
350                            return;
351                            }
352                        // Make that an overall update.
353                        m_iDirtyCount++;
354                        m_iChangeCount++;
355                        stabilizeForm();
356                    }   // Otherwise, load an usual session file (LSCP script)...
357                    else if (closeSession(true))
358                            loadSessionFile(sPath);
359                    // Make it look responsive...:)
360                    QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
361            }
362    }
363    
364    
365    // Custome event handler.
366    void qsamplerMainForm::customEvent ( QCustomEvent *pCustomEvent )
367    {
368        // For the time being, just pump it to messages.
369        if (pCustomEvent->type() == QSAMPLER_CUSTOM_EVENT) {
370            qsamplerCustomEvent *pEvent = (qsamplerCustomEvent *) pCustomEvent;
371            appendMessagesColor(tr("Notify event: %1 data: %2")
372                .arg(::lscp_event_to_text(pEvent->event()))
373                .arg(pEvent->data()), "#996699");
374      }      }
375  }  }
376    
# Line 325  bool qsamplerMainForm::newSession (void) Line 423  bool qsamplerMainForm::newSession (void)
423      if (!closeSession(true))      if (!closeSession(true))
424          return false;          return false;
425    
426            // Give us what the server has, right now...
427            updateSession();
428    
429      // Ok increment untitled count.      // Ok increment untitled count.
430      m_iUntitled++;      m_iUntitled++;
431    
# Line 438  bool qsamplerMainForm::closeSession ( bo Line 539  bool qsamplerMainForm::closeSession ( bo
539          m_pWorkspace->setUpdatesEnabled(false);          m_pWorkspace->setUpdatesEnabled(false);
540          QWidgetList wlist = m_pWorkspace->windowList();          QWidgetList wlist = m_pWorkspace->windowList();
541          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
542              qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);              qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
543              if (bForce && ::lscp_remove_channel(m_pClient, pChannel->channelID()) != LSCP_OK)              if (pChannelStrip) {
544                  appendMessagesClient("lscp_remove_channel");                  qsamplerChannel *pChannel = pChannelStrip->channel();
545              delete pChannel;                  if (bForce && pChannel)
546                        pChannel->removeChannel();
547                    delete pChannelStrip;
548                }
549          }          }
550          m_pWorkspace->setUpdatesEnabled(true);          m_pWorkspace->setUpdatesEnabled(true);
551          // We're now clean, for sure.          // We're now clean, for sure.
# Line 480  bool qsamplerMainForm::loadSessionFile ( Line 584  bool qsamplerMainForm::loadSessionFile (
584              if (::lscp_client_query(m_pClient, sCommand.latin1()) != LSCP_OK) {              if (::lscp_client_query(m_pClient, sCommand.latin1()) != LSCP_OK) {
585                  appendMessagesClient("lscp_client_query");                  appendMessagesClient("lscp_client_query");
586                  iErrors++;                  iErrors++;
587                    break;
588              }              }
589          }          }
590          // Try to make it snappy :)          // Try to make it snappy :)
# Line 491  bool qsamplerMainForm::loadSessionFile ( Line 596  bool qsamplerMainForm::loadSessionFile (
596    
597      // Have we any errors?      // Have we any errors?
598      if (iErrors > 0)      if (iErrors > 0)
599          appendMessagesError(tr("Some setttings could not be loaded\nfrom \"%1\" session file.\n\nSorry.").arg(sFilename));          appendMessagesError(tr("Session could not be loaded\nfrom \"%1\".\n\nSorry.").arg(sFilename));
600    
601      // Now we'll try to create the whole GUI session.          // Now we'll try to create (update) the whole GUI session.
602      int iChannels = ::lscp_get_channels(m_pClient);          updateSession();
     if (iChannels < 0) {  
         appendMessagesClient("lscp_get_channels");  
         appendMessagesError(tr("Could not get current number of channels.\n\nSorry."));  
     }  
       
     // Try to (re)create each channel.  
     m_pWorkspace->setUpdatesEnabled(false);  
     for (int iChannelID = 0; iChannelID < iChannels; iChannelID++) {  
         createChannel(iChannelID, false);  
         QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);  
     }  
     m_pWorkspace->setUpdatesEnabled(true);  
603    
604      // Save as default session directory.      // Save as default session directory.
605      if (m_pOptions)      if (m_pOptions)
# Line 517  bool qsamplerMainForm::loadSessionFile ( Line 610  bool qsamplerMainForm::loadSessionFile (
610      m_sFilename = sFilename;      m_sFilename = sFilename;
611      updateRecentFiles(sFilename);      updateRecentFiles(sFilename);
612      appendMessages(tr("Open session: \"%1\".").arg(sessionName(m_sFilename)));      appendMessages(tr("Open session: \"%1\".").arg(sessionName(m_sFilename)));
613        
614        // Make that an overall update.
615        m_iChangeCount++;
616      stabilizeForm();      stabilizeForm();
617      return true;      return true;
618  }  }
# Line 550  bool qsamplerMainForm::saveSessionFile ( Line 646  bool qsamplerMainForm::saveSessionFile (
646      ts << endl;      ts << endl;
647      QWidgetList wlist = m_pWorkspace->windowList();      QWidgetList wlist = m_pWorkspace->windowList();
648      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
649          qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);          qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
650          int iChannelID = pChannel->channelID();          if (pChannelStrip) {
651          ts << "# " << pChannel->caption() << endl;              qsamplerChannel *pChannel = pChannelStrip->channel();
652          ts << "ADD CHANNEL" << endl;              if (pChannel) {
653          ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannelID << " " << pChannel->audioDriver() << endl;                  int iChannelID = pChannel->channelID();
654          ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannelID << " " << pChannel->midiDriver() << endl;                  ts << "# " << pChannelStrip->caption() << endl;
655      //  ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID << " " << pChannel->midiPort() << endl;                  ts << "ADD CHANNEL" << endl;
656          ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannelID << " " << pChannel->midiChannel() << endl;                  ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannelID << " " << pChannel->audioDriver() << endl;
657          ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannelID << endl;                  ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannelID << " " << pChannel->midiDriver() << endl;
658          ts << "LOAD INSTRUMENT " << pChannel->instrumentFile() << " " << pChannel->instrumentNr() << " " << iChannelID << endl;                  ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID << " " << pChannel->midiPort() << endl;
659          ts << "SET CHANNEL VOLUME " << iChannelID << " " << pChannel->volume() << endl;                  ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannelID << " ";
660          ts << endl;                  if (pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL)
661                        ts << "ALL";
662                    else
663                        ts << pChannel->midiChannel();
664                    ts << endl;
665                    ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannelID << endl;
666                    ts << "LOAD INSTRUMENT NON_MODAL '" << pChannel->instrumentFile() << "' " << pChannel->instrumentNr() << " " << iChannelID << endl;
667                    ts << "SET CHANNEL VOLUME " << iChannelID << " " << pChannel->volume() << endl;
668                    ts << endl;
669                }
670            }
671          // Try to keep it snappy :)          // Try to keep it snappy :)
672          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
673      }      }
# Line 633  void qsamplerMainForm::fileSaveAs (void) Line 739  void qsamplerMainForm::fileSaveAs (void)
739  }  }
740    
741    
742    // Reset the sampler instance.
743    void qsamplerMainForm::fileReset (void)
744    {
745        if (m_pClient == NULL)
746            return;
747    
748        // Ask user whether he/she want's an internal sampler reset...
749        if (QMessageBox::warning(this, tr("Warning"),
750            tr("Resetting the sampler instance will close\n"
751               "all device and channel configurations.\n\n"
752               "Please note that this operation may cause\n"
753               "temporary MIDI and Audio disruption\n\n"
754               "Do you want to reset the sampler engine now?"),
755            tr("Reset"), tr("Cancel")) > 0)
756            return;
757    
758        // Just do the reset, after closing down current session...
759        if (closeSession(true) && ::lscp_reset_sampler(m_pClient) != LSCP_OK) {
760            appendMessagesClient("lscp_reset_sampler");
761            appendMessagesError(tr("Could not reset sampler instance.\n\nSorry."));
762            return;
763        }
764    
765        // Log this.
766        appendMessages(tr("Sampler reset."));
767    
768            // Make it a new session...
769            newSession();
770    }
771    
772    
773  // Restart the client/server instance.  // Restart the client/server instance.
774  void qsamplerMainForm::fileRestart (void)  void qsamplerMainForm::fileRestart (void)
775  {  {
# Line 680  void qsamplerMainForm::editAddChannel (v Line 817  void qsamplerMainForm::editAddChannel (v
817      if (m_pClient == NULL)      if (m_pClient == NULL)
818          return;          return;
819    
820      // Create the new sampler channel.      // Just create the channel instance...
821      int iChannelID = ::lscp_add_channel(m_pClient);      qsamplerChannel *pChannel = new qsamplerChannel(this);
822      if (iChannelID < 0) {      if (pChannel == NULL)
         appendMessagesClient("lscp_add_channel");  
         appendMessagesError(tr("Could not create the new channel.\n\nSorry."));  
823          return;          return;
     }  
824    
825      // Log this happening.      // Before we show it up, may be we'll
826      appendMessages(tr("Channel %1 created.").arg(iChannelID));      // better ask for some initial values?
827        if (!pChannel->channelSetup(this)) {
828      // Just create the channel strip with given id.          delete pChannel;
829      createChannel(iChannelID, true);          return;
830        }
831        
832        // And give it to the strip (will own the channel instance, if successful).
833        if (!createChannelStrip(pChannel)) {
834            delete pChannel;
835            return;
836        }
837    
838      // We'll be dirty, for sure...      // Make that an overall update.
839      m_iDirtyCount++;      m_iDirtyCount++;
840      // Stabilize form anyway.      m_iChangeCount++;
841      stabilizeForm();      stabilizeForm();
842  }  }
843    
# Line 707  void qsamplerMainForm::editRemoveChannel Line 848  void qsamplerMainForm::editRemoveChannel
848      if (m_pClient == NULL)      if (m_pClient == NULL)
849          return;          return;
850    
851      qsamplerChannelStrip *pChannel = activeChannel();      qsamplerChannelStrip *pChannelStrip = activeChannelStrip();
852        if (pChannelStrip == NULL)
853            return;
854            
855        qsamplerChannel *pChannel = pChannelStrip->channel();
856      if (pChannel == NULL)      if (pChannel == NULL)
857          return;          return;
858    
# Line 717  void qsamplerMainForm::editRemoveChannel Line 862  void qsamplerMainForm::editRemoveChannel
862              tr("About to remove channel:\n\n"              tr("About to remove channel:\n\n"
863                 "%1\n\n"                 "%1\n\n"
864                 "Are you sure?")                 "Are you sure?")
865                 .arg(pChannel->caption()),                 .arg(pChannelStrip->caption()),
866              tr("OK"), tr("Cancel")) > 0)              tr("OK"), tr("Cancel")) > 0)
867              return;              return;
868      }      }
869    
870      // Remove the existing sampler channel.      // Remove the existing sampler channel.
871      if (::lscp_remove_channel(m_pClient, pChannel->channelID()) != LSCP_OK) {      if (!pChannel->removeChannel())
         appendMessagesClient("lscp_remove_channel");  
         appendMessagesError(tr("Could not remove channel.\n\nSorry."));  
872          return;          return;
     }  
873    
     // Log this happening.  
     appendMessages(tr("Channel %1 removed.").arg(pChannel->channelID()));  
       
874      // Just delete the channel strip.      // Just delete the channel strip.
875      delete pChannel;      delete pChannelStrip;
876        
877      // Do we auto-arrange?      // Do we auto-arrange?
878      if (m_pOptions && m_pOptions->bAutoArrange)      if (m_pOptions && m_pOptions->bAutoArrange)
879          channelsArrange();          channelsArrange();
# Line 750  void qsamplerMainForm::editSetupChannel Line 890  void qsamplerMainForm::editSetupChannel
890      if (m_pClient == NULL)      if (m_pClient == NULL)
891          return;          return;
892    
893      qsamplerChannelStrip *pChannel = activeChannel();      qsamplerChannelStrip *pChannelStrip = activeChannelStrip();
894      if (pChannel == NULL)      if (pChannelStrip == NULL)
895          return;          return;
896    
897      // Just invoque the channel strip procedure.      // Just invoque the channel strip procedure.
898      pChannel->channelSetup();      pChannelStrip->channelSetup();
899  }  }
900    
901    
# Line 765  void qsamplerMainForm::editResetChannel Line 905  void qsamplerMainForm::editResetChannel
905      if (m_pClient == NULL)      if (m_pClient == NULL)
906          return;          return;
907    
908      qsamplerChannelStrip *pChannel = activeChannel();      qsamplerChannelStrip *pChannelStrip = activeChannelStrip();
909      if (pChannel == NULL)      if (pChannelStrip == NULL)
910          return;          return;
911    
912      // Remove the existing sampler channel.      qsamplerChannel *pChannel = pChannelStrip->channel();
913      if (::lscp_reset_channel(m_pClient, pChannel->channelID()) != LSCP_OK) {      if (pChannel == NULL)
         appendMessagesClient("lscp_reset_channel");  
         appendMessagesError(tr("Could not reset channel.\n\nSorry."));  
914          return;          return;
     }  
915    
916      // Log this.      // Reset the existing sampler channel.
917      appendMessages(tr("Channel %1 reset.").arg(pChannel->channelID()));      pChannel->resetChannel();
918    
919      // Refresh channel strip info.      // And force a deferred update.
920      pChannel->updateChannelInfo();      m_iChangeCount++;
921  }  }
922    
923    
# Line 841  void qsamplerMainForm::viewOptions (void Line 978  void qsamplerMainForm::viewOptions (void
978      qsamplerOptionsForm *pOptionsForm = new qsamplerOptionsForm(this);      qsamplerOptionsForm *pOptionsForm = new qsamplerOptionsForm(this);
979      if (pOptionsForm) {      if (pOptionsForm) {
980          // Check out some initial nullities(tm)...          // Check out some initial nullities(tm)...
981          qsamplerChannelStrip *pChannel = activeChannel();          qsamplerChannelStrip *pChannelStrip = activeChannelStrip();
982          if (m_pOptions->sDisplayFont.isEmpty() && pChannel)          if (m_pOptions->sDisplayFont.isEmpty() && pChannelStrip)
983              m_pOptions->sDisplayFont = pChannel->displayFont().toString();              m_pOptions->sDisplayFont = pChannelStrip->displayFont().toString();
984          if (m_pOptions->sMessagesFont.isEmpty() && m_pMessages)          if (m_pOptions->sMessagesFont.isEmpty() && m_pMessages)
985              m_pOptions->sMessagesFont = m_pMessages->messagesFont().toString();              m_pOptions->sMessagesFont = m_pMessages->messagesFont().toString();
986          // To track down deferred or immediate changes.          // To track down deferred or immediate changes.
# Line 853  void qsamplerMainForm::viewOptions (void Line 990  void qsamplerMainForm::viewOptions (void
990          bool    bOldServerStart     = m_pOptions->bServerStart;          bool    bOldServerStart     = m_pOptions->bServerStart;
991          QString sOldServerCmdLine   = m_pOptions->sServerCmdLine;          QString sOldServerCmdLine   = m_pOptions->sServerCmdLine;
992          QString sOldDisplayFont     = m_pOptions->sDisplayFont;          QString sOldDisplayFont     = m_pOptions->sDisplayFont;
993            bool    bOldDisplayEffect   = m_pOptions->bDisplayEffect;
994          int     iOldMaxVolume       = m_pOptions->iMaxVolume;          int     iOldMaxVolume       = m_pOptions->iMaxVolume;
995          QString sOldMessagesFont    = m_pOptions->sMessagesFont;          QString sOldMessagesFont    = m_pOptions->sMessagesFont;
996          bool    bOldStdoutCapture   = m_pOptions->bStdoutCapture;          bool    bOldStdoutCapture   = m_pOptions->bStdoutCapture;
997          int     bOldMessagesLimit   = m_pOptions->bMessagesLimit;          int     bOldMessagesLimit   = m_pOptions->bMessagesLimit;
998          int     iOldMessagesLimitLines = m_pOptions->iMessagesLimitLines;          int     iOldMessagesLimitLines = m_pOptions->iMessagesLimitLines;
999          bool    bOldCompletePath    = m_pOptions->bCompletePath;          bool    bOldCompletePath    = m_pOptions->bCompletePath;
1000            bool    bOldInstrumentNames = m_pOptions->bInstrumentNames;
1001          int     iOldMaxRecentFiles  = m_pOptions->iMaxRecentFiles;          int     iOldMaxRecentFiles  = m_pOptions->iMaxRecentFiles;
1002          // Load the current setup settings.          // Load the current setup settings.
1003          pOptionsForm->setup(m_pOptions);          pOptionsForm->setup(m_pOptions);
# Line 877  void qsamplerMainForm::viewOptions (void Line 1016  void qsamplerMainForm::viewOptions (void
1016                  (!bOldCompletePath &&  m_pOptions->bCompletePath) ||                  (!bOldCompletePath &&  m_pOptions->bCompletePath) ||
1017                  (iOldMaxRecentFiles != m_pOptions->iMaxRecentFiles))                  (iOldMaxRecentFiles != m_pOptions->iMaxRecentFiles))
1018                  updateRecentFilesMenu();                  updateRecentFilesMenu();
1019                if (( bOldInstrumentNames && !m_pOptions->bInstrumentNames) ||
1020                    (!bOldInstrumentNames &&  m_pOptions->bInstrumentNames))
1021                    updateInstrumentNames();
1022                if (( bOldDisplayEffect && !m_pOptions->bDisplayEffect) ||
1023                    (!bOldDisplayEffect &&  m_pOptions->bDisplayEffect))
1024                    updateDisplayEffect();
1025              if (sOldDisplayFont != m_pOptions->sDisplayFont)              if (sOldDisplayFont != m_pOptions->sDisplayFont)
1026                  updateDisplayFont();                  updateDisplayFont();
1027              if (iOldMaxVolume != m_pOptions->iMaxVolume)              if (iOldMaxVolume != m_pOptions->iMaxVolume)
# Line 919  void qsamplerMainForm::channelsArrange ( Line 1064  void qsamplerMainForm::channelsArrange (
1064      m_pWorkspace->setUpdatesEnabled(false);      m_pWorkspace->setUpdatesEnabled(false);
1065      int y = 0;      int y = 0;
1066      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1067          qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);          qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1068      /*  if (pChannel->testWState(WState_Maximized | WState_Minimized)) {      /*  if (pChannelStrip->testWState(WState_Maximized | WState_Minimized)) {
1069              // Prevent flicker...              // Prevent flicker...
1070              pChannel->hide();              pChannelStrip->hide();
1071              pChannel->showNormal();              pChannelStrip->showNormal();
1072          }   */          }   */
1073          pChannel->adjustSize();          pChannelStrip->adjustSize();
1074          int iWidth  = m_pWorkspace->width();          int iWidth  = m_pWorkspace->width();
1075          if (iWidth < pChannel->width())          if (iWidth < pChannelStrip->width())
1076              iWidth = pChannel->width();              iWidth = pChannelStrip->width();
1077      //  int iHeight = pChannel->height() + pChannel->parentWidget()->baseSize().height();      //  int iHeight = pChannelStrip->height() + pChannelStrip->parentWidget()->baseSize().height();
1078          int iHeight = pChannel->parentWidget()->frameGeometry().height();          int iHeight = pChannelStrip->parentWidget()->frameGeometry().height();
1079          pChannel->parentWidget()->setGeometry(0, y, iWidth, iHeight);          pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight);
1080          y += iHeight;          y += iHeight;
1081      }      }
1082      m_pWorkspace->setUpdatesEnabled(true);      m_pWorkspace->setUpdatesEnabled(true);
# Line 979  void qsamplerMainForm::helpAbout (void) Line 1124  void qsamplerMainForm::helpAbout (void)
1124      sText += tr("Debugging option enabled.");      sText += tr("Debugging option enabled.");
1125      sText += "</font></small><br />";      sText += "</font></small><br />";
1126  #endif  #endif
1127    #ifndef CONFIG_LIBGIG
1128        sText += "<small><font color=\"red\">";
1129        sText += tr("GIG (libgig) file support disabled.");
1130        sText += "</font></small><br />";
1131    #endif
1132    #ifndef CONFIG_INSTRUMENT_NAME
1133        sText += "<small><font color=\"red\">";
1134        sText += tr("LSCP (liblscp) instrument_name support disabled.");
1135        sText += "</font></small><br />";
1136    #endif
1137      sText += "<br />\n";      sText += "<br />\n";
1138      sText += tr("Using") + ": ";      sText += tr("Using") + ": ";
1139      sText += ::lscp_client_package();      sText += ::lscp_client_package();
# Line 1012  void qsamplerMainForm::stabilizeForm (vo Line 1167  void qsamplerMainForm::stabilizeForm (vo
1167      setCaption(tr(QSAMPLER_TITLE " - [%1]").arg(sSessioName));      setCaption(tr(QSAMPLER_TITLE " - [%1]").arg(sSessioName));
1168    
1169      // Update the main menu state...      // Update the main menu state...
1170      qsamplerChannelStrip *pChannel = activeChannel();      qsamplerChannelStrip *pChannelStrip = activeChannelStrip();
1171      bool bHasClient  = (m_pOptions != NULL && m_pClient != NULL);      bool bHasClient  = (m_pOptions != NULL && m_pClient != NULL);
1172      bool bHasChannel = (bHasClient && pChannel != NULL);      bool bHasChannel = (bHasClient && pChannelStrip != NULL);
1173      fileNewAction->setEnabled(bHasClient);      fileNewAction->setEnabled(bHasClient);
1174      fileOpenAction->setEnabled(bHasClient);      fileOpenAction->setEnabled(bHasClient);
1175      fileSaveAction->setEnabled(bHasClient && m_iDirtyCount > 0);      fileSaveAction->setEnabled(bHasClient && m_iDirtyCount > 0);
1176      fileSaveAsAction->setEnabled(bHasClient);      fileSaveAsAction->setEnabled(bHasClient);
1177        fileResetAction->setEnabled(bHasClient);
1178      fileRestartAction->setEnabled(bHasClient || m_pServer == NULL);      fileRestartAction->setEnabled(bHasClient || m_pServer == NULL);
1179      editAddChannelAction->setEnabled(bHasClient);      editAddChannelAction->setEnabled(bHasClient);
1180      editRemoveChannelAction->setEnabled(bHasChannel);      editRemoveChannelAction->setEnabled(bHasChannel);
# Line 1037  void qsamplerMainForm::stabilizeForm (vo Line 1193  void qsamplerMainForm::stabilizeForm (vo
1193      }      }
1194      // Channel status...      // Channel status...
1195      if (bHasChannel)      if (bHasChannel)
1196          m_status[QSAMPLER_STATUS_CHANNEL]->setText(pChannel->caption());          m_status[QSAMPLER_STATUS_CHANNEL]->setText(pChannelStrip->caption());
1197      else      else
1198          m_status[QSAMPLER_STATUS_CHANNEL]->clear();          m_status[QSAMPLER_STATUS_CHANNEL]->clear();
1199      // Session status...      // Session status...
# Line 1056  void qsamplerMainForm::stabilizeForm (vo Line 1212  void qsamplerMainForm::stabilizeForm (vo
1212    
1213    
1214  // Channel change receiver slot.  // Channel change receiver slot.
1215  void qsamplerMainForm::channelChanged( qsamplerChannelStrip * )  void qsamplerMainForm::channelStripChanged( qsamplerChannelStrip * )
1216  {  {
1217        // Flag that we're update those channel strips.
1218        m_iChangeCount++;
1219      // Just mark the dirty form.      // Just mark the dirty form.
1220      m_iDirtyCount++;      m_iDirtyCount++;
1221      // and update the form status...      // and update the form status...
# Line 1065  void qsamplerMainForm::channelChanged( q Line 1223  void qsamplerMainForm::channelChanged( q
1223  }  }
1224    
1225    
1226    // Grab and restore current sampler channels session.
1227    void qsamplerMainForm::updateSession (void)
1228    {
1229            // Retrieve the current channel list.
1230            int *piChannelIDs = ::lscp_list_channels(m_pClient);
1231            if (piChannelIDs == NULL) {
1232                    if (::lscp_client_get_errno(m_pClient)) {
1233                            appendMessagesClient("lscp_list_channels");
1234                            appendMessagesError(tr("Could not get current list of channels.\n\nSorry."));
1235                    }
1236                    return;
1237            }
1238    
1239            // Try to (re)create each channel.
1240            m_pWorkspace->setUpdatesEnabled(false);
1241            for (int iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) {
1242                    // Check if theres already a channel strip for this one...
1243                    if (!channelStrip(piChannelIDs[iChannel]))
1244                            createChannelStrip(new qsamplerChannel(this, piChannelIDs[iChannel]));
1245                    // Make it visibly responsive...
1246                    QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
1247            }
1248            m_pWorkspace->setUpdatesEnabled(true);
1249    }
1250    
1251    
1252  // Update the recent files list and menu.  // Update the recent files list and menu.
1253  void qsamplerMainForm::updateRecentFiles ( const QString& sFilename )  void qsamplerMainForm::updateRecentFiles ( const QString& sFilename )
1254  {  {
# Line 1109  void qsamplerMainForm::updateRecentFiles Line 1293  void qsamplerMainForm::updateRecentFiles
1293  }  }
1294    
1295    
1296    // Force update of the channels instrument names mode.
1297    void qsamplerMainForm::updateInstrumentNames (void)
1298    {
1299        // Full channel list update...
1300        QWidgetList wlist = m_pWorkspace->windowList();
1301        if (wlist.isEmpty())
1302            return;
1303    
1304        m_pWorkspace->setUpdatesEnabled(false);
1305        for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1306            qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1307            if (pChannelStrip)
1308                pChannelStrip->updateInstrumentName(true);
1309        }
1310        m_pWorkspace->setUpdatesEnabled(true);
1311    }
1312    
1313    
1314  // Force update of the channels display font.  // Force update of the channels display font.
1315  void qsamplerMainForm::updateDisplayFont (void)  void qsamplerMainForm::updateDisplayFont (void)
1316  {  {
# Line 1130  void qsamplerMainForm::updateDisplayFont Line 1332  void qsamplerMainForm::updateDisplayFont
1332    
1333      m_pWorkspace->setUpdatesEnabled(false);      m_pWorkspace->setUpdatesEnabled(false);
1334      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1335          qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);          qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1336          pChannel->setDisplayFont(font);          if (pChannelStrip)
1337                pChannelStrip->setDisplayFont(font);
1338        }
1339        m_pWorkspace->setUpdatesEnabled(true);
1340    }
1341    
1342    
1343    // Update channel strips background effect.
1344    void qsamplerMainForm::updateDisplayEffect (void)
1345    {
1346       QPixmap pm;
1347        if (m_pOptions->bDisplayEffect)
1348            pm = QPixmap::fromMimeSource("displaybg1.png");
1349    
1350        // Full channel list update...
1351        QWidgetList wlist = m_pWorkspace->windowList();
1352        if (wlist.isEmpty())
1353            return;
1354    
1355        m_pWorkspace->setUpdatesEnabled(false);
1356        for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1357            qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1358            if (pChannelStrip)
1359                pChannelStrip->setDisplayBackground(pm);
1360      }      }
1361      m_pWorkspace->setUpdatesEnabled(true);      m_pWorkspace->setUpdatesEnabled(true);
1362  }  }
# Line 1150  void qsamplerMainForm::updateMaxVolume ( Line 1375  void qsamplerMainForm::updateMaxVolume (
1375    
1376      m_pWorkspace->setUpdatesEnabled(false);      m_pWorkspace->setUpdatesEnabled(false);
1377      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1378          qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);          qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1379          pChannel->setMaxVolume(m_pOptions->iMaxVolume);          if (pChannelStrip)
1380                pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume);
1381      }      }
1382      m_pWorkspace->setUpdatesEnabled(true);      m_pWorkspace->setUpdatesEnabled(true);
1383  }  }
# Line 1250  void qsamplerMainForm::updateMessagesCap Line 1476  void qsamplerMainForm::updateMessagesCap
1476  // qsamplerMainForm -- MDI channel strip management.  // qsamplerMainForm -- MDI channel strip management.
1477    
1478  // The channel strip creation executive.  // The channel strip creation executive.
1479  void qsamplerMainForm::createChannel ( int iChannelID, bool bPrompt )  qsamplerChannelStrip *qsamplerMainForm::createChannelStrip ( qsamplerChannel *pChannel )
1480  {  {
1481      if (m_pClient == NULL)      if (m_pClient == NULL || pChannel == NULL)
1482          return;          return NULL;
1483    
1484      // Prepare for auto-arrange?      // Prepare for auto-arrange?
1485      qsamplerChannelStrip *pChannel = NULL;      qsamplerChannelStrip *pChannelStrip = NULL;
1486      int y = 0;      int y = 0;
1487      if (m_pOptions && m_pOptions->bAutoArrange) {      if (m_pOptions && m_pOptions->bAutoArrange) {
1488          QWidgetList wlist = m_pWorkspace->windowList();          QWidgetList wlist = m_pWorkspace->windowList();
1489          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1490              pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);              pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1491          //  y += pChannel->height() + pChannel->parentWidget()->baseSize().height();                          if (pChannelStrip) {
1492              y += pChannel->parentWidget()->frameGeometry().height();                          //  y += pChannelStrip->height() + pChannelStrip->parentWidget()->baseSize().height();
1493                                    y += pChannelStrip->parentWidget()->frameGeometry().height();
1494                            }
1495          }          }
1496      }      }
1497    
1498      // Add a new channel itema...      // Add a new channel itema...
1499      WFlags wflags = Qt::WStyle_Customize | Qt::WStyle_Tool | Qt::WStyle_Title | Qt::WStyle_NoBorder;      WFlags wflags = Qt::WStyle_Customize | Qt::WStyle_Tool | Qt::WStyle_Title | Qt::WStyle_NoBorder;
1500      pChannel = new qsamplerChannelStrip(m_pWorkspace, 0, wflags);      pChannelStrip = new qsamplerChannelStrip(m_pWorkspace, 0, wflags);
1501      pChannel->setMaxVolume(m_pOptions->iMaxVolume);      if (pChannelStrip == NULL)
1502      pChannel->setup(this, iChannelID);          return NULL;
1503      // We'll need a display font.          
1504      QFont font;      // Actual channel strip setup...
1505      if (m_pOptions && font.fromString(m_pOptions->sDisplayFont))      pChannelStrip->setup(pChannel);
1506          pChannel->setDisplayFont(font);      QObject::connect(pChannelStrip, SIGNAL(channelChanged(qsamplerChannelStrip *)), this, SLOT(channelStripChanged(qsamplerChannelStrip *)));
1507      // Track channel setup changes.      // Set some initial aesthetic options...
1508      QObject::connect(pChannel, SIGNAL(channelChanged(qsamplerChannelStrip *)), this, SLOT(channelChanged(qsamplerChannelStrip *)));      if (m_pOptions) {
1509      // Before we show it up, may be we'll          // Background display effect...
1510      // better ask for some initial values?          pChannelStrip->setDisplayEffect(m_pOptions->bDisplayEffect);
1511      if (bPrompt)          // We'll need a display font.
1512          pChannel->channelSetup();                QFont font;
1513            if (font.fromString(m_pOptions->sDisplayFont))
1514                pChannelStrip->setDisplayFont(font);
1515            // Maximum allowed volume setting.
1516            pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume);
1517        }
1518    
1519      // Now we show up us to the world.      // Now we show up us to the world.
1520      pChannel->show();      pChannelStrip->show();
1521      // Only then, we'll auto-arrange...      // Only then, we'll auto-arrange...
1522      if (m_pOptions && m_pOptions->bAutoArrange) {      if (m_pOptions && m_pOptions->bAutoArrange) {
1523          int iWidth  = m_pWorkspace->width();          int iWidth  = m_pWorkspace->width();
1524      //  int iHeight = pChannel->height() + pChannel->parentWidget()->baseSize().height();      //  int iHeight = pChannel->height() + pChannel->parentWidget()->baseSize().height();
1525          int iHeight = pChannel->parentWidget()->frameGeometry().height();          int iHeight = pChannelStrip->parentWidget()->frameGeometry().height();
1526          pChannel->parentWidget()->setGeometry(0, y, iWidth, iHeight);          pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight);
1527      }      }
1528        
1529        // Return our successful reference...
1530        return pChannelStrip;
1531  }  }
1532    
1533    
1534  // Retrieve the active channel strip.  // Retrieve the active channel strip.
1535  qsamplerChannelStrip *qsamplerMainForm::activeChannel (void)  qsamplerChannelStrip *qsamplerMainForm::activeChannelStrip (void)
1536  {  {
1537      return (qsamplerChannelStrip *) m_pWorkspace->activeWindow();      return (qsamplerChannelStrip *) m_pWorkspace->activeWindow();
1538  }  }
1539    
1540    
1541  // Retrieve a channel strip by index.  // Retrieve a channel strip by index.
1542  qsamplerChannelStrip *qsamplerMainForm::channelAt ( int iChannel )  qsamplerChannelStrip *qsamplerMainForm::channelStripAt ( int iChannel )
1543  {  {
1544      QWidgetList wlist = m_pWorkspace->windowList();      QWidgetList wlist = m_pWorkspace->windowList();
1545      if (wlist.isEmpty())      if (wlist.isEmpty())
1546          return 0;          return NULL;
1547    
1548      return (qsamplerChannelStrip *) wlist.at(iChannel);      return (qsamplerChannelStrip *) wlist.at(iChannel);
1549  }  }
1550    
1551    
1552    // Retrieve a channel strip by sampler channel id.
1553    qsamplerChannelStrip *qsamplerMainForm::channelStrip ( int iChannelID )
1554    {
1555            QWidgetList wlist = m_pWorkspace->windowList();
1556            if (wlist.isEmpty())
1557                    return NULL;
1558            
1559            for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1560                    qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1561                    if (pChannelStrip) {
1562                            qsamplerChannel *pChannel = pChannelStrip->channel();
1563                            if (pChannel && pChannel->channelID() == iChannelID)
1564                                    return pChannelStrip;
1565                    }
1566            }
1567    
1568            // Not found.
1569            return NULL;
1570    }
1571    
1572    
1573  // Construct the windows menu.  // Construct the windows menu.
1574  void qsamplerMainForm::channelsMenuAboutToShow (void)  void qsamplerMainForm::channelsMenuAboutToShow (void)
1575  {  {
# Line 1323  void qsamplerMainForm::channelsMenuAbout Line 1581  void qsamplerMainForm::channelsMenuAbout
1581      if (!wlist.isEmpty()) {      if (!wlist.isEmpty()) {
1582          channelsMenu->insertSeparator();          channelsMenu->insertSeparator();
1583          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1584              qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);              qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1585              int iItemID = channelsMenu->insertItem(pChannel->caption(), this, SLOT(channelsMenuActivated(int)));              if (pChannelStrip) {
1586              channelsMenu->setItemParameter(iItemID, iChannel);                  int iItemID = channelsMenu->insertItem(pChannelStrip->caption(), this, SLOT(channelsMenuActivated(int)));
1587              channelsMenu->setItemChecked(iItemID, activeChannel() == pChannel);                  channelsMenu->setItemParameter(iItemID, iChannel);
1588                    channelsMenu->setItemChecked(iItemID, activeChannelStrip() == pChannelStrip);
1589                }
1590          }          }
1591      }      }
1592  }  }
# Line 1335  void qsamplerMainForm::channelsMenuAbout Line 1595  void qsamplerMainForm::channelsMenuAbout
1595  // Windows menu activation slot  // Windows menu activation slot
1596  void qsamplerMainForm::channelsMenuActivated ( int iChannel )  void qsamplerMainForm::channelsMenuActivated ( int iChannel )
1597  {  {
1598      qsamplerChannelStrip *pChannel = channelAt(iChannel);      qsamplerChannelStrip *pChannelStrip = channelStripAt(iChannel);
1599      if (pChannel)      if (pChannelStrip)
1600          pChannel->showNormal();          pChannelStrip->showNormal();
1601      pChannel->setFocus();      pChannelStrip->setFocus();
1602  }  }
1603    
1604    
# Line 1378  void qsamplerMainForm::timerSlot (void) Line 1638  void qsamplerMainForm::timerSlot (void)
1638      }      }
1639            
1640          // Refresh each channel usage, on each period...          // Refresh each channel usage, on each period...
1641      if (m_pClient && m_pOptions->bAutoRefresh && m_pWorkspace->isUpdatesEnabled()) {      if (m_pClient && (m_iChangeCount > 0 || m_pOptions->bAutoRefresh)) {
1642          m_iTimerSlot += QSAMPLER_TIMER_MSECS;          m_iTimerSlot += QSAMPLER_TIMER_MSECS;
1643          if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime)  {          if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime && m_pWorkspace->isUpdatesEnabled())  {
1644              m_iTimerSlot = 0;              m_iTimerSlot = 0;
1645                m_iChangeCount = 0;
1646              QWidgetList wlist = m_pWorkspace->windowList();              QWidgetList wlist = m_pWorkspace->windowList();
1647              for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {              for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1648                  qsamplerChannelStrip *pChannel = (qsamplerChannelStrip *) wlist.at(iChannel);                  qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1649                  if (pChannel->isVisible())                  if (pChannelStrip && pChannelStrip->isVisible()) {
1650                      pChannel->updateChannelUsage();                      // If we can't make it clean, try next time.
1651                        if (!pChannelStrip->updateChannelUsage())
1652                            m_iChangeCount++;
1653                    }
1654              }              }
1655          }          }
1656      }      }
# Line 1523  void qsamplerMainForm::processServerExit Line 1787  void qsamplerMainForm::processServerExit
1787  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
1788  // qsamplerMainForm -- Client stuff.  // qsamplerMainForm -- Client stuff.
1789    
   
1790  // The LSCP client callback procedure.  // The LSCP client callback procedure.
1791  lscp_status_t qsampler_client_callback ( lscp_client_t *pClient, const char *pchBuffer, int cchBuffer, void *pvData )  lscp_status_t qsampler_client_callback ( lscp_client_t */*pClient*/, lscp_event_t event, const char *pchData, int cchData, void *pvData )
1792  {  {
1793      qsamplerMainForm *pMainForm = (qsamplerMainForm *) pvData;      qsamplerMainForm *pMainForm = (qsamplerMainForm *) pvData;
1794      if (pMainForm == NULL)      if (pMainForm == NULL)
1795          return LSCP_FAILED;          return LSCP_FAILED;
1796    
1797      char *pszBuffer = (char *) malloc(cchBuffer + 1);      // ATTN: DO NOT EVER call any GUI code here,
1798      if (pszBuffer == NULL)      // as this is run under some other thread context.
1799          return LSCP_FAILED;      // A custom event must be posted here...
1800        QApplication::postEvent(pMainForm, new qsamplerCustomEvent(event, pchData, cchData));
     memcpy(pszBuffer, pchBuffer, cchBuffer);  
     pszBuffer[cchBuffer] = (char) 0;  
     pMainForm->appendMessagesColor(pszBuffer, "#996699");  
     free(pszBuffer);  
1801    
1802      return LSCP_OK;      return LSCP_OK;
1803  }  }

Legend:
Removed from v.127  
changed lines
  Added in v.395

  ViewVC Help
Powered by ViewVC