/[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 2459 by capela, Mon Jul 8 10:06:57 2013 UTC revision 3510 by capela, Wed Apr 10 23:03:23 2019 UTC
# Line 1  Line 1 
1  // qsamplerMainForm.cpp  // qsamplerMainForm.cpp
2  //  //
3  /****************************************************************************  /****************************************************************************
4     Copyright (C) 2004-2013, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2019, rncbc aka Rui Nuno Capela. All rights reserved.
5     Copyright (C) 2007, 2008 Christian Schoenebeck     Copyright (C) 2007,2008,2015 Christian Schoenebeck
6    
7     This program is free software; you can redistribute it and/or     This program is free software; you can redistribute it and/or
8     modify it under the terms of the GNU General Public License     modify it under the terms of the GNU General Public License
# Line 68  const WindowFlags WindowCloseButtonHint Line 68  const WindowFlags WindowCloseButtonHint
68  }  }
69  #endif  #endif
70    
 #ifdef HAVE_SIGNAL_H  
 #include <signal.h>  
 #endif  
   
71  #ifdef CONFIG_LIBGIG  #ifdef CONFIG_LIBGIG
72  #include <gig.h>  #include <gig.h>
73  #endif  #endif
# Line 91  static inline long lroundf ( float x ) Line 87  static inline long lroundf ( float x )
87    
88    
89  // All winsock apps needs this.  // All winsock apps needs this.
90  #if defined(WIN32)  #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
91  static WSADATA _wsaData;  static WSADATA _wsaData;
92    #undef HAVE_SIGNAL_H
93  #endif  #endif
94    
95    
# Line 103  static WSADATA _wsaData; Line 100  static WSADATA _wsaData;
100    
101  #include <QSocketNotifier>  #include <QSocketNotifier>
102    
103    #include <unistd.h>
104  #include <sys/types.h>  #include <sys/types.h>
105  #include <sys/socket.h>  #include <sys/socket.h>
   
106  #include <signal.h>  #include <signal.h>
107    
108  // File descriptor for SIGUSR1 notifier.  // File descriptor for SIGUSR1 notifier.
109  static int g_fdUsr1[2];  static int g_fdSigusr1[2] = { -1, -1 };
110    
111  // Unix SIGUSR1 signal handler.  // Unix SIGUSR1 signal handler.
112  static void qsampler_sigusr1_handler ( int /* signo */ )  static void qsampler_sigusr1_handler ( int /* signo */ )
113  {  {
114          char c = 1;          char c = 1;
115    
116          (::write(g_fdUsr1[0], &c, sizeof(c)) > 0);          (::write(g_fdSigusr1[0], &c, sizeof(c)) > 0);
117    }
118    
119    // File descriptor for SIGTERM notifier.
120    static int g_fdSigterm[2] = { -1, -1 };
121    
122    // Unix SIGTERM signal handler.
123    static void qsampler_sigterm_handler ( int /* signo */ )
124    {
125            char c = 1;
126    
127            (::write(g_fdSigterm[0], &c, sizeof(c)) > 0);
128  }  }
129    
130  #endif  // HAVE_SIGNAL_H  #endif  // HAVE_SIGNAL_H
131    
132    
133  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
134  // qsampler -- namespace  // QSampler -- namespace
135    
136    
137  namespace QSampler {  namespace QSampler {
# Line 143  namespace QSampler { Line 151  namespace QSampler {
151    
152    
153  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
154  // LscpEvent -- specialty for LSCP callback comunication.  // QSampler::LscpEvent -- specialty for LSCP callback comunication.
   
155    
156  class LscpEvent : public QEvent  class LscpEvent : public QEvent
157  {  {
# Line 159  public: Line 166  public:
166          }          }
167    
168          // Accessors.          // Accessors.
169          lscp_event_t event() { return m_event; }          lscp_event_t  event() { return m_event; }
170          QString&     data()  { return m_data;  }          const QString& data() { return m_data;  }
171    
172  private:  private:
173    
# Line 172  private: Line 179  private:
179    
180    
181  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
182  // qsamplerMainForm -- Main window form implementation.  // QSampler::Workspace -- Main window workspace (MDI Area) decl.
183    
184    class Workspace : public QMdiArea
185    {
186    public:
187    
188            Workspace(MainForm *pMainForm) : QMdiArea(pMainForm) {}
189    
190    protected:
191    
192            void resizeEvent(QResizeEvent *)
193            {
194                    MainForm *pMainForm = static_cast<MainForm *> (parentWidget());
195                    if (pMainForm)
196                            pMainForm->channelsArrangeAuto();
197            }
198    };
199    
200    
201    //-------------------------------------------------------------------------
202    // QSampler::MainForm -- Main window form implementation.
203    
204  // Kind of singleton reference.  // Kind of singleton reference.
205  MainForm* MainForm::g_pMainForm = NULL;  MainForm *MainForm::g_pMainForm = NULL;
206    
207  MainForm::MainForm ( QWidget *pParent )  MainForm::MainForm ( QWidget *pParent )
208          : QMainWindow(pParent)          : QMainWindow(pParent)
# Line 195  MainForm::MainForm ( QWidget *pParent ) Line 222  MainForm::MainForm ( QWidget *pParent )
222    
223          // We'll start clean.          // We'll start clean.
224          m_iUntitled   = 0;          m_iUntitled   = 0;
225            m_iDirtySetup = 0;
226          m_iDirtyCount = 0;          m_iDirtyCount = 0;
227    
228          m_pServer = NULL;          m_pServer = NULL;
# Line 213  MainForm::MainForm ( QWidget *pParent ) Line 241  MainForm::MainForm ( QWidget *pParent )
241          // LADISH Level 1 suport.          // LADISH Level 1 suport.
242    
243          // Initialize file descriptors for SIGUSR1 socket notifier.          // Initialize file descriptors for SIGUSR1 socket notifier.
244          ::socketpair(AF_UNIX, SOCK_STREAM, 0, g_fdUsr1);          ::socketpair(AF_UNIX, SOCK_STREAM, 0, g_fdSigusr1);
245          m_pUsr1Notifier          m_pSigusr1Notifier
246                  = new QSocketNotifier(g_fdUsr1[1], QSocketNotifier::Read, this);                  = new QSocketNotifier(g_fdSigusr1[1], QSocketNotifier::Read, this);
247    
248          QObject::connect(m_pUsr1Notifier,          QObject::connect(m_pSigusr1Notifier,
249                  SIGNAL(activated(int)),                  SIGNAL(activated(int)),
250                  SLOT(handle_sigusr1()));                  SLOT(handle_sigusr1()));
251    
252          // Install SIGUSR1 signal handler.          // Install SIGUSR1 signal handler.
253      struct sigaction usr1;          struct sigaction sigusr1;
254      usr1.sa_handler = qsampler_sigusr1_handler;          sigusr1.sa_handler = qsampler_sigusr1_handler;
255      sigemptyset(&usr1.sa_mask);          sigemptyset(&sigusr1.sa_mask);
256      usr1.sa_flags = 0;          sigusr1.sa_flags = 0;
257      usr1.sa_flags |= SA_RESTART;          sigusr1.sa_flags |= SA_RESTART;
258      ::sigaction(SIGUSR1, &usr1, NULL);          ::sigaction(SIGUSR1, &sigusr1, NULL);
259    
260            // Initialize file descriptors for SIGTERM socket notifier.
261            ::socketpair(AF_UNIX, SOCK_STREAM, 0, g_fdSigterm);
262            m_pSigtermNotifier
263                    = new QSocketNotifier(g_fdSigterm[1], QSocketNotifier::Read, this);
264    
265            QObject::connect(m_pSigtermNotifier,
266                    SIGNAL(activated(int)),
267                    SLOT(handle_sigterm()));
268    
269            // Install SIGTERM signal handler.
270            struct sigaction sigterm;
271            sigterm.sa_handler = qsampler_sigterm_handler;
272            ::sigemptyset(&sigterm.sa_mask);
273            sigterm.sa_flags = 0;
274            sigterm.sa_flags |= SA_RESTART;
275            ::sigaction(SIGTERM, &sigterm, NULL);
276            ::sigaction(SIGQUIT, &sigterm, NULL);
277    
278            // Ignore SIGHUP/SIGINT signals.
279            ::signal(SIGHUP, SIG_IGN);
280            ::signal(SIGINT, SIG_IGN);
281    
282  #else   // HAVE_SIGNAL_H  #else   // HAVE_SIGNAL_H
283    
284          m_pUsr1Notifier = NULL;          m_pSigusr1Notifier = NULL;
285            m_pSigtermNotifier = NULL;
286                    
287  #endif  // !HAVE_SIGNAL_H  #endif  // !HAVE_SIGNAL_H
288    
# Line 254  MainForm::MainForm ( QWidget *pParent ) Line 305  MainForm::MainForm ( QWidget *pParent )
305          QObject::connect(m_pVolumeSlider,          QObject::connect(m_pVolumeSlider,
306                  SIGNAL(valueChanged(int)),                  SIGNAL(valueChanged(int)),
307                  SLOT(volumeChanged(int)));                  SLOT(volumeChanged(int)));
         //m_ui.channelsToolbar->setHorizontallyStretchable(true);  
         //m_ui.channelsToolbar->setStretchableWidget(m_pVolumeSlider);  
308          m_ui.channelsToolbar->addWidget(m_pVolumeSlider);          m_ui.channelsToolbar->addWidget(m_pVolumeSlider);
309          // Volume spin-box          // Volume spin-box
310          m_ui.channelsToolbar->addSeparator();          m_ui.channelsToolbar->addSeparator();
311          m_pVolumeSpinBox = new QSpinBox(m_ui.channelsToolbar);          m_pVolumeSpinBox = new QSpinBox(m_ui.channelsToolbar);
         m_pVolumeSpinBox->setMaximumHeight(24);  
312          m_pVolumeSpinBox->setSuffix(" %");          m_pVolumeSpinBox->setSuffix(" %");
313          m_pVolumeSpinBox->setMinimum(0);          m_pVolumeSpinBox->setMinimum(0);
314          m_pVolumeSpinBox->setMaximum(100);          m_pVolumeSpinBox->setMaximum(100);
# Line 272  MainForm::MainForm ( QWidget *pParent ) Line 320  MainForm::MainForm ( QWidget *pParent )
320  #endif  #endif
321    
322          // Make it an MDI workspace.          // Make it an MDI workspace.
323          m_pWorkspace = new QMdiArea(this);          m_pWorkspace = new Workspace(this);
324          m_pWorkspace->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);          m_pWorkspace->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
325          m_pWorkspace->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);          m_pWorkspace->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
326          // Set the activation connection.          // Set the activation connection.
# Line 307  MainForm::MainForm ( QWidget *pParent ) Line 355  MainForm::MainForm ( QWidget *pParent )
355          m_statusItem[QSAMPLER_STATUS_SESSION] = pLabel;          m_statusItem[QSAMPLER_STATUS_SESSION] = pLabel;
356          statusBar()->addWidget(pLabel);          statusBar()->addWidget(pLabel);
357    
358  #if defined(WIN32)  #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
359          WSAStartup(MAKEWORD(1, 1), &_wsaData);          WSAStartup(MAKEWORD(1, 1), &_wsaData);
360  #endif  #endif
361    
# Line 395  MainForm::MainForm ( QWidget *pParent ) Line 443  MainForm::MainForm ( QWidget *pParent )
443          QObject::connect(m_ui.channelsMenu,          QObject::connect(m_ui.channelsMenu,
444                  SIGNAL(aboutToShow()),                  SIGNAL(aboutToShow()),
445                  SLOT(channelsMenuAboutToShow()));                  SLOT(channelsMenuAboutToShow()));
446    #ifdef CONFIG_VOLUME
447            QObject::connect(m_ui.channelsToolbar,
448                    SIGNAL(orientationChanged(Qt::Orientation)),
449                    SLOT(channelsToolbarOrientation(Qt::Orientation)));
450    #endif
451  }  }
452    
453  // Destructor.  // Destructor.
# Line 403  MainForm::~MainForm() Line 456  MainForm::~MainForm()
456          // Do final processing anyway.          // Do final processing anyway.
457          processServerExit();          processServerExit();
458    
459  #if defined(WIN32)  #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
460          WSACleanup();          WSACleanup();
461  #endif  #endif
462    
463  #if defined(HAVE_SIGNAL_H) && defined(HAVE_SYS_SOCKET_H)  #if defined(HAVE_SIGNAL_H) && defined(HAVE_SYS_SOCKET_H)
464          if (m_pUsr1Notifier)          if (m_pSigusr1Notifier)
465                  delete m_pUsr1Notifier;                  delete m_pSigusr1Notifier;
466            if (m_pSigtermNotifier)
467                    delete m_pSigtermNotifier;
468  #endif  #endif
469    
470          // Finally drop any widgets around...          // Finally drop any widgets around...
# Line 476  void MainForm::setup ( Options *pOptions Line 531  void MainForm::setup ( Options *pOptions
531          updateMessagesFont();          updateMessagesFont();
532          updateMessagesLimit();          updateMessagesLimit();
533          updateMessagesCapture();          updateMessagesCapture();
534    
535          // Set the visibility signal.          // Set the visibility signal.
536          QObject::connect(m_pMessages,          QObject::connect(m_pMessages,
537                  SIGNAL(visibilityChanged(bool)),                  SIGNAL(visibilityChanged(bool)),
# Line 541  bool MainForm::queryClose (void) Line 597  bool MainForm::queryClose (void)
597                                  || m_ui.channelsToolbar->isVisible());                                  || m_ui.channelsToolbar->isVisible());
598                          m_pOptions->bStatusbar = statusBar()->isVisible();                          m_pOptions->bStatusbar = statusBar()->isVisible();
599                          // Save the dock windows state.                          // Save the dock windows state.
                         const QString sDockables = saveState().toBase64().data();  
