void PostWidget::addSub(QString channelPost, QString channelSub) { { PixmapWidget *pw = new PixmapWidget(NULL); pw->setPixmap("separator.svg"); pw->setFixedSize(CHANNEL_WIDTH, SEPARATOR_HEIGHT); lSub->addWidget(pw); sub_tb[channelSub] = pw; } TWidget* elem = m_pMatrix->createToggle(POST, channelPost, TO_SUB, channelSub); lSub->addWidget(elem); sub[channelSub] = elem; }
void InWidget::addPost(QString channelIn, QString channelPost) { { PixmapWidget *pw = new PixmapWidget(NULL); pw->setPixmap("separator.svg"); pw->setFixedSize(CHANNEL_WIDTH, SEPARATOR_HEIGHT); lPost->addWidget(pw); post_tb[channelPost] = pw; } VWidget *elem = m_pMatrix->createRotary(IN, channelIn, TO_POST, channelPost); lPost->addWidget(elem); post[channelPost] = elem; }
MainWidget::MainWidget(Widget* p_pMatrix) : ChannelWidget() , m_pMatrix(p_pMatrix) { QVBoxLayout* layout = new QVBoxLayout; setLayout(layout); setFixedWidth(CHANNEL_WIDTH); layout->setSpacing(0); layout->setMargin(0); { QLabel *label = new QLabel(trUtf8("Phone")); label->setFixedWidth(CHANNEL_WIDTH); label->setAlignment(Qt::AlignHCenter); layout->addWidget(label); } phone = m_pMatrix->createRotary(OUT, MAIN, FADER, PFL); layout->addWidget(phone); { Widget::addSpacer(layout); m_pLabel = new QLabel(trUtf8("Main")); m_pLabel->setFixedWidth(CHANNEL_WIDTH); m_pLabel->setAlignment(Qt::AlignHCenter); layout->addWidget(m_pLabel); QFont font = m_pLabel->font(); font.setBold(true); m_pLabel->setFont(font); } mute = m_pMatrix->createToggle(OUT, MAIN, MUTE); layout->addWidget(mute); // Widget::addLine(layout); { PixmapWidget *pw = new PixmapWidget(NULL); pw->setPixmap("separator.svg"); pw->setFixedSize(CHANNEL_WIDTH, SEPARATOR_HEIGHT); layout->addWidget(pw); } mono = m_pMatrix->createRotary(OUT, MAIN, FADER, MONO); layout->addWidget(mono); // Widget::addLine(layout); { PixmapWidget *pw = new PixmapWidget(NULL); pw->setPixmap("separator.svg"); pw->setFixedSize(CHANNEL_WIDTH, SEPARATOR_HEIGHT); layout->addWidget(pw); } bal = m_pMatrix->createRotary(OUT, MAIN, PAN_BAL); layout->addWidget(bal); afl = m_pMatrix->createToggle(OUT, MAIN, TO_AFL); layout->addWidget(afl); fader = m_pMatrix->createFader(OUT, MAIN, FADER, MAIN); layout->addWidget(fader); }
PatternEditorPanel::PatternEditorPanel( QWidget *pParent ) : QWidget( pParent ) , Object( __class_name ) , m_pPattern( NULL ) , m_bEnablePatternResize( true ) { setAcceptDrops(true); Preferences *pPref = Preferences::get_instance(); // Editor TOP PixmapWidget *editor_top = new PixmapWidget(0); editor_top->setPixmap("/patternEditor/editor_top.png", true); editor_top->setFixedHeight(24); PixmapWidget *editor_top_2 = new PixmapWidget(0); editor_top_2->setPixmap("/patternEditor/editor_top.png", true); editor_top_2->setFixedHeight(24); QHBoxLayout *editor_top_hbox = new QHBoxLayout(editor_top); editor_top_hbox->setSpacing(0); editor_top_hbox->setMargin(0); editor_top_hbox->setAlignment(Qt::AlignLeft); QHBoxLayout *editor_top_hbox_2 = new QHBoxLayout(editor_top_2); editor_top_hbox_2->setSpacing(0); editor_top_hbox_2->setMargin(0); editor_top_hbox_2->setAlignment(Qt::AlignLeft); //soundlibrary name pSLlabel = new QLabel( NULL ); pSLlabel->setText( Hydrogen::get_instance()->m_currentDrumkit ); pSLlabel->setFixedSize( 170, 20 ); pSLlabel->move( 10, 3 ); pSLlabel->setToolTip( trUtf8("Loaded Soundlibrary") ); editor_top_hbox->addWidget( pSLlabel ); //wolke some background images back_size_res PixmapWidget *pSizeResol = new PixmapWidget( NULL ); pSizeResol->setFixedSize( 200, 20 ); pSizeResol->setPixmap( "/patternEditor/background_res-new.png" ); pSizeResol->move( 0, 3 ); editor_top_hbox_2->addWidget( pSizeResol ); // PATTERN size __pattern_size_combo = new LCDCombo(pSizeResol, 4); __pattern_size_combo->move( 34, 2 ); __pattern_size_combo->setToolTip( trUtf8("Select pattern size") ); for ( int i = 1; i <= 32; i++) { __pattern_size_combo->addItem( QString( "%1" ).arg( i ) ); } __pattern_size_combo->update(); connect(__pattern_size_combo, SIGNAL( valueChanged( QString ) ), this, SLOT( patternSizeChanged(QString) ) ); // GRID resolution __resolution_combo = new LCDCombo( pSizeResol , 7); __resolution_combo->setToolTip(trUtf8("Select grid resolution")); __resolution_combo->addItem( "4" ); __resolution_combo->addItem( "8" ); __resolution_combo->addItem( "16" ); __resolution_combo->addItem( "32" ); __resolution_combo->addItem( "64" ); __resolution_combo->addSeparator(); __resolution_combo->addItem( "4T" ); __resolution_combo->addItem( "8T" ); __resolution_combo->addItem( "16T" ); __resolution_combo->addItem( "32T" ); __resolution_combo->addSeparator(); __resolution_combo->addItem( "off" ); __resolution_combo->update(); __resolution_combo->move( 121, 2 ); connect(__resolution_combo, SIGNAL(valueChanged(QString)), this, SLOT(gridResolutionChanged(QString))); PixmapWidget *pRec = new PixmapWidget( NULL ); pRec->setFixedSize( 158, 20 ); pRec->setPixmap( "/patternEditor/background_rec-new.png" ); pRec->move( 0, 3 ); editor_top_hbox_2->addWidget( pRec ); // Hear notes btn ToggleButton *hearNotesBtn = new ToggleButton( pRec, "/patternEditor/btn_hear_on.png", "/patternEditor/btn_hear_off.png", "/patternEditor/btn_hear_off.png", QSize(15, 13) ); hearNotesBtn->move( 34, 3 ); hearNotesBtn->setToolTip( trUtf8( "Hear new notes" ) ); connect( hearNotesBtn, SIGNAL(clicked(Button*)), this, SLOT( hearNotesBtnClick(Button*))); hearNotesBtn->setPressed( pPref->getHearNewNotes() ); // quantize ToggleButton* quantizeEventsBtn = new ToggleButton( pRec, "/patternEditor/btn_quant_on.png", "/patternEditor/btn_quant_off.png", "/patternEditor/btn_quant_off.png", QSize(15, 13) ); quantizeEventsBtn->move( 90, 3 ); quantizeEventsBtn->setPressed( pPref->getQuantizeEvents()); quantizeEventsBtn->setToolTip( trUtf8( "Quantize keyboard/midi events to grid" ) ); connect( quantizeEventsBtn, SIGNAL(clicked(Button*)), this, SLOT( quantizeEventsBtnClick(Button*))); // Editor mode __show_drum_btn = new ToggleButton( pRec, "/patternEditor/btn_drum_piano_on.png", "/patternEditor/btn_drum_piano_off.png", "/patternEditor/btn_drum_piano_off.png", QSize(17, 13) ); __show_drum_btn->move( 137, 3 ); __show_drum_btn->setPressed( false ); __show_drum_btn->setToolTip( trUtf8( "Show piano roll editor" ) ); connect(__show_drum_btn, SIGNAL(clicked(Button*)), this, SLOT( showDrumEditorBtnClick(Button*))); __recpredelete = new QComboBox( NULL ); __recpredelete->setFixedSize( 130, 20 ); __recpredelete->move( 2, 1 ); __recpredelete->addItem ( QString( "On play" )); __recpredelete->addItem ( QString( "On rec: once fp" )); __recpredelete->addItem ( QString( "On rec: 1/1 fp" )); __recpredelete->addItem ( QString( "On rec: 1/2 fp" )); __recpredelete->addItem ( QString( "On rec: 1/4 fp" )); __recpredelete->addItem ( QString( "On rec: 1/8 fp" )); __recpredelete->addItem ( QString( "On rec: 1/16 fp" )); __recpredelete->addItem ( QString( "On rec: 1/32 fp" )); __recpredelete->addItem ( QString( "On rec: 1/64 fp" )); __recpredelete->addItem ( QString( "On rec: 1/64" )); __recpredelete->addItem ( QString( "On rec: 1/32" )); __recpredelete->addItem ( QString( "On rec: 1/16" )); __recpredelete->addItem ( QString( "On rec: 1/8" )); __recpredelete->addItem ( QString( "On rec: 1/4" )); __recpredelete->addItem ( QString( "On rec: 1/2" )); __recpredelete->addItem ( QString( "On rec: 1/1" )); __recpredelete->addItem ( QString( "On rec: once" )); __recpredelete->update(); __recpredelete->setToolTip( trUtf8( "destructive mode pre delete settings" ) ); editor_top_hbox_2->addWidget( __recpredelete ); connect( __recpredelete, SIGNAL( currentIndexChanged( int ) ), this, SLOT( recPreDeleteSelect( int) ) ); __recpostdelete = new QComboBox( NULL ); __recpostdelete->setFixedSize( 60, 20 ); __recpostdelete->move( 2, 1 ); __recpostdelete->addItem ( QString( "off" )); __recpostdelete->addItem ( QString( "1/64" )); __recpostdelete->addItem ( QString( "1/32" )); __recpostdelete->addItem ( QString( "1/16" )); __recpostdelete->addItem ( QString( "1/8" )); __recpostdelete->addItem ( QString( "1/4" )); __recpostdelete->addItem ( QString( "1/2" )); __recpostdelete->addItem ( QString( "1/1" )); __recpostdelete->update(); __recpostdelete->setToolTip( trUtf8( "destructive mode post delete settings" ) ); editor_top_hbox_2->addWidget( __recpostdelete ); connect( __recpostdelete, SIGNAL( currentIndexChanged( int ) ), this, SLOT( recPostDeleteSelect( int) ) ); // zoom-in btn Button *zoom_in_btn = new Button( NULL, "/songEditor/btn_new_on.png", "/songEditor/btn_new_off.png", "/songEditor/btn_new_over.png", QSize(19, 13) ); zoom_in_btn->setToolTip( trUtf8( "Zoom in" ) ); connect(zoom_in_btn, SIGNAL(clicked(Button*)), this, SLOT( zoomInBtnClicked(Button*) ) ); // zoom-out btn Button *zoom_out_btn = new Button( NULL, "/songEditor/btn_minus_on.png", "/songEditor/btn_minus_off.png", "/songEditor/btn_minus_over.png", QSize(19, 13) ); zoom_out_btn->setToolTip( trUtf8( "Zoom out" ) ); connect( zoom_out_btn, SIGNAL(clicked(Button*)), this, SLOT( zoomOutBtnClicked(Button*) ) ); // End Editor TOP // RULER____________________________________ // Ruler ScrollView m_pRulerScrollView = new QScrollArea( NULL ); m_pRulerScrollView->setFrameShape( QFrame::NoFrame ); m_pRulerScrollView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); m_pRulerScrollView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); m_pRulerScrollView->setFixedHeight( 25 ); // Ruler m_pPatternEditorRuler = new PatternEditorRuler( m_pRulerScrollView->viewport() ); m_pRulerScrollView->setWidget( m_pPatternEditorRuler ); //~ RULER // EDITOR _____________________________________ // Editor scrollview m_pEditorScrollView = new QScrollArea( NULL ); m_pEditorScrollView->setFrameShape( QFrame::NoFrame ); m_pEditorScrollView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); m_pEditorScrollView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); // Editor m_pDrumPatternEditor = new DrumPatternEditor( m_pEditorScrollView->viewport(), this ); m_pEditorScrollView->setWidget( m_pDrumPatternEditor ); connect( m_pEditorScrollView->verticalScrollBar(), SIGNAL( valueChanged(int) ), this, SLOT( on_patternEditorScroll(int) ) ); //PianoRollEditor m_pPianoRollScrollView = new QScrollArea( NULL ); m_pPianoRollScrollView->setFrameShape( QFrame::NoFrame ); m_pPianoRollScrollView->setVerticalScrollBarPolicy( Qt::ScrollBarAsNeeded ); m_pPianoRollScrollView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); m_pPianoRollEditor = new PianoRollEditor( m_pPianoRollScrollView->viewport(), this ); m_pPianoRollScrollView->setWidget( m_pPianoRollEditor ); m_pPianoRollScrollView->hide(); //~ EDITOR // INSTRUMENT LIST // Instrument list scrollview m_pInstrListScrollView = new QScrollArea( NULL ); m_pInstrListScrollView->setFrameShape( QFrame::NoFrame ); m_pInstrListScrollView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); m_pInstrListScrollView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); // Instrument list m_pInstrumentList = new PatternEditorInstrumentList( m_pInstrListScrollView->viewport(), this ); m_pInstrListScrollView->setWidget( m_pInstrumentList ); m_pInstrListScrollView->setFixedWidth( m_pInstrumentList->width() ); connect( m_pInstrListScrollView->verticalScrollBar(), SIGNAL( valueChanged(int) ), this, SLOT( on_patternEditorScroll(int) ) ); //~ INSTRUMENT LIST // NOTE_VELOCITY EDITOR m_pNoteVelocityScrollView = new QScrollArea( NULL ); m_pNoteVelocityScrollView->setFrameShape( QFrame::NoFrame ); m_pNoteVelocityScrollView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); m_pNoteVelocityScrollView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); m_pNoteVelocityEditor = new NotePropertiesRuler( m_pNoteVelocityScrollView->viewport(), this, NotePropertiesRuler::VELOCITY ); m_pNoteVelocityScrollView->setWidget( m_pNoteVelocityEditor ); m_pNoteVelocityScrollView->setFixedHeight( 100 ); //~ NOTE_VELOCITY EDITOR // NOTE_PAN EDITOR m_pNotePanScrollView = new QScrollArea( NULL ); m_pNotePanScrollView->setFrameShape( QFrame::NoFrame ); m_pNotePanScrollView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); m_pNotePanScrollView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); m_pNotePanEditor = new NotePropertiesRuler( m_pNotePanScrollView->viewport(), this, NotePropertiesRuler::PAN ); m_pNotePanScrollView->setWidget( m_pNotePanEditor ); m_pNotePanScrollView->setFixedHeight( 100 ); //~ NOTE_PAN EDITOR // NOTE_LEADLAG EDITOR m_pNoteLeadLagScrollView = new QScrollArea( NULL ); m_pNoteLeadLagScrollView->setFrameShape( QFrame::NoFrame ); m_pNoteLeadLagScrollView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); m_pNoteLeadLagScrollView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); m_pNoteLeadLagEditor = new NotePropertiesRuler( m_pNoteLeadLagScrollView->viewport(), this, NotePropertiesRuler::LEADLAG ); m_pNoteLeadLagScrollView->setWidget( m_pNoteLeadLagEditor ); m_pNoteLeadLagScrollView->setFixedHeight( 100 ); //~ NOTE_LEADLAG EDITOR // NOTE_NOTEKEY EDITOR m_pNoteNoteKeyScrollView = new QScrollArea( NULL ); m_pNoteNoteKeyScrollView->setFrameShape( QFrame::NoFrame ); m_pNoteNoteKeyScrollView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); m_pNoteNoteKeyScrollView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); m_pNoteNoteKeyEditor = new NotePropertiesRuler( m_pNoteNoteKeyScrollView->viewport(), this, NotePropertiesRuler::NOTEKEY ); m_pNoteNoteKeyScrollView->setWidget( m_pNoteNoteKeyEditor ); m_pNoteNoteKeyScrollView->setFixedHeight( 210 ); //~ NOTE_NOTEKEY EDITOR // external horizontal scrollbar m_pPatternEditorHScrollBar = new QScrollBar( Qt::Horizontal , NULL ); connect( m_pPatternEditorHScrollBar, SIGNAL(valueChanged(int)), this, SLOT( syncToExternalHorizontalScrollbar(int) ) ); // external vertical scrollbar m_pPatternEditorVScrollBar = new QScrollBar( Qt::Vertical, NULL ); connect( m_pPatternEditorVScrollBar, SIGNAL(valueChanged(int)), this, SLOT( syncToExternalHorizontalScrollbar(int) ) ); QHBoxLayout *pPatternEditorHScrollBarLayout = new QHBoxLayout(); pPatternEditorHScrollBarLayout->setSpacing( 0 ); pPatternEditorHScrollBarLayout->setMargin( 0 ); pPatternEditorHScrollBarLayout->addWidget( m_pPatternEditorHScrollBar ); pPatternEditorHScrollBarLayout->addWidget( zoom_in_btn ); pPatternEditorHScrollBarLayout->addWidget( zoom_out_btn ); QWidget *pPatternEditorHScrollBarContainer = new QWidget(); pPatternEditorHScrollBarContainer->setLayout( pPatternEditorHScrollBarLayout ); QPalette label_palette; label_palette.setColor( QPalette::Foreground, QColor( 230, 230, 230 ) ); QFont boldFont; boldFont.setBold( true ); m_pPatternNameLbl = new QLabel( NULL ); m_pPatternNameLbl->setFont( boldFont ); m_pPatternNameLbl->setText( "pattern name label" ); m_pPatternNameLbl->setPalette(label_palette); // NOTE_PROPERTIES BUTTONS PixmapWidget *pPropertiesPanel = new PixmapWidget( NULL ); pPropertiesPanel->setColor( QColor( 58, 62, 72 ) ); pPropertiesPanel->setFixedSize( 181, 100 ); QVBoxLayout *pPropertiesVBox = new QVBoxLayout( pPropertiesPanel ); pPropertiesVBox->setSpacing( 0 ); pPropertiesVBox->setMargin( 0 ); __pPropertiesCombo = new LCDCombo( NULL, 20); __pPropertiesCombo->setToolTip(trUtf8("Select note properties")); __pPropertiesCombo->addItem( trUtf8("Velocity") ); __pPropertiesCombo->addItem( trUtf8("Pan") ); __pPropertiesCombo->addItem( trUtf8("Lead and Lag") ); __pPropertiesCombo->addItem( trUtf8("NoteKey") ); __pPropertiesCombo->update(); connect( __pPropertiesCombo, SIGNAL(valueChanged(QString)), this, SLOT(propertiesComboChanged(QString))); pPropertiesVBox->addWidget( __pPropertiesCombo ); //~ NOTE_PROPERTIES BUTTONS // LAYOUT QWidget *pMainPanel = new QWidget(); QGridLayout *pGrid = new QGridLayout(); pGrid->setSpacing( 0 ); pGrid->setMargin( 0 ); pGrid->addWidget( editor_top, 0, 0); pGrid->addWidget( editor_top_2, 0, 1, 1, 3); pGrid->addWidget( m_pPatternNameLbl, 1, 0 ); pGrid->addWidget( m_pRulerScrollView, 1, 1 ); pGrid->addWidget( m_pInstrListScrollView, 2, 0 ); pGrid->addWidget( m_pEditorScrollView, 2, 1 ); pGrid->addWidget( m_pPianoRollScrollView, 2, 1 ); pGrid->addWidget( m_pPatternEditorVScrollBar, 2, 2 ); pGrid->addWidget( pPatternEditorHScrollBarContainer, 10, 1 ); pGrid->addWidget( m_pNoteVelocityScrollView, 4, 1 ); pGrid->addWidget( m_pNotePanScrollView, 4, 1 ); pGrid->addWidget( m_pNoteLeadLagScrollView, 4, 1 ); pGrid->addWidget( m_pNoteNoteKeyScrollView, 4, 1 ); pGrid->addWidget( pPropertiesPanel, 4, 0 ); pGrid->setRowStretch( 2, 100 ); pMainPanel->setLayout( pGrid ); // restore grid resolution int nIndex; if ( pPref->isPatternEditorUsingTriplets() == false ) { switch ( pPref->getPatternEditorGridResolution() ) { case 4: __resolution_combo->set_text( "4" ); nIndex = 0; break; case 8: __resolution_combo->set_text( "8" ); nIndex = 1; break; case 16: __resolution_combo->set_text( "16" ); nIndex = 2; break; case 32: __resolution_combo->set_text( "32" ); nIndex = 3; break; case 64: __resolution_combo->set_text( "64" ); nIndex = 4; break; default: ERRORLOG( QString("Wrong grid resolution: %1").arg( pPref->getPatternEditorGridResolution() ) ); __resolution_combo->set_text( "4" ); nIndex = 0; } } else { switch ( pPref->getPatternEditorGridResolution() ) { case 8: __resolution_combo->set_text( "4T" ); nIndex = 5; break; case 16: __resolution_combo->set_text( "8T" ); nIndex = 6; break; case 32: __resolution_combo->set_text( "16T" ); nIndex = 7; break; case 64: __resolution_combo->set_text( "32T" ); nIndex = 8; break; default: ERRORLOG( QString("Wrong grid resolution: %1").arg( pPref->getPatternEditorGridResolution() ) ); __resolution_combo->set_text( "4T" ); nIndex = 5; } } gridResolutionChanged(__resolution_combo->getText()); //set pre delete __recpredelete->setCurrentIndex(pPref->m_nRecPreDelete); __recpostdelete->setCurrentIndex(pPref->m_nRecPostDelete); displayorHidePrePostCB(); // LAYOUT QVBoxLayout *pVBox = new QVBoxLayout(); pVBox->setSpacing( 0 ); pVBox->setMargin( 0 ); this->setLayout( pVBox ); pVBox->addWidget( pMainPanel ); HydrogenApp::get_instance()->addEventListener( this ); selectedPatternChangedEvent(); // force an update __pPropertiesCombo->set_text( trUtf8("Velocity")); }
PlaylistDialog::PlaylistDialog ( QWidget* pParent ) : QDialog ( pParent ) , Object ( __class_name ) { setupUi ( this ); INFOLOG ( "INIT" ); setWindowTitle ( trUtf8 ( "Playlist Browser" ) + QString(" - ") + Playlist::get_instance()->get_filename() ); setFixedSize ( width(), height() ); installEventFilter( this ); // menubar QMenuBar *m_pMenubar = new QMenuBar( this ); // Playlist menu QMenu *m_pPlaylistMenu = m_pMenubar->addMenu( trUtf8( "&Playlist" ) ); m_pPlaylistMenu->addAction( trUtf8( "Add song to Play&list" ), this, SLOT( addSong() ), QKeySequence( "" ) ); m_pPlaylistMenu->addAction( trUtf8( "Add ¤t song to Playlist" ), this, SLOT( addCurrentSong() ), QKeySequence( "" ) ); m_pPlaylistMenu->addSeparator(); // ----- m_pPlaylistMenu->addAction( trUtf8( "&Remove selected song from Playlist" ), this, SLOT( removeFromList() ), QKeySequence( "" ) ); m_pPlaylistMenu->addAction( trUtf8( "&New Playlist" ), this, SLOT( clearPlaylist() ), QKeySequence( "" ) ); m_pPlaylistMenu->addSeparator(); m_pPlaylistMenu->addAction( trUtf8( "&Open Playlist" ), this, SLOT( loadList() ), QKeySequence( "" ) ); m_pPlaylistMenu->addSeparator(); m_pPlaylistMenu->addAction( trUtf8( "&Save Playlist" ), this, SLOT( saveList() ), QKeySequence( "" ) ); m_pPlaylistMenu->addAction( trUtf8( "Save Playlist &as" ), this, SLOT( saveListAs() ), QKeySequence( "" ) ); #ifdef WIN32 //no scripts under windows #else // Script menu QMenu *m_pScriptMenu = m_pMenubar->addMenu( trUtf8( "&Scripts" ) ); m_pScriptMenu->addAction( trUtf8( "&Add Script to selected song" ), this, SLOT( loadScript() ), QKeySequence( "" ) ); m_pScriptMenu->addAction( trUtf8( "&Edit selected Script" ), this, SLOT( editScript() ), QKeySequence( "" ) ); m_pScriptMenu->addSeparator(); m_pScriptMenu->addAction( trUtf8( "&Remove selected Script" ), this, SLOT( removeScript() ), QKeySequence( "" ) ); m_pScriptMenu->addSeparator(); m_pScriptMenu->addAction( trUtf8( "&Create a new Script" ), this, SLOT( newScript() ), QKeySequence( "" ) ); #endif // CONTROLS PixmapWidget *pControlsPanel = new PixmapWidget( NULL ); pControlsPanel->setFixedSize( 119, 32 ); pControlsPanel->setPixmap( "/playerControlPanel/playlist_background_Control.png" ); vboxLayout->addWidget( pControlsPanel ); // Rewind button m_pRwdBtn = new Button( pControlsPanel, "/playerControlPanel/btn_rwd_on.png", "/playerControlPanel/btn_rwd_off.png", "/playerControlPanel/btn_rwd_over.png", QSize(21, 15) ); m_pRwdBtn->move(6, 6); m_pRwdBtn->setToolTip( trUtf8("Rewind") ); connect(m_pRwdBtn, SIGNAL(clicked(Button*)), this, SLOT(rewindBtnClicked(Button*))); // Play button m_pPlayBtn = new ToggleButton( pControlsPanel, "/playerControlPanel/btn_play_on.png", "/playerControlPanel/btn_play_off.png", "/playerControlPanel/btn_play_over.png", QSize(33, 17) ); m_pPlayBtn->move(33, 6); m_pPlayBtn->setPressed(false); m_pPlayBtn->setToolTip( trUtf8("Play/ Pause/ Load selected song") ); connect(m_pPlayBtn, SIGNAL(clicked(Button*)), this, SLOT(nodePlayBTN(Button*))); // Stop button m_pStopBtn = new Button( pControlsPanel, "/playerControlPanel/btn_stop_on.png", "/playerControlPanel/btn_stop_off.png", "/playerControlPanel/btn_stop_over.png", QSize(21, 15) ); m_pStopBtn->move(65, 6); m_pStopBtn->setToolTip( trUtf8("Stop") ); connect(m_pStopBtn, SIGNAL(clicked(Button*)), this, SLOT(nodeStopBTN(Button*))); // Fast forward button m_pFfwdBtn = new Button( pControlsPanel, "/playerControlPanel/btn_ffwd_on.png", "/playerControlPanel/btn_ffwd_off.png", "/playerControlPanel/btn_ffwd_over.png", QSize(21, 15) ); m_pFfwdBtn->move(92, 6); m_pFfwdBtn->setToolTip( trUtf8("Fast Forward") ); connect(m_pFfwdBtn, SIGNAL(clicked(Button*)), this, SLOT(ffWDBtnClicked(Button*))); #ifdef WIN32 QStringList headers; headers << trUtf8 ( "Song list" ); QTreeWidgetItem* header = new QTreeWidgetItem ( headers ); m_pPlaylistTree->setHeaderItem ( header ); m_pPlaylistTree->setAlternatingRowColors( true ); /*addSongBTN->setEnabled ( true ); loadListBTN->setEnabled ( true ); removeFromListBTN->setEnabled ( false ); removeFromListBTN->setEnabled ( false ); saveListBTN->setEnabled ( false ); saveListAsBTN->setEnabled ( false ); loadScriptBTN->hide(); removeScriptBTN->hide(); editScriptBTN->hide(); newScriptBTN->hide(); clearPlBTN->setEnabled ( false );*/ QVBoxLayout *sideBarLayout = new QVBoxLayout(sideBarWidget); sideBarLayout->setSpacing(0); sideBarLayout->setMargin(0); #else QStringList headers; headers << trUtf8 ( "Song list" ) << trUtf8 ( "Script" ) << trUtf8 ( "exec Script" ); QTreeWidgetItem* header = new QTreeWidgetItem ( headers ); m_pPlaylistTree->setHeaderItem ( header ); m_pPlaylistTree->header()->resizeSection ( 0, 405 ); m_pPlaylistTree->header()->resizeSection ( 1, 405 ); m_pPlaylistTree->header()->resizeSection ( 2, 15 ); m_pPlaylistTree->setAlternatingRowColors( true ); QVBoxLayout *sideBarLayout = new QVBoxLayout(sideBarWidget); sideBarLayout->setSpacing(0); sideBarLayout->setMargin(0); #endif // zoom-in btn Button *up_btn = new Button( NULL, "/songEditor/btn_up_on.png", "/songEditor/btn_up_off.png", "/songEditor/btn_up_over.png", QSize(18, 13) ); up_btn->setFontSize(7); up_btn->setToolTip( trUtf8( "sort" ) ); connect(up_btn, SIGNAL(clicked(Button*)), this, SLOT(o_upBClicked()) ); sideBarLayout->addWidget(up_btn); // zoom-in btn Button *down_btn = new Button( NULL, "/songEditor/btn_down_on.png", "/songEditor/btn_down_off.png", "/songEditor/btn_down_over.png", QSize(18, 13) ); down_btn->setFontSize(7); down_btn->setToolTip( trUtf8( "sort" ) ); connect(down_btn, SIGNAL(clicked(Button*)), this, SLOT(o_downBClicked())); sideBarLayout->addWidget(down_btn); //restore the playlist if( Hydrogen::get_instance()->m_PlayList.size() > 0 ){ for ( uint i = 0; i < Hydrogen::get_instance()->m_PlayList.size(); ++i ){ QTreeWidgetItem* m_pPlaylistItem = new QTreeWidgetItem ( m_pPlaylistTree ); m_pPlaylistItem->setText ( 0, Hydrogen::get_instance()->m_PlayList[i].m_hFile ); m_pPlaylistItem->setText ( 1, Hydrogen::get_instance()->m_PlayList[i].m_hScript ); if ( Hydrogen::get_instance()->m_PlayList[i].m_hScriptEnabled == "Use Script" ) { m_pPlaylistItem->setCheckState( 2, Qt::Checked ); }else{ m_pPlaylistItem->setCheckState( 2, Qt::Unchecked ); } } //restore the selected item int selected = Playlist::get_instance()->getActiveSongNumber(); int Selected = Playlist::get_instance()->getSelectedSongNr(); if( selected == -1 && Selected == -1 ) return; int aselected = 0; if( selected == -1 ){ aselected = Selected; } else { aselected = selected ; } QTreeWidget* m_pPlaylist = m_pPlaylistTree; QTreeWidgetItem* m_pPlaylistItem = m_pPlaylist->topLevelItem ( aselected ); m_pPlaylistItem->setBackgroundColor ( 0, QColor( 50, 50, 50) ); m_pPlaylistItem->setBackgroundColor ( 1, QColor( 50, 50, 50) ); m_pPlaylistItem->setBackgroundColor ( 2, QColor( 50, 50, 50) ); } timer = new QTimer( this ); connect(timer, SIGNAL(timeout() ), this, SLOT( updateActiveSongNumber() ) ); timer->start( 1000 ); // update player control at 1 fps }
PlayerControl::PlayerControl(QWidget *parent) : QLabel(parent) , Object( __class_name ) { // Background image setPixmap( QPixmap( Skin::getImagePath() + "/playerControlPanel/background.png" ) ); setScaledContents( true ); QHBoxLayout *hbox = new QHBoxLayout(); hbox->setSpacing( 0 ); hbox->setMargin( 0 ); setLayout( hbox ); // CONTROLS PixmapWidget *pControlsPanel = new PixmapWidget( NULL ); pControlsPanel->setFixedSize( 344, 43 ); pControlsPanel->setPixmap( "/playerControlPanel/background_Control.png" ); hbox->addWidget( pControlsPanel ); m_pTimeDisplayH = new LCDDisplay( pControlsPanel, LCDDigit::LARGE_GRAY, 2 ); m_pTimeDisplayH->move( 27, 12 ); m_pTimeDisplayH->setText( "00" ); m_pTimeDisplayM = new LCDDisplay( pControlsPanel, LCDDigit::LARGE_GRAY, 2 ); m_pTimeDisplayM->move( 61, 12 ); m_pTimeDisplayM->setText( "00" ); m_pTimeDisplayS = new LCDDisplay( pControlsPanel, LCDDigit::LARGE_GRAY, 2 ); m_pTimeDisplayS->move( 95, 12 ); m_pTimeDisplayS->setText( "00" ); m_pTimeDisplayMS = new LCDDisplay( pControlsPanel, LCDDigit::SMALL_GRAY, 3 ); m_pTimeDisplayMS->move( 122, 16 ); m_pTimeDisplayMS->setText( "000" ); // Rewind button m_pRwdBtn = new Button( pControlsPanel, "/playerControlPanel/btn_rwd_on.png", "/playerControlPanel/btn_rwd_off.png", "/playerControlPanel/btn_rwd_over.png", QSize(21, 15) ); m_pRwdBtn->move(168, 17); m_pRwdBtn->setToolTip( trUtf8("Rewind") ); connect(m_pRwdBtn, SIGNAL(clicked(Button*)), this, SLOT(RewindBtnClicked(Button*))); // Record button m_pRecBtn = new ToggleButton( pControlsPanel, "/playerControlPanel/btn_rec_on.png", "/playerControlPanel/btn_rec_off.png", "/playerControlPanel/btn_rec_over.png", QSize(21, 15) ); m_pRecBtn->move(195, 17); m_pRecBtn->setPressed(false); m_pRecBtn->setHidden(false); m_pRecBtn->setToolTip( trUtf8("Record") ); connect(m_pRecBtn, SIGNAL(clicked(Button*)), this, SLOT(recBtnClicked(Button*))); connect(m_pRecBtn, SIGNAL(rightClicked(Button*)), this, SLOT(recBtnRightClicked(Button*))); MidiAction* pAction = new MidiAction("RECORD_READY"); m_pRecBtn->setAction( pAction ); // Record+delete button m_pRecDelBtn = new ToggleButton( pControlsPanel, "/playerControlPanel/btn_recdel_on.png", "/playerControlPanel/btn_recdel_off.png", "/playerControlPanel/btn_recdel_over.png", QSize(21, 15) ); m_pRecDelBtn->move(195, 17); m_pRecDelBtn->setPressed(false); m_pRecDelBtn->setHidden(true); m_pRecDelBtn->setToolTip( trUtf8("Destructive Record") ); connect(m_pRecDelBtn, SIGNAL(clicked(Button*)), this, SLOT(recBtnClicked(Button*))); connect(m_pRecDelBtn, SIGNAL(rightClicked(Button*)), this, SLOT(recBtnRightClicked(Button*))); // Play button m_pPlayBtn = new ToggleButton( pControlsPanel, "/playerControlPanel/btn_play_on.png", "/playerControlPanel/btn_play_off.png", "/playerControlPanel/btn_play_over.png", QSize(26, 17) ); m_pPlayBtn->move(222, 17); m_pPlayBtn->setPressed(false); m_pPlayBtn->setToolTip( trUtf8("Play/ Pause") ); connect(m_pPlayBtn, SIGNAL(clicked(Button*)), this, SLOT(playBtnClicked(Button*))); pAction = new MidiAction("PLAY"); m_pPlayBtn->setAction( pAction ); // Stop button m_pStopBtn = new Button( pControlsPanel, "/playerControlPanel/btn_stop_on.png", "/playerControlPanel/btn_stop_off.png", "/playerControlPanel/btn_stop_over.png", QSize(21, 15) ); m_pStopBtn->move(254, 17); m_pStopBtn->setToolTip( trUtf8("Stop") ); connect(m_pStopBtn, SIGNAL(clicked(Button*)), this, SLOT(stopBtnClicked(Button*))); pAction = new MidiAction("STOP"); m_pStopBtn->setAction( pAction ); // Fast forward button m_pFfwdBtn = new Button( pControlsPanel, "/playerControlPanel/btn_ffwd_on.png", "/playerControlPanel/btn_ffwd_off.png", "/playerControlPanel/btn_ffwd_over.png", QSize(21, 15) ); m_pFfwdBtn->move(281, 17); m_pFfwdBtn->setToolTip( trUtf8("Fast Forward") ); connect(m_pFfwdBtn, SIGNAL(clicked(Button*)), this, SLOT(FFWDBtnClicked(Button*))); // Loop song button button m_pSongLoopBtn = new ToggleButton( pControlsPanel, "/playerControlPanel/btn_loop_on.png", "/playerControlPanel/btn_loop_off.png", "/playerControlPanel/btn_loop_over.png", QSize(21, 15) ); m_pSongLoopBtn->move(310, 17); m_pSongLoopBtn->setToolTip( trUtf8("Loop song") ); connect( m_pSongLoopBtn, SIGNAL( clicked(Button*) ), this, SLOT( songLoopBtnClicked(Button*) ) ); // Live mode button m_pLiveModeBtn = new ToggleButton( pControlsPanel, "/playerControlPanel/statusLED_on.png", "/playerControlPanel/statusLED_off.png", "/playerControlPanel/statusLED_off.png", QSize(68, 9) ); m_pLiveModeBtn->move(180, 5); m_pLiveModeBtn->setPressed(true); m_pLiveModeBtn->setToolTip( trUtf8("Pattern Mode") ); connect(m_pLiveModeBtn, SIGNAL(clicked(Button*)), this, SLOT(liveModeBtnClicked(Button*))); // Song mode button m_pSongModeBtn = new ToggleButton( pControlsPanel, "/playerControlPanel/statusLED_on.png", "/playerControlPanel/statusLED_off.png", "/playerControlPanel/statusLED_off.png", QSize(68, 9) ); m_pSongModeBtn->move(253, 5); m_pSongModeBtn->setPressed(false); m_pSongModeBtn->setToolTip( trUtf8("Song Mode") ); connect(m_pSongModeBtn, SIGNAL(clicked(Button*)), this, SLOT(songModeBtnClicked(Button*))); //~ CONTROLS // BC on off PixmapWidget *pControlsBBTBConoffPanel = new PixmapWidget( NULL ); pControlsBBTBConoffPanel->setFixedSize( 15, 43 ); pControlsBBTBConoffPanel->setPixmap( "/playerControlPanel/onoff.png" ); hbox->addWidget( pControlsBBTBConoffPanel ); m_pBConoffBtn = new ToggleButton( pControlsBBTBConoffPanel, "/playerControlPanel/bc_on.png", "/playerControlPanel/bc_off.png", "/playerControlPanel/bc_off.png", QSize(10, 40) ); m_pBConoffBtn->move(1, 1); m_pBConoffBtn->setPressed(false); m_pBConoffBtn->setToolTip( trUtf8("BeatCounter Panel on") ); connect(m_pBConoffBtn, SIGNAL(clicked(Button*)), this, SLOT(bconoffBtnClicked(Button*))); //~ BC on off //beatcounter m_pControlsBCPanel = new PixmapWidget( NULL ); m_pControlsBCPanel->setFixedSize( 86, 43 ); m_pControlsBCPanel->setPixmap( "/playerControlPanel/beatConter_BG.png" ); hbox->addWidget( m_pControlsBCPanel ); m_pBCDisplayZ = new LCDDisplay( m_pControlsBCPanel, LCDDigit::LARGE_GRAY, 2 ); m_pBCDisplayZ->move( 36, 8 ); m_pBCDisplayZ->setText( "--" ); m_pBCDisplayT = new LCDDisplay( m_pControlsBCPanel, LCDDigit::SMALL_GRAY, 1 ); m_pBCDisplayT->move( 23, 26 ); m_pBCDisplayT->setText( "4" ); m_pBCDisplayB = new LCDDisplay( m_pControlsBCPanel, LCDDigit::SMALL_GRAY, 2 ); m_pBCDisplayB->move( 39, 26 ); // set display from 4 to 04. fix against qt4 transparent problem // m_pBCDisplayB->setText( "4" ); m_pBCDisplayB->setText( "04" ); m_pBCTUpBtn = new Button( m_pControlsBCPanel, "/lcd/LCDSpinBox_up_on.png", "/lcd/LCDSpinBox_up_off.png", "/lcd/LCDSpinBox_up_over.png", QSize(16, 8) ); m_pBCTUpBtn->move( 4, 6 ); connect( m_pBCTUpBtn, SIGNAL( clicked( Button* ) ), this, SLOT(bctButtonClicked( Button* ) ) ); m_pBCTDownBtn = new Button( m_pControlsBCPanel, "/lcd/LCDSpinBox_down_on.png", "/lcd/LCDSpinBox_down_off.png", "/lcd/LCDSpinBox_down_over.png", QSize(16, 8) ); m_pBCTDownBtn->move( 4, 16 ); connect( m_pBCTDownBtn, SIGNAL( clicked( Button* ) ), this, SLOT(bctButtonClicked( Button* ) ) ); m_pBCBUpBtn = new Button( m_pControlsBCPanel, "/lcd/LCDSpinBox_up_on.png", "/lcd/LCDSpinBox_up_off.png", "/lcd/LCDSpinBox_up_over.png", QSize(16, 8) ); m_pBCBUpBtn->move( 65, 6 ); connect( m_pBCBUpBtn, SIGNAL( clicked( Button* ) ), this, SLOT(bcbButtonClicked( Button* ) ) ); m_pBCBDownBtn = new Button( m_pControlsBCPanel, "/lcd/LCDSpinBox_down_on.png", "/lcd/LCDSpinBox_down_off.png", "/lcd/LCDSpinBox_down_over.png", QSize(16, 8) ); m_pBCBDownBtn->move( 65, 16 ); connect( m_pBCBDownBtn, SIGNAL( clicked( Button* ) ), this, SLOT(bcbButtonClicked( Button* ) ) ); m_pBCSetPlayBtn = new ToggleButton( m_pControlsBCPanel, "/playerControlPanel/btn_set_play_on.png", "/playerControlPanel/btn_set_play_off.png", "/playerControlPanel/btn_set_play_off.png", QSize(15, 13) ); m_pBCSetPlayBtn->move(67, 27); m_pBCSetPlayBtn->setPressed(false); m_pBCSetPlayBtn->setToolTip( trUtf8("Set BPM / Set BPM and play") ); connect(m_pBCSetPlayBtn, SIGNAL(clicked(Button*)), this, SLOT(bcSetPlayBtnClicked(Button*))); //~ beatcounter // BPM PixmapWidget *pBPMPanel = new PixmapWidget( NULL ); pBPMPanel->setFixedSize( 145, 43 ); pBPMPanel->setPixmap( "/playerControlPanel/background_BPM.png" ); hbox->addWidget( pBPMPanel ); // LCD BPM SpinBox m_pLCDBPMSpinbox = new LCDSpinBox( pBPMPanel, 6, LCDSpinBox::FLOAT, 30, 400 ); m_pLCDBPMSpinbox->move( 43, 6 ); connect( m_pLCDBPMSpinbox, SIGNAL(changed(LCDSpinBox*)), this, SLOT(bpmChanged())); connect( m_pLCDBPMSpinbox, SIGNAL(spinboxClicked()), this, SLOT(bpmClicked())); m_pBPMUpBtn = new Button( pBPMPanel, "/lcd/LCDSpinBox_up_on.png", "/lcd/LCDSpinBox_up_off.png", "/lcd/LCDSpinBox_up_over.png", QSize(16, 8) ); m_pBPMUpBtn->move( 12, 5 ); connect( m_pBPMUpBtn, SIGNAL( clicked( Button* ) ), this, SLOT(bpmButtonClicked( Button* ) ) ); connect( m_pBPMUpBtn, SIGNAL( mousePress( Button* ) ), this, SLOT(bpmButtonPressed( Button* ) ) ); m_pBPMDownBtn = new Button( pBPMPanel, "/lcd/LCDSpinBox_down_on.png", "/lcd/LCDSpinBox_down_off.png", "/lcd/LCDSpinBox_down_over.png", QSize(16, 8) ); m_pBPMDownBtn->move( 12, 14 ); connect( m_pBPMDownBtn, SIGNAL( clicked( Button* ) ), this, SLOT(bpmButtonClicked( Button* ) ) ); connect( m_pBPMDownBtn, SIGNAL( mousePress( Button* ) ), this, SLOT(bpmButtonPressed( Button* ) ) ); m_pRubberBPMChange = new ToggleButton( pBPMPanel, "/playerControlPanel/rubber_on.png", "/playerControlPanel/rubber_off.png", "/playerControlPanel/rubber_off.png", QSize(9, 37) ); m_pRubberBPMChange->move( 133, 3 ); m_pRubberBPMChange->setToolTip( trUtf8("Recalculate Rubberband modified samples if bpm will change") ); m_pRubberBPMChange->setPressed( Preferences::get_instance()->getRubberBandBatchMode()); connect( m_pRubberBPMChange, SIGNAL( clicked( Button* ) ), this, SLOT(rubberbandButtonToggle( Button* ) ) ); QString program = Preferences::get_instance()->m_rubberBandCLIexecutable; //test the path. if test fails, no button if ( QFile( program ).exists() == false) { m_pRubberBPMChange->hide(); } m_pMetronomeWidget = new MetronomeWidget( pBPMPanel ); m_pMetronomeWidget->resize( 85, 5 ); m_pMetronomeWidget->move( 42, 25 ); m_pMetronomeBtn = new ToggleButton( pBPMPanel, "/playerControlPanel/btn_metronome_on.png", "/playerControlPanel/btn_metronome_off.png", "/playerControlPanel/btn_metronome_over.png", QSize( 20, 13 ) ); m_pMetronomeBtn->move( 10, 26 ); m_pMetronomeBtn->setToolTip( trUtf8("Switch metronome on/off") ); connect( m_pMetronomeBtn, SIGNAL( clicked( Button* ) ), this, SLOT(metronomeButtonClicked( Button* ) ) ); pAction = new MidiAction("TOGGLE_METRONOME"); m_pMetronomeBtn->setAction( pAction ); //~ BPM // JACK PixmapWidget *pJackPanel = new PixmapWidget( NULL ); pJackPanel->setFixedSize( 113, 43 ); pJackPanel->setPixmap( "/playerControlPanel/background_Jack.png" ); hbox->addWidget( pJackPanel ); // Jack transport mode button m_pJackTransportBtn = new ToggleButton( pJackPanel, "/playerControlPanel/jackTransportBtn_on.png", "/playerControlPanel/jackTransportBtn_off.png", "/playerControlPanel/jackTransportBtn_over.png", QSize(45, 13) ); m_pJackTransportBtn->hide(); m_pJackTransportBtn->setPressed(true); m_pJackTransportBtn->setToolTip( trUtf8("Jack-transport on/off") ); connect(m_pJackTransportBtn, SIGNAL(clicked(Button*)), this, SLOT(jackTransportBtnClicked(Button*))); m_pJackTransportBtn->move(10, 26); //jack time master m_pJackMasterBtn = new ToggleButton( pJackPanel, "/playerControlPanel/jackMasterBtn_on.png", "/playerControlPanel/jackMasterBtn_off.png", "/playerControlPanel/jackMasterBtn_over.png", QSize(45, 13) ); m_pJackMasterBtn->hide(); m_pJackMasterBtn->setPressed(true); m_pJackMasterBtn->setToolTip( trUtf8("Jack-Time-Master on/off") ); connect(m_pJackMasterBtn, SIGNAL(clicked(Button*)), this, SLOT(jackMasterBtnClicked(Button*))); m_pJackMasterBtn->move(56, 26); //~ jack time master m_pEngine = Hydrogen::get_instance(); // CPU load widget m_pCpuLoadWidget = new CpuLoadWidget( pJackPanel ); // Midi Activity widget m_pMidiActivityWidget = new MidiActivityWidget( pJackPanel ); m_pMidiActivityWidget->move( 10, 14 ); m_pCpuLoadWidget->move( 10, 4 ); //~ JACK PixmapWidget *pLcdBackGround = new PixmapWidget( NULL ); pLcdBackGround->setFixedSize( 256, 43 ); pLcdBackGround->setPixmap( "/playerControlPanel/lcd_background.png" ); hbox->addWidget( pLcdBackGround ); m_pShowMixerBtn = new ToggleButton( pLcdBackGround, "/skin_btn_on.png", "/skin_btn_off.png", "/skin_btn_over.png", QSize( 80, 17 ), true ); m_pShowMixerBtn->move( 7, 6 ); m_pShowMixerBtn->setToolTip( trUtf8( "Show mixer" ) ); m_pShowMixerBtn->setText( trUtf8( "Mixer" ) ); connect(m_pShowMixerBtn, SIGNAL(clicked(Button*)), this, SLOT(showButtonClicked(Button*))); m_pShowInstrumentRackBtn = new ToggleButton( pLcdBackGround, "/skin_btn_on.png", "/skin_btn_off.png", "/skin_btn_over.png", QSize( 160, 17 ), true ); m_pShowInstrumentRackBtn->move( 88, 6 ); m_pShowInstrumentRackBtn->setToolTip( trUtf8( "Show Instrument Rack" ) ); m_pShowInstrumentRackBtn->setText( trUtf8( "Instrument rack" ) ); connect( m_pShowInstrumentRackBtn, SIGNAL( clicked(Button*) ), this, SLOT( showButtonClicked( Button*)) ); m_pStatusLabel = new LCDDisplay(pLcdBackGround , LCDDigit::SMALL_BLUE, 30, true ); m_pStatusLabel->move( 7, 25 ); hbox->addStretch( 1000 ); // this must be the last widget in the HBOX!! QTimer *timer = new QTimer( this ); connect(timer, SIGNAL(timeout()), this, SLOT(updatePlayerControl())); timer->start(100); // update player control at 10 fps m_pBPMTimer = new QTimer( this ); connect(m_pBPMTimer, SIGNAL(timeout()), this, SLOT(onBpmTimerEvent())); m_pStatusTimer = new QTimer( this ); connect( m_pStatusTimer, SIGNAL( timeout() ), this, SLOT( onStatusTimerEvent() ) ); m_pScrollTimer = new QTimer( this ); connect( m_pScrollTimer, SIGNAL( timeout() ), this, SLOT( onScrollTimerEvent() ) ); m_pScrollMessage = ""; }
PostWidget::PostWidget(QString channel, Widget* p_pMatrix) : m_Channel(channel) , m_pMatrix(p_pMatrix) , sub_tb() , sub() { QVBoxLayout* layout = new QVBoxLayout; setLayout(layout); setFixedWidth(CHANNEL_WIDTH); layout->setSpacing(0); layout->setMargin(0); { m_pLabel = new QLabel(channel); m_pLabel->setFixedWidth(CHANNEL_WIDTH); m_pLabel->setAlignment(Qt::AlignHCenter); layout->addWidget(m_pLabel); } QWidget *prevol = m_pMatrix->createRotary(POST, channel, PRE_VOL); layout->addWidget(prevol); Toggle* mute = m_pMatrix->createToggle(POST, channel, MUTE); layout->addWidget(mute); Toggle* pfl = m_pMatrix->createToggle(POST, channel, TO_PFL); layout->addWidget(pfl); Widget::addSpacer(layout); { QLabel *label = new QLabel(trUtf8("Return")); label->setFixedWidth(CHANNEL_WIDTH); label->setAlignment(Qt::AlignHCenter); layout->addWidget(label); } Toggle* afl = m_pMatrix->createToggle(POST, channel, TO_AFL); layout->addWidget(afl); wSub = new QWidget; lSub = new QVBoxLayout; lSub->setSpacing(0); lSub->setMargin(0); wSub->setLayout(lSub); layout->addWidget(wSub); { PixmapWidget *pw = new PixmapWidget(NULL); pw->setPixmap("separator.svg"); pw->setFixedSize(CHANNEL_WIDTH, SEPARATOR_HEIGHT); layout->addWidget(pw); } QWidget *bal = m_pMatrix->createRotary(POST, channel, PAN_BAL); layout->addWidget(bal); { PixmapWidget *pw = new PixmapWidget(NULL); pw->setPixmap("separator.svg"); pw->setFixedSize(CHANNEL_WIDTH, SEPARATOR_HEIGHT); layout->addWidget(pw); } Toggle* main_on = m_pMatrix->createToggle(POST, channel, TO_MAIN); layout->addWidget(main_on); fader = m_pMatrix->createFader(POST, channel, FADER); layout->addWidget(fader); }
InWidget::InWidget(QString p_sChannel, Widget* p_pMatrix) : ChannelWidget() , m_Channel(p_sChannel) , m_pMatrix(p_pMatrix) , pre_tb() , post_tb() , sub_tb() , pre() , post() , sub() { QVBoxLayout* layout = new QVBoxLayout(); setLayout(layout); setFixedWidth(CHANNEL_WIDTH); layout->setSpacing(0); layout->setMargin(0); m_pLabel = new QLabel(p_sChannel); m_pLabel->setFixedWidth(CHANNEL_WIDTH); m_pLabel->setAlignment(Qt::AlignHCenter); layout->addWidget(m_pLabel); { PixmapWidget *pw = new PixmapWidget(NULL); pw->setPixmap("separator.svg"); pw->setFixedSize(CHANNEL_WIDTH, SEPARATOR_HEIGHT); layout->addWidget(pw); } QWidget *gain = m_pMatrix->createRotary(IN, p_sChannel, GAIN); layout->addWidget(gain); { PixmapWidget *pw = new PixmapWidget(NULL); pw->setPixmap("separator.svg"); pw->setFixedSize(CHANNEL_WIDTH, SEPARATOR_HEIGHT); layout->addWidget(pw); } Toggle* mute = m_pMatrix->createToggle(IN, p_sChannel, MUTE); layout->addWidget(mute); { PixmapWidget *pw = new PixmapWidget(NULL); pw->setPixmap("separator.svg"); pw->setFixedSize(CHANNEL_WIDTH, SEPARATOR_HEIGHT); layout->addWidget(pw); } Toggle* pfl = m_pMatrix->createToggle(IN, p_sChannel, TO_PFL); layout->addWidget(pfl); wPre = new QWidget; lPre = new QVBoxLayout; lPre->setSpacing(0); lPre->setMargin(0); wPre->setLayout(lPre); layout->addWidget(wPre); /* { PixmapWidget *pw = new PixmapWidget(NULL); pw->setPixmap("separator.svg"); pw->setFixedSize(CHANNEL_WIDTH, SEPARATOR_HEIGHT); layout->addWidget(pw); }*/ wPost = new QWidget; lPost = new QVBoxLayout; lPost->setSpacing(0); lPost->setMargin(0); wPost->setLayout(lPost); layout->addWidget(wPost); wSub = new QWidget; lSub = new QVBoxLayout; lSub->setSpacing(0); lSub->setMargin(0); wSub->setLayout(lSub); layout->addWidget(wSub); { PixmapWidget *pw = new PixmapWidget(NULL); pw->setPixmap("separator.svg"); pw->setFixedSize(CHANNEL_WIDTH, SEPARATOR_HEIGHT); layout->addWidget(pw); } QWidget *bal = m_pMatrix->createRotary(IN, p_sChannel, PAN_BAL); layout->addWidget(bal); { PixmapWidget *pw = new PixmapWidget(NULL); pw->setPixmap("separator.svg"); pw->setFixedSize(CHANNEL_WIDTH, SEPARATOR_HEIGHT); layout->addWidget(pw); } Toggle* main_on = m_pMatrix->createToggle(IN, p_sChannel, TO_MAIN); layout->addWidget(main_on); fader = m_pMatrix->createFader(IN, p_sChannel, FADER); layout->addWidget(fader); }
SongEditorPanel::SongEditorPanel(QWidget *pParent) : QWidget( pParent ) , Object( __class_name ) , m_actionMode( DRAW_ACTION ) { m_nInitialWidth = 600; m_nInitialHeight = 250; Preferences *pPref = Preferences::get_instance(); Hydrogen* pEngine = Hydrogen::get_instance(); Song* pSong = pEngine->getSong(); setWindowTitle( trUtf8( "Song Editor" ) ); // background PixmapWidget *pBackPanel = new PixmapWidget( NULL ); pBackPanel->setFixedSize( 196, 49 ); pBackPanel->setPixmap( "/songEditor/bg_topPanel.png" ); // time line toggle button m_pTimeLineToggleBtn = new ToggleButton( pBackPanel, "/songEditor/btn_bpm_on.png", "/songEditor/btn_bpm_off.png", "/songEditor/btn_bpm_over.png", QSize( 54, 13 ) ); m_pTimeLineToggleBtn->move( 133, 6 ); m_pTimeLineToggleBtn->setToolTip( trUtf8( "Enable time line edit") ); connect( m_pTimeLineToggleBtn, SIGNAL( clicked( Button* ) ), this, SLOT( timeLineBtnPressed(Button* ) ) ); m_pTimeLineToggleBtn->setPressed( pPref->getUseTimelineBpm() ); // clear sequence button m_pClearPatternSeqBtn = new Button( pBackPanel, "/songEditor/btn_clear_on.png", "/songEditor/btn_clear_off.png", "/songEditor/btn_clear_over.png", QSize(53,13) ); m_pClearPatternSeqBtn->move( 6, 5 + 25 ); m_pClearPatternSeqBtn->setToolTip( trUtf8("Clear pattern sequence") ); connect( m_pClearPatternSeqBtn, SIGNAL( clicked( Button* ) ), this, SLOT( clearSequence(Button*) ) ); // new pattern button Button *newPatBtn = new Button( pBackPanel, "/songEditor/btn_new_on.png", "/songEditor/btn_new_off.png", "/songEditor/btn_new_over.png", QSize(19, 13) ); newPatBtn->move( 64, 5 + 25); newPatBtn->setToolTip( trUtf8("Create new pattern") ); connect( newPatBtn, SIGNAL( clicked( Button* ) ), this, SLOT( newPatBtnClicked( Button* ) ) ); // down button m_pDownBtn = new Button( pBackPanel, "/songEditor/btn_down_on.png", "/songEditor/btn_down_off.png", "/songEditor/btn_down_over.png", QSize(18,13) ); m_pDownBtn->move( 89, 5 + 25); m_pDownBtn->setToolTip( trUtf8("Move the selected pattern down") ); connect( m_pDownBtn, SIGNAL( clicked( Button* ) ), this, SLOT( downBtnClicked( Button* ) ) ); // up button m_pUpBtn = new Button( pBackPanel, "/songEditor/btn_up_on.png", "/songEditor/btn_up_off.png", "/songEditor/btn_up_over.png", QSize(18,13) ); m_pUpBtn->move( 106, 5 + 25 ); m_pUpBtn->setToolTip( trUtf8("Move the selected pattern up") ); connect( m_pUpBtn, SIGNAL( clicked( Button* ) ), this, SLOT( upBtnClicked( Button* ) ) ); // select toggle button m_pPointerActionBtn = new ToggleButton( pBackPanel, "/songEditor/btn_select_on.png", "/songEditor/btn_select_off.png", "/songEditor/btn_select_over.png", QSize( 18, 13 ) ); m_pPointerActionBtn->move( 128, 5 + 25 ); m_pPointerActionBtn->setToolTip( trUtf8( "Select mode" ) ); connect( m_pPointerActionBtn, SIGNAL( clicked( Button* ) ), this, SLOT( pointerActionBtnPressed(Button*) ) ); // draw toggle button m_pDrawActionBtn = new ToggleButton( pBackPanel, "/songEditor/btn_draw_on.png", "/songEditor/btn_draw_off.png", "/songEditor/btn_draw_over.png", QSize( 18, 13 ) ); m_pDrawActionBtn->move( 147, 5 + 25 ); m_pDrawActionBtn->setToolTip( trUtf8( "Draw mode") ); connect( m_pDrawActionBtn, SIGNAL( clicked( Button* ) ), this, SLOT( drawActionBtnPressed(Button* ) ) ); m_pDrawActionBtn->setPressed( true ); m_pModeActionBtn = new ToggleButton( pBackPanel, "/songEditor/btn_mode_on.png", "/songEditor/btn_mode_off.png", "/songEditor/btn_mode_over.png", QSize( 18, 13 ) ); m_pModeActionBtn->move( 169, 5 + 25 ); m_pModeActionBtn->setToolTip( trUtf8( "stacked mode") ); m_pModeActionBtn->setPressed( pPref->patternModePlaysSelected() ); connect( m_pModeActionBtn, SIGNAL( clicked( Button* ) ), this, SLOT( modeActionBtnPressed() ) ); // ZOOM m_pHScrollBar = new QScrollBar( Qt::Horizontal,NULL ); connect( m_pHScrollBar, SIGNAL(valueChanged(int)), this, SLOT( syncToExternalScrollBar() ) ); // zoom-in btn Button* pZoomInBtn = new Button( NULL, "/songEditor/btn_new_on.png", "/songEditor/btn_new_off.png", "/songEditor/btn_new_over.png", QSize( 19, 13 ) ); connect( pZoomInBtn, SIGNAL( clicked( Button* ) ), this, SLOT( zoomOutBtnPressed(Button* ) ) ); // zoom-out btn Button* pZoomOutBtn = new Button( NULL, "/songEditor/btn_minus_on.png", "/songEditor/btn_minus_off.png", "/songEditor/btn_minus_over.png", QSize( 19, 13 ) ); connect( pZoomOutBtn, SIGNAL( clicked( Button* ) ), this, SLOT( zoomInBtnPressed(Button* ) ) ); // view playback track toggle button m_pViewPlaybackToggleBtn = new ToggleButton( NULL, "/songEditor/btn_viewPL_on.png", "/songEditor/btn_viewPL_off.png", "/songEditor/btn_viewPL_over.png", QSize( 19, 13 ) ); m_pViewPlaybackToggleBtn->setToolTip( trUtf8( "View playback track") ); connect( m_pViewPlaybackToggleBtn, SIGNAL( clicked( Button* ) ), this, SLOT( viewPlaybackTrackBtnPressed(Button* ) ) ); m_pViewPlaybackToggleBtn->setPressed( false ); // Playback Fader m_pPlaybackTrackFader = new VerticalFader( pBackPanel, false, false ); m_pPlaybackTrackFader->move( 6, 2 ); m_pPlaybackTrackFader->setMinValue( 0.0 ); m_pPlaybackTrackFader->setMaxValue( 1.5 ); m_pPlaybackTrackFader->setValue( pSong->get_playback_track_volume() ); m_pPlaybackTrackFader->hide(); connect( m_pPlaybackTrackFader, SIGNAL( valueChanged(Fader*) ), this, SLOT( faderChanged(Fader*) ) ); // mute playback track toggle button m_pMutePlaybackToggleBtn = new ToggleButton( pBackPanel, "/mixerPanel/master_mute_on.png", "/mixerPanel/master_mute_off.png", "/mixerPanel/master_mute_over.png", QSize( 42, 13 ) ); m_pMutePlaybackToggleBtn->setToolTip( trUtf8( "Mute playback track") ); m_pMutePlaybackToggleBtn->move( 151, 6 ); m_pMutePlaybackToggleBtn->hide(); connect( m_pMutePlaybackToggleBtn, SIGNAL( clicked( Button* ) ), this, SLOT( mutePlaybackTrackBtnPressed(Button* ) ) ); m_pMutePlaybackToggleBtn->setPressed( !pSong->get_playback_track_enabled() ); // edit playback track toggle button m_pEditPlaybackBtn = new Button( pBackPanel, "/mixerPanel/edit_on.png", "/mixerPanel/edit_off.png", "/mixerPanel/edit_over.png", QSize( 42, 13 ) ); m_pEditPlaybackBtn->setToolTip( trUtf8( "Choose playback track") ); m_pEditPlaybackBtn->move( 124, 6 ); m_pEditPlaybackBtn->hide(); connect( m_pEditPlaybackBtn, SIGNAL( clicked( Button* ) ), this, SLOT( editPlaybackTrackBtnPressed(Button* ) ) ); m_pEditPlaybackBtn->setPressed( false ); // timeline view toggle button m_pViewTimeLineToggleBtn = new ToggleButton( NULL, "/songEditor/btn_viewTL_on.png", "/songEditor/btn_viewTL_off.png", "/songEditor/btn_viewTL_over.png", QSize( 19, 13 ) ); m_pViewTimeLineToggleBtn->setToolTip( trUtf8( "View timeline") ); connect( m_pViewTimeLineToggleBtn, SIGNAL( clicked( Button* ) ), this, SLOT( viewTimeLineBtnPressed(Button* ) ) ); m_pViewTimeLineToggleBtn->setPressed( true ); QHBoxLayout *pHZoomLayout = new QHBoxLayout(); pHZoomLayout->setSpacing( 0 ); pHZoomLayout->setMargin( 0 ); pHZoomLayout->addWidget( m_pViewPlaybackToggleBtn ); pHZoomLayout->addWidget( m_pViewTimeLineToggleBtn ); pHZoomLayout->addWidget( m_pHScrollBar ); pHZoomLayout->addWidget( pZoomInBtn ); pHZoomLayout->addWidget( pZoomOutBtn ); QWidget *pHScrollbarPanel = new QWidget(); pHScrollbarPanel->setLayout( pHZoomLayout ); //~ ZOOM // PATTERN LIST m_pPatternListScrollView = new QScrollArea( NULL ); m_pPatternListScrollView->setFrameShape( QFrame::NoFrame ); m_pPatternListScrollView->setFixedWidth( m_nPatternListWidth ); m_pPatternListScrollView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); m_pPatternListScrollView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); connect( m_pPatternListScrollView->verticalScrollBar(), SIGNAL( valueChanged(int) ), this, SLOT( on_patternListScroll() ) ); m_pPatternList = new SongEditorPatternList( m_pPatternListScrollView->viewport() ); m_pPatternListScrollView->setWidget( m_pPatternList ); // EDITOR m_pEditorScrollView = new QScrollArea( NULL ); m_pEditorScrollView->setFrameShape( QFrame::NoFrame ); m_pEditorScrollView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); m_pEditorScrollView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); m_pSongEditor = new SongEditor( m_pEditorScrollView->viewport() ); m_pEditorScrollView->setWidget( m_pSongEditor ); connect( m_pEditorScrollView->horizontalScrollBar(), SIGNAL( valueChanged(int) ), this, SLOT( on_EditorScroll() ) ); connect( m_pEditorScrollView->verticalScrollBar(), SIGNAL( valueChanged(int) ), this, SLOT( on_EditorScroll() ) ); // POSITION RULER m_pPositionRulerScrollView = new QScrollArea( NULL ); m_pPositionRulerScrollView->setFrameShape( QFrame::NoFrame ); m_pPositionRulerScrollView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); m_pPositionRulerScrollView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); m_pPositionRulerScrollView->setFixedHeight( 50 ); m_pWidgetStack = new QStackedWidget( m_pPositionRulerScrollView ); m_pPositionRuler = new SongEditorPositionRuler( NULL ); m_pWaveDisplay = new WaveDisplay( m_pPositionRulerScrollView->viewport() ); InstrumentComponent *pCompo = AudioEngine::get_instance()->get_sampler()->__preview_instrument->get_components()->front(); assert(pCompo); m_pWaveDisplay->updateDisplay( pCompo->get_layer(0) ); m_pWidgetStack->addWidget( m_pPositionRuler ); m_pWidgetStack->addWidget( m_pWaveDisplay ); m_pPositionRulerScrollView->setWidgetResizable(true); m_pPositionRulerScrollView->setWidget( m_pWidgetStack ); m_pAutomationPathScrollView = new QScrollArea( NULL ); m_pAutomationPathScrollView->setFrameShape( QFrame::NoFrame ); m_pAutomationPathScrollView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); m_pAutomationPathScrollView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); m_pAutomationPathView = new AutomationPathView( m_pAutomationPathScrollView->viewport() ); m_pAutomationPathScrollView->setWidget( m_pAutomationPathView ); m_pAutomationPathScrollView->setFixedHeight( 64 ); connect( m_pAutomationPathView, SIGNAL( valueChanged() ), this, SLOT( automationPathChanged() ) ); connect( m_pAutomationPathView, SIGNAL( pointAdded(float, float) ), this, SLOT( automationPathPointAdded(float,float) ) ); connect( m_pAutomationPathView, SIGNAL( pointRemoved(float, float) ), this, SLOT( automationPathPointRemoved(float,float) ) ); connect( m_pAutomationPathView, SIGNAL( pointMoved(float, float, float, float) ), this, SLOT( automationPathPointMoved(float,float, float, float) ) ); m_pAutomationCombo = new LCDCombo( NULL, 22 ); m_pAutomationCombo->setToolTip( trUtf8("Adjust parameter values in time") ); m_pAutomationCombo->addItem( trUtf8("Velocity") ); m_pAutomationCombo->set_text( trUtf8("Velocity") ); m_pAutomationCombo->update(); m_pVScrollBar = new QScrollBar( Qt::Vertical, NULL ); connect( m_pVScrollBar, SIGNAL(valueChanged(int)), this, SLOT( syncToExternalScrollBar() ) ); // ok...let's build the layout QGridLayout *pGridLayout = new QGridLayout(); pGridLayout->setSpacing( 0 ); pGridLayout->setMargin( 0 ); pGridLayout->addWidget( pBackPanel, 0, 0 ); pGridLayout->addWidget( m_pPositionRulerScrollView, 0, 1 ); pGridLayout->addWidget( m_pPatternListScrollView, 1, 0 ); pGridLayout->addWidget( m_pEditorScrollView, 1, 1 ); pGridLayout->addWidget( m_pVScrollBar, 1, 2, 2, 1 ); pGridLayout->addWidget( m_pAutomationPathScrollView, 2, 1); pGridLayout->addWidget( m_pAutomationCombo, 2, 0, Qt::AlignTop | Qt::AlignRight ); pGridLayout->addWidget( pHScrollbarPanel, 3, 1 ); if( !pPref->getShowAutomationArea() ){ m_pAutomationPathScrollView->hide(); m_pAutomationCombo->hide(); } this->setLayout( pGridLayout ); QPalette defaultPalette; defaultPalette.setColor( QPalette::Background, QColor( 58, 62, 72 ) ); this->setPalette( defaultPalette ); show(); updateAll(); HydrogenApp::get_instance()->addEventListener( this ); m_pTimer = new QTimer(this); connect(m_pTimer, SIGNAL(timeout()), this, SLOT( updatePlayHeadPosition() ) ); connect(m_pTimer, SIGNAL(timeout()), this, SLOT( updatePlaybackFaderPeaks() ) ); m_pTimer->start(100); }