/[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 1626 by schoenebeck, Sat Jan 5 13:29:11 2008 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-2007, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2014, rncbc aka Rui Nuno Capela. All rights reserved.
5     Copyright (C) 2007, 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
8     modify it under the terms of the GNU General Public License     modify it under the terms of the GNU General Public License
# Line 33  Line 33 
33  #include "qsamplerInstrumentListForm.h"  #include "qsamplerInstrumentListForm.h"
34  #include "qsamplerDeviceForm.h"  #include "qsamplerDeviceForm.h"
35  #include "qsamplerOptionsForm.h"  #include "qsamplerOptionsForm.h"
36    #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 55  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
66    namespace Qt {
67    const WindowFlags WindowCloseButtonHint = WindowFlags(0x08000000);
68    }
69    #endif
70    
71  #ifdef HAVE_SIGNAL_H  #ifdef HAVE_SIGNAL_H
72  #include <signal.h>  #include <signal.h>
# Line 84  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 96  namespace QSampler { Line 138  namespace QSampler {
138  #define QSAMPLER_STATUS_SESSION 3       // Current session modification state.  #define QSAMPLER_STATUS_SESSION 3       // Current session modification state.
139    
140    
141    // Specialties for thread-callback comunication.
142    #define QSAMPLER_LSCP_EVENT   QEvent::Type(QEvent::User + 1)
143    
144    
145  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
146  // CustomEvent -- specialty for callback comunication.  // LscpEvent -- specialty for LSCP callback comunication.
147    
 #define QSAMPLER_CUSTOM_EVENT   QEvent::Type(QEvent::User + 0)  
148    
149  class CustomEvent : public QEvent  class LscpEvent : public QEvent
150  {  {
151  public:  public:
152    
153          // Constructor.          // Constructor.
154          CustomEvent(lscp_event_t event, const char *pchData, int cchData)          LscpEvent(lscp_event_t event, const char *pchData, int cchData)
155                  : QEvent(QSAMPLER_CUSTOM_EVENT)                  : QEvent(QSAMPLER_LSCP_EVENT)
156          {          {
157                  m_event = event;                  m_event = event;
158                  m_data  = QString::fromUtf8(pchData, cchData);                  m_data  = QString::fromUtf8(pchData, cchData);
# Line 160  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  #endif  
213            // LADISH Level 1 suport.
214    
215            // 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 184  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 202  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 324  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 336  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 374  void MainForm::setup ( Options *pOptions Line 452  void MainForm::setup ( Options *pOptions
452    
453          // What style do we create these forms?          // What style do we create these forms?
454          Qt::WindowFlags wflags = Qt::Window          Qt::WindowFlags wflags = Qt::Window
 #if QT_VERSION >= 0x040200  
455                  | Qt::CustomizeWindowHint                  | Qt::CustomizeWindowHint
 #endif  
456                  | Qt::WindowTitleHint                  | Qt::WindowTitleHint
457                  | Qt::WindowSystemMenuHint                  | Qt::WindowSystemMenuHint
458                  | Qt::WindowMinMaxButtonsHint;                  | Qt::WindowMinMaxButtonsHint
459                    | Qt::WindowCloseButtonHint;
460          if (m_pOptions->bKeepOnTop)          if (m_pOptions->bKeepOnTop)
461                  wflags |= Qt::Tool;                  wflags |= Qt::Tool;
462    
463          // Some child forms are to be created right now.          // Some child forms are to be created right now.
464          m_pMessages = new Messages(this);          m_pMessages = new Messages(this);
465          m_pDeviceForm = new DeviceForm(this, wflags);          m_pDeviceForm = new DeviceForm(this, wflags);
466  #ifdef CONFIG_MIDI_INSTRUMENT  #ifdef CONFIG_MIDI_INSTRUMENT
467          m_pInstrumentListForm = new InstrumentListForm(this, wflags);          m_pInstrumentListForm = new InstrumentListForm(this, wflags);
468  #else  #else
469          viewInstrumentsAction->setEnabled(false);          m_ui.viewInstrumentsAction->setEnabled(false);
470  #endif  #endif
471    
472            // Setup messages logging appropriately...
473            m_pMessages->setLogging(
474                    m_pOptions->bMessagesLog,
475                    m_pOptions->sMessagesLogPath);
476    
477          // Set message defaults...          // Set message defaults...
478          updateMessagesFont();          updateMessagesFont();
479          updateMessagesLimit();          updateMessagesLimit();
# Line 420  void MainForm::setup ( Options *pOptions Line 504  void MainForm::setup ( Options *pOptions
504          }          }
505    
506          // Try to restore old window positioning and initial visibility.          // Try to restore old window positioning and initial visibility.
507          m_pOptions->loadWidgetGeometry(this);          m_pOptions->loadWidgetGeometry(this, true);
508          m_pOptions->loadWidgetGeometry(m_pInstrumentListForm);          m_pOptions->loadWidgetGeometry(m_pInstrumentListForm);
509          m_pOptions->loadWidgetGeometry(m_pDeviceForm);          m_pOptions->loadWidgetGeometry(m_pDeviceForm);
510    
# Line 464  bool MainForm::queryClose (void) Line 548  bool MainForm::queryClose (void)
548                          // And the children, and the main windows state,.                          // And the children, and the main windows state,.
549                          m_pOptions->saveWidgetGeometry(m_pDeviceForm);                          m_pOptions->saveWidgetGeometry(m_pDeviceForm);
550                          m_pOptions->saveWidgetGeometry(m_pInstrumentListForm);                          m_pOptions->saveWidgetGeometry(m_pInstrumentListForm);
551                          m_pOptions->saveWidgetGeometry(this);                          m_pOptions->saveWidgetGeometry(this, true);
552                          // Close popup widgets.                          // Close popup widgets.
553                          if (m_pInstrumentListForm)                          if (m_pInstrumentListForm)
554                                  m_pInstrumentListForm->close();                                  m_pInstrumentListForm->close();
# Line 481  bool MainForm::queryClose (void) Line 565  bool MainForm::queryClose (void)
565    
566  void MainForm::closeEvent ( QCloseEvent *pCloseEvent )  void MainForm::closeEvent ( QCloseEvent *pCloseEvent )
567  {  {
568          if (queryClose())          if (queryClose()) {
569                    DeviceStatusForm::deleteAllInstances();
570                  pCloseEvent->accept();                  pCloseEvent->accept();
571          else          } else
572                  pCloseEvent->ignore();                  pCloseEvent->ignore();
573  }  }
574    
# Line 512  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 546  void MainForm::dropEvent ( QDropEvent* p Line 632  void MainForm::dropEvent ( QDropEvent* p
632    
633    
634  // Custome event handler.  // Custome event handler.
635  void MainForm::customEvent(QEvent* pCustomEvent)  void MainForm::customEvent ( QEvent* pEvent )
636  {  {
637          // For the time being, just pump it to messages.          // For the time being, just pump it to messages.
638          if (pCustomEvent->type() == QSAMPLER_CUSTOM_EVENT) {          if (pEvent->type() == QSAMPLER_LSCP_EVENT) {
639                  CustomEvent *pEvent = static_cast<CustomEvent *> (pCustomEvent);                  LscpEvent *pLscpEvent = static_cast<LscpEvent *> (pEvent);
640                  if (pEvent->event() == LSCP_EVENT_CHANNEL_INFO) {                  switch (pLscpEvent->event()) {
641                          int iChannelID = pEvent->data().toInt();                          case LSCP_EVENT_CHANNEL_COUNT:
642                          ChannelStrip *pChannelStrip = channelStrip(iChannelID);                                  updateAllChannelStrips(true);
643                          if (pChannelStrip)                                  break;
644                                  channelStripChanged(pChannelStrip);                          case LSCP_EVENT_CHANNEL_INFO: {
645                  } else {                                  int iChannelID = pLscpEvent->data().toInt();
646                          appendMessagesColor(tr("Notify event: %1 data: %2")                                  ChannelStrip *pChannelStrip = channelStrip(iChannelID);
647                                  .arg(::lscp_event_to_text(pEvent->event()))                                  if (pChannelStrip)
648                                  .arg(pEvent->data()), "#996699");                                          channelStripChanged(pChannelStrip);
649                                    break;
650                            }
651                            case LSCP_EVENT_MIDI_INPUT_DEVICE_COUNT:
652                                    if (m_pDeviceForm) m_pDeviceForm->refreshDevices();
653                                    DeviceStatusForm::onDevicesChanged();
654                                    updateViewMidiDeviceStatusMenu();
655                                    break;
656                            case LSCP_EVENT_MIDI_INPUT_DEVICE_INFO: {
657                                    if (m_pDeviceForm) m_pDeviceForm->refreshDevices();
658                                    const int iDeviceID = pLscpEvent->data().section(' ', 0, 0).toInt();
659                                    DeviceStatusForm::onDeviceChanged(iDeviceID);
660                                    break;
661                            }
662                            case LSCP_EVENT_AUDIO_OUTPUT_DEVICE_COUNT:
663                                    if (m_pDeviceForm) m_pDeviceForm->refreshDevices();
664                                    break;
665                            case LSCP_EVENT_AUDIO_OUTPUT_DEVICE_INFO:
666                                    if (m_pDeviceForm) m_pDeviceForm->refreshDevices();
667                                    break;
668                    #if CONFIG_EVENT_CHANNEL_MIDI
669                            case LSCP_EVENT_CHANNEL_MIDI: {
670                                    const int iChannelID = pLscpEvent->data().section(' ', 0, 0).toInt();
671                                    ChannelStrip *pChannelStrip = channelStrip(iChannelID);
672                                    if (pChannelStrip)
673                                            pChannelStrip->midiActivityLedOn();
674                                    break;
675                            }
676                    #endif
677                    #if CONFIG_EVENT_DEVICE_MIDI
678                            case LSCP_EVENT_DEVICE_MIDI: {
679                                    const int iDeviceID = pLscpEvent->data().section(' ', 0, 0).toInt();
680                                    const int iPortID   = pLscpEvent->data().section(' ', 1, 1).toInt();
681                                    DeviceStatusForm *pDeviceStatusForm
682                                            = DeviceStatusForm::getInstance(iDeviceID);
683                                    if (pDeviceStatusForm)
684                                            pDeviceStatusForm->midiArrived(iPortID);
685                                    break;
686                            }
687                    #endif
688                            default:
689                                    appendMessagesColor(tr("LSCP Event: %1 data: %2")
690                                            .arg(::lscp_event_to_text(pLscpEvent->event()))
691                                            .arg(pLscpEvent->data()), "#996699");
692                  }                  }
693          }          }
694  }  }
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);
706    
707    #endif
708    }
709    
710    
711    void MainForm::updateViewMidiDeviceStatusMenu (void)
712    {
713            m_ui.viewMidiDeviceStatusMenu->clear();
714            const std::map<int, DeviceStatusForm *> statusForms
715                    = DeviceStatusForm::getInstances();
716            std::map<int, DeviceStatusForm *>::const_iterator iter
717                    = statusForms.begin();
718            for ( ; iter != statusForms.end(); ++iter) {
719                    DeviceStatusForm *pStatusForm = iter->second;
720                    m_ui.viewMidiDeviceStatusMenu->addAction(
721                            pStatusForm->visibleAction());
722            }
723    }
724    
725    
726  // Context menu event handler.  // Context menu event handler.
727  void MainForm::contextMenuEvent( QContextMenuEvent *pEvent )  void MainForm::contextMenuEvent( QContextMenuEvent *pEvent )
728  {  {
# Line 695  bool MainForm::saveSession ( bool bPromp Line 854  bool MainForm::saveSession ( bool bPromp
854                                  "\"%1\"\n\n"                                  "\"%1\"\n\n"
855                                  "Do you want to replace it?")                                  "Do you want to replace it?")
856                                  .arg(sFilename),                                  .arg(sFilename),
857                                  tr("Replace"), tr("Cancel")) > 0)                                  QMessageBox::Yes | QMessageBox::No)
858                                    == QMessageBox::No)
859                                  return false;                                  return false;
860                  }                  }
861          }          }
# Line 718  bool MainForm::closeSession ( bool bForc Line 878  bool MainForm::closeSession ( bool bForc
878                          "\"%1\"\n\n"                          "\"%1\"\n\n"
879                          "Do you want to save the changes?")                          "Do you want to save the changes?")
880                          .arg(sessionName(m_sFilename)),                          .arg(sessionName(m_sFilename)),
881                          tr("Save"), tr("Discard"), tr("Cancel"))) {                          QMessageBox::Save |
882                  case 0:     // Save...                          QMessageBox::Discard |
883                            QMessageBox::Cancel)) {
884                    case QMessageBox::Save:
885                          bClose = saveSession(false);                          bClose = saveSession(false);
886                          // Fall thru....                          // Fall thru....
887                  case 1:     // Discard                  case QMessageBox::Discard:
888                          break;                          break;
889                  default:    // Cancel.                  default:    // Cancel.
890                          bClose = false;                          bClose = false;
# Line 734  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 1033  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 1084  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 1114  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 1243  void MainForm::fileReset (void) Line 1412  void MainForm::fileReset (void)
1412                  "Please note that this operation may cause\n"                  "Please note that this operation may cause\n"
1413                  "temporary MIDI and Audio disruption.\n\n"                  "temporary MIDI and Audio disruption.\n\n"
1414                  "Do you want to reset the sampler engine now?"),                  "Do you want to reset the sampler engine now?"),
1415                  tr("Reset"), tr("Cancel")) > 0)                  QMessageBox::Ok | QMessageBox::Cancel)
1416                    == QMessageBox::Cancel)
1417                  return;                  return;
1418    
1419          // Trye closing the current session, first...          // Trye closing the current session, first...
# Line 1284  void MainForm::fileRestart (void) Line 1454  void MainForm::fileRestart (void)
1454                          "Please note that this operation may cause\n"                          "Please note that this operation may cause\n"
1455                          "temporary MIDI and Audio disruption.\n\n"                          "temporary MIDI and Audio disruption.\n\n"
1456                          "Do you want to restart the connection now?"),                          "Do you want to restart the connection now?"),
1457                          tr("Restart"), tr("Cancel")) == 0);                          QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok);
1458          }          }
1459    
1460          // Are we still for it?          // Are we still for it?
# Line 1349  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 1365  void MainForm::editRemoveChannel (void) Line 1535  void MainForm::editRemoveChannel (void)
1535                          "%1\n\n"                          "%1\n\n"
1536                          "Are you sure?")                          "Are you sure?")
1537                          .arg(pChannelStrip->windowTitle()),                          .arg(pChannelStrip->windowTitle()),
1538                          tr("OK"), tr("Cancel")) > 0)                          QMessageBox::Ok | QMessageBox::Cancel)
1539                            == QMessageBox::Cancel)
1540                          return;                          return;
1541          }          }
1542    
# Line 1373  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 1392  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 1407  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 1422  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 1440  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 1545  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 1556  void MainForm::viewOptions (void) Line 1725  void MainForm::viewOptions (void)
1725                  int     iOldServerTimeout   = m_pOptions->iServerTimeout;                  int     iOldServerTimeout   = m_pOptions->iServerTimeout;
1726                  bool    bOldServerStart     = m_pOptions->bServerStart;                  bool    bOldServerStart     = m_pOptions->bServerStart;
1727                  QString sOldServerCmdLine   = m_pOptions->sServerCmdLine;                  QString sOldServerCmdLine   = m_pOptions->sServerCmdLine;
1728                    bool    bOldMessagesLog     = m_pOptions->bMessagesLog;
1729                    QString sOldMessagesLogPath = m_pOptions->sMessagesLogPath;
1730                  QString sOldDisplayFont     = m_pOptions->sDisplayFont;                  QString sOldDisplayFont     = m_pOptions->sDisplayFont;
1731                  bool    bOldDisplayEffect   = m_pOptions->bDisplayEffect;                  bool    bOldDisplayEffect   = m_pOptions->bDisplayEffect;
1732                  int     iOldMaxVolume       = m_pOptions->iMaxVolume;                  int     iOldMaxVolume       = m_pOptions->iMaxVolume;
# Line 1567  void MainForm::viewOptions (void) Line 1738  void MainForm::viewOptions (void)
1738                  bool    bOldCompletePath    = m_pOptions->bCompletePath;                  bool    bOldCompletePath    = m_pOptions->bCompletePath;
1739                  bool    bOldInstrumentNames = m_pOptions->bInstrumentNames;                  bool    bOldInstrumentNames = m_pOptions->bInstrumentNames;
1740                  int     iOldMaxRecentFiles  = m_pOptions->iMaxRecentFiles;                  int     iOldMaxRecentFiles  = m_pOptions->iMaxRecentFiles;
1741                    int     iOldBaseFontSize    = m_pOptions->iBaseFontSize;
1742                  // Load the current setup settings.                  // Load the current setup settings.
1743                  pOptionsForm->setup(m_pOptions);                  pOptionsForm->setup(m_pOptions);
1744                  // Show the setup dialog...                  // Show the setup dialog...
# Line 1575  void MainForm::viewOptions (void) Line 1747  void MainForm::viewOptions (void)
1747                          if (( bOldStdoutCapture && !m_pOptions->bStdoutCapture) ||                          if (( bOldStdoutCapture && !m_pOptions->bStdoutCapture) ||
1748                                  (!bOldStdoutCapture &&  m_pOptions->bStdoutCapture) ||                                  (!bOldStdoutCapture &&  m_pOptions->bStdoutCapture) ||
1749                                  ( bOldKeepOnTop     && !m_pOptions->bKeepOnTop)     ||                                  ( bOldKeepOnTop     && !m_pOptions->bKeepOnTop)     ||
1750                                  (!bOldKeepOnTop     &&  m_pOptions->bKeepOnTop)) {                                  (!bOldKeepOnTop     &&  m_pOptions->bKeepOnTop)     ||
1751                                    (iOldBaseFontSize   !=  m_pOptions->iBaseFontSize)) {
1752                                  QMessageBox::information(this,                                  QMessageBox::information(this,
1753                                          QSAMPLER_TITLE ": " + tr("Information"),                                          QSAMPLER_TITLE ": " + tr("Information"),
1754                                          tr("Some settings may be only effective\n"                                          tr("Some settings may be only effective\n"
1755                                          "next time you start this program."), tr("OK"));                                          "next time you start this program."));
1756                                  updateMessagesCapture();                                  updateMessagesCapture();
1757                          }                          }
1758                          // Check wheather something immediate has changed.                          // Check wheather something immediate has changed.
1759                            if (( bOldMessagesLog && !m_pOptions->bMessagesLog) ||
1760                                    (!bOldMessagesLog &&  m_pOptions->bMessagesLog) ||
1761                                    (sOldMessagesLogPath != m_pOptions->sMessagesLogPath))
1762                                    m_pMessages->setLogging(
1763                                            m_pOptions->bMessagesLog, m_pOptions->sMessagesLogPath);
1764                          if (( bOldCompletePath && !m_pOptions->bCompletePath) ||                          if (( bOldCompletePath && !m_pOptions->bCompletePath) ||
1765                                  (!bOldCompletePath &&  m_pOptions->bCompletePath) ||                                  (!bOldCompletePath &&  m_pOptions->bCompletePath) ||
1766                                  (iOldMaxRecentFiles != m_pOptions->iMaxRecentFiles))                                  (iOldMaxRecentFiles != m_pOptions->iMaxRecentFiles))
# Line 1629  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 1737  void MainForm::helpAbout (void) Line 1920  void MainForm::helpAbout (void)
1920          sText += tr("Instrument editing support disabled.");          sText += tr("Instrument editing support disabled.");
1921          sText += "</font></small><br />";          sText += "</font></small><br />";
1922  #endif  #endif
1923    #ifndef CONFIG_EVENT_CHANNEL_MIDI
1924            sText += "<small><font color=\"red\">";
1925            sText += tr("Channel MIDI event support disabled.");
1926            sText += "</font></small><br />";
1927    #endif
1928    #ifndef CONFIG_EVENT_DEVICE_MIDI
1929            sText += "<small><font color=\"red\">";
1930            sText += tr("Device MIDI event support disabled.");
1931            sText += "</font></small><br />";
1932    #endif
1933    #ifndef CONFIG_MAX_VOICES
1934            sText += "<small><font color=\"red\">";
1935            sText += tr("Runtime max. voices / disk streams support disabled.");
1936            sText += "</font></small><br />";
1937    #endif
1938          sText += "<br />\n";          sText += "<br />\n";
1939          sText += tr("Using") + ": ";          sText += tr("Using") + ": ";
1940          sText += ::lscp_client_package();          sText += ::lscp_client_package();
# Line 1777  void MainForm::stabilizeForm (void) Line 1975  void MainForm::stabilizeForm (void)
1975          setWindowTitle(tr(QSAMPLER_TITLE " - [%1]").arg(sSessionName));          setWindowTitle(tr(QSAMPLER_TITLE " - [%1]").arg(sSessionName));
1976    
1977          // Update the main menu state...          // Update the main menu state...
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->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 1795  void MainForm::stabilizeForm (void) Line 1994  void MainForm::stabilizeForm (void)
1994          m_ui.editEditChannelAction->setEnabled(false);          m_ui.editEditChannelAction->setEnabled(false);
1995  #endif  #endif
1996          m_ui.editResetChannelAction->setEnabled(bHasChannel);          m_ui.editResetChannelAction->setEnabled(bHasChannel);
1997          m_ui.editResetAllChannelsAction->setEnabled(bHasChannel);          m_ui.editResetAllChannelsAction->setEnabled(bHasChannels);
1998          m_ui.viewMessagesAction->setChecked(m_pMessages && m_pMessages->isVisible());          m_ui.viewMessagesAction->setChecked(m_pMessages && m_pMessages->isVisible());
1999  #ifdef CONFIG_MIDI_INSTRUMENT  #ifdef CONFIG_MIDI_INSTRUMENT
2000          m_ui.viewInstrumentsAction->setChecked(m_pInstrumentListForm          m_ui.viewInstrumentsAction->setChecked(m_pInstrumentListForm
# Line 1807  void MainForm::stabilizeForm (void) Line 2006  void MainForm::stabilizeForm (void)
2006          m_ui.viewDevicesAction->setChecked(m_pDeviceForm          m_ui.viewDevicesAction->setChecked(m_pDeviceForm
2007                  && m_pDeviceForm->isVisible());                  && m_pDeviceForm->isVisible());
2008          m_ui.viewDevicesAction->setEnabled(bHasClient);          m_ui.viewDevicesAction->setEnabled(bHasClient);
2009          m_ui.channelsArrangeAction->setEnabled(bHasChannel);          m_ui.viewMidiDeviceStatusMenu->setEnabled(
2010                    DeviceStatusForm::getInstances().size() > 0);
2011            m_ui.channelsArrangeAction->setEnabled(bHasChannels);
2012    
2013  #ifdef CONFIG_VOLUME  #ifdef CONFIG_VOLUME
2014          // Toolbar widgets are also affected...          // Toolbar widgets are also affected...
# Line 1873  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 1911  void MainForm::updateSession (void) Line 2112  void MainForm::updateSession (void)
2112          }          }
2113  #endif  #endif
2114    
2115            updateAllChannelStrips(false);
2116    
2117            // Do we auto-arrange?
2118            if (m_pOptions && m_pOptions->bAutoArrange)
2119                    channelsArrange();
2120    
2121            // Remember to refresh devices and instruments...
2122            if (m_pInstrumentListForm)
2123                    m_pInstrumentListForm->refreshInstruments();
2124            if (m_pDeviceForm)
2125                    m_pDeviceForm->refreshDevices();
2126    }
2127    
2128    
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 1922  void MainForm::updateSession (void) Line 2139  void MainForm::updateSession (void)
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?
2148                    if (m_pOptions && m_pOptions->bAutoArrange)
2149                            channelsArrange();
2150                    // remove dead channel strips
2151                    if (bRemoveDeadStrips) {
2152                            QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();
2153                            for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {
2154                                    ChannelStrip *pChannelStrip = NULL;
2155                                    QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);
2156                                    if (pMdiSubWindow)
2157                                            pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
2158                                    if (pChannelStrip) {
2159                                            bool bExists = false;
2160                                            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                                    }
2172                            }
2173                    }
2174                  m_pWorkspace->setUpdatesEnabled(true);                  m_pWorkspace->setUpdatesEnabled(true);
2175          }          }
2176    
2177          // Do we auto-arrange?          stabilizeForm();
         if (m_pOptions && m_pOptions->bAutoArrange)  
                 channelsArrange();  
   
         // Remember to refresh devices and instruments...  
         if (m_pInstrumentListForm)  
                 m_pInstrumentListForm->refreshInstruments();  
         if (m_pDeviceForm)  
                 m_pDeviceForm->refreshDevices();  
2178  }  }
2179    
2180    
# Line 1988  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 2017  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 2035  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 2063  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 2114  void MainForm::appendMessagesError( cons Line 2359  void MainForm::appendMessagesError( cons
2359          QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);          QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
2360    
2361          QMessageBox::critical(this,          QMessageBox::critical(this,
2362                  QSAMPLER_TITLE ": " + tr("Error"), s, tr("Cancel"));                  QSAMPLER_TITLE ": " + tr("Error"), s, QMessageBox::Cancel);
2363  }  }
2364    
2365    
# Line 2177  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 2200  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 2220  ChannelStrip* MainForm::createChannelStr Line 2466  ChannelStrip* MainForm::createChannelStr
2466  }  }
2467    
2468    
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.
2477            delete pChannelStrip;
2478            delete pMdiSubWindow;
2479    
2480            // Do we auto-arrange?
2481            if (m_pOptions && m_pOptions->bAutoArrange)
2482                    channelsArrange();
2483    
2484            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          QWidgetList wlist = m_pWorkspace->windowList();          if (!m_pWorkspace) return NULL;
2503    
2504            QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();
2505          if (wlist.isEmpty())          if (wlist.isEmpty())
2506                  return NULL;                  return NULL;
2507    
2508          return static_cast<ChannelStrip *> (wlist.at(iChannel));          if (iChannel < 0 || iChannel >= wlist.size())
2509                    return NULL;
2510    
2511            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 2267  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 2294  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 2355  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 2387  void MainForm::startServer (void) Line 2670  void MainForm::startServer (void)
2670    
2671          // Is the server process instance still here?          // Is the server process instance still here?
2672          if (m_pServer) {          if (m_pServer) {
2673                  switch (QMessageBox::warning(this,                  if (QMessageBox::warning(this,
2674                          QSAMPLER_TITLE ": " + tr("Warning"),                          QSAMPLER_TITLE ": " + tr("Warning"),
2675                          tr("Could not start the LinuxSampler server.\n\n"                          tr("Could not start the LinuxSampler server.\n\n"
2676                          "Maybe it is already started."),                          "Maybe it is already started."),
2677                          tr("Stop"), tr("Kill"), tr("Cancel"))) {                          QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok) {
                 case 0:  
2678                          m_pServer->terminate();                          m_pServer->terminate();
                         break;  
                 case 1:  
2679                          m_pServer->kill();                          m_pServer->kill();
                         break;  
2680                  }                  }
2681                  return;                  return;
2682          }          }
# Line 2415  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 2471  void MainForm::stopServer (bool bInterac Line 2748  void MainForm::stopServer (bool bInterac
2748                          "running in the background. The sampler would continue to work\n"                          "running in the background. The sampler would continue to work\n"
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 or to keep running in\n"                          "Do you want LinuxSampler to stop?"),
2752                          "the background?"),                          QMessageBox::Yes | QMessageBox::No,
2753                          tr("Stop"), tr("Keep Running")) == 1)                          QMessageBox::Yes) == QMessageBox::No)
2754                  {                  {
2755                          bForceServerStop = false;                          bForceServerStop = false;
2756                  }                  }
# Line 2483  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 2559  lscp_status_t qsampler_client_callback ( Line 2836  lscp_status_t qsampler_client_callback (
2836          // as this is run under some other thread context.          // as this is run under some other thread context.
2837          // A custom event must be posted here...          // A custom event must be posted here...
2838          QApplication::postEvent(pMainForm,          QApplication::postEvent(pMainForm,
2839                  new CustomEvent(event, pchData, cchData));                  new LscpEvent(event, pchData, cchData));
2840    
2841          return LSCP_OK;          return LSCP_OK;
2842  }  }
# Line 2604  bool MainForm::startClient (void) Line 2881  bool MainForm::startClient (void)
2881                  .arg(::lscp_client_get_timeout(m_pClient)));                  .arg(::lscp_client_get_timeout(m_pClient)));
2882    
2883          // Subscribe to channel info change notifications...          // Subscribe to channel info change notifications...
2884            if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_CHANNEL_COUNT) != LSCP_OK)
2885                    appendMessagesClient("lscp_client_subscribe(CHANNEL_COUNT)");
2886          if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_CHANNEL_INFO) != LSCP_OK)          if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_CHANNEL_INFO) != LSCP_OK)
2887                  appendMessagesClient("lscp_client_subscribe");                  appendMessagesClient("lscp_client_subscribe(CHANNEL_INFO)");
2888    
2889            DeviceStatusForm::onDevicesChanged(); // initialize
2890            updateViewMidiDeviceStatusMenu();
2891            if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_MIDI_INPUT_DEVICE_COUNT) != LSCP_OK)
2892                    appendMessagesClient("lscp_client_subscribe(MIDI_INPUT_DEVICE_COUNT)");
2893            if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_MIDI_INPUT_DEVICE_INFO) != LSCP_OK)
2894                    appendMessagesClient("lscp_client_subscribe(MIDI_INPUT_DEVICE_INFO)");
2895            if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_AUDIO_OUTPUT_DEVICE_COUNT) != LSCP_OK)
2896                    appendMessagesClient("lscp_client_subscribe(AUDIO_OUTPUT_DEVICE_COUNT)");
2897            if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_AUDIO_OUTPUT_DEVICE_INFO) != LSCP_OK)
2898                    appendMessagesClient("lscp_client_subscribe(AUDIO_OUTPUT_DEVICE_INFO)");
2899    
2900    #if CONFIG_EVENT_CHANNEL_MIDI
2901            // Subscribe to channel MIDI data notifications...
2902            if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_CHANNEL_MIDI) != LSCP_OK)
2903                    appendMessagesClient("lscp_client_subscribe(CHANNEL_MIDI)");
2904    #endif
2905    
2906    #if CONFIG_EVENT_DEVICE_MIDI
2907            // Subscribe to channel MIDI data notifications...
2908            if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_DEVICE_MIDI) != LSCP_OK)
2909                    appendMessagesClient("lscp_client_subscribe(DEVICE_MIDI)");
2910    #endif
2911    
2912          // We may stop scheduling around.          // We may stop scheduling around.
2913          stopSchedule();          stopSchedule();
# Line 2632  bool MainForm::startClient (void) Line 2934  bool MainForm::startClient (void)
2934                  }                  }
2935          }          }
2936    
2937            // send the current / loaded fine tuning settings to the sampler
2938            m_pOptions->sendFineTuningSettings();
2939    
2940          // Make a new session          // Make a new session
2941          return newSession();          return newSession();
2942  }  }
# Line 2659  void MainForm::stopClient (void) Line 2964  void MainForm::stopClient (void)
2964          closeSession(false);          closeSession(false);
2965    
2966          // Close us as a client...          // Close us as a client...
2967    #if CONFIG_EVENT_DEVICE_MIDI
2968            ::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_DEVICE_MIDI);
2969    #endif
2970    #if CONFIG_EVENT_CHANNEL_MIDI
2971            ::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_CHANNEL_MIDI);
2972    #endif
2973            ::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_AUDIO_OUTPUT_DEVICE_INFO);
2974            ::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_AUDIO_OUTPUT_DEVICE_COUNT);
2975            ::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_MIDI_INPUT_DEVICE_INFO);
2976            ::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_MIDI_INPUT_DEVICE_COUNT);
2977          ::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_CHANNEL_INFO);          ::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_CHANNEL_INFO);
2978            ::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_CHANNEL_COUNT);
2979          ::lscp_client_destroy(m_pClient);          ::lscp_client_destroy(m_pClient);
2980          m_pClient = NULL;          m_pClient = NULL;
2981    
# Line 2679  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 2690  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.1626  
changed lines
  Added in v.2717

  ViewVC Help
Powered by ViewVC