/[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 2978 by capela, Mon Aug 15 19:10:16 2016 UTC revision 3049 by capela, Sat Dec 3 09:47:38 2016 UTC
# Line 123  static void qsampler_sigusr1_handler ( i Line 123  static void qsampler_sigusr1_handler ( i
123    
124    
125  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
126  // qsampler -- namespace  // QSampler -- namespace
127    
128    
129  namespace QSampler {  namespace QSampler {
# Line 143  namespace QSampler { Line 143  namespace QSampler {
143    
144    
145  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
146  // LscpEvent -- specialty for LSCP callback comunication.  // QSampler::LscpEvent -- specialty for LSCP callback comunication.
   
147    
148  class LscpEvent : public QEvent  class LscpEvent : public QEvent
149  {  {
# Line 159  public: Line 158  public:
158          }          }
159    
160          // Accessors.          // Accessors.
161          lscp_event_t event() { return m_event; }          lscp_event_t  event() { return m_event; }
162          QString&     data()  { return m_data;  }          const QString& data() { return m_data;  }
163    
164  private:  private:
165    
# Line 172  private: Line 171  private:
171    
172    
173  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
174  // qsamplerMainForm -- Main window form implementation.  // QSampler::Workspace -- Main window workspace (MDI Area) decl.
175    
176    class Workspace : public QMdiArea
177    {
178    public:
179    
180            Workspace(MainForm *pMainForm) : QMdiArea(pMainForm) {}
181    
182    protected:
183    
184            void resizeEvent(QResizeEvent *)
185            {
186                    MainForm *pMainForm = static_cast<MainForm *> (parentWidget());
187                    if (pMainForm)
188                            pMainForm->channelsArrangeAuto();
189            }
190    };
191    
192    
193    //-------------------------------------------------------------------------
194    // QSampler::MainForm -- Main window form implementation.
195    
196  // Kind of singleton reference.  // Kind of singleton reference.
197  MainForm* MainForm::g_pMainForm = NULL;  MainForm *MainForm::g_pMainForm = NULL;
198    
199  MainForm::MainForm ( QWidget *pParent )  MainForm::MainForm ( QWidget *pParent )
200          : QMainWindow(pParent)          : QMainWindow(pParent)
# Line 270  MainForm::MainForm ( QWidget *pParent ) Line 289  MainForm::MainForm ( QWidget *pParent )
289  #endif  #endif
290    
291          // Make it an MDI workspace.          // Make it an MDI workspace.
292          m_pWorkspace = new QMdiArea(this);          m_pWorkspace = new Workspace(this);
293          m_pWorkspace->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);          m_pWorkspace->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
294          m_pWorkspace->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);          m_pWorkspace->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
295          // Set the activation connection.          // Set the activation connection.
# Line 695  void MainForm::customEvent ( QEvent* pEv Line 714  void MainForm::customEvent ( QEvent* pEv
714  }  }
715    
716    
 // Window resize event handler.  
 void MainForm::resizeEvent ( QResizeEvent * )  
 {  
         if (m_pOptions->bAutoArrange)  
                 channelsArrange();  
 }  
   
   
