/[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 264 by capela, Wed Sep 29 13:12:45 2004 UTC revision 295 by capela, Tue Nov 16 15:26:18 2004 UTC
# Line 487  bool qsamplerMainForm::closeSession ( bo Line 487  bool qsamplerMainForm::closeSession ( bo
487              qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);              qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
488              if (pChannelStrip) {              if (pChannelStrip) {
489                  qsamplerChannel *pChannel = pChannelStrip->channel();                  qsamplerChannel *pChannel = pChannelStrip->channel();
490                  if (bForce && pChannel && ::lscp_remove_channel(m_pClient, pChannel->channelID()) != LSCP_OK)                  if (bForce && pChannel)
491                      appendMessagesClient("lscp_remove_channel");                      pChannel->removeChannel();
492                  delete pChannelStrip;                  delete pChannelStrip;
493              }              }
494          }          }
# Line 552  bool qsamplerMainForm::loadSessionFile ( Line 552  bool qsamplerMainForm::loadSessionFile (
552      // Try to (re)create each channel.      // Try to (re)create each channel.
553      m_pWorkspace->setUpdatesEnabled(false);      m_pWorkspace->setUpdatesEnabled(false);
554      for (int iChannelID = 0; iChannelID < iChannels; iChannelID++) {      for (int iChannelID = 0; iChannelID < iChannels; iChannelID++) {
555          createChannel(iChannelID, false);          createChannelStrip(iChannelID);
556          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
557      }      }
558      m_pWorkspace->setUpdatesEnabled(true);      m_pWorkspace->setUpdatesEnabled(true);
# Line 767  void qsamplerMainForm::editAddChannel (v Line 767  void qsamplerMainForm::editAddChannel (v
767      if (m_pClient == NULL)      if (m_pClient == NULL)
768          return;          return;
769    
770      // Create the new sampler channel.      // Just create the channel strip, given an invalid channel id.
771      int iChannelID = ::lscp_add_channel(m_pClient);      qsamplerChannelStrip *pChannelStrip = createChannelStrip(-1);
772      if (iChannelID < 0) {      if (pChannelStrip == NULL)
         appendMessagesClient("lscp_add_channel");  
         appendMessagesError(tr("Could not create the new channel.\n\nSorry."));  
773          return;          return;
774      }          
   
     // Log this happening.  
     appendMessages(tr("Channel %1 created.").arg(iChannelID));  
   
     // Just create the channel strip with given id.  
     createChannel(iChannelID, true);  
   
775      // We'll be dirty, for sure...      // We'll be dirty, for sure...
776      m_iDirtyCount++;      m_iDirtyCount++;
777      // Stabilize form anyway.      // Stabilize form anyway.
# Line 814  void qsamplerMainForm::editRemoveChannel Line 805  void qsamplerMainForm::editRemoveChannel
805      }      }
806    
807      // Remove the existing sampler channel.      // Remove the existing sampler channel.
808      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."));  
809          return;          return;
     }  
810    
     // Log this happening.  
     appendMessages(tr("Channel %1 removed.").arg(pChannel->channelID()));  
       
