/[svn]/qsampler/trunk/src/qsamplerChannel.cpp
ViewVC logotype

Diff of /qsampler/trunk/src/qsamplerChannel.cpp

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

revision 758 by capela, Sun Aug 28 00:31:34 2005 UTC revision 824 by capela, Fri Dec 23 01:40:56 2005 UTC
# Line 26  Line 26 
26  #include "qsamplerChannelForm.h"  #include "qsamplerChannelForm.h"
27    
28  #include <qfileinfo.h>  #include <qfileinfo.h>
29    #include <qcombobox.h>
30    
31  #ifdef CONFIG_LIBGIG  #ifdef CONFIG_LIBGIG
32  #include "gig.h"  #include "gig.h"
33  #endif  #endif
34    
35  #define QSAMPLER_INSTRUMENT_MAX 8  #define QSAMPLER_INSTRUMENT_MAX 100
36    
37    
38  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
# Line 788  qsamplerChannelRoutingTable::qsamplerCha Line 789  qsamplerChannelRoutingTable::qsamplerCha
789          QTable::setShowGrid(false);          QTable::setShowGrid(false);
790          QTable::setSorting(false);          QTable::setSorting(false);
791          QTable::setFocusStyle(QTable::FollowStyle);          QTable::setFocusStyle(QTable::FollowStyle);
792          QTable::setSelectionMode(QTable::SingleRow);          QTable::setSelectionMode(QTable::NoSelection);
793          // No vertical header.          // No vertical header.
794          QTable::verticalHeader()->hide();          QTable::verticalHeader()->hide();
795          QTable::setLeftMargin(0);          QTable::setLeftMargin(0);
# Line 830  void qsamplerChannelRoutingTable::refres Line 831  void qsamplerChannelRoutingTable::refres
831          }          }
832    
833          // Those items shall have a proper pixmap...          // Those items shall have a proper pixmap...
834            QPixmap pmChannel = QPixmap::fromMimeSource("qsamplerChannel.png");
835          QPixmap pmDevice;          QPixmap pmDevice;
836          switch (pDevice->deviceType()) {          switch (pDevice->deviceType()) {
837          case qsamplerDevice::Audio:          case qsamplerDevice::Audio:
# Line 847  void qsamplerChannelRoutingTable::refres Line 849  void qsamplerChannelRoutingTable::refres
849          int iRow = 0;          int iRow = 0;
850          qsamplerChannelRoutingMap::ConstIterator iter;          qsamplerChannelRoutingMap::ConstIterator iter;
851          for (iter = routing.begin(); iter != routing.end(); ++iter) {          for (iter = routing.begin(); iter != routing.end(); ++iter) {
852                  QTable::setPixmap(iRow, 0, pmDevice);                  QTable::setPixmap(iRow, 0, pmChannel);
853                  QTable::setText(iRow, 0, pDevice->deviceTypeName()                  QTable::setText(iRow, 0, pDevice->deviceTypeName()
854                          + ' ' + QString::number(iter.key()));                          + ' ' + QString::number(iter.key()));
855                  QComboTableItem *pComboItem = new QComboTableItem(this, opts);                  qsamplerChannelRoutingComboBox *pComboItem =
856                            new qsamplerChannelRoutingComboBox(this, opts, pmDevice);
857                  pComboItem->setCurrentItem(iter.data());                  pComboItem->setCurrentItem(iter.data());
858                  QTable::setItem(iRow, 1, pComboItem);                  QTable::setItem(iRow, 1, pComboItem);
859                  ++iRow;                  ++iRow;
# Line 865  void qsamplerChannelRoutingTable::refres Line 868  void qsamplerChannelRoutingTable::refres
868  }  }
869    
870    
871    // Commit any pending editing.
872    void qsamplerChannelRoutingTable::flush (void)
873    {
874            if (QTable::isEditing())
875                QTable::endEdit(QTable::currEditRow(), QTable::currEditCol(), true, true);
876    }
877    
878    
879    //-------------------------------------------------------------------------
880    // qsamplerChannelRoutingComboBox - Custom combo box for routing table.
881    //
882    
883    // Constructor.
884    qsamplerChannelRoutingComboBox::qsamplerChannelRoutingComboBox (
885            QTable *pTable, const QStringList& list, const QPixmap& pixmap )
886            : QTableItem(pTable, QTableItem::WhenCurrent, QString::null, pixmap),
887            m_list(list)
888    {
889            m_iCurrentItem = 0;
890    }
891    
892    // Public accessors.
893    void qsamplerChannelRoutingComboBox::setCurrentItem ( int iCurrentItem )
894    {
895            m_iCurrentItem = iCurrentItem;
896    
897            QTableItem::setText(m_list[iCurrentItem]);
898    }
899    
900    int qsamplerChannelRoutingComboBox::currentItem (void) const
901    {
902            return m_iCurrentItem;
903    }
904    
905    // Virtual implemetations.
906    QWidget *qsamplerChannelRoutingComboBox::createEditor (void) const
907    {
908            QComboBox *pComboBox = new QComboBox(QTableItem::table()->viewport());
909            QObject::connect(pComboBox, SIGNAL(activated(int)),
910                    QTableItem::table(), SLOT(doValueChanged()));
911            for (QStringList::ConstIterator iter = m_list.begin();
912                            iter != m_list.end(); iter++) {
913                    pComboBox->insertItem(QTableItem::pixmap(), *iter);
914            }
915            pComboBox->setCurrentItem(m_iCurrentItem);
916            return pComboBox;
917    }
918    
919    void qsamplerChannelRoutingComboBox::setContentFromEditor ( QWidget *pWidget )
920    {
921            if (pWidget->inherits("QComboBox")) {
922                    QComboBox *pComboBox = (QComboBox *) pWidget;
923                    m_iCurrentItem = pComboBox->currentItem();
924                    QTableItem::setText(pComboBox->currentText());
925            }
926            else QTableItem::setContentFromEditor(pWidget);
927    }
928    
929    
930  // end of qsamplerChannel.cpp  // end of qsamplerChannel.cpp

Legend:
Removed from v.758  
changed lines
  Added in v.824

  ViewVC Help
Powered by ViewVC