/[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 2038 by capela, Thu Jan 7 18:42:26 2010 UTC revision 2050 by capela, Mon Jan 18 08:52:45 2010 UTC
# Line 105  namespace QSampler { Line 105  namespace QSampler {
105  #define QSAMPLER_STATUS_SESSION 3       // Current session modification state.  #define QSAMPLER_STATUS_SESSION 3       // Current session modification state.
106    
107    
108    // Specialties for thread-callback comunication.
109    #define QSAMPLER_LSCP_EVENT   QEvent::Type(QEvent::User + 1)
110    #define QSAMPLER_SAVE_EVENT   QEvent::Type(QEvent::User + 2)
111    
112    
113  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
114  // CustomEvent -- specialty for callback comunication.  // LscpEvent -- specialty for LSCP callback comunication.
115    
 #define QSAMPLER_CUSTOM_EVENT   QEvent::Type(QEvent::User + 0)  
116    
117  class CustomEvent : public QEvent  class LscpEvent : public QEvent
118  {  {
119  public:  public:
120    
121          // Constructor.          // Constructor.
122          CustomEvent(lscp_event_t event, const char *pchData, int cchData)          LscpEvent(lscp_event_t event, const char *pchData, int cchData)
123                  : QEvent(QSAMPLER_CUSTOM_EVENT)                  : QEvent(QSAMPLER_LSCP_EVENT)
124          {          {
125                  m_event = event;                  m_event = event;
126                  m_data  = QString::fromUtf8(pchData, cchData);                  m_data  = QString::fromUtf8(pchData, cchData);
# Line 136  private: Line 140  private:
140    
141    
142  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
143    // LADISH Level 1 support stuff.
144    
145    void qsampler_on_sigusr1 ( int /*signo*/ )
146    {
147            QApplication::postEvent(
148                    MainForm::getInstance(),
149                    new QEvent(QSAMPLER_SAVE_EVENT));
150    }
151    
152    
153    //-------------------------------------------------------------------------
154  // qsamplerMainForm -- Main window form implementation.  // qsamplerMainForm -- Main window form implementation.
155    
156  // Kind of singleton reference.  // Kind of singleton reference.
# Line 172  MainForm::MainForm ( QWidget *pParent ) Line 187  MainForm::MainForm ( QWidget *pParent )
187  #ifdef HAVE_SIGNAL_H  #ifdef HAVE_SIGNAL_H
188          // Set to ignore any fatal "Broken pipe" signals.          // Set to ignore any fatal "Broken pipe" signals.
189          ::signal(SIGPIPE, SIG_IGN);          ::signal(SIGPIPE, SIG_IGN);
190            // LADISH Level 1 suport.
191            ::signal(SIGUSR1, qsampler_on_sigusr1);
192  #endif  #endif
193    
194  #ifdef CONFIG_VOLUME  #ifdef CONFIG_VOLUME
# Line 562  void MainForm::dropEvent ( QDropEvent* p Line 579  void MainForm::dropEvent ( QDropEvent* p
579    
580    
581  // Custome event handler.  // Custome event handler.
582  void MainForm::customEvent(QEvent* pCustomEvent)  void MainForm::customEvent ( QEvent* pEvent )
583  {  {
584          // For the time being, just pump it to messages.          // For the time being, just pump it to messages.
585          if (pCustomEvent->type() == QSAMPLER_CUSTOM_EVENT) {          if (pEvent->type() == QSAMPLER_LSCP_EVENT) {
586                  CustomEvent *pEvent = static_cast<CustomEvent *> (pCustomEvent);                  LscpEvent *pLscpEvent = static_cast<LscpEvent *> (pEvent);
587                  switch (pEvent->event()) {                  switch (pLscpEvent->event()) {
588                          case LSCP_EVENT_CHANNEL_COUNT:                          case LSCP_EVENT_CHANNEL_COUNT:
589                                  updateAllChannelStrips(true);                                  updateAllChannelStrips(true);
590                                  break;                                  break;
591                          case LSCP_EVENT_CHANNEL_INFO: {                          case LSCP_EVENT_CHANNEL_INFO: {
592                                  int iChannelID = pEvent->data().toInt();                                  int iChannelID = pLscpEvent->data().toInt();
593                                  ChannelStrip *pChannelStrip = channelStrip(iChannelID);                                  ChannelStrip *pChannelStrip = channelStrip(iChannelID);
594                                  if (pChannelStrip)                                  if (pChannelStrip)
595                                          channelStripChanged(pChannelStrip);                                          channelStripChanged(pChannelStrip);
# Line 585  void MainForm::customEvent(QEvent* pCust Line 602  void MainForm::customEvent(QEvent* pCust
602                                  break;                                  break;
603                          case LSCP_EVENT_MIDI_INPUT_DEVICE_INFO: {                          case LSCP_EVENT_MIDI_INPUT_DEVICE_INFO: {
604                                  if (m_pDeviceForm) m_pDeviceForm->refreshDevices();                                  if (m_pDeviceForm) m_pDeviceForm->refreshDevices();
605                                  const int iDeviceID = pEvent->data().section(' ', 0, 0).toInt();                                  const int iDeviceID = pLscpEvent->data().section(' ', 0, 0).toInt();
606                                  DeviceStatusForm::onDeviceChanged(iDeviceID);                                  DeviceStatusForm::onDeviceChanged(iDeviceID);
607                                  break;                                  break;
608                          }                          }
# Line 597  void MainForm::customEvent(QEvent* pCust Line 614  void MainForm::customEvent(QEvent* pCust
614                                  break;                                  break;
615                  #if CONFIG_EVENT_CHANNEL_MIDI                  #if CONFIG_EVENT_CHANNEL_MIDI
616                          case LSCP_EVENT_CHANNEL_MIDI: {                          case LSCP_EVENT_CHANNEL_MIDI: {
617                                  const int iChannelID = pEvent->data().section(' ', 0, 0).toInt();                                  const int iChannelID = pLscpEvent->data().section(' ', 0, 0).toInt();
618                                  ChannelStrip *pChannelStrip = channelStrip(iChannelID);                                  ChannelStrip *pChannelStrip = channelStrip(iChannelID);
619                                  if (pChannelStrip)                                  if (pChannelStrip)
620                                          pChannelStrip->midiActivityLedOn();                                          pChannelStrip->midiActivityLedOn();
# Line 606  void MainForm::customEvent(QEvent* pCust Line 623  void MainForm::customEvent(QEvent* pCust
623                  #endif                  #endif
624                  #if CONFIG_EVENT_DEVICE_MIDI                  #if CONFIG_EVENT_DEVICE_MIDI
625                          case LSCP_EVENT_DEVICE_MIDI: {                          case LSCP_EVENT_DEVICE_MIDI: {
626                                  const int iDeviceID = pEvent->data().section(' ', 0, 0).toInt();                                  const int iDeviceID = pLscpEvent->data().section(' ', 0, 0).toInt();
627                                  const int iPortID   = pEvent->data().section(' ', 1, 1).toInt();                                  const int iPortID   = pLscpEvent->data().section(' ', 1, 1).toInt();
628                                  DeviceStatusForm *pDeviceStatusForm                                  DeviceStatusForm *pDeviceStatusForm
629                                          = DeviceStatusForm::getInstance(iDeviceID);                                          = DeviceStatusForm::getInstance(iDeviceID);
630                                  if (pDeviceStatusForm)                                  if (pDeviceStatusForm)
# Line 616  void MainForm::customEvent(QEvent* pCust Line 633  void MainForm::customEvent(QEvent* pCust
633                          }                          }
634                  #endif                  #endif
635                          default:                          default:
636                                  appendMessagesColor(tr("Notify event: %1 data: %2")                                  appendMessagesColor(tr("LSCP Event: %1 data: %2")
637                                          .arg(::lscp_event_to_text(pEvent->event()))                                          .arg(::lscp_event_to_text(pLscpEvent->event()))
638                                          .arg(pEvent->data()), "#996699");                                          .arg(pLscpEvent->data()), "#996699");
639                  }                  }
640          }          }       // LADISH1 Level 1 support...
641            else if (pEvent->type() == QSAMPLER_SAVE_EVENT)
642                    saveSession(false);
643  }  }
644    
645    
# Line 2702  lscp_status_t qsampler_client_callback ( Line 2721  lscp_status_t qsampler_client_callback (
2721          // as this is run under some other thread context.          // as this is run under some other thread context.
2722          // A custom event must be posted here...          // A custom event must be posted here...
2723          QApplication::postEvent(pMainForm,          QApplication::postEvent(pMainForm,
2724                  new CustomEvent(event, pchData, cchData));                  new LscpEvent(event, pchData, cchData));
2725    
2726          return LSCP_OK;          return LSCP_OK;
2727  }  }

Legend:
Removed from v.2038  
changed lines
  Added in v.2050

  ViewVC Help
Powered by ViewVC