/[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 428 by capela, Mon Mar 7 17:05:55 2005 UTC revision 455 by capela, Mon Mar 14 12:59:27 2005 UTC
# Line 211  void qsamplerMainForm::setup ( qsamplerO Line 211  void qsamplerMainForm::setup ( qsamplerO
211      // We got options?      // We got options?
212      m_pOptions = pOptions;      m_pOptions = pOptions;
213    
214        // What style do we create these forms?
215        WFlags wflags = Qt::WType_TopLevel;
216        if (m_pOptions->bKeepOnTop)
217            wflags |= Qt::WStyle_Tool;
218      // Some child forms are to be created right now.      // Some child forms are to be created right now.
219      m_pMessages = new qsamplerMessages(this);      m_pMessages = new qsamplerMessages(this);
220      m_pDeviceForm = new qsamplerDeviceForm(this);      m_pDeviceForm = new qsamplerDeviceForm(this, 0, wflags);
221      // Set message defaults...      // Set message defaults...
222      updateMessagesFont();      updateMessagesFont();
223      updateMessagesLimit();      updateMessagesLimit();
# Line 271  bool qsamplerMainForm::queryClose (void) Line 275  bool qsamplerMainForm::queryClose (void)
275          // Some windows default fonts is here on demand too.          // Some windows default fonts is here on demand too.
276          if (bQueryClose && m_pMessages)          if (bQueryClose && m_pMessages)
277              m_pOptions->sMessagesFont = m_pMessages->messagesFont().toString();              m_pOptions->sMessagesFont = m_pMessages->messagesFont().toString();
                 // Other windows just need asking if it can close gracefully...  
         if (bQueryClose && m_pDeviceForm)  
                 bQueryClose = m_pDeviceForm->queryClose();  
278          // Try to save current positioning.          // Try to save current positioning.
279          if (bQueryClose) {          if (bQueryClose) {
280              // Save decorations state.              // Save decorations state.
# Line 641  bool qsamplerMainForm::saveSessionFile ( Line 642  bool qsamplerMainForm::saveSessionFile (
642      }      }
643    
644      // Write the file.      // Write the file.
645      int iErrors = 0;      int  iErrors = 0;
646      QTextStream ts(&file);      QTextStream ts(&file);
647      ts << "# " << QSAMPLER_TITLE " - " << tr(QSAMPLER_SUBTITLE) << endl;      ts << "# " << QSAMPLER_TITLE " - " << tr(QSAMPLER_SUBTITLE) << endl;
648      ts << "# " << tr("Version")      ts << "# " << tr("Version")
# Line 652  bool qsamplerMainForm::saveSessionFile ( Line 653  bool qsamplerMainForm::saveSessionFile (
653      ts << "# " << tr("File")      ts << "# " << tr("File")
654         << ": " << QFileInfo(sFilename).fileName() << endl;         << ": " << QFileInfo(sFilename).fileName() << endl;
655      ts << "# " << tr("Date")      ts << "# " << tr("Date")
656         << ": " << QDate::currentDate().toString("MMMM dd yyyy")         << ": " << QDate::currentDate().toString("MMM dd yyyy")
657         << " "  << QTime::currentTime().toString("hh:mm:ss") << endl;         << " "  << QTime::currentTime().toString("hh:mm:ss") << endl;
658      ts << "#"  << endl;      ts << "#"  << endl;
659      ts << endl;      ts << endl;
660            // It is assumed that this new kind of device+session file
661            // will be loaded from a complete
662            int *piDeviceIDs;
663            int  iDevice;
664            ts << "RESET" << endl;
665            // Audio device mapping.
666            QMap<int, int> audioDeviceMap;
667            piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Audio);
668            for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {
669                    qsamplerDevice device(m_pClient, qsamplerDevice::Audio, piDeviceIDs[iDevice]);
670                    ts << endl;
671            ts << "# " << device.deviceTypeName() << " " << device.driverName()
672                       << " " << tr("Device") << " " << iDevice << endl;
673                    ts << "CREATE AUDIO_OUTPUT_DEVICE " << device.driverName();
674                    qsamplerDeviceParamMap& params = device.params();
675                    qsamplerDeviceParamMap::ConstIterator iter;
676                    for (iter = params.begin(); iter != params.end(); ++iter)
677                            ts << " " << iter.key() << "='" << iter.data().value << "'";
678                    ts << endl;
679                    audioDeviceMap[device.deviceID()] = iDevice;
680            // Try to keep it snappy :)
681            QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
682            }
683            // MIDI device mapping.
684            QMap<int, int> midiDeviceMap;
685            piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Midi);
686            for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) {
687                    qsamplerDevice device(m_pClient, qsamplerDevice::Midi, piDeviceIDs[iDevice]);
688            ts << "# " << device.deviceTypeName() << " " << device.driverName()
689                       << " " << tr("Device") << " " << iDevice << endl;
690                    ts << "CREATE MIDI_INPUT_DEVICE " << device.driverName();
691                    qsamplerDeviceParamMap& params = device.params();
692                    qsamplerDeviceParamMap::ConstIterator iter;
693                    for (iter = params.begin(); iter != params.end(); ++iter)
694                            ts << " " << iter.key() << "='" << iter.data().value << "'";
695                    ts << endl;
696                    midiDeviceMap[device.deviceID()] = iDevice;
697            // Try to keep it snappy :)
698            QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput);
699            }
700            ts << endl;
701            // Sampler channel mapping.
702      QWidgetList wlist = m_pWorkspace->windowList();      QWidgetList wlist = m_pWorkspace->windowList();
703      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {      for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
704          qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);          qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
705          if (pChannelStrip) {          if (pChannelStrip) {
706              qsamplerChannel *pChannel = pChannelStrip->channel();              qsamplerChannel *pChannel = pChannelStrip->channel();
707              if (pChannel) {              if (pChannel) {
708                  ts << "# Channel " << iChannel << endl;                  ts << "# " << tr("Channel") << " " << iChannel << endl;
709                  ts << "ADD CHANNEL" << endl;                  ts << "ADD CHANNEL" << endl;
710                  ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannel << " " << pChannel->audioDriver() << endl;                  if (audioDeviceMap.isEmpty()) {
711                  ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannel << " " << pChannel->midiDriver() << endl;                          ts << "SET CHANNEL AUDIO_OUTPUT_TYPE " << iChannel
712              //  ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannel << " " << pChannel->midiPort() << endl;                                              << " " << pChannel->audioDriver() << endl;
713                                } else {
714                            ts << "SET CHANNEL AUDIO_OUTPUT_DEVICE " << iChannel
715                                               << " " << audioDeviceMap[pChannel->audioDevice()] << endl;
716                                    }
717                    if (midiDeviceMap.isEmpty()) {
718                            ts << "SET CHANNEL MIDI_INPUT_TYPE " << iChannel
719                                           << " " << pChannel->midiDriver() << endl;
720                                } else {
721                            ts << "SET CHANNEL MIDI_INPUT_DEVICE " << iChannel
722                                               << " " << midiDeviceMap[pChannel->midiDevice()] << endl;
723                                }
724                    ts << "SET CHANNEL MIDI_INPUT_PORT " << iChannel
725                                   << " " << pChannel->midiPort() << endl;
726                  ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannel << " ";                  ts << "SET CHANNEL MIDI_INPUT_CHANNEL " << iChannel << " ";
727                  if (pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL)                  if (pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL)
728                      ts << "ALL";                      ts << "ALL";
# Line 704  bool qsamplerMainForm::saveSessionFile ( Line 760  bool qsamplerMainForm::saveSessionFile (
760  }  }
761    
762    
763    // Session change receiver slot.
764    void qsamplerMainForm::sessionDirty (void)
765    {
766        // Just mark the dirty form.
767        m_iDirtyCount++;
768        // and update the form status...
769        stabilizeForm();
770    }
771    
772    
773  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
774  // qsamplerMainForm -- File Action slots.  // qsamplerMainForm -- File Action slots.
775    
# Line 1035  void qsamplerMainForm::viewOptions (void Line 1101  void qsamplerMainForm::viewOptions (void
1101          bool    bOldDisplayEffect   = m_pOptions->bDisplayEffect;          bool    bOldDisplayEffect   = m_pOptions->bDisplayEffect;
1102          int     iOldMaxVolume       = m_pOptions->iMaxVolume;          int     iOldMaxVolume       = m_pOptions->iMaxVolume;
1103          QString sOldMessagesFont    = m_pOptions->sMessagesFont;          QString sOldMessagesFont    = m_pOptions->sMessagesFont;
1104            bool    bOldKeepOnTop       = m_pOptions->bKeepOnTop;
1105          bool    bOldStdoutCapture   = m_pOptions->bStdoutCapture;          bool    bOldStdoutCapture   = m_pOptions->bStdoutCapture;
1106          int     bOldMessagesLimit   = m_pOptions->bMessagesLimit;          int     bOldMessagesLimit   = m_pOptions->bMessagesLimit;
1107          int     iOldMessagesLimitLines = m_pOptions->iMessagesLimitLines;          int     iOldMessagesLimitLines = m_pOptions->iMessagesLimitLines;
# Line 1047  void qsamplerMainForm::viewOptions (void Line 1114  void qsamplerMainForm::viewOptions (void
1114          if (pOptionsForm->exec()) {          if (pOptionsForm->exec()) {
1115              // Warn if something will be only effective on next run.              // Warn if something will be only effective on next run.
1116              if (( bOldStdoutCapture && !m_pOptions->bStdoutCapture) ||              if (( bOldStdoutCapture && !m_pOptions->bStdoutCapture) ||
1117                  (!bOldStdoutCapture &&  m_pOptions->bStdoutCapture)) {                  (!bOldStdoutCapture &&  m_pOptions->bStdoutCapture) ||
1118                    ( bOldKeepOnTop     && !m_pOptions->bKeepOnTop)     ||
1119                    (!bOldKeepOnTop     &&  m_pOptions->bKeepOnTop)) {
1120                  QMessageBox::information(this, tr("Information"),                  QMessageBox::information(this, tr("Information"),
1121                      tr("Some settings may be only effective\n"                      tr("Some settings may be only effective\n"
1122                         "next time you start this program."), tr("OK"));                         "next time you start this program."), tr("OK"));

Legend:
Removed from v.428  
changed lines
  Added in v.455

  ViewVC Help
Powered by ViewVC