/[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 391 by capela, Fri Feb 18 10:28:45 2005 UTC revision 395 by capela, Sun Feb 20 19:13:33 2005 UTC
# Line 317  bool qsamplerMainForm::decodeDragFiles ( Line 317  bool qsamplerMainForm::decodeDragFiles (
317  // Window drag-n-drop event handlers.  // Window drag-n-drop event handlers.
318  void qsamplerMainForm::dragEnterEvent ( QDragEnterEvent* pDragEnterEvent )  void qsamplerMainForm::dragEnterEvent ( QDragEnterEvent* pDragEnterEvent )
319  {  {
320      QStringList files;          QStringList files;
321            pDragEnterEvent->accept(decodeDragFiles(pDragEnterEvent, files));
     pDragEnterEvent->accept(decodeDragFiles(pDragEnterEvent, files));  
322  }  }
323    
324    
# Line 424  bool qsamplerMainForm::newSession (void) Line 423  bool qsamplerMainForm::newSession (void)
423      if (!closeSession(true))      if (!closeSession(true))
424          return false;          return false;
425    
426            // Give us what the server has, right now...
427            updateSession();
428    
429      // Ok increment untitled count.      // Ok increment untitled count.
430      m_iUntitled++;      m_iUntitled++;
431    
# Line 596  bool qsamplerMainForm::loadSessionFile ( Line 598  bool qsamplerMainForm::loadSessionFile (
598      if (iErrors > 0)      if (iErrors > 0)
599          appendMessagesError(tr("Session could not be loaded\nfrom \"%1\".\n\nSorry.").arg(sFilename));          appendMessagesError(tr("Session could not be loaded\nfrom \"%1\".\n\nSorry.").arg(sFilename));
600    
601      // Now we'll try to create the whole GUI session.          // Now we'll try to create (update) the whole GUI session.
602      int *piChannelIDs = ::lscp_list_channels(m_pClient);          updateSession();
     if (piChannelIDs == NULL) {  
         appendMessagesClient("lscp_list_channels");  
         appendMessagesError(tr("Could not get current list of channels.\n\nSorry."));  
     } else {  
                 // Try to (re)create each channel.  
                 m_pWorkspace->setUpdatesEnabled(false);  
                 for (int iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) {  
                         createChannelStrip(new qsamplerChannel(this, piChannelIDs[iChannel]));  
                         QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);  
                 }  
                 m_pWorkspace->setUpdatesEnabled(true);  
         }  
603    
604      // Save as default session directory.      // Save as default session directory.
605      if (m_pOptions)      if (m_pOptions)
# Line 774  void qsamplerMainForm::fileReset (void) Line 764  void qsamplerMainForm::fileReset (void)
764    
765      // Log this.      // Log this.
766      appendMessages(tr("Sampler reset."));      appendMessages(tr("Sampler reset."));
767    
768            // Make it a new session...
769            newSession();
770  }  }
771    
772    
# Line 1230  void qsamplerMainForm::channelStripChang Line 1223  void qsamplerMainForm::channelStripChang
1223  }  }
1224    
1225    
1226    // Grab and restore current sampler channels session.
1227    void qsamplerMainForm::updateSession (void)
1228    {
1229            // Retrieve the current channel list.
1230            int *piChannelIDs = ::lscp_list_channels(m_pClient);
1231            if (piChannelIDs == NULL) {
1232                    if (::lscp_client_get_errno(m_pClient)) {
1233                            appendMessagesClient("lscp_list_channels");
1234                            appendMessagesError(tr("Could not get current list of channels.\n\nSorry."));
1235                    }
1236                    return;
1237            }
1238    
1239            // Try to (re)create each channel.
1240            m_pWorkspace->setUpdatesEnabled(false);
1241            for (int iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) {
1242                    // Check if theres already a channel strip for this one...
1243                    if (!channelStrip(piChannelIDs[iChannel]))
1244                            createChannelStrip(new qsamplerChannel(this, piChannelIDs[iChannel]));
1245                    // Make it visibly responsive...
1246                    QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
1247            }
1248            m_pWorkspace->setUpdatesEnabled(true);
1249    }
1250    
1251    
1252  // Update the recent files list and menu.  // Update the recent files list and menu.
1253  void qsamplerMainForm::updateRecentFiles ( const QString& sFilename )  void qsamplerMainForm::updateRecentFiles ( const QString& sFilename )
1254  {  {
# Line 1469  qsamplerChannelStrip *qsamplerMainForm:: Line 1488  qsamplerChannelStrip *qsamplerMainForm::
1488          QWidgetList wlist = m_pWorkspace->windowList();          QWidgetList wlist = m_pWorkspace->windowList();
1489          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1490              pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);              pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1491          //  y += pChannelStrip->height() + pChannelStrip->parentWidget()->baseSize().height();                          if (pChannelStrip) {
1492              y += pChannelStrip->parentWidget()->frameGeometry().height();                          //  y += pChannelStrip->height() + pChannelStrip->parentWidget()->baseSize().height();
1493                                    y += pChannelStrip->parentWidget()->frameGeometry().height();
1494                            }
1495          }          }
1496      }      }
1497    
# Line 1522  qsamplerChannelStrip *qsamplerMainForm:: Line 1543  qsamplerChannelStrip *qsamplerMainForm::
1543  {  {
1544      QWidgetList wlist = m_pWorkspace->windowList();      QWidgetList wlist = m_pWorkspace->windowList();
1545      if (wlist.isEmpty())      if (wlist.isEmpty())
1546          return 0;          return NULL;
1547    
1548      return (qsamplerChannelStrip *) wlist.at(iChannel);      return (qsamplerChannelStrip *) wlist.at(iChannel);
1549  }  }
1550    
1551    
1552    // Retrieve a channel strip by sampler channel id.
1553    qsamplerChannelStrip *qsamplerMainForm::channelStrip ( int iChannelID )
1554    {
1555            QWidgetList wlist = m_pWorkspace->windowList();
1556            if (wlist.isEmpty())
1557                    return NULL;
1558            
1559            for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1560                    qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1561                    if (pChannelStrip) {
1562                            qsamplerChannel *pChannel = pChannelStrip->channel();
1563                            if (pChannel && pChannel->channelID() == iChannelID)
1564                                    return pChannelStrip;
1565                    }
1566            }
1567    
1568            // Not found.
1569            return NULL;
1570    }
1571    
1572    
1573  // Construct the windows menu.  // Construct the windows menu.
1574  void qsamplerMainForm::channelsMenuAboutToShow (void)  void qsamplerMainForm::channelsMenuAboutToShow (void)
1575  {  {

Legend:
Removed from v.391  
changed lines
  Added in v.395

  ViewVC Help
Powered by ViewVC