/[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 2077 by capela, Wed Mar 31 09:07:30 2010 UTC revision 2717 by schoenebeck, Wed Jan 21 13:19:51 2015 UTC
# Line 1  Line 1 
1  // qsamplerMainForm.cpp  // qsamplerMainForm.cpp
2  //  //
3  /****************************************************************************  /****************************************************************************
4     Copyright (C) 2004-2010, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2014, rncbc aka Rui Nuno Capela. All rights reserved.
5     Copyright (C) 2007, 2008 Christian Schoenebeck     Copyright (C) 2007, 2008 Christian Schoenebeck
6    
7     This program is free software; you can redistribute it and/or     This program is free software; you can redistribute it and/or
# Line 35  Line 35 
35  #include "qsamplerOptionsForm.h"  #include "qsamplerOptionsForm.h"
36  #include "qsamplerDeviceStatusForm.h"  #include "qsamplerDeviceStatusForm.h"
37    
38    #include <QMdiArea>
39    #include <QMdiSubWindow>
40    
41  #include <QApplication>  #include <QApplication>
 #include <QWorkspace>  
42  #include <QProcess>  #include <QProcess>
43  #include <QMessageBox>  #include <QMessageBox>
44    
# Line 56  Line 58 
58  #include <QTimer>  #include <QTimer>
59  #include <QDateTime>  #include <QDateTime>
60    
61    #if QT_VERSION >= 0x050000
62    #include <QMimeData>
63    #endif
64    
65  #if QT_VERSION < 0x040500  #if QT_VERSION < 0x040500
66  namespace Qt {  namespace Qt {
67  const WindowFlags WindowCloseButtonHint = WindowFlags(0x08000000);  const WindowFlags WindowCloseButtonHint = WindowFlags(0x08000000);
 #if QT_VERSION < 0x040200  
 const WindowFlags CustomizeWindowHint   = WindowFlags(0x02000000);  
 #endif  
68  }  }
69  #endif  #endif
70    
# Line 93  static WSADATA _wsaData; Line 96  static WSADATA _wsaData;
96  #endif  #endif
97    
98    
99    //-------------------------------------------------------------------------
100    // LADISH Level 1 support stuff.
101    
102    #if defined(HAVE_SIGNAL_H) && defined(HAVE_SYS_SOCKET_H)
103    
104    #include <QSocketNotifier>
105    
106    #include <sys/types.h>
107    #include <sys/socket.h>
108    
109    #include <signal.h>
110    
111    // File descriptor for SIGUSR1 notifier.
112    static int g_fdUsr1[2];
113    
114    // Unix SIGUSR1 signal handler.
115    static void qsampler_sigusr1_handler ( int /* signo */ )
116    {
117            char c = 1;
118    
119            (::write(g_fdUsr1[0], &c, sizeof(c)) > 0);
120    }
121    
122    #endif  // HAVE_SIGNAL_H
123    
124    
125    //-------------------------------------------------------------------------
126    // qsampler -- namespace
127    
128    
129  namespace QSampler {  namespace QSampler {
130    
131  // Timer constant stuff.  // Timer constant stuff.
# Line 107  namespace QSampler { Line 140  namespace QSampler {
140    
141  // Specialties for thread-callback comunication.  // Specialties for thread-callback comunication.
142  #define QSAMPLER_LSCP_EVENT   QEvent::Type(QEvent::User + 1)  #define QSAMPLER_LSCP_EVENT   QEvent::Type(QEvent::User + 1)
 #define QSAMPLER_SAVE_EVENT   QEvent::Type(QEvent::User + 2)  
143    
144    
145  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
# Line 140  private: Line 172  private:
172    
173    
174  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
 // LADISH Level 1 support stuff.  
   
 void qsampler_on_sigusr1 ( int /*signo*/ )  
 {  
         QApplication::postEvent(  
                 MainForm::getInstance(),  
                 new QEvent(QSAMPLER_SAVE_EVENT));  
 }  
   
   
 //-------------------------------------------------------------------------  
175  // qsamplerMainForm -- Main window form implementation.  // qsamplerMainForm -- Main window form implementation.
176    
177  // Kind of singleton reference.  // Kind of singleton reference.
# Line 184  MainForm::MainForm ( QWidget *pParent ) Line 205  MainForm::MainForm ( QWidget *pParent )
205    
206          m_iTimerSlot = 0;          m_iTimerSlot = 0;
207    
208  #ifdef HAVE_SIGNAL_H  #if defined(HAVE_SIGNAL_H) && defined(HAVE_SYS_SOCKET_H)
209    
210          // Set to ignore any fatal "Broken pipe" signals.          // Set to ignore any fatal "Broken pipe" signals.
211          ::signal(SIGPIPE, SIG_IGN);          ::signal(SIGPIPE, SIG_IGN);
212    
213          // LADISH Level 1 suport.          // LADISH Level 1 suport.
214          ::signal(SIGUSR1, qsampler_on_sigusr1);  
215  #endif          // Initialize file descriptors for SIGUSR1 socket notifier.
216            ::socketpair(AF_UNIX, SOCK_STREAM, 0, g_fdUsr1);
217            m_pUsr1Notifier
218                    = new QSocketNotifier(g_fdUsr1[1], QSocketNotifier::Read, this);
219    
220            QObject::connect(m_pUsr1Notifier,
221                    SIGNAL(activated(int)),
222                    SLOT(handle_sigusr1()));
223    
224            // Install SIGUSR1 signal handler.
225        struct sigaction usr1;
226        usr1.sa_handler = qsampler_sigusr1_handler;
227        sigemptyset(&usr1.sa_mask);
228        usr1.sa_flags = 0;
229        usr1.sa_flags |= SA_RESTART;
230        ::sigaction(SIGUSR1, &usr1, NULL);
231    
232    #else   // HAVE_SIGNAL_H
233    
234            m_pUsr1Notifier = NULL;
235            
236    #endif  // !HAVE_SIGNAL_H
237    
238  #ifdef CONFIG_VOLUME  #ifdef CONFIG_VOLUME
239          // Make some extras into the toolbar...          // Make some extras into the toolbar...
# Line 210  MainForm::MainForm ( QWidget *pParent ) Line 254  MainForm::MainForm ( QWidget *pParent )
254          QObject::connect(m_pVolumeSlider,          QObject::connect(m_pVolumeSlider,
255                  SIGNAL(valueChanged(int)),                  SIGNAL(valueChanged(int)),
256                  SLOT(volumeChanged(int)));                  SLOT(volumeChanged(int)));
         //m_ui.channelsToolbar->setHorizontallyStretchable(true);  
         //m_ui.channelsToolbar->setStretchableWidget(m_pVolumeSlider);  
257          m_ui.channelsToolbar->addWidget(m_pVolumeSlider);          m_ui.channelsToolbar->addWidget(m_pVolumeSlider);
258          // Volume spin-box          // Volume spin-box
259          m_ui.channelsToolbar->addSeparator();          m_ui.channelsToolbar->addSeparator();
260          m_pVolumeSpinBox = new QSpinBox(m_ui.channelsToolbar);          m_pVolumeSpinBox = new QSpinBox(m_ui.channelsToolbar);
         m_pVolumeSpinBox->setMaximumHeight(24);  
261          m_pVolumeSpinBox->setSuffix(" %");          m_pVolumeSpinBox->setSuffix(" %");
262          m_pVolumeSpinBox->setMinimum(0);          m_pVolumeSpinBox->setMinimum(0);
263          m_pVolumeSpinBox->setMaximum(100);          m_pVolumeSpinBox->setMaximum(100);
# Line 228  MainForm::MainForm ( QWidget *pParent ) Line 269  MainForm::MainForm ( QWidget *pParent )
269  #endif  #endif
270    
271          // Make it an MDI workspace.          // Make it an MDI workspace.
272          m_pWorkspace = new QWorkspace(this);          m_pWorkspace = new QMdiArea(this);
273          m_pWorkspace->setScrollBarsEnabled(true);          m_pWorkspace->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
274            m_pWorkspace->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
275          // Set the activation connection.          // Set the activation connection.
276          QObject::connect(m_pWorkspace,          QObject::connect(m_pWorkspace,
277                  SIGNAL(windowActivated(QWidget *)),                  SIGNAL(subWindowActivated(QMdiSubWindow *)),
278                  SLOT(activateStrip(QWidget *)));                  SLOT(activateStrip(QMdiSubWindow *)));
279          // Make it shine :-)          // Make it shine :-)
280          setCentralWidget(m_pWorkspace);          setCentralWidget(m_pWorkspace);
281    
# Line 350  MainForm::MainForm ( QWidget *pParent ) Line 392  MainForm::MainForm ( QWidget *pParent )
392          QObject::connect(m_ui.channelsMenu,          QObject::connect(m_ui.channelsMenu,
393                  SIGNAL(aboutToShow()),                  SIGNAL(aboutToShow()),
394                  SLOT(channelsMenuAboutToShow()));                  SLOT(channelsMenuAboutToShow()));
395    #ifdef CONFIG_VOLUME
396            QObject::connect(m_ui.channelsToolbar,
397                    SIGNAL(orientationChanged(Qt::Orientation)),
398                    SLOT(channelsToolbarOrientation(Qt::Orientation)));
399    #endif
400  }  }
401    
402  // Destructor.  // Destructor.
# Line 362  MainForm::~MainForm() Line 409  MainForm::~MainForm()
409          WSACleanup();          WSACleanup();
410  #endif  #endif
411    
412    #if defined(HAVE_SIGNAL_H) && defined(HAVE_SYS_SOCKET_H)
413            if (m_pUsr1Notifier)
414                    delete m_pUsr1Notifier;
415    #endif
416    
417          // Finally drop any widgets around...          // Finally drop any widgets around...
418          if (m_pDeviceForm)          if (m_pDeviceForm)
419                  delete m_pDeviceForm;                  delete m_pDeviceForm;
# Line 545  void MainForm::dropEvent ( QDropEvent* p Line 597  void MainForm::dropEvent ( QDropEvent* p
597                  QListIterator<QUrl> iter(pMimeData->urls());                  QListIterator<QUrl> iter(pMimeData->urls());
598                  while (iter.hasNext()) {                  while (iter.hasNext()) {
599                          const QString& sPath = iter.next().toLocalFile();                          const QString& sPath = iter.next().toLocalFile();
600                          if (Channel::isInstrumentFile(sPath)) {                  //      if (Channel::isDlsInstrumentFile(sPath)) {
601                            if (QFileInfo(sPath).exists()) {
602                                  // Try to create a new channel from instrument file...                                  // Try to create a new channel from instrument file...
603                                  Channel *pChannel = new Channel();                                  Channel *pChannel = new Channel();
604                                  if (pChannel == NULL)                                  if (pChannel == NULL)
# Line 637  void MainForm::customEvent ( QEvent* pEv Line 690  void MainForm::customEvent ( QEvent* pEv
690                                          .arg(::lscp_event_to_text(pLscpEvent->event()))                                          .arg(::lscp_event_to_text(pLscpEvent->event()))
691                                          .arg(pLscpEvent->data()), "#996699");                                          .arg(pLscpEvent->data()), "#996699");
692                  }                  }
693          }       // LADISH1 Level 1 support...          }
694          else if (pEvent->type() == QSAMPLER_SAVE_EVENT)  }
695    
696    
697    // LADISH Level 1 -- SIGUSR1 signal handler.
698    void MainForm::handle_sigusr1 (void)
699    {
700    #if defined(HAVE_SIGNAL_H) && defined(HAVE_SYS_SOCKET_H)
701    
702            char c;
703    
704            if (::read(g_fdUsr1[1], &c, sizeof(c)) > 0)
705                  saveSession(false);                  saveSession(false);
706    
707    #endif
708  }  }
709    
710    
# Line 831  bool MainForm::closeSession ( bool bForc Line 896  bool MainForm::closeSession ( bool bForc
896          if (bClose) {          if (bClose) {
897                  // Remove all channel strips from sight...                  // Remove all channel strips from sight...
898                  m_pWorkspace->setUpdatesEnabled(false);                  m_pWorkspace->setUpdatesEnabled(false);
899                  QWidgetList wlist = m_pWorkspace->windowList();                  QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();
900                  for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {                  for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {
901                          ChannelStrip *pChannelStrip = (ChannelStrip*) wlist.at(iChannel);                          ChannelStrip *pChannelStrip = NULL;
902                            QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);
903                            if (pMdiSubWindow)
904                                    pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
905                          if (pChannelStrip) {                          if (pChannelStrip) {
906                                  Channel *pChannel = pChannelStrip->channel();                                  Channel *pChannel = pChannelStrip->channel();
907                                  if (bForce && pChannel)                                  if (bForce && pChannel)
908                                          pChannel->removeChannel();                                          pChannel->removeChannel();
909                                  delete pChannelStrip;                                  delete pChannelStrip;
910                          }                          }
911                            if (pMdiSubWindow)
912                                    delete pMdiSubWindow;
913                  }                  }
914                  m_pWorkspace->setUpdatesEnabled(true);                  m_pWorkspace->setUpdatesEnabled(true);
915                  // We're now clean, for sure.                  // We're now clean, for sure.
# Line 1130  bool MainForm::saveSessionFile ( const Q Line 1200  bool MainForm::saveSessionFile ( const Q
1200  #endif  // CONFIG_MIDI_INSTRUMENT  #endif  // CONFIG_MIDI_INSTRUMENT
1201    
1202          // Sampler channel mapping.          // Sampler channel mapping.
1203          QWidgetList wlist = m_pWorkspace->windowList();          QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();
1204          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {
1205                  ChannelStrip* pChannelStrip                  ChannelStrip *pChannelStrip = NULL;
1206                          = static_cast<ChannelStrip *> (wlist.at(iChannel));                  QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);
1207                    if (pMdiSubWindow)
1208                            pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
1209                  if (pChannelStrip) {                  if (pChannelStrip) {
1210                          Channel *pChannel = pChannelStrip->channel();                          Channel *pChannel = pChannelStrip->channel();
1211                          if (pChannel) {                          if (pChannel) {
# Line 1181  bool MainForm::saveSessionFile ( const Q Line 1253  bool MainForm::saveSessionFile ( const Q
1253                                          ts << "SET CHANNEL MUTE " << iChannel << " 1" << endl;                                          ts << "SET CHANNEL MUTE " << iChannel << " 1" << endl;
1254                                  if (pChannel->channelSolo())                                  if (pChannel->channelSolo())
1255                                          ts << "SET CHANNEL SOLO " << iChannel << " 1" << endl;                                          ts << "SET CHANNEL SOLO " << iChannel << " 1" << endl;
1256  #ifdef CONFIG_MIDI_INSTRUMENT                          #ifdef CONFIG_MIDI_INSTRUMENT
1257                                  if (pChannel->midiMap() >= 0) {                                  if (pChannel->midiMap() >= 0) {
1258                                          ts << "SET CHANNEL MIDI_INSTRUMENT_MAP " << iChannel                                          ts << "SET CHANNEL MIDI_INSTRUMENT_MAP " << iChannel
1259                                                  << " " << midiInstrumentMap[pChannel->midiMap()] << endl;                                                  << " " << midiInstrumentMap[pChannel->midiMap()] << endl;
1260                                  }                                  }
1261  #endif                          #endif
1262  #ifdef CONFIG_FXSEND                          #ifdef CONFIG_FXSEND
1263                                  int iChannelID = pChannel->channelID();                                  int iChannelID = pChannel->channelID();
1264                                  int *piFxSends = ::lscp_list_fxsends(m_pClient, iChannelID);                                  int *piFxSends = ::lscp_list_fxsends(m_pClient, iChannelID);
1265                                  for (int iFxSend = 0;                                  for (int iFxSend = 0;
# Line 1211  bool MainForm::saveSessionFile ( const Q Line 1283  bool MainForm::saveSessionFile ( const Q
1283                                                                  << " " << iAudioSrc                                                                  << " " << iAudioSrc
1284                                                                  << " " << piRouting[iAudioSrc] << endl;                                                                  << " " << piRouting[iAudioSrc] << endl;
1285                                                  }                                                  }
1286  #ifdef CONFIG_FXSEND_LEVEL                                          #ifdef CONFIG_FXSEND_LEVEL
1287                                                  ts << "SET FX_SEND LEVEL " << iChannel                                                  ts << "SET FX_SEND LEVEL " << iChannel
1288                                                          << " " << iFxSend                                                          << " " << iFxSend
1289                                                          << " " << pFxSendInfo->level << endl;                                                          << " " << pFxSendInfo->level << endl;
1290  #endif                                          #endif
1291                                          }       // Check for errors...                                          }       // Check for errors...
1292                                          else if (::lscp_client_get_errno(m_pClient)) {                                          else if (::lscp_client_get_errno(m_pClient)) {
1293                                                  appendMessagesClient("lscp_get_fxsend_info");                                                  appendMessagesClient("lscp_get_fxsend_info");
1294                                                  iErrors++;                                                  iErrors++;
1295                                          }                                          }
1296                                  }                                  }
1297  #endif                          #endif
1298                                  ts << endl;                                  ts << endl;
1299                          }                          }
1300                  }                  }
# Line 1447  void MainForm::editRemoveChannel (void) Line 1519  void MainForm::editRemoveChannel (void)
1519          if (m_pClient == NULL)          if (m_pClient == NULL)
1520                  return;                  return;
1521    
1522          ChannelStrip* pChannelStrip = activeChannelStrip();          ChannelStrip *pChannelStrip = activeChannelStrip();
1523          if (pChannelStrip == NULL)          if (pChannelStrip == NULL)
1524                  return;                  return;
1525    
# Line 1472  void MainForm::editRemoveChannel (void) Line 1544  void MainForm::editRemoveChannel (void)
1544          if (!pChannel->removeChannel())          if (!pChannel->removeChannel())
1545                  return;                  return;
1546    
         // Just delete the channel strip.  
         delete pChannelStrip;  
   
         // Do we auto-arrange?  
         if (m_pOptions && m_pOptions->bAutoArrange)  
                 channelsArrange();  
   
