/[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 369 by capela, Fri Feb 11 13:30:21 2005 UTC revision 388 by capela, Thu Feb 17 17:27:59 2005 UTC
# Line 26  Line 26 
26  #include <qprocess.h>  #include <qprocess.h>
27  #include <qmessagebox.h>  #include <qmessagebox.h>
28  #include <qdragobject.h>  #include <qdragobject.h>
29    #include <qregexp.h>
30  #include <qfiledialog.h>  #include <qfiledialog.h>
31  #include <qfileinfo.h>  #include <qfileinfo.h>
32  #include <qfile.h>  #include <qfile.h>
# Line 294  void qsamplerMainForm::closeEvent ( QClo Line 295  void qsamplerMainForm::closeEvent ( QClo
295  }  }
296    
297    
298  // Window drag-n-drop event handlers.  // Drag'n'drop file handler.
299  void qsamplerMainForm::dragEnterEvent ( QDragEnterEvent* pDragEnterEvent )  bool qsamplerMainForm::decodeDragFiles ( const QMimeSource *pEvent, QStringList& files )
300  {  {
301      bool bAccept = false;      bool bDecode = false;
302    
303      if (QTextDrag::canDecode(pDragEnterEvent)) {      if (QTextDrag::canDecode(pEvent)) {
304          QString sUrl;          QString sText;
305          if (QTextDrag::decode(pDragEnterEvent, sUrl) && m_pClient)          bDecode = QTextDrag::decode(pEvent, sText);
306              bAccept = QFileInfo(QUrl(sUrl).path()).exists();          if (bDecode) {
307                files = QStringList::split('\n', sText);
308                for (QStringList::Iterator iter = files.begin(); iter != files.end(); iter++)
309                    *iter = (*iter).stripWhiteSpace().replace(QRegExp("^file:"), QString::null);
310            }
311      }      }
312    
313      pDragEnterEvent->accept(bAccept);      return bDecode;
314    }
315    
316    
317    // Window drag-n-drop event handlers.
318    void qsamplerMainForm::dragEnterEvent ( QDragEnterEvent* pDragEnterEvent )
319    {
320        QStringList files;
321    
322        pDragEnterEvent->accept(decodeDragFiles(pDragEnterEvent, files));
323  }  }
324    
325    
326  void qsamplerMainForm::dropEvent ( QDropEvent* pDropEvent )  void qsamplerMainForm::dropEvent ( QDropEvent* pDropEvent )
327  {  {
328      if (QTextDrag::canDecode(pDropEvent)) {      QStringList files;
329          QString sUrl;      if (decodeDragFiles(pDropEvent, files)) {
330          if (QTextDrag::decode(pDropEvent, sUrl) && closeSession(true))          for (QStringList::Iterator iter = files.begin(); iter != files.end(); iter++) {
331              loadSessionFile(QUrl(sUrl).path());                          const QString& sPath = QUrl(*iter).path();
332                            if (qsamplerChannel::isInstrumentFile(sPath)) {
333                                    // Try to create a new channel from instrument file...
334                                qsamplerChannel *pChannel = new qsamplerChannel(this);
335                                if (pChannel == NULL)
336                                    return;
337                                    // Start setting the instrument filename...
338                                    pChannel->setInstrument(sPath, 0);
339                                // Before we show it up, may be we'll
340                                // better ask for some initial values?
341                                if (!pChannel->channelSetup(this)) {
342                                    delete pChannel;
343                                    return;
344                                }
345                                // Make that an overall update.
346                                m_iDirtyCount++;
347                                m_iChangeCount++;
348                                stabilizeForm();
349                    }   // Otherwise, load an usual session file (LSCP script)...
350                            else if (closeSession(true))
351                                    loadSessionFile(sPath);
352                    }
353      }      }
354  }  }
355    
# Line 538  bool qsamplerMainForm::loadSessionFile ( Line 573  bool qsamplerMainForm::loadSessionFile (
573              if (::lscp_client_query(m_pClient, sCommand.latin1()) != LSCP_OK) {              if (::lscp_client_query(m_pClient, sCommand.latin1()) != LSCP_OK) {
574                  appendMessagesClient("lscp_client_query");                  appendMessagesClient("lscp_client_query");
575                  iErrors++;                  iErrors++;
576                    break;
577              }              }
578          }          }
579          // Try to make it snappy :)          // Try to make it snappy :)
# Line 549  bool qsamplerMainForm::loadSessionFile ( Line 585  bool qsamplerMainForm::loadSessionFile (
585    
586      // Have we any errors?      // Have we any errors?
587      if (iErrors > 0)      if (iErrors > 0)
588          appendMessagesError(tr("Some setttings could not be loaded\nfrom \"%1\" session file.\n\nSorry.").arg(sFilename));          appendMessagesError(tr("Session could not be loaded\nfrom \"%1\".\n\nSorry.").arg(sFilename));
589    
590      // Now we'll try to create the whole GUI session.      // Now we'll try to create the whole GUI session.
591      int *piChannelIDs = ::lscp_list_channels(m_pClient);      int *piChannelIDs = ::lscp_list_channels(m_pClient);
# Line 959  void qsamplerMainForm::viewOptions (void Line 995  void qsamplerMainForm::viewOptions (void
995          int     bOldMessagesLimit   = m_pOptions->bMessagesLimit;          int     bOldMessagesLimit   = m_pOptions->bMessagesLimit;
996          int     iOldMessagesLimitLines = m_pOptions->iMessagesLimitLines;          int     iOldMessagesLimitLines = m_pOptions->iMessagesLimitLines;
997          bool    bOldCompletePath    = m_pOptions->bCompletePath;          bool    bOldCompletePath    = m_pOptions->bCompletePath;
998            bool    bOldInstrumentNames = m_pOptions->bInstrumentNames;
999          int     iOldMaxRecentFiles  = m_pOptions->iMaxRecentFiles;          int     iOldMaxRecentFiles  = m_pOptions->iMaxRecentFiles;
1000          // Load the current setup settings.          // Load the current setup settings.
1001          pOptionsForm->setup(m_pOptions);          pOptionsForm->setup(m_pOptions);
# Line 977  void qsamplerMainForm::viewOptions (void Line 1014  void qsamplerMainForm::viewOptions (void
1014                  (!bOldCompletePath &&  m_pOptions->bCompletePath) ||                  (!bOldCompletePath &&  m_pOptions->bCompletePath) ||
1015                  (iOldMaxRecentFiles != m_pOptions->iMaxRecentFiles))                  (iOldMaxRecentFiles != m_pOptions->iMaxRecentFiles))
1016                  updateRecentFilesMenu();                  updateRecentFilesMenu();
1017                if (( bOldInstrumentNames && !m_pOptions->bInstrumentNames) ||
1018                    (!bOldInstrumentNames &&  m_pOptions->bInstrumentNames))
1019                    updateInstrumentNames();
1020              if (( bOldDisplayEffect && !m_pOptions->bDisplayEffect) ||              if (( bOldDisplayEffect && !m_pOptions->bDisplayEffect) ||
1021                  (!bOldDisplayEffect &&  m_pOptions->bDisplayEffect))                  (!bOldDisplayEffect &&  m_pOptions->bDisplayEffect))
1022                  updateDisplayEffect();                  updateDisplayEffect();
# Line 1087  void qsamplerMainForm::helpAbout (void) Line 1127  void qsamplerMainForm::helpAbout (void)
1127      sText += tr("GIG (libgig) file support disabled.");      sText += tr("GIG (libgig) file support disabled.");
1128      sText += "</font></small><br />";      sText += "</font></small><br />";
1129  #endif  #endif
1130    #ifndef CONFIG_INSTRUMENT_NAME
1131        sText += "<small><font color=\"red\">";
1132        sText += tr("LSCP (liblscp) instrument_name support disabled.");
1133        sText += "</font></small><br />";
1134    #endif
1135      sText += "<br />\n";      sText += "<br />\n";
1136      sText += tr("Using") + ": ";      sText += tr("Using") + ": ";
1137      sText += ::lscp_client_package();      sText += ::lscp_client_package();
# Line 1220  void qsamplerMainForm::updateRecentFiles Line 1265  void qsamplerMainForm::updateRecentFiles
1265  }  }
1266    
1267    
1268    // Force update of the channels instrument names mode.
1269    void qsamplerMainForm::updateInstrumentNames (void)
1270    {
1271        // Full channel list update...
1272        QWidgetList wlist = m_pWorkspace->windowList();
1273        if (wlist.isEmpty())
1274            return;
1275    
1276        m_pWorkspace->setUpdatesEnabled(false);
1277        for (int iChannel = 0; iChannel < (int) wlist.count(); iChannel++) {
1278            qsamplerChannelStrip *pChannelStrip = (qsamplerChannelStrip *) wlist.at(iChannel);
1279            if (pChannelStrip)
1280                pChannelStrip->updateInstrumentName(true);
1281        }
1282        m_pWorkspace->setUpdatesEnabled(true);
1283    }
1284    
1285    
1286  // Force update of the channels display font.  // Force update of the channels display font.
1287  void qsamplerMainForm::updateDisplayFont (void)  void qsamplerMainForm::updateDisplayFont (void)
1288  {  {

Legend:
Removed from v.369  
changed lines
  Added in v.388

  ViewVC Help
Powered by ViewVC