/[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 957 by capela, Wed Nov 29 11:48:26 2006 UTC revision 968 by capela, Tue Dec 5 12:37:06 2006 UTC
# Line 41  Line 41 
41  #include "qsamplerMessages.h"  #include "qsamplerMessages.h"
42    
43  #include "qsamplerChannelStrip.h"  #include "qsamplerChannelStrip.h"
44    #include "qsamplerInstrumentList.h"
45    
46    #include "qsamplerInstrumentListForm.h"
47  #include "qsamplerDeviceForm.h"  #include "qsamplerDeviceForm.h"
48  #include "qsamplerOptionsForm.h"  #include "qsamplerOptionsForm.h"
49    
# Line 102  private: Line 104  private:
104  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
105  // qsamplerMainForm -- Main window form implementation.  // qsamplerMainForm -- Main window form implementation.
106    
107    // Kind of singleton reference.
108    qsamplerMainForm *qsamplerMainForm::g_pMainForm = NULL;
109    
110    
111  // Kind of constructor.  // Kind of constructor.
112  void qsamplerMainForm::init (void)  void qsamplerMainForm::init (void)
113  {  {
114            // Pseudo-singleton reference setup.
115            g_pMainForm = this;
116    
117      // Initialize some pointer references.      // Initialize some pointer references.
118      m_pOptions = NULL;      m_pOptions = NULL;
119    
120      // All child forms are to be created later, not earlier than setup.      // All child forms are to be created later, not earlier than setup.
121      m_pMessages   = NULL;      m_pMessages = NULL;
122        m_pInstrumentListForm = NULL;
123      m_pDeviceForm = NULL;      m_pDeviceForm = NULL;
124    
125      // We'll start clean.      // We'll start clean.
# Line 186  void qsamplerMainForm::destroy (void) Line 196  void qsamplerMainForm::destroy (void)
196      // Finally drop any widgets around...      // Finally drop any widgets around...
197      if (m_pDeviceForm)      if (m_pDeviceForm)
198          delete m_pDeviceForm;          delete m_pDeviceForm;
199        if (m_pInstrumentListForm)
200            delete m_pInstrumentListForm;
201      if (m_pMessages)      if (m_pMessages)
202          delete m_pMessages;          delete m_pMessages;
203      if (m_pWorkspace)      if (m_pWorkspace)
# Line 204  void qsamplerMainForm::destroy (void) Line 216  void qsamplerMainForm::destroy (void)
216      // Delete recentfiles menu.      // Delete recentfiles menu.
217      if (m_pRecentFilesMenu)      if (m_pRecentFilesMenu)
218          delete m_pRecentFilesMenu;          delete m_pRecentFilesMenu;
219    
220            // Pseudo-singleton reference shut-down.
221            g_pMainForm = NULL;
222  }  }
223    
224    
# Line 214  void qsamplerMainForm::setup ( qsamplerO Line 229  void qsamplerMainForm::setup ( qsamplerO
229      m_pOptions = pOptions;      m_pOptions = pOptions;
230    
231      // What style do we create these forms?      // What style do we create these forms?
232      WFlags wflags = Qt::WType_TopLevel;          Qt::WFlags wflags = Qt::WStyle_Customize
233                    | Qt::WStyle_NormalBorder
234                    | Qt::WStyle_Title
235                    | Qt::WStyle_SysMenu
236                    | Qt::WStyle_MinMax
237                    | Qt::WType_TopLevel;
238      if (m_pOptions->bKeepOnTop)      if (m_pOptions->bKeepOnTop)
239          wflags |= Qt::WStyle_Tool;          wflags |= Qt::WStyle_Tool;
240      // Some child forms are to be created right now.      // Some child forms are to be created right now.
241      m_pMessages = new qsamplerMessages(this);      m_pMessages = new qsamplerMessages(this);
242      m_pDeviceForm = new qsamplerDeviceForm(this, 0, wflags);      m_pDeviceForm = new qsamplerDeviceForm(this, 0, wflags);
243      m_pDeviceForm->setMainForm(this); // An important life immutable!  #ifdef CONFIG_MIDI_INSTRUMENT
244        m_pInstrumentListForm = new qsamplerInstrumentListForm(this, 0, wflags);
245            QObject::connect(m_pInstrumentListForm->InstrumentList,
246                    SIGNAL(instrumentsChanged()),
247                    SLOT(sessionDirty()));
248    #else
249            viewInstrumentsAction->setEnabled(false);
250    #endif
251      // Set message defaults...      // Set message defaults...
252      updateMessagesFont();      updateMessagesFont();
253      updateMessagesLimit();      updateMessagesLimit();
254      updateMessagesCapture();      updateMessagesCapture();
255      // Set the visibility signal.      // Set the visibility signal.
256      QObject::connect(m_pMessages, SIGNAL(visibilityChanged(bool)), this, SLOT(stabilizeForm()));      QObject::connect(m_pMessages,
257                    SIGNAL(visibilityChanged(bool)),
258                    SLOT(stabilizeForm()));
259    
260      // Initial decorations toggle state.      // Initial decorations toggle state.
261      viewMenubarAction->setOn(m_pOptions->bMenubar);      viewMenubarAction->setOn(m_pOptions->bMenubar);
# Line 251  void qsamplerMainForm::setup ( qsamplerO Line 280  void qsamplerMainForm::setup ( qsamplerO
280      }      }
281      // Try to restore old window positioning and initial visibility.      // Try to restore old window positioning and initial visibility.
282      m_pOptions->loadWidgetGeometry(this);      m_pOptions->loadWidgetGeometry(this);
283        m_pOptions->loadWidgetGeometry(m_pInstrumentListForm);
284      m_pOptions->loadWidgetGeometry(m_pDeviceForm);      m_pOptions->loadWidgetGeometry(m_pDeviceForm);
285    
286      // Final startup stabilization...      // Final startup stabilization...
# Line 291  bool qsamplerMainForm::queryClose (void) Line 321  bool qsamplerMainForm::queryClose (void)
321              m_pOptions->settings().writeEntry("/Layout/DockWindows", sDockables);              m_pOptions->settings().writeEntry("/Layout/DockWindows", sDockables);
322              // And the children, and the main windows state,.              // And the children, and the main windows state,.
323                          m_pOptions->saveWidgetGeometry(m_pDeviceForm);                          m_pOptions->saveWidgetGeometry(m_pDeviceForm);
324                            m_pOptions->saveWidgetGeometry(m_pInstrumentListForm);
325                          m_pOptions->saveWidgetGeometry(this);                          m_pOptions->saveWidgetGeometry(this);
326                          // Close popup widgets.                          // Close popup widgets.
327                            if (m_pInstrumentListForm)
328                                    m_pInstrumentListForm->close();
329                          if (m_pDeviceForm)                          if (m_pDeviceForm)
330                                  m_pDeviceForm->close();                                  m_pDeviceForm->close();
331              // Stop client and/or server, gracefully.              // Stop client and/or server, gracefully.
# Line 351  void qsamplerMainForm::dropEvent ( QDrop Line 384  void qsamplerMainForm::dropEvent ( QDrop
384                  const QString& sPath = *iter;                  const QString& sPath = *iter;
385                  if (qsamplerChannel::isInstrumentFile(sPath)) {                  if (qsamplerChannel::isInstrumentFile(sPath)) {
386                          // Try to create a new channel from instrument file...                          // Try to create a new channel from instrument file...
387                          qsamplerChannel *pChannel = new qsamplerChannel(this);                          qsamplerChannel *pChannel = new qsamplerChannel();
388                          if (pChannel == NULL)                          if (pChannel == NULL)
389                                  return;                                  return;
390                          // Start setting the instrument filename...                          // Start setting the instrument filename...
# Line 417  qsamplerOptions *qsamplerMainForm::optio Line 450  qsamplerOptions *qsamplerMainForm::optio
450      return m_pOptions;      return m_pOptions;
451  }  }
452    
453    
454  // The LSCP client descriptor property.  // The LSCP client descriptor property.
455  lscp_client_t *qsamplerMainForm::client (void)  lscp_client_t *qsamplerMainForm::client (void)
456  {  {
# Line 424  lscp_client_t *qsamplerMainForm::client Line 458  lscp_client_t *qsamplerMainForm::client
458  }  }
459    
460    
461    // The pseudo-singleton instance accessor.
462    qsamplerMainForm *qsamplerMainForm::getInstance (void)
463    {
464            return g_pMainForm;
465    }
466    
467    
468  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
469  // qsamplerMainForm -- Session file stuff.  // qsamplerMainForm -- Session file stuff.
470    
# Line 678  bool qsamplerMainForm::saveSessionFile ( Line 719  bool qsamplerMainForm::saveSessionFile (
719          piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Audio);          piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Audio);
720          for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {          for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {
721                  ts << endl;                  ts << endl;
722                  qsamplerDevice device(this, qsamplerDevice::Audio, piDeviceIDs[iDevice]);                  qsamplerDevice device(qsamplerDevice::Audio, piDeviceIDs[iDevice]);
723                  // Audio device specification...                  // Audio device specification...
724                  ts << "# " << device.deviceTypeName() << " " << device.driverName()                  ts << "# " << device.deviceTypeName() << " " << device.driverName()
725                          << " " << tr("Device") << " " << iDevice << endl;                          << " " << tr("Device") << " " << iDevice << endl;
# Line 718  bool qsamplerMainForm::saveSessionFile ( Line 759  bool qsamplerMainForm::saveSessionFile (
759          piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Midi);          piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Midi);
760          for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {          for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {
761                  ts << endl;                  ts << endl;
762                  qsamplerDevice device(this, qsamplerDevice::Midi, piDeviceIDs[iDevice]);                  qsamplerDevice device(qsamplerDevice::Midi, piDeviceIDs[iDevice]);
763                  // MIDI device specification...                  // MIDI device specification...
764                  ts << "# " << device.deviceTypeName() << " " << device.driverName()                  ts << "# " << device.deviceTypeName() << " " << device.driverName()
765                          << " " << tr("Device") << " " << iDevice << endl;                          << " " << tr("Device") << " " << iDevice << endl;
# Line 1005  void qsamplerMainForm::editAddChannel (v Line 1046  void qsamplerMainForm::editAddChannel (v
1046          return;          return;
1047    
1048      // Just create the channel instance...      // Just create the channel instance...
1049      qsamplerChannel *pChannel = new qsamplerChannel(this);      qsamplerChannel *pChannel = new qsamplerChannel();
1050      if (pChannel == NULL)      if (pChannel == NULL)
1051          return;          return;
1052    
# Line 1168  void qsamplerMainForm::viewMessages ( bo Line 1209  void qsamplerMainForm::viewMessages ( bo
1209  }  }
1210    
1211    
1212    // Show/hide the MIDI instrument list-view form.
1213    void qsamplerMainForm::viewInstruments (void)
1214    {
1215            if (m_pOptions == NULL)
1216                    return;
1217    
1218            if (m_pInstrumentListForm) {
1219                    m_pOptions->saveWidgetGeometry(m_pInstrumentListForm);
1220                    if (m_pInstrumentListForm->isVisible()) {
1221                            m_pInstrumentListForm->hide();
1222                    } else {
1223                            m_pInstrumentListForm->show();
1224                            m_pInstrumentListForm->raise();
1225                            m_pInstrumentListForm->setActiveWindow();
1226                    }
1227            }
1228    }
1229    
1230    
1231  // Show/hide the device configurator form.  // Show/hide the device configurator form.
1232  void qsamplerMainForm::viewDevices (void)  void qsamplerMainForm::viewDevices (void)
1233  {  {
# Line 1176  void qsamplerMainForm::viewDevices (void Line 1236  void qsamplerMainForm::viewDevices (void
1236    
1237          if (m_pDeviceForm) {          if (m_pDeviceForm) {
1238                  m_pOptions->saveWidgetGeometry(m_pDeviceForm);                  m_pOptions->saveWidgetGeometry(m_pDeviceForm);
                 m_pDeviceForm->setClient(m_pClient);  
1239                  if (m_pDeviceForm->isVisible()) {                  if (m_pDeviceForm->isVisible()) {
1240                          m_pDeviceForm->hide();                          m_pDeviceForm->hide();
1241                  } else {                  } else {
# Line 1362  void qsamplerMainForm::helpAbout (void) Line 1421  void qsamplerMainForm::helpAbout (void)
1421      sText += tr("Sampler channel Mute/Solo support disabled.");      sText += tr("Sampler channel Mute/Solo support disabled.");
1422      sText += "</font></small><br />";      sText += "</font></small><br />";
1423  #endif  #endif
1424    #ifndef CONFIG_MIDI_INSTRUMENT
1425        sText += "<small><font color=\"red\">";
1426        sText += tr("MIDI instrument mapping support disabled.");
1427        sText += "</font></small><br />";
1428    #endif
1429      sText += "<br />\n";      sText += "<br />\n";
1430      sText += tr("Using") + ": ";      sText += tr("Using") + ": ";
1431      sText += ::lscp_client_package();      sText += ::lscp_client_package();
# Line 1416  void qsamplerMainForm::stabilizeForm (vo Line 1480  void qsamplerMainForm::stabilizeForm (vo
1480      editResetChannelAction->setEnabled(bHasChannel);      editResetChannelAction->setEnabled(bHasChannel);
1481      editResetAllChannelsAction->setEnabled(bHasChannel);      editResetAllChannelsAction->setEnabled(bHasChannel);
1482      viewMessagesAction->setOn(m_pMessages && m_pMessages->isVisible());      viewMessagesAction->setOn(m_pMessages && m_pMessages->isVisible());
1483      viewDevicesAction->setOn(m_pDeviceForm && m_pDeviceForm->isVisible());  #ifdef CONFIG_MIDI_INSTRUMENT
1484            viewInstrumentsAction->setOn(m_pInstrumentListForm
1485                    && m_pInstrumentListForm->isVisible());
1486            viewInstrumentsAction->setEnabled(bHasClient);
1487    #endif
1488            viewDevicesAction->setOn(m_pDeviceForm
1489                    && m_pDeviceForm->isVisible());
1490      viewDevicesAction->setEnabled(bHasClient);      viewDevicesAction->setEnabled(bHasClient);
1491      channelsArrangeAction->setEnabled(bHasChannel);      channelsArrangeAction->setEnabled(bHasChannel);
1492    
# Line 1482  void qsamplerMainForm::updateSession (vo Line 1552  void qsamplerMainForm::updateSession (vo
1552          for (int iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) {          for (int iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) {
1553                  // Check if theres already a channel strip for this one...                  // Check if theres already a channel strip for this one...
1554                  if (!channelStrip(piChannelIDs[iChannel]))                  if (!channelStrip(piChannelIDs[iChannel]))
1555                          createChannelStrip(new qsamplerChannel(this, piChannelIDs[iChannel]));                          createChannelStrip(new qsamplerChannel(piChannelIDs[iChannel]));
1556                  // Make it visibly responsive...                  // Make it visibly responsive...
1557                  QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);                  QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
1558          }          }
1559          m_pWorkspace->setUpdatesEnabled(true);          m_pWorkspace->setUpdatesEnabled(true);
1560                    
1561          // Remember to refresh devices          // Remember to refresh devices and instruments...
1562            if (m_pInstrumentListForm)
1563                m_pInstrumentListForm->refreshInstruments();
1564          if (m_pDeviceForm)          if (m_pDeviceForm)
1565              m_pDeviceForm->refreshDevices();              m_pDeviceForm->refreshDevices();
1566  }  }
# Line 2107  bool qsamplerMainForm::startClient (void Line 2179  bool qsamplerMainForm::startClient (void
2179      // Log success here.      // Log success here.
2180      appendMessages(tr("Client connected."));      appendMessages(tr("Client connected."));
2181    
2182          // Hard-notify device configuration form,          // Hard-notify instrumnet and device configuration forms,
2183          // if visible, that we're ready...          // if visible, that we're ready...
2184          if (m_pDeviceForm && m_pDeviceForm->isVisible())          if (m_pInstrumentListForm)
2185              m_pDeviceForm->setClient(m_pClient);              m_pInstrumentListForm->refreshInstruments();
2186            if (m_pDeviceForm)
2187                m_pDeviceForm->refreshDevices();
2188    
2189      // Is any session pending to be loaded?      // Is any session pending to be loaded?
2190      if (!m_pOptions->sSessionFile.isEmpty()) {      if (!m_pOptions->sSessionFile.isEmpty()) {
# Line 2132  void qsamplerMainForm::stopClient (void) Line 2206  void qsamplerMainForm::stopClient (void)
2206      if (m_pClient == NULL)      if (m_pClient == NULL)
2207          return;          return;
2208    
         // Hard-notify device configuration form,  
         // if visible, that we're running out...  
         if (m_pDeviceForm && m_pDeviceForm->isVisible())  
             m_pDeviceForm->setClient(NULL);  
   
2209      // Log prepare here.      // Log prepare here.
2210      appendMessages(tr("Client disconnecting..."));      appendMessages(tr("Client disconnecting..."));
2211    
# Line 2157  void qsamplerMainForm::stopClient (void) Line 2226  void qsamplerMainForm::stopClient (void)
2226      ::lscp_client_destroy(m_pClient);      ::lscp_client_destroy(m_pClient);
2227      m_pClient = NULL;      m_pClient = NULL;
2228    
2229            // Hard-notify instrumnet and device configuration forms,
2230            // if visible, that we're running out...
2231            if (m_pInstrumentListForm)
2232                m_pInstrumentListForm->refreshInstruments();
2233            if (m_pDeviceForm)
2234                m_pDeviceForm->refreshDevices();
2235    
2236      // Log final here.      // Log final here.
2237      appendMessages(tr("Client disconnected."));      appendMessages(tr("Client disconnected."));
2238    

Legend:
Removed from v.957  
changed lines
  Added in v.968

  ViewVC Help
Powered by ViewVC