1547          // We'll be dirty, for sure...          // We'll be dirty, for sure...
1548          m_iDirtyCount++;          m_iDirtyCount++;
1549          stabilizeForm();  
1550            // Just delete the channel strip.
1551            destroyChannelStrip(pChannelStrip);
1552  }  }
1553    
1554    
# Line 1491  void MainForm::editSetupChannel (void) Line 1558  void MainForm::editSetupChannel (void)
1558          if (m_pClient == NULL)          if (m_pClient == NULL)
1559                  return;                  return;
1560    
1561          ChannelStrip* pChannelStrip = activeChannelStrip();          ChannelStrip *pChannelStrip = activeChannelStrip();
1562          if (pChannelStrip == NULL)          if (pChannelStrip == NULL)
1563                  return;                  return;
1564    
# Line 1506  void MainForm::editEditChannel (void) Line 1573  void MainForm::editEditChannel (void)
1573          if (m_pClient == NULL)          if (m_pClient == NULL)
1574                  return;                  return;
1575    
1576          ChannelStrip* pChannelStrip = activeChannelStrip();          ChannelStrip *pChannelStrip = activeChannelStrip();
1577          if (pChannelStrip == NULL)          if (pChannelStrip == NULL)
1578                  return;                  return;
1579    
# Line 1521  void MainForm::editResetChannel (void) Line 1588  void MainForm::editResetChannel (void)
1588          if (m_pClient == NULL)          if (m_pClient == NULL)
1589                  return;                  return;
1590    
1591          ChannelStrip* pChannelStrip = activeChannelStrip();          ChannelStrip *pChannelStrip = activeChannelStrip();
1592          if (pChannelStrip == NULL)          if (pChannelStrip == NULL)
1593                  return;                  return;
1594    
# Line 1539  void MainForm::editResetAllChannels (voi Line 1606  void MainForm::editResetAllChannels (voi
1606          // Invoque the channel strip procedure,          // Invoque the channel strip procedure,
1607          // for all channels out there...          // for all channels out there...
1608          m_pWorkspace->setUpdatesEnabled(false);          m_pWorkspace->setUpdatesEnabled(false);
1609          QWidgetList wlist = m_pWorkspace->windowList();          QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();
1610          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {
1611                  ChannelStrip* pChannelStrip = (ChannelStrip*) wlist.at(iChannel);                  ChannelStrip *pChannelStrip = NULL;
1612                    QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);
1613                    if (pMdiSubWindow)
1614                            pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
1615                  if (pChannelStrip)                  if (pChannelStrip)
1616                          pChannelStrip->channelReset();                          pChannelStrip->channelReset();
1617          }          }
# Line 1644  void MainForm::viewOptions (void) Line 1714  void MainForm::viewOptions (void)
1714          OptionsForm* pOptionsForm = new OptionsForm(this);          OptionsForm* pOptionsForm = new OptionsForm(this);
1715          if (pOptionsForm) {          if (pOptionsForm) {
1716                  // Check out some initial nullities(tm)...                  // Check out some initial nullities(tm)...
1717                  ChannelStrip* pChannelStrip = activeChannelStrip();                  ChannelStrip *pChannelStrip = activeChannelStrip();
1718                  if (m_pOptions->sDisplayFont.isEmpty() && pChannelStrip)                  if (m_pOptions->sDisplayFont.isEmpty() && pChannelStrip)
1719                          m_pOptions->sDisplayFont = pChannelStrip->displayFont().toString();                          m_pOptions->sDisplayFont = pChannelStrip->displayFont().toString();
1720                  if (m_pOptions->sMessagesFont.isEmpty() && m_pMessages)                  if (m_pOptions->sMessagesFont.isEmpty() && m_pMessages)
# Line 1737  void MainForm::viewOptions (void) Line 1807  void MainForm::viewOptions (void)
1807  void MainForm::channelsArrange (void)  void MainForm::channelsArrange (void)
1808  {  {
1809          // Full width vertical tiling          // Full width vertical tiling
1810          QWidgetList wlist = m_pWorkspace->windowList();          QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();
1811          if (wlist.isEmpty())          if (wlist.isEmpty())
1812                  return;                  return;
1813    
1814          m_pWorkspace->setUpdatesEnabled(false);          m_pWorkspace->setUpdatesEnabled(false);
1815          int y = 0;          int y = 0;
1816          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {
1817                  ChannelStrip* pChannelStrip = (ChannelStrip*) wlist.at(iChannel);                  ChannelStrip *pChannelStrip = NULL;
1818          /*  if (pChannelStrip->testWState(WState_Maximized | WState_Minimized)) {                  QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);
1819                          // Prevent flicker...                  if (pMdiSubWindow)
1820                          pChannelStrip->hide();                          pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
1821                          pChannelStrip->showNormal();                  if (pChannelStrip) {
1822                  }   */                  /*  if (pChannelStrip->testWState(WState_Maximized | WState_Minimized)) {
1823                  pChannelStrip->adjustSize();                                  // Prevent flicker...
1824                  int iWidth  = m_pWorkspace->width();                                  pChannelStrip->hide();
1825                  if (iWidth < pChannelStrip->width())                                  pChannelStrip->showNormal();
1826                          iWidth = pChannelStrip->width();                          }   */
1827          //  int iHeight = pChannelStrip->height()                          pChannelStrip->adjustSize();
1828          //              + pChannelStrip->parentWidget()->baseSize().height();                          int iWidth  = m_pWorkspace->width();
1829                  int iHeight = pChannelStrip->parentWidget()->frameGeometry().height();                          if (iWidth < pChannelStrip->width())
1830                  pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight);                                  iWidth = pChannelStrip->width();
1831                  y += iHeight;                  //  int iHeight = pChannelStrip->height()
1832                    //              + pChannelStrip->parentWidget()->baseSize().height();
1833                            int iHeight = pChannelStrip->parentWidget()->frameGeometry().height();
1834                            pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight);
1835                            y += iHeight;
1836                    }
1837          }          }
1838          m_pWorkspace->setUpdatesEnabled(true);          m_pWorkspace->setUpdatesEnabled(true);
1839    
# Line 1903  void MainForm::stabilizeForm (void) Line 1978  void MainForm::stabilizeForm (void)
1978          ChannelStrip *pChannelStrip = activeChannelStrip();          ChannelStrip *pChannelStrip = activeChannelStrip();
1979          bool bHasClient = (m_pOptions != NULL && m_pClient != NULL);          bool bHasClient = (m_pOptions != NULL && m_pClient != NULL);
1980          bool bHasChannel = (bHasClient && pChannelStrip != NULL);          bool bHasChannel = (bHasClient && pChannelStrip != NULL);
1981          bool bHasChannels = (bHasClient && m_pWorkspace->windowList().count() > 0);          bool bHasChannels = (bHasClient && m_pWorkspace->subWindowList().count() > 0);
1982          m_ui.fileNewAction->setEnabled(bHasClient);          m_ui.fileNewAction->setEnabled(bHasClient);
1983          m_ui.fileOpenAction->setEnabled(bHasClient);          m_ui.fileOpenAction->setEnabled(bHasClient);
1984          m_ui.fileSaveAction->setEnabled(bHasClient && m_iDirtyCount > 0);          m_ui.fileSaveAction->setEnabled(bHasClient && m_iDirtyCount > 0);
# Line 1999  void MainForm::volumeChanged ( int iVolu Line 2074  void MainForm::volumeChanged ( int iVolu
2074    
2075    
2076  // Channel change receiver slot.  // Channel change receiver slot.
2077  void MainForm::channelStripChanged(ChannelStrip* pChannelStrip)  void MainForm::channelStripChanged ( ChannelStrip *pChannelStrip )
2078  {  {
2079          // Add this strip to the changed list...          // Add this strip to the changed list...
2080          if (!m_changedStrips.contains(pChannelStrip)) {          if (!m_changedStrips.contains(pChannelStrip)) {
# Line 2050  void MainForm::updateSession (void) Line 2125  void MainForm::updateSession (void)
2125                  m_pDeviceForm->refreshDevices();                  m_pDeviceForm->refreshDevices();
2126  }  }
2127    
2128  void MainForm::updateAllChannelStrips(bool bRemoveDeadStrips) {  
2129    void MainForm::updateAllChannelStrips ( bool bRemoveDeadStrips )
2130    {
2131          // Retrieve the current channel list.          // Retrieve the current channel list.
2132          int *piChannelIDs = ::lscp_list_channels(m_pClient);          int *piChannelIDs = ::lscp_list_channels(m_pClient);
2133          if (piChannelIDs == NULL) {          if (piChannelIDs == NULL) {
# Line 2062  void MainForm::updateAllChannelStrips(bo Line 2139  void MainForm::updateAllChannelStrips(bo
2139          } else {          } else {
2140                  // Try to (re)create each channel.                  // Try to (re)create each channel.
2141                  m_pWorkspace->setUpdatesEnabled(false);                  m_pWorkspace->setUpdatesEnabled(false);
2142                  for (int iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) {                  for (int iChannel = 0; piChannelIDs[iChannel] >= 0; ++iChannel) {
2143                          // Check if theres already a channel strip for this one...                          // Check if theres already a channel strip for this one...
2144                          if (!channelStrip(piChannelIDs[iChannel]))                          if (!channelStrip(piChannelIDs[iChannel]))
2145                                  createChannelStrip(new Channel(piChannelIDs[iChannel]));                                  createChannelStrip(new Channel(piChannelIDs[iChannel]));
2146                  }                  }
   
2147                  // Do we auto-arrange?                  // Do we auto-arrange?
2148                  if (m_pOptions && m_pOptions->bAutoArrange)                  if (m_pOptions && m_pOptions->bAutoArrange)
2149                          channelsArrange();                          channelsArrange();
   
                 stabilizeForm();  
   
2150                  // remove dead channel strips                  // remove dead channel strips
2151                  if (bRemoveDeadStrips) {                  if (bRemoveDeadStrips) {
2152                          for (int i = 0; channelStripAt(i); ++i) {                          QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();
2153                                  ChannelStrip* pChannelStrip = channelStripAt(i);                          for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {
2154                                  bool bExists = false;                                  ChannelStrip *pChannelStrip = NULL;
2155                                  for (int j = 0; piChannelIDs[j] >= 0; ++j) {                                  QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);
2156                                          if (!pChannelStrip->channel()) break;                                  if (pMdiSubWindow)
2157                                          if (piChannelIDs[j] == pChannelStrip->channel()->channelID()) {                                          pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
2158                                                  // strip exists, don't touch it                                  if (pChannelStrip) {
2159                                                  bExists = true;                                          bool bExists = false;
2160                                                  break;                                          for (int j = 0; piChannelIDs[j] >= 0; ++j) {
2161                                                    if (!pChannelStrip->channel())
2162                                                            break;
2163                                                    if (piChannelIDs[j] == pChannelStrip->channel()->channelID()) {
2164                                                            // strip exists, don't touch it
2165                                                            bExists = true;
2166                                                            break;
2167                                                    }
2168                                          }                                          }
2169                                            if (!bExists)
2170                                                    destroyChannelStrip(pChannelStrip);
2171                                  }                                  }
                                 if (!bExists) destroyChannelStrip(pChannelStrip);  
2172                          }                          }
2173                  }                  }
2174                  m_pWorkspace->setUpdatesEnabled(true);                  m_pWorkspace->setUpdatesEnabled(true);
2175          }          }
2176    
2177            stabilizeForm();
2178  }  }
2179    
2180    
2181  // Update the recent files list and menu.  // Update the recent files list and menu.
2182  void MainForm::updateRecentFiles ( const QString& sFilename )  void MainForm::updateRecentFiles ( const QString& sFilename )
2183  {  {
# Line 2140  void MainForm::updateRecentFilesMenu (vo Line 2224  void MainForm::updateRecentFilesMenu (vo
2224  void MainForm::updateInstrumentNames (void)  void MainForm::updateInstrumentNames (void)
2225  {  {
2226          // Full channel list update...          // Full channel list update...
2227          QWidgetList wlist = m_pWorkspace->windowList();          QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();
2228          if (wlist.isEmpty())          if (wlist.isEmpty())
2229                  return;                  return;
2230    
2231          m_pWorkspace->setUpdatesEnabled(false);          m_pWorkspace->setUpdatesEnabled(false);
2232          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {
2233                  ChannelStrip *pChannelStrip = (ChannelStrip *) wlist.at(iChannel);                  ChannelStrip *pChannelStrip = (ChannelStrip *) wlist.at(iChannel);
2234                  if (pChannelStrip)                  if (pChannelStrip)
2235                          pChannelStrip->updateInstrumentName(true);                          pChannelStrip->updateInstrumentName(true);
# Line 2169  void MainForm::updateDisplayFont (void) Line 2253  void MainForm::updateDisplayFont (void)
2253                  return;                  return;
2254    
2255          // Full channel list update...          // Full channel list update...
2256          QWidgetList wlist = m_pWorkspace->windowList();          QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();
2257          if (wlist.isEmpty())          if (wlist.isEmpty())
2258                  return;                  return;
2259    
2260          m_pWorkspace->setUpdatesEnabled(false);          m_pWorkspace->setUpdatesEnabled(false);
2261          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {
2262                  ChannelStrip* pChannelStrip = (ChannelStrip*) wlist.at(iChannel);                  ChannelStrip *pChannelStrip = NULL;
2263                    QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);
2264                    if (pMdiSubWindow)
2265                            pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
2266                  if (pChannelStrip)                  if (pChannelStrip)
2267                          pChannelStrip->setDisplayFont(font);                          pChannelStrip->setDisplayFont(font);
2268          }          }
# Line 2187  void MainForm::updateDisplayFont (void) Line 2274  void MainForm::updateDisplayFont (void)
2274  void MainForm::updateDisplayEffect (void)  void MainForm::updateDisplayEffect (void)
2275  {  {
2276          // Full channel list update...          // Full channel list update...
2277          QWidgetList wlist = m_pWorkspace->windowList();          QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();
2278          if (wlist.isEmpty())          if (wlist.isEmpty())
2279                  return;                  return;
2280    
2281          m_pWorkspace->setUpdatesEnabled(false);          m_pWorkspace->setUpdatesEnabled(false);
2282          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {
2283                  ChannelStrip* pChannelStrip = (ChannelStrip*) wlist.at(iChannel);                  ChannelStrip *pChannelStrip = NULL;
2284                    QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);
2285                    if (pMdiSubWindow)
2286                            pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
2287                  if (pChannelStrip)                  if (pChannelStrip)
2288                          pChannelStrip->setDisplayEffect(m_pOptions->bDisplayEffect);                          pChannelStrip->setDisplayEffect(m_pOptions->bDisplayEffect);
2289          }          }
# Line 2215  void MainForm::updateMaxVolume (void) Line 2305  void MainForm::updateMaxVolume (void)
2305  #endif  #endif
2306    
2307          // Full channel list update...          // Full channel list update...
2308          QWidgetList wlist = m_pWorkspace->windowList();          QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();
2309          if (wlist.isEmpty())          if (wlist.isEmpty())
2310                  return;                  return;
2311    
2312          m_pWorkspace->setUpdatesEnabled(false);          m_pWorkspace->setUpdatesEnabled(false);
2313          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {
2314                  ChannelStrip* pChannelStrip = (ChannelStrip*) wlist.at(iChannel);                  ChannelStrip *pChannelStrip = NULL;
2315                    QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);
2316                    if (pMdiSubWindow)
2317                            pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
2318                  if (pChannelStrip)                  if (pChannelStrip)
2319                          pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume);                          pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume);
2320          }          }
# Line 2329  void MainForm::updateMessagesCapture (vo Line 2422  void MainForm::updateMessagesCapture (vo
2422  // qsamplerMainForm -- MDI channel strip management.  // qsamplerMainForm -- MDI channel strip management.
2423    
2424  // The channel strip creation executive.  // The channel strip creation executive.
2425  ChannelStrip* MainForm::createChannelStrip ( Channel *pChannel )  ChannelStrip *MainForm::createChannelStrip ( Channel *pChannel )
2426  {  {
2427          if (m_pClient == NULL || pChannel == NULL)          if (m_pClient == NULL || pChannel == NULL)
2428                  return NULL;                  return NULL;
# Line 2352  ChannelStrip* MainForm::createChannelStr Line 2445  ChannelStrip* MainForm::createChannelStr
2445          }          }
2446    
2447          // Add it to workspace...          // Add it to workspace...
2448          m_pWorkspace->addWindow(pChannelStrip, Qt::FramelessWindowHint);          m_pWorkspace->addSubWindow(pChannelStrip,
2449                    Qt::SubWindow | Qt::FramelessWindowHint);
2450    
2451          // Actual channel strip setup...          // Actual channel strip setup...
2452          pChannelStrip->setup(pChannel);          pChannelStrip->setup(pChannel);
2453    
2454          QObject::connect(pChannelStrip,          QObject::connect(pChannelStrip,
2455                  SIGNAL(channelChanged(ChannelStrip*)),                  SIGNAL(channelChanged(ChannelStrip *)),
2456                  SLOT(channelStripChanged(ChannelStrip*)));                  SLOT(channelStripChanged(ChannelStrip *)));
2457    
2458          // Now we show up us to the world.          // Now we show up us to the world.
2459          pChannelStrip->show();          pChannelStrip->show();
# Line 2371  ChannelStrip* MainForm::createChannelStr Line 2465  ChannelStrip* MainForm::createChannelStr
2465          return pChannelStrip;          return pChannelStrip;
2466  }  }
2467    
2468  void MainForm::destroyChannelStrip(ChannelStrip* pChannelStrip) {  
2469    void MainForm::destroyChannelStrip ( ChannelStrip *pChannelStrip )
2470    {
2471            QMdiSubWindow *pMdiSubWindow
2472                    = static_cast<QMdiSubWindow *> (pChannelStrip->parentWidget());
2473            if (pMdiSubWindow == NULL)
2474                    return;
2475    
2476          // Just delete the channel strip.          // Just delete the channel strip.
2477          delete pChannelStrip;          delete pChannelStrip;
2478            delete pMdiSubWindow;
2479    
2480          // Do we auto-arrange?          // Do we auto-arrange?
2481          if (m_pOptions && m_pOptions->bAutoArrange)          if (m_pOptions && m_pOptions->bAutoArrange)
# Line 2382  void MainForm::destroyChannelStrip(Chann Line 2484  void MainForm::destroyChannelStrip(Chann
2484          stabilizeForm();          stabilizeForm();
2485  }  }
2486    
2487    
2488  // Retrieve the active channel strip.  // Retrieve the active channel strip.
2489  ChannelStrip* MainForm::activeChannelStrip (void)  ChannelStrip *MainForm::activeChannelStrip (void)
2490  {  {
2491          return static_cast<ChannelStrip *> (m_pWorkspace->activeWindow());          QMdiSubWindow *pMdiSubWindow = m_pWorkspace->activeSubWindow();
2492            if (pMdiSubWindow)
2493                    return static_cast<ChannelStrip *> (pMdiSubWindow->widget());
2494            else
2495                    return NULL;
2496  }  }
2497    
2498    
2499  // Retrieve a channel strip by index.  // Retrieve a channel strip by index.
2500  ChannelStrip* MainForm::channelStripAt ( int iChannel )  ChannelStrip *MainForm::channelStripAt ( int iChannel )
2501  {  {
2502          if (!m_pWorkspace) return NULL;          if (!m_pWorkspace) return NULL;
2503    
2504          QWidgetList wlist = m_pWorkspace->windowList();          QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();
2505          if (wlist.isEmpty())          if (wlist.isEmpty())
2506                  return NULL;                  return NULL;
2507    
2508          if (iChannel < 0 || iChannel >= wlist.size())          if (iChannel < 0 || iChannel >= wlist.size())
2509                  return NULL;                  return NULL;
2510    
2511          return dynamic_cast<ChannelStrip *> (wlist.at(iChannel));          QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);
2512            if (pMdiSubWindow)
2513                    return static_cast<ChannelStrip *> (pMdiSubWindow->widget());
2514            else
2515                    return NULL;
2516  }  }
2517    
2518    
2519  // Retrieve a channel strip by sampler channel id.  // Retrieve a channel strip by sampler channel id.
2520  ChannelStrip* MainForm::channelStrip ( int iChannelID )  ChannelStrip *MainForm::channelStrip ( int iChannelID )
2521  {  {
2522          QWidgetList wlist = m_pWorkspace->windowList();          QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();
2523          if (wlist.isEmpty())          if (wlist.isEmpty())
2524                  return NULL;                  return NULL;
2525    
2526          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {
2527                  ChannelStrip* pChannelStrip                  ChannelStrip *pChannelStrip = NULL;
2528                          = static_cast<ChannelStrip*> (wlist.at(iChannel));                  QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);
2529                    if (pMdiSubWindow)
2530                            pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
2531                  if (pChannelStrip) {                  if (pChannelStrip) {
2532                          Channel *pChannel = pChannelStrip->channel();                          Channel *pChannel = pChannelStrip->channel();
2533                          if (pChannel && pChannel->channelID() == iChannelID)                          if (pChannel && pChannel->channelID() == iChannelID)
# Line 2434  void MainForm::channelsMenuAboutToShow ( Line 2547  void MainForm::channelsMenuAboutToShow (
2547          m_ui.channelsMenu->addAction(m_ui.channelsArrangeAction);          m_ui.channelsMenu->addAction(m_ui.channelsArrangeAction);
2548          m_ui.channelsMenu->addAction(m_ui.channelsAutoArrangeAction);          m_ui.channelsMenu->addAction(m_ui.channelsAutoArrangeAction);
2549    
2550          QWidgetList wlist = m_pWorkspace->windowList();          QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();
2551          if (!wlist.isEmpty()) {          if (!wlist.isEmpty()) {
2552                  m_ui.channelsMenu->addSeparator();                  m_ui.channelsMenu->addSeparator();
2553                  for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {                  for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {
2554                          ChannelStrip* pChannelStrip                          ChannelStrip *pChannelStrip = NULL;
2555                                  = static_cast<ChannelStrip*> (wlist.at(iChannel));                          QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);
2556                            if (pMdiSubWindow)
2557                                    pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
2558                          if (pChannelStrip) {                          if (pChannelStrip) {
2559                                  QAction *pAction = m_ui.channelsMenu->addAction(                                  QAction *pAction = m_ui.channelsMenu->addAction(
2560                                          pChannelStrip->windowTitle(),                                          pChannelStrip->windowTitle(),
# Line 2461  void MainForm::channelsMenuActivated (vo Line 2576  void MainForm::channelsMenuActivated (vo
2576          if (pAction == NULL)          if (pAction == NULL)
2577                  return;                  return;
2578    
2579          ChannelStrip* pChannelStrip = channelStripAt(pAction->data().toInt());          ChannelStrip *pChannelStrip = channelStripAt(pAction->data().toInt());
2580          if (pChannelStrip) {          if (pChannelStrip) {
2581                  pChannelStrip->showNormal();                  pChannelStrip->showNormal();
2582                  pChannelStrip->setFocus();                  pChannelStrip->setFocus();
# Line 2522  void MainForm::timerSlot (void) Line 2637  void MainForm::timerSlot (void)
2637                          if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime)  {                          if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime)  {
2638                                  m_iTimerSlot = 0;                                  m_iTimerSlot = 0;
2639                                  // Update the channel stream usage for each strip...                                  // Update the channel stream usage for each strip...
2640                                  QWidgetList wlist = m_pWorkspace->windowList();                                  QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();
2641                                  for (int iChannel = 0;                                  for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {
2642                                                  iChannel < (int) wlist.count(); iChannel++) {                                          ChannelStrip *pChannelStrip = NULL;
2643                                          ChannelStrip* pChannelStrip                                          QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);
2644                                                  = (ChannelStrip*) wlist.at(iChannel);                                          if (pMdiSubWindow)
2645                                                    pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
2646                                          if (pChannelStrip && pChannelStrip->isVisible())                                          if (pChannelStrip && pChannelStrip->isVisible())
2647                                                  pChannelStrip->updateChannelUsage();                                                  pChannelStrip->updateChannelUsage();
2648                                  }                                  }
# Line 2578  void MainForm::startServer (void) Line 2694  void MainForm::startServer (void)
2694    
2695          // Setup stdout/stderr capture...          // Setup stdout/stderr capture...
2696  //      if (m_pOptions->bStdoutCapture) {  //      if (m_pOptions->bStdoutCapture) {
 #if QT_VERSION >= 0x040200  
2697                  m_pServer->setProcessChannelMode(QProcess::ForwardedChannels);                  m_pServer->setProcessChannelMode(QProcess::ForwardedChannels);
 #endif  
2698                  QObject::connect(m_pServer,                  QObject::connect(m_pServer,
2699                          SIGNAL(readyReadStandardOutput()),                          SIGNAL(readyReadStandardOutput()),
2700                          SLOT(readServerStdout()));                          SLOT(readServerStdout()));
# Line 2635  void MainForm::stopServer (bool bInterac Line 2749  void MainForm::stopServer (bool bInterac
2749                          "according to your current sampler session and you could alter the\n"                          "according to your current sampler session and you could alter the\n"
2750                          "sampler session at any time by relaunching QSampler.\n\n"                          "sampler session at any time by relaunching QSampler.\n\n"
2751                          "Do you want LinuxSampler to stop?"),                          "Do you want LinuxSampler to stop?"),
2752                          QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)                          QMessageBox::Yes | QMessageBox::No,
2753                            QMessageBox::Yes) == QMessageBox::No)
2754                  {                  {
2755                          bForceServerStop = false;                          bForceServerStop = false;
2756                  }                  }
# Line 2645  void MainForm::stopServer (bool bInterac Line 2760  void MainForm::stopServer (bool bInterac
2760          if (m_pServer && bForceServerStop) {          if (m_pServer && bForceServerStop) {
2761                  appendMessages(tr("Server is stopping..."));                  appendMessages(tr("Server is stopping..."));
2762                  if (m_pServer->state() == QProcess::Running) {                  if (m_pServer->state() == QProcess::Running) {
2763  #if defined(WIN32)                  #if defined(WIN32)
2764                          // Try harder...                          // Try harder...
2765                          m_pServer->kill();                          m_pServer->kill();
2766  #else                  #else
2767                          // Try softly...                          // Try softly...
2768                          m_pServer->terminate();                          m_pServer->terminate();
2769  #endif                  #endif
2770                  }                  }
2771          }       // Do final processing anyway.          }       // Do final processing anyway.
2772          else processServerExit();          else processServerExit();
# Line 2880  void MainForm::stopClient (void) Line 2995  void MainForm::stopClient (void)
2995    
2996    
2997  // Channel strip activation/selection.  // Channel strip activation/selection.
2998  void MainForm::activateStrip ( QWidget *pWidget )  void MainForm::activateStrip ( QMdiSubWindow *pMdiSubWindow )
2999  {  {
3000          ChannelStrip *pChannelStrip          ChannelStrip *pChannelStrip = NULL;
3001                  = static_cast<ChannelStrip *> (pWidget);          if (pMdiSubWindow)
3002                    pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
3003          if (pChannelStrip)          if (pChannelStrip)
3004                  pChannelStrip->setSelected(true);                  pChannelStrip->setSelected(true);
3005    
# Line 2891  void MainForm::activateStrip ( QWidget * Line 3007  void MainForm::activateStrip ( QWidget *
3007  }  }
3008    
3009    
3010    // Channel toolbar orientation change.
3011    void MainForm::channelsToolbarOrientation ( Qt::Orientation orientation )
3012    {
3013    #ifdef CONFIG_VOLUME
3014            m_pVolumeSlider->setOrientation(orientation);
3015            if (orientation == Qt::Horizontal) {
3016                    m_pVolumeSlider->setMinimumHeight(24);
3017                    m_pVolumeSlider->setMaximumHeight(32);
3018                    m_pVolumeSlider->setMinimumWidth(120);
3019                    m_pVolumeSlider->setMaximumWidth(640);
3020                    m_pVolumeSpinBox->setMaximumWidth(64);
3021                    m_pVolumeSpinBox->setButtonSymbols(QSpinBox::UpDownArrows);
3022            } else {
3023                    m_pVolumeSlider->setMinimumHeight(120);
3024                    m_pVolumeSlider->setMaximumHeight(480);
3025                    m_pVolumeSlider->setMinimumWidth(24);
3026                    m_pVolumeSlider->setMaximumWidth(32);
3027                    m_pVolumeSpinBox->setMaximumWidth(32);
3028                    m_pVolumeSpinBox->setButtonSymbols(QSpinBox::NoButtons);
3029            }
3030    #endif
3031    }
3032    
3033    
3034  } // namespace QSampler  } // namespace QSampler
3035    
3036    

Legend:
Removed from v.2077  
changed lines
  Added in v.2717

  ViewVC Help
Powered by ViewVC