/[svn]/qsampler/trunk/src/qsamplerMainForm.ui.h
ViewVC logotype

Diff of /qsampler/trunk/src/qsamplerMainForm.ui.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 753 by capela, Wed Aug 24 17:44:59 2005 UTC revision 986 by capela, Mon Dec 18 16:51:50 2006 UTC
# Line 2  Line 2 
2  //  //
3  // ui.h extension file, included from the uic-generated form implementation.  // ui.h extension file, included from the uic-generated form implementation.
4  /****************************************************************************  /****************************************************************************
5     Copyright (C) 2004-2005, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2006, rncbc aka Rui Nuno Capela. All rights reserved.
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 14  Line 14 
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15     GNU General Public License for more details.     GNU General Public License for more details.
16    
17     You should have received a copy of the GNU General Public License     You should have received a copy of the GNU General Public License along
18     along with this program; if not, write to the Free Software     with this program; if not, write to the Free Software Foundation, Inc.,
19     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20    
21  *****************************************************************************/  *****************************************************************************/
22    
# Line 41  Line 41 
41  #include "qsamplerMessages.h"  #include "qsamplerMessages.h"
42    
43  #include "qsamplerChannelStrip.h"  #include "qsamplerChannelStrip.h"
44    #include "qsamplerInstrumentList.h"
45    
46    #include "qsamplerInstrumentListForm.h"
47  #include "qsamplerDeviceForm.h"  #include "qsamplerDeviceForm.h"
48  #include "qsamplerOptionsForm.h"  #include "qsamplerOptionsForm.h"
49    
# Line 102  private: Line 104  private:
104  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
105  // qsamplerMainForm -- Main window form implementation.  // qsamplerMainForm -- Main window form implementation.
106    
107    // Kind of singleton reference.
108    qsamplerMainForm *qsamplerMainForm::g_pMainForm = NULL;
109    
110    
111  // Kind of constructor.  // Kind of constructor.
112  void qsamplerMainForm::init (void)  void qsamplerMainForm::init (void)
113  {  {
114            // Pseudo-singleton reference setup.
115            g_pMainForm = this;
116    
117      // Initialize some pointer references.      // Initialize some pointer references.
118      m_pOptions = NULL;      m_pOptions = NULL;
119    
120      // All child forms are to be created later, not earlier than setup.      // All child forms are to be created later, not earlier than setup.
121      m_pMessages   = NULL;      m_pMessages = NULL;
122        m_pInstrumentListForm = NULL;
123      m_pDeviceForm = NULL;      m_pDeviceForm = NULL;
124    
125      // We'll start clean.      // We'll start clean.
# Line 186  void qsamplerMainForm::destroy (void) Line 196  void qsamplerMainForm::destroy (void)
196      // Finally drop any widgets around...      // Finally drop any widgets around...
197      if (m_pDeviceForm)      if (m_pDeviceForm)
198          delete m_pDeviceForm;          delete m_pDeviceForm;
199        if (m_pInstrumentListForm)
200            delete m_pInstrumentListForm;
201      if (m_pMessages)      if (m_pMessages)
202          delete m_pMessages;          delete m_pMessages;
203      if (m_pWorkspace)      if (m_pWorkspace)
# Line 204  void qsamplerMainForm::destroy (void) Line 216  void qsamplerMainForm::destroy (void)
216      // Delete recentfiles menu.      // Delete recentfiles menu.
217      if (m_pRecentFilesMenu)      if (m_pRecentFilesMenu)
218          delete m_pRecentFilesMenu;          delete m_pRecentFilesMenu;
219    
220            // Pseudo-singleton reference shut-down.
221            g_pMainForm = NULL;
222  }  }
223    
224    
# Line 214  void qsamplerMainForm::setup ( qsamplerO Line 229  void qsamplerMainForm::setup ( qsamplerO
229      m_pOptions = pOptions;      m_pOptions = pOptions;
230    
231      // What style do we create these forms?      // What style do we create these forms?
232      WFlags wflags = Qt::WType_TopLevel;          Qt::WFlags wflags = Qt::WStyle_Customize
233                    | Qt::WStyle_NormalBorder
234                    | Qt::WStyle_Title
235                    | Qt::WStyle_SysMenu
236                    | Qt::WStyle_MinMax
237                    | Qt::WType_TopLevel;
238      if (m_pOptions->bKeepOnTop)      if (m_pOptions->bKeepOnTop)
239          wflags |= Qt::WStyle_Tool;          wflags |= Qt::WStyle_Tool;
240      // Some child forms are to be created right now.      // Some child forms are to be created right now.
241      m_pMessages = new qsamplerMessages(this);      m_pMessages = new qsamplerMessages(this);
242      m_pDeviceForm = new qsamplerDeviceForm(this, 0, wflags);      m_pDeviceForm = new qsamplerDeviceForm(this, 0, wflags);
243      m_pDeviceForm->setMainForm(this); // An important life immutable!  #ifdef CONFIG_MIDI_INSTRUMENT
244        m_pInstrumentListForm = new qsamplerInstrumentListForm(this, 0, wflags);
245            QObject::connect(m_pInstrumentListForm->InstrumentList,
246                    SIGNAL(instrumentsChanged()),
247                    SLOT(sessionDirty()));
248    #else
249            viewInstrumentsAction->setEnabled(false);
250    #endif
251      // Set message defaults...      // Set message defaults...
252      updateMessagesFont();      updateMessagesFont();
253      updateMessagesLimit();      updateMessagesLimit();
254      updateMessagesCapture();      updateMessagesCapture();
255      // Set the visibility signal.      // Set the visibility signal.
256      QObject::connect(m_pMessages, SIGNAL(visibilityChanged(bool)), this, SLOT(stabilizeForm()));      QObject::connect(m_pMessages,
257                    SIGNAL(visibilityChanged(bool)),
258                    SLOT(stabilizeForm()));
259    
260      // Initial decorations toggle state.      // Initial decorations toggle state.
261      viewMenubarAction->setOn(m_pOptions->bMenubar);      viewMenubarAction->setOn(m_pOptions->bMenubar);
# Line 251  void qsamplerMainForm::setup ( qsamplerO Line 280  void qsamplerMainForm::setup ( qsamplerO
280      }      }
281      // Try to restore old window positioning and initial visibility.      // Try to restore old window positioning and initial visibility.
282      m_pOptions->loadWidgetGeometry(this);      m_pOptions->loadWidgetGeometry(this);
283        m_pOptions->loadWidgetGeometry(m_pInstrumentListForm);
284      m_pOptions->loadWidgetGeometry(m_pDeviceForm);      m_pOptions->loadWidgetGeometry(m_pDeviceForm);
285    
286      // Final startup stabilization...      // Final startup stabilization...
# Line 291  bool qsamplerMainForm::queryClose (void) Line 321  bool qsamplerMainForm::queryClose (void)
321              m_pOptions->settings().writeEntry("/Layout/DockWindows", sDockables);              m_pOptions->settings().writeEntry("/Layout/DockWindows", sDockables);
322              // And the children, and the main windows state,.              // And the children, and the main windows state,.
323                          m_pOptions->saveWidgetGeometry(m_pDeviceForm);                          m_pOptions->saveWidgetGeometry(m_pDeviceForm);
324                            m_pOptions->saveWidgetGeometry(m_pInstrumentListForm);
325                          m_pOptions->saveWidgetGeometry(this);                          m_pOptions->saveWidgetGeometry(this);
326                          // Close popup widgets.                          // Close popup widgets.
327                            if (m_pInstrumentListForm)
328                                    m_pInstrumentListForm->close();
329                          if (m_pDeviceForm)                          if (m_pDeviceForm)
330                                  m_pDeviceForm->close();                                  m_pDeviceForm->close();
331              // Stop client and/or server, gracefully.              // Stop client and/or server, gracefully.
# Line 351  void qsamplerMainForm::dropEvent ( QDrop Line 384  void qsamplerMainForm::dropEvent ( QDrop
384                  const QString& sPath = *iter;                  const QString& sPath = *iter;
385                  if (qsamplerChannel::isInstrumentFile(sPath)) {                  if (qsamplerChannel::isInstrumentFile(sPath)) {
386                          // Try to create a new channel from instrument file...                          // Try to create a new channel from instrument file...
387                          qsamplerChannel *pChannel = new qsamplerChannel(this);                          qsamplerChannel *pChannel = new qsamplerChannel();
388                          if (pChannel == NULL)                          if (pChannel == NULL)
389                                  return;                                  return;
390                          // Start setting the instrument filename...                          // Start setting the instrument filename...
# Line 417  qsamplerOptions *qsamplerMainForm::optio Line 450  qsamplerOptions *qsamplerMainForm::optio
450      return m_pOptions;      return m_pOptions;
451  }  }
452    
453    
454  // The LSCP client descriptor property.  // The LSCP client descriptor property.
455  lscp_client_t *qsamplerMainForm::client (void)  lscp_client_t *qsamplerMainForm::client (void)
456  {  {
# Line 424  lscp_client_t *qsamplerMainForm::client Line 458  lscp_client_t *qsamplerMainForm::client
458  }  }
459    
460    
461    // The pseudo-singleton instance accessor.
462    qsamplerMainForm *qsamplerMainForm::getInstance (void)
463    {
464            return g_pMainForm;
465    }
466    
467    
468  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
469  // qsamplerMainForm -- Session file stuff.  // qsamplerMainForm -- Session file stuff.
470    
# Line 471  bool qsamplerMainForm::openSession (void Line 512  bool qsamplerMainForm::openSession (void
512    
513      // Ask for the filename to open...      // Ask for the filename to open...
514      QString sFilename = QFileDialog::getOpenFileName(      QString sFilename = QFileDialog::getOpenFileName(
515              m_pOptions->sSessionDir,                // Start here.                  m_pOptions->sSessionDir,                // Start here.
516              tr("LSCP Session files") + " (*.lscp)", // Filter (LSCP files)                  tr("LSCP Session files") + " (*.lscp)", // Filter (LSCP files)
517              this, 0,                                // Parent and name (none)                  this, 0,                                // Parent and name (none)
518              tr("Open Session")                      // Caption.                  QSAMPLER_TITLE ": " + tr("Open Session")        // Caption.
519      );      );
520    
521      // Have we cancelled?      // Have we cancelled?
# Line 505  bool qsamplerMainForm::saveSession ( boo Line 546  bool qsamplerMainForm::saveSession ( boo
546              sFilename = m_pOptions->sSessionDir;              sFilename = m_pOptions->sSessionDir;
547          // Prompt the guy...          // Prompt the guy...
548          sFilename = QFileDialog::getSaveFileName(          sFilename = QFileDialog::getSaveFileName(
549                  sFilename,                              // Start here.                          sFilename,                              // Start here.
550                  tr("LSCP Session files") + " (*.lscp)", // Filter (LSCP files)                          tr("LSCP Session files") + " (*.lscp)", // Filter (LSCP files)
551                  this, 0,                                // Parent and name (none)                          this, 0,                                // Parent and name (none)
552                  tr("Save Session")                      // Caption.                          QSAMPLER_TITLE ": " + tr("Save Session")        // Caption.
553          );          );
554          // Have we cancelled it?          // Have we cancelled it?
555          if (sFilename.isEmpty())          if (sFilename.isEmpty())
# Line 518  bool qsamplerMainForm::saveSession ( boo Line 559  bool qsamplerMainForm::saveSession ( boo
559              sFilename += ".lscp";              sFilename += ".lscp";
560          // Check if already exists...          // Check if already exists...
561          if (sFilename != m_sFilename && QFileInfo(sFilename).exists()) {          if (sFilename != m_sFilename && QFileInfo(sFilename).exists()) {
562              if (QMessageBox::warning(this, tr("Warning"),              if (QMessageBox::warning(this,
563                                    QSAMPLER_TITLE ": " + tr("Warning"),
564                  tr("The file already exists:\n\n"                  tr("The file already exists:\n\n"
565                     "\"%1\"\n\n"                     "\"%1\"\n\n"
566                     "Do you want to replace it?")                     "Do you want to replace it?")
# Line 540  bool qsamplerMainForm::closeSession ( bo Line 582  bool qsamplerMainForm::closeSession ( bo
582    
583      // Are we dirty enough to prompt it?      // Are we dirty enough to prompt it?
584      if (m_iDirtyCount > 0) {      if (m_iDirtyCount > 0) {
585          switch (QMessageBox::warning(this, tr("Warning"),          switch (QMessageBox::warning(this,
586                            QSAMPLER_TITLE ": " + tr("Warning"),
587              tr("The current session has been changed:\n\n"              tr("The current session has been changed:\n\n"
588              "\"%1\"\n\n"              "\"%1\"\n\n"
589              "Do you want to save the changes?")              "Do you want to save the changes?")
# Line 598  bool qsamplerMainForm::loadSessionFile ( Line 641  bool qsamplerMainForm::loadSessionFile (
641      QTextStream ts(&file);      QTextStream ts(&file);
642      while (!ts.atEnd()) {      while (!ts.atEnd()) {
643          // Read the line.          // Read the line.
644          QString sCommand = ts.readLine().simplifyWhiteSpace();          QString sCommand = ts.readLine().stripWhiteSpace();
645          // If not empty, nor a comment, call the server...          // If not empty, nor a comment, call the server...
646          if (!sCommand.isEmpty() && sCommand[0] != '#') {          if (!sCommand.isEmpty() && sCommand[0] != '#') {
647              appendMessagesColor(sCommand, "#996633");              appendMessagesColor(sCommand, "#996633");
# Line 643  bool qsamplerMainForm::loadSessionFile ( Line 686  bool qsamplerMainForm::loadSessionFile (
686  // Save current session to specific file path.  // Save current session to specific file path.
687  bool qsamplerMainForm::saveSessionFile ( const QString& sFilename )  bool qsamplerMainForm::saveSessionFile ( const QString& sFilename )
688  {  {
689            if (m_pClient == NULL)
690                    return false;
691    
692            // Check whether server is apparently OK...
693            if (::lscp_get_channels(m_pClient) < 0) {
694                    appendMessagesClient("lscp_get_channels");
695                    return false;
696            }
697    
698      // Open and write into real file.      // Open and write into real file.
699      QFile file(sFilename);      QFile file(sFilename);
700      if (!file.open(IO_WriteOnly | IO_Truncate)) {      if (!file.open(IO_WriteOnly | IO_Truncate)) {
# Line 666  bool qsamplerMainForm::saveSessionFile ( Line 718  bool qsamplerMainForm::saveSessionFile (
718         << " "  << QTime::currentTime().toString("hh:mm:ss") << endl;         << " "  << QTime::currentTime().toString("hh:mm:ss") << endl;
719      ts << "#"  << endl;      ts << "#"  << endl;
720      ts << endl;      ts << endl;
721    
722          // It is assumed that this new kind of device+session file          // It is assumed that this new kind of device+session file
723          // will be loaded from a complete          // will be loaded from a complete initialized server...
724          int *piDeviceIDs;          int *piDeviceIDs;
725          int  iDevice;          int  iDevice;
726          ts << "RESET" << endl;          ts << "RESET" << endl;
727    
728          // Audio device mapping.          // Audio device mapping.
729          QMap<int, int> audioDeviceMap;          QMap<int, int> audioDeviceMap;
730          piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Audio);          piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Audio);
731          for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {          for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {
732                  ts << endl;                  ts << endl;
733                  qsamplerDevice device(this, qsamplerDevice::Audio, piDeviceIDs[iDevice]);                  qsamplerDevice device(qsamplerDevice::Audio, piDeviceIDs[iDevice]);
734                  // Audio device specification...                  // Audio device specification...
735                  ts << "# " << device.deviceTypeName() << " " << device.driverName()                  ts << "# " << device.deviceTypeName() << " " << device.driverName()
736                          << " " << tr("Device") << " " << iDevice << endl;                          << " " << tr("Device") << " " << iDevice << endl;
# Line 708  bool qsamplerMainForm::saveSessionFile ( Line 762  bool qsamplerMainForm::saveSessionFile (
762                  }                  }
763                  // Audio device index/id mapping.                  // Audio device index/id mapping.
764                  audioDeviceMap[device.deviceID()] = iDevice;                  audioDeviceMap[device.deviceID()] = iDevice;
765          // Try to keep it snappy :)                  // Try to keep it snappy :)
766          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);                  QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
767          }          }
768    
769          // MIDI device mapping.          // MIDI device mapping.
770          QMap<int, int> midiDeviceMap;          QMap<int, int> midiDeviceMap;
771          piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Midi);          piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Midi);
772          for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {          for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {
773                  ts << endl;                  ts << endl;
774                  qsamplerDevice device(this, qsamplerDevice::Midi, piDeviceIDs[iDevice]);                  qsamplerDevice device(qsamplerDevice::Midi, piDeviceIDs[iDevice]);
775                  // MIDI device specification...                  // MIDI device specification...
776                  ts << "# " << device.deviceTypeName() << " " << device.driverName()                  ts << "# " << device.deviceTypeName() << " " << device.driverName()
777                          << " " << tr("Device") << " " << iDevice << endl;                          << " " << tr("Device") << " " << iDevice << endl;
# Line 748  bool qsamplerMainForm::saveSessionFile ( Line 803  bool qsamplerMainForm::saveSessionFile (
803                  }                  }
804                  // MIDI device index/id mapping.                  // MIDI device index/id mapping.
805                  midiDeviceMap[device.deviceID()] = iDevice;                  midiDeviceMap[device.deviceID()] = iDevice;
806          // Try to keep it snappy :)                  // Try to keep it snappy :)
807          QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);                  QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
808          }          }
809          ts << endl;          ts << endl;
810    
811    #ifdef CONFIG_MIDI_INSTRUMENT
812            // MIDI instrument mapping...
813            QMap<int, int> midiInstrumentMap;
814            int *piMaps = ::lscp_list_midi_instrument_maps(m_pClient);
815            for (int iMap = 0; piMaps && piMaps[iMap] >= 0; iMap++) {
816                    int iMidiMap = piMaps[iMap];
817                    const char *pszMapName
818                            = ::lscp_get_midi_instrument_map_name(m_pClient, iMidiMap);
819                    ts << "# " << tr("MIDI instrument map") << " " << iMap;
820                    if (pszMapName)
821                            ts << " - " << pszMapName;
822                    ts << endl;
823                    ts << "ADD MIDI_INSTRUMENT_MAP";
824                    if (pszMapName)
825                            ts << " '" << pszMapName << "'";
826                    ts << endl;
827                    // MIDI instrument mapping...
828                    lscp_midi_instrument_t *pInstrs
829                            = ::lscp_list_midi_instruments(m_pClient, iMidiMap);
830                    for (int iInstr = 0; pInstrs && pInstrs[iInstr].map >= 0; iInstr++) {
831                            lscp_midi_instrument_info_t *pInstrInfo
832                                    = ::lscp_get_midi_instrument_info(m_pClient, &pInstrs[iInstr]);
833                            if (pInstrInfo) {
834                                    ts << "MAP MIDI_INSTRUMENT "
835                                            << iMap                        << " "
836                                            << pInstrs[iInstr].bank        << " "
837                                            << pInstrs[iInstr].prog        << " "
838                                            << pInstrInfo->engine_name     << " '"
839                                            << pInstrInfo->instrument_file << "' "
840                                            << pInstrInfo->instrument_nr   << " "
841                                            << pInstrInfo->volume          << " ";
842                                    switch (pInstrInfo->load_mode) {
843                                            case LSCP_LOAD_PERSISTENT:
844                                                    ts << "PERSISTENT";
845                                                    break;
846                                            case LSCP_LOAD_ON_DEMAND_HOLD:
847                                                    ts << "ON_DEMAND_HOLD";
848                                                    break;
849                                            case LSCP_LOAD_ON_DEMAND:
850                                            case LSCP_LOAD_DEFAULT:
851                                            default:
852                                                    ts << "ON_DEMAND";
853                                                    break;
854                                    }
855                                    if (pInstrInfo->name)
856                                            ts << " '" << pInstrInfo->name << "'";
857                                    ts << endl;
858                            }
859                            // MIDI device index/id mapping.
860                            midiInstrumentMap[iMidiMap] = iMap;
861                            // Try to keep it snappy :)
862                            QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
863                    }
864                    if (pInstrs)
865                            ts << endl;
866            }
867    #endif //  CONFIG_MIDI_INSTRUMENT
868    
869          // Sampler channel mapping.          // Sampler channel mapping.
870      QWidgetList wlist = m_pWorkspace->windowList();      QWidgetList wlist = m_pWorkspace->windowList();
871      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
# Line 784  bool qsamplerMainForm::saveSessionFile ( Line 898  bool qsamplerMainForm::saveSessionFile (
898                      ts << pChannel->midiChannel();                      ts << pChannel->midiChannel();
899                  ts << endl;                  ts << endl;
900                  ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannel << endl;                  ts << "LOAD ENGINE " << pChannel->engineName() << " " << iChannel << endl;
901                  ts << "LOAD INSTRUMENT NON_MODAL '" << pChannel->instrumentFile() << "' " << pChannel->instrumentNr() << " " << iChannel << endl;                                  if (pChannel->instrumentStatus() < 100) ts << "# ";
902                  ts << "SET CHANNEL VOLUME " << iChannel << " " << pChannel->volume() << endl;                                  ts << "LOAD INSTRUMENT NON_MODAL '" << pChannel->instrumentFile() << "' "
903                  if (pChannel->channelMute())                                          << pChannel->instrumentNr() << " " << iChannel << endl;
904                          ts << "SET CHANNEL MUTE " << iChannel << " 1" << endl;                                  qsamplerChannelRoutingMap::ConstIterator audioRoute;
905                  if (pChannel->channelSolo())                                  for (audioRoute = pChannel->audioRouting().begin();
906                          ts << "SET CHANNEL SOLO " << iChannel << " 1" << endl;                                                  audioRoute != pChannel->audioRouting().end();
907                                                            ++audioRoute) {
908                                            ts << "SET CHANNEL AUDIO_OUTPUT_CHANNEL " << iChannel
909                                                    << " " << audioRoute.key()
910                                                    << " " << audioRoute.data() << endl;
911                                    }
912                                    ts << "SET CHANNEL VOLUME " << iChannel
913                                            << " " << pChannel->volume() << endl;
914                                    if (pChannel->channelMute())
915                                            ts << "SET CHANNEL MUTE " << iChannel << " 1" << endl;
916                                    if (pChannel->channelSolo())
917                                            ts << "SET CHANNEL SOLO " << iChannel << " 1" << endl;
918    #ifdef CONFIG_MIDI_INSTRUMENT
919                                    if (pChannel->midiMap() >= 0) {
920                                            ts << "SET CHANNEL MIDI_INSTRUMENT_MAP " << iChannel
921                                                    << " " << midiInstrumentMap[pChannel->midiMap()] << endl;
922                                    }
923    #endif
924                  ts << endl;                  ts << endl;
925              }              }
926          }          }
# Line 881  void qsamplerMainForm::fileReset (void) Line 1012  void qsamplerMainForm::fileReset (void)
1012          return;          return;
1013    
1014      // Ask user whether he/she want's an internal sampler reset...      // Ask user whether he/she want's an internal sampler reset...
1015      if (QMessageBox::warning(this, tr("Warning"),      if (QMessageBox::warning(this,
1016                    QSAMPLER_TITLE ": " + tr("Warning"),
1017          tr("Resetting the sampler instance will close\n"          tr("Resetting the sampler instance will close\n"
1018             "all device and channel configurations.\n\n"             "all device and channel configurations.\n\n"
1019             "Please note that this operation may cause\n"             "Please note that this operation may cause\n"
# Line 916  void qsamplerMainForm::fileRestart (void Line 1048  void qsamplerMainForm::fileRestart (void
1048      // Ask user whether he/she want's a complete restart...      // Ask user whether he/she want's a complete restart...
1049      // (if we're currently up and running)      // (if we're currently up and running)
1050      if (bRestart && m_pClient) {      if (bRestart && m_pClient) {
1051          bRestart = (QMessageBox::warning(this, tr("Warning"),          bRestart = (QMessageBox::warning(this,
1052                            QSAMPLER_TITLE ": " + tr("Warning"),
1053              tr("New settings will be effective after\n"              tr("New settings will be effective after\n"
1054                 "restarting the client/server connection.\n\n"                 "restarting the client/server connection.\n\n"
1055                 "Please note that this operation may cause\n"                 "Please note that this operation may cause\n"
# Line 953  void qsamplerMainForm::editAddChannel (v Line 1086  void qsamplerMainForm::editAddChannel (v
1086          return;          return;
1087    
1088      // Just create the channel instance...      // Just create the channel instance...
1089      qsamplerChannel *pChannel = new qsamplerChannel(this);      qsamplerChannel *pChannel = new qsamplerChannel();
1090      if (pChannel == NULL)      if (pChannel == NULL)
1091          return;          return;
1092    
# Line 992  void qsamplerMainForm::editRemoveChannel Line 1125  void qsamplerMainForm::editRemoveChannel
1125    
1126      // Prompt user if he/she's sure about this...      // Prompt user if he/she's sure about this...
1127      if (m_pOptions && m_pOptions->bConfirmRemove) {      if (m_pOptions && m_pOptions->bConfirmRemove) {
1128          if (QMessageBox::warning(this, tr("Warning"),          if (QMessageBox::warning(this,
1129                            QSAMPLER_TITLE ": " + tr("Warning"),
1130              tr("About to remove channel:\n\n"              tr("About to remove channel:\n\n"
1131                 "%1\n\n"                 "%1\n\n"
1132                 "Are you sure?")                 "Are you sure?")
# Line 1115  void qsamplerMainForm::viewMessages ( bo Line 1249  void qsamplerMainForm::viewMessages ( bo
1249  }  }
1250    
1251    
1252    // Show/hide the MIDI instrument list-view form.
1253    void qsamplerMainForm::viewInstruments (void)
1254    {
1255            if (m_pOptions == NULL)
1256                    return;
1257    
1258            if (m_pInstrumentListForm) {
1259                    m_pOptions->saveWidgetGeometry(m_pInstrumentListForm);
1260                    if (m_pInstrumentListForm->isVisible()) {
1261                            m_pInstrumentListForm->hide();
1262                    } else {
1263                            m_pInstrumentListForm->show();
1264                            m_pInstrumentListForm->raise();
1265                            m_pInstrumentListForm->setActiveWindow();
1266                    }
1267            }
1268    }
1269    
1270    
1271  // Show/hide the device configurator form.  // Show/hide the device configurator form.
1272  void qsamplerMainForm::viewDevices (void)  void qsamplerMainForm::viewDevices (void)
1273  {  {
# Line 1123  void qsamplerMainForm::viewDevices (void Line 1276  void qsamplerMainForm::viewDevices (void
1276    
1277          if (m_pDeviceForm) {          if (m_pDeviceForm) {
1278                  m_pOptions->saveWidgetGeometry(m_pDeviceForm);                  m_pOptions->saveWidgetGeometry(m_pDeviceForm);
                 m_pDeviceForm->setClient(m_pClient);  
1279                  if (m_pDeviceForm->isVisible()) {                  if (m_pDeviceForm->isVisible()) {
1280                          m_pDeviceForm->hide();                          m_pDeviceForm->hide();
1281                  } else {                  } else {
# Line 1175  void qsamplerMainForm::viewOptions (void Line 1327  void qsamplerMainForm::viewOptions (void
1327                  (!bOldStdoutCapture &&  m_pOptions->bStdoutCapture) ||                  (!bOldStdoutCapture &&  m_pOptions->bStdoutCapture) ||
1328                  ( bOldKeepOnTop     && !m_pOptions->bKeepOnTop)     ||                  ( bOldKeepOnTop     && !m_pOptions->bKeepOnTop)     ||
1329                  (!bOldKeepOnTop     &&  m_pOptions->bKeepOnTop)) {                  (!bOldKeepOnTop     &&  m_pOptions->bKeepOnTop)) {
1330                  QMessageBox::information(this, tr("Information"),                  QMessageBox::information(this,
1331                                            QSAMPLER_TITLE ": " + tr("Information"),
1332                      tr("Some settings may be only effective\n"                      tr("Some settings may be only effective\n"
1333                         "next time you start this program."), tr("OK"));                         "next time you start this program."), tr("OK"));
1334                  updateMessagesCapture();                  updateMessagesCapture();
# Line 1308  void qsamplerMainForm::helpAbout (void) Line 1461  void qsamplerMainForm::helpAbout (void)
1461      sText += tr("Sampler channel Mute/Solo support disabled.");      sText += tr("Sampler channel Mute/Solo support disabled.");
1462      sText += "</font></small><br />";      sText += "</font></small><br />";
1463  #endif  #endif
1464    #ifndef CONFIG_MIDI_INSTRUMENT
1465        sText += "<small><font color=\"red\">";
1466        sText += tr("MIDI instrument mapping support disabled.");
1467        sText += "</font></small><br />";
1468    #endif
1469      sText += "<br />\n";      sText += "<br />\n";
1470      sText += tr("Using") + ": ";      sText += tr("Using") + ": ";
1471      sText += ::lscp_client_package();      sText += ::lscp_client_package();
# Line 1343  void qsamplerMainForm::stabilizeForm (vo Line 1501  void qsamplerMainForm::stabilizeForm (vo
1501      // Update the main application caption...      // Update the main application caption...
1502      QString sSessionName = sessionName(m_sFilename);      QString sSessionName = sessionName(m_sFilename);
1503      if (m_iDirtyCount > 0)      if (m_iDirtyCount > 0)
1504          sSessionName += '*';          sSessionName += " *";
1505      setCaption(tr(QSAMPLER_TITLE " - [%1]").arg(sSessionName));      setCaption(tr(QSAMPLER_TITLE " - [%1]").arg(sSessionName));
1506    
1507      // Update the main menu state...      // Update the main menu state...
# Line 1362  void qsamplerMainForm::stabilizeForm (vo Line 1520  void qsamplerMainForm::stabilizeForm (vo
1520      editResetChannelAction->setEnabled(bHasChannel);      editResetChannelAction->setEnabled(bHasChannel);
1521      editResetAllChannelsAction->setEnabled(bHasChannel);      editResetAllChannelsAction->setEnabled(bHasChannel);
1522      viewMessagesAction->setOn(m_pMessages && m_pMessages->isVisible());      viewMessagesAction->setOn(m_pMessages && m_pMessages->isVisible());
1523      viewDevicesAction->setOn(m_pDeviceForm && m_pDeviceForm->isVisible());  #ifdef CONFIG_MIDI_INSTRUMENT
1524            viewInstrumentsAction->setOn(m_pInstrumentListForm
1525                    && m_pInstrumentListForm->isVisible());
1526            viewInstrumentsAction->setEnabled(bHasClient);
1527    #endif
1528            viewDevicesAction->setOn(m_pDeviceForm
1529                    && m_pDeviceForm->isVisible());
1530      viewDevicesAction->setEnabled(bHasClient);      viewDevicesAction->setEnabled(bHasClient);
1531      channelsArrangeAction->setEnabled(bHasChannel);      channelsArrangeAction->setEnabled(bHasChannel);
1532    
# Line 1413  void qsamplerMainForm::channelStripChang Line 1577  void qsamplerMainForm::channelStripChang
1577  // Grab and restore current sampler channels session.  // Grab and restore current sampler channels session.
1578  void qsamplerMainForm::updateSession (void)  void qsamplerMainForm::updateSession (void)
1579  {  {
1580    #ifdef CONFIG_MIDI_INSTRUMENT
1581            // FIXME Make some room for default instrument maps...
1582            int iMaps = ::lscp_get_midi_instrument_maps(m_pClient);
1583            if (iMaps < 0)
1584                    appendMessagesClient("lscp_get_midi_instrument_maps");
1585            else if (iMaps < 1) {
1586                    ::lscp_add_midi_instrument_map(m_pClient, tr("Chromatic").latin1());
1587                    ::lscp_add_midi_instrument_map(m_pClient, tr("Drum Kits").latin1());
1588            }
1589    #endif
1590    
1591          // Retrieve the current channel list.          // Retrieve the current channel list.
1592          int *piChannelIDs = ::lscp_list_channels(m_pClient);          int *piChannelIDs = ::lscp_list_channels(m_pClient);
1593          if (piChannelIDs == NULL) {          if (piChannelIDs == NULL) {
# Line 1428  void qsamplerMainForm::updateSession (vo Line 1603  void qsamplerMainForm::updateSession (vo
1603          for (int iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) {          for (int iChannel = 0; piChannelIDs[iChannel] >= 0; iChannel++) {
1604                  // Check if theres already a channel strip for this one...                  // Check if theres already a channel strip for this one...
1605                  if (!channelStrip(piChannelIDs[iChannel]))                  if (!channelStrip(piChannelIDs[iChannel]))
1606                          createChannelStrip(new qsamplerChannel(this, piChannelIDs[iChannel]));                          createChannelStrip(new qsamplerChannel(piChannelIDs[iChannel]));
1607                  // Make it visibly responsive...                  // Make it visibly responsive...
1608                  QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);                  QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
1609          }          }
1610          m_pWorkspace->setUpdatesEnabled(true);          m_pWorkspace->setUpdatesEnabled(true);
1611            
1612          // Remember to refresh devices          // Remember to refresh devices and instruments...
1613            if (m_pInstrumentListForm)
1614                m_pInstrumentListForm->refreshInstruments();
1615          if (m_pDeviceForm)          if (m_pDeviceForm)
1616              m_pDeviceForm->refreshDevices();              m_pDeviceForm->refreshDevices();
1617  }  }
# Line 1607  void qsamplerMainForm::appendMessagesErr Line 1784  void qsamplerMainForm::appendMessagesErr
1784    
1785      appendMessagesColor(s.simplifyWhiteSpace(), "#ff0000");      appendMessagesColor(s.simplifyWhiteSpace(), "#ff0000");
1786    
1787      QMessageBox::critical(this, tr("Error"), s, tr("Cancel"));      QMessageBox::critical(this,
1788                    QSAMPLER_TITLE ": " + tr("Error"), s, tr("Cancel"));
1789  }  }
1790    
1791    
# Line 1879  void qsamplerMainForm::startServer (void Line 2057  void qsamplerMainForm::startServer (void
2057    
2058      // Is the server process instance still here?      // Is the server process instance still here?
2059      if (m_pServer) {      if (m_pServer) {
2060          switch (QMessageBox::warning(this, tr("Warning"),          switch (QMessageBox::warning(this,
2061                            QSAMPLER_TITLE ": " + tr("Warning"),
2062              tr("Could not start the LinuxSampler server.\n\n"              tr("Could not start the LinuxSampler server.\n\n"
2063                 "Maybe it ss already started."),                 "Maybe it ss already started."),
2064              tr("Stop"), tr("Kill"), tr("Cancel"))) {              tr("Stop"), tr("Kill"), tr("Cancel"))) {
# Line 2051  bool qsamplerMainForm::startClient (void Line 2230  bool qsamplerMainForm::startClient (void
2230      // Log success here.      // Log success here.
2231      appendMessages(tr("Client connected."));      appendMessages(tr("Client connected."));
2232    
2233          // Hard-notify device configuration form,          // Hard-notify instrumnet and device configuration forms,
2234          // if visible, that we're ready...          // if visible, that we're ready...
2235          if (m_pDeviceForm && m_pDeviceForm->isVisible())          if (m_pInstrumentListForm)
2236              m_pDeviceForm->setClient(m_pClient);              m_pInstrumentListForm->refreshInstruments();
2237            if (m_pDeviceForm)
2238                m_pDeviceForm->refreshDevices();
2239    
2240      // Is any session pending to be loaded?      // Is any session pending to be loaded?
2241      if (!m_pOptions->sSessionFile.isEmpty()) {      if (!m_pOptions->sSessionFile.isEmpty()) {
# Line 2076  void qsamplerMainForm::stopClient (void) Line 2257  void qsamplerMainForm::stopClient (void)
2257      if (m_pClient == NULL)      if (m_pClient == NULL)
2258          return;          return;
2259    
         // Hard-notify device configuration form,  
         // if visible, that we're running out...  
         if (m_pDeviceForm && m_pDeviceForm->isVisible())  
             m_pDeviceForm->setClient(NULL);  
   
2260      // Log prepare here.      // Log prepare here.
2261      appendMessages(tr("Client disconnecting..."));      appendMessages(tr("Client disconnecting..."));
2262    
# Line 2101  void qsamplerMainForm::stopClient (void) Line 2277  void qsamplerMainForm::stopClient (void)
2277      ::lscp_client_destroy(m_pClient);      ::lscp_client_destroy(m_pClient);
2278      m_pClient = NULL;      m_pClient = NULL;
2279    
2280            // Hard-notify instrumnet and device configuration forms,
2281            // if visible, that we're running out...
2282            if (m_pInstrumentListForm)
2283                m_pInstrumentListForm->refreshInstruments();
2284            if (m_pDeviceForm)
2285                m_pDeviceForm->refreshDevices();
2286    
2287      // Log final here.      // Log final here.
2288      appendMessages(tr("Client disconnected."));      appendMessages(tr("Client disconnected."));
2289    

Legend:
Removed from v.753  
changed lines
  Added in v.986

  ViewVC Help
Powered by ViewVC