// Constructor. qtractorMidiControlForm::qtractorMidiControlForm ( QWidget *pParent, Qt::WindowFlags wflags ) : QDialog(pParent, wflags) { // Setup UI struct... m_ui.setupUi(this); // Window modality (let plugin/tool windows rave around). QDialog::setWindowModality(Qt::WindowModal); m_iDirtyCount = 0; m_iDirtyMap = 0; m_iUpdating = 0; QHeaderView *pHeader = m_ui.FilesListView->header(); pHeader->setDefaultAlignment(Qt::AlignLeft); #if QT_VERSION >= 0x050000 // pHeader->setSectionResizeMode(QHeaderView::Custom); pHeader->setSectionResizeMode(QHeaderView::ResizeToContents); pHeader->setSectionsMovable(false); #else // pHeader->setResizeMode(QHeaderView::Custom); pHeader->setResizeMode(QHeaderView::ResizeToContents); pHeader->setMovable(false); #endif pHeader = m_ui.ControlMapListView->header(); pHeader->setDefaultAlignment(Qt::AlignLeft); #if QT_VERSION >= 0x050000 // pHeader->setSectionResizeMode(QHeaderView::Custom); pHeader->setSectionResizeMode(QHeaderView::ResizeToContents); pHeader->setSectionsMovable(false); #else // pHeader->setResizeMode(QHeaderView::Custom); pHeader->setResizeMode(QHeaderView::ResizeToContents); pHeader->setMovable(false); #endif m_pControlTypeGroup = new qtractorMidiControlTypeGroup(NULL, m_ui.ControlTypeComboBox, m_ui.ParamComboBox, m_ui.ParamTextLabel); m_ui.ControlTypeComboBox->setCurrentIndex(3); // Controller (default). // m_ui.ChannelComboBox->clear(); m_ui.ChannelComboBox->addItem("*"); for (unsigned short iChannel = 0; iChannel < 16; ++iChannel) m_ui.ChannelComboBox->addItem(textFromChannel(iChannel)); const QIcon iconCommand(":/images/itemChannel.png"); // m_ui.CommandComboBox->clear(); m_ui.CommandComboBox->addItem(iconCommand, qtractorMidiControl::nameFromCommand(qtractorMidiControl::TRACK_GAIN)); m_ui.CommandComboBox->addItem(iconCommand, qtractorMidiControl::nameFromCommand(qtractorMidiControl::TRACK_PANNING)); m_ui.CommandComboBox->addItem(iconCommand, qtractorMidiControl::nameFromCommand(qtractorMidiControl::TRACK_MONITOR)); m_ui.CommandComboBox->addItem(iconCommand, qtractorMidiControl::nameFromCommand(qtractorMidiControl::TRACK_RECORD)); m_ui.CommandComboBox->addItem(iconCommand, qtractorMidiControl::nameFromCommand(qtractorMidiControl::TRACK_MUTE)); m_ui.CommandComboBox->addItem(iconCommand, qtractorMidiControl::nameFromCommand(qtractorMidiControl::TRACK_SOLO)); m_ui.SyncCheckBox->setChecked(qtractorMidiControl::isSync()); stabilizeTypeChange(); refreshFiles(); adjustSize(); // UI signal/slot connections... QObject::connect(m_ui.FilesListView, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), SLOT(stabilizeForm())); QObject::connect(m_ui.ControlMapListView, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), SLOT(stabilizeForm())); QObject::connect(m_ui.ImportPushButton, SIGNAL(clicked()), SLOT(importSlot())); QObject::connect(m_ui.RemovePushButton, SIGNAL(clicked()), SLOT(removeSlot())); QObject::connect(m_ui.MoveUpPushButton, SIGNAL(clicked()), SLOT(moveUpSlot())); QObject::connect(m_ui.MoveDownPushButton, SIGNAL(clicked()), SLOT(moveDownSlot())); QObject::connect(m_pControlTypeGroup, SIGNAL(controlTypeChanged(int)), SLOT(typeChangedSlot())); QObject::connect(m_pControlTypeGroup, SIGNAL(controlParamChanged(int)), SLOT(keyChangedSlot())); QObject::connect(m_ui.ChannelComboBox, SIGNAL(activated(int)), SLOT(keyChangedSlot())); QObject::connect(m_ui.TrackCheckBox, SIGNAL(toggled(bool)), SLOT(keyChangedSlot())); QObject::connect(m_ui.TrackSpinBox, SIGNAL(valueChanged(int)), SLOT(valueChangedSlot())); QObject::connect(m_ui.CommandComboBox, SIGNAL(activated(int)), SLOT(valueChangedSlot())); QObject::connect(m_ui.FeedbackCheckBox, SIGNAL(toggled(bool)), SLOT(valueChangedSlot())); QObject::connect(m_ui.MapPushButton, SIGNAL(clicked()), SLOT(mapSlot())); QObject::connect(m_ui.UnmapPushButton, SIGNAL(clicked()), SLOT(unmapSlot())); QObject::connect(m_ui.SyncCheckBox, SIGNAL(toggled(bool)), SLOT(syncSlot(bool))); QObject::connect(m_ui.ReloadPushButton, SIGNAL(clicked()), SLOT(reloadSlot())); QObject::connect(m_ui.ExportPushButton, SIGNAL(clicked()), SLOT(exportSlot())); QObject::connect(m_ui.ClosePushButton, SIGNAL(clicked()), SLOT(reject())); }
// Constructor. qtractorInstrumentForm::qtractorInstrumentForm ( QWidget *pParent, Qt::WindowFlags wflags ) : QDialog(pParent, wflags) { // Setup UI struct... m_ui.setupUi(this); // Window modality (let plugin/tool windows rave around). QDialog::setWindowModality(Qt::WindowModal); m_pInstruments = NULL; m_iDirtyCount = 0; QHeaderView *pHeader = m_ui.InstrumentsListView->header(); pHeader->setDefaultAlignment(Qt::AlignLeft); #if QT_VERSION >= 0x050000 // pHeader->setSectionResizeMode(QHeaderView::Custom); pHeader->setSectionResizeMode(QHeaderView::ResizeToContents); pHeader->setSectionsMovable(false); #else // pHeader->setResizeMode(QHeaderView::Custom); pHeader->setResizeMode(QHeaderView::ResizeToContents); pHeader->setMovable(false); #endif pHeader = m_ui.FilesListView->header(); pHeader->setDefaultAlignment(Qt::AlignLeft); #if QT_VERSION >= 0x050000 // pHeader->setSectionResizeMode(QHeaderView::Custom); pHeader->setSectionResizeMode(QHeaderView::ResizeToContents); pHeader->setSectionsMovable(false); #else // pHeader->setResizeMode(QHeaderView::Custom); pHeader->setResizeMode(QHeaderView::ResizeToContents); pHeader->setMovable(false); #endif pHeader = m_ui.NamesListView->header(); pHeader->setDefaultAlignment(Qt::AlignLeft); #if QT_VERSION >= 0x050000 // pHeader->setSectionResizeMode(QHeaderView::Custom); pHeader->setSectionResizeMode(QHeaderView::ResizeToContents); pHeader->setSectionsMovable(false); #else // pHeader->setResizeMode(QHeaderView::Custom); pHeader->setResizeMode(QHeaderView::ResizeToContents); pHeader->setMovable(false); #endif qtractorSession *pSession = qtractorSession::getInstance(); if (pSession) setInstruments(pSession->instruments()); adjustSize(); // UI signal/slot connections... QObject::connect(m_ui.FilesListView, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), SLOT(stabilizeForm())); QObject::connect(m_ui.NamesListView, SIGNAL(itemCollapsed(QTreeWidgetItem*)), SLOT(itemCollapsed(QTreeWidgetItem*))); QObject::connect(m_ui.NamesListView, SIGNAL(itemExpanded(QTreeWidgetItem*)), SLOT(itemExpanded(QTreeWidgetItem*))); QObject::connect(m_ui.InstrumentsListView, SIGNAL(itemCollapsed(QTreeWidgetItem*)), SLOT(itemCollapsed(QTreeWidgetItem*))); QObject::connect(m_ui.InstrumentsListView, SIGNAL(itemExpanded(QTreeWidgetItem*)), SLOT(itemExpanded(QTreeWidgetItem*))); QObject::connect(m_ui.ImportPushButton, SIGNAL(clicked()), SLOT(importSlot())); QObject::connect(m_ui.RemovePushButton, SIGNAL(clicked()), SLOT(removeSlot())); QObject::connect(m_ui.MoveUpPushButton, SIGNAL(clicked()), SLOT(moveUpSlot())); QObject::connect(m_ui.MoveDownPushButton, SIGNAL(clicked()), SLOT(moveDownSlot())); QObject::connect(m_ui.ReloadPushButton, SIGNAL(clicked()), SLOT(reloadSlot())); QObject::connect(m_ui.ExportPushButton, SIGNAL(clicked()), SLOT(exportSlot())); QObject::connect(m_ui.ClosePushButton, SIGNAL(clicked()), SLOT(reject())); }
//Create the actions of main window void MainWindow::createActions() { //Game menu KStandardGameAction::gameNew( this, SLOT(gameNewSlot() ), actionCollection() ); KStandardGameAction::highscores( this, SLOT( showHighscoresSlot() ), actionCollection() ); closeGameAction = KStandardGameAction::end( this, SLOT( playerClosedGameSlot() ), actionCollection() ); closeGameAction->setEnabled( false ); pauseAction = KStandardGameAction::pause( this, SLOT( pauseSlot() ), actionCollection() ); pauseAction->setEnabled( false ); KStandardGameAction::quit( this, SLOT( close() ), actionCollection() ); //Move menu moveLeftAction = new KAction( this ); moveLeftAction->setText( i18n( "Move Left" ) ); moveLeftAction->setShortcut( Qt::Key_Left ); moveLeftAction->setIcon( KIcon( ":/pics/move_left.png" ) ); moveLeftAction->setEnabled( false ); actionCollection()->addAction( "move_left", moveLeftAction ); moveRightAction = new KAction( this ); moveRightAction->setText( i18n( "Move Right" ) ); moveRightAction->setShortcut( Qt::Key_Right ); moveRightAction->setIcon( KIcon( ":/pics/move_right.png" ) ); moveRightAction->setEnabled( false ); actionCollection()->addAction( "move_right", moveRightAction ); moveDownAction = new KAction( this ); moveDownAction->setText( i18n( "Move Down" ) ); moveDownAction->setShortcut( Qt::Key_Down ); moveDownAction->setIcon( KIcon( ":/pics/move_down.png" ) ); moveDownAction->setEnabled( false ); actionCollection()->addAction( "move_down", moveDownAction ); fastMoveDownAction = new KAction( this ); fastMoveDownAction->setText( i18n( "Fast Move Down" ) ); fastMoveDownAction->setShortcut( Qt::Key_Space ); fastMoveDownAction->setIcon( KIcon( ":/pics/fast_move_down.png" ) ); fastMoveDownAction->setEnabled( false ); actionCollection()->addAction( "fast_move_down", fastMoveDownAction ); rotateLeftAction = new KAction( this ); rotateLeftAction->setText( i18n( "Rotate Left" ) ); rotateLeftAction->setShortcut( Qt::Key_X ); rotateLeftAction->setIcon( KIcon( ":/pics/rotate_left.png" ) ); rotateLeftAction->setEnabled( false ); actionCollection()->addAction( "rotate_left", rotateLeftAction ); rotateRightAction = new KAction( this ); rotateRightAction->setText( i18n( "Rotate Right" ) ); rotateRightAction->setShortcut( Qt::Key_Up ); rotateRightAction->setIcon( KIcon( ":/pics/rotate_right.png" ) ); rotateRightAction->setEnabled( false ); actionCollection()->addAction( "rotate_right", rotateRightAction ); connect( moveLeftAction, SIGNAL( triggered() ), centralTable, SLOT( moveLeftSlot() ) ); connect( moveRightAction, SIGNAL( triggered() ), centralTable, SLOT( moveRightSlot() ) ); connect( moveDownAction, SIGNAL( triggered() ), centralTable, SLOT( moveDownSlot() ) ); connect( fastMoveDownAction, SIGNAL( triggered() ), centralTable, SLOT( fastMoveDownSlot() ) ); connect( rotateLeftAction, SIGNAL( triggered() ), centralTable, SLOT( rotateLeftSlot() ) ); connect( rotateRightAction, SIGNAL( triggered() ), centralTable, SLOT( rotateRightSlot() ) ); }