/[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 265 by capela, Wed Sep 29 16:05:24 2004 UTC revision 298 by capela, Wed Nov 17 13:05:42 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 767  void qsamplerMainForm::editAddChannel (v Line 768  void qsamplerMainForm::editAddChannel (v
768      if (m_pClient == NULL)      if (m_pClient == NULL)
769          return;          return;
770    
771      // Create the new sampler channel.      // Just create the channel strip,
772      int iChannelID = ::lscp_add_channel(m_pClient);      // by giving an invalid channel id.
773      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();  
774  }  }
775    
776    
# Line 814  void qsamplerMainForm::editRemoveChannel Line 800  void qsamplerMainForm::editRemoveChannel
800      }      }
801    
802      // Remove the existing sampler channel.      // Remove the existing sampler channel.
803      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."));  
804          return;          return;
     }  
805    
     // Log this happening.  
     appendMessages(tr("Channel %1 removed.").arg(pChannel->channelID()));  
       
806      // Just delete the channel strip.      // Just delete the channel strip.
807      delete pChannelStrip;      delete pChannelStrip;
808            
# Line 847  void qsamplerMainForm::editSetupChannel Line 827  void qsamplerMainForm::editSetupChannel
827          return;          return;
828    
829      // Just invoque the channel strip procedure.      // Just invoque the channel strip procedure.
830      pChannelStrip->showChannelSetup(false);      pChannelStrip->channelSetup();
831  }  }
832    
833    
# Line 865  void qsamplerMainForm::editResetChannel Line 845  void qsamplerMainForm::editResetChannel
845      if (pChannel == NULL)      if (pChannel == NULL)
846          return;          return;
847    
848      // Remove the existing sampler channel.      // Reset the existing sampler channel.
849      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()));  
850    
851      // Refresh channel strip info.      // Refresh channel strip info.
852      pChannelStrip->updateChannelInfo();      pChannelStrip->updateChannelInfo();
853        // And force a deferred update.
854        m_iChangeCount++;
855  }  }
856    
857    
# Line 949  void qsamplerMainForm::viewOptions (void Line 924  void qsamplerMainForm::viewOptions (void
924          bool    bOldServerStart     = m_pOptions->bServerStart;          bool    bOldServerStart     = m_pOptions->bServerStart;
925          QString sOldServerCmdLine   = m_pOptions->sServerCmdLine;          QString sOldServerCmdLine   = m_pOptions->sServerCmdLine;
926          QString sOldDisplayFont     = m_pOptions->sDisplayFont;          QString sOldDisplayFont     = m_pOptions->sDisplayFont;
927            bool    bOldDisplayEffect   = m_pOptions->bDisplayEffect;
928          int     iOldMaxVolume       = m_pOptions->iMaxVolume;          int     iOldMaxVolume       = m_pOptions->iMaxVolume;
929          QString sOldMessagesFont    = m_pOptions->sMessagesFont;          QString sOldMessagesFont    = m_pOptions->sMessagesFont;
930          bool    bOldStdoutCapture   = m_pOptions->bStdoutCapture;          bool    bOldStdoutCapture   = m_pOptions->bStdoutCapture;
# Line 973  void qsamplerMainForm::viewOptions (void Line 949  void qsamplerMainForm::viewOptions (void
949                  (!bOldCompletePath &&  m_pOptions->bCompletePath) ||                  (!bOldCompletePath &&  m_pOptions->bCompletePath) ||
950                  (iOldMaxRecentFiles != m_pOptions->iMaxRecentFiles))                  (iOldMaxRecentFiles != m_pOptions->iMaxRecentFiles))
951                  updateRecentFilesMenu();                  updateRecentFilesMenu();
952                if (( bOldDisplayEffect && !m_pOptions->bDisplayEffect) ||
953                    (!bOldDisplayEffect &&  m_pOptions->bDisplayEffect))
954                    updateDisplayEffect();
955              if (sOldDisplayFont != m_pOptions->sDisplayFont)              if (sOldDisplayFont != m_pOptions->sDisplayFont)
956                  updateDisplayFont();                  updateDisplayFont();
957              if (iOldMaxVolume != m_pOptions->iMaxVolume)              if (iOldMaxVolume != m_pOptions->iMaxVolume)
# Line 1160  void qsamplerMainForm::stabilizeForm (vo Line 1139  void qsamplerMainForm::stabilizeForm (vo
1139  // Channel change receiver slot.  // Channel change receiver slot.
1140  void qsamplerMainForm::channelStripChanged( qsamplerChannelStrip * )  void qsamplerMainForm::channelStripChanged( qsamplerChannelStrip * )
1141  {  {
1142        // Flag that we're update those channel strips.
1143        m_iChangeCount++;
1144      // Just mark the dirty form.      // Just mark the dirty form.
1145      m_iDirtyCount++;      m_iDirtyCount++;
1146      // and update the form status...      // and update the form status...
# Line 1240  void qsamplerMainForm::updateDisplayFont Line 1221  void qsamplerMainForm::updateDisplayFont
1221  }  }
1222    
1223    
1224    // Update channel strips background effect.
1225    void qsamplerMainForm::updateDisplayEffect (void)
1226    {
1227       QPixmap pm;
1228        if (m_pOptions->bDisplayEffect)
1229            pm = QPixmap::fromMimeSource("displaybg1.png");
1230    
1231        // Full channel list update...
1232        QWidgetList wlist = m_pWorkspace->windowList();
1233        if (wlist.isEmpty())
1234            return;
1235    
1236        m_pWorkspace->setUpdatesEnabled(false);
1237        for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1238            qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1239            if (pChannelStrip)
1240                pChannelStrip->setDisplayBackground(pm);
1241        }
1242        m_pWorkspace->setUpdatesEnabled(true);
1243    }
1244    
1245    
1246  // Force update of the channels maximum volume setting.  // Force update of the channels maximum volume setting.
1247  void qsamplerMainForm::updateMaxVolume (void)  void qsamplerMainForm::updateMaxVolume (void)
1248  {  {
# Line 1354  void qsamplerMainForm::updateMessagesCap Line 1357  void qsamplerMainForm::updateMessagesCap
1357  // qsamplerMainForm -- MDI channel strip management.  // qsamplerMainForm -- MDI channel strip management.
1358    
1359  // The channel strip creation executive.  // The channel strip creation executive.
1360  void qsamplerMainForm::createChannel ( int iChannelID, bool bPrompt )  qsamplerChannelStrip *qsamplerMainForm::createChannelStrip ( int iChannelID )
1361  {  {
1362      if (m_pClient == NULL)      if (m_pClient == NULL)
1363          return;          return NULL;
1364    
1365      // Prepare for auto-arrange?      // Prepare for auto-arrange?
1366      qsamplerChannelStrip *pChannelStrip = NULL;      qsamplerChannelStrip *pChannelStrip = NULL;
# Line 1374  void qsamplerMainForm::createChannel ( i Line 1377  void qsamplerMainForm::createChannel ( i
1377      // Add a new channel itema...      // Add a new channel itema...
1378      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;
1379      pChannelStrip = new qsamplerChannelStrip(m_pWorkspace, 0, wflags);      pChannelStrip = new qsamplerChannelStrip(m_pWorkspace, 0, wflags);
1380      pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume);      // Actual channel setup.
1381      pChannelStrip->setup(this, iChannelID);      pChannelStrip->setup(this, iChannelID);
     // We'll need a display font.  
     QFont font;  
     if (m_pOptions && font.fromString(m_pOptions->sDisplayFont))  
         pChannelStrip->setDisplayFont(font);  
     // Track channel setup changes.  
1382      QObject::connect(pChannelStrip, SIGNAL(channelChanged(qsamplerChannelStrip *)), this, SLOT(channelStripChanged(qsamplerChannelStrip *)));      QObject::connect(pChannelStrip, SIGNAL(channelChanged(qsamplerChannelStrip *)), this, SLOT(channelStripChanged(qsamplerChannelStrip *)));
1383      // Before we show it up, may be we'll      // Before we show it up, may be we'll
1384      // better ask for some initial values?      // better ask for some initial values?
1385      if (bPrompt)      if (iChannelID < 0 && !pChannelStrip->channelSetup()) {
1386          pChannelStrip->showChannelSetup(true);          // No luck, bail out...
1387            delete pChannelStrip;
1388            return NULL;
1389        }
1390    
1391        // Set some initial aesthetic options...
1392        if (m_pOptions) {
1393            // Background display effect...
1394            pChannelStrip->setDisplayEffect(m_pOptions->bDisplayEffect);
1395            // We'll need a display font.
1396            QFont font;
1397            if (font.fromString(m_pOptions->sDisplayFont))
1398                pChannelStrip->setDisplayFont(font);
1399            // Maximum allowed volume setting.
1400            pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume);
1401        }
1402    
1403      // Now we show up us to the world.      // Now we show up us to the world.
1404      pChannelStrip->show();      pChannelStrip->show();
1405      // Only then, we'll auto-arrange...      // Only then, we'll auto-arrange...
# Line 1395  void qsamplerMainForm::createChannel ( i Line 1409  void qsamplerMainForm::createChannel ( i
1409          int iHeight = pChannelStrip->parentWidget()->frameGeometry().height();          int iHeight = pChannelStrip->parentWidget()->frameGeometry().height();
1410          pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight);          pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight);
1411      }      }
1412        
1413        // Return our successful reference...
1414        return pChannelStrip;
1415  }  }
1416    
1417    
# Line 1484  void qsamplerMainForm::timerSlot (void) Line 1501  void qsamplerMainForm::timerSlot (void)
1501      }      }
1502            
1503          // Refresh each channel usage, on each period...          // Refresh each channel usage, on each period...
1504      if (m_pClient && m_pOptions->bAutoRefresh && m_pWorkspace->isUpdatesEnabled()) {      if (m_pClient && (m_iChangeCount > 0 || m_pOptions->bAutoRefresh)) {
1505          m_iTimerSlot += QSAMPLER_TIMER_MSECS;          m_iTimerSlot += QSAMPLER_TIMER_MSECS;
1506          if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime)  {          if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime && m_pWorkspace->isUpdatesEnabled())  {
1507              m_iTimerSlot = 0;              m_iTimerSlot = 0;
1508                m_iChangeCount = 0;
1509              QWidgetList wlist = m_pWorkspace->windowList();              QWidgetList wlist = m_pWorkspace->windowList();
1510              for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {              for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1511                  qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);                  qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1512                  if (pChannelStrip && pChannelStrip->isVisible())                  if (pChannelStrip && pChannelStrip->isVisible()) {
1513                      pChannelStrip->updateChannelUsage();                      // If we can't make it clean, try next time.
1514                        if (!pChannelStrip->updateChannelUsage())
1515                            m_iChangeCount++;
1516                    }
1517              }              }
1518          }          }
1519      }      }

Legend:
Removed from v.265  
changed lines
  Added in v.298

  ViewVC Help
Powered by ViewVC