811      // Just delete the channel strip.      // Just delete the channel strip.
812      delete pChannel;      delete pChannelStrip;
813        
814      // Do we auto-arrange?      // Do we auto-arrange?
815      if (m_pOptions && m_pOptions->bAutoArrange)      if (m_pOptions && m_pOptions->bAutoArrange)
816          channelsArrange();          channelsArrange();
# Line 846  void qsamplerMainForm::editSetupChannel Line 832  void qsamplerMainForm::editSetupChannel
832          return;          return;
833    
834      // Just invoque the channel strip procedure.      // Just invoque the channel strip procedure.
835      pChannelStrip->showChannelSetup(false);      pChannelStrip->channelSetup();
836  }  }
837    
838    
# Line 864  void qsamplerMainForm::editResetChannel Line 850  void qsamplerMainForm::editResetChannel
850      if (pChannel == NULL)      if (pChannel == NULL)
851          return;          return;
852    
853      // Remove the existing sampler channel.      // Reset the existing sampler channel.
854      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()));  
855    
856      // Refresh channel strip info.      // Refresh channel strip info.
857      pChannelStrip->updateChannelInfo();      pChannelStrip->updateChannelInfo();
# Line 948  void qsamplerMainForm::viewOptions (void Line 927  void qsamplerMainForm::viewOptions (void
927          bool    bOldServerStart     = m_pOptions->bServerStart;          bool    bOldServerStart     = m_pOptions->bServerStart;
928          QString sOldServerCmdLine   = m_pOptions->sServerCmdLine;          QString sOldServerCmdLine   = m_pOptions->sServerCmdLine;
929          QString sOldDisplayFont     = m_pOptions->sDisplayFont;          QString sOldDisplayFont     = m_pOptions->sDisplayFont;
930            bool    bOldDisplayEffect   = m_pOptions->bDisplayEffect;
931          int     iOldMaxVolume       = m_pOptions->iMaxVolume;          int     iOldMaxVolume       = m_pOptions->iMaxVolume;
932          QString sOldMessagesFont    = m_pOptions->sMessagesFont;          QString sOldMessagesFont    = m_pOptions->sMessagesFont;
933          bool    bOldStdoutCapture   = m_pOptions->bStdoutCapture;          bool    bOldStdoutCapture   = m_pOptions->bStdoutCapture;
# Line 972  void qsamplerMainForm::viewOptions (void Line 952  void qsamplerMainForm::viewOptions (void
952                  (!bOldCompletePath &&  m_pOptions->bCompletePath) ||                  (!bOldCompletePath &&  m_pOptions->bCompletePath) ||
953                  (iOldMaxRecentFiles != m_pOptions->iMaxRecentFiles))                  (iOldMaxRecentFiles != m_pOptions->iMaxRecentFiles))
954                  updateRecentFilesMenu();                  updateRecentFilesMenu();
955                if (( bOldDisplayEffect && !m_pOptions->bDisplayEffect) ||
956                    (!bOldDisplayEffect &&  m_pOptions->bDisplayEffect))
957                    updateDisplayEffect();
958              if (sOldDisplayFont != m_pOptions->sDisplayFont)              if (sOldDisplayFont != m_pOptions->sDisplayFont)
959                  updateDisplayFont();                  updateDisplayFont();
960              if (iOldMaxVolume != m_pOptions->iMaxVolume)              if (iOldMaxVolume != m_pOptions->iMaxVolume)
# Line 1239  void qsamplerMainForm::updateDisplayFont Line 1222  void qsamplerMainForm::updateDisplayFont
1222  }  }
1223    
1224    
1225    // Update channel strips background effect.
1226    void qsamplerMainForm::updateDisplayEffect (void)
1227    {
1228       QPixmap pm;
1229        if (m_pOptions->bDisplayEffect)
1230            pm = QPixmap::fromMimeSource("displaybg1.png");
1231    
1232        // Full channel list update...
1233        QWidgetList wlist = m_pWorkspace->windowList();
1234        if (wlist.isEmpty())
1235            return;
1236    
1237        m_pWorkspace->setUpdatesEnabled(false);
1238        for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1239            qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1240            if (pChannelStrip)
1241                pChannelStrip->setDisplayBackground(pm);
1242        }
1243        m_pWorkspace->setUpdatesEnabled(true);
1244    }
1245    
1246    
1247  // Force update of the channels maximum volume setting.  // Force update of the channels maximum volume setting.
1248  void qsamplerMainForm::updateMaxVolume (void)  void qsamplerMainForm::updateMaxVolume (void)
1249  {  {
# Line 1353  void qsamplerMainForm::updateMessagesCap Line 1358  void qsamplerMainForm::updateMessagesCap
1358  // qsamplerMainForm -- MDI channel strip management.  // qsamplerMainForm -- MDI channel strip management.
1359    
1360  // The channel strip creation executive.  // The channel strip creation executive.
1361  void qsamplerMainForm::createChannel ( int iChannelID, bool bPrompt )  qsamplerChannelStrip *qsamplerMainForm::createChannelStrip ( int iChannelID )
1362  {  {
1363      if (m_pClient == NULL)      if (m_pClient == NULL)
1364          return;          return NULL;
1365    
1366      // Prepare for auto-arrange?      // Prepare for auto-arrange?
1367      qsamplerChannelStrip *pChannelStrip = NULL;      qsamplerChannelStrip *pChannelStrip = NULL;
# Line 1373  void qsamplerMainForm::createChannel ( i Line 1378  void qsamplerMainForm::createChannel ( i
1378      // Add a new channel itema...      // Add a new channel itema...
1379      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;
1380      pChannelStrip = new qsamplerChannelStrip(m_pWorkspace, 0, wflags);      pChannelStrip = new qsamplerChannelStrip(m_pWorkspace, 0, wflags);
1381      pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume);      // Actual channel setup.
1382      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.  
1383      QObject::connect(pChannelStrip, SIGNAL(channelChanged(qsamplerChannelStrip *)), this, SLOT(channelStripChanged(qsamplerChannelStrip *)));      QObject::connect(pChannelStrip, SIGNAL(channelChanged(qsamplerChannelStrip *)), this, SLOT(channelStripChanged(qsamplerChannelStrip *)));
1384      // Before we show it up, may be we'll      // Before we show it up, may be we'll
1385      // better ask for some initial values?      // better ask for some initial values?
1386      if (bPrompt)      if (iChannelID < 0 && !pChannelStrip->channelSetup()) {
1387          pChannelStrip->showChannelSetup(true);          // No luck, bail out...
1388            delete pChannelStrip;
1389            return NULL;
1390        }
1391    
1392        // Set some initial aesthetic options...
1393        if (m_pOptions) {
1394            // Background display effect...
1395            pChannelStrip->setDisplayEffect(m_pOptions->bDisplayEffect);
1396            // We'll need a display font.
1397            QFont font;
1398            if (font.fromString(m_pOptions->sDisplayFont))
1399                pChannelStrip->setDisplayFont(font);
1400            // Maximum allowed volume setting.
1401            pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume);
1402        }
1403    
1404      // Now we show up us to the world.      // Now we show up us to the world.
1405      pChannelStrip->show();      pChannelStrip->show();
1406      // Only then, we'll auto-arrange...      // Only then, we'll auto-arrange...
# Line 1394  void qsamplerMainForm::createChannel ( i Line 1410  void qsamplerMainForm::createChannel ( i
1410          int iHeight = pChannelStrip->parentWidget()->frameGeometry().height();          int iHeight = pChannelStrip->parentWidget()->frameGeometry().height();
1411          pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight);          pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight);
1412      }      }
1413        
1414        // Return our successful reference...
1415        return pChannelStrip;
1416  }  }
1417    
1418    

Legend:
Removed from v.264  
changed lines
  Added in v.295

  ViewVC Help
Powered by ViewVC