717  // LADISH Level 1 -- SIGUSR1 signal handler.  // LADISH Level 1 -- SIGUSR1 signal handler.
718  void MainForm::handle_sigusr1 (void)  void MainForm::handle_sigusr1 (void)
719  {  {
# Line 742  void MainForm::contextMenuEvent( QContex Line 753  void MainForm::contextMenuEvent( QContex
753    
754    
755  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
756  // qsamplerMainForm -- Brainless public property accessors.  // QSampler::MainForm -- Brainless public property accessors.
757    
758  // The global options settings property.  // The global options settings property.
759  Options *MainForm::options (void) const  Options *MainForm::options (void) const
# Line 766  MainForm *MainForm::getInstance (void) Line 777  MainForm *MainForm::getInstance (void)
777    
778    
779  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
780  // qsamplerMainForm -- Session file stuff.  // QSampler::MainForm -- Session file stuff.
781    
782  // Format the displayable session filename.  // Format the displayable session filename.
783  QString MainForm::sessionName ( const QString& sFilename )  QString MainForm::sessionName ( const QString& sFilename )
# Line 1035  bool MainForm::saveSessionFile ( const Q Line 1046  bool MainForm::saveSessionFile ( const Q
1046          int iErrors = 0;          int iErrors = 0;
1047          QTextStream ts(&file);          QTextStream ts(&file);
1048          ts << "# " << QSAMPLER_TITLE " - " << tr(QSAMPLER_SUBTITLE) << endl;          ts << "# " << QSAMPLER_TITLE " - " << tr(QSAMPLER_SUBTITLE) << endl;
1049          ts << "# " << tr("Version")          ts << "# " << tr("Version") << ": " CONFIG_BUILD_VERSION << endl;
1050          << ": " QSAMPLER_VERSION << endl;  //      ts << "# " << tr("Build") << ": " CONFIG_BUILD_DATE << endl;
         ts << "# " << tr("Build")  
         << ": " __DATE__ " " __TIME__ << endl;  
1051          ts << "#"  << endl;          ts << "#"  << endl;
1052          ts << "# " << tr("File")          ts << "# " << tr("File")
1053          << ": " << QFileInfo(sFilename).fileName() << endl;          << ": " << QFileInfo(sFilename).fileName() << endl;
# Line 1360  void MainForm::sessionDirty (void) Line 1369  void MainForm::sessionDirty (void)
1369    
1370    
1371  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
1372  // qsamplerMainForm -- File Action slots.  // QSampler::MainForm -- File Action slots.
1373    
1374  // Create a new sampler session.  // Create a new sampler session.
1375  void MainForm::fileNew (void)  void MainForm::fileNew (void)
# Line 1526  void MainForm::fileExit (void) Line 1535  void MainForm::fileExit (void)
1535    
1536    
1537  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
1538  // qsamplerMainForm -- Edit Action slots.  // QSampler::MainForm -- Edit Action slots.
1539    
1540  // Add a new sampler channel.  // Add a new sampler channel.
1541  void MainForm::editAddChannel (void)  void MainForm::editAddChannel (void)
# Line 1561  void MainForm::addChannelStrip (void) Line 1570  void MainForm::addChannelStrip (void)
1570          }          }
1571    
1572          // Do we auto-arrange?          // Do we auto-arrange?
1573          if (m_pOptions && m_pOptions->bAutoArrange)          channelsArrangeAuto();
                 channelsArrange();  
1574    
1575          // Make that an overall update.          // Make that an overall update.
1576          m_iDirtyCount++;          m_iDirtyCount++;
# Line 1703  void MainForm::editResetAllChannels (voi Line 1711  void MainForm::editResetAllChannels (voi
1711    
1712    
1713  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
1714  // qsamplerMainForm -- View Action slots.  // QSampler::MainForm -- View Action slots.
1715    
1716  // Show/hide the main program window menubar.  // Show/hide the main program window menubar.
1717  void MainForm::viewMenubar ( bool bOn )  void MainForm::viewMenubar ( bool bOn )
# Line 1884  void MainForm::viewOptions (void) Line 1892  void MainForm::viewOptions (void)
1892    
1893    
1894  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
1895  // qsamplerMainForm -- Channels action slots.  // QSampler::MainForm -- Channels action slots.
1896    
1897  // Arrange channel strips.  // Arrange channel strips.
1898  void MainForm::channelsArrange (void)  void MainForm::channelsArrange (void)
# Line 1926  void MainForm::channelsAutoArrange ( boo Line 1934  void MainForm::channelsAutoArrange ( boo
1934          m_pOptions->bAutoArrange = bOn;          m_pOptions->bAutoArrange = bOn;
1935    
1936          // If on, update whole workspace...          // If on, update whole workspace...
1937          if (m_pOptions->bAutoArrange)          channelsArrangeAuto();
1938    }
1939    
1940    
1941    void MainForm::channelsArrangeAuto (void)
1942    {
1943            if (m_pOptions && m_pOptions->bAutoArrange)
1944                  channelsArrange();                  channelsArrange();
1945  }  }
1946    
1947    
1948  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
1949  // qsamplerMainForm -- Help Action slots.  // QSampler::MainForm -- Help Action slots.
1950    
1951  // Show information about the Qt toolkit.  // Show information about the Qt toolkit.
1952  void MainForm::helpAboutQt (void)  void MainForm::helpAboutQt (void)
# Line 1944  void MainForm::helpAboutQt (void) Line 1958  void MainForm::helpAboutQt (void)
1958  // Show information about application program.  // Show information about application program.
1959  void MainForm::helpAbout (void)  void MainForm::helpAbout (void)
1960  {  {
1961          // 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";  
1962  #ifdef CONFIG_DEBUG  #ifdef CONFIG_DEBUG
1963          sText += "<small><font color=\"red\">";          list << tr("Debugging option enabled.");
         sText += tr("Debugging option enabled.");  
         sText += "</font></small><br />";  
1964  #endif  #endif
1965  #ifndef CONFIG_LIBGIG  #ifndef CONFIG_LIBGIG
1966          sText += "<small><font color=\"red\">";          list << tr("GIG (libgig) file support disabled.");
         sText += tr("GIG (libgig) file support disabled.");  
         sText += "</font></small><br />";  
1967  #endif  #endif
1968  #ifndef CONFIG_INSTRUMENT_NAME  #ifndef CONFIG_INSTRUMENT_NAME
1969          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 />";  
1970  #endif  #endif
1971  #ifndef CONFIG_MUTE_SOLO  #ifndef CONFIG_MUTE_SOLO
1972          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 />";  
1973  #endif  #endif
1974  #ifndef CONFIG_AUDIO_ROUTING  #ifndef CONFIG_AUDIO_ROUTING
1975          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 />";  
1976  #endif  #endif
1977  #ifndef CONFIG_FXSEND  #ifndef CONFIG_FXSEND
1978          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 />";  
1979  #endif  #endif
1980  #ifndef CONFIG_VOLUME  #ifndef CONFIG_VOLUME
1981          sText += "<small><font color=\"red\">";          list << tr("Global volume support disabled.");
         sText += tr("Global volume support disabled.");  
         sText += "</font></small><br />";  
1982  #endif  #endif
1983  #ifndef CONFIG_MIDI_INSTRUMENT  #ifndef CONFIG_MIDI_INSTRUMENT
1984          sText += "<small><font color=\"red\">";          list << tr("MIDI instrument mapping support disabled.");
         sText += tr("MIDI instrument mapping support disabled.");  
         sText += "</font></small><br />";  
1985  #endif  #endif
1986  #ifndef CONFIG_EDIT_INSTRUMENT  #ifndef CONFIG_EDIT_INSTRUMENT
1987          sText += "<small><font color=\"red\">";          list << tr("Instrument editing support disabled.");
         sText += tr("Instrument editing support disabled.");  
         sText += "</font></small><br />";  
1988  #endif  #endif
1989  #ifndef CONFIG_EVENT_CHANNEL_MIDI  #ifndef CONFIG_EVENT_CHANNEL_MIDI
1990          sText += "<small><font color=\"red\">";          list << tr("Channel MIDI event support disabled.");
         sText += tr("Channel MIDI event support disabled.");  
         sText += "</font></small><br />";  
1991  #endif  #endif
1992  #ifndef CONFIG_EVENT_DEVICE_MIDI  #ifndef CONFIG_EVENT_DEVICE_MIDI
1993          sText += "<small><font color=\"red\">";          list << tr("Device MIDI event support disabled.");
         sText += tr("Device MIDI event support disabled.");  
         sText += "</font></small><br />";  
1994  #endif  #endif
1995  #ifndef CONFIG_MAX_VOICES  #ifndef CONFIG_MAX_VOICES
1996          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 />";  
1997  #endif  #endif
1998    
1999            // Stuff the about box text...
2000            QString sText = "<p>\n";
2001            sText += "<b>" QSAMPLER_TITLE " - " + tr(QSAMPLER_SUBTITLE) + "</b><br />\n";
2002            sText += "<br />\n";
2003            sText += tr("Version") + ": <b>" CONFIG_BUILD_VERSION "</b><br />\n";
2004    //      sText += "<small>" + tr("Build") + ": " CONFIG_BUILD_DATE "</small><br />\n";
2005            if (!list.isEmpty()) {
2006                    sText += "<small><font color=\"red\">";
2007                    sText += list.join("<br />\n");
2008                    sText += "</font></small>";
2009            }
2010          sText += "<br />\n";          sText += "<br />\n";
2011          sText += tr("Using") + ": ";          sText += tr("Using") + ": ";
2012          sText += ::lscp_client_package();          sText += ::lscp_client_package();
# Line 2039  void MainForm::helpAbout (void) Line 2036  void MainForm::helpAbout (void)
2036    
2037    
2038  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
2039  // qsamplerMainForm -- Main window stabilization.  // QSampler::MainForm -- Main window stabilization.
2040    
2041  void MainForm::stabilizeForm (void)  void MainForm::stabilizeForm (void)
2042  {  {
# Line 2191  void MainForm::updateSession (void) Line 2188  void MainForm::updateSession (void)
2188          updateAllChannelStrips(false);          updateAllChannelStrips(false);
2189    
2190          // Do we auto-arrange?          // Do we auto-arrange?
2191          if (m_pOptions && m_pOptions->bAutoArrange)          channelsArrangeAuto();
                 channelsArrange();  
2192    
2193          // Remember to refresh devices and instruments...          // Remember to refresh devices and instruments...
2194          if (m_pInstrumentListForm)          if (m_pInstrumentListForm)
# Line 2225  void MainForm::updateAllChannelStrips ( Line 2221  void MainForm::updateAllChannelStrips (
2221                                  createChannelStrip(new Channel(piChannelIDs[iChannel]));                                  createChannelStrip(new Channel(piChannelIDs[iChannel]));
2222                  }                  }
2223                  // Do we auto-arrange?                  // Do we auto-arrange?
2224                  if (m_pOptions && m_pOptions->bAutoArrange)                  channelsArrangeAuto();
                         channelsArrange();  
2225                  // remove dead channel strips                  // remove dead channel strips
2226                  if (bRemoveDeadStrips) {                  if (bRemoveDeadStrips) {
2227                          const QList<QMdiSubWindow *>& wlist                          const QList<QMdiSubWindow *>& wlist
# Line 2418  void MainForm::updateMaxVolume (void) Line 2413  void MainForm::updateMaxVolume (void)
2413    
2414    
2415  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
2416  // qsamplerMainForm -- Messages window form handlers.  // QSampler::MainForm -- Messages window form handlers.
2417    
2418  // Messages output methods.  // Messages output methods.
2419  void MainForm::appendMessages( const QString& s )  void MainForm::appendMessages( const QString& s )
# Line 2530  void MainForm::updateMessagesCapture (vo Line 2525  void MainForm::updateMessagesCapture (vo
2525    
2526    
2527  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
2528  // qsamplerMainForm -- MDI channel strip management.  // QSampler::MainForm -- MDI channel strip management.
2529    
2530  // The channel strip creation executive.  // The channel strip creation executive.
2531  ChannelStrip *MainForm::createChannelStrip ( Channel *pChannel )  ChannelStrip *MainForm::createChannelStrip ( Channel *pChannel )
# Line 2590  void MainForm::destroyChannelStrip ( Cha Line 2585  void MainForm::destroyChannelStrip ( Cha
2585          delete pMdiSubWindow;          delete pMdiSubWindow;
2586    
2587          // Do we auto-arrange?          // Do we auto-arrange?
2588          if (m_pOptions && m_pOptions->bAutoArrange)          channelsArrangeAuto();
                 channelsArrange();  
2589  }  }
2590    
2591    
# Line 2700  void MainForm::channelsMenuActivated (vo Line 2694  void MainForm::channelsMenuActivated (vo
2694    
2695    
2696  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
2697  // qsamplerMainForm -- Timer stuff.  // QSampler::MainForm -- Timer stuff.
2698    
2699  // Set the pseudo-timer delay schedule.  // Set the pseudo-timer delay schedule.
2700  void MainForm::startSchedule ( int iStartDelay )  void MainForm::startSchedule ( int iStartDelay )
# Line 2773  void MainForm::timerSlot (void) Line 2767  void MainForm::timerSlot (void)
2767    
2768    
2769  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
2770  // qsamplerMainForm -- Server stuff.  // QSampler::MainForm -- Server stuff.
2771    
2772  // Start linuxsampler server...  // Start linuxsampler server...
2773  void MainForm::startServer (void)  void MainForm::startServer (void)
# Line 2937  void MainForm::processServerExit (void) Line 2931  void MainForm::processServerExit (void)
2931    
2932    
2933  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
2934  // qsamplerMainForm -- Client stuff.  // QSampler::MainForm -- Client stuff.
2935    
2936  // The LSCP client callback procedure.  // The LSCP client callback procedure.
2937  lscp_status_t qsampler_client_callback ( lscp_client_t */*pClient*/,  lscp_status_t qsampler_client_callback ( lscp_client_t */*pClient*/,

Legend:
Removed from v.2978  
changed lines
  Added in v.3049

  ViewVC Help
Powered by ViewVC