/[svn]/qsampler/trunk/src/qsamplerChannelStrip.ui.h
ViewVC logotype

Diff of /qsampler/trunk/src/qsamplerChannelStrip.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 341 by capela, Tue Jan 18 11:29:01 2005 UTC
# Line 2  Line 2 
2  //  //
3  // ui.h extension file, included from the uic-generated form implementation.  // ui.h extension file, included from the uic-generated form implementation.
4  /****************************************************************************  /****************************************************************************
5     Copyright (C) 2004, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2005, rncbc aka Rui Nuno Capela. All rights reserved.
6    
7     This program is free software; you can redistribute it and/or     This program is free software; you can redistribute it and/or
8     modify it under the terms of the GNU General Public License     modify it under the terms of the GNU General Public License
# Line 25  Line 25 
25  #include <qfileinfo.h>  #include <qfileinfo.h>
26  #include <qtooltip.h>  #include <qtooltip.h>
27  #include <qpopupmenu.h>  #include <qpopupmenu.h>
28    #include <qobjectlist.h>
29    
30  #include <math.h>  #include <math.h>
31    
# Line 38  Line 39 
39  void qsamplerChannelStrip::init (void)  void qsamplerChannelStrip::init (void)
40  {  {
41      // Initialize locals.      // Initialize locals.
     m_pMainForm    = NULL;  
42      m_pChannel     = NULL;      m_pChannel     = NULL;
43      m_iDirtyChange = 0;      m_iDirtyChange = 0;
44    
# Line 58  void qsamplerChannelStrip::destroy (void Line 58  void qsamplerChannelStrip::destroy (void
58    
59    
60  // Channel strip setup formal initializer.  // Channel strip setup formal initializer.
61  void qsamplerChannelStrip::setup ( qsamplerMainForm *pMainForm, int iChannelID )  void qsamplerChannelStrip::setup ( qsamplerChannel *pChannel )
62  {  {
63      // Set main form reference.      // Destroy any previous channel descriptor;
64      m_pMainForm = pMainForm;      // (remember that once setup we own it!)
       
     // Destroy any previous channel descriptor.  
65      if (m_pChannel)      if (m_pChannel)
66          delete m_pChannel;          delete m_pChannel;
67    
68      // Create a new one...      // Set the new one...
69      m_pChannel = new qsamplerChannel(pMainForm);      m_pChannel = pChannel;
70      // And set appropriate settings.  
     if (m_pChannel) {  
         m_pChannel->setChannelID(iChannelID);  
         m_iDirtyChange = 0;  
     }  
       
71      // Stabilize this around.      // Stabilize this around.
72      updateChannelInfo();      updateChannelInfo();
73  }  }
# Line 101  void qsamplerChannelStrip::setDisplayFon Line 94  void qsamplerChannelStrip::setDisplayFon
94  }  }
95    
96    
97  // Channel setup dialog slot.  // Channel display background effect.
98  void qsamplerChannelStrip::channelSetup (void)  void qsamplerChannelStrip::setDisplayEffect ( bool bDisplayEffect )
99  {  {
100      showChannelSetup(false);      QPixmap pm;
101        if (bDisplayEffect)
102            pm = QPixmap::fromMimeSource("displaybg1.png");
103        setDisplayBackground(pm);
104  }  }
105    
106    
107  // Channel setup dialog.  // Update main display background pixmap.
108  void qsamplerChannelStrip::showChannelSetup ( bool bNew )  void qsamplerChannelStrip::setDisplayBackground ( const QPixmap& pm )
109  {  {
110      qsamplerChannelForm *pChannelForm = new qsamplerChannelForm(this);      // Set the main origin...
111      if (pChannelForm) {      ChannelInfoFrame->setPaletteBackgroundPixmap(pm);
112          pChannelForm->setup(m_pChannel, bNew);  
113          if (pChannelForm->exec()) {      // Iterate for every child text label...
114              updateChannelInfo();      QObjectList *pList = ChannelInfoFrame->queryList("QLabel");
115              emit channelChanged(this);      if (pList) {
116          }          for (QLabel *pLabel = (QLabel *) pList->first(); pLabel; pLabel = (QLabel *) pList->next())
117          delete pChannelForm;              pLabel->setPaletteBackgroundPixmap(pm);
118            delete pList;
119      }      }
120        
121        // And this standalone too.
122        StreamVoiceCountTextLabel->setPaletteBackgroundPixmap(pm);
123    }
124    
125    
126    // Channel setup dialog slot.
127    bool qsamplerChannelStrip::channelSetup (void)
128    {
129        bool bResult = m_pChannel->channelSetup(this);
130    
131        if (bResult)
132            emit channelChanged(this);
133    
134        return bResult;
135  }  }
136    
137    
138  // Update whole channel info state.  // Update whole channel info state.
139  void qsamplerChannelStrip::updateChannelInfo (void)  bool qsamplerChannelStrip::updateChannelInfo (void)
140  {  {
141      if (m_pChannel == NULL)      if (m_pChannel == NULL)
142          return;          return false;
143                    
144      // Update strip caption.      // Update strip caption.
145      QString sText = tr("Channel %1").arg(m_pChannel->channelID());      QString sText = m_pChannel->channelName();
146      setCaption(sText);      setCaption(sText);
147      ChannelSetupPushButton->setText(sText);      ChannelSetupPushButton->setText(sText);
148    
149      // Check if we're up and connected.      // Check if we're up and connected.
150      if (m_pChannel->client() == NULL)      if (m_pChannel->client() == NULL)
151          return;          return false;
152    
153      // Read actual channel information.      // Read actual channel information.
154      m_pChannel->updateChannelInfo();      m_pChannel->updateChannelInfo();
# Line 154  void qsamplerChannelStrip::updateChannel Line 166  void qsamplerChannelStrip::updateChannel
166      if (m_pChannel->instrumentFile().isEmpty())      if (m_pChannel->instrumentFile().isEmpty())
167          InstrumentNameTextLabel->setText(sIndent + tr("(No instrument)"));          InstrumentNameTextLabel->setText(sIndent + tr("(No instrument)"));
168      else      else
169          InstrumentNameTextLabel->setText(sIndent + QString("%1 [%2]")          InstrumentNameTextLabel->setText(sIndent + qsamplerChannel::getInstrumentName(m_pChannel->instrumentFile(), m_pChannel->instrumentNr()));
             .arg(QFileInfo(m_pChannel->instrumentFile()).fileName()).arg(m_pChannel->instrumentNr()));  
170    
171      // Instrument status...      // Instrument status...
172      int iInstrumentStatus = m_pChannel->instrumentStatus();      int iInstrumentStatus = m_pChannel->instrumentStatus();
# Line 168  void qsamplerChannelStrip::updateChannel Line 179  void qsamplerChannelStrip::updateChannel
179      }      }
180    
181      // MIDI Port/Channel...      // MIDI Port/Channel...
182      if (m_pChannel->midiChannel() > 0)      if (m_pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL)
         MidiPortChannelTextLabel->setText(QString("%1 / %2").arg(m_pChannel->midiPort()).arg(m_pChannel->midiChannel()));  
     else  
183          MidiPortChannelTextLabel->setText(QString("%1 / *").arg(m_pChannel->midiPort()));          MidiPortChannelTextLabel->setText(QString("%1 / *").arg(m_pChannel->midiPort()));
184        else
185            MidiPortChannelTextLabel->setText(QString("%1 / %2").arg(m_pChannel->midiPort()).arg(m_pChannel->midiChannel() + 1));
186    
187      // And update the both GUI volume elements.      // And update the both GUI volume elements.
188      updateChannelVolume();      return updateChannelVolume();
189  }  }
190    
191    
192  // Do the dirty volume change.  // Do the dirty volume change.
193  void qsamplerChannelStrip::updateChannelVolume (void)  bool qsamplerChannelStrip::updateChannelVolume (void)
194  {  {
195      if (m_pChannel == NULL)      if (m_pChannel == NULL)
196          return;          return false;
197    
198      // Convert...      // Convert...
199  #ifdef CONFIG_ROUND  #ifdef CONFIG_ROUND
# Line 207  void qsamplerChannelStrip::updateChannel Line 218  void qsamplerChannelStrip::updateChannel
218      VolumeSlider->setValue(iVolume);      VolumeSlider->setValue(iVolume);
219      VolumeSpinBox->setValue(iVolume);      VolumeSpinBox->setValue(iVolume);
220      m_iDirtyChange--;      m_iDirtyChange--;
221        
222        return true;
223  }  }
224    
225    
226  // Update whole channel usage state.  // Update whole channel usage state.
227  void qsamplerChannelStrip::updateChannelUsage (void)  bool qsamplerChannelStrip::updateChannelUsage (void)
228  {  {
229      if (m_pChannel == NULL)      if (m_pChannel == NULL)
230          return;          return false;
231      if (m_pChannel->client() == NULL)      if (m_pChannel->client() == NULL)
232          return;          return false;
233    
234      // Conditionally update whole channel status info.      // Update whole channel status info,
235      if (m_pChannel->instrumentStatus() >= 0 && m_pChannel->instrumentStatus() < 100) {      // if instrument load is still pending...
236        if (m_pChannel->instrumentStatus() < 100) {
237          updateChannelInfo();          updateChannelInfo();
238          // Once we get a complete instrument load, try a implied reset channel....          // Check (updated) status again...
239          if (m_pChannel->instrumentStatus() == 100)          if (m_pChannel->instrumentStatus() < 100)
240              m_pChannel->resetChannel();              return false;
241            // Once we get a complete instrument load,
242            // we'll try an implied channel reset...
243            m_pChannel->resetChannel();
244      }      }
245      // Leave, if we still have an erroneus or incomplete instrument load.      
246        // Check again that we're clean.
247      if (m_pChannel->instrumentStatus() < 100)      if (m_pChannel->instrumentStatus() < 100)
248          return;          return false;
249    
250      // Get current channel voice count.      // Get current channel voice count.
251      int iVoiceCount  = ::lscp_get_channel_voice_count(m_pChannel->client(), m_pChannel->channelID());      int iVoiceCount  = ::lscp_get_channel_voice_count(m_pChannel->client(), m_pChannel->channelID());
# Line 241  void qsamplerChannelStrip::updateChannel Line 259  void qsamplerChannelStrip::updateChannel
259      // Update the GUI elements...      // Update the GUI elements...
260      StreamUsageProgressBar->setProgress(iStreamUsage);      StreamUsageProgressBar->setProgress(iStreamUsage);
261      StreamVoiceCountTextLabel->setText(QString("%1 / %2").arg(iStreamCount).arg(iVoiceCount));      StreamVoiceCountTextLabel->setText(QString("%1 / %2").arg(iStreamCount).arg(iVoiceCount));
262        
263        // We're clean.
264        return true;
265  }  }
266    
267    
# Line 270  void qsamplerChannelStrip::volumeChanged Line 291  void qsamplerChannelStrip::volumeChanged
291  // Context menu event handler.  // Context menu event handler.
292  void qsamplerChannelStrip::contextMenuEvent( QContextMenuEvent *pEvent )  void qsamplerChannelStrip::contextMenuEvent( QContextMenuEvent *pEvent )
293  {  {
294      if (m_pMainForm == NULL)      if (m_pChannel == NULL)
295          return;          return;
296                    
297      // We'll just show up the main form's edit menu.      // We'll just show up the main form's edit menu (thru qsamplerChannel).
298      m_pMainForm->contextMenuEvent(pEvent);      m_pChannel->contextMenuEvent(pEvent);
299  }  }
300    
301    

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

  ViewVC Help
Powered by ViewVC