/[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 267 by capela, Wed Oct 6 15:42:59 2004 UTC revision 301 by capela, Wed Nov 17 16:43:49 2004 UTC
# Line 104  void qsamplerMainForm::init (void) Line 104  void qsamplerMainForm::init (void)
104      m_pMessages = NULL;      m_pMessages = NULL;
105    
106      // We'll start clean.      // We'll start clean.
107      m_iUntitled = 0;      m_iUntitled    = 0;
108      m_iDirtyCount = 0;      m_iDirtyCount  = 0;
109        m_iChangeCount = 0;
110    
111      m_pServer = NULL;      m_pServer = NULL;
112      m_pClient = NULL;      m_pClient = NULL;
# Line 487  bool qsamplerMainForm::closeSession ( bo Line 488  bool qsamplerMainForm::closeSession ( bo
488              qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);              qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
489              if (pChannelStrip) {              if (pChannelStrip) {
490                  qsamplerChannel *pChannel = pChannelStrip->channel();                  qsamplerChannel *pChannel = pChannelStrip->channel();
491                  if (bForce && pChannel && ::lscp_remove_channel(m_pClient, pChannel->channelID()) != LSCP_OK)                  if (bForce && pChannel)
492                      appendMessagesClient("lscp_remove_channel");                      pChannel->removeChannel();
493                  delete pChannelStrip;                  delete pChannelStrip;
494              }              }
495          }          }
# Line 552  bool qsamplerMainForm::loadSessionFile ( Line 553  bool qsamplerMainForm::loadSessionFile (
553      // Try to (re)create each channel.      // Try to (re)create each channel.
554      m_pWorkspace->setUpdatesEnabled(false);      m_pWorkspace->setUpdatesEnabled(false);
555      for (int iChannelID = 0; iChannelID < iChannels; iChannelID++) {      for (int iChannelID = 0; iChannelID < iChannels; iChannelID++) {
556          createChannel(iChannelID, false);          createChannelStrip(iChannelID);
557          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
558      }      }
559      m_pWorkspace->setUpdatesEnabled(true);      m_pWorkspace->setUpdatesEnabled(true);
# Line 566  bool qsamplerMainForm::loadSessionFile ( Line 567  bool qsamplerMainForm::loadSessionFile (
567      m_sFilename = sFilename;      m_sFilename = sFilename;
568      updateRecentFiles(sFilename);      updateRecentFiles(sFilename);
569      appendMessages(tr("Open session: \"%1\".").arg(sessionName(m_sFilename)));      appendMessages(tr("Open session: \"%1\".").arg(sessionName(m_sFilename)));
570        
571        // Make that an overall update.
572        m_iChangeCount++;
573      stabilizeForm();      stabilizeForm();
574      return true;      return true;
575  }  }
# Line 767  void qsamplerMainForm::editAddChannel (v Line 771  void qsamplerMainForm::editAddChannel (v
771      if (m_pClient == NULL)      if (m_pClient == NULL)
772          return;          return;
773    
774      // Create the new sampler channel.      // Just create the channel strip,
775      int iChannelID = ::lscp_add_channel(m_pClient);      // by giving an invalid channel id.
776      if (iChannelID < 0) {      createChannelStrip(-1);
         appendMessagesClient("lscp_add_channel");  
         appendMessagesError(tr("Could not create the new channel.\n\nSorry."));  
         return;  
     }  
   
     // Log this happening.  
     appendMessages(tr("Channel %1 created.").arg(iChannelID));  
   
     // Just create the channel strip with given id.  
     createChannel(iChannelID, true);  
   
     // We'll be dirty, for sure...  
     m_iDirtyCount++;  
     // Stabilize form anyway.  
     stabilizeForm();  
777  }  }
778    
779    
# Line 814  void qsamplerMainForm::editRemoveChannel Line 803  void qsamplerMainForm::editRemoveChannel
803      }      }
804    
805      // Remove the existing sampler channel.      // Remove the existing sampler channel.
806      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."));  
807          return;          return;
     }  
808    
     // Log this happening.  
     appendMessages(tr("Channel %1 removed.").arg(pChannel->channelID()));  
       
809      // Just delete the channel strip.      // Just delete the channel strip.
810      delete pChannelStrip;      delete pChannelStrip;
811            
# Line 847  void qsamplerMainForm::editSetupChannel Line 830  void qsamplerMainForm::editSetupChannel
830          return;          return;
831    
832      // Just invoque the channel strip procedure.      // Just invoque the channel strip procedure.
833      pChannelStrip->showChannelSetup(false);      pChannelStrip->channelSetup();
834  }  }
835    
836    
# Line 865  void qsamplerMainForm::editResetChannel Line 848  void qsamplerMainForm::editResetChannel
848      if (pChannel == NULL)      if (pChannel == NULL)
849          return;          return;
850    
851      // Remove the existing sampler channel.      // Reset the existing sampler channel.
852      if (::lscp_reset_channel(m_pClient, pChannel->channelID()) != LSCP_OK) {      pChannel->resetChannel();
         appendMessagesClient("lscp_reset_channel");  
         appendMessagesError(tr("Could not reset channel.\n\nSorry."));  
         return;  
     }  
   
     // Log this.  
     appendMessages(tr("Channel %1 reset.").arg(pChannel->channelID()));  
853    
854      // Refresh channel strip info.      // Refresh channel strip info.
855      pChannelStrip->updateChannelInfo();      pChannelStrip->updateChannelInfo();
856        // And force a deferred update.
857        m_iChangeCount++;
858  }  }
859    
860    
# Line 1164  void qsamplerMainForm::stabilizeForm (vo Line 1142  void qsamplerMainForm::stabilizeForm (vo
1142  // Channel change receiver slot.  // Channel change receiver slot.
1143  void qsamplerMainForm::channelStripChanged( qsamplerChannelStrip * )  void qsamplerMainForm::channelStripChanged( qsamplerChannelStrip * )
1144  {  {
1145        // Flag that we're update those channel strips.
1146        m_iChangeCount++;
1147      // Just mark the dirty form.      // Just mark the dirty form.
1148      m_iDirtyCount++;      m_iDirtyCount++;
1149      // and update the form status...      // and update the form status...
# Line 1380  void qsamplerMainForm::updateMessagesCap Line 1360  void qsamplerMainForm::updateMessagesCap
1360  // qsamplerMainForm -- MDI channel strip management.  // qsamplerMainForm -- MDI channel strip management.
1361    
1362  // The channel strip creation executive.  // The channel strip creation executive.
1363  void qsamplerMainForm::createChannel ( int iChannelID, bool bPrompt )  qsamplerChannelStrip *qsamplerMainForm::createChannelStrip ( int iChannelID )
1364  {  {
1365      if (m_pClient == NULL)      if (m_pClient == NULL)
1366          return;          return NULL;
1367    
1368      // Prepare for auto-arrange?      // Prepare for auto-arrange?
1369      qsamplerChannelStrip *pChannelStrip = NULL;      qsamplerChannelStrip *pChannelStrip = NULL;
# Line 1400  void qsamplerMainForm::createChannel ( i Line 1380  void qsamplerMainForm::createChannel ( i
1380      // Add a new channel itema...      // Add a new channel itema...
1381      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;
1382      pChannelStrip = new qsamplerChannelStrip(m_pWorkspace, 0, wflags);      pChannelStrip = new qsamplerChannelStrip(m_pWorkspace, 0, wflags);
1383        // Actual channel setup.
1384        pChannelStrip->setup(this, iChannelID);
1385        QObject::connect(pChannelStrip, SIGNAL(channelChanged(qsamplerChannelStrip *)), this, SLOT(channelStripChanged(qsamplerChannelStrip *)));
1386        // Before we show it up, may be we'll
1387        // better ask for some initial values?
1388        if (iChannelID < 0 && !pChannelStrip->channelSetup()) {
1389            // No luck, bail out...
1390            delete pChannelStrip;
1391            return NULL;
1392        }
1393    
1394      // Set some initial aesthetic options...      // Set some initial aesthetic options...
1395      if (m_pOptions) {      if (m_pOptions) {
1396          // Background display effect...          // Background display effect...
# Line 1411  void qsamplerMainForm::createChannel ( i Line 1402  void qsamplerMainForm::createChannel ( i
1402          // Maximum allowed volume setting.          // Maximum allowed volume setting.
1403          pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume);          pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume);
1404      }      }
1405      // Actual channel setup.  
     pChannelStrip->setup(this, iChannelID);  
     QObject::connect(pChannelStrip, SIGNAL(channelChanged(qsamplerChannelStrip *)), this, SLOT(channelStripChanged(qsamplerChannelStrip *)));  
     // Before we show it up, may be we'll  
     // better ask for some initial values?  
     if (bPrompt)  
         pChannelStrip->showChannelSetup(true);  
1406      // Now we show up us to the world.      // Now we show up us to the world.
1407      pChannelStrip->show();      pChannelStrip->show();
1408      // Only then, we'll auto-arrange...      // Only then, we'll auto-arrange...
# Line 1427  void qsamplerMainForm::createChannel ( i Line 1412  void qsamplerMainForm::createChannel ( i
1412          int iHeight = pChannelStrip->parentWidget()->frameGeometry().height();          int iHeight = pChannelStrip->parentWidget()->frameGeometry().height();
1413          pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight);          pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight);
1414      }      }
1415        
1416        // Return our successful reference...
1417        return pChannelStrip;
1418  }  }
1419    
1420    
# Line 1516  void qsamplerMainForm::timerSlot (void) Line 1504  void qsamplerMainForm::timerSlot (void)
1504      }      }
1505            
1506          // Refresh each channel usage, on each period...          // Refresh each channel usage, on each period...
1507      if (m_pClient && m_pOptions->bAutoRefresh && m_pWorkspace->isUpdatesEnabled()) {      if (m_pClient && (m_iChangeCount > 0 || m_pOptions->bAutoRefresh)) {
1508          m_iTimerSlot += QSAMPLER_TIMER_MSECS;          m_iTimerSlot += QSAMPLER_TIMER_MSECS;
1509          if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime)  {          if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime && m_pWorkspace->isUpdatesEnabled())  {
1510              m_iTimerSlot = 0;              m_iTimerSlot = 0;
1511                m_iChangeCount = 0;
1512              QWidgetList wlist = m_pWorkspace->windowList();              QWidgetList wlist = m_pWorkspace->windowList();
1513              for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {              for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1514                  qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);                  qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1515                  if (pChannelStrip && pChannelStrip->isVisible())                  if (pChannelStrip && pChannelStrip->isVisible()) {
1516                      pChannelStrip->updateChannelUsage();                      // If we can't make it clean, try next time.
1517                        if (!pChannelStrip->updateChannelUsage())
1518                            m_iChangeCount++;
1519                    }
1520              }              }
1521          }          }
1522      }      }

Legend:
Removed from v.267  
changed lines
  Added in v.301

  ViewVC Help
Powered by ViewVC