/[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 2387 by capela, Sat Dec 29 00:21:11 2012 UTC revision 2681 by capela, Wed Dec 24 14:23:06 2014 UTC
# Line 1  Line 1 
1  // qsamplerMainForm.cpp  // qsamplerMainForm.cpp
2  //  //
3  /****************************************************************************  /****************************************************************************
4     Copyright (C) 2004-2012, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2014, rncbc aka Rui Nuno Capela. All rights reserved.
5     Copyright (C) 2007, 2008 Christian Schoenebeck     Copyright (C) 2007, 2008 Christian Schoenebeck
6    
7     This program is free software; you can redistribute it and/or     This program is free software; you can redistribute it and/or
# Line 65  Line 65 
65  #if QT_VERSION < 0x040500  #if QT_VERSION < 0x040500
66  namespace Qt {  namespace Qt {
67  const WindowFlags WindowCloseButtonHint = WindowFlags(0x08000000);  const WindowFlags WindowCloseButtonHint = WindowFlags(0x08000000);
 #if QT_VERSION < 0x040200  
 const WindowFlags CustomizeWindowHint   = WindowFlags(0x02000000);  
 #endif  
68  }  }
69  #endif  #endif
70    
# Line 257  MainForm::MainForm ( QWidget *pParent ) Line 254  MainForm::MainForm ( QWidget *pParent )
254          QObject::connect(m_pVolumeSlider,          QObject::connect(m_pVolumeSlider,
255                  SIGNAL(valueChanged(int)),                  SIGNAL(valueChanged(int)),
256                  SLOT(volumeChanged(int)));                  SLOT(volumeChanged(int)));
         //m_ui.channelsToolbar->setHorizontallyStretchable(true);  
         //m_ui.channelsToolbar->setStretchableWidget(m_pVolumeSlider);  
257          m_ui.channelsToolbar->addWidget(m_pVolumeSlider);          m_ui.channelsToolbar->addWidget(m_pVolumeSlider);
258          // Volume spin-box          // Volume spin-box
259          m_ui.channelsToolbar->addSeparator();          m_ui.channelsToolbar->addSeparator();
260          m_pVolumeSpinBox = new QSpinBox(m_ui.channelsToolbar);          m_pVolumeSpinBox = new QSpinBox(m_ui.channelsToolbar);
         m_pVolumeSpinBox->setMaximumHeight(24);  
261          m_pVolumeSpinBox->setSuffix(" %");          m_pVolumeSpinBox->setSuffix(" %");
262          m_pVolumeSpinBox->setMinimum(0);          m_pVolumeSpinBox->setMinimum(0);
263          m_pVolumeSpinBox->setMaximum(100);          m_pVolumeSpinBox->setMaximum(100);
# Line 276  MainForm::MainForm ( QWidget *pParent ) Line 270  MainForm::MainForm ( QWidget *pParent )
270    
271          // Make it an MDI workspace.          // Make it an MDI workspace.
272          m_pWorkspace = new QMdiArea(this);          m_pWorkspace = new QMdiArea(this);
273            m_pWorkspace->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
274            m_pWorkspace->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
275          // Set the activation connection.          // Set the activation connection.
276          QObject::connect(m_pWorkspace,          QObject::connect(m_pWorkspace,
277                  SIGNAL(subWindowActivated(QMdiSubWindow *)),                  SIGNAL(subWindowActivated(QMdiSubWindow *)),
# Line 396  MainForm::MainForm ( QWidget *pParent ) Line 392  MainForm::MainForm ( QWidget *pParent )
392          QObject::connect(m_ui.channelsMenu,          QObject::connect(m_ui.channelsMenu,
393                  SIGNAL(aboutToShow()),                  SIGNAL(aboutToShow()),
394                  SLOT(channelsMenuAboutToShow()));                  SLOT(channelsMenuAboutToShow()));
395    #ifdef CONFIG_VOLUME
396            QObject::connect(m_ui.channelsToolbar,
397                    SIGNAL(orientationChanged(Qt::Orientation)),
398                    SLOT(channelsToolbarOrientation(Qt::Orientation)));
399    #endif
400  }  }
401    
402  // Destructor.  // Destructor.
# Line 907  bool MainForm::closeSession ( bool bForc Line 908  bool MainForm::closeSession ( bool bForc
908                                          pChannel->removeChannel();                                          pChannel->removeChannel();
909                                  delete pChannelStrip;                                  delete pChannelStrip;
910                          }                          }
911                            if (pMdiSubWindow)
912                                    delete pMdiSubWindow;
913                  }                  }
914                  m_pWorkspace->setUpdatesEnabled(true);                  m_pWorkspace->setUpdatesEnabled(true);
915                  // We're now clean, for sure.                  // We're now clean, for sure.
# Line 1250  bool MainForm::saveSessionFile ( const Q Line 1253  bool MainForm::saveSessionFile ( const Q
1253                                          ts << "SET CHANNEL MUTE " << iChannel << " 1" << endl;                                          ts << "SET CHANNEL MUTE " << iChannel << " 1" << endl;
1254                                  if (pChannel->channelSolo())                                  if (pChannel->channelSolo())
1255                                          ts << "SET CHANNEL SOLO " << iChannel << " 1" << endl;                                          ts << "SET CHANNEL SOLO " << iChannel << " 1" << endl;
1256  #ifdef CONFIG_MIDI_INSTRUMENT                          #ifdef CONFIG_MIDI_INSTRUMENT
1257                                  if (pChannel->midiMap() >= 0) {                                  if (pChannel->midiMap() >= 0) {
1258                                          ts << "SET CHANNEL MIDI_INSTRUMENT_MAP " << iChannel                                          ts << "SET CHANNEL MIDI_INSTRUMENT_MAP " << iChannel
1259                                                  << " " << midiInstrumentMap[pChannel->midiMap()] << endl;                                                  << " " << midiInstrumentMap[pChannel->midiMap()] << endl;
1260                                  }                                  }
1261  #endif                          #endif
1262  #ifdef CONFIG_FXSEND                          #ifdef CONFIG_FXSEND
1263                                  int iChannelID = pChannel->channelID();                                  int iChannelID = pChannel->channelID();
1264                                  int *piFxSends = ::lscp_list_fxsends(m_pClient, iChannelID);                                  int *piFxSends = ::lscp_list_fxsends(m_pClient, iChannelID);
1265                                  for (int iFxSend = 0;                                  for (int iFxSend = 0;
# Line 1280  bool MainForm::saveSessionFile ( const Q Line 1283  bool MainForm::saveSessionFile ( const Q
1283                                                                  << " " << iAudioSrc                                                                  << " " << iAudioSrc
1284                                                                  << " " << piRouting[iAudioSrc] << endl;                                                                  << " " << piRouting[iAudioSrc] << endl;
1285                                                  }                                                  }
1286  #ifdef CONFIG_FXSEND_LEVEL                                          #ifdef CONFIG_FXSEND_LEVEL
1287                                                  ts << "SET FX_SEND LEVEL " << iChannel                                                  ts << "SET FX_SEND LEVEL " << iChannel
1288                                                          << " " << iFxSend                                                          << " " << iFxSend
1289                                                          << " " << pFxSendInfo->level << endl;                                                          << " " << pFxSendInfo->level << endl;
1290  #endif                                          #endif
1291                                          }       // Check for errors...                                          }       // Check for errors...
1292                                          else if (::lscp_client_get_errno(m_pClient)) {                                          else if (::lscp_client_get_errno(m_pClient)) {
1293                                                  appendMessagesClient("lscp_get_fxsend_info");                                                  appendMessagesClient("lscp_get_fxsend_info");
1294                                                  iErrors++;                                                  iErrors++;
1295                                          }                                          }
1296                                  }                                  }
1297  #endif                          #endif
1298                                  ts << endl;                                  ts << endl;
1299                          }                          }
1300                  }                  }
# Line 1541  void MainForm::editRemoveChannel (void) Line 1544  void MainForm::editRemoveChannel (void)
1544          if (!pChannel->removeChannel())          if (!pChannel->removeChannel())
1545                  return;                  return;
1546    
         // Just delete the channel strip.  
         delete pChannelStrip;  
   
         // Do we auto-arrange?  
         if (m_pOptions && m_pOptions->bAutoArrange)  
                 channelsArrange();  
   
1547          // We'll be dirty, for sure...          // We'll be dirty, for sure...
1548          m_iDirtyCount++;          m_iDirtyCount++;
1549          stabilizeForm();  
1550            // Just delete the channel strip.
1551            destroyChannelStrip(pChannelStrip);
1552  }  }
1553    
1554    
# Line 2447  ChannelStrip *MainForm::createChannelStr Line 2445  ChannelStrip *MainForm::createChannelStr
2445          }          }
2446    
2447          // Add it to workspace...          // Add it to workspace...
2448          m_pWorkspace->addSubWindow(pChannelStrip, Qt::FramelessWindowHint);          m_pWorkspace->addSubWindow(pChannelStrip,
2449                    Qt::SubWindow | Qt::FramelessWindowHint);
2450    
2451          // Actual channel strip setup...          // Actual channel strip setup...
2452          pChannelStrip->setup(pChannel);          pChannelStrip->setup(pChannel);
# Line 2469  ChannelStrip *MainForm::createChannelStr Line 2468  ChannelStrip *MainForm::createChannelStr
2468    
2469  void MainForm::destroyChannelStrip ( ChannelStrip *pChannelStrip )  void MainForm::destroyChannelStrip ( ChannelStrip *pChannelStrip )
2470  {  {
2471            QMdiSubWindow *pMdiSubWindow
2472                    = static_cast<QMdiSubWindow *> (pChannelStrip->parentWidget());
2473            if (pMdiSubWindow == NULL)
2474                    return;
2475    
2476          // Just delete the channel strip.          // Just delete the channel strip.
2477          delete pChannelStrip;          delete pChannelStrip;
2478            delete pMdiSubWindow;
2479    
2480          // Do we auto-arrange?          // Do we auto-arrange?
2481          if (m_pOptions && m_pOptions->bAutoArrange)          if (m_pOptions && m_pOptions->bAutoArrange)
# Line 2689  void MainForm::startServer (void) Line 2694  void MainForm::startServer (void)
2694    
2695          // Setup stdout/stderr capture...          // Setup stdout/stderr capture...
2696  //      if (m_pOptions->bStdoutCapture) {  //      if (m_pOptions->bStdoutCapture) {
 #if QT_VERSION >= 0x040200  
2697                  m_pServer->setProcessChannelMode(QProcess::ForwardedChannels);                  m_pServer->setProcessChannelMode(QProcess::ForwardedChannels);
 #endif  
2698                  QObject::connect(m_pServer,                  QObject::connect(m_pServer,
2699                          SIGNAL(readyReadStandardOutput()),                          SIGNAL(readyReadStandardOutput()),
2700                          SLOT(readServerStdout()));                          SLOT(readServerStdout()));
# Line 2756  void MainForm::stopServer (bool bInterac Line 2759  void MainForm::stopServer (bool bInterac
2759          if (m_pServer && bForceServerStop) {          if (m_pServer && bForceServerStop) {
2760                  appendMessages(tr("Server is stopping..."));                  appendMessages(tr("Server is stopping..."));
2761                  if (m_pServer->state() == QProcess::Running) {                  if (m_pServer->state() == QProcess::Running) {
2762  #if defined(WIN32)                  #if defined(WIN32)
2763                          // Try harder...                          // Try harder...
2764                          m_pServer->kill();                          m_pServer->kill();
2765  #else                  #else
2766                          // Try softly...                          // Try softly...
2767                          m_pServer->terminate();                          m_pServer->terminate();
2768  #endif                  #endif
2769                  }                  }
2770          }       // Do final processing anyway.          }       // Do final processing anyway.
2771          else processServerExit();          else processServerExit();
# Line 3003  void MainForm::activateStrip ( QMdiSubWi Line 3006  void MainForm::activateStrip ( QMdiSubWi
3006  }  }
3007    
3008    
3009    // Channel toolbar orientation change.
3010    void MainForm::channelsToolbarOrientation ( Qt::Orientation orientation )
3011    {
3012    #ifdef CONFIG_VOLUME
3013            m_pVolumeSlider->setOrientation(orientation);
3014            if (orientation == Qt::Horizontal) {
3015                    m_pVolumeSlider->setMinimumHeight(24);
3016                    m_pVolumeSlider->setMaximumHeight(32);
3017                    m_pVolumeSlider->setMinimumWidth(120);
3018                    m_pVolumeSlider->setMaximumWidth(640);
3019                    m_pVolumeSpinBox->setMaximumWidth(64);
3020                    m_pVolumeSpinBox->setButtonSymbols(QSpinBox::UpDownArrows);
3021            } else {
3022                    m_pVolumeSlider->setMinimumHeight(120);
3023                    m_pVolumeSlider->setMaximumHeight(480);
3024                    m_pVolumeSlider->setMinimumWidth(24);
3025                    m_pVolumeSlider->setMaximumWidth(32);
3026                    m_pVolumeSpinBox->setMaximumWidth(32);
3027                    m_pVolumeSpinBox->setButtonSymbols(QSpinBox::NoButtons);
3028            }
3029    #endif
3030    }
3031    
3032    
3033  } // namespace QSampler  } // namespace QSampler
3034    
3035    

Legend:
Removed from v.2387  
changed lines
  Added in v.2681

  ViewVC Help
Powered by ViewVC