/[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 122 by capela, Sat Jun 12 13:21:35 2004 UTC revision 149 by capela, Sat Jun 26 14:27:25 2004 UTC
# Line 54  Line 54 
54  #define QSAMPLER_STATUS_SESSION 3       // Current session modification state.  #define QSAMPLER_STATUS_SESSION 3       // Current session modification state.
55    
56    
57    // All winsock apps needs this.
58  #if defined(WIN32)  #if defined(WIN32)
59  static WSADATA _wsaData;  static WSADATA _wsaData;
60  #endif  #endif
61    
62    
63    //-------------------------------------------------------------------------
64    // qsamplerCustomEvent -- specialty for callback comunication.
65    
66    #define QSAMPLER_CUSTOM_EVENT   1000
67    
68    class qsamplerCustomEvent : public QCustomEvent
69    {
70    public:
71    
72        // Constructor.
73        qsamplerCustomEvent(lscp_event_t event, const char *pchData, int cchData)
74            : QCustomEvent(QSAMPLER_CUSTOM_EVENT)
75        {
76            m_event = event;
77            m_data.setLatin1(pchData, cchData);
78        }
79    
80        // Accessors.
81        lscp_event_t event() { return m_event; }
82        QString&     data()  { return m_data;  }
83    
84    private:
85    
86        // The proper event type.
87        lscp_event_t m_event;
88        // The event data as a string.
89        QString      m_data;
90    };
91    
92    
93  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
94  // qsamplerMainForm -- Main window form implementation.  // qsamplerMainForm -- Main window form implementation.
95    
# Line 252  void qsamplerMainForm::closeEvent ( QClo Line 284  void qsamplerMainForm::closeEvent ( QClo
284  }  }
285    
286    
287    // Window drag-n-drop event handlers.
288  void qsamplerMainForm::dragEnterEvent ( QDragEnterEvent* pDragEnterEvent )  void qsamplerMainForm::dragEnterEvent ( QDragEnterEvent* pDragEnterEvent )
289  {  {
290      bool bAccept = false;      bool bAccept = false;
# Line 276  void qsamplerMainForm::dropEvent ( QDrop Line 309  void qsamplerMainForm::dropEvent ( QDrop
309  }  }
310    
311    
312    // Custome event handler.
313    void qsamplerMainForm::customEvent ( QCustomEvent *pCustomEvent )
314    {
315        // For the time being, just pump it to messages.
316        if (pCustomEvent->type() == QSAMPLER_CUSTOM_EVENT) {
317            qsamplerCustomEvent *pEvent = (qsamplerCustomEvent *) pCustomEvent;
318            appendMessagesColor(tr("Notify event: %1 data: %2")
319                .arg(::lscp_event_to_text(pEvent->event()))
320                .arg(pEvent->data()), "#996699");
321        }
322    }
323    
324    
325    // Context menu event handler.
326    void qsamplerMainForm::contextMenuEvent( QContextMenuEvent *pEvent )
327    {
328        stabilizeForm();
329        
330        editMenu->exec(pEvent->globalPos());
331    }
332    
333    
334  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
335  // qsamplerMainForm -- Brainless public property accessors.  // qsamplerMainForm -- Brainless public property accessors.
336    
# Line 549  bool qsamplerMainForm::saveSessionFile ( Line 604  bool qsamplerMainForm::saveSessionFile (
604      //  ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID << " " << pChannel->midiPort() << endl;      //  ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID << " " << pChannel->midiPort() << endl;
605          ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannelID << " " << pChannel->midiChannel() << endl;          ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannelID << " " << pChannel->midiChannel() << endl;
606          ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannelID << endl;          ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannelID << endl;
607          ts << "LOAD INSTRUMENT " << pChannel->instrumentFile() << " " << pChannel->instrumentNr() << " " << iChannelID << endl;          ts << "LOAD INSTRUMENT NON_MODAL " << pChannel->instrumentFile() << " " << pChannel->instrumentNr() << " " << iChannelID << endl;
608          ts << "SET CHANNEL VOLUME " << iChannelID << " " << pChannel->volume() << endl;          ts << "SET CHANNEL VOLUME " << iChannelID << " " << pChannel->volume() << endl;
609          ts << endl;          ts << endl;
610          // Try to keep it snappy :)          // Try to keep it snappy :)
# Line 1513  void qsamplerMainForm::processServerExit Line 1568  void qsamplerMainForm::processServerExit
1568  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
1569  // qsamplerMainForm -- Client stuff.  // qsamplerMainForm -- Client stuff.
1570    
   
1571  // The LSCP client callback procedure.  // The LSCP client callback procedure.
1572  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 )
1573  {  {
1574      qsamplerMainForm *pMainForm = (qsamplerMainForm *) pvData;      qsamplerMainForm *pMainForm = (qsamplerMainForm *) pvData;
1575      if (pMainForm == NULL)      if (pMainForm == NULL)
1576          return LSCP_FAILED;          return LSCP_FAILED;
1577    
1578      char *pszBuffer = (char *) malloc(cchBuffer + 1);      // ATTN: DO NOT EVER call any GUI code here,
1579      if (pszBuffer == NULL)      // as this is run under some other thread context.
1580          return LSCP_FAILED;      // A custom event must be posted here...
1581        QApplication::postEvent(pMainForm, new qsamplerCustomEvent(event, pchData, cchData));
     memcpy(pszBuffer, pchBuffer, cchBuffer);  
     pszBuffer[cchBuffer] = (char) 0;  
     pMainForm->appendMessagesColor(pszBuffer, "#996699");  
     free(pszBuffer);  
1582    
1583      return LSCP_OK;      return LSCP_OK;
1584  }  }

Legend:
Removed from v.122  
changed lines
  Added in v.149

  ViewVC Help
Powered by ViewVC