/[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 759 by capela, Sun Aug 28 11:44:10 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"
# 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    //-------------------------------------------------------------------------
872    // qsamplerChannelRoutingComboBox - Custom combo box for routing table.
873    //
874    
875    // Constructor.
876    qsamplerChannelRoutingComboBox::qsamplerChannelRoutingComboBox (
877            QTable *pTable, const QStringList& list, const QPixmap& pixmap )
878            : QTableItem(pTable, QTableItem::OnTyping, QString::null, pixmap),
879            m_list(list)
880    {
881            m_iCurrentItem = 0;
882    }
883    
884    // Public accessors.
885    void qsamplerChannelRoutingComboBox::setCurrentItem ( int iCurrentItem )
886    {
887            m_iCurrentItem = iCurrentItem;
888    
889            QTableItem::setText(m_list[iCurrentItem]);
890    }
891    
892    int qsamplerChannelRoutingComboBox::currentItem (void) const
893    {
894            return m_iCurrentItem;
895    }
896    
897    // Virtual implemetations.
898    QWidget *qsamplerChannelRoutingComboBox::createEditor (void) const
899    {
900            QComboBox *pComboBox = new QComboBox(QTableItem::table()->viewport());
901            QObject::connect(pComboBox, SIGNAL(activated(int)),
902                    QTableItem::table(), SLOT(doValueChanged()));
903            for (QStringList::ConstIterator iter = m_list.begin();
904                            iter != m_list.end(); iter++) {
905                    pComboBox->insertItem(QTableItem::pixmap(), *iter);
906            }
907            pComboBox->setCurrentItem(m_iCurrentItem);
908            return pComboBox;
909    }
910    
911    void qsamplerChannelRoutingComboBox::setContentFromEditor ( QWidget *pWidget )
912    {
913            if (pWidget->inherits("QComboBox")) {
914                    QComboBox *pComboBox = (QComboBox *) pWidget;
915                    m_iCurrentItem = pComboBox->currentItem();
916                    QTableItem::setText(pComboBox->currentText());
917            }
918            else QTableItem::setContentFromEditor(pWidget);
919    }
920    
921    
922  // end of qsamplerChannel.cpp  // end of qsamplerChannel.cpp

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

  ViewVC Help
Powered by ViewVC