600                          m_pOptions->settings().setValue("/Layout/DockWindows", saveState());                          m_pOptions->settings().setValue("/Layout/DockWindows", saveState());
601                          // And the children, and the main windows state,.                          // And the children, and the main windows state,.
602                          m_pOptions->saveWidgetGeometry(m_pDeviceForm);                          m_pOptions->saveWidgetGeometry(m_pDeviceForm);
# Line 584  void MainForm::dragEnterEvent ( QDragEnt Line 639  void MainForm::dragEnterEvent ( QDragEnt
639  }  }
640    
641    
642  void MainForm::dropEvent ( QDropEvent* pDropEvent )  void MainForm::dropEvent ( QDropEvent *pDropEvent )
643  {  {
644          // Accept externally originated drops only...          // Accept externally originated drops only...
645          if (pDropEvent->source())          if (pDropEvent->source())
# Line 640  void MainForm::customEvent ( QEvent* pEv Line 695  void MainForm::customEvent ( QEvent* pEv
695                                  updateAllChannelStrips(true);                                  updateAllChannelStrips(true);
696                                  break;                                  break;
697                          case LSCP_EVENT_CHANNEL_INFO: {                          case LSCP_EVENT_CHANNEL_INFO: {
698                                  int iChannelID = pLscpEvent->data().toInt();                                  const int iChannelID = pLscpEvent->data().toInt();
699                                  ChannelStrip *pChannelStrip = channelStrip(iChannelID);                                  ChannelStrip *pChannelStrip = channelStrip(iChannelID);
700                                  if (pChannelStrip)                                  if (pChannelStrip)
701                                          channelStripChanged(pChannelStrip);                                          channelStripChanged(pChannelStrip);
# Line 699  void MainForm::handle_sigusr1 (void) Line 754  void MainForm::handle_sigusr1 (void)
754    
755          char c;          char c;
756    
757          if (::read(g_fdUsr1[1], &c, sizeof(c)) > 0)          if (::read(g_fdSigusr1[1], &c, sizeof(c)) > 0)
758                  saveSession(false);                  saveSession(false);
759    
760  #endif  #endif
761  }  }
762    
763    
764    void MainForm::handle_sigterm (void)
765    {
766    #if defined(HAVE_SIGNAL_H) && defined(HAVE_SYS_SOCKET_H)
767    
768            char c;
769    
770            if (::read(g_fdSigterm[1], &c, sizeof(c)) > 0)
771                    close();
772    
773    #endif
774    }
775    
776    
777  void MainForm::updateViewMidiDeviceStatusMenu (void)  void MainForm::updateViewMidiDeviceStatusMenu (void)
778  {  {
779          m_ui.viewMidiDeviceStatusMenu->clear();          m_ui.viewMidiDeviceStatusMenu->clear();
# Line 731  void MainForm::contextMenuEvent( QContex Line 799  void MainForm::contextMenuEvent( QContex
799    
800    
801  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
802  // qsamplerMainForm -- Brainless public property accessors.  // QSampler::MainForm -- Brainless public property accessors.
803    
804  // The global options settings property.  // The global options settings property.
805  Options *MainForm::options (void) const  Options *MainForm::options (void) const
# Line 755  MainForm *MainForm::getInstance (void) Line 823  MainForm *MainForm::getInstance (void)
823    
824    
825  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
826  // qsamplerMainForm -- Session file stuff.  // QSampler::MainForm -- Session file stuff.
827    
828  // Format the displayable session filename.  // Format the displayable session filename.
829  QString MainForm::sessionName ( const QString& sFilename )  QString MainForm::sessionName ( const QString& sFilename )
830  {  {
831          bool bCompletePath = (m_pOptions && m_pOptions->bCompletePath);          const bool bCompletePath = (m_pOptions && m_pOptions->bCompletePath);
832          QString sSessionName = sFilename;          QString sSessionName = sFilename;
833          if (sSessionName.isEmpty())          if (sSessionName.isEmpty())
834                  sSessionName = tr("Untitled") + QString::number(m_iUntitled);                  sSessionName = tr("Untitled") + QString::number(m_iUntitled);
# Line 844  bool MainForm::saveSession ( bool bPromp Line 912  bool MainForm::saveSession ( bool bPromp
912                  // Enforce .lscp extension...                  // Enforce .lscp extension...
913                  if (QFileInfo(sFilename).suffix().isEmpty())                  if (QFileInfo(sFilename).suffix().isEmpty())
914                          sFilename += ".lscp";                          sFilename += ".lscp";
915            #if 0
916                  // Check if already exists...                  // Check if already exists...
917                  if (sFilename != m_sFilename && QFileInfo(sFilename).exists()) {                  if (sFilename != m_sFilename && QFileInfo(sFilename).exists()) {
918                          if (QMessageBox::warning(this,                          if (QMessageBox::warning(this,
# Line 856  bool MainForm::saveSession ( bool bPromp Line 925  bool MainForm::saveSession ( bool bPromp
925                                  == QMessageBox::No)                                  == QMessageBox::No)
926                                  return false;                                  return false;
927                  }                  }
928            #endif
929          }          }
930    
931          // Save it right away.          // Save it right away.
# Line 894  bool MainForm::closeSession ( bool bForc Line 964  bool MainForm::closeSession ( bool bForc
964          if (bClose) {          if (bClose) {
965                  // Remove all channel strips from sight...                  // Remove all channel strips from sight...
966                  m_pWorkspace->setUpdatesEnabled(false);                  m_pWorkspace->setUpdatesEnabled(false);
967                  QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();                  const QList<QMdiSubWindow *>& wlist
968                  for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {                          = m_pWorkspace->subWindowList();
969                    const int iStripCount = wlist.count();
970                    for (int iStrip = 0; iStrip < iStripCount; ++iStrip) {
971                          ChannelStrip *pChannelStrip = NULL;                          ChannelStrip *pChannelStrip = NULL;
972                          QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);                          QMdiSubWindow *pMdiSubWindow = wlist.at(iStrip);
973                          if (pMdiSubWindow)                          if (pMdiSubWindow)
974                                  pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());                                  pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
975                          if (pChannelStrip) {                          if (pChannelStrip) {
# Line 1019  bool MainForm::saveSessionFile ( const Q Line 1091  bool MainForm::saveSessionFile ( const Q
1091          QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));          QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
1092    
1093          // Write the file.          // Write the file.
1094          int  iErrors = 0;          int iErrors = 0;
1095          QTextStream ts(&file);          QTextStream ts(&file);
1096          ts << "# " << QSAMPLER_TITLE " - " << tr(QSAMPLER_SUBTITLE) << endl;          ts << "# " << QSAMPLER_TITLE " - " << tr(QSAMPLER_SUBTITLE) << endl;
1097          ts << "# " << tr("Version")          ts << "# " << tr("Version") << ": " CONFIG_BUILD_VERSION << endl;
1098          << ": " QSAMPLER_VERSION << endl;  //      ts << "# " << tr("Build") << ": " CONFIG_BUILD_DATE << endl;
         ts << "# " << tr("Build")  
         << ": " __DATE__ " " __TIME__ << endl;  
1099          ts << "#"  << endl;          ts << "#"  << endl;
1100          ts << "# " << tr("File")          ts << "# " << tr("File")
1101          << ": " << QFileInfo(sFilename).fileName() << endl;          << ": " << QFileInfo(sFilename).fileName() << endl;
# Line 1038  bool MainForm::saveSessionFile ( const Q Line 1108  bool MainForm::saveSessionFile ( const Q
1108          // It is assumed that this new kind of device+session file          // It is assumed that this new kind of device+session file
1109          // will be loaded from a complete initialized server...          // will be loaded from a complete initialized server...
1110          int *piDeviceIDs;          int *piDeviceIDs;
1111          int  iDevice;          int  i, iDevice;
1112          ts << "RESET" << endl;          ts << "RESET" << endl;
1113    
1114          // Audio device mapping.          // Audio device mapping.
1115          QMap<int, int> audioDeviceMap;          QMap<int, int> audioDeviceMap; iDevice = 0;
1116          piDeviceIDs = Device::getDevices(m_pClient, Device::Audio);          piDeviceIDs = Device::getDevices(m_pClient, Device::Audio);
1117          for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {          for (i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; ++i) {
1118                  ts << endl;                  Device device(Device::Audio, piDeviceIDs[i]);
1119                  Device device(Device::Audio, piDeviceIDs[iDevice]);                  // Avoid plug-in driver devices...
1120                    if (device.driverName().toUpper() == "PLUGIN")
1121                            continue;
1122                  // Audio device specification...                  // Audio device specification...
1123                    ts << endl;
1124                  ts << "# " << device.deviceTypeName() << " " << device.driverName()                  ts << "# " << device.deviceTypeName() << " " << device.driverName()
1125                          << " " << tr("Device") << " " << iDevice << endl;                          << " " << tr("Device") << " " << iDevice << endl;
1126                  ts << "CREATE AUDIO_OUTPUT_DEVICE " << device.driverName();                  ts << "CREATE AUDIO_OUTPUT_DEVICE " << device.driverName();
# Line 1078  bool MainForm::saveSessionFile ( const Q Line 1151  bool MainForm::saveSessionFile ( const Q
1151                          iPort++;                          iPort++;
1152                  }                  }
1153                  // Audio device index/id mapping.                  // Audio device index/id mapping.
1154                  audioDeviceMap[device.deviceID()] = iDevice;                  audioDeviceMap.insert(device.deviceID(), iDevice++);
1155                  // Try to keep it snappy :)                  // Try to keep it snappy :)
1156                  QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);                  QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
1157          }          }
1158    
1159          // MIDI device mapping.          // MIDI device mapping.
1160          QMap<int, int> midiDeviceMap;          QMap<int, int> midiDeviceMap; iDevice = 0;
1161          piDeviceIDs = Device::getDevices(m_pClient, Device::Midi);          piDeviceIDs = Device::getDevices(m_pClient, Device::Midi);
1162          for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {          for (i = 0; piDeviceIDs && piDeviceIDs[i] >= 0; ++i) {
1163                  ts << endl;                  Device device(Device::Midi, piDeviceIDs[i]);
1164                  Device device(Device::Midi, piDeviceIDs[iDevice]);                  // Avoid plug-in driver devices...
1165                    if (device.driverName().toUpper() == "PLUGIN")
1166                            continue;
1167                  // MIDI device specification...                  // MIDI device specification...
1168                    ts << endl;
1169                  ts << "# " << device.deviceTypeName() << " " << device.driverName()                  ts << "# " << device.deviceTypeName() << " " << device.driverName()
1170                          << " " << tr("Device") << " " << iDevice << endl;                          << " " << tr("Device") << " " << iDevice << endl;
1171                  ts << "CREATE MIDI_INPUT_DEVICE " << device.driverName();                  ts << "CREATE MIDI_INPUT_DEVICE " << device.driverName();
# Line 1120  bool MainForm::saveSessionFile ( const Q Line 1196  bool MainForm::saveSessionFile ( const Q
1196                          iPort++;                          iPort++;
1197                  }                  }
1198                  // MIDI device index/id mapping.                  // MIDI device index/id mapping.
1199                  midiDeviceMap[device.deviceID()] = iDevice;                  midiDeviceMap.insert(device.deviceID(), iDevice++);
1200                  // Try to keep it snappy :)                  // Try to keep it snappy :)
1201                  QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);                  QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
1202          }          }
# Line 1131  bool MainForm::saveSessionFile ( const Q Line 1207  bool MainForm::saveSessionFile ( const Q
1207          QMap<int, int> midiInstrumentMap;          QMap<int, int> midiInstrumentMap;
1208          int *piMaps = ::lscp_list_midi_instrument_maps(m_pClient);          int *piMaps = ::lscp_list_midi_instrument_maps(m_pClient);
1209          for (int iMap = 0; piMaps && piMaps[iMap] >= 0; iMap++) {          for (int iMap = 0; piMaps && piMaps[iMap] >= 0; iMap++) {
1210                  int iMidiMap = piMaps[iMap];                  const int iMidiMap = piMaps[iMap];
1211                  const char *pszMapName                  const char *pszMapName
1212                          = ::lscp_get_midi_instrument_map_name(m_pClient, iMidiMap);                          = ::lscp_get_midi_instrument_map_name(m_pClient, iMidiMap);
1213                  ts << "# " << tr("MIDI instrument map") << " " << iMap;                  ts << "# " << tr("MIDI instrument map") << " " << iMap;
# Line 1188  bool MainForm::saveSessionFile ( const Q Line 1264  bool MainForm::saveSessionFile ( const Q
1264                          iErrors++;                          iErrors++;
1265                  }                  }
1266                  // MIDI strument index/id mapping.                  // MIDI strument index/id mapping.
1267                  midiInstrumentMap[iMidiMap] = iMap;                  midiInstrumentMap.insert(iMidiMap, iMap);
1268          }          }
1269          // Check for errors...          // Check for errors...
1270          if (piMaps == NULL && ::lscp_client_get_errno(m_pClient)) {          if (piMaps == NULL && ::lscp_client_get_errno(m_pClient)) {
# Line 1197  bool MainForm::saveSessionFile ( const Q Line 1273  bool MainForm::saveSessionFile ( const Q
1273          }          }
1274  #endif  // CONFIG_MIDI_INSTRUMENT  #endif  // CONFIG_MIDI_INSTRUMENT
1275    
1276          // Sampler channel mapping.          // Sampler channel mapping...
1277          QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();          int iChannelID = 0;
1278          for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {          const QList<QMdiSubWindow *>& wlist
1279                    = m_pWorkspace->subWindowList();
1280            const int iStripCount = wlist.count();
1281            for (int iStrip = 0; iStrip < iStripCount; ++iStrip) {
1282                  ChannelStrip *pChannelStrip = NULL;                  ChannelStrip *pChannelStrip = NULL;
1283                  QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);                  QMdiSubWindow *pMdiSubWindow = wlist.at(iStrip);
1284                  if (pMdiSubWindow)                  if (pMdiSubWindow)
1285                          pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());                          pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
1286                  if (pChannelStrip) {                  if (pChannelStrip) {
1287                          Channel *pChannel = pChannelStrip->channel();                          Channel *pChannel = pChannelStrip->channel();
1288                          if (pChannel) {                          if (pChannel) {
1289                                  ts << "# " << tr("Channel") << " " << iChannel << endl;                                  // Avoid "artifial" plug-in devices...
1290                                    const int iAudioDevice = pChannel->audioDevice();
1291                                    if (!audioDeviceMap.contains(iAudioDevice))
1292                                            continue;
1293                                    const int iMidiDevice = pChannel->midiDevice();
1294                                    if (!midiDeviceMap.contains(iMidiDevice))
1295                                            continue;
1296                                    // Go for regular, canonical devices...
1297                                    ts << "# " << tr("Channel") << " " << iChannelID << endl;
1298                                  ts << "ADD CHANNEL" << endl;                                  ts << "ADD CHANNEL" << endl;
1299                                  if (audioDeviceMap.isEmpty()) {                                  if (audioDeviceMap.isEmpty()) {
1300                                          ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannel                                          ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannelID
1301                                                  << " " << pChannel->audioDriver() << endl;                                                  << " " << pChannel->audioDriver() << endl;
1302                                  } else {                                  } else {
1303                                          ts << "SET CHANNEL AUDIO_OUTPUT_DEVICE " << iChannel                                          ts << "SET CHANNEL AUDIO_OUTPUT_DEVICE " << iChannelID
1304                                                  << " " << audioDeviceMap[pChannel->audioDevice()] << endl;                                                  << " " << audioDeviceMap.value(iAudioDevice) << endl;
1305                                  }                                  }
1306                                  if (midiDeviceMap.isEmpty()) {                                  if (midiDeviceMap.isEmpty()) {
1307                                          ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannel                                          ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannelID
1308                                                  << " " << pChannel->midiDriver() << endl;                                                  << " " << pChannel->midiDriver() << endl;
1309                                  } else {                                  } else {
1310                                          ts << "SET CHANNEL MIDI_INPUT_DEVICE " << iChannel                                          ts << "SET CHANNEL MIDI_INPUT_DEVICE " << iChannelID
1311                                                  << " " << midiDeviceMap[pChannel->midiDevice()] << endl;                                                  << " " << midiDeviceMap.value(iMidiDevice) << endl;
1312                                  }                                  }
1313                                  ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannel                                  ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannelID
1314                                          << " " << pChannel->midiPort() << endl;                                          << " " << pChannel->midiPort() << endl;
1315                                  ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannel << " ";                                  ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannelID << " ";
1316                                  if (pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL)                                  if (pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL)
1317                                          ts << "ALL";                                          ts << "ALL";
1318                                  else                                  else
1319                                          ts << pChannel->midiChannel();                                          ts << pChannel->midiChannel();
1320                                  ts << endl;                                  ts << endl;
1321                                  ts << "LOAD ENGINE " << pChannel->engineName()                                  ts << "LOAD ENGINE " << pChannel->engineName()
1322                                          << " " << iChannel << endl;                                          << " " << iChannelID << endl;
1323                                  if (pChannel->instrumentStatus() < 100) ts << "# ";                                  if (pChannel->instrumentStatus() < 100) ts << "# ";
1324                                  ts << "LOAD INSTRUMENT NON_MODAL '"                                  ts << "LOAD INSTRUMENT NON_MODAL '"
1325                                          << pChannel->instrumentFile() << "' "                                          << pChannel->instrumentFile() << "' "
1326                                          << pChannel->instrumentNr() << " " << iChannel << endl;                                          << pChannel->instrumentNr() << " " << iChannelID << endl;
1327                                  ChannelRoutingMap::ConstIterator audioRoute;                                  ChannelRoutingMap::ConstIterator audioRoute;
1328                                  for (audioRoute = pChannel->audioRouting().begin();                                  for (audioRoute = pChannel->audioRouting().begin();
1329                                                  audioRoute != pChannel->audioRouting().end();                                                  audioRoute != pChannel->audioRouting().end();
1330                                                          ++audioRoute) {                                                          ++audioRoute) {
1331                                          ts << "SET CHANNEL AUDIO_OUTPUT_CHANNEL " << iChannel                                          ts << "SET CHANNEL AUDIO_OUTPUT_CHANNEL " << iChannelID
1332                                                  << " " << audioRoute.key()                                                  << " " << audioRoute.key()
1333                                                  << " " << audioRoute.value() << endl;                                                  << " " << audioRoute.value() << endl;
1334                                  }                                  }
1335                                  ts << "SET CHANNEL VOLUME " << iChannel                                  ts << "SET CHANNEL VOLUME " << iChannelID
1336                                          << " " << pChannel->volume() << endl;                                          << " " << pChannel->volume() << endl;
1337                                  if (pChannel->channelMute())                                  if (pChannel->channelMute())
1338                                          ts << "SET CHANNEL MUTE " << iChannel << " 1" << endl;                                          ts << "SET CHANNEL MUTE " << iChannelID << " 1" << endl;
1339                                  if (pChannel->channelSolo())                                  if (pChannel->channelSolo())
1340                                          ts << "SET CHANNEL SOLO " << iChannel << " 1" << endl;                                          ts << "SET CHANNEL SOLO " << iChannelID << " 1" << endl;
1341                          #ifdef CONFIG_MIDI_INSTRUMENT                          #ifdef CONFIG_MIDI_INSTRUMENT
1342                                  if (pChannel->midiMap() >= 0) {                                  const int iMidiMap = pChannel->midiMap();
1343                                          ts << "SET CHANNEL MIDI_INSTRUMENT_MAP " << iChannel                                  if (midiInstrumentMap.contains(iMidiMap)) {
1344                                                  << " " << midiInstrumentMap[pChannel->midiMap()] << endl;                                          ts << "SET CHANNEL MIDI_INSTRUMENT_MAP " << iChannelID
1345                                                    << " " << midiInstrumentMap.value(iMidiMap) << endl;
1346                                  }                                  }
1347                          #endif                          #endif
1348                          #ifdef CONFIG_FXSEND                          #ifdef CONFIG_FXSEND
                                 int iChannelID = pChannel->channelID();  
1349                                  int *piFxSends = ::lscp_list_fxsends(m_pClient, iChannelID);                                  int *piFxSends = ::lscp_list_fxsends(m_pClient, iChannelID);
1350                                  for (int iFxSend = 0;                                  for (int iFxSend = 0;
1351                                                  piFxSends && piFxSends[iFxSend] >= 0;                                                  piFxSends && piFxSends[iFxSend] >= 0;
# Line 1266  bool MainForm::saveSessionFile ( const Q Line 1353  bool MainForm::saveSessionFile ( const Q
1353                                          lscp_fxsend_info_t *pFxSendInfo = ::lscp_get_fxsend_info(                                          lscp_fxsend_info_t *pFxSendInfo = ::lscp_get_fxsend_info(
1354                                                  m_pClient, iChannelID, piFxSends[iFxSend]);                                                  m_pClient, iChannelID, piFxSends[iFxSend]);
1355                                          if (pFxSendInfo) {                                          if (pFxSendInfo) {
1356                                                  ts << "CREATE FX_SEND " << iChannel                                                  ts << "CREATE FX_SEND " << iChannelID
1357                                                          << " " << pFxSendInfo->midi_controller;                                                          << " " << pFxSendInfo->midi_controller;
1358                                                  if (pFxSendInfo->name)                                                  if (pFxSendInfo->name)
1359                                                          ts << " '" << pFxSendInfo->name << "'";                                                          ts << " '" << pFxSendInfo->name << "'";
# Line 1276  bool MainForm::saveSessionFile ( const Q Line 1363  bool MainForm::saveSessionFile ( const Q
1363                                                                  piRouting && piRouting[iAudioSrc] >= 0;                                                                  piRouting && piRouting[iAudioSrc] >= 0;
1364                                                                          iAudioSrc++) {                                                                          iAudioSrc++) {
1365                                                          ts << "SET FX_SEND AUDIO_OUTPUT_CHANNEL "                                                          ts << "SET FX_SEND AUDIO_OUTPUT_CHANNEL "
1366                                                                  << iChannel                                                                  << iChannelID
1367                                                                  << " " << iFxSend                                                                  << " " << iFxSend
1368                                                                  << " " << iAudioSrc                                                                  << " " << iAudioSrc
1369                                                                  << " " << piRouting[iAudioSrc] << endl;                                                                  << " " << piRouting[iAudioSrc] << endl;
1370                                                  }                                                  }
1371                                          #ifdef CONFIG_FXSEND_LEVEL                                          #ifdef CONFIG_FXSEND_LEVEL
1372                                                  ts << "SET FX_SEND LEVEL " << iChannel                                                  ts << "SET FX_SEND LEVEL " << iChannelID
1373                                                          << " " << iFxSend                                                          << " " << iFxSend
1374                                                          << " " << pFxSendInfo->level << endl;                                                          << " " << pFxSendInfo->level << endl;
1375                                          #endif                                          #endif
# Line 1294  bool MainForm::saveSessionFile ( const Q Line 1381  bool MainForm::saveSessionFile ( const Q
1381                                  }                                  }
1382                          #endif                          #endif
1383                                  ts << endl;                                  ts << endl;
1384                                    // Go for next channel...
1385                                    ++iChannelID;
1386                          }                          }
1387                  }                  }
1388                  // Try to keep it snappy :)                  // Try to keep it snappy :)
# Line 1345  void MainForm::sessionDirty (void) Line 1434  void MainForm::sessionDirty (void)
1434    
1435    
1436  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
1437  // qsamplerMainForm -- File Action slots.  // QSampler::MainForm -- File Action slots.
1438    
1439  // Create a new sampler session.  // Create a new sampler session.
1440  void MainForm::fileNew (void)  void MainForm::fileNew (void)
# Line 1369  void MainForm::fileOpenRecent (void) Line 1458  void MainForm::fileOpenRecent (void)
1458          // Retrive filename index from action data...          // Retrive filename index from action data...
1459          QAction *pAction = qobject_cast<QAction *> (sender());          QAction *pAction = qobject_cast<QAction *> (sender());
1460          if (pAction && m_pOptions) {          if (pAction && m_pOptions) {
1461                  int iIndex = pAction->data().toInt();                  const int iIndex = pAction->data().toInt();
1462                  if (iIndex >= 0 && iIndex < m_pOptions->recentFiles.count()) {                  if (iIndex >= 0 && iIndex < m_pOptions->recentFiles.count()) {
1463                          QString sFilename = m_pOptions->recentFiles[iIndex];                          QString sFilename = m_pOptions->recentFiles[iIndex];
1464                          // Check if we can safely close the current session...                          // Check if we can safely close the current session...
# Line 1403  void MainForm::fileReset (void) Line 1492  void MainForm::fileReset (void)
1492                  return;                  return;
1493    
1494          // Ask user whether he/she want's an internal sampler reset...          // Ask user whether he/she want's an internal sampler reset...
1495          if (QMessageBox::warning(this,          if (m_pOptions && m_pOptions->bConfirmReset) {
1496                  QSAMPLER_TITLE ": " + tr("Warning"),                  const QString& sTitle = QSAMPLER_TITLE ": " + tr("Warning");
1497                  tr("Resetting the sampler instance will close\n"                  const QString& sText = tr(
1498                  "all device and channel configurations.\n\n"                          "Resetting the sampler instance will close\n"
1499                  "Please note that this operation may cause\n"                          "all device and channel configurations.\n\n"
1500                  "temporary MIDI and Audio disruption.\n\n"                          "Please note that this operation may cause\n"
1501                  "Do you want to reset the sampler engine now?"),                          "temporary MIDI and Audio disruption.\n\n"
1502                  QMessageBox::Ok | QMessageBox::Cancel)                          "Do you want to reset the sampler engine now?");
1503                  == QMessageBox::Cancel)          #if 0
1504                  return;                  if (QMessageBox::warning(this, sTitle, sText,
1505                            QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Cancel)
1506                            return;
1507            #else
1508                    QMessageBox mbox(this);
1509                    mbox.setIcon(QMessageBox::Warning);
1510                    mbox.setWindowTitle(sTitle);
1511                    mbox.setText(sText);
1512                    mbox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
1513                    QCheckBox cbox(tr("Don't ask this again"));
1514                    cbox.setChecked(false);
1515                    cbox.blockSignals(true);
1516                    mbox.addButton(&cbox, QMessageBox::ActionRole);
1517                    if (mbox.exec() == QMessageBox::Cancel)
1518                            return;
1519                    if (cbox.isChecked())
1520                            m_pOptions->bConfirmReset = false;
1521            #endif
1522            }
1523    
1524          // Trye closing the current session, first...          // Trye closing the current session, first...
1525          if (!closeSession(true))          if (!closeSession(true))
# Line 1444  void MainForm::fileRestart (void) Line 1551  void MainForm::fileRestart (void)
1551    
1552          // Ask user whether he/she want's a complete restart...          // Ask user whether he/she want's a complete restart...
1553          // (if we're currently up and running)          // (if we're currently up and running)
1554          if (bRestart && m_pClient) {          if (m_pOptions && m_pOptions->bConfirmRestart) {
1555                  bRestart = (QMessageBox::warning(this,                  const QString& sTitle = QSAMPLER_TITLE ": " + tr("Warning");
1556                          QSAMPLER_TITLE ": " + tr("Warning"),                  const QString& sText = tr(
1557                          tr("New settings will be effective after\n"                          "New settings will be effective after\n"
1558                          "restarting the client/server connection.\n\n"                          "restarting the client/server connection.\n\n"
1559                          "Please note that this operation may cause\n"                          "Please note that this operation may cause\n"
1560                          "temporary MIDI and Audio disruption.\n\n"                          "temporary MIDI and Audio disruption.\n\n"
1561                          "Do you want to restart the connection now?"),                          "Do you want to restart the connection now?");
1562                          QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok);          #if 0
1563                    if (QMessageBox::warning(this, sTitle, sText,
1564                            QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Cancel)
1565                            bRestart = false;
1566            #else
1567                    QMessageBox mbox(this);
1568                    mbox.setIcon(QMessageBox::Warning);
1569                    mbox.setWindowTitle(sTitle);
1570                    mbox.setText(sText);
1571                    mbox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
1572                    QCheckBox cbox(tr("Don't ask this again"));
1573                    cbox.setChecked(false);
1574                    cbox.blockSignals(true);
1575                    mbox.addButton(&cbox, QMessageBox::ActionRole);
1576                    if (mbox.exec() == QMessageBox::Cancel)
1577                            bRestart = false;
1578                    else
1579                    if (cbox.isChecked())
1580                            m_pOptions->bConfirmRestart = false;
1581            #endif
1582          }          }
1583    
1584          // Are we still for it?          // Are we still for it?
# Line 1474  void MainForm::fileExit (void) Line 1600  void MainForm::fileExit (void)
1600    
1601    
1602  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
1603  // qsamplerMainForm -- Edit Action slots.  // QSampler::MainForm -- Edit Action slots.
1604    
1605  // Add a new sampler channel.  // Add a new sampler channel.
1606  void MainForm::editAddChannel (void)  void MainForm::editAddChannel (void)
1607  {  {
1608            ++m_iDirtySetup;
1609            addChannelStrip();
1610            --m_iDirtySetup;
1611    }
1612    
1613    void MainForm::addChannelStrip (void)
1614    {
1615          if (m_pClient == NULL)          if (m_pClient == NULL)
1616                  return;                  return;
1617    
# Line 1502  void MainForm::editAddChannel (void) Line 1635  void MainForm::editAddChannel (void)
1635          }          }
1636    
1637          // Do we auto-arrange?          // Do we auto-arrange?
1638          if (m_pOptions && m_pOptions->bAutoArrange)          channelsArrangeAuto();
                 channelsArrange();  
1639    
1640          // Make that an overall update.          // Make that an overall update.
1641          m_iDirtyCount++;          m_iDirtyCount++;
# Line 1514  void MainForm::editAddChannel (void) Line 1646  void MainForm::editAddChannel (void)
1646  // Remove current sampler channel.  // Remove current sampler channel.
1647  void MainForm::editRemoveChannel (void)  void MainForm::editRemoveChannel (void)
1648  {  {
1649            ++m_iDirtySetup;
1650            removeChannelStrip();
1651            --m_iDirtySetup;
1652    }
1653    
1654    void MainForm::removeChannelStrip (void)
1655    {
1656          if (m_pClient == NULL)          if (m_pClient == NULL)
1657                  return;                  return;
1658    
# Line 1527  void MainForm::editRemoveChannel (void) Line 1666  void MainForm::editRemoveChannel (void)
1666    
1667          // Prompt user if he/she's sure about this...          // Prompt user if he/she's sure about this...
1668          if (m_pOptions && m_pOptions->bConfirmRemove) {          if (m_pOptions && m_pOptions->bConfirmRemove) {
1669                  if (QMessageBox::warning(this,                  const QString& sTitle = QSAMPLER_TITLE ": " + tr("Warning");
1670                          QSAMPLER_TITLE ": " + tr("Warning"),                  const QString& sText = tr(
1671                          tr("About to remove channel:\n\n"                          "About to remove channel:\n\n"
1672                          "%1\n\n"                          "%1\n\n"
1673                          "Are you sure?")                          "Are you sure?")
1674                          .arg(pChannelStrip->windowTitle()),                          .arg(pChannelStrip->windowTitle());
1675                          QMessageBox::Ok | QMessageBox::Cancel)          #if 0
1676                          == QMessageBox::Cancel)                  if (QMessageBox::warning(this, sTitle, sText,
1677                            QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Cancel)
1678                            return;
1679            #else
1680                    QMessageBox mbox(this);
1681                    mbox.setIcon(QMessageBox::Warning);
1682                    mbox.setWindowTitle(sTitle);
1683                    mbox.setText(sText);
1684                    mbox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
1685                    QCheckBox cbox(tr("Don't ask this again"));
1686                    cbox.setChecked(false);
1687                    cbox.blockSignals(true);
1688                    mbox.addButton(&cbox, QMessageBox::ActionRole);
1689                    if (mbox.exec() == QMessageBox::Cancel)
1690                          return;                          return;
1691                    if (cbox.isChecked())
1692                            m_pOptions->bConfirmRemove = false;
1693            #endif
1694          }          }
1695    
1696          // Remove the existing sampler channel.          // Remove the existing sampler channel.
1697          if (!pChannel->removeChannel())          if (!pChannel->removeChannel())
1698                  return;                  return;
1699    
         // We'll be dirty, for sure...  
         m_iDirtyCount++;  
   
1700          // Just delete the channel strip.          // Just delete the channel strip.
1701          destroyChannelStrip(pChannelStrip);          destroyChannelStrip(pChannelStrip);
1702    
1703            // We'll be dirty, for sure...
1704            m_iDirtyCount++;
1705            stabilizeForm();
1706  }  }
1707    
1708    
# Line 1604  void MainForm::editResetAllChannels (voi Line 1760  void MainForm::editResetAllChannels (voi
1760          // Invoque the channel strip procedure,          // Invoque the channel strip procedure,
1761          // for all channels out there...          // for all channels out there...
1762          m_pWorkspace->setUpdatesEnabled(false);          m_pWorkspace->setUpdatesEnabled(false);
1763          QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();          const QList<QMdiSubWindow *>& wlist
1764          for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {                  = m_pWorkspace->subWindowList();
1765            const int iStripCount = wlist.count();
1766            for (int iStrip = 0; iStrip < iStripCount; ++iStrip) {
1767                  ChannelStrip *pChannelStrip = NULL;                  ChannelStrip *pChannelStrip = NULL;
1768                  QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);                  QMdiSubWindow *pMdiSubWindow = wlist.at(iStrip);
1769                  if (pMdiSubWindow)                  if (pMdiSubWindow)
1770                          pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());                          pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
1771                  if (pChannelStrip)                  if (pChannelStrip)
# Line 1618  void MainForm::editResetAllChannels (voi Line 1776  void MainForm::editResetAllChannels (voi
1776    
1777    
1778  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
1779  // qsamplerMainForm -- View Action slots.  // QSampler::MainForm -- View Action slots.
1780    
1781  // Show/hide the main program window menubar.  // Show/hide the main program window menubar.
1782  void MainForm::viewMenubar ( bool bOn )  void MainForm::viewMenubar ( bool bOn )
# Line 1718  void MainForm::viewOptions (void) Line 1876  void MainForm::viewOptions (void)
1876                  if (m_pOptions->sMessagesFont.isEmpty() && m_pMessages)                  if (m_pOptions->sMessagesFont.isEmpty() && m_pMessages)
1877                          m_pOptions->sMessagesFont = m_pMessages->messagesFont().toString();                          m_pOptions->sMessagesFont = m_pMessages->messagesFont().toString();
1878                  // To track down deferred or immediate changes.                  // To track down deferred or immediate changes.
1879                  QString sOldServerHost      = m_pOptions->sServerHost;                  const QString sOldServerHost      = m_pOptions->sServerHost;
1880                  int     iOldServerPort      = m_pOptions->iServerPort;                  const int     iOldServerPort      = m_pOptions->iServerPort;
1881                  int     iOldServerTimeout   = m_pOptions->iServerTimeout;                  const int     iOldServerTimeout   = m_pOptions->iServerTimeout;
1882                  bool    bOldServerStart     = m_pOptions->bServerStart;                  const bool    bOldServerStart     = m_pOptions->bServerStart;
1883                  QString sOldServerCmdLine   = m_pOptions->sServerCmdLine;                  const QString sOldServerCmdLine   = m_pOptions->sServerCmdLine;
1884                  bool    bOldMessagesLog     = m_pOptions->bMessagesLog;                  const bool    bOldMessagesLog     = m_pOptions->bMessagesLog;
1885                  QString sOldMessagesLogPath = m_pOptions->sMessagesLogPath;                  const QString sOldMessagesLogPath = m_pOptions->sMessagesLogPath;
1886                  QString sOldDisplayFont     = m_pOptions->sDisplayFont;                  const QString sOldDisplayFont     = m_pOptions->sDisplayFont;
1887                  bool    bOldDisplayEffect   = m_pOptions->bDisplayEffect;                  const bool    bOldDisplayEffect   = m_pOptions->bDisplayEffect;
1888                  int     iOldMaxVolume       = m_pOptions->iMaxVolume;                  const int     iOldMaxVolume       = m_pOptions->iMaxVolume;
1889                  QString sOldMessagesFont    = m_pOptions->sMessagesFont;                  const QString sOldMessagesFont    = m_pOptions->sMessagesFont;
1890                  bool    bOldKeepOnTop       = m_pOptions->bKeepOnTop;                  const bool    bOldKeepOnTop       = m_pOptions->bKeepOnTop;
1891                  bool    bOldStdoutCapture   = m_pOptions->bStdoutCapture;                  const bool    bOldStdoutCapture   = m_pOptions->bStdoutCapture;
1892                  int     bOldMessagesLimit   = m_pOptions->bMessagesLimit;                  const int     bOldMessagesLimit   = m_pOptions->bMessagesLimit;
1893                  int     iOldMessagesLimitLines = m_pOptions->iMessagesLimitLines;                  const int     iOldMessagesLimitLines = m_pOptions->iMessagesLimitLines;
1894                  bool    bOldCompletePath    = m_pOptions->bCompletePath;                  const bool    bOldCompletePath    = m_pOptions->bCompletePath;
1895                  bool    bOldInstrumentNames = m_pOptions->bInstrumentNames;                  const bool    bOldInstrumentNames = m_pOptions->bInstrumentNames;
1896                  int     iOldMaxRecentFiles  = m_pOptions->iMaxRecentFiles;                  const int     iOldMaxRecentFiles  = m_pOptions->iMaxRecentFiles;
1897                  int     iOldBaseFontSize    = m_pOptions->iBaseFontSize;                  const int     iOldBaseFontSize    = m_pOptions->iBaseFontSize;
1898                  // Load the current setup settings.                  // Load the current setup settings.
1899                  pOptionsForm->setup(m_pOptions);                  pOptionsForm->setup(m_pOptions);
1900                  // Show the setup dialog...                  // Show the setup dialog...
# Line 1799  void MainForm::viewOptions (void) Line 1957  void MainForm::viewOptions (void)
1957    
1958    
1959  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
1960  // qsamplerMainForm -- Channels action slots.  // QSampler::MainForm -- Channels action slots.
1961    
1962  // Arrange channel strips.  // Arrange channel strips.
1963  void MainForm::channelsArrange (void)  void MainForm::channelsArrange (void)
1964  {  {
1965          // Full width vertical tiling          // Full width vertical tiling
1966          QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();          const QList<QMdiSubWindow *>& wlist
1967                    = m_pWorkspace->subWindowList();
1968          if (wlist.isEmpty())          if (wlist.isEmpty())
1969                  return;                  return;
1970    
1971          m_pWorkspace->setUpdatesEnabled(false);          m_pWorkspace->setUpdatesEnabled(false);
1972          int y = 0;          int y = 0;
1973          for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {          const int iStripCount = wlist.count();
1974                  ChannelStrip *pChannelStrip = NULL;          for (int iStrip = 0; iStrip < iStripCount; ++iStrip) {
1975                  QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);                  QMdiSubWindow *pMdiSubWindow = wlist.at(iStrip);
1976                  if (pMdiSubWindow)                  if (pMdiSubWindow) {
1977                          pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());                          pMdiSubWindow->adjustSize();
1978                  if (pChannelStrip) {                          int iWidth = m_pWorkspace->width();
1979                  /*  if (pChannelStrip->testWState(WState_Maximized | WState_Minimized)) {                          if (iWidth < pMdiSubWindow->width())
1980                                  // Prevent flicker...                                  iWidth = pMdiSubWindow->width();
1981                                  pChannelStrip->hide();                          const int iHeight = pMdiSubWindow->frameGeometry().height();
1982                                  pChannelStrip->showNormal();                          pMdiSubWindow->setGeometry(0, y, iWidth, iHeight);
                         }   */  
                         pChannelStrip->adjustSize();  
                         int iWidth  = m_pWorkspace->width();  
                         if (iWidth < pChannelStrip->width())  
                                 iWidth = pChannelStrip->width();  
                 //  int iHeight = pChannelStrip->height()  
                 //              + pChannelStrip->parentWidget()->baseSize().height();  
                         int iHeight = pChannelStrip->parentWidget()->frameGeometry().height();  
                         pChannelStrip->parentWidget()->setGeometry(0, y, iWidth, iHeight);  
1983                          y += iHeight;                          y += iHeight;
1984                  }                  }
1985          }          }
# Line 1849  void MainForm::channelsAutoArrange ( boo Line 1999  void MainForm::channelsAutoArrange ( boo
1999          m_pOptions->bAutoArrange = bOn;          m_pOptions->bAutoArrange = bOn;
2000    
2001          // If on, update whole workspace...          // If on, update whole workspace...
2002          if (m_pOptions->bAutoArrange)          channelsArrangeAuto();
2003    }
2004    
2005    
2006    void MainForm::channelsArrangeAuto (void)
2007    {
2008            if (m_pOptions && m_pOptions->bAutoArrange)
2009                  channelsArrange();                  channelsArrange();
2010  }  }
2011    
2012    
2013  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
2014  // qsamplerMainForm -- Help Action slots.  // QSampler::MainForm -- Help Action slots.
2015    
2016  // Show information about the Qt toolkit.  // Show information about the Qt toolkit.
2017  void MainForm::helpAboutQt (void)  void MainForm::helpAboutQt (void)
# Line 1867  void MainForm::helpAboutQt (void) Line 2023  void MainForm::helpAboutQt (void)
2023  // Show information about application program.  // Show information about application program.
2024  void MainForm::helpAbout (void)  void MainForm::helpAbout (void)
2025  {  {
2026          // Stuff the about box text...          QStringList list;
         QString sText = "<p>\n";  
         sText += "<b>" QSAMPLER_TITLE " - " + tr(QSAMPLER_SUBTITLE) + "</b><br />\n";  
         sText += "<br />\n";  
         sText += tr("Version") + ": <b>" QSAMPLER_VERSION "</b><br />\n";  
         sText += "<small>" + tr("Build") + ": " __DATE__ " " __TIME__ "</small><br />\n";  
2027  #ifdef CONFIG_DEBUG  #ifdef CONFIG_DEBUG
2028          sText += "<small><font color=\"red\">";          list << tr("Debugging option enabled.");
         sText += tr("Debugging option enabled.");  
         sText += "</font></small><br />";  
2029  #endif  #endif
2030  #ifndef CONFIG_LIBGIG  #ifndef CONFIG_LIBGIG
2031          sText += "<small><font color=\"red\">";          list << tr("GIG (libgig) file support disabled.");
         sText += tr("GIG (libgig) file support disabled.");  
         sText += "</font></small><br />";  
2032  #endif  #endif
2033  #ifndef CONFIG_INSTRUMENT_NAME  #ifndef CONFIG_INSTRUMENT_NAME
2034          sText += "<small><font color=\"red\">";          list << tr("LSCP (liblscp) instrument_name support disabled.");
         sText += tr("LSCP (liblscp) instrument_name support disabled.");  
         sText += "</font></small><br />";  
2035  #endif  #endif
2036  #ifndef CONFIG_MUTE_SOLO  #ifndef CONFIG_MUTE_SOLO
2037          sText += "<small><font color=\"red\">";          list << tr("Sampler channel Mute/Solo support disabled.");
         sText += tr("Sampler channel Mute/Solo support disabled.");  
         sText += "</font></small><br />";  
2038  #endif  #endif
2039  #ifndef CONFIG_AUDIO_ROUTING  #ifndef CONFIG_AUDIO_ROUTING
2040          sText += "<small><font color=\"red\">";          list << tr("LSCP (liblscp) audio_routing support disabled.");
         sText += tr("LSCP (liblscp) audio_routing support disabled.");  
         sText += "</font></small><br />";  
2041  #endif  #endif
2042  #ifndef CONFIG_FXSEND  #ifndef CONFIG_FXSEND
2043          sText += "<small><font color=\"red\">";          list << tr("Sampler channel Effect Sends support disabled.");
         sText += tr("Sampler channel Effect Sends support disabled.");  
         sText += "</font></small><br />";  
2044  #endif  #endif
2045  #ifndef CONFIG_VOLUME  #ifndef CONFIG_VOLUME
2046          sText += "<small><font color=\"red\">";          list << tr("Global volume support disabled.");
         sText += tr("Global volume support disabled.");  
         sText += "</font></small><br />";  
2047  #endif  #endif
2048  #ifndef CONFIG_MIDI_INSTRUMENT  #ifndef CONFIG_MIDI_INSTRUMENT
2049          sText += "<small><font color=\"red\">";          list << tr("MIDI instrument mapping support disabled.");
         sText += tr("MIDI instrument mapping support disabled.");  
         sText += "</font></small><br />";  
2050  #endif  #endif
2051  #ifndef CONFIG_EDIT_INSTRUMENT  #ifndef CONFIG_EDIT_INSTRUMENT
2052          sText += "<small><font color=\"red\">";          list << tr("Instrument editing support disabled.");
         sText += tr("Instrument editing support disabled.");  
         sText += "</font></small><br />";  
2053  #endif  #endif
2054  #ifndef CONFIG_EVENT_CHANNEL_MIDI  #ifndef CONFIG_EVENT_CHANNEL_MIDI
2055          sText += "<small><font color=\"red\">";          list << tr("Channel MIDI event support disabled.");
         sText += tr("Channel MIDI event support disabled.");  
         sText += "</font></small><br />";  
2056  #endif  #endif
2057  #ifndef CONFIG_EVENT_DEVICE_MIDI  #ifndef CONFIG_EVENT_DEVICE_MIDI
2058          sText += "<small><font color=\"red\">";          list << tr("Device MIDI event support disabled.");
         sText += tr("Device MIDI event support disabled.");  
         sText += "</font></small><br />";  
2059  #endif  #endif
2060  #ifndef CONFIG_MAX_VOICES  #ifndef CONFIG_MAX_VOICES
2061          sText += "<small><font color=\"red\">";          list << tr("Runtime max. voices / disk streams support disabled.");
         sText += tr("Runtime max. voices / disk streams support disabled.");  
         sText += "</font></small><br />";  
2062  #endif  #endif
2063    
2064            // Stuff the about box text...
2065            QString sText = "<p>\n";
2066            sText += "<b>" QSAMPLER_TITLE " - " + tr(QSAMPLER_SUBTITLE) + "</b><br />\n";
2067            sText += "<br />\n";
2068            sText += tr("Version") + ": <b>" CONFIG_BUILD_VERSION "</b><br />\n";
2069    //      sText += "<small>" + tr("Build") + ": " CONFIG_BUILD_DATE "</small><br />\n";
2070            if (!list.isEmpty()) {
2071                    sText += "<small><font color=\"red\">";
2072                    sText += list.join("<br />\n");
2073                    sText += "</font></small>";
2074            }
2075          sText += "<br />\n";          sText += "<br />\n";
2076          sText += tr("Using") + ": ";          sText += tr("Using") + ": ";
2077          sText += ::lscp_client_package();          sText += ::lscp_client_package();
# Line 1962  void MainForm::helpAbout (void) Line 2101  void MainForm::helpAbout (void)
2101    
2102    
2103  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
2104  // qsamplerMainForm -- Main window stabilization.  // QSampler::MainForm -- Main window stabilization.
2105    
2106  void MainForm::stabilizeForm (void)  void MainForm::stabilizeForm (void)
2107  {  {
# Line 1974  void MainForm::stabilizeForm (void) Line 2113  void MainForm::stabilizeForm (void)
2113    
2114          // Update the main menu state...          // Update the main menu state...
2115          ChannelStrip *pChannelStrip = activeChannelStrip();          ChannelStrip *pChannelStrip = activeChannelStrip();
2116          bool bHasClient = (m_pOptions != NULL && m_pClient != NULL);          const QList<QMdiSubWindow *>& wlist = m_pWorkspace->subWindowList();
2117          bool bHasChannel = (bHasClient && pChannelStrip != NULL);          const bool bHasClient = (m_pOptions != NULL && m_pClient != NULL);
2118          bool bHasChannels = (bHasClient && m_pWorkspace->subWindowList().count() > 0);          const bool bHasChannel = (bHasClient && pChannelStrip != NULL);
2119            const bool bHasChannels = (bHasClient && wlist.count() > 0);
2120          m_ui.fileNewAction->setEnabled(bHasClient);          m_ui.fileNewAction->setEnabled(bHasClient);
2121          m_ui.fileOpenAction->setEnabled(bHasClient);          m_ui.fileOpenAction->setEnabled(bHasClient);
2122          m_ui.fileSaveAction->setEnabled(bHasClient && m_iDirtyCount > 0);          m_ui.fileSaveAction->setEnabled(bHasClient && m_iDirtyCount > 0);
# Line 2056  void MainForm::volumeChanged ( int iVolu Line 2196  void MainForm::volumeChanged ( int iVolu
2196                  m_pVolumeSpinBox->setValue(iVolume);                  m_pVolumeSpinBox->setValue(iVolume);
2197    
2198          // Do it as commanded...          // Do it as commanded...
2199          float fVolume = 0.01f * float(iVolume);          const float fVolume = 0.01f * float(iVolume);
2200          if (::lscp_set_volume(m_pClient, fVolume) == LSCP_OK)          if (::lscp_set_volume(m_pClient, fVolume) == LSCP_OK)
2201                  appendMessages(QObject::tr("Volume: %1.").arg(fVolume));                  appendMessages(QObject::tr("Volume: %1.").arg(fVolume));
2202          else          else
# Line 2091  void MainForm::channelStripChanged ( Cha Line 2231  void MainForm::channelStripChanged ( Cha
2231  void MainForm::updateSession (void)  void MainForm::updateSession (void)
2232  {  {
2233  #ifdef CONFIG_VOLUME  #ifdef CONFIG_VOLUME
2234          int iVolume = ::lroundf(100.0f * ::lscp_get_volume(m_pClient));          const int iVolume = ::lroundf(100.0f * ::lscp_get_volume(m_pClient));
2235          m_iVolumeChanging++;          m_iVolumeChanging++;
2236          m_pVolumeSlider->setValue(iVolume);          m_pVolumeSlider->setValue(iVolume);
2237          m_pVolumeSpinBox->setValue(iVolume);          m_pVolumeSpinBox->setValue(iVolume);
# Line 2099  void MainForm::updateSession (void) Line 2239  void MainForm::updateSession (void)
2239  #endif  #endif
2240  #ifdef CONFIG_MIDI_INSTRUMENT  #ifdef CONFIG_MIDI_INSTRUMENT
2241          // FIXME: Make some room for default instrument maps...          // FIXME: Make some room for default instrument maps...
2242          int iMaps = ::lscp_get_midi_instrument_maps(m_pClient);          const int iMaps = ::lscp_get_midi_instrument_maps(m_pClient);
2243          if (iMaps < 0)          if (iMaps < 0)
2244                  appendMessagesClient("lscp_get_midi_instrument_maps");                  appendMessagesClient("lscp_get_midi_instrument_maps");
2245          else if (iMaps < 1) {          else if (iMaps < 1) {
# Line 2113  void MainForm::updateSession (void) Line 2253  void MainForm::updateSession (void)
2253          updateAllChannelStrips(false);          updateAllChannelStrips(false);
2254    
2255          // Do we auto-arrange?          // Do we auto-arrange?
2256          if (m_pOptions && m_pOptions->bAutoArrange)          channelsArrangeAuto();
                 channelsArrange();  
2257    
2258          // Remember to refresh devices and instruments...          // Remember to refresh devices and instruments...
2259          if (m_pInstrumentListForm)          if (m_pInstrumentListForm)
# Line 2126  void MainForm::updateSession (void) Line 2265  void MainForm::updateSession (void)
2265    
2266  void MainForm::updateAllChannelStrips ( bool bRemoveDeadStrips )  void MainForm::updateAllChannelStrips ( bool bRemoveDeadStrips )
2267  {  {
2268            // Skip if setting up a new channel strip...
2269            if (m_iDirtySetup > 0)
2270                    return;
2271    
2272          // Retrieve the current channel list.          // Retrieve the current channel list.
2273          int *piChannelIDs = ::lscp_list_channels(m_pClient);          int *piChannelIDs = ::lscp_list_channels(m_pClient);
2274          if (piChannelIDs == NULL) {          if (piChannelIDs == NULL) {
# Line 2143  void MainForm::updateAllChannelStrips ( Line 2286  void MainForm::updateAllChannelStrips (
2286                                  createChannelStrip(new Channel(piChannelIDs[iChannel]));                                  createChannelStrip(new Channel(piChannelIDs[iChannel]));
2287                  }                  }
2288                  // Do we auto-arrange?                  // Do we auto-arrange?
2289                  if (m_pOptions && m_pOptions->bAutoArrange)                  channelsArrangeAuto();
                         channelsArrange();  
2290                  // remove dead channel strips                  // remove dead channel strips
2291                  if (bRemoveDeadStrips) {                  if (bRemoveDeadStrips) {
2292                          QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();                          const QList<QMdiSubWindow *>& wlist
2293                          for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {                                  = m_pWorkspace->subWindowList();
2294                            const int iStripCount = wlist.count();
2295                            for (int iStrip = 0; iStrip < iStripCount; ++iStrip) {
2296                                  ChannelStrip *pChannelStrip = NULL;                                  ChannelStrip *pChannelStrip = NULL;
2297                                  QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);                                  QMdiSubWindow *pMdiSubWindow = wlist.at(iStrip);
2298                                  if (pMdiSubWindow)                                  if (pMdiSubWindow)
2299                                          pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());                                          pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
2300                                  if (pChannelStrip) {                                  if (pChannelStrip) {
2301                                          bool bExists = false;                                          bool bExists = false;
2302                                          for (int j = 0; piChannelIDs[j] >= 0; ++j) {                                          for (int iChannel = 0; piChannelIDs[iChannel] >= 0; ++iChannel) {
2303                                                  if (!pChannelStrip->channel())                                                  Channel *pChannel = pChannelStrip->channel();
2304                                                    if (pChannel == NULL)
2305                                                          break;                                                          break;
2306                                                  if (piChannelIDs[j] == pChannelStrip->channel()->channelID()) {                                                  if (piChannelIDs[iChannel] == pChannel->channelID()) {
2307                                                          // strip exists, don't touch it                                                          // strip exists, don't touch it
2308                                                          bExists = true;                                                          bExists = true;
2309                                                          break;                                                          break;
# Line 2183  void MainForm::updateRecentFiles ( const Line 2328  void MainForm::updateRecentFiles ( const
2328                  return;                  return;
2329    
2330          // Remove from list if already there (avoid duplicates)          // Remove from list if already there (avoid duplicates)
2331          int iIndex = m_pOptions->recentFiles.indexOf(sFilename);          const int iIndex = m_pOptions->recentFiles.indexOf(sFilename);
2332          if (iIndex >= 0)          if (iIndex >= 0)
2333                  m_pOptions->recentFiles.removeAt(iIndex);                  m_pOptions->recentFiles.removeAt(iIndex);
2334          // Put it to front...          // Put it to front...
# Line 2222  void MainForm::updateRecentFilesMenu (vo Line 2367  void MainForm::updateRecentFilesMenu (vo
2367  void MainForm::updateInstrumentNames (void)  void MainForm::updateInstrumentNames (void)
2368  {  {
2369          // Full channel list update...          // Full channel list update...
2370          QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();          const QList<QMdiSubWindow *>& wlist
2371                    = m_pWorkspace->subWindowList();
2372          if (wlist.isEmpty())          if (wlist.isEmpty())
2373                  return;                  return;
2374    
2375          m_pWorkspace->setUpdatesEnabled(false);          m_pWorkspace->setUpdatesEnabled(false);
2376          for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {          const int iStripCount = wlist.count();
2377                  ChannelStrip *pChannelStrip = (ChannelStrip *) wlist.at(iChannel);          for (int iStrip = 0; iStrip < iStripCount; ++iStrip) {
2378                    ChannelStrip *pChannelStrip = NULL;
2379                    QMdiSubWindow *pMdiSubWindow = wlist.at(iStrip);
2380                    if (pMdiSubWindow)
2381                            pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
2382                  if (pChannelStrip)                  if (pChannelStrip)
2383                          pChannelStrip->updateInstrumentName(true);                          pChannelStrip->updateInstrumentName(true);
2384          }          }
# Line 2245  void MainForm::updateDisplayFont (void) Line 2395  void MainForm::updateDisplayFont (void)
2395          // Check if display font is legal.          // Check if display font is legal.
2396          if (m_pOptions->sDisplayFont.isEmpty())          if (m_pOptions->sDisplayFont.isEmpty())
2397                  return;                  return;
2398    
2399          // Realize it.          // Realize it.
2400          QFont font;          QFont font;
2401          if (!font.fromString(m_pOptions->sDisplayFont))          if (!font.fromString(m_pOptions->sDisplayFont))
2402                  return;                  return;
2403    
2404          // Full channel list update...          // Full channel list update...
2405          QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();          const QList<QMdiSubWindow *>& wlist
2406                    = m_pWorkspace->subWindowList();
2407          if (wlist.isEmpty())          if (wlist.isEmpty())
2408                  return;                  return;
2409    
2410          m_pWorkspace->setUpdatesEnabled(false);          m_pWorkspace->setUpdatesEnabled(false);
2411          for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {          const int iStripCount = wlist.count();
2412            for (int iStrip = 0; iStrip < iStripCount; ++iStrip) {
2413                  ChannelStrip *pChannelStrip = NULL;                  ChannelStrip *pChannelStrip = NULL;
2414                  QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);                  QMdiSubWindow *pMdiSubWindow = wlist.at(iStrip);
2415                  if (pMdiSubWindow)                  if (pMdiSubWindow)
2416                          pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());                          pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
2417                  if (pChannelStrip)                  if (pChannelStrip)
# Line 2272  void MainForm::updateDisplayFont (void) Line 2425  void MainForm::updateDisplayFont (void)
2425  void MainForm::updateDisplayEffect (void)  void MainForm::updateDisplayEffect (void)
2426  {  {
2427          // Full channel list update...          // Full channel list update...
2428          QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();          const QList<QMdiSubWindow *>& wlist
2429                    = m_pWorkspace->subWindowList();
2430          if (wlist.isEmpty())          if (wlist.isEmpty())
2431                  return;                  return;
2432    
2433          m_pWorkspace->setUpdatesEnabled(false);          m_pWorkspace->setUpdatesEnabled(false);
2434          for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {          const int iStripCount = wlist.count();
2435            for (int iStrip = 0; iStrip < iStripCount; ++iStrip) {
2436                  ChannelStrip *pChannelStrip = NULL;                  ChannelStrip *pChannelStrip = NULL;
2437                  QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);                  QMdiSubWindow *pMdiSubWindow = wlist.at(iStrip);
2438                  if (pMdiSubWindow)                  if (pMdiSubWindow)
2439                          pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());                          pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
2440                  if (pChannelStrip)                  if (pChannelStrip)
# Line 2303  void MainForm::updateMaxVolume (void) Line 2458  void MainForm::updateMaxVolume (void)
2458  #endif  #endif
2459    
2460          // Full channel list update...          // Full channel list update...
2461          QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();          const QList<QMdiSubWindow *>& wlist
2462                    = m_pWorkspace->subWindowList();
2463          if (wlist.isEmpty())          if (wlist.isEmpty())
2464                  return;                  return;
2465    
2466          m_pWorkspace->setUpdatesEnabled(false);          m_pWorkspace->setUpdatesEnabled(false);
2467          for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {          const int iStripCount = wlist.count();
2468            for (int iStrip = 0; iStrip < iStripCount; ++iStrip) {
2469                  ChannelStrip *pChannelStrip = NULL;                  ChannelStrip *pChannelStrip = NULL;
2470                  QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);                  QMdiSubWindow *pMdiSubWindow = wlist.at(iStrip);
2471                  if (pMdiSubWindow)                  if (pMdiSubWindow)
2472                          pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());                          pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
2473                  if (pChannelStrip)                  if (pChannelStrip)
# Line 2321  void MainForm::updateMaxVolume (void) Line 2478  void MainForm::updateMaxVolume (void)
2478    
2479    
2480  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
2481  // qsamplerMainForm -- Messages window form handlers.  // QSampler::MainForm -- Messages window form handlers.
2482    
2483  // Messages output methods.  // Messages output methods.
2484  void MainForm::appendMessages( const QString& s )  void MainForm::appendMessages( const QString& s )
# Line 2346  void MainForm::appendMessagesText( const Line 2503  void MainForm::appendMessagesText( const
2503                  m_pMessages->appendMessagesText(s);                  m_pMessages->appendMessagesText(s);
2504  }  }
2505    
2506  void MainForm::appendMessagesError( const QString& s )  void MainForm::appendMessagesError( const QString& sText )
2507  {  {
2508          if (m_pMessages)          if (m_pMessages)
2509                  m_pMessages->show();                  m_pMessages->show();
2510    
2511          appendMessagesColor(s.simplified(), "#ff0000");          appendMessagesColor(sText.simplified(), "#ff0000");
2512    
2513          // Make it look responsive...:)          // Make it look responsive...:)
2514          QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);          QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
2515    
2516          QMessageBox::critical(this,          if (m_pOptions && m_pOptions->bConfirmError) {
2517                  QSAMPLER_TITLE ": " + tr("Error"), s, QMessageBox::Cancel);                  const QString& sTitle = QSAMPLER_TITLE ": " + tr("Error");
2518            #if 0
2519                    QMessageBox::critical(this, sTitle, sText, QMessageBox::Cancel);
2520            #else
2521                    QMessageBox mbox(this);
2522                    mbox.setIcon(QMessageBox::Critical);
2523                    mbox.setWindowTitle(sTitle);
2524                    mbox.setText(sText);
2525                    mbox.setStandardButtons(QMessageBox::Cancel);
2526                    QCheckBox cbox(tr("Don't show this again"));
2527                    cbox.setChecked(false);
2528                    cbox.blockSignals(true);
2529                    mbox.addButton(&cbox, QMessageBox::ActionRole);
2530                    if (mbox.exec() && cbox.isChecked())
2531                            m_pOptions->bConfirmError = false;
2532            #endif
2533            }
2534  }  }
2535    
2536    
# Line 2417  void MainForm::updateMessagesCapture (vo Line 2590  void MainForm::updateMessagesCapture (vo
2590    
2591    
2592  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
2593  // qsamplerMainForm -- MDI channel strip management.  // QSampler::MainForm -- MDI channel strip management.
2594    
2595  // The channel strip creation executive.  // The channel strip creation executive.
2596  ChannelStrip *MainForm::createChannelStrip ( Channel *pChannel )  ChannelStrip *MainForm::createChannelStrip ( Channel *pChannel )
# Line 2436  ChannelStrip *MainForm::createChannelStr Line 2609  ChannelStrip *MainForm::createChannelStr
2609                  pChannelStrip->setDisplayEffect(m_pOptions->bDisplayEffect);                  pChannelStrip->setDisplayEffect(m_pOptions->bDisplayEffect);
2610                  // We'll need a display font.                  // We'll need a display font.
2611                  QFont font;                  QFont font;
2612                  if (font.fromString(m_pOptions->sDisplayFont))                  if (!m_pOptions->sDisplayFont.isEmpty() &&
2613                            font.fromString(m_pOptions->sDisplayFont))
2614                          pChannelStrip->setDisplayFont(font);                          pChannelStrip->setDisplayFont(font);
2615                  // Maximum allowed volume setting.                  // Maximum allowed volume setting.
2616                  pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume);                  pChannelStrip->setMaxVolume(m_pOptions->iMaxVolume);
# Line 2476  void MainForm::destroyChannelStrip ( Cha Line 2650  void MainForm::destroyChannelStrip ( Cha
2650          delete pMdiSubWindow;          delete pMdiSubWindow;
2651    
2652          // Do we auto-arrange?          // Do we auto-arrange?
2653          if (m_pOptions && m_pOptions->bAutoArrange)          channelsArrangeAuto();
                 channelsArrange();  
   
         stabilizeForm();  
2654  }  }
2655    
2656    
# Line 2495  ChannelStrip *MainForm::activeChannelStr Line 2666  ChannelStrip *MainForm::activeChannelStr
2666    
2667    
2668  // Retrieve a channel strip by index.  // Retrieve a channel strip by index.
2669  ChannelStrip *MainForm::channelStripAt ( int iChannel )  ChannelStrip *MainForm::channelStripAt ( int iStrip )
2670  {  {
2671          if (!m_pWorkspace) return NULL;          if (!m_pWorkspace) return NULL;
2672    
2673          QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();          const QList<QMdiSubWindow *>& wlist
2674                    = m_pWorkspace->subWindowList();
2675          if (wlist.isEmpty())          if (wlist.isEmpty())
2676                  return NULL;                  return NULL;
2677    
2678          if (iChannel < 0 || iChannel >= wlist.size())          if (iStrip < 0 || iStrip >= wlist.count())
2679                  return NULL;                  return NULL;
2680    
2681          QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);          QMdiSubWindow *pMdiSubWindow = wlist.at(iStrip);
2682          if (pMdiSubWindow)          if (pMdiSubWindow)
2683                  return static_cast<ChannelStrip *> (pMdiSubWindow->widget());                  return static_cast<ChannelStrip *> (pMdiSubWindow->widget());
2684          else          else
# Line 2517  ChannelStrip *MainForm::channelStripAt ( Line 2689  ChannelStrip *MainForm::channelStripAt (
2689  // Retrieve a channel strip by sampler channel id.  // Retrieve a channel strip by sampler channel id.
2690  ChannelStrip *MainForm::channelStrip ( int iChannelID )  ChannelStrip *MainForm::channelStrip ( int iChannelID )
2691  {  {
2692          QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();          const QList<QMdiSubWindow *>& wlist
2693                    = m_pWorkspace->subWindowList();
2694          if (wlist.isEmpty())          if (wlist.isEmpty())
2695                  return NULL;                  return NULL;
2696    
2697          for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {          const int iStripCount = wlist.count();
2698            for (int iStrip = 0; iStrip < iStripCount; ++iStrip) {
2699                  ChannelStrip *pChannelStrip = NULL;                  ChannelStrip *pChannelStrip = NULL;
2700                  QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);                  QMdiSubWindow *pMdiSubWindow = wlist.at(iStrip);
2701                  if (pMdiSubWindow)                  if (pMdiSubWindow)
2702                          pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());                          pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
2703                  if (pChannelStrip) {                  if (pChannelStrip) {
# Line 2545  void MainForm::channelsMenuAboutToShow ( Line 2719  void MainForm::channelsMenuAboutToShow (
2719          m_ui.channelsMenu->addAction(m_ui.channelsArrangeAction);          m_ui.channelsMenu->addAction(m_ui.channelsArrangeAction);
2720          m_ui.channelsMenu->addAction(m_ui.channelsAutoArrangeAction);          m_ui.channelsMenu->addAction(m_ui.channelsAutoArrangeAction);
2721    
2722          QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();          const QList<QMdiSubWindow *>& wlist
2723                    = m_pWorkspace->subWindowList();
2724          if (!wlist.isEmpty()) {          if (!wlist.isEmpty()) {
2725                  m_ui.channelsMenu->addSeparator();                  m_ui.channelsMenu->addSeparator();
2726                  for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {                  const int iStripCount = wlist.count();
2727                    for (int iStrip = 0; iStrip < iStripCount; ++iStrip) {
2728                          ChannelStrip *pChannelStrip = NULL;                          ChannelStrip *pChannelStrip = NULL;
2729                          QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);                          QMdiSubWindow *pMdiSubWindow = wlist.at(iStrip);
2730                          if (pMdiSubWindow)                          if (pMdiSubWindow)
2731                                  pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());                                  pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
2732                          if (pChannelStrip) {                          if (pChannelStrip) {
# Line 2559  void MainForm::channelsMenuAboutToShow ( Line 2735  void MainForm::channelsMenuAboutToShow (
2735                                          this, SLOT(channelsMenuActivated()));                                          this, SLOT(channelsMenuActivated()));
2736                                  pAction->setCheckable(true);                                  pAction->setCheckable(true);
2737                                  pAction->setChecked(activeChannelStrip() == pChannelStrip);                                  pAction->setChecked(activeChannelStrip() == pChannelStrip);
2738                                  pAction->setData(iChannel);                                  pAction->setData(iStrip);
2739                          }                          }
2740                  }                  }
2741          }          }
# Line 2583  void MainForm::channelsMenuActivated (vo Line 2759  void MainForm::channelsMenuActivated (vo
2759    
2760    
2761  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
2762  // qsamplerMainForm -- Timer stuff.  // QSampler::MainForm -- Timer stuff.
2763    
2764  // Set the pseudo-timer delay schedule.  // Set the pseudo-timer delay schedule.
2765  void MainForm::startSchedule ( int iStartDelay )  void MainForm::startSchedule ( int iStartDelay )
# Line 2624  void MainForm::timerSlot (void) Line 2800  void MainForm::timerSlot (void)
2800                          ChannelStrip *pChannelStrip = iter.next();                          ChannelStrip *pChannelStrip = iter.next();
2801                          // If successfull, remove from pending list...                          // If successfull, remove from pending list...
2802                          if (pChannelStrip->updateChannelInfo()) {                          if (pChannelStrip->updateChannelInfo()) {
2803                                  int iChannelStrip = m_changedStrips.indexOf(pChannelStrip);                                  const int iChannelStrip = m_changedStrips.indexOf(pChannelStrip);
2804                                  if (iChannelStrip >= 0)                                  if (iChannelStrip >= 0)
2805                                          m_changedStrips.removeAt(iChannelStrip);                                          m_changedStrips.removeAt(iChannelStrip);
2806                          }                          }
# Line 2635  void MainForm::timerSlot (void) Line 2811  void MainForm::timerSlot (void)
2811                          if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime)  {                          if (m_iTimerSlot >= m_pOptions->iAutoRefreshTime)  {
2812                                  m_iTimerSlot = 0;                                  m_iTimerSlot = 0;
2813                                  // Update the channel stream usage for each strip...                                  // Update the channel stream usage for each strip...
2814                                  QList<QMdiSubWindow *> wlist = m_pWorkspace->subWindowList();                                  const QList<QMdiSubWindow *>& wlist
2815                                  for (int iChannel = 0; iChannel < (int) wlist.count(); ++iChannel) {                                          = m_pWorkspace->subWindowList();
2816                                    const int iStripCount = wlist.count();
2817                                    for (int iStrip = 0; iStrip < iStripCount; ++iStrip) {
2818                                          ChannelStrip *pChannelStrip = NULL;                                          ChannelStrip *pChannelStrip = NULL;
2819                                          QMdiSubWindow *pMdiSubWindow = wlist.at(iChannel);                                          QMdiSubWindow *pMdiSubWindow = wlist.at(iStrip);
2820                                          if (pMdiSubWindow)                                          if (pMdiSubWindow)
2821                                                  pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());                                                  pChannelStrip = static_cast<ChannelStrip *> (pMdiSubWindow->widget());
2822                                          if (pChannelStrip && pChannelStrip->isVisible())                                          if (pChannelStrip && pChannelStrip->isVisible())
# Line 2654  void MainForm::timerSlot (void) Line 2832  void MainForm::timerSlot (void)
2832    
2833    
2834  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
2835  // qsamplerMainForm -- Server stuff.  // QSampler::MainForm -- Server stuff.
2836    
2837  // Start linuxsampler server...  // Start linuxsampler server...
2838  void MainForm::startServer (void)  void MainForm::startServer (void)
# Line 2688  void MainForm::startServer (void) Line 2866  void MainForm::startServer (void)
2866    
2867          // OK. Let's build the startup process...          // OK. Let's build the startup process...
2868          m_pServer = new QProcess();          m_pServer = new QProcess();
2869          bForceServerStop = true;          m_bForceServerStop = true;
2870    
2871          // Setup stdout/stderr capture...          // Setup stdout/stderr capture...
2872  //      if (m_pOptions->bStdoutCapture) {          m_pServer->setProcessChannelMode(QProcess::ForwardedChannels);
2873                  m_pServer->setProcessChannelMode(QProcess::ForwardedChannels);          QObject::connect(m_pServer,
2874                  QObject::connect(m_pServer,                  SIGNAL(readyReadStandardOutput()),
2875                          SIGNAL(readyReadStandardOutput()),                  SLOT(readServerStdout()));
2876                          SLOT(readServerStdout()));          QObject::connect(m_pServer,
2877                  QObject::connect(m_pServer,                  SIGNAL(readyReadStandardError()),
2878                          SIGNAL(readyReadStandardError()),                  SLOT(readServerStdout()));
                         SLOT(readServerStdout()));  
 //      }  
2879    
2880          // The unforgiveable signal communication...          // The unforgiveable signal communication...
2881          QObject::connect(m_pServer,          QObject::connect(m_pServer,
# Line 2734  void MainForm::startServer (void) Line 2910  void MainForm::startServer (void)
2910    
2911    
2912  // Stop linuxsampler server...  // Stop linuxsampler server...
2913  void MainForm::stopServer (bool bInteractive)  void MainForm::stopServer ( bool bInteractive )
2914  {  {
2915          // Stop client code.          // Stop client code.
2916          stopClient();          stopClient();
# Line 2747  void MainForm::stopServer (bool bInterac Line 2923  void MainForm::stopServer (bool bInterac
2923                          "according to your current sampler session and you could alter the\n"                          "according to your current sampler session and you could alter the\n"
2924                          "sampler session at any time by relaunching QSampler.\n\n"                          "sampler session at any time by relaunching QSampler.\n\n"
2925                          "Do you want LinuxSampler to stop?"),                          "Do you want LinuxSampler to stop?"),
2926                          QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)                          QMessageBox::Yes | QMessageBox::No,
2927                  {                          QMessageBox::Yes) == QMessageBox::No) {
2928                          bForceServerStop = false;                          m_bForceServerStop = false;
2929                  }                  }
2930          }          }
2931    
2932            bool bGraceWait = true;
2933    
2934          // And try to stop server.          // And try to stop server.
2935          if (m_pServer && bForceServerStop) {          if (m_pServer && m_bForceServerStop) {
2936                  appendMessages(tr("Server is stopping..."));                  appendMessages(tr("Server is stopping..."));
2937                  if (m_pServer->state() == QProcess::Running) {                  if (m_pServer->state() == QProcess::Running) {
2938                  #if defined(WIN32)                  #if defined(__WIN32__) || defined(_WIN32) || defined(WIN32)
2939                          // Try harder...                          // Try harder...
2940                          m_pServer->kill();                          m_pServer->kill();
2941                  #else                  #else
2942                          // Try softly...                          // Try softly...
2943                          m_pServer->terminate();                          m_pServer->terminate();
2944                            bool bFinished = m_pServer->waitForFinished(QSAMPLER_TIMER_MSECS * 1000);
2945                            if (bFinished) bGraceWait = false;
2946                  #endif                  #endif
2947                  }                  }
2948          }       // Do final processing anyway.          }       // Do final processing anyway.
2949          else processServerExit();          else processServerExit();
2950    
2951          // Give it some time to terminate gracefully and stabilize...          // Give it some time to terminate gracefully and stabilize...
2952          QTime t;          if (bGraceWait) {
2953          t.start();                  QTime t;
2954          while (t.elapsed() < QSAMPLER_TIMER_MSECS)                  t.start();
2955                  QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);                  while (t.elapsed() < QSAMPLER_TIMER_MSECS)
2956                            QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
2957            }
2958  }  }
2959    
2960    
# Line 2794  void MainForm::processServerExit (void) Line 2976  void MainForm::processServerExit (void)
2976          if (m_pMessages)          if (m_pMessages)
2977                  m_pMessages->flushStdoutBuffer();                  m_pMessages->flushStdoutBuffer();
2978    
2979          if (m_pServer && bForceServerStop) {          if (m_pServer && m_bForceServerStop) {
2980                  if (m_pServer->state() != QProcess::NotRunning) {                  if (m_pServer->state() != QProcess::NotRunning) {
2981                          appendMessages(tr("Server is being forced..."));                          appendMessages(tr("Server is being forced..."));
2982                          // Force final server shutdown...                          // Force final server shutdown...
# Line 2819  void MainForm::processServerExit (void) Line 3001  void MainForm::processServerExit (void)
3001    
3002    
3003  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
3004  // qsamplerMainForm -- Client stuff.  // QSampler::MainForm -- Client stuff.
3005    
3006  // The LSCP client callback procedure.  // The LSCP client callback procedure.
3007  lscp_status_t qsampler_client_callback ( lscp_client_t */*pClient*/,  lscp_status_t qsampler_client_callback ( lscp_client_t */*pClient*/,
# Line 2871  bool MainForm::startClient (void) Line 3053  bool MainForm::startClient (void)
3053                  stabilizeForm();                  stabilizeForm();
3054                  return false;                  return false;
3055          }          }
3056    
3057          // Just set receive timeout value, blindly.          // Just set receive timeout value, blindly.
3058          ::lscp_client_set_timeout(m_pClient, m_pOptions->iServerTimeout);          ::lscp_client_set_timeout(m_pClient, m_pOptions->iServerTimeout);
3059          appendMessages(          appendMessages(
# Line 3004  void MainForm::activateStrip ( QMdiSubWi Line 3187  void MainForm::activateStrip ( QMdiSubWi
3187  }  }
3188    
3189    
3190    // Channel toolbar orientation change.
3191    void MainForm::channelsToolbarOrientation ( Qt::Orientation orientation )
3192    {
3193    #ifdef CONFIG_VOLUME
3194            m_pVolumeSlider->setOrientation(orientation);
3195            if (orientation == Qt::Horizontal) {
3196                    m_pVolumeSlider->setMinimumHeight(24);
3197                    m_pVolumeSlider->setMaximumHeight(32);
3198                    m_pVolumeSlider->setMinimumWidth(120);
3199                    m_pVolumeSlider->setMaximumWidth(640);
3200                    m_pVolumeSpinBox->setMaximumWidth(64);
3201                    m_pVolumeSpinBox->setButtonSymbols(QSpinBox::UpDownArrows);
3202            } else {
3203                    m_pVolumeSlider->setMinimumHeight(120);
3204                    m_pVolumeSlider->setMaximumHeight(480);
3205                    m_pVolumeSlider->setMinimumWidth(24);
3206                    m_pVolumeSlider->setMaximumWidth(32);
3207                    m_pVolumeSpinBox->setMaximumWidth(32);
3208                    m_pVolumeSpinBox->setButtonSymbols(QSpinBox::NoButtons);
3209            }
3210    #endif
3211    }
3212    
3213    
3214  } // namespace QSampler  } // namespace QSampler
3215    
3216    

Legend:
Removed from v.2459  
changed lines
  Added in v.3510

  ViewVC Help
Powered by ViewVC