/[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 303 by capela, Fri Nov 19 10:18:59 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 543  bool qsamplerMainForm::loadSessionFile ( Line 544  bool qsamplerMainForm::loadSessionFile (
544          appendMessagesError(tr("Some setttings could not be loaded\nfrom \"%1\" session file.\n\nSorry.").arg(sFilename));          appendMessagesError(tr("Some setttings could not be loaded\nfrom \"%1\" session file.\n\nSorry.").arg(sFilename));
545    
546      // Now we'll try to create the whole GUI session.      // Now we'll try to create the whole GUI session.
547      int iChannels = ::lscp_get_channels(m_pClient);      int *piChannelIDs = ::lscp_list_channels(m_pClient);
548      if (iChannels < 0) {      if (piChannelIDs == NULL) {
549          appendMessagesClient("lscp_get_channels");          appendMessagesClient("lscp_list_channels");
550          appendMessagesError(tr("Could not get current number of channels.\n\nSorry."));          appendMessagesError(tr("Could not get current list of channels.\n\nSorry."));
551      }      }
552            
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 iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) {
556          createChannel(iChannelID, false);          createChannelStrip(new qsamplerChannel(this, piChannelIDs[iChannel]));
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 instance...
775      int iChannelID = ::lscp_add_channel(m_pClient);      qsamplerChannel *pChannel = new qsamplerChannel(this);
776      if (iChannelID < 0) {      if (pChannel == NULL)
         appendMessagesClient("lscp_add_channel");  
         appendMessagesError(tr("Could not create the new channel.\n\nSorry."));  
777          return;          return;
     }  
778    
779      // Log this happening.      // Before we show it up, may be we'll
780      appendMessages(tr("Channel %1 created.").arg(iChannelID));      // better ask for some initial values?
781        if (!pChannel->channelSetup(this)) {
782      // Just create the channel strip with given id.          delete pChannel;
783      createChannel(iChannelID, true);          return;
784        }
785        
786        // And give it to the strip (will own the channel instance, if successful).
787        if (!createChannelStrip(pChannel)) {
788            delete pChannel;
789            return;
790        }
791    
792      // We'll be dirty, for sure...      // Make that an overall update.
793      m_iDirtyCount++;      m_iDirtyCount++;
794      // Stabilize form anyway.      m_iChangeCount++;
795      stabilizeForm();      stabilizeForm();
796  }  }
797    
# Line 814  void qsamplerMainForm::editRemoveChannel Line 822  void qsamplerMainForm::editRemoveChannel
822      }      }
823    
824      // Remove the existing sampler channel.      // Remove the existing sampler channel.
825      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."));  
826          return;          return;
     }  
827    
     // Log this happening.  
     appendMessages(tr("Channel %1 removed.").arg(pChannel->channelID()));  
       
828      // Just delete the channel strip.      // Just delete the channel strip.
829      delete pChannelStrip;      delete pChannelStrip;
830            
# Line 847  void qsamplerMainForm::editSetupChannel Line 849  void qsamplerMainForm::editSetupChannel
849          return;          return;
850    
851      // Just invoque the channel strip procedure.      // Just invoque the channel strip procedure.
852      pChannelStrip->showChannelSetup(false);      pChannelStrip->channelSetup();
853  }  }
854    
855    
# Line 865  void qsamplerMainForm::editResetChannel Line 867  void qsamplerMainForm::editResetChannel
867      if (pChannel == NULL)      if (pChannel == NULL)
868          return;          return;
869    
870      // Remove the existing sampler channel.      // Reset the existing sampler channel.
871      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()));  
872    
873      // Refresh channel strip info.      // And force a deferred update.
874      pChannelStrip->updateChannelInfo();      m_iChangeCount++;
875  }  }
876    
877    
# Line 949  void qsamplerMainForm::viewOptions (void Line 944  void qsamplerMainForm::viewOptions (void
944          bool    bOldServerStart     = m_pOptions->bServerStart;          bool    bOldServerStart     = m_pOptions->bServerStart;
945          QString sOldServerCmdLine   = m_pOptions->sServerCmdLine;          QString sOldServerCmdLine   = m_pOptions->sServerCmdLine;
946          QString sOldDisplayFont     = m_pOptions->sDisplayFont;          QString sOldDisplayFont     = m_pOptions->sDisplayFont;
947            bool    bOldDisplayEffect   = m_pOptions->bDisplayEffect;
948          int     iOldMaxVolume       = m_pOptions->iMaxVolume;          int     iOldMaxVolume       = m_pOptions->iMaxVolume;
949          QString sOldMessagesFont    = m_pOptions->sMessagesFont;          QString sOldMessagesFont    = m_pOptions->sMessagesFont;
950          bool    bOldStdoutCapture   = m_pOptions->bStdoutCapture;          bool    bOldStdoutCapture   = m_pOptions->bStdoutCapture;
# Line 973  void qsamplerMainForm::viewOptions (void Line 969  void qsamplerMainForm::viewOptions (void
969                  (!bOldCompletePath &&  m_pOptions->bCompletePath) ||                  (!bOldCompletePath &&  m_pOptions->bCompletePath) ||
970                  (iOldMaxRecentFiles != m_pOptions->iMaxRecentFiles))                  (iOldMaxRecentFiles != m_pOptions->iMaxRecentFiles))
971                  updateRecentFilesMenu();                  updateRecentFilesMenu();
972                if (( bOldDisplayEffect && !m_pOptions->bDisplayEffect) ||
973                    (!bOldDisplayEffect &&  m_pOptions->bDisplayEffect))
974                    updateDisplayEffect();
975              if (sOldDisplayFont != m_pOptions->sDisplayFont)              if (sOldDisplayFont != m_pOptions->sDisplayFont)
976                  updateDisplayFont();                  updateDisplayFont();
977              if (iOldMaxVolume != m_pOptions->iMaxVolume)              if (iOldMaxVolume != m_pOptions->iMaxVolume)
# Line 1160  void qsamplerMainForm::stabilizeForm (vo Line 1159  void qsamplerMainForm::stabilizeForm (vo
1159  // Channel change receiver slot.  // Channel change receiver slot.
1160  void qsamplerMainForm::channelStripChanged( qsamplerChannelStrip * )  void qsamplerMainForm::channelStripChanged( qsamplerChannelStrip * )
1161  {  {
1162        // Flag that we're update those channel strips.
1163        m_iChangeCount++;
1164      // Just mark the dirty form.      // Just mark the dirty form.
1165      m_iDirtyCount++;      m_iDirtyCount++;
1166      // and update the form status...      // and update the form status...
# Line 1240  void qsamplerMainForm::updateDisplayFont Line 1241  void qsamplerMainForm::updateDisplayFont
1241  }  }
1242    
1243    
1244    // Update channel strips background effect.
1245    void qsamplerMainForm::updateDisplayEffect (void)
1246    {
1247       QPixmap pm;
1248        if (m_pOptions->bDisplayEffect)
1249            pm = QPixmap::fromMimeSource("displaybg1.png");
1250    
1251        // Full channel list update...
1252        QWidgetList wlist = m_pWorkspace->windowList();
1253        if (wlist.isEmpty())
1254            return;
1255    
1256        m_pWorkspace->setUpdatesEnabled(false);
1257        for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1258            qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1259            if (pChannelStrip)
1260                pChannelStrip->setDisplayBackground(pm);
1261        }
1262        m_pWorkspace->setUpdatesEnabled(true);
1263    }
1264    
1265    
1266  // Force update of the channels maximum volume setting.  // Force update of the channels maximum volume setting.
1267  void qsamplerMainForm::updateMaxVolume (void)  void qsamplerMainForm::updateMaxVolume (void)
1268  {  {
# Line 1354  void qsamplerMainForm::updateMessagesCap Line 1377  void qsamplerMainForm::updateMessagesCap
1377  // qsamplerMainForm -- MDI channel strip management.  // qsamplerMainForm -- MDI channel strip management.
1378    
1379  // The channel strip creation executive.  // The channel strip creation executive.
1380  void qsamplerMainForm::createChannel ( int iChannelID, bool bPrompt )  qsamplerChannelStrip *qsamplerMainForm::createChannelStrip ( qsamplerChannel *pChannel )
1381  {  {
1382      if (m_pClient == NULL)      if (m_pClient == NULL || pChannel == NULL)
1383          return;          return NULL;
1384    
1385      // Prepare for auto-arrange?      // Prepare for auto-arrange?
1386      qsamplerChannelStrip *pChannelStrip = NULL;      qsamplerChannelStrip *pChannelStrip = NULL;
# Line 1374  void qsamplerMainForm::createChannel ( i Line 1397  void qsamplerMainForm::createChannel ( i
1397      // Add a new channel itema...      // Add a new channel itema...
1398      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;
1399      pChannelStrip = new qsamplerChannelStrip(m_pWorkspace, 0, wflags);      pChannelStrip = new qsamplerChannelStrip(m_pWorkspace, 0, wflags);
1400      pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume);      if (pChannelStrip == NULL)
1401      pChannelStrip->setup(this, iChannelID);          return NULL;
1402      // We'll need a display font.          
1403      QFont font;      // Actual channel strip setup...
1404      if (m_pOptions && font.fromString(m_pOptions->sDisplayFont))      pChannelStrip->setup(pChannel);
         pChannelStrip->setDisplayFont(font);  
     // Track channel setup changes.  
1405      QObject::connect(pChannelStrip, SIGNAL(channelChanged(qsamplerChannelStrip *)), this, SLOT(channelStripChanged(qsamplerChannelStrip *)));      QObject::connect(pChannelStrip, SIGNAL(channelChanged(qsamplerChannelStrip *)), this, SLOT(channelStripChanged(qsamplerChannelStrip *)));
1406      // Before we show it up, may be we'll      // Set some initial aesthetic options...
1407      // better ask for some initial values?      if (m_pOptions) {
1408      if (bPrompt)          // Background display effect...
1409          pChannelStrip->showChannelSetup(true);          pChannelStrip->setDisplayEffect(m_pOptions->bDisplayEffect);
1410            // We'll need a display font.
1411            QFont font;
1412            if (font.fromString(m_pOptions->sDisplayFont))
1413                pChannelStrip->setDisplayFont(font);
1414            // Maximum allowed volume setting.
1415            pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume);
1416        }
1417    
1418      // Now we show up us to the world.      // Now we show up us to the world.
1419      pChannelStrip->show();      pChannelStrip->show();
1420      // Only then, we'll auto-arrange...      // Only then, we'll auto-arrange...
# Line 1395  void qsamplerMainForm::createChannel ( i Line 1424  void qsamplerMainForm::createChannel ( i
1424          int iHeight = pChannelStrip->parentWidget()->frameGeometry().height();          int iHeight = pChannelStrip->parentWidget()->frameGeometry().height();
1425          pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight);          pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight);
1426      }      }
1427        
1428        // Return our successful reference...
1429        return pChannelStrip;
1430  }  }
1431    
1432    
# Line 1484  void qsamplerMainForm::timerSlot (void) Line 1516  void qsamplerMainForm::timerSlot (void)
1516      }      }
1517            
1518          // Refresh each channel usage, on each period...          // Refresh each channel usage, on each period...
1519      if (m_pClient && m_pOptions->bAutoRefresh && m_pWorkspace->isUpdatesEnabled()) {      if (m_pClient && (m_iChangeCount > 0 || m_pOptions->bAutoRefresh)) {
1520          m_iTimerSlot += QSAMPLER_TIMER_MSECS;          m_iTimerSlot += QSAMPLER_TIMER_MSECS;
1521          if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime)  {          if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime && m_pWorkspace->isUpdatesEnabled())  {
1522              m_iTimerSlot = 0;              m_iTimerSlot = 0;
1523                m_iChangeCount = 0;
1524              QWidgetList wlist = m_pWorkspace->windowList();              QWidgetList wlist = m_pWorkspace->windowList();
1525              for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {              for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1526                  qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);                  qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1527                  if (pChannelStrip && pChannelStrip->isVisible())                  if (pChannelStrip && pChannelStrip->isVisible()) {
1528                      pChannelStrip->updateChannelUsage();                      // If we can't make it clean, try next time.
1529                        if (!pChannelStrip->updateChannelUsage())
1530                            m_iChangeCount++;
1531                    }
1532              }              }
1533          }          }
1534      }      }

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

  ViewVC Help
Powered by ViewVC