/[svn]/qsampler/trunk/src/qsamplerMainForm.cpp
ViewVC logotype

Diff of /qsampler/trunk/src/qsamplerMainForm.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1509 by capela, Thu Nov 22 11:10:44 2007 UTC revision 1515 by capela, Fri Nov 23 18:15:33 2007 UTC
# Line 20  Line 20 
20    
21  *****************************************************************************/  *****************************************************************************/
22    
23    #include "qsamplerAbout.h"
24  #include "qsamplerMainForm.h"  #include "qsamplerMainForm.h"
25    
 #include "qsamplerAbout.h"  
26  #include "qsamplerOptions.h"  #include "qsamplerOptions.h"
27  #include "qsamplerChannel.h"  #include "qsamplerChannel.h"
28  #include "qsamplerMessages.h"  #include "qsamplerMessages.h"
# Line 171  MainForm::MainForm ( QWidget *pParent ) Line 171  MainForm::MainForm ( QWidget *pParent )
171          // Volume slider...          // Volume slider...
172          m_ui.channelsToolbar->addSeparator();          m_ui.channelsToolbar->addSeparator();
173          m_pVolumeSlider = new QSlider(Qt::Horizontal, m_ui.channelsToolbar);          m_pVolumeSlider = new QSlider(Qt::Horizontal, m_ui.channelsToolbar);
174          m_pVolumeSlider->setTickPosition(QSlider::TicksBelow);          m_pVolumeSlider->setTickPosition(QSlider::TicksBothSides);
175          m_pVolumeSlider->setTickInterval(10);          m_pVolumeSlider->setTickInterval(10);
176          m_pVolumeSlider->setPageStep(10);          m_pVolumeSlider->setPageStep(10);
177          m_pVolumeSlider->setSingleStep(10);          m_pVolumeSlider->setSingleStep(10);
# Line 189  MainForm::MainForm ( QWidget *pParent ) Line 189  MainForm::MainForm ( QWidget *pParent )
189          // Volume spin-box          // Volume spin-box
190          m_ui.channelsToolbar->addSeparator();          m_ui.channelsToolbar->addSeparator();
191          m_pVolumeSpinBox = new QSpinBox(m_ui.channelsToolbar);          m_pVolumeSpinBox = new QSpinBox(m_ui.channelsToolbar);
192            m_pVolumeSpinBox->setMaximumHeight(24);
193          m_pVolumeSpinBox->setSuffix(" %");          m_pVolumeSpinBox->setSuffix(" %");
194          m_pVolumeSpinBox->setMinimum(0);          m_pVolumeSpinBox->setMinimum(0);
195          m_pVolumeSpinBox->setMaximum(100);          m_pVolumeSpinBox->setMaximum(100);
# Line 205  MainForm::MainForm ( QWidget *pParent ) Line 206  MainForm::MainForm ( QWidget *pParent )
206          // Set the activation connection.          // Set the activation connection.
207          QObject::connect(m_pWorkspace,          QObject::connect(m_pWorkspace,
208                  SIGNAL(windowActivated(QWidget *)),                  SIGNAL(windowActivated(QWidget *)),
209                  SLOT(stabilizeForm()));                  SLOT(activateStrip(QWidget *)));
210          // Make it shine :-)          // Make it shine :-)
211          setCentralWidget(m_pWorkspace);          setCentralWidget(m_pWorkspace);
212    
# Line 238  MainForm::MainForm ( QWidget *pParent ) Line 239  MainForm::MainForm ( QWidget *pParent )
239          WSAStartup(MAKEWORD(1, 1), &_wsaData);          WSAStartup(MAKEWORD(1, 1), &_wsaData);
240  #endif  #endif
241    
242            // Some actions surely need those
243            // shortcuts firmly attached...
244            addAction(m_ui.viewMenubarAction);
245            addAction(m_ui.viewToolbarAction);
246    
247          QObject::connect(m_ui.fileNewAction,          QObject::connect(m_ui.fileNewAction,
248                  SIGNAL(triggered()),                  SIGNAL(triggered()),
249                  SLOT(fileNew()));                  SLOT(fileNew()));
# Line 1326  void MainForm::editAddChannel (void) Line 1332  void MainForm::editAddChannel (void)
1332                  return;                  return;
1333          }          }
1334    
1335            // Do we auto-arrange?
1336            if (m_pOptions && m_pOptions->bAutoArrange)
1337                    channelsArrange();
1338    
1339          // Make that an overall update.          // Make that an overall update.
1340          m_iDirtyCount++;          m_iDirtyCount++;
1341          stabilizeForm();          stabilizeForm();
# Line 2166  void MainForm::updateMessagesCapture (vo Line 2176  void MainForm::updateMessagesCapture (vo
2176  // qsamplerMainForm -- MDI channel strip management.  // qsamplerMainForm -- MDI channel strip management.
2177    
2178  // The channel strip creation executive.  // The channel strip creation executive.
2179  ChannelStrip* MainForm::createChannelStrip(qsamplerChannel* pChannel)  ChannelStrip* MainForm::createChannelStrip ( qsamplerChannel *pChannel )
2180  {  {
2181          if (m_pClient == NULL || pChannel == NULL)          if (m_pClient == NULL || pChannel == NULL)
2182                  return NULL;                  return NULL;
2183    
         // Prepare for auto-arrange?  
         ChannelStrip* pChannelStrip = NULL;  
         int y = 0;  
         if (m_pOptions && m_pOptions->bAutoArrange) {  
                 QWidgetList wlist = m_pWorkspace->windowList();  
                 for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {  
                         pChannelStrip = static_cast<ChannelStrip *> (wlist.at(iChannel));  
                         if (pChannelStrip) {  
                         //  y += pChannelStrip->height()  
                         //              + pChannelStrip->parentWidget()->baseSize().height();  
                                 y += pChannelStrip->parentWidget()->frameGeometry().height();  
                         }  
                 }  
         }  
   
2184          // Add a new channel itema...          // Add a new channel itema...
2185          pChannelStrip = new ChannelStrip();          ChannelStrip *pChannelStrip = new ChannelStrip();
2186          if (pChannelStrip == NULL)          if (pChannelStrip == NULL)
2187                  return NULL;                  return NULL;
2188    
2189          m_pWorkspace->addWindow(pChannelStrip, Qt::FramelessWindowHint);          // Set some initial channel strip options...
   
         // Actual channel strip setup...  
         pChannelStrip->setup(pChannel);  
         QObject::connect(pChannelStrip,  
                 SIGNAL(channelChanged(ChannelStrip*)),  
                 SLOT(channelStripChanged(ChannelStrip*)));  
         // Set some initial aesthetic options...  
2190          if (m_pOptions) {          if (m_pOptions) {
2191                  // Background display effect...                  // Background display effect...
2192                  pChannelStrip->setDisplayEffect(m_pOptions->bDisplayEffect);                  pChannelStrip->setDisplayEffect(m_pOptions->bDisplayEffect);
# Line 2210  ChannelStrip* MainForm::createChannelStr Line 2198  ChannelStrip* MainForm::createChannelStr
2198                  pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume);                  pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume);
2199          }          }
2200    
2201            // Add it to workspace...
2202            m_pWorkspace->addWindow(pChannelStrip, Qt::FramelessWindowHint);
2203    
2204            // Actual channel strip setup...
2205            pChannelStrip->setup(pChannel);
2206    
2207            QObject::connect(pChannelStrip,
2208                    SIGNAL(channelChanged(ChannelStrip*)),
2209                    SLOT(channelStripChanged(ChannelStrip*)));
2210    
2211          // Now we show up us to the world.          // Now we show up us to the world.
2212          pChannelStrip->show();          pChannelStrip->show();
         // Only then, we'll auto-arrange...  
         if (m_pOptions && m_pOptions->bAutoArrange) {  
                 int iWidth  = m_pWorkspace->width();  
         //  int iHeight = pChannel->height()  
         //              + pChannel->parentWidget()->baseSize().height();  
                 int iHeight = pChannelStrip->parentWidget()->frameGeometry().height();  
                 pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight);  
         }  
2213    
2214          // This is pretty new, so we'll watch for it closely.          // This is pretty new, so we'll watch for it closely.
2215          channelStripChanged(pChannelStrip);          channelStripChanged(pChannelStrip);
# Line 2658  void MainForm::stopClient (void) Line 2648  void MainForm::stopClient (void)
2648          stabilizeForm();          stabilizeForm();
2649  }  }
2650    
2651    
2652    // Channel strip activation/selection.
2653    void MainForm::activateStrip ( QWidget *pWidget )
2654    {
2655            ChannelStrip *pChannelStrip
2656                    = static_cast<ChannelStrip *> (pWidget);
2657            if (pChannelStrip)
2658                    pChannelStrip->setSelected(true);
2659    
2660            stabilizeForm();
2661    }
2662    
2663    
2664  } // namespace QSampler  } // namespace QSampler
2665    
2666    

Legend:
Removed from v.1509  
changed lines
  Added in v.1515

  ViewVC Help
Powered by ViewVC