/[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 1514 by capela, Fri Nov 23 10:51:37 2007 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-2007, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2015, rncbc aka Rui Nuno Capela. All rights reserved.
5     Copyright (C) 2007, 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 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 77  static inline long lroundf ( float x ) Line 89  static inline long lroundf ( float x )
89  }  }
90  #endif  #endif
91    
92    
93    // All winsock apps needs this.
94    #if defined(WIN32)
95    static WSADATA _wsaData;
96    #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 {
130    
131  // Timer constant stuff.  // Timer constant stuff.
132  #define QSAMPLER_TIMER_MSECS    200  #define QSAMPLER_TIMER_MSECS    200
133    
# Line 87  static inline long lroundf ( float x ) Line 138  static inline long lroundf ( float x )
138  #define QSAMPLER_STATUS_SESSION 3       // Current session modification state.  #define QSAMPLER_STATUS_SESSION 3       // Current session modification state.
139    
140    
141  // All winsock apps needs this.  // Specialties for thread-callback comunication.
142  #if defined(WIN32)  #define QSAMPLER_LSCP_EVENT   QEvent::Type(QEvent::User + 1)
 static WSADATA _wsaData;  
 #endif  
143    
144    
145  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
146  // qsamplerCustomEvent -- specialty for callback comunication.  // LscpEvent -- specialty for LSCP callback comunication.
147    
 #define QSAMPLER_CUSTOM_EVENT   QEvent::Type(QEvent::User + 0)  
148    
149  class qsamplerCustomEvent : public QEvent  class LscpEvent : public QEvent
150  {  {
151  public:  public:
152    
153          // Constructor.          // Constructor.
154          qsamplerCustomEvent(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 126  private: Line 174  private:
174  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
175  // qsamplerMainForm -- Main window form implementation.  // qsamplerMainForm -- Main window form implementation.
176    
 namespace QSampler {  
   
177  // Kind of singleton reference.  // Kind of singleton reference.
178  MainForm* MainForm::g_pMainForm = NULL;  MainForm* MainForm::g_pMainForm = NULL;
179    
# Line 159  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 171  MainForm::MainForm ( QWidget *pParent ) Line 242  MainForm::MainForm ( QWidget *pParent )
242          // Volume slider...          // Volume slider...
243          m_ui.channelsToolbar->addSeparator();          m_ui.channelsToolbar->addSeparator();
244          m_pVolumeSlider = new QSlider(Qt::Horizontal, m_ui.channelsToolbar);          m_pVolumeSlider = new QSlider(Qt::Horizontal, m_ui.channelsToolbar);
245          m_pVolumeSlider->setTickPosition(QSlider::TicksBelow);          m_pVolumeSlider->setTickPosition(QSlider::TicksBothSides);
246          m_pVolumeSlider->setTickInterval(10);          m_pVolumeSlider->setTickInterval(10);
247          m_pVolumeSlider->setPageStep(10);          m_pVolumeSlider->setPageStep(10);
248          m_pVolumeSlider->setSingleStep(10);          m_pVolumeSlider->setSingleStep(10);
# Line 183  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();
# Line 200  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 322  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 334  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 365  MainForm::~MainForm() Line 445  MainForm::~MainForm()
445    
446    
447  // Make and set a proper setup options step.  // Make and set a proper setup options step.
448  void MainForm::setup ( qsamplerOptions *pOptions )  void MainForm::setup ( Options *pOptions )
449  {  {
450          // We got options?          // We got options?
451          m_pOptions = pOptions;          m_pOptions = 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 qsamplerMessages(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 418  void MainForm::setup ( qsamplerOptions * Line 504  void MainForm::setup ( qsamplerOptions *
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 462  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();
555                          if (m_pDeviceForm)                          if (m_pDeviceForm)
556                                  m_pDeviceForm->close();                                  m_pDeviceForm->close();
557                          // Stop client and/or server, gracefully.                          // Stop client and/or server, gracefully.
558                          stopServer();                          stopServer(true /*interactive*/);
559                  }                  }
560          }          }
561    
# Line 479  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 510  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 (qsamplerChannel::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                                  qsamplerChannel *pChannel = new qsamplerChannel();                                  Channel *pChannel = new Channel();
604                                  if (pChannel == NULL)                                  if (pChannel == NULL)
605                                          return;                                          return;
606                                  // Start setting the instrument filename...                                  // Start setting the instrument filename...
# Line 544  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                  qsamplerCustomEvent *pEvent = (qsamplerCustomEvent *) 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 575  void MainForm::contextMenuEvent( QContex Line 736  void MainForm::contextMenuEvent( QContex
736  // qsamplerMainForm -- Brainless public property accessors.  // qsamplerMainForm -- Brainless public property accessors.
737    
738  // The global options settings property.  // The global options settings property.
739  qsamplerOptions *MainForm::options (void) const  Options *MainForm::options (void) const
740  {  {
741          return m_pOptions;          return m_pOptions;
742  }  }
# Line 693  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 716  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 732  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                                  qsamplerChannel *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 876  bool MainForm::saveSessionFile ( const Q Line 1045  bool MainForm::saveSessionFile ( const Q
1045    
1046          // Audio device mapping.          // Audio device mapping.
1047          QMap<int, int> audioDeviceMap;          QMap<int, int> audioDeviceMap;
1048          piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Audio);          piDeviceIDs = Device::getDevices(m_pClient, Device::Audio);
1049          for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {          for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {
1050                  ts << endl;                  ts << endl;
1051                  qsamplerDevice device(qsamplerDevice::Audio, piDeviceIDs[iDevice]);                  Device device(Device::Audio, piDeviceIDs[iDevice]);
1052                  // Audio device specification...                  // Audio device specification...
1053                  ts << "# " << device.deviceTypeName() << " " << device.driverName()                  ts << "# " << device.deviceTypeName() << " " << device.driverName()
1054                          << " " << tr("Device") << " " << iDevice << endl;                          << " " << tr("Device") << " " << iDevice << endl;
1055                  ts << "CREATE AUDIO_OUTPUT_DEVICE " << device.driverName();                  ts << "CREATE AUDIO_OUTPUT_DEVICE " << device.driverName();
1056                  qsamplerDeviceParamMap::ConstIterator deviceParam;                  DeviceParamMap::ConstIterator deviceParam;
1057                  for (deviceParam = device.params().begin();                  for (deviceParam = device.params().begin();
1058                                  deviceParam != device.params().end();                                  deviceParam != device.params().end();
1059                                          ++deviceParam) {                                          ++deviceParam) {
1060                          const qsamplerDeviceParam& param = deviceParam.value();                          const DeviceParam& param = deviceParam.value();
1061                          if (param.value.isEmpty()) ts << "# ";                          if (param.value.isEmpty()) ts << "# ";
1062                          ts << " " << deviceParam.key() << "='" << param.value << "'";                          ts << " " << deviceParam.key() << "='" << param.value << "'";
1063                  }                  }
1064                  ts << endl;                  ts << endl;
1065                  // Audio channel parameters...                  // Audio channel parameters...
1066                  int iPort = 0;                  int iPort = 0;
1067                  QListIterator<qsamplerDevicePort *> iter(device.ports());                  QListIterator<DevicePort *> iter(device.ports());
1068                  while (iter.hasNext()) {                  while (iter.hasNext()) {
1069                          qsamplerDevicePort *pPort = iter.next();                          DevicePort *pPort = iter.next();
1070                          qsamplerDeviceParamMap::ConstIterator portParam;                          DeviceParamMap::ConstIterator portParam;
1071                          for (portParam = pPort->params().begin();                          for (portParam = pPort->params().begin();
1072                                          portParam != pPort->params().end();                                          portParam != pPort->params().end();
1073                                                  ++portParam) {                                                  ++portParam) {
1074                                  const qsamplerDeviceParam& param = portParam.value();                                  const DeviceParam& param = portParam.value();
1075                                  if (param.fix || param.value.isEmpty()) ts << "# ";                                  if (param.fix || param.value.isEmpty()) ts << "# ";
1076                                  ts << "SET AUDIO_OUTPUT_CHANNEL_PARAMETER " << iDevice                                  ts << "SET AUDIO_OUTPUT_CHANNEL_PARAMETER " << iDevice
1077                                          << " " << iPort << " " << portParam.key()                                          << " " << iPort << " " << portParam.key()
# Line 918  bool MainForm::saveSessionFile ( const Q Line 1087  bool MainForm::saveSessionFile ( const Q
1087    
1088          // MIDI device mapping.          // MIDI device mapping.
1089          QMap<int, int> midiDeviceMap;          QMap<int, int> midiDeviceMap;
1090          piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Midi);          piDeviceIDs = Device::getDevices(m_pClient, Device::Midi);
1091          for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {          for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {
1092                  ts << endl;                  ts << endl;
1093                  qsamplerDevice device(qsamplerDevice::Midi, piDeviceIDs[iDevice]);                  Device device(Device::Midi, piDeviceIDs[iDevice]);
1094                  // MIDI device specification...                  // MIDI device specification...
1095                  ts << "# " << device.deviceTypeName() << " " << device.driverName()                  ts << "# " << device.deviceTypeName() << " " << device.driverName()
1096                          << " " << tr("Device") << " " << iDevice << endl;                          << " " << tr("Device") << " " << iDevice << endl;
1097                  ts << "CREATE MIDI_INPUT_DEVICE " << device.driverName();                  ts << "CREATE MIDI_INPUT_DEVICE " << device.driverName();
1098                  qsamplerDeviceParamMap::ConstIterator deviceParam;                  DeviceParamMap::ConstIterator deviceParam;
1099                  for (deviceParam = device.params().begin();                  for (deviceParam = device.params().begin();
1100                                  deviceParam != device.params().end();                                  deviceParam != device.params().end();
1101                                          ++deviceParam) {                                          ++deviceParam) {
1102                          const qsamplerDeviceParam& param = deviceParam.value();                          const DeviceParam& param = deviceParam.value();
1103                          if (param.value.isEmpty()) ts << "# ";                          if (param.value.isEmpty()) ts << "# ";
1104                          ts << " " << deviceParam.key() << "='" << param.value << "'";                          ts << " " << deviceParam.key() << "='" << param.value << "'";
1105                  }                  }
1106                  ts << endl;                  ts << endl;
1107                  // MIDI port parameters...                  // MIDI port parameters...
1108                  int iPort = 0;                  int iPort = 0;
1109                  QListIterator<qsamplerDevicePort *> iter(device.ports());                  QListIterator<DevicePort *> iter(device.ports());
1110                  while (iter.hasNext()) {                  while (iter.hasNext()) {
1111                          qsamplerDevicePort *pPort = iter.next();                          DevicePort *pPort = iter.next();
1112                          qsamplerDeviceParamMap::ConstIterator portParam;                          DeviceParamMap::ConstIterator portParam;
1113                          for (portParam = pPort->params().begin();                          for (portParam = pPort->params().begin();
1114                                          portParam != pPort->params().end();                                          portParam != pPort->params().end();
1115                                                  ++portParam) {                                                  ++portParam) {
1116                                  const qsamplerDeviceParam& param = portParam.value();                                  const DeviceParam& param = portParam.value();
1117                                  if (param.fix || param.value.isEmpty()) ts << "# ";                                  if (param.fix || param.value.isEmpty()) ts << "# ";
1118                                  ts << "SET MIDI_INPUT_PORT_PARAMETER " << iDevice                                  ts << "SET MIDI_INPUT_PORT_PARAMETER " << iDevice
1119                                  << " " << iPort << " " << portParam.key()                                  << " " << iPort << " " << portParam.key()
# Line 1031  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                          qsamplerChannel *pChannel = pChannelStrip->channel();                          Channel *pChannel = pChannelStrip->channel();
1211                          if (pChannel) {                          if (pChannel) {
1212                                  ts << "# " << tr("Channel") << " " << iChannel << endl;                                  ts << "# " << tr("Channel") << " " << iChannel << endl;
1213                                  ts << "ADD CHANNEL" << endl;                                  ts << "ADD CHANNEL" << endl;
# Line 1068  bool MainForm::saveSessionFile ( const Q Line 1239  bool MainForm::saveSessionFile ( const Q
1239                                  ts << "LOAD INSTRUMENT NON_MODAL '"                                  ts << "LOAD INSTRUMENT NON_MODAL '"
1240                                          << pChannel->instrumentFile() << "' "                                          << pChannel->instrumentFile() << "' "
1241                                          << pChannel->instrumentNr() << " " << iChannel << endl;                                          << pChannel->instrumentNr() << " " << iChannel << endl;
1242                                  qsamplerChannelRoutingMap::ConstIterator audioRoute;                                  ChannelRoutingMap::ConstIterator audioRoute;
1243                                  for (audioRoute = pChannel->audioRouting().begin();                                  for (audioRoute = pChannel->audioRouting().begin();
1244                                                  audioRoute != pChannel->audioRouting().end();                                                  audioRoute != pChannel->audioRouting().end();
1245                                                          ++audioRoute) {                                                          ++audioRoute) {
# Line 1082  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 1112  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 1234  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                  tr("Reset"), tr("Cancel")) > 0)                          "Do you want to reset the sampler engine now?");
1416                  return;          #if 0
1417                    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 1274  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                          tr("Restart"), tr("Cancel")) == 0);          #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 1313  void MainForm::editAddChannel (void) Line 1522  void MainForm::editAddChannel (void)
1522                  return;                  return;
1523    
1524          // Just create the channel instance...          // Just create the channel instance...
1525          qsamplerChannel *pChannel = new qsamplerChannel();          Channel *pChannel = new Channel();
1526          if (pChannel == NULL)          if (pChannel == NULL)
1527                  return;                  return;
1528    
# Line 1331  void MainForm::editAddChannel (void) Line 1540  void MainForm::editAddChannel (void)
1540                  return;                  return;
1541          }          }
1542    
1543            // Do we auto-arrange?
1544            if (m_pOptions && m_pOptions->bAutoArrange)
1545                    channelsArrange();
1546    
1547          // Make that an overall update.          // Make that an overall update.
1548          m_iDirtyCount++;          m_iDirtyCount++;
1549          stabilizeForm();          stabilizeForm();
# Line 1343  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    
1563          qsamplerChannel *pChannel = pChannelStrip->channel();          Channel *pChannel = pChannelStrip->channel();
1564          if (pChannel == NULL)          if (pChannel == NULL)
1565                  return;                  return;
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                          tr("OK"), tr("Cancel")) > 0)          #if 0
1576                    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 1386  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 1401  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 1416  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 1434  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 1539  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 1550  void MainForm::viewOptions (void) Line 1778  void MainForm::viewOptions (void)
1778                  int     iOldServerTimeout   = m_pOptions->iServerTimeout;                  int     iOldServerTimeout   = m_pOptions->iServerTimeout;
1779                  bool    bOldServerStart     = m_pOptions->bServerStart;                  bool    bOldServerStart     = m_pOptions->bServerStart;
1780                  QString sOldServerCmdLine   = m_pOptions->sServerCmdLine;                  QString sOldServerCmdLine   = m_pOptions->sServerCmdLine;
1781                    bool    bOldMessagesLog     = m_pOptions->bMessagesLog;
1782                    QString sOldMessagesLogPath = m_pOptions->sMessagesLogPath;
1783                  QString sOldDisplayFont     = m_pOptions->sDisplayFont;                  QString sOldDisplayFont     = m_pOptions->sDisplayFont;
1784                  bool    bOldDisplayEffect   = m_pOptions->bDisplayEffect;                  bool    bOldDisplayEffect   = m_pOptions->bDisplayEffect;
1785                  int     iOldMaxVolume       = m_pOptions->iMaxVolume;                  int     iOldMaxVolume       = m_pOptions->iMaxVolume;
# Line 1561  void MainForm::viewOptions (void) Line 1791  void MainForm::viewOptions (void)
1791                  bool    bOldCompletePath    = m_pOptions->bCompletePath;                  bool    bOldCompletePath    = m_pOptions->bCompletePath;
1792                  bool    bOldInstrumentNames = m_pOptions->bInstrumentNames;                  bool    bOldInstrumentNames = m_pOptions->bInstrumentNames;
1793                  int     iOldMaxRecentFiles  = m_pOptions->iMaxRecentFiles;                  int     iOldMaxRecentFiles  = m_pOptions->iMaxRecentFiles;
1794                    int     iOldBaseFontSize    = m_pOptions->iBaseFontSize;
1795                  // Load the current setup settings.                  // Load the current setup settings.
1796                  pOptionsForm->setup(m_pOptions);                  pOptionsForm->setup(m_pOptions);
1797                  // Show the setup dialog...                  // Show the setup dialog...
# Line 1569  void MainForm::viewOptions (void) Line 1800  void MainForm::viewOptions (void)
1800                          if (( bOldStdoutCapture && !m_pOptions->bStdoutCapture) ||                          if (( bOldStdoutCapture && !m_pOptions->bStdoutCapture) ||
1801                                  (!bOldStdoutCapture &&  m_pOptions->bStdoutCapture) ||                                  (!bOldStdoutCapture &&  m_pOptions->bStdoutCapture) ||
1802                                  ( bOldKeepOnTop     && !m_pOptions->bKeepOnTop)     ||                                  ( bOldKeepOnTop     && !m_pOptions->bKeepOnTop)     ||
1803                                  (!bOldKeepOnTop     &&  m_pOptions->bKeepOnTop)) {                                  (!bOldKeepOnTop     &&  m_pOptions->bKeepOnTop)     ||
1804                                    (iOldBaseFontSize   !=  m_pOptions->iBaseFontSize)) {
1805                                  QMessageBox::information(this,                                  QMessageBox::information(this,
1806                                          QSAMPLER_TITLE ": " + tr("Information"),                                          QSAMPLER_TITLE ": " + tr("Information"),
1807                                          tr("Some settings may be only effective\n"                                          tr("Some settings may be only effective\n"
1808                                          "next time you start this program."), tr("OK"));                                          "next time you start this program."));
1809                                  updateMessagesCapture();                                  updateMessagesCapture();
1810                          }                          }
1811                          // Check wheather something immediate has changed.                          // Check wheather something immediate has changed.
1812                            if (( bOldMessagesLog && !m_pOptions->bMessagesLog) ||
1813                                    (!bOldMessagesLog &&  m_pOptions->bMessagesLog) ||
1814                                    (sOldMessagesLogPath != m_pOptions->sMessagesLogPath))
1815                                    m_pMessages->setLogging(
1816                                            m_pOptions->bMessagesLog, m_pOptions->sMessagesLogPath);
1817                          if (( bOldCompletePath && !m_pOptions->bCompletePath) ||                          if (( bOldCompletePath && !m_pOptions->bCompletePath) ||
1818                                  (!bOldCompletePath &&  m_pOptions->bCompletePath) ||                                  (!bOldCompletePath &&  m_pOptions->bCompletePath) ||
1819                                  (iOldMaxRecentFiles != m_pOptions->iMaxRecentFiles))                                  (iOldMaxRecentFiles != m_pOptions->iMaxRecentFiles))
# Line 1623  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 1731  void MainForm::helpAbout (void) Line 1973  void MainForm::helpAbout (void)
1973          sText += tr("Instrument editing support disabled.");          sText += tr("Instrument editing support disabled.");
1974          sText += "</font></small><br />";          sText += "</font></small><br />";
1975  #endif  #endif
1976    #ifndef CONFIG_EVENT_CHANNEL_MIDI
1977            sText += "<small><font color=\"red\">";
1978            sText += tr("Channel MIDI event support disabled.");
1979            sText += "</font></small><br />";
1980    #endif
1981    #ifndef CONFIG_EVENT_DEVICE_MIDI
1982            sText += "<small><font color=\"red\">";
1983            sText += tr("Device MIDI event support disabled.");
1984            sText += "</font></small><br />";
1985    #endif
1986    #ifndef CONFIG_MAX_VOICES
1987            sText += "<small><font color=\"red\">";
1988            sText += tr("Runtime max. voices / disk streams support disabled.");
1989            sText += "</font></small><br />";
1990    #endif
1991          sText += "<br />\n";          sText += "<br />\n";
1992          sText += tr("Using") + ": ";          sText += tr("Using") + ": ";
1993          sText += ::lscp_client_package();          sText += ::lscp_client_package();
# Line 1771  void MainForm::stabilizeForm (void) Line 2028  void MainForm::stabilizeForm (void)
2028          setWindowTitle(tr(QSAMPLER_TITLE " - [%1]").arg(sSessionName));          setWindowTitle(tr(QSAMPLER_TITLE " - [%1]").arg(sSessionName));
2029    
2030          // Update the main menu state...          // Update the main menu state...
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->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 1789  void MainForm::stabilizeForm (void) Line 2047  void MainForm::stabilizeForm (void)
2047          m_ui.editEditChannelAction->setEnabled(false);          m_ui.editEditChannelAction->setEnabled(false);
2048  #endif  #endif
2049          m_ui.editResetChannelAction->setEnabled(bHasChannel);          m_ui.editResetChannelAction->setEnabled(bHasChannel);
2050          m_ui.editResetAllChannelsAction->setEnabled(bHasChannel);          m_ui.editResetAllChannelsAction->setEnabled(bHasChannels);
2051          m_ui.viewMessagesAction->setChecked(m_pMessages && m_pMessages->isVisible());          m_ui.viewMessagesAction->setChecked(m_pMessages && m_pMessages->isVisible());
2052  #ifdef CONFIG_MIDI_INSTRUMENT  #ifdef CONFIG_MIDI_INSTRUMENT
2053          m_ui.viewInstrumentsAction->setChecked(m_pInstrumentListForm          m_ui.viewInstrumentsAction->setChecked(m_pInstrumentListForm
# Line 1801  void MainForm::stabilizeForm (void) Line 2059  void MainForm::stabilizeForm (void)
2059          m_ui.viewDevicesAction->setChecked(m_pDeviceForm          m_ui.viewDevicesAction->setChecked(m_pDeviceForm
2060                  && m_pDeviceForm->isVisible());                  && m_pDeviceForm->isVisible());
2061          m_ui.viewDevicesAction->setEnabled(bHasClient);          m_ui.viewDevicesAction->setEnabled(bHasClient);
2062          m_ui.channelsArrangeAction->setEnabled(bHasChannel);          m_ui.viewMidiDeviceStatusMenu->setEnabled(
2063                    DeviceStatusForm::getInstances().size() > 0);
2064            m_ui.channelsArrangeAction->setEnabled(bHasChannels);
2065    
2066  #ifdef CONFIG_VOLUME  #ifdef CONFIG_VOLUME
2067          // Toolbar widgets are also affected...          // Toolbar widgets are also affected...
# Line 1867  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 1905  void MainForm::updateSession (void) Line 2165  void MainForm::updateSession (void)
2165          }          }
2166  #endif  #endif
2167    
2168            updateAllChannelStrips(false);
2169    
2170            // Do we auto-arrange?
2171            if (m_pOptions && m_pOptions->bAutoArrange)
2172                    channelsArrange();
2173    
2174            // Remember to refresh devices and instruments...
2175            if (m_pInstrumentListForm)
2176                    m_pInstrumentListForm->refreshInstruments();
2177            if (m_pDeviceForm)
2178                    m_pDeviceForm->refreshDevices();
2179    }
2180    
2181    
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 1916  void MainForm::updateSession (void) Line 2192  void MainForm::updateSession (void)
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 qsamplerChannel(piChannelIDs[iChannel]));                                  createChannelStrip(new Channel(piChannelIDs[iChannel]));
2199                    }
2200                    // Do we auto-arrange?
2201                    if (m_pOptions && m_pOptions->bAutoArrange)
2202                            channelsArrange();
2203                    // remove dead channel strips
2204                    if (bRemoveDeadStrips) {
2205                            QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();
2206                            for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {
2207                                    ChannelStrip *pChannelStrip = NULL;
2208                                    QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);
2209                                    if (pMdiSubWindow)
2210                                            pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
2211                                    if (pChannelStrip) {
2212                                            bool bExists = false;
2213                                            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                                    }
2225                            }
2226                  }                  }
2227                  m_pWorkspace->setUpdatesEnabled(true);                  m_pWorkspace->setUpdatesEnabled(true);
2228          }          }
2229    
2230          // 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();  
2231  }  }
2232    
2233    
# Line 1982  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 2011  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 2029  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 2057  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 2097  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, tr("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 2171  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(qsamplerChannel* 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;
2498    
         // Prepare for auto-arrange?  
         ChannelStrip* pChannelStrip = NULL;  
         int y = 0;  
         if (m_pOptions && m_pOptions->bAutoArrange) {  
                 QWidgetList wlist = m_pWorkspace->windowList();  
                 for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {  
                         pChannelStrip = static_cast<ChannelStrip *> (wlist.at(iChannel));  
                         if (pChannelStrip) {  
                         //  y += pChannelStrip->height()  
                         //              + pChannelStrip->parentWidget()->baseSize().height();  
                                 y += pChannelStrip->parentWidget()->frameGeometry().height();  
                         }  
                 }  
         }  
   
2499          // Add a new channel itema...          // Add a new channel itema...
2500          pChannelStrip = new ChannelStrip();          ChannelStrip *pChannelStrip = new ChannelStrip();
2501          if (pChannelStrip == NULL)          if (pChannelStrip == NULL)
2502                  return NULL;                  return NULL;
2503    
2504          m_pWorkspace->addWindow(pChannelStrip, Qt::FramelessWindowHint);          // Set some initial channel strip options...
   
         // Actual channel strip setup...  
         pChannelStrip->setup(pChannel);  
         QObject::connect(pChannelStrip,  
                 SIGNAL(channelChanged(ChannelStrip*)),  
                 SLOT(channelStripChanged(ChannelStrip*)));  
         // Set some initial aesthetic options...  
2505          if (m_pOptions) {          if (m_pOptions) {
2506                  // Background display effect...                  // Background display effect...
2507                  pChannelStrip->setDisplayEffect(m_pOptions->bDisplayEffect);                  pChannelStrip->setDisplayEffect(m_pOptions->bDisplayEffect);
# Line 2215  ChannelStrip* MainForm::createChannelStr Line 2513  ChannelStrip* MainForm::createChannelStr
2513                  pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume);                  pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume);
2514          }          }
2515    
2516            // Add it to workspace...
2517            m_pWorkspace->addSubWindow(pChannelStrip,
2518                    Qt::SubWindow | Qt::FramelessWindowHint);
2519    
2520            // Actual channel strip setup...
2521            pChannelStrip->setup(pChannel);
2522    
2523            QObject::connect(pChannelStrip,
2524                    SIGNAL(channelChanged(ChannelStrip *)),
2525                    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();
         // Only then, we'll auto-arrange...  
         if (m_pOptions && m_pOptions->bAutoArrange) {  
                 int iWidth  = m_pWorkspace->width();  
         //  int iHeight = pChannel->height()  
         //              + pChannel->parentWidget()->baseSize().height();  
                 int iHeight = pChannelStrip->parentWidget()->frameGeometry().height();  
                 pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight);  
         }  
2529    
2530          // This is pretty new, so we'll watch for it closely.          // This is pretty new, so we'll watch for it closely.
2531          channelStripChanged(pChannelStrip);          channelStripChanged(pChannelStrip);
# Line 2234  ChannelStrip* MainForm::createChannelStr Line 2535  ChannelStrip* MainForm::createChannelStr
2535  }  }
2536    
2537    
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.
2546            delete pChannelStrip;
2547            delete pMdiSubWindow;
2548    
2549            // Do we auto-arrange?
2550            if (m_pOptions && m_pOptions->bAutoArrange)
2551                    channelsArrange();
2552    
2553            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          QWidgetList wlist = m_pWorkspace->windowList();          if (!m_pWorkspace) return NULL;
2572    
2573            QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();
2574          if (wlist.isEmpty())          if (wlist.isEmpty())
2575                  return NULL;                  return NULL;
2576    
2577          return static_cast<ChannelStrip *> (wlist.at(iChannel));          if (iChannel < 0 || iChannel >= wlist.size())
2578                    return NULL;
2579    
2580            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                          qsamplerChannel *pChannel = pChannelStrip->channel();                          Channel *pChannel = pChannelStrip->channel();
2602                          if (pChannel && pChannel->channelID() == iChannelID)                          if (pChannel && pChannel->channelID() == iChannelID)
2603                                  return pChannelStrip;                                  return pChannelStrip;
2604                  }                  }
# Line 2281  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 2308  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 2369  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 2401  void MainForm::startServer (void) Line 2739  void MainForm::startServer (void)
2739    
2740          // Is the server process instance still here?          // Is the server process instance still here?
2741          if (m_pServer) {          if (m_pServer) {
2742                  switch (QMessageBox::warning(this,                  if (QMessageBox::warning(this,
2743                          QSAMPLER_TITLE ": " + tr("Warning"),                          QSAMPLER_TITLE ": " + tr("Warning"),
2744                          tr("Could not start the LinuxSampler server.\n\n"                          tr("Could not start the LinuxSampler server.\n\n"
2745                          "Maybe it ss already started."),                          "Maybe it is already started."),
2746                          tr("Stop"), tr("Kill"), tr("Cancel"))) {                          QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok) {
                 case 0:  
2747                          m_pServer->terminate();                          m_pServer->terminate();
                         break;  
                 case 1:  
2748                          m_pServer->kill();                          m_pServer->kill();
                         break;  
2749                  }                  }
2750                  return;                  return;
2751          }          }
# Line 2424  void MainForm::startServer (void) Line 2758  void MainForm::startServer (void)
2758                  return;                  return;
2759    
2760          // OK. Let's build the startup process...          // OK. Let's build the startup process...
2761          m_pServer = new QProcess(this);          m_pServer = new QProcess();
2762            bForceServerStop = true;
2763    
2764          // Setup stdout/stderr capture...          // Setup stdout/stderr capture...
2765  //      if (m_pOptions->bStdoutCapture) {  //      if (m_pOptions->bStdoutCapture) {
2766                  //m_pServer->setProcessChannelMode(                  m_pServer->setProcessChannelMode(QProcess::ForwardedChannels);
                 //      QProcess::StandardOutput);  
2767                  QObject::connect(m_pServer,                  QObject::connect(m_pServer,
2768                          SIGNAL(readyReadStandardOutput()),                          SIGNAL(readyReadStandardOutput()),
2769                          SLOT(readServerStdout()));                          SLOT(readServerStdout()));
# Line 2440  void MainForm::startServer (void) Line 2774  void MainForm::startServer (void)
2774    
2775          // The unforgiveable signal communication...          // The unforgiveable signal communication...
2776          QObject::connect(m_pServer,          QObject::connect(m_pServer,
2777                  SIGNAL(finished(int,QProcess::ExitStatus)),                  SIGNAL(finished(int, QProcess::ExitStatus)),
2778                  SLOT(processServerExit()));                  SLOT(processServerExit()));
2779    
2780          // Build process arguments...          // Build process arguments...
# Line 2471  void MainForm::startServer (void) Line 2805  void MainForm::startServer (void)
2805    
2806    
2807  // Stop linuxsampler server...  // Stop linuxsampler server...
2808  void MainForm::stopServer (void)  void MainForm::stopServer (bool bInteractive)
2809  {  {
2810          // Stop client code.          // Stop client code.
2811          stopClient();          stopClient();
2812    
2813            if (m_pServer && bInteractive) {
2814                    if (QMessageBox::question(this,
2815                            QSAMPLER_TITLE ": " + tr("The backend's fate ..."),
2816                            tr("You have the option to keep the sampler backend (LinuxSampler)\n"
2817                            "running in the background. The sampler would continue to work\n"
2818                            "according to your current sampler session and you could alter the\n"
2819                            "sampler session at any time by relaunching QSampler.\n\n"
2820                            "Do you want LinuxSampler to stop?"),
2821                            QMessageBox::Yes | QMessageBox::No,
2822                            QMessageBox::Yes) == QMessageBox::No)
2823                    {
2824                            bForceServerStop = false;
2825                    }
2826            }
2827    
2828          // And try to stop server.          // And try to stop server.
2829          if (m_pServer) {          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)
2833                            // Try harder...
2834                            m_pServer->kill();
2835                    #else
2836                            // Try softly...
2837                          m_pServer->terminate();                          m_pServer->terminate();
2838          }                  #endif
2839                    }
2840            }       // Do final processing anyway.
2841            else processServerExit();
2842    
2843          // Give it some time to terminate gracefully and stabilize...          // Give it some time to terminate gracefully and stabilize...
2844          QTime t;          QTime t;
2845          t.start();          t.start();
2846          while (t.elapsed() < QSAMPLER_TIMER_MSECS)          while (t.elapsed() < QSAMPLER_TIMER_MSECS)
2847                  QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);                  QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
   
         // Do final processing anyway.  
         processServerExit();  
2848  }  }
2849    
2850    
# Line 2512  void MainForm::processServerExit (void) Line 2866  void MainForm::processServerExit (void)
2866          if (m_pMessages)          if (m_pMessages)
2867                  m_pMessages->flushStdoutBuffer();                  m_pMessages->flushStdoutBuffer();
2868    
2869          if (m_pServer) {          if (m_pServer && bForceServerStop) {
2870                    if (m_pServer->state() != QProcess::NotRunning) {
2871                            appendMessages(tr("Server is being forced..."));
2872                            // Force final server shutdown...
2873                            m_pServer->kill();
2874                            // Give it some time to terminate gracefully and stabilize...
2875                            QTime t;
2876                            t.start();
2877                            while (t.elapsed() < QSAMPLER_TIMER_MSECS)
2878                                    QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
2879                    }
2880                  // Force final server shutdown...                  // Force final server shutdown...
2881                  appendMessages(                  appendMessages(
2882                          tr("Server was stopped with exit status %1.")                          tr("Server was stopped with exit status %1.")
2883                          .arg(m_pServer->exitStatus()));                          .arg(m_pServer->exitStatus()));
                 m_pServer->terminate();  
                 if (!m_pServer->waitForFinished(2000))  
                         m_pServer->kill();  
                 // Destroy it.  
2884                  delete m_pServer;                  delete m_pServer;
2885                  m_pServer = NULL;                  m_pServer = NULL;
2886          }          }
# Line 2545  lscp_status_t qsampler_client_callback ( Line 2905  lscp_status_t qsampler_client_callback (
2905          // as this is run under some other thread context.          // as this is run under some other thread context.
2906          // A custom event must be posted here...          // A custom event must be posted here...
2907          QApplication::postEvent(pMainForm,          QApplication::postEvent(pMainForm,
2908                  new qsamplerCustomEvent(event, pchData, cchData));                  new LscpEvent(event, pchData, cchData));
2909    
2910          return LSCP_OK;          return LSCP_OK;
2911  }  }
# Line 2590  bool MainForm::startClient (void) Line 2950  bool MainForm::startClient (void)
2950                  .arg(::lscp_client_get_timeout(m_pClient)));                  .arg(::lscp_client_get_timeout(m_pClient)));
2951    
2952          // Subscribe to channel info change notifications...          // Subscribe to channel info change notifications...
2953            if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_CHANNEL_COUNT) != LSCP_OK)
2954                    appendMessagesClient("lscp_client_subscribe(CHANNEL_COUNT)");
2955          if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_CHANNEL_INFO) != LSCP_OK)          if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_CHANNEL_INFO) != LSCP_OK)
2956                  appendMessagesClient("lscp_client_subscribe");                  appendMessagesClient("lscp_client_subscribe(CHANNEL_INFO)");
2957    
2958            DeviceStatusForm::onDevicesChanged(); // initialize
2959            updateViewMidiDeviceStatusMenu();
2960            if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_MIDI_INPUT_DEVICE_COUNT) != LSCP_OK)
2961                    appendMessagesClient("lscp_client_subscribe(MIDI_INPUT_DEVICE_COUNT)");
2962            if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_MIDI_INPUT_DEVICE_INFO) != LSCP_OK)
2963                    appendMessagesClient("lscp_client_subscribe(MIDI_INPUT_DEVICE_INFO)");
2964            if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_AUDIO_OUTPUT_DEVICE_COUNT) != LSCP_OK)
2965                    appendMessagesClient("lscp_client_subscribe(AUDIO_OUTPUT_DEVICE_COUNT)");
2966            if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_AUDIO_OUTPUT_DEVICE_INFO) != LSCP_OK)
2967                    appendMessagesClient("lscp_client_subscribe(AUDIO_OUTPUT_DEVICE_INFO)");
2968    
2969    #if CONFIG_EVENT_CHANNEL_MIDI
2970            // Subscribe to channel MIDI data notifications...
2971            if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_CHANNEL_MIDI) != LSCP_OK)
2972                    appendMessagesClient("lscp_client_subscribe(CHANNEL_MIDI)");
2973    #endif
2974    
2975    #if CONFIG_EVENT_DEVICE_MIDI
2976            // Subscribe to channel MIDI data notifications...
2977            if (::lscp_client_subscribe(m_pClient, LSCP_EVENT_DEVICE_MIDI) != LSCP_OK)
2978                    appendMessagesClient("lscp_client_subscribe(DEVICE_MIDI)");
2979    #endif
2980    
2981          // We may stop scheduling around.          // We may stop scheduling around.
2982          stopSchedule();          stopSchedule();
# Line 2618  bool MainForm::startClient (void) Line 3003  bool MainForm::startClient (void)
3003                  }                  }
3004          }          }
3005    
3006            // send the current / loaded fine tuning settings to the sampler
3007            m_pOptions->sendFineTuningSettings();
3008    
3009          // Make a new session          // Make a new session
3010          return newSession();          return newSession();
3011  }  }
# Line 2645  void MainForm::stopClient (void) Line 3033  void MainForm::stopClient (void)
3033          closeSession(false);          closeSession(false);
3034    
3035          // Close us as a client...          // Close us as a client...
3036    #if CONFIG_EVENT_DEVICE_MIDI
3037            ::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_DEVICE_MIDI);
3038    #endif
3039    #if CONFIG_EVENT_CHANNEL_MIDI
3040            ::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_CHANNEL_MIDI);
3041    #endif
3042            ::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_AUDIO_OUTPUT_DEVICE_INFO);
3043            ::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_AUDIO_OUTPUT_DEVICE_COUNT);
3044            ::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_MIDI_INPUT_DEVICE_INFO);
3045            ::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_MIDI_INPUT_DEVICE_COUNT);
3046          ::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_CHANNEL_INFO);          ::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_CHANNEL_INFO);
3047            ::lscp_client_unsubscribe(m_pClient, LSCP_EVENT_CHANNEL_COUNT);
3048          ::lscp_client_destroy(m_pClient);          ::lscp_client_destroy(m_pClient);
3049          m_pClient = NULL;          m_pClient = NULL;
3050    
# Line 2665  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 2676  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.1514  
changed lines
  Added in v.2722

  ViewVC Help
Powered by ViewVC