/[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 145 by capela, Thu Jun 24 18:26:57 2004 UTC revision 263 by capela, Wed Sep 29 09:01:35 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 277  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.  // Context menu event handler.
326  void qsamplerMainForm::contextMenuEvent( QContextMenuEvent *pEvent )  void qsamplerMainForm::contextMenuEvent( QContextMenuEvent *pEvent )
327  {  {
# Line 556  bool qsamplerMainForm::saveSessionFile ( Line 601  bool qsamplerMainForm::saveSessionFile (
601          ts << "ADD CHANNEL" << endl;          ts << "ADD CHANNEL" << endl;
602          ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannelID << " " << pChannel->audioDriver() << endl;          ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannelID << " " << pChannel->audioDriver() << endl;
603          ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannelID << " " << pChannel->midiDriver() << endl;          ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannelID << " " << pChannel->midiDriver() << endl;
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 << " ";
606            if (pChannel->midiChannel() > 0)
607                ts << pChannel->midiChannel();
608             else
609                ts << "ALL";
610            ts << endl;
611          ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannelID << endl;          ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannelID << endl;
612          ts << "LOAD INSTRUMENT NON_MODAL " << pChannel->instrumentFile() << " " << pChannel->instrumentNr() << " " << iChannelID << endl;          ts << "LOAD INSTRUMENT NON_MODAL '" << pChannel->instrumentFile() << "' " << pChannel->instrumentNr() << " " << iChannelID << endl;
613          ts << "SET CHANNEL VOLUME " << iChannelID << " " << pChannel->volume() << endl;          ts << "SET CHANNEL VOLUME " << iChannelID << " " << pChannel->volume() << endl;
614          ts << endl;          ts << endl;
615          // Try to keep it snappy :)          // Try to keep it snappy :)
# Line 633  void qsamplerMainForm::fileSaveAs (void) Line 683  void qsamplerMainForm::fileSaveAs (void)
683  }  }
684    
685    
686    // Reset the sampler instance.
687    void qsamplerMainForm::fileReset (void)
688    {
689        if (m_pClient == NULL)
690            return;
691    
692        // Ask user whether he/she want's an internal sampler reset...
693        if (QMessageBox::warning(this, tr("Warning"),
694            tr("Resetting the sampler instance will close\n"
695               "all device and channel configurations.\n\n"
696               "Please note that this operation may cause\n"
697               "temporary MIDI and Audio disruption\n\n"
698               "Do you want to reset the sampler engine now?"),
699            tr("Reset"), tr("Cancel")) > 0)
700            return;
701    
702        // Just do the reset, after closing down current session...
703        if (closeSession(true) && ::lscp_reset_sampler(m_pClient) != LSCP_OK) {
704            appendMessagesClient("lscp_reset_sampler");
705            appendMessagesError(tr("Could not reset sampler instance.\n\nSorry."));
706            return;
707        }
708    
709        // Log this.
710        appendMessages(tr("Sampler reset."));
711    }
712    
713    
714  // Restart the client/server instance.  // Restart the client/server instance.
715  void qsamplerMainForm::fileRestart (void)  void qsamplerMainForm::fileRestart (void)
716  {  {
# Line 755  void qsamplerMainForm::editSetupChannel Line 833  void qsamplerMainForm::editSetupChannel
833          return;          return;
834    
835      // Just invoque the channel strip procedure.      // Just invoque the channel strip procedure.
836      pChannel->channelSetup();      pChannel->showChannelSetup(false);
837  }  }
838    
839    
# Line 979  void qsamplerMainForm::helpAbout (void) Line 1057  void qsamplerMainForm::helpAbout (void)
1057      sText += tr("Debugging option enabled.");      sText += tr("Debugging option enabled.");
1058      sText += "</font></small><br />";      sText += "</font></small><br />";
1059  #endif  #endif
1060    #ifndef CONFIG_LIBGIG
1061        sText += "<small><font color=\"red\">";
1062        sText += tr("GIG (libgig) file support disabled.");
1063        sText += "</font></small><br />";
1064    #endif
1065      sText += "<br />\n";      sText += "<br />\n";
1066      sText += tr("Using") + ": ";      sText += tr("Using") + ": ";
1067      sText += ::lscp_client_package();      sText += ::lscp_client_package();
# Line 1019  void qsamplerMainForm::stabilizeForm (vo Line 1102  void qsamplerMainForm::stabilizeForm (vo
1102      fileOpenAction->setEnabled(bHasClient);      fileOpenAction->setEnabled(bHasClient);
1103      fileSaveAction->setEnabled(bHasClient && m_iDirtyCount > 0);      fileSaveAction->setEnabled(bHasClient && m_iDirtyCount > 0);
1104      fileSaveAsAction->setEnabled(bHasClient);      fileSaveAsAction->setEnabled(bHasClient);
1105        fileResetAction->setEnabled(bHasClient);
1106      fileRestartAction->setEnabled(bHasClient || m_pServer == NULL);      fileRestartAction->setEnabled(bHasClient || m_pServer == NULL);
1107      editAddChannelAction->setEnabled(bHasClient);      editAddChannelAction->setEnabled(bHasClient);
1108      editRemoveChannelAction->setEnabled(bHasChannel);      editRemoveChannelAction->setEnabled(bHasChannel);
# Line 1281  void qsamplerMainForm::createChannel ( i Line 1365  void qsamplerMainForm::createChannel ( i
1365      // Before we show it up, may be we'll      // Before we show it up, may be we'll
1366      // better ask for some initial values?      // better ask for some initial values?
1367      if (bPrompt)      if (bPrompt)
1368          pChannel->channelSetup();                pChannel->showChannelSetup(true);
1369      // Now we show up us to the world.      // Now we show up us to the world.
1370      pChannel->show();      pChannel->show();
1371      // Only then, we'll auto-arrange...      // Only then, we'll auto-arrange...
# Line 1523  void qsamplerMainForm::processServerExit Line 1607  void qsamplerMainForm::processServerExit
1607  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
1608  // qsamplerMainForm -- Client stuff.  // qsamplerMainForm -- Client stuff.
1609    
   
1610  // The LSCP client callback procedure.  // The LSCP client callback procedure.
1611  lscp_status_t qsampler_client_callback ( lscp_client_t */*pClient*/, lscp_event_t /*event*/, 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 )
1612  {  {
1613      // FIXME: DO NOT EVER call any GUI code here,      qsamplerMainForm *pMainForm = (qsamplerMainForm *) pvData;
1614        if (pMainForm == NULL)
1615            return LSCP_FAILED;
1616    
1617        // ATTN: DO NOT EVER call any GUI code here,
1618      // as this is run under some other thread context.      // as this is run under some other thread context.
1619      // A custom event must be posted here...      // A custom event must be posted here...
1620      //      QApplication::postEvent(pMainForm, new qsamplerCustomEvent(event, pchData, cchData));
     // QApplication::postEvent((qjackctlMainForm *) pvData, new QCustomEvent(...));  
1621    
1622      return LSCP_OK;      return LSCP_OK;
1623  }  }

Legend:
Removed from v.145  
changed lines
  Added in v.263

  ViewVC Help
Powered by ViewVC