/[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 2113 by capela, Thu Jul 22 08:12:12 2010 UTC revision 2722 by capela, Tue Mar 3 17:41:04 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-2015, rncbc aka Rui Nuno Capela. All rights reserved.
5     Copyright (C) 2007, 2008 Christian Schoenebeck     Copyright (C) 2007,2008,2015 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
8     modify it under the terms of the GNU General Public License     modify it under the terms of the GNU General Public License
# 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 96  static WSADATA _wsaData; Line 99  static WSADATA _wsaData;
99  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
100  // LADISH Level 1 support stuff.  // LADISH Level 1 support stuff.
101    
102  #ifdef HAVE_SIGNAL_H  #if defined(HAVE_SIGNAL_H) && defined(HAVE_SYS_SOCKET_H)
103    
104  #include <QSocketNotifier>  #include <QSocketNotifier>
105    
# Line 202  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);
# Line 221  MainForm::MainForm ( QWidget *pParent ) Line 224  MainForm::MainForm ( QWidget *pParent )
224          // Install SIGUSR1 signal handler.          // Install SIGUSR1 signal handler.
225      struct sigaction usr1;      struct sigaction usr1;
226      usr1.sa_handler = qsampler_sigusr1_handler;      usr1.sa_handler = qsampler_sigusr1_handler;
227      ::sigemptyset(&usr1.sa_mask);      sigemptyset(&usr1.sa_mask);
228      usr1.sa_flags = 0;      usr1.sa_flags = 0;
229      usr1.sa_flags |= SA_RESTART;      usr1.sa_flags |= SA_RESTART;
230      ::sigaction(SIGUSR1, &usr1, NULL);      ::sigaction(SIGUSR1, &usr1, NULL);
# Line 251  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 269  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 391  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 403  MainForm::~MainForm() Line 409  MainForm::~MainForm()
409          WSACleanup();          WSACleanup();
410  #endif  #endif
411    
412  #ifdef HAVE_SIGNAL_H  #if defined(HAVE_SIGNAL_H) && defined(HAVE_SYS_SOCKET_H)
413          if (m_pUsr1Notifier)          if (m_pUsr1Notifier)
414                  delete m_pUsr1Notifier;                  delete m_pUsr1Notifier;
415  #endif  #endif
# Line 691  void MainForm::customEvent ( QEvent* pEv Line 697  void MainForm::customEvent ( QEvent* pEv
697  // LADISH Level 1 -- SIGUSR1 signal handler.  // LADISH Level 1 -- SIGUSR1 signal handler.
698  void MainForm::handle_sigusr1 (void)  void MainForm::handle_sigusr1 (void)
699  {  {
700  #ifdef HAVE_SIGNAL_H  #if defined(HAVE_SIGNAL_H) && defined(HAVE_SYS_SOCKET_H)
701    
702          char c;          char c;
703    
# Line 890  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 1189  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 1240  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 1270  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 1392  void MainForm::fileReset (void) Line 1405  void MainForm::fileReset (void)
1405                  return;                  return;
1406    
1407          // Ask user whether he/she want's an internal sampler reset...          // Ask user whether he/she want's an internal sampler reset...
1408          if (QMessageBox::warning(this,          if (m_pOptions && m_pOptions->bConfirmReset) {
1409                  QSAMPLER_TITLE ": " + tr("Warning"),                  const QString& sTitle = QSAMPLER_TITLE ": " + tr("Warning");
1410                  tr("Resetting the sampler instance will close\n"                  const QString& sText = tr(
1411                  "all device and channel configurations.\n\n"                          "Resetting the sampler instance will close\n"
1412                  "Please note that this operation may cause\n"                          "all device and channel configurations.\n\n"
1413                  "temporary MIDI and Audio disruption.\n\n"                          "Please note that this operation may cause\n"
1414                  "Do you want to reset the sampler engine now?"),                          "temporary MIDI and Audio disruption.\n\n"
1415                  QMessageBox::Ok | QMessageBox::Cancel)                          "Do you want to reset the sampler engine now?");
1416                  == QMessageBox::Cancel)          #if 0
1417                  return;                  if (QMessageBox::warning(this, sTitle, sText,
1418                            QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Cancel)
1419                            return;
1420            #else
1421                    QMessageBox mbox(this);
1422                    mbox.setIcon(QMessageBox::Warning);
1423                    mbox.setWindowTitle(sTitle);
1424                    mbox.setText(sText);
1425                    mbox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
1426                    QCheckBox cbox(tr("Don't ask this again"));
1427                    cbox.setChecked(false);
1428                    cbox.blockSignals(true);
1429                    mbox.addButton(&cbox, QMessageBox::ActionRole);
1430                    if (mbox.exec() == QMessageBox::Cancel)
1431                            return;
1432                    if (cbox.isChecked())
1433                            m_pOptions->bConfirmReset = false;
1434            #endif
1435            }
1436    
1437          // Trye closing the current session, first...          // Trye closing the current session, first...
1438          if (!closeSession(true))          if (!closeSession(true))
# Line 1433  void MainForm::fileRestart (void) Line 1464  void MainForm::fileRestart (void)
1464    
1465          // Ask user whether he/she want's a complete restart...          // Ask user whether he/she want's a complete restart...
1466          // (if we're currently up and running)          // (if we're currently up and running)
1467          if (bRestart && m_pClient) {          if (m_pOptions && m_pOptions->bConfirmRestart) {
1468                  bRestart = (QMessageBox::warning(this,                  const QString& sTitle = QSAMPLER_TITLE ": " + tr("Warning");
1469                          QSAMPLER_TITLE ": " + tr("Warning"),                  const QString& sText = tr(
1470                          tr("New settings will be effective after\n"                          "New settings will be effective after\n"
1471                          "restarting the client/server connection.\n\n"                          "restarting the client/server connection.\n\n"
1472                          "Please note that this operation may cause\n"                          "Please note that this operation may cause\n"
1473                          "temporary MIDI and Audio disruption.\n\n"                          "temporary MIDI and Audio disruption.\n\n"
1474                          "Do you want to restart the connection now?"),                          "Do you want to restart the connection now?");
1475                          QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok);          #if 0
1476                    if (QMessageBox::warning(this, sTitle, sText,
1477                            QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Cancel)
1478                            bRestart = false;
1479            #else
1480                    QMessageBox mbox(this);
1481                    mbox.setIcon(QMessageBox::Warning);
1482                    mbox.setWindowTitle(sTitle);
1483                    mbox.setText(sText);
1484                    mbox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
1485                    QCheckBox cbox(tr("Don't ask this again"));
1486                    cbox.setChecked(false);
1487                    cbox.blockSignals(true);
1488                    mbox.addButton(&cbox, QMessageBox::ActionRole);
1489                    if (mbox.exec() == QMessageBox::Cancel)
1490                            bRestart = false;
1491                    else
1492                    if (cbox.isChecked())
1493                            m_pOptions->bConfirmRestart = false;
1494            #endif
1495          }          }
1496    
1497          // Are we still for it?          // Are we still for it?
# Line 1506  void MainForm::editRemoveChannel (void) Line 1556  void MainForm::editRemoveChannel (void)
1556          if (m_pClient == NULL)          if (m_pClient == NULL)
1557                  return;                  return;
1558    
1559          ChannelStrip* pChannelStrip = activeChannelStrip();          ChannelStrip *pChannelStrip = activeChannelStrip();
1560          if (pChannelStrip == NULL)          if (pChannelStrip == NULL)
1561                  return;                  return;
1562    
# Line 1516  void MainForm::editRemoveChannel (void) Line 1566  void MainForm::editRemoveChannel (void)
1566    
1567          // Prompt user if he/she's sure about this...          // Prompt user if he/she's sure about this...
1568          if (m_pOptions && m_pOptions->bConfirmRemove) {          if (m_pOptions && m_pOptions->bConfirmRemove) {
1569                  if (QMessageBox::warning(this,                  const QString& sTitle = QSAMPLER_TITLE ": " + tr("Warning");
1570                          QSAMPLER_TITLE ": " + tr("Warning"),                  const QString& sText = tr(
1571                          tr("About to remove channel:\n\n"                          "About to remove channel:\n\n"
1572                          "%1\n\n"                          "%1\n\n"
1573                          "Are you sure?")                          "Are you sure?")
1574                          .arg(pChannelStrip->windowTitle()),                          .arg(pChannelStrip->windowTitle());
1575                          QMessageBox::Ok | QMessageBox::Cancel)          #if 0
1576                          == QMessageBox::Cancel)                  if (QMessageBox::warning(this, sTitle, sText,
1577                            QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Cancel)
1578                            return;
1579            #else
1580                    QMessageBox mbox(this);
1581                    mbox.setIcon(QMessageBox::Warning);
1582                    mbox.setWindowTitle(sTitle);
1583                    mbox.setText(sText);
1584                    mbox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
1585                    QCheckBox cbox(tr("Don't ask this again"));
1586                    cbox.setChecked(false);
1587                    cbox.blockSignals(true);
1588                    mbox.addButton(&cbox, QMessageBox::ActionRole);
1589                    if (mbox.exec() == QMessageBox::Cancel)
1590                          return;                          return;
1591                    if (cbox.isChecked())
1592                            m_pOptions->bConfirmRemove = false;
1593            #endif
1594          }          }
1595    
1596          // Remove the existing sampler channel.          // Remove the existing sampler channel.
1597          if (!pChannel->removeChannel())          if (!pChannel->removeChannel())
1598                  return;                  return;
1599    
         // Just delete the channel strip.  
         delete pChannelStrip;  
   
         // Do we auto-arrange?  
         if (m_pOptions && m_pOptions->bAutoArrange)  
                 channelsArrange();  
   
1600          // We'll be dirty, for sure...          // We'll be dirty, for sure...
1601          m_iDirtyCount++;          m_iDirtyCount++;
1602          stabilizeForm();  
1603            // Just delete the channel strip.
1604            destroyChannelStrip(pChannelStrip);
1605  }  }
1606    
1607    
# Line 1550  void MainForm::editSetupChannel (void) Line 1611  void MainForm::editSetupChannel (void)
1611          if (m_pClient == NULL)          if (m_pClient == NULL)
1612                  return;                  return;
1613    
1614          ChannelStrip* pChannelStrip = activeChannelStrip();          ChannelStrip *pChannelStrip = activeChannelStrip();
1615          if (pChannelStrip == NULL)          if (pChannelStrip == NULL)
1616                  return;                  return;
1617    
# Line 1565  void MainForm::editEditChannel (void) Line 1626  void MainForm::editEditChannel (void)
1626          if (m_pClient == NULL)          if (m_pClient == NULL)
1627                  return;                  return;
1628    
1629          ChannelStrip* pChannelStrip = activeChannelStrip();          ChannelStrip *pChannelStrip = activeChannelStrip();
1630          if (pChannelStrip == NULL)          if (pChannelStrip == NULL)
1631                  return;                  return;
1632    
# Line 1580  void MainForm::editResetChannel (void) Line 1641  void MainForm::editResetChannel (void)
1641          if (m_pClient == NULL)          if (m_pClient == NULL)
1642                  return;                  return;
1643    
1644          ChannelStrip* pChannelStrip = activeChannelStrip();          ChannelStrip *pChannelStrip = activeChannelStrip();
1645          if (pChannelStrip == NULL)          if (pChannelStrip == NULL)
1646                  return;                  return;
1647    
# Line 1598  void MainForm::editResetAllChannels (voi Line 1659  void MainForm::editResetAllChannels (voi
1659          // Invoque the channel strip procedure,          // Invoque the channel strip procedure,
1660          // for all channels out there...          // for all channels out there...
1661          m_pWorkspace->setUpdatesEnabled(false);          m_pWorkspace->setUpdatesEnabled(false);
1662          QWidgetList wlist = m_pWorkspace->windowList();          QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();
1663          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {
1664                  ChannelStrip* pChannelStrip = (ChannelStrip*) wlist.at(iChannel);                  ChannelStrip *pChannelStrip = NULL;
1665                    QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);
1666                    if (pMdiSubWindow)
1667                            pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
1668                  if (pChannelStrip)                  if (pChannelStrip)
1669                          pChannelStrip->channelReset();                          pChannelStrip->channelReset();
1670          }          }
# Line 1703  void MainForm::viewOptions (void) Line 1767  void MainForm::viewOptions (void)
1767          OptionsForm* pOptionsForm = new OptionsForm(this);          OptionsForm* pOptionsForm = new OptionsForm(this);
1768          if (pOptionsForm) {          if (pOptionsForm) {
1769                  // Check out some initial nullities(tm)...                  // Check out some initial nullities(tm)...
1770                  ChannelStrip* pChannelStrip = activeChannelStrip();                  ChannelStrip *pChannelStrip = activeChannelStrip();
1771                  if (m_pOptions->sDisplayFont.isEmpty() && pChannelStrip)                  if (m_pOptions->sDisplayFont.isEmpty() && pChannelStrip)
1772                          m_pOptions->sDisplayFont = pChannelStrip->displayFont().toString();                          m_pOptions->sDisplayFont = pChannelStrip->displayFont().toString();
1773                  if (m_pOptions->sMessagesFont.isEmpty() && m_pMessages)                  if (m_pOptions->sMessagesFont.isEmpty() && m_pMessages)
# Line 1796  void MainForm::viewOptions (void) Line 1860  void MainForm::viewOptions (void)
1860  void MainForm::channelsArrange (void)  void MainForm::channelsArrange (void)
1861  {  {
1862          // Full width vertical tiling          // Full width vertical tiling
1863          QWidgetList wlist = m_pWorkspace->windowList();          QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();
1864          if (wlist.isEmpty())          if (wlist.isEmpty())
1865                  return;                  return;
1866    
1867          m_pWorkspace->setUpdatesEnabled(false);          m_pWorkspace->setUpdatesEnabled(false);
1868          int y = 0;          int y = 0;
1869          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {
1870                  ChannelStrip* pChannelStrip = (ChannelStrip*) wlist.at(iChannel);                  ChannelStrip *pChannelStrip = NULL;
1871          /*  if (pChannelStrip->testWState(WState_Maximized | WState_Minimized)) {                  QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);
1872                          // Prevent flicker...                  if (pMdiSubWindow)
1873                          pChannelStrip->hide();                          pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
1874                          pChannelStrip->showNormal();                  if (pChannelStrip) {
1875                  }   */                  /*  if (pChannelStrip->testWState(WState_Maximized | WState_Minimized)) {
1876                  pChannelStrip->adjustSize();                                  // Prevent flicker...
1877                  int iWidth  = m_pWorkspace->width();                                  pChannelStrip->hide();
1878                  if (iWidth < pChannelStrip->width())                                  pChannelStrip->showNormal();
1879                          iWidth = pChannelStrip->width();                          }   */
1880          //  int iHeight = pChannelStrip->height()                          pChannelStrip->adjustSize();
1881          //              + pChannelStrip->parentWidget()->baseSize().height();                          int iWidth  = m_pWorkspace->width();
1882                  int iHeight = pChannelStrip->parentWidget()->frameGeometry().height();                          if (iWidth < pChannelStrip->width())
1883                  pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight);                                  iWidth = pChannelStrip->width();
1884                  y += iHeight;                  //  int iHeight = pChannelStrip->height()
1885                    //              + pChannelStrip->parentWidget()->baseSize().height();
1886                            int iHeight = pChannelStrip->parentWidget()->frameGeometry().height();
1887                            pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight);
1888                            y += iHeight;
1889                    }
1890          }          }
1891          m_pWorkspace->setUpdatesEnabled(true);          m_pWorkspace->setUpdatesEnabled(true);
1892    
# Line 1962  void MainForm::stabilizeForm (void) Line 2031  void MainForm::stabilizeForm (void)
2031          ChannelStrip *pChannelStrip = activeChannelStrip();          ChannelStrip *pChannelStrip = activeChannelStrip();
2032          bool bHasClient = (m_pOptions != NULL && m_pClient != NULL);          bool bHasClient = (m_pOptions != NULL && m_pClient != NULL);
2033          bool bHasChannel = (bHasClient && pChannelStrip != NULL);          bool bHasChannel = (bHasClient && pChannelStrip != NULL);
2034          bool bHasChannels = (bHasClient && m_pWorkspace->windowList().count() > 0);          bool bHasChannels = (bHasClient && m_pWorkspace->subWindowList().count() > 0);
2035          m_ui.fileNewAction->setEnabled(bHasClient);          m_ui.fileNewAction->setEnabled(bHasClient);
2036          m_ui.fileOpenAction->setEnabled(bHasClient);          m_ui.fileOpenAction->setEnabled(bHasClient);
2037          m_ui.fileSaveAction->setEnabled(bHasClient && m_iDirtyCount > 0);          m_ui.fileSaveAction->setEnabled(bHasClient && m_iDirtyCount > 0);
# Line 2058  void MainForm::volumeChanged ( int iVolu Line 2127  void MainForm::volumeChanged ( int iVolu
2127    
2128    
2129  // Channel change receiver slot.  // Channel change receiver slot.
2130  void MainForm::channelStripChanged(ChannelStrip* pChannelStrip)  void MainForm::channelStripChanged ( ChannelStrip *pChannelStrip )
2131  {  {
2132          // Add this strip to the changed list...          // Add this strip to the changed list...
2133          if (!m_changedStrips.contains(pChannelStrip)) {          if (!m_changedStrips.contains(pChannelStrip)) {
# Line 2109  void MainForm::updateSession (void) Line 2178  void MainForm::updateSession (void)
2178                  m_pDeviceForm->refreshDevices();                  m_pDeviceForm->refreshDevices();
2179  }  }
2180    
2181  void MainForm::updateAllChannelStrips(bool bRemoveDeadStrips) {  
2182    void MainForm::updateAllChannelStrips ( bool bRemoveDeadStrips )
2183    {
2184          // Retrieve the current channel list.          // Retrieve the current channel list.
2185          int *piChannelIDs = ::lscp_list_channels(m_pClient);          int *piChannelIDs = ::lscp_list_channels(m_pClient);
2186          if (piChannelIDs == NULL) {          if (piChannelIDs == NULL) {
# Line 2121  void MainForm::updateAllChannelStrips(bo Line 2192  void MainForm::updateAllChannelStrips(bo
2192          } else {          } else {
2193                  // Try to (re)create each channel.                  // Try to (re)create each channel.
2194                  m_pWorkspace->setUpdatesEnabled(false);                  m_pWorkspace->setUpdatesEnabled(false);
2195                  for (int iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) {                  for (int iChannel = 0; piChannelIDs[iChannel] >= 0; ++iChannel) {
2196                          // Check if theres already a channel strip for this one...                          // Check if theres already a channel strip for this one...
2197                          if (!channelStrip(piChannelIDs[iChannel]))                          if (!channelStrip(piChannelIDs[iChannel]))
2198                                  createChannelStrip(new Channel(piChannelIDs[iChannel]));                                  createChannelStrip(new Channel(piChannelIDs[iChannel]));
2199                  }                  }
   
2200                  // Do we auto-arrange?                  // Do we auto-arrange?
2201                  if (m_pOptions && m_pOptions->bAutoArrange)                  if (m_pOptions && m_pOptions->bAutoArrange)
2202                          channelsArrange();                          channelsArrange();
   
                 stabilizeForm();  
   
2203                  // remove dead channel strips                  // remove dead channel strips
2204                  if (bRemoveDeadStrips) {                  if (bRemoveDeadStrips) {
2205                          for (int i = 0; channelStripAt(i); ++i) {                          QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();
2206                                  ChannelStrip* pChannelStrip = channelStripAt(i);                          for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {
2207                                  bool bExists = false;                                  ChannelStrip *pChannelStrip = NULL;
2208                                  for (int j = 0; piChannelIDs[j] >= 0; ++j) {                                  QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);
2209                                          if (!pChannelStrip->channel()) break;                                  if (pMdiSubWindow)
2210                                          if (piChannelIDs[j] == pChannelStrip->channel()->channelID()) {                                          pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
2211                                                  // strip exists, don't touch it                                  if (pChannelStrip) {
2212                                                  bExists = true;                                          bool bExists = false;
2213                                                  break;                                          for (int j = 0; piChannelIDs[j] >= 0; ++j) {
2214                                                    if (!pChannelStrip->channel())
2215                                                            break;
2216                                                    if (piChannelIDs[j] == pChannelStrip->channel()->channelID()) {
2217                                                            // strip exists, don't touch it
2218                                                            bExists = true;
2219                                                            break;
2220                                                    }
2221                                          }                                          }
2222                                            if (!bExists)
2223                                                    destroyChannelStrip(pChannelStrip);
2224                                  }                                  }
                                 if (!bExists) destroyChannelStrip(pChannelStrip);  
2225                          }                          }
2226                  }                  }
2227                  m_pWorkspace->setUpdatesEnabled(true);                  m_pWorkspace->setUpdatesEnabled(true);
2228          }          }
2229    
2230            stabilizeForm();
2231  }  }
2232    
2233    
2234  // Update the recent files list and menu.  // Update the recent files list and menu.
2235  void MainForm::updateRecentFiles ( const QString& sFilename )  void MainForm::updateRecentFiles ( const QString& sFilename )
2236  {  {
# Line 2199  void MainForm::updateRecentFilesMenu (vo Line 2277  void MainForm::updateRecentFilesMenu (vo
2277  void MainForm::updateInstrumentNames (void)  void MainForm::updateInstrumentNames (void)
2278  {  {
2279          // Full channel list update...          // Full channel list update...
2280          QWidgetList wlist = m_pWorkspace->windowList();          QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();
2281          if (wlist.isEmpty())          if (wlist.isEmpty())
2282                  return;                  return;
2283    
2284          m_pWorkspace->setUpdatesEnabled(false);          m_pWorkspace->setUpdatesEnabled(false);
2285          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {
2286                  ChannelStrip *pChannelStrip = (ChannelStrip *) wlist.at(iChannel);                  ChannelStrip *pChannelStrip = (ChannelStrip *) wlist.at(iChannel);
2287                  if (pChannelStrip)                  if (pChannelStrip)
2288                          pChannelStrip->updateInstrumentName(true);                          pChannelStrip->updateInstrumentName(true);
# Line 2228  void MainForm::updateDisplayFont (void) Line 2306  void MainForm::updateDisplayFont (void)
2306                  return;                  return;
2307    
2308          // Full channel list update...          // Full channel list update...
2309          QWidgetList wlist = m_pWorkspace->windowList();          QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();
2310          if (wlist.isEmpty())          if (wlist.isEmpty())
2311                  return;                  return;
2312    
2313          m_pWorkspace->setUpdatesEnabled(false);          m_pWorkspace->setUpdatesEnabled(false);
2314          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {
2315                  ChannelStrip* pChannelStrip = (ChannelStrip*) wlist.at(iChannel);                  ChannelStrip *pChannelStrip = NULL;
2316                    QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);
2317                    if (pMdiSubWindow)
2318                            pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
2319                  if (pChannelStrip)                  if (pChannelStrip)
2320                          pChannelStrip->setDisplayFont(font);                          pChannelStrip->setDisplayFont(font);
2321          }          }
# Line 2246  void MainForm::updateDisplayFont (void) Line 2327  void MainForm::updateDisplayFont (void)
2327  void MainForm::updateDisplayEffect (void)  void MainForm::updateDisplayEffect (void)
2328  {  {
2329          // Full channel list update...          // Full channel list update...
2330          QWidgetList wlist = m_pWorkspace->windowList();          QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();
2331          if (wlist.isEmpty())          if (wlist.isEmpty())
2332                  return;                  return;
2333    
2334          m_pWorkspace->setUpdatesEnabled(false);          m_pWorkspace->setUpdatesEnabled(false);
2335          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {
2336                  ChannelStrip* pChannelStrip = (ChannelStrip*) wlist.at(iChannel);                  ChannelStrip *pChannelStrip = NULL;
2337                    QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);
2338                    if (pMdiSubWindow)
2339                            pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
2340                  if (pChannelStrip)                  if (pChannelStrip)
2341                          pChannelStrip->setDisplayEffect(m_pOptions->bDisplayEffect);                          pChannelStrip->setDisplayEffect(m_pOptions->bDisplayEffect);
2342          }          }
# Line 2274  void MainForm::updateMaxVolume (void) Line 2358  void MainForm::updateMaxVolume (void)
2358  #endif  #endif
2359    
2360          // Full channel list update...          // Full channel list update...
2361          QWidgetList wlist = m_pWorkspace->windowList();          QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();
2362          if (wlist.isEmpty())          if (wlist.isEmpty())
2363                  return;                  return;
2364    
2365          m_pWorkspace->setUpdatesEnabled(false);          m_pWorkspace->setUpdatesEnabled(false);
2366          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {
2367                  ChannelStrip* pChannelStrip = (ChannelStrip*) wlist.at(iChannel);                  ChannelStrip *pChannelStrip = NULL;
2368                    QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);
2369                    if (pMdiSubWindow)
2370                            pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
2371                  if (pChannelStrip)                  if (pChannelStrip)
2372                          pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume);                          pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume);
2373          }          }
# Line 2314  void MainForm::appendMessagesText( const Line 2401  void MainForm::appendMessagesText( const
2401                  m_pMessages->appendMessagesText(s);                  m_pMessages->appendMessagesText(s);
2402  }  }
2403    
2404  void MainForm::appendMessagesError( const QString& s )  void MainForm::appendMessagesError( const QString& sText )
2405  {  {
2406          if (m_pMessages)          if (m_pMessages)
2407                  m_pMessages->show();                  m_pMessages->show();
2408    
2409          appendMessagesColor(s.simplified(), "#ff0000");          appendMessagesColor(sText.simplified(), "#ff0000");
2410    
2411          // Make it look responsive...:)          // Make it look responsive...:)
2412          QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);          QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
2413    
2414          QMessageBox::critical(this,          if (m_pOptions && m_pOptions->bConfirmError) {
2415                  QSAMPLER_TITLE ": " + tr("Error"), s, QMessageBox::Cancel);                  const QString& sTitle = QSAMPLER_TITLE ": " + tr("Error");
2416            #if 0
2417                    QMessageBox::critical(this, sTitle, sText, QMessageBox::Cancel);
2418            #else
2419                    QMessageBox mbox(this);
2420                    mbox.setIcon(QMessageBox::Critical);
2421                    mbox.setWindowTitle(sTitle);
2422                    mbox.setText(sText);
2423                    mbox.setStandardButtons(QMessageBox::Cancel);
2424                    QCheckBox cbox(tr("Don't show this again"));
2425                    cbox.setChecked(false);
2426                    cbox.blockSignals(true);
2427                    mbox.addButton(&cbox, QMessageBox::ActionRole);
2428                    if (mbox.exec() && cbox.isChecked())
2429                            m_pOptions->bConfirmError = false;
2430            #endif
2431            }
2432  }  }
2433    
2434    
# Line 2388  void MainForm::updateMessagesCapture (vo Line 2491  void MainForm::updateMessagesCapture (vo
2491  // qsamplerMainForm -- MDI channel strip management.  // qsamplerMainForm -- MDI channel strip management.
2492    
2493  // The channel strip creation executive.  // The channel strip creation executive.
2494  ChannelStrip* MainForm::createChannelStrip ( Channel *pChannel )  ChannelStrip *MainForm::createChannelStrip ( Channel *pChannel )
2495  {  {
2496          if (m_pClient == NULL || pChannel == NULL)          if (m_pClient == NULL || pChannel == NULL)
2497                  return NULL;                  return NULL;
# Line 2411  ChannelStrip* MainForm::createChannelStr Line 2514  ChannelStrip* MainForm::createChannelStr
2514          }          }
2515    
2516          // Add it to workspace...          // Add it to workspace...
2517          m_pWorkspace->addWindow(pChannelStrip, Qt::FramelessWindowHint);          m_pWorkspace->addSubWindow(pChannelStrip,
2518                    Qt::SubWindow | Qt::FramelessWindowHint);
2519    
2520          // Actual channel strip setup...          // Actual channel strip setup...
2521          pChannelStrip->setup(pChannel);          pChannelStrip->setup(pChannel);
2522    
2523          QObject::connect(pChannelStrip,          QObject::connect(pChannelStrip,
2524                  SIGNAL(channelChanged(ChannelStrip*)),                  SIGNAL(channelChanged(ChannelStrip *)),
2525                  SLOT(channelStripChanged(ChannelStrip*)));                  SLOT(channelStripChanged(ChannelStrip *)));
2526    
2527          // Now we show up us to the world.          // Now we show up us to the world.
2528          pChannelStrip->show();          pChannelStrip->show();
# Line 2430  ChannelStrip* MainForm::createChannelStr Line 2534  ChannelStrip* MainForm::createChannelStr
2534          return pChannelStrip;          return pChannelStrip;
2535  }  }
2536    
2537  void MainForm::destroyChannelStrip(ChannelStrip* pChannelStrip) {  
2538    void MainForm::destroyChannelStrip ( ChannelStrip *pChannelStrip )
2539    {
2540            QMdiSubWindow *pMdiSubWindow
2541                    = static_cast<QMdiSubWindow *> (pChannelStrip->parentWidget());
2542            if (pMdiSubWindow == NULL)
2543                    return;
2544    
2545          // Just delete the channel strip.          // Just delete the channel strip.
2546          delete pChannelStrip;          delete pChannelStrip;
2547            delete pMdiSubWindow;
2548    
2549          // Do we auto-arrange?          // Do we auto-arrange?
2550          if (m_pOptions && m_pOptions->bAutoArrange)          if (m_pOptions && m_pOptions->bAutoArrange)
# Line 2441  void MainForm::destroyChannelStrip(Chann Line 2553  void MainForm::destroyChannelStrip(Chann
2553          stabilizeForm();          stabilizeForm();
2554  }  }
2555    
2556    
2557  // Retrieve the active channel strip.  // Retrieve the active channel strip.
2558  ChannelStrip* MainForm::activeChannelStrip (void)  ChannelStrip *MainForm::activeChannelStrip (void)
2559  {  {
2560          return static_cast<ChannelStrip *> (m_pWorkspace->activeWindow());          QMdiSubWindow *pMdiSubWindow = m_pWorkspace->activeSubWindow();
2561            if (pMdiSubWindow)
2562                    return static_cast<ChannelStrip *> (pMdiSubWindow->widget());
2563            else
2564                    return NULL;
2565  }  }
2566    
2567    
2568  // Retrieve a channel strip by index.  // Retrieve a channel strip by index.
2569  ChannelStrip* MainForm::channelStripAt ( int iChannel )  ChannelStrip *MainForm::channelStripAt ( int iChannel )
2570  {  {
2571          if (!m_pWorkspace) return NULL;          if (!m_pWorkspace) return NULL;
2572    
2573          QWidgetList wlist = m_pWorkspace->windowList();          QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();
2574          if (wlist.isEmpty())          if (wlist.isEmpty())
2575                  return NULL;                  return NULL;
2576    
2577          if (iChannel < 0 || iChannel >= wlist.size())          if (iChannel < 0 || iChannel >= wlist.size())
2578                  return NULL;                  return NULL;
2579    
2580          return dynamic_cast<ChannelStrip *> (wlist.at(iChannel));          QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);
2581            if (pMdiSubWindow)
2582                    return static_cast<ChannelStrip *> (pMdiSubWindow->widget());
2583            else
2584                    return NULL;
2585  }  }
2586    
2587    
2588  // Retrieve a channel strip by sampler channel id.  // Retrieve a channel strip by sampler channel id.
2589  ChannelStrip* MainForm::channelStrip ( int iChannelID )  ChannelStrip *MainForm::channelStrip ( int iChannelID )
2590  {  {
2591          QWidgetList wlist = m_pWorkspace->windowList();          QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();
2592          if (wlist.isEmpty())          if (wlist.isEmpty())
2593                  return NULL;                  return NULL;
2594    
2595          for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {          for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {
2596                  ChannelStrip* pChannelStrip                  ChannelStrip *pChannelStrip = NULL;
2597                          = static_cast<ChannelStrip*> (wlist.at(iChannel));                  QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);
2598                    if (pMdiSubWindow)
2599                            pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
2600                  if (pChannelStrip) {                  if (pChannelStrip) {
2601                          Channel *pChannel = pChannelStrip->channel();                          Channel *pChannel = pChannelStrip->channel();
2602                          if (pChannel && pChannel->channelID() == iChannelID)                          if (pChannel && pChannel->channelID() == iChannelID)
# Line 2493  void MainForm::channelsMenuAboutToShow ( Line 2616  void MainForm::channelsMenuAboutToShow (
2616          m_ui.channelsMenu->addAction(m_ui.channelsArrangeAction);          m_ui.channelsMenu->addAction(m_ui.channelsArrangeAction);
2617          m_ui.channelsMenu->addAction(m_ui.channelsAutoArrangeAction);          m_ui.channelsMenu->addAction(m_ui.channelsAutoArrangeAction);
2618    
2619          QWidgetList wlist = m_pWorkspace->windowList();          QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();
2620          if (!wlist.isEmpty()) {          if (!wlist.isEmpty()) {
2621                  m_ui.channelsMenu->addSeparator();                  m_ui.channelsMenu->addSeparator();
2622                  for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {                  for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {
2623                          ChannelStrip* pChannelStrip                          ChannelStrip *pChannelStrip = NULL;
2624                                  = static_cast<ChannelStrip*> (wlist.at(iChannel));                          QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);
2625                            if (pMdiSubWindow)
2626                                    pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
2627                          if (pChannelStrip) {                          if (pChannelStrip) {
2628                                  QAction *pAction = m_ui.channelsMenu->addAction(                                  QAction *pAction = m_ui.channelsMenu->addAction(
2629                                          pChannelStrip->windowTitle(),                                          pChannelStrip->windowTitle(),
# Line 2520  void MainForm::channelsMenuActivated (vo Line 2645  void MainForm::channelsMenuActivated (vo
2645          if (pAction == NULL)          if (pAction == NULL)
2646                  return;                  return;
2647    
2648          ChannelStrip* pChannelStrip = channelStripAt(pAction->data().toInt());          ChannelStrip *pChannelStrip = channelStripAt(pAction->data().toInt());
2649          if (pChannelStrip) {          if (pChannelStrip) {
2650                  pChannelStrip->showNormal();                  pChannelStrip->showNormal();
2651                  pChannelStrip->setFocus();                  pChannelStrip->setFocus();
# Line 2581  void MainForm::timerSlot (void) Line 2706  void MainForm::timerSlot (void)
2706                          if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime)  {                          if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime)  {
2707                                  m_iTimerSlot = 0;                                  m_iTimerSlot = 0;
2708                                  // Update the channel stream usage for each strip...                                  // Update the channel stream usage for each strip...
2709                                  QWidgetList wlist = m_pWorkspace->windowList();                                  QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();
2710                                  for (int iChannel = 0;                                  for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {
2711                                                  iChannel < (int) wlist.count(); iChannel++) {                                          ChannelStrip *pChannelStrip = NULL;
2712                                          ChannelStrip* pChannelStrip                                          QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);
2713                                                  = (ChannelStrip*) wlist.at(iChannel);                                          if (pMdiSubWindow)
2714                                                    pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
2715                                          if (pChannelStrip && pChannelStrip->isVisible())                                          if (pChannelStrip && pChannelStrip->isVisible())
2716                                                  pChannelStrip->updateChannelUsage();                                                  pChannelStrip->updateChannelUsage();
2717                                  }                                  }
# Line 2637  void MainForm::startServer (void) Line 2763  void MainForm::startServer (void)
2763    
2764          // Setup stdout/stderr capture...          // Setup stdout/stderr capture...
2765  //      if (m_pOptions->bStdoutCapture) {  //      if (m_pOptions->bStdoutCapture) {
 #if QT_VERSION >= 0x040200  
2766                  m_pServer->setProcessChannelMode(QProcess::ForwardedChannels);                  m_pServer->setProcessChannelMode(QProcess::ForwardedChannels);
 #endif  
2767                  QObject::connect(m_pServer,                  QObject::connect(m_pServer,
2768                          SIGNAL(readyReadStandardOutput()),                          SIGNAL(readyReadStandardOutput()),
2769                          SLOT(readServerStdout()));                          SLOT(readServerStdout()));
# Line 2694  void MainForm::stopServer (bool bInterac Line 2818  void MainForm::stopServer (bool bInterac
2818                          "according to your current sampler session and you could alter the\n"                          "according to your current sampler session and you could alter the\n"
2819                          "sampler session at any time by relaunching QSampler.\n\n"                          "sampler session at any time by relaunching QSampler.\n\n"
2820                          "Do you want LinuxSampler to stop?"),                          "Do you want LinuxSampler to stop?"),
2821                          QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)                          QMessageBox::Yes | QMessageBox::No,
2822                            QMessageBox::Yes) == QMessageBox::No)
2823                  {                  {
2824                          bForceServerStop = false;                          bForceServerStop = false;
2825                  }                  }
# Line 2704  void MainForm::stopServer (bool bInterac Line 2829  void MainForm::stopServer (bool bInterac
2829          if (m_pServer && bForceServerStop) {          if (m_pServer && bForceServerStop) {
2830                  appendMessages(tr("Server is stopping..."));                  appendMessages(tr("Server is stopping..."));
2831                  if (m_pServer->state() == QProcess::Running) {                  if (m_pServer->state() == QProcess::Running) {
2832  #if defined(WIN32)                  #if defined(WIN32)
2833                          // Try harder...                          // Try harder...
2834                          m_pServer->kill();                          m_pServer->kill();
2835  #else                  #else
2836                          // Try softly...                          // Try softly...
2837                          m_pServer->terminate();                          m_pServer->terminate();
2838  #endif                  #endif
2839                  }                  }
2840          }       // Do final processing anyway.          }       // Do final processing anyway.
2841          else processServerExit();          else processServerExit();
# Line 2939  void MainForm::stopClient (void) Line 3064  void MainForm::stopClient (void)
3064    
3065    
3066  // Channel strip activation/selection.  // Channel strip activation/selection.
3067  void MainForm::activateStrip ( QWidget *pWidget )  void MainForm::activateStrip ( QMdiSubWindow *pMdiSubWindow )
3068  {  {
3069          ChannelStrip *pChannelStrip          ChannelStrip *pChannelStrip = NULL;
3070                  = static_cast<ChannelStrip *> (pWidget);          if (pMdiSubWindow)
3071                    pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
3072          if (pChannelStrip)          if (pChannelStrip)
3073                  pChannelStrip->setSelected(true);                  pChannelStrip->setSelected(true);
3074    
# Line 2950  void MainForm::activateStrip ( QWidget * Line 3076  void MainForm::activateStrip ( QWidget *
3076  }  }
3077    
3078    
3079    // Channel toolbar orientation change.
3080    void MainForm::channelsToolbarOrientation ( Qt::Orientation orientation )
3081    {
3082    #ifdef CONFIG_VOLUME
3083            m_pVolumeSlider->setOrientation(orientation);
3084            if (orientation == Qt::Horizontal) {
3085                    m_pVolumeSlider->setMinimumHeight(24);
3086                    m_pVolumeSlider->setMaximumHeight(32);
3087                    m_pVolumeSlider->setMinimumWidth(120);
3088                    m_pVolumeSlider->setMaximumWidth(640);
3089                    m_pVolumeSpinBox->setMaximumWidth(64);
3090                    m_pVolumeSpinBox->setButtonSymbols(QSpinBox::UpDownArrows);
3091            } else {
3092                    m_pVolumeSlider->setMinimumHeight(120);
3093                    m_pVolumeSlider->setMaximumHeight(480);
3094                    m_pVolumeSlider->setMinimumWidth(24);
3095                    m_pVolumeSlider->setMaximumWidth(32);
3096                    m_pVolumeSpinBox->setMaximumWidth(32);
3097                    m_pVolumeSpinBox->setButtonSymbols(QSpinBox::NoButtons);
3098            }
3099    #endif
3100    }
3101    
3102    
3103  } // namespace QSampler  } // namespace QSampler
3104    
3105    

Legend:
Removed from v.2113  
changed lines
  Added in v.2722

  ViewVC Help
Powered by ViewVC