void PatternView::constructContextMenu( QMenu * _cm ) { QAction * a = new QAction( embed::getIconPixmap( "piano" ), tr( "Open in piano-roll" ), _cm ); _cm->insertAction( _cm->actions()[0], a ); connect( a, SIGNAL( triggered( bool ) ), this, SLOT( openInPianoRoll() ) ); _cm->insertSeparator( _cm->actions()[1] ); _cm->addSeparator(); _cm->addAction( embed::getIconPixmap( "edit_erase" ), tr( "Clear all notes" ), m_pat, SLOT( clear() ) ); _cm->addSeparator(); _cm->addAction( embed::getIconPixmap( "reload" ), tr( "Reset name" ), this, SLOT( resetName() ) ); _cm->addAction( embed::getIconPixmap( "edit_rename" ), tr( "Change name" ), this, SLOT( changeName() ) ); if ( m_pat->type() == Pattern::BeatPattern ) { _cm->addSeparator(); _cm->addAction( embed::getIconPixmap( "step_btn_add" ), tr( "Add steps" ), m_pat, SLOT( addSteps() ) ); _cm->addAction( embed::getIconPixmap( "step_btn_remove" ), tr( "Remove steps" ), m_pat, SLOT( removeSteps() ) ); } }
void patternView::constructContextMenu( QMenu * _cm ) { QAction * a = new QAction( embed::getIconPixmap( "piano" ), tr( "Open in piano-roll" ), _cm ); _cm->insertAction( _cm->actions()[0], a ); connect( a, SIGNAL( triggered( bool ) ), this, SLOT( openInPianoRoll() ) ); _cm->insertSeparator( _cm->actions()[1] ); _cm->addSeparator(); _cm->addAction( embed::getIconPixmap( "edit_erase" ), tr( "Clear all notes" ), m_pat, SLOT( clear() ) ); _cm->addSeparator(); _cm->addAction( embed::getIconPixmap( "reload" ), tr( "Reset name" ), this, SLOT( resetName() ) ); _cm->addAction( embed::getIconPixmap( "edit_rename" ), tr( "Change name" ), this, SLOT( changeName() ) ); _cm->addSeparator(); bool freeze_separator = false; if( !( m_pat->m_instrumentTrack->isMuted() || m_pat->isMuted() ) ) { _cm->addAction( embed::getIconPixmap( "freeze" ), m_pat->m_frozenPattern ? tr( "Refreeze" ) : tr( "Freeze" ), m_pat, SLOT( freeze() ) ); freeze_separator = true; } if( m_pat->m_frozenPattern ) { _cm->addAction( embed::getIconPixmap( "unfreeze" ), tr( "Unfreeze" ), m_pat, SLOT( unfreeze() ) ); freeze_separator = true; } if( freeze_separator ) { _cm->addSeparator(); } _cm->addAction( embed::getIconPixmap( "step_btn_add" ), tr( "Add steps" ), m_pat, SLOT( addSteps() ) ); _cm->addAction( embed::getIconPixmap( "step_btn_remove" ), tr( "Remove steps" ), m_pat, SLOT( removeSteps() ) ); }
BBEditor::BBEditor( BBTrackContainer* tc ) : Editor(false), m_trackContainerView( new BBTrackContainerView(tc) ) { setWindowIcon( embed::getIconPixmap( "bb_track_btn" ) ); setWindowTitle( tr( "Beat+Bassline Editor" ) ); setCentralWidget(m_trackContainerView); setAcceptDrops(true); m_toolBar->setAcceptDrops(true); connect(m_toolBar, SIGNAL(dragEntered(QDragEnterEvent*)), m_trackContainerView, SLOT(dragEnterEvent(QDragEnterEvent*))); connect(m_toolBar, SIGNAL(dropped(QDropEvent*)), m_trackContainerView, SLOT(dropEvent(QDropEvent*))); // TODO: Use style sheet if( ConfigManager::inst()->value( "ui", "compacttrackbuttons" ).toInt() ) { setMinimumWidth( TRACK_OP_WIDTH_COMPACT + DEFAULT_SETTINGS_WIDGET_WIDTH_COMPACT + 2 * TCO_BORDER_WIDTH + 264 ); } else { setMinimumWidth( TRACK_OP_WIDTH + DEFAULT_SETTINGS_WIDGET_WIDTH + 2 * TCO_BORDER_WIDTH + 264 ); } m_playAction->setToolTip(tr( "Play/pause current beat/bassline (Space)" )); m_stopAction->setToolTip(tr( "Stop playback of current beat/bassline (Space)" )); m_playAction->setWhatsThis( tr( "Click here to play the current " "beat/bassline. The beat/bassline is automatically " "looped when its end is reached." ) ); m_stopAction->setWhatsThis( tr( "Click here to stop playing of current " "beat/bassline." ) ); // Beat selector DropToolBar *beatSelectionToolBar = addDropToolBarToTop(tr("Beat selector")); m_bbComboBox = new ComboBox( m_toolBar ); m_bbComboBox->setFixedSize( 200, 22 ); m_bbComboBox->setModel( &tc->m_bbComboBoxModel ); beatSelectionToolBar->addWidget( m_bbComboBox ); // Track actions DropToolBar *trackAndStepActionsToolBar = addDropToolBarToTop(tr("Track and step actions")); trackAndStepActionsToolBar->addAction(embed::getIconPixmap("add_bb_track"), tr("Add beat/bassline"), Engine::getSong(), SLOT(addBBTrack())); trackAndStepActionsToolBar->addAction(embed::getIconPixmap("add_automation"), tr("Add automation-track"), m_trackContainerView, SLOT(addAutomationTrack())); QWidget* stretch = new QWidget(m_toolBar); stretch->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); trackAndStepActionsToolBar->addWidget(stretch); // Step actions trackAndStepActionsToolBar->addAction(embed::getIconPixmap("step_btn_remove"), tr("Remove steps"), m_trackContainerView, SLOT(removeSteps())); trackAndStepActionsToolBar->addAction(embed::getIconPixmap("step_btn_add"), tr("Add steps"), m_trackContainerView, SLOT( addSteps())); trackAndStepActionsToolBar->addAction( embed::getIconPixmap( "step_btn_duplicate" ), tr( "Clone Steps" ), m_trackContainerView, SLOT( cloneSteps() ) ); connect( &tc->m_bbComboBoxModel, SIGNAL( dataChanged() ), m_trackContainerView, SLOT( updatePosition() ) ); QAction* viewNext = new QAction(this); connect(viewNext, SIGNAL(triggered()), m_bbComboBox, SLOT(selectNext())); viewNext->setShortcut(Qt::Key_Plus); addAction(viewNext); QAction* viewPrevious = new QAction(this); connect(viewPrevious, SIGNAL(triggered()), m_bbComboBox, SLOT(selectPrevious())); viewPrevious->setShortcut(Qt::Key_Minus); addAction(viewPrevious); }