MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); this->setWindowIcon(QIcon(":/images/logo-0.png")); radio = new GstreamerRadio(); radio->init(); connect(radio, SIGNAL(bufferChanged(int)), this, SLOT(bufferChanged(int))); connect(¤tSong, SIGNAL(songChanged()), this, SLOT(songChanged())); loadSettings(); setEffects(); }
//--------------------------------------------------------- void PlayerInterface::checkSongChange(SongInfo &song) { if(song.songName != m_currentSong.songName) { qDebug() << "Song changed: " << song.songName; emit songChanged(song); m_currentSong = song; if(song.isValid()) downloadSongArt(song.artUrl); if(playbackStatus() == Playing && song.isValid()) { m_startedSong = song; emit songStarted(song); } else m_startedSong = SongInfo(); // invalid song } else if(song.isValid() && !m_startedSong.isValid() && playbackStatus() == Playing) { // sometimes (depends on the player) a new song is active but not playing, // we only emit song started when a song is valid and the player is playing.s m_startedSong = song; emit songStarted(song); } }
void Transport::onPlayClicked() { QString fileName = ((CommAudio*)parent())->getSelectedSong(); if (fileName.isEmpty()) { QMessageBox(QMessageBox::Warning, "No Music Files", "There were no music files found. Try adding a folder which contains audio files.").exec(); } switch (playingState) { case STOPPED: AudioManager::instance()->playMusic(fileName); ui->playPushButton->setIcon(QIcon(ICON_PAUSE)); emit songChanged(); playingState = PLAYING; break; case PLAYING: AudioManager::instance()->togglePause(); ui->playPushButton->setIcon(QIcon(ICON_PLAY)); ui->statusLabel->setText("Paused"); playingState = PAUSED; break; case PAUSED: AudioManager::instance()->togglePause(); ui->playPushButton->setIcon(QIcon(ICON_PAUSE)); QString text = ((CommAudio*) parent())->getMuted() ? "Mute" : ""; ui->statusLabel->setText(text); playingState = PLAYING; break; } }
void Arranger::switchInfo(int n) { if (n == 2) { AudioStrip* w = (AudioStrip*)(trackInfo->getWidget(2)); if (w == 0 || selected != w->getTrack()) { if (w) { //fprintf(stderr, "Arranger::switchInfo deleting strip\n"); //delete w; w->deleteLater(); } w = new AudioStrip(trackInfo, (MusECore::AudioTrack*)selected); //w->setFocusPolicy(Qt::TabFocus); connect(MusEGlobal::song, SIGNAL(songChanged(MusECore::SongChangedFlags_t)), w, SLOT(songChanged(MusECore::SongChangedFlags_t))); connect(MusEGlobal::muse, SIGNAL(configChanged()), w, SLOT(configChanged())); w->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed)); trackInfo->addWidget(w, 2); w->show(); //setTabOrder(midiTrackInfo, w); tgrid->activate(); tgrid->update(); // muse-2 Qt4 } } if (trackInfo->curIdx() == n) return; trackInfo->raiseWidget(n); tgrid->activate(); tgrid->update(); // muse-2 Qt4 }
ClipListEdit::ClipListEdit(QWidget* parent) : TopWin(TopWin::CLIPLIST, parent, "cliplist", Qt::Window) { setWindowTitle(tr("MusE: Clip List Editor")); editor = new ClipListEditorBaseWidget; setCentralWidget(editor); QMenu* settingsMenu = menuBar()->addMenu(tr("Window &Config")); settingsMenu->addAction(subwinAction); settingsMenu->addAction(shareAction); settingsMenu->addAction(fullscreenAction); QFontMetrics fm(editor->view->font()); int fw = style()->pixelMetric(QStyle::PM_DefaultFrameWidth,0, this); // ddskrjo 0 int w = 2 + fm.width('9') * 9 + fm.width(':') * 3 + fw * 4; editor->view->setColumnWidth(COL_SAMPLERATE, w); editor->view->setColumnWidth(COL_LEN, w); connect(editor->view, SIGNAL(itemSelectionChanged()), SLOT(clipSelectionChanged())); connect(editor->view, SIGNAL(itemClicked(QTreeWidgetItem*, int)), SLOT(clicked(QTreeWidgetItem*, int))); connect(MusEGlobal::song, SIGNAL(songChanged(MusECore::SongChangedFlags_t)), SLOT(songChanged(MusECore::SongChangedFlags_t))); connect(editor->start, SIGNAL(valueChanged(const MusECore::Pos&)), SLOT(startChanged(const MusECore::Pos&))); connect(editor->len, SIGNAL(valueChanged(const MusECore::Pos&)), SLOT(lenChanged(const MusECore::Pos&))); updateList(); finalizeInit(); }
Transport::Transport(Ui::CommAudioClass* gui, QWidget* parent) : QObject(parent), ui(gui), playingState(STOPPED) { connect(ui->playPushButton, SIGNAL(clicked()), this, SLOT(onPlayClicked())); connect(ui->stopPushButton, SIGNAL(clicked()), this, SLOT(onStopClicked())); connect(ui->previousPushButton, SIGNAL(clicked()), this, SLOT(onPreviousClicked())); connect(ui->nextPushButton, SIGNAL(clicked()), this, SLOT(onNextClicked())); connect(ui->shufflePushButton, SIGNAL(clicked()), this, SLOT(onShuffleClicked())); connect(ui->loopPushButton, SIGNAL(clicked()), this, SLOT(onLoopClicked())); connect(this, SIGNAL(songChanged()), parent, SLOT(changeDisplayedSong())); connect(this, SIGNAL(songStopped()), parent, SLOT(clearDisplayedSong())); QSettings settings; loop = !settings.value("loop", false).toBool(); onLoopClicked(); shuffle = !settings.value("shuffle", false).toBool(); onShuffleClicked(); }
void Transport::onSongDoubleClicked(QString songName) { AudioManager::instance()->playMusic(songName); ui->playPushButton->setIcon(QIcon(ICON_PAUSE)); QString text = ((CommAudio*) parent())->getMuted() ? "Mute" : ""; ui->statusLabel->setText(text); emit songChanged(); playingState = PLAYING; }
void AbstractMidiEditor::removePart(int sn)/*{{{*/ { if(_parts.size() >= 2) { _parts.remove(sn); } songChanged(SC_PART_REMOVED); }/*}}}*/
void AbstractMidiEditor::addPart(Part* p)/*{{{*/ { if(p) { _parts.push_back(p->sn()); songChanged(SC_PART_INSERTED); //setCurCanvasPart(p); } }/*}}}*/
void AbstractMidiEditor::removeParts(PartList* pl)/*{{{*/ { if(pl) { for(iPart i = pl->begin(); i != pl->end(); ++i) { if(hasPart(i->second->sn()) && _parts.size() >= 2) _parts.remove(i->second->sn()); } songChanged(SC_PART_REMOVED); } }/*}}}*/
void Transport::onPreviousClicked() { QString fileName = ((CommAudio*) parent())->getUserSongs()->getPrevSong(loop); if (fileName.isEmpty()) { return; } AudioManager::instance()->playMusic(fileName); ui->playPushButton->setIcon(QIcon(ICON_PAUSE)); emit songChanged(); playingState = PLAYING; }
void AbstractMidiEditor::addParts(PartList* pl)/*{{{*/ { if(pl) { for(iPart i = pl->begin(); i != pl->end(); ++i) { if(!hasPart(i->second->sn())) _parts.push_back(i->second->sn()); } songChanged(SC_PART_INSERTED); //setCurCanvasPart(p); } }/*}}}*/
void MainWindow::mkconnections() { connect(bar,SIGNAL(closeClicked()),SLOT(close())); connect(bar,SIGNAL(maximizeClicked(bool)),SLOT(showWind(bool))); connect(bar,SIGNAL(hideClicked()),SLOT(showMinimized())); connect(playlists,SIGNAL(songAdded(QString,QString)),&library,SLOT(addSongInPlaylist(QString,QString))); connect(bar,SIGNAL(addFilePressed()),SLOT(addFiles())); connect(bar,SIGNAL(addFolderPressed()),SLOT(addFolder())); connect(&player,SIGNAL(inPlaylist(bool)),SLOT(changePlayerConnections(bool))); connect(&library,SIGNAL(newSong(Song)),table,SLOT(addSongInList(Song))); connect(&player,SIGNAL(positionChanged(qint64)),bar,SIGNAL(seekChanged(qint64))); connect(&player,SIGNAL(currentSongChanged(Song)),bar,SIGNAL(songChanged(Song))); connect(bar,SIGNAL(playClicked()),&player,SLOT(playpause())); connect(addFile,SIGNAL(triggered()),SLOT(addFiles())); connect(actionAddFolder,SIGNAL(triggered()),SLOT(addFolder())); connect(actionOuvrir,SIGNAL(triggered()),SLOT(openFile())); connect(bar,SIGNAL(volumeChanged(int)),&player,SLOT(setVolume(int))); connect(bar,SIGNAL(positionChanged(int)),&player,SLOT(setPosition(int))); connect(bar,SIGNAL(seekBarPressed()),&player,SLOT(pause())); connect(bar,SIGNAL(seekBarReleased()),&player,SLOT(play())); connect(&player,SIGNAL(playbackStateChanged(bool)),bar,SLOT(changeButton(bool))); connect(tree,SIGNAL(albumChosen(QString,QString)),table,SLOT(showSongsFrom(QString,QString))); connect(tree,SIGNAL(artistChosen(QString)),table,SLOT(showSongsBy(QString))); connect(&library,SIGNAL(libraryChanged(Library*)),tree,SLOT(updateTree(Library*))); connect(table,SIGNAL(newPlaylist(Song)),this,SLOT(mkPlaylist(Song))); connect(playlists,SIGNAL(playlistChosen(QString)),table,SLOT(showSongsIn(QString))); connect(table,SIGNAL(deleteSong(Song,bool)),&library,SLOT(deleteSong(Song,bool))); connect(bar,SIGNAL(newQuery(QString,int)),table,SLOT(setQuery(QString,int))); connect(bar,SIGNAL(newPlaybackMode(QMediaPlaylist::PlaybackMode)),&player,SLOT(setPlayBackMode(QMediaPlaylist::PlaybackMode))); connect(table,SIGNAL(songChosen(int)),&player,SLOT(play(int))); connect(table,SIGNAL(newSongList(SongList)),&player,SLOT(update(SongList))); connect(&player,SIGNAL(inPlaylist(bool)),bar,SLOT(enableNavigation(bool))); connect(bar,SIGNAL(miniLecteur()),&mLecteur,SLOT(show())); connect(bar,SIGNAL(miniLecteur()),SLOT(hide())); connect(&mLecteur,SIGNAL(windowedMode()),SLOT(show())); connect(&mLecteur,SIGNAL(positionChanged(int)),bar,SIGNAL(positionChanged(int))); connect(&mLecteur,SIGNAL(seekBarPressed()),bar,SIGNAL(seekBarPressed())); connect(&mLecteur,SIGNAL(seekBarReleased()),bar,SIGNAL(seekBarReleased())); connect(&mLecteur,SIGNAL(positionChanged(int)),bar,SIGNAL(positionChanged(int))); connect(&mLecteur,SIGNAL(playClicked()),bar,SIGNAL(playClicked())); connect(&mLecteur,SIGNAL(nextClicked()),bar,SIGNAL(nextClicked())); connect(&mLecteur,SIGNAL(previousClicked()),bar,SIGNAL(previousClicked())); connect(&mLecteur,SIGNAL(volumeChanged(int)),bar,SIGNAL(volumeChanged(int))); connect(&player,SIGNAL(currentSongChanged(Song)),&mLecteur,SLOT(setNewSong(Song))); connect(&player,SIGNAL(positionChanged(qint64)),&mLecteur,SLOT(setPosition(qint64))); connect(&player,SIGNAL(playbackStateChanged(bool)),&mLecteur,SLOT(changeButton(bool))); connect(&player,SIGNAL(indexChanged(int,int)),table,SLOT(setIconTo(int,int))); connect(table,SIGNAL(addFileTriggered()),SLOT(addFiles())); connect(table,SIGNAL(addFolderTriggered()),SLOT(addFolder())); }
void Player::NextSong() { if (curr_track_num < songs->length()-1) { player->setMedia(songs->at(++curr_track_num).url()); player->play(); emit prevSongAvailabilityChanged(true); emit songChanged(); emit songIndexChanged(curr_track_num); } if (curr_track_num == songs->length()-1) emit nextSongAvailabilityChanged(false); }
void Player::PrevSong() { if (curr_track_num > 0) { player->setMedia(songs->at(--curr_track_num).url()); player->play(); emit nextSongAvailabilityChanged(true); emit songChanged(); emit songIndexChanged(curr_track_num); } if (curr_track_num == 0) emit prevSongAvailabilityChanged(false); }
void RouteMapDock::btnLinkClicked(bool)/*{{{*/ { QList<int> rows = getSelectedRows(); if (!rows.isEmpty()) { int id = rows.at(0); QStandardItem* path = _listModel->item(id, 0); if(path) { song->associatedRoute = path->text(); song->dirty = true; songChanged(-1); } } }/*}}}*/
void WaveEdit::songChanged1(MusECore::SongChangedFlags_t bits) { if(_isDeleting) // Ignore while while deleting to prevent crash. return; if (bits & SC_SOLO) { MusECore::WavePart* part = (MusECore::WavePart*)(parts()->begin()->second); solo->blockSignals(true); solo->setChecked(part->track()->solo()); solo->blockSignals(false); } songChanged(bits); }
void Transport::onNextClicked() { QString fileName; if (shuffle) { fileName = ((CommAudio*) parent())->getUserSongs()->getRandSong(loop); } else { fileName = ((CommAudio*) parent())->getUserSongs()->getNextSong(loop); } if (fileName.isEmpty()) { if (playingState == STOPPED) { ui->currentSongLabel->setText(""); } return; } AudioManager::instance()->playMusic(fileName); ui->playPushButton->setIcon(QIcon(ICON_PAUSE)); emit songChanged(); playingState = PLAYING; }
void Player::SetSongByIndex(QModelIndex index) { int row = index.row(); if (row != curr_track_num && row <= songs->length()-1 && row >= 0) { curr_track_num = row; player->setMedia(songs->at(curr_track_num).url()); player->play(); emit nextSongAvailabilityChanged(true); emit songChanged(); emit songIndexChanged(curr_track_num); } if (curr_track_num == 0) emit prevSongAvailabilityChanged(false); if (curr_track_num == songs->length()-1) emit nextSongAvailabilityChanged(false); }
void EventCanvas::selectAtTick(unsigned int tick)/*{{{*/ { CItemList list = _items; if(multiPartSelectionAction && !multiPartSelectionAction->isChecked()) list = getItemlistForCurrentPart(); //CItemList list = getItemlistForCurrentPart(); //Select note nearest tick, if none selected and there are any if (!list.empty() && selectionSize() == 0) { iCItem i = list.begin(); CItem* nearest = i->second; while (i != list.end()) { CItem* cur = i->second; unsigned int curtk = abs(cur->x() + cur->part()->tick() - tick); unsigned int neartk = abs(nearest->x() + nearest->part()->tick() - tick); if (curtk < neartk) { nearest = cur; } i++; } if (!nearest->isSelected()) { selectItem(nearest, true); if(editor->isGlobalEdit()) populateMultiSelect(nearest); songChanged(SC_SELECTION); } itemPressed(nearest); m_tempPlayItems.append(nearest); QTimer::singleShot(NOTE_PLAY_TIME, this, SLOT(playReleaseForItem())); } }/*}}}*/
MTScaleFlo::MTScaleFlo(ScoreCanvas* parent_editor, QWidget* parent_widget) : View(parent_widget, 1, 1) { setToolTip(tr("bar scale")); pos[0] = MusEGlobal::song->cpos(); pos[1] = MusEGlobal::song->lpos(); pos[2] = MusEGlobal::song->rpos(); xpos=0; xoffset=0; button = Qt::NoButton; setMouseTracking(true); connect(MusEGlobal::song, SIGNAL(posChanged(int, unsigned, bool)), SLOT(setPos(int, unsigned, bool))); connect(MusEGlobal::song, SIGNAL(songChanged(MusECore::SongChangedFlags_t)), SLOT(songChanged(MusECore::SongChangedFlags_t))); connect(MusEGlobal::song, SIGNAL(markerChanged(int)), SLOT(redraw())); connect(MusEGlobal::muse, SIGNAL(configChanged()), SLOT(configChanged())); parent=parent_editor; setFixedHeight(28); setBg(MusEGlobal::config.rulerBg); }
ClipListEdit::ClipListEdit(QWidget* parent) : TopWin(TopWin::CLIPLIST, parent, "cliplist", Qt::Window) { setWindowTitle(tr("MusE: Clip List Editor")); editor = new ClipListEditorBaseWidget; setCentralWidget(editor); QMenu* settingsMenu = menuBar()->addMenu(tr("Window &Config")); settingsMenu->addAction(subwinAction); settingsMenu->addAction(shareAction); settingsMenu->addAction(fullscreenAction); // NOTICE: Please ensure that any tool bar object names here match the names assigned // to identical or similar toolbars in class MusE or other TopWin classes. // This allows MusE::setCurrentMenuSharingTopwin() to do some magic // to retain the original toolbar layout. If it finds an existing // toolbar with the same object name, it /replaces/ it using insertToolBar(), // instead of /appending/ with addToolBar(). QFontMetrics fm(editor->view->font()); int fw = style()->pixelMetric(QStyle::PM_DefaultFrameWidth,0, this); // ddskrjo 0 int w = 2 + fm.width('9') * 9 + fm.width(':') * 3 + fw * 4; editor->view->setColumnWidth(COL_SAMPLERATE, w); editor->view->setColumnWidth(COL_LEN, w); connect(editor->view, SIGNAL(itemSelectionChanged()), SLOT(clipSelectionChanged())); connect(editor->view, SIGNAL(itemClicked(QTreeWidgetItem*, int)), SLOT(clicked(QTreeWidgetItem*, int))); connect(MusEGlobal::song, SIGNAL(songChanged(MusECore::SongChangedStruct_t)), SLOT(songChanged(MusECore::SongChangedStruct_t))); connect(editor->start, SIGNAL(valueChanged(const MusECore::Pos&)), SLOT(startChanged(const MusECore::Pos&))); connect(editor->len, SIGNAL(valueChanged(const MusECore::Pos&)), SLOT(lenChanged(const MusECore::Pos&))); updateList(); finalizeInit(); }
PlayerAdaptor::PlayerAdaptor (FDOPropsAdaptor *fdo, Player *player) : QDBusAbstractAdaptor (player) , Props_ (fdo) , Player_ (player) { setAutoRelaySignals (true); connect (Player_, SIGNAL (songChanged (MediaInfo)), this, SLOT (handleSongChanged ())); connect (Player_, SIGNAL (playModeChanged (Player::PlayMode)), this, SLOT (handlePlayModeChanged ())); connect (Player_->GetSourceObject (), SIGNAL (stateChanged (Phonon::State, Phonon::State)), this, SLOT (handleStateChanged ())); connect (Player_->GetAudioOutput (), SIGNAL (volumeChanged (qreal)), this, SLOT (handleVolumeChanged ())); }
LMaster::LMaster(QWidget* parent, const char* name) : MidiEditor(TopWin::LMASTER, 0, 0, parent, name) { pos_editor = 0; tempo_editor = 0; sig_editor = 0; key_editor = 0; editedItem = 0; editingNewItem = false; setWindowTitle(tr("MusE: Mastertrack")); setMinimumHeight(100); //setFixedWidth(400); // FIXME: Arbitrary. But without this, sig editor is too wide. Must fix sig editor width... setFocusPolicy(Qt::NoFocus); comboboxTimer=new QTimer(this); comboboxTimer->setInterval(150); comboboxTimer->setSingleShot(true); connect(comboboxTimer, SIGNAL(timeout()), this, SLOT(comboboxTimerSlot())); //---------Pulldown Menu---------------------------- menuEdit = menuBar()->addMenu(tr("&Edit")); QSignalMapper *signalMapper = new QSignalMapper(this); menuEdit->addActions(MusEGlobal::undoRedo->actions()); menuEdit->addSeparator(); tempoAction = menuEdit->addAction(tr("Insert Tempo")); signAction = menuEdit->addAction(tr("Insert Signature")); keyAction = menuEdit->addAction(tr("Insert Key")); posAction = menuEdit->addAction(tr("Edit Position")); valAction = menuEdit->addAction(tr("Edit Value")); delAction = menuEdit->addAction(tr("Delete Event")); delAction->setShortcut(Qt::Key_Delete); QMenu* settingsMenu = menuBar()->addMenu(tr("Window &Config")); settingsMenu->addAction(subwinAction); settingsMenu->addAction(shareAction); settingsMenu->addAction(fullscreenAction); connect(tempoAction, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(signAction, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(keyAction, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(posAction, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(valAction, SIGNAL(triggered()), signalMapper, SLOT(map())); connect(delAction, SIGNAL(triggered()), signalMapper, SLOT(map())); signalMapper->setMapping(tempoAction, CMD_INSERT_TEMPO); signalMapper->setMapping(signAction, CMD_INSERT_SIG); signalMapper->setMapping(keyAction, CMD_INSERT_KEY); signalMapper->setMapping(posAction, CMD_EDIT_BEAT); signalMapper->setMapping(valAction, CMD_EDIT_VALUE); signalMapper->setMapping(delAction, CMD_DELETE); connect(signalMapper, SIGNAL(mapped(int)), SLOT(cmd(int))); // Toolbars --------------------------------------------------------- // NOTICE: Please ensure that any tool bar object names here match the names assigned // to identical or similar toolbars in class MusE or other TopWin classes. // This allows MusE::setCurrentMenuSharingTopwin() to do some magic // to retain the original toolbar layout. If it finds an existing // toolbar with the same object name, it /replaces/ it using insertToolBar(), // instead of /appending/ with addToolBar(). addToolBarBreak(); QToolBar* edit = addToolBar(tr("Edit tools")); edit->setObjectName("Master List Edit Tools"); QToolButton* tempoButton = new QToolButton(); QToolButton* timeSigButton = new QToolButton(); QToolButton* keyButton = new QToolButton(); tempoButton->setFocusPolicy(Qt::NoFocus); timeSigButton->setFocusPolicy(Qt::NoFocus); keyButton->setFocusPolicy(Qt::NoFocus); tempoButton->setText(tr("Tempo")); timeSigButton->setText(tr("Timesig")); keyButton->setText(tr("Key")); tempoButton->setToolTip(tr("new tempo")); timeSigButton->setToolTip(tr("new signature")); keyButton->setToolTip(tr("new key")); edit->addWidget(tempoButton); edit->addWidget(timeSigButton); edit->addWidget(keyButton); //--------------------------------------------------- // master //--------------------------------------------------- view = new QTreeWidget; view->setAllColumnsShowFocus(true); view->setSelectionMode(QAbstractItemView::SingleSelection); QStringList columnnames; columnnames << tr("Meter") << tr("Time") << tr("Type") << tr("Value"); view->setHeaderLabels(columnnames); view->setColumnWidth(2,80); view->header()->setStretchLastSection(true); //--------------------------------------------------- // Rest //--------------------------------------------------- mainGrid->setRowStretch(0, 100); mainGrid->setColumnStretch(0, 100); mainGrid->addWidget(view, 0, 0); updateList(); tempo_editor = new QLineEdit(view->viewport()); tempo_editor->setFrame(false); tempo_editor->hide(); connect(tempo_editor, SIGNAL(returnPressed()), SLOT(returnPressed())); sig_editor = new SigEdit(view->viewport()); sig_editor->setFrame(false); sig_editor->hide(); connect(sig_editor, SIGNAL(returnPressed()), SLOT(returnPressed())); pos_editor = new PosEdit(view->viewport()); pos_editor->setFrame(false); pos_editor->hide(); connect(pos_editor, SIGNAL(returnPressed()), SLOT(returnPressed())); key_editor = new QComboBox(view->viewport()); key_editor->setFrame(false); key_editor->addItems(MusECore::keyStrs); key_editor->hide(); connect(key_editor, SIGNAL(activated(int)), SLOT(returnPressed())); connect(view, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), SLOT(select(QTreeWidgetItem*, QTreeWidgetItem*))); connect(view, SIGNAL(itemPressed(QTreeWidgetItem*, int)), SLOT(itemPressed(QTreeWidgetItem*, int))); connect(view, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)), SLOT(itemDoubleClicked(QTreeWidgetItem*))); connect(MusEGlobal::song, SIGNAL(songChanged(MusECore::SongChangedStruct_t)), SLOT(songChanged(MusECore::SongChangedStruct_t))); connect(this, SIGNAL(seekTo(int)), MusEGlobal::song, SLOT(seekTo(int))); connect(tempoButton, SIGNAL(clicked()), SLOT(tempoButtonClicked())); connect(timeSigButton, SIGNAL(clicked()), SLOT(timeSigButtonClicked())); connect(keyButton, SIGNAL(clicked()), SLOT(insertKey())); initShortcuts(); finalizeInit(); }
int refineBeat(int isBeat) { BOOL accepted=FALSE; BOOL predicted=FALSE; BOOL resyncin=FALSE; BOOL resyncout=FALSE; if (isBeat) // Show the beat received from AVS SliderStep(IDC_IN, &inSlide); DWORD TCNow = GetTickCount(); if (songChanged(TCNow)) { bestConfidence=(int)((float)bestConfidence*0.5); sticked=0; stickyConfidenceCount=0; if (cfg_smartbeatresetnewsong) ResetAdapt(); } // Try to predict if this frame should be a beat if (Bpm && TCNow > predictionLastTC + (60000 / Bpm)) predicted = TRUE; if (isBeat) // If it is a real beat, do discrimination/guessing and computations, then see if it is accepted accepted = TCHistStep(TCHist, Avg, halfDiscriminated, &hdPos, &lastTC, TCNow, BEAT_REAL); // Calculate current Bpm CalcBPM(); // If prediction Bpm has not yet been set // or if prediction bpm is too high or too low // or if 3/4 of our history buffer contains beats within the range of typical drift // the accept the calculated Bpm as the new prediction Bpm // This allows keeping the beat going on when the music fades out, and readapt to the new beat as soon as // the music fades in again if ((accepted || predicted) && !sticked && (!predictionBpm || predictionBpm > MAX_BPM || predictionBpm < MIN_BPM)) { if (Confidence >= bestConfidence) { /* betterConfidenceCount++; if (!predictionBpm || betterConfidenceCount == BETTER_CONF_ADOPT) {*/ forceNewBeat=1; /* betterConfidenceCount=0; }*/ } if (Confidence >= 50) { topConfidenceCount++; if (topConfidenceCount == TOP_CONF_ADOPT) { forceNewBeat=1; topConfidenceCount=0; } } if (forceNewBeat) { forceNewBeat=0; bestConfidence = Confidence; predictionBpm=Bpm; } } if (!sticked) predictionBpm = Bpm; Bpm=predictionBpm; /* resync = (predictionBpm && (predictionLastTC < TCNow - (30000/predictionBpm) - (60000/predictionBpm)*0.2) || (predictionLastTC < TCNow - (30000/predictionBpm) - (60000/predictionBpm)*0.2));*/ if (predictionBpm && accepted && !predicted) { int b; if (TCNow > predictionLastTC + (60000 / predictionBpm)*0.7) { resyncin = TRUE; b = (int)((float)predictionBpm * 1.01); } if (TCNow < predictionLastTC + (60000 / predictionBpm)*0.3) { int b; resyncout = TRUE; b = (int)((float)predictionBpm * 0.98); } if (!sticked && doResyncBpm && (resyncin || resyncout)) { newBpm(b); predictionBpm = GetBpm(); } } if (resyncin) { predictionLastTC = TCNow; SliderStep(IDC_OUT, &outSlide); doResyncBpm=TRUE; return ((cfg_smartbeat && !cfg_smartbeatonlysticky) || (cfg_smartbeat && cfg_smartbeatonlysticky && sticked)) ? 1 : isBeat; } if (predicted) { predictionLastTC = TCNow; if (Confidence > 25) TCHistStep(TCHist, Avg, halfDiscriminated, &hdPos, &lastTC, TCNow, BEAT_GUESSED); SliderStep(IDC_OUT, &outSlide); doResyncBpm=FALSE; return ((cfg_smartbeat && !cfg_smartbeatonlysticky) || (cfg_smartbeat && cfg_smartbeatonlysticky && sticked)) ? 1 : isBeat; } if (resyncout) { predictionLastTC = TCNow; doResyncBpm=TRUE; return ((cfg_smartbeat && !cfg_smartbeatonlysticky) || (cfg_smartbeat && cfg_smartbeatonlysticky && sticked)) ? 0 : isBeat; } return ((cfg_smartbeat && !cfg_smartbeatonlysticky) || (cfg_smartbeat && cfg_smartbeatonlysticky && sticked)) ? (predictionBpm ? 0 : isBeat) : isBeat; }
void RouteMapDock::btnClearClicked(bool)/*{{{*/ { song->associatedRoute = ""; song->dirty = true; songChanged(-1); }/*}}}*/
void MPConfig::mdevViewItemRenamed(QTableWidgetItem* item) { int col = item->column(); QString s = item->text(); //printf("MPConfig::mdevViewItemRenamed col:%d txt:%s\n", col, s.toLatin1().constData()); if (item == 0) return; switch (col) { case DEVCOL_DEF_IN_CHANS: { QString id = item->tableWidget()->item(item->row(), DEVCOL_NO)->text(); int no = atoi(id.toLatin1().constData()) - 1; if (no < 0 || no >= kMaxMidiPorts) return; midiPorts[no].setDefaultInChannels(((1 << kMaxMidiChannels) - 1) & string2bitmap(s)); song->update(); } break; case DEVCOL_DEF_OUT_CHANS: { QString id = item->tableWidget()->item(item->row(), DEVCOL_NO)->text(); int no = atoi(id.toLatin1().constData()) - 1; if (no < 0 || no >= kMaxMidiPorts) return; midiPorts[no].setDefaultOutChannels(((1 << kMaxMidiChannels) - 1) & string2bitmap(s)); song->update(); } break; case DEVCOL_NAME: { QString id = item->tableWidget()->item(item->row(), DEVCOL_NO)->text(); int no = atoi(id.toLatin1().constData()) - 1; if (no < 0 || no >= kMaxMidiPorts) return; MidiPort* port = &midiPorts[no]; MidiDevice* dev = port->device(); // Only Jack midi devices. if (!dev || dev->deviceType() != MidiDevice::JACK_MIDI) return; if (dev->name() == s) return; if (midiDevices.find(s)) { QMessageBox::critical(this, tr("LOS: bad device name"), tr("please choose a unique device name"), QMessageBox::Ok, Qt::NoButton, Qt::NoButton); songChanged(-1); return; } dev->setName(s); song->update(); } break; default: //printf("MPConfig::mdevViewItemRenamed unknown column clicked col:%d txt:%s\n", col, s.toLatin1().constData()); break; } }
ArrangerView::ArrangerView(QWidget* parent) : TopWin(TopWin::ARRANGER, parent, "arrangerview", Qt::Window) { setWindowTitle(tr("MusE: Arranger")); setFocusPolicy(Qt::NoFocus); arranger = new Arranger(this, "arranger"); setCentralWidget(arranger); //setFocusProxy(arranger); scoreOneStaffPerTrackMapper = new QSignalMapper(this); scoreAllInOneMapper = new QSignalMapper(this); editSignalMapper = new QSignalMapper(this); QShortcut* sc = new QShortcut(shortcuts[SHRT_DELETE].key, this); sc->setContext(Qt::WindowShortcut); connect(sc, SIGNAL(activated()), editSignalMapper, SLOT(map())); editSignalMapper->setMapping(sc, CMD_DELETE); // Toolbars --------------------------------------------------------- editTools = new EditToolBar(this, arrangerTools); addToolBar(editTools); editTools->setObjectName("arrangerTools"); visTracks = new VisibleTracks(this); addToolBar(visTracks); connect(editTools, SIGNAL(toolChanged(int)), arranger, SLOT(setTool(int))); connect(visTracks, SIGNAL(visibilityChanged()), MusEGlobal::song, SLOT(update()) ); connect(arranger, SIGNAL(editPart(MusECore::Track*)), MusEGlobal::muse, SLOT(startEditor(MusECore::Track*))); connect(arranger, SIGNAL(dropSongFile(const QString&)), MusEGlobal::muse, SLOT(loadProjectFile(const QString&))); connect(arranger, SIGNAL(dropMidiFile(const QString&)), MusEGlobal::muse, SLOT(importMidi(const QString&))); connect(arranger, SIGNAL(startEditor(MusECore::PartList*,int)), MusEGlobal::muse, SLOT(startEditor(MusECore::PartList*,int))); connect(arranger, SIGNAL(toolChanged(int)), editTools, SLOT(set(int))); connect(MusEGlobal::muse, SIGNAL(configChanged()), arranger, SLOT(configChanged())); connect(arranger, SIGNAL(setUsedTool(int)), editTools, SLOT(set(int))); connect(arranger, SIGNAL(selectionChanged()), SLOT(selectionChanged())); connect(MusEGlobal::song, SIGNAL(songChanged(MusECore::SongChangedFlags_t)), this, SLOT(songChanged(MusECore::SongChangedFlags_t))); //-------- Edit Actions editCutAction = new QAction(QIcon(*editcutIconSet), tr("C&ut"), this); editCopyAction = new QAction(QIcon(*editcopyIconSet), tr("&Copy"), this); editCopyRangeAction = new QAction(QIcon(*editcopyIconSet), tr("Copy in range"), this); editPasteAction = new QAction(QIcon(*editpasteIconSet), tr("&Paste"), this); editPasteCloneAction = new QAction(QIcon(*editpasteCloneIconSet), tr("Paste c&lone"), this); editPasteToTrackAction = new QAction(QIcon(*editpaste2TrackIconSet), tr("Paste to selected &track"), this); editPasteCloneToTrackAction = new QAction(QIcon(*editpasteClone2TrackIconSet), tr("Paste clone to selected trac&k"), this); editPasteDialogAction = new QAction(QIcon(*editpasteIconSet), tr("Paste (show dialo&g)"), this); editInsertEMAction = new QAction(QIcon(*editpasteIconSet), tr("&Insert Empty Measure"), this); editDeleteSelectedAction = new QAction(QIcon(*edit_track_delIcon), tr("Delete Selected Tracks"), this); editDuplicateSelTrackAction = new QAction(QIcon(*edit_track_addIcon), tr("Duplicate Selected Tracks"), this); editShrinkPartsAction = new QAction(tr("Shrink selected parts"), this); editExpandPartsAction = new QAction(tr("Expand selected parts"), this); editCleanPartsAction = new QAction(tr("Purge hidden events from selected parts"), this); addTrack = new QMenu(tr("Add Track"), this); addTrack->setIcon(QIcon(*edit_track_addIcon)); select = new QMenu(tr("Select"), this); select->setIcon(QIcon(*selectIcon)); editSelectAllAction = new QAction(QIcon(*select_allIcon), tr("Select &All"), this); editDeselectAllAction = new QAction(QIcon(*select_deselect_allIcon), tr("&Deselect All"), this); editInvertSelectionAction = new QAction(QIcon(*select_invert_selectionIcon), tr("Invert &Selection"), this); editInsideLoopAction = new QAction(QIcon(*select_inside_loopIcon), tr("&Inside Loop"), this); editOutsideLoopAction = new QAction(QIcon(*select_outside_loopIcon), tr("&Outside Loop"), this); editAllPartsAction = new QAction( QIcon(*select_all_parts_on_trackIcon), tr("All &Parts on Track"), this); scoreSubmenu = new QMenu(tr("Score"), this); scoreSubmenu->setIcon(QIcon(*scoreIconSet)); scoreAllInOneSubsubmenu = new QMenu(tr("all tracks in one staff"), this); scoreOneStaffPerTrackSubsubmenu = new QMenu(tr("one staff per track"), this); scoreSubmenu->addMenu(scoreAllInOneSubsubmenu); scoreSubmenu->addMenu(scoreOneStaffPerTrackSubsubmenu); updateScoreMenus(); startScoreEditAction = new QAction(*scoreIconSet, tr("New score window"), this); startPianoEditAction = new QAction(*pianoIconSet, tr("Pianoroll"), this); startDrumEditAction = new QAction(QIcon(*edit_drummsIcon), tr("Drums"), this); startListEditAction = new QAction(QIcon(*edit_listIcon), tr("List"), this); startWaveEditAction = new QAction(QIcon(*edit_waveIcon), tr("Wave"), this); master = new QMenu(tr("Mastertrack"), this); master->setIcon(QIcon(*edit_mastertrackIcon)); masterGraphicAction = new QAction(QIcon(*mastertrack_graphicIcon),tr("Graphic"), this); masterListAction = new QAction(QIcon(*mastertrack_listIcon),tr("List"), this); midiTransformerAction = new QAction(QIcon(*midi_transformIcon), tr("Midi &Transform"), this); //-------- Structure Actions strGlobalCutAction = new QAction(tr("Global Cut"), this); strGlobalInsertAction = new QAction(tr("Global Insert"), this); strGlobalSplitAction = new QAction(tr("Global Split"), this); strGlobalCutSelAction = new QAction(tr("Global Cut - selected tracks"), this); strGlobalInsertSelAction = new QAction(tr("Global Insert - selected tracks"), this); strGlobalSplitSelAction = new QAction(tr("Global Split - selected tracks"), this); //------------------------------------------------------------- // popup Edit //------------------------------------------------------------- QMenu* menuEdit = menuBar()->addMenu(tr("&Edit")); menuEdit->addActions(MusEGlobal::undoRedo->actions()); menuEdit->addSeparator(); menuEdit->addAction(editCutAction); menuEdit->addAction(editCopyAction); menuEdit->addAction(editCopyRangeAction); menuEdit->addAction(editPasteAction); menuEdit->addAction(editPasteToTrackAction); menuEdit->addAction(editPasteCloneAction); menuEdit->addAction(editPasteCloneToTrackAction); menuEdit->addAction(editPasteDialogAction); menuEdit->addAction(editInsertEMAction); menuEdit->addSeparator(); menuEdit->addAction(editShrinkPartsAction); menuEdit->addAction(editExpandPartsAction); menuEdit->addAction(editCleanPartsAction); menuEdit->addSeparator(); menuEdit->addAction(editDeleteSelectedAction); menuEdit->addMenu(addTrack); menuEdit->addAction(editDuplicateSelTrackAction); menuEdit->addMenu(select); select->addAction(editSelectAllAction); select->addAction(editDeselectAllAction); select->addAction(editInvertSelectionAction); select->addAction(editInsideLoopAction); select->addAction(editOutsideLoopAction); select->addAction(editAllPartsAction); menuEdit->addSeparator(); menuEdit->addAction(startPianoEditAction); menuEdit->addMenu(scoreSubmenu); menuEdit->addAction(startScoreEditAction); menuEdit->addAction(startDrumEditAction); menuEdit->addAction(startListEditAction); menuEdit->addAction(startWaveEditAction); menuEdit->addMenu(master); master->addAction(masterGraphicAction); master->addAction(masterListAction); menuEdit->addSeparator(); menuEdit->addAction(midiTransformerAction); QMenu* menuStructure = menuEdit->addMenu(tr("&Structure")); menuStructure->addAction(strGlobalCutAction); menuStructure->addAction(strGlobalInsertAction); menuStructure->addAction(strGlobalSplitAction); menuStructure->addSeparator(); menuStructure->addAction(strGlobalCutSelAction); menuStructure->addAction(strGlobalInsertSelAction); menuStructure->addAction(strGlobalSplitSelAction); QMenu* functions_menu = menuBar()->addMenu(tr("Functions")); QAction* func_quantize_action = functions_menu->addAction(tr("&Quantize Notes"), editSignalMapper, SLOT(map())); QAction* func_notelen_action = functions_menu->addAction(tr("Change note &length"), editSignalMapper, SLOT(map())); QAction* func_velocity_action = functions_menu->addAction(tr("Change note &velocity"), editSignalMapper, SLOT(map())); QAction* func_cresc_action = functions_menu->addAction(tr("Crescendo/Decrescendo"), editSignalMapper, SLOT(map())); QAction* func_transpose_action = functions_menu->addAction(tr("Transpose"), editSignalMapper, SLOT(map())); QAction* func_erase_action = functions_menu->addAction(tr("Erase Events (Not Parts)"), editSignalMapper, SLOT(map())); QAction* func_move_action = functions_menu->addAction(tr("Move Events (Not Parts)"), editSignalMapper, SLOT(map())); QAction* func_fixed_len_action = functions_menu->addAction(tr("Set Fixed Note Length"), editSignalMapper, SLOT(map())); QAction* func_del_overlaps_action = functions_menu->addAction(tr("Delete Overlapping Notes"), editSignalMapper, SLOT(map())); QAction* func_legato_action = functions_menu->addAction(tr("Legato"), editSignalMapper, SLOT(map())); editSignalMapper->setMapping(func_quantize_action, CMD_QUANTIZE); editSignalMapper->setMapping(func_notelen_action, CMD_NOTELEN); editSignalMapper->setMapping(func_velocity_action, CMD_VELOCITY); editSignalMapper->setMapping(func_cresc_action, CMD_CRESCENDO); editSignalMapper->setMapping(func_transpose_action, CMD_TRANSPOSE); editSignalMapper->setMapping(func_erase_action, CMD_ERASE); editSignalMapper->setMapping(func_move_action, CMD_MOVE); editSignalMapper->setMapping(func_fixed_len_action, CMD_FIXED_LEN); editSignalMapper->setMapping(func_del_overlaps_action, CMD_DELETE_OVERLAPS); editSignalMapper->setMapping(func_legato_action, CMD_LEGATO); QMenu* menuSettings = menuBar()->addMenu(tr("Window &Config")); menuSettings->addAction(tr("Configure &custom columns"), this, SLOT(configCustomColumns())); menuSettings->addSeparator(); menuSettings->addAction(subwinAction); menuSettings->addAction(shareAction); menuSettings->addAction(fullscreenAction); //-------- Edit connections connect(editCutAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editCopyAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editCopyRangeAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editPasteAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editPasteCloneAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editPasteToTrackAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editPasteCloneToTrackAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editPasteDialogAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editInsertEMAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editDeleteSelectedAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editDuplicateSelTrackAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editShrinkPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editExpandPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editCleanPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editSelectAllAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editDeselectAllAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editInvertSelectionAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editInsideLoopAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editOutsideLoopAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); connect(editAllPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map())); editSignalMapper->setMapping(editCutAction, CMD_CUT); editSignalMapper->setMapping(editCopyAction, CMD_COPY); editSignalMapper->setMapping(editCopyRangeAction, CMD_COPY_RANGE); editSignalMapper->setMapping(editPasteAction, CMD_PASTE); editSignalMapper->setMapping(editPasteCloneAction, CMD_PASTE_CLONE); editSignalMapper->setMapping(editPasteToTrackAction, CMD_PASTE_TO_TRACK); editSignalMapper->setMapping(editPasteCloneToTrackAction, CMD_PASTE_CLONE_TO_TRACK); editSignalMapper->setMapping(editPasteDialogAction, CMD_PASTE_DIALOG); editSignalMapper->setMapping(editInsertEMAction, CMD_INSERTMEAS); editSignalMapper->setMapping(editDeleteSelectedAction, CMD_DELETE_TRACK); editSignalMapper->setMapping(editDuplicateSelTrackAction, CMD_DUPLICATE_TRACK); editSignalMapper->setMapping(editShrinkPartsAction, CMD_SHRINK_PART); editSignalMapper->setMapping(editExpandPartsAction, CMD_EXPAND_PART); editSignalMapper->setMapping(editCleanPartsAction, CMD_CLEAN_PART); editSignalMapper->setMapping(editSelectAllAction, CMD_SELECT_ALL); editSignalMapper->setMapping(editDeselectAllAction, CMD_SELECT_NONE); editSignalMapper->setMapping(editInvertSelectionAction, CMD_SELECT_INVERT); editSignalMapper->setMapping(editInsideLoopAction, CMD_SELECT_ILOOP); editSignalMapper->setMapping(editOutsideLoopAction, CMD_SELECT_OLOOP); editSignalMapper->setMapping(editAllPartsAction, CMD_SELECT_PARTS); connect(editSignalMapper, SIGNAL(mapped(int)), this, SLOT(cmd(int))); connect(startPianoEditAction, SIGNAL(activated()), MusEGlobal::muse, SLOT(startPianoroll())); connect(startScoreEditAction, SIGNAL(activated()), MusEGlobal::muse, SLOT(startScoreQuickly())); connect(startDrumEditAction, SIGNAL(activated()), MusEGlobal::muse, SLOT(startDrumEditor())); connect(startListEditAction, SIGNAL(activated()), MusEGlobal::muse, SLOT(startListEditor())); connect(startWaveEditAction, SIGNAL(activated()), MusEGlobal::muse, SLOT(startWaveEditor())); connect(scoreOneStaffPerTrackMapper, SIGNAL(mapped(QWidget*)), MusEGlobal::muse, SLOT(openInScoreEdit_oneStaffPerTrack(QWidget*))); connect(scoreAllInOneMapper, SIGNAL(mapped(QWidget*)), MusEGlobal::muse, SLOT(openInScoreEdit_allInOne(QWidget*))); connect(masterGraphicAction, SIGNAL(activated()), MusEGlobal::muse, SLOT(startMasterEditor())); connect(masterListAction, SIGNAL(activated()), MusEGlobal::muse, SLOT(startLMasterEditor())); connect(midiTransformerAction, SIGNAL(activated()), MusEGlobal::muse, SLOT(startMidiTransformer())); //-------- Structure connections connect(strGlobalCutAction, SIGNAL(activated()), SLOT(globalCut())); connect(strGlobalInsertAction, SIGNAL(activated()), SLOT(globalInsert())); connect(strGlobalSplitAction, SIGNAL(activated()), SLOT(globalSplit())); connect(strGlobalCutSelAction, SIGNAL(activated()), SLOT(globalCutSel())); connect(strGlobalInsertSelAction, SIGNAL(activated()), SLOT(globalInsertSel())); connect(strGlobalSplitSelAction, SIGNAL(activated()), SLOT(globalSplitSel())); connect(MusEGlobal::muse, SIGNAL(configChanged()), SLOT(updateShortcuts())); QClipboard* cb = QApplication::clipboard(); connect(cb, SIGNAL(dataChanged()), SLOT(clipboardChanged())); connect(cb, SIGNAL(selectionChanged()), SLOT(clipboardChanged())); finalizeInit(); // work around for probable QT/WM interaction bug. // for certain window managers, e.g xfce, this window is // is displayed although not specifically set to show(); // bug: 2811156 Softsynth GUI unclosable with XFCE4 (and a few others) // Nov 21, 2012 Hey this causes the thing not to open at all, EVER, on Lubuntu and some others! // And we had a request to remove this from a knowledgable tester. REMOVE Tim. ///show(); ///hide(); }
WaveEdit::WaveEdit(MusECore::PartList* pl, QWidget* parent, const char* name) : MidiEditor(TopWin::WAVE, 1, pl, parent, name) { setFocusPolicy(Qt::NoFocus); colorMode = colorModeInit; QSignalMapper* mapper = new QSignalMapper(this); QSignalMapper* colorMapper = new QSignalMapper(this); QAction* act; //---------Pulldown Menu---------------------------- // We probably don't need an empty menu - Orcan //QMenu* menuFile = menuBar()->addMenu(tr("&File")); QMenu* menuEdit = menuBar()->addMenu(tr("&Edit")); menuFunctions = menuBar()->addMenu(tr("Func&tions")); menuGain = menuFunctions->addMenu(tr("&Gain")); act = menuGain->addAction("200%"); mapper->setMapping(act, WaveCanvas::CMD_GAIN_200); connect(act, SIGNAL(triggered()), mapper, SLOT(map())); act = menuGain->addAction("150%"); mapper->setMapping(act, WaveCanvas::CMD_GAIN_150); connect(act, SIGNAL(triggered()), mapper, SLOT(map())); act = menuGain->addAction("75%"); mapper->setMapping(act, WaveCanvas::CMD_GAIN_75); connect(act, SIGNAL(triggered()), mapper, SLOT(map())); act = menuGain->addAction("50%"); mapper->setMapping(act, WaveCanvas::CMD_GAIN_50); connect(act, SIGNAL(triggered()), mapper, SLOT(map())); act = menuGain->addAction("25%"); mapper->setMapping(act, WaveCanvas::CMD_GAIN_25); connect(act, SIGNAL(triggered()), mapper, SLOT(map())); act = menuGain->addAction(tr("Other")); mapper->setMapping(act, WaveCanvas::CMD_GAIN_FREE); connect(act, SIGNAL(triggered()), mapper, SLOT(map())); connect(mapper, SIGNAL(mapped(int)), this, SLOT(cmd(int))); menuFunctions->addSeparator(); copyAction = menuEdit->addAction(tr("&Copy")); mapper->setMapping(copyAction, WaveCanvas::CMD_EDIT_COPY); connect(copyAction, SIGNAL(triggered()), mapper, SLOT(map())); copyPartRegionAction = menuEdit->addAction(tr("&Create Part from Region")); mapper->setMapping(copyPartRegionAction, WaveCanvas::CMD_CREATE_PART_REGION); connect(copyPartRegionAction, SIGNAL(triggered()), mapper, SLOT(map())); cutAction = menuEdit->addAction(tr("C&ut")); mapper->setMapping(cutAction, WaveCanvas::CMD_EDIT_CUT); connect(cutAction, SIGNAL(triggered()), mapper, SLOT(map())); pasteAction = menuEdit->addAction(tr("&Paste")); mapper->setMapping(pasteAction, WaveCanvas::CMD_EDIT_PASTE); connect(pasteAction, SIGNAL(triggered()), mapper, SLOT(map())); act = menuEdit->addAction(tr("Edit in E&xternal Editor")); mapper->setMapping(act, WaveCanvas::CMD_EDIT_EXTERNAL); connect(act, SIGNAL(triggered()), mapper, SLOT(map())); menuEdit->addSeparator(); // REMOVE Tim. Also remove CMD_ADJUST_WAVE_OFFSET and so on... // adjustWaveOffsetAction = menuEdit->addAction(tr("Adjust wave offset...")); // mapper->setMapping(adjustWaveOffsetAction, WaveCanvas::CMD_ADJUST_WAVE_OFFSET); // connect(adjustWaveOffsetAction, SIGNAL(triggered()), mapper, SLOT(map())); act = menuFunctions->addAction(tr("Mute Selection")); mapper->setMapping(act, WaveCanvas::CMD_MUTE); connect(act, SIGNAL(triggered()), mapper, SLOT(map())); act = menuFunctions->addAction(tr("Normalize Selection")); mapper->setMapping(act, WaveCanvas::CMD_NORMALIZE); connect(act, SIGNAL(triggered()), mapper, SLOT(map())); act = menuFunctions->addAction(tr("Fade In Selection")); mapper->setMapping(act, WaveCanvas::CMD_FADE_IN); connect(act, SIGNAL(triggered()), mapper, SLOT(map())); act = menuFunctions->addAction(tr("Fade Out Selection")); mapper->setMapping(act, WaveCanvas::CMD_FADE_OUT); connect(act, SIGNAL(triggered()), mapper, SLOT(map())); act = menuFunctions->addAction(tr("Reverse Selection")); mapper->setMapping(act, WaveCanvas::CMD_REVERSE); connect(act, SIGNAL(triggered()), mapper, SLOT(map())); select = menuEdit->addMenu(QIcon(*selectIcon), tr("Select")); selectAllAction = select->addAction(QIcon(*select_allIcon), tr("Select &All")); mapper->setMapping(selectAllAction, WaveCanvas::CMD_SELECT_ALL); connect(selectAllAction, SIGNAL(triggered()), mapper, SLOT(map())); selectNoneAction = select->addAction(QIcon(*select_allIcon), tr("&Deselect All")); mapper->setMapping(selectNoneAction, WaveCanvas::CMD_SELECT_NONE); connect(selectNoneAction, SIGNAL(triggered()), mapper, SLOT(map())); select->addSeparator(); selectPrevPartAction = select->addAction(QIcon(*select_all_parts_on_trackIcon), tr("&Previous Part")); mapper->setMapping(selectPrevPartAction, WaveCanvas::CMD_SELECT_PREV_PART); connect(selectPrevPartAction, SIGNAL(triggered()), mapper, SLOT(map())); selectNextPartAction = select->addAction(QIcon(*select_all_parts_on_trackIcon), tr("&Next Part")); mapper->setMapping(selectNextPartAction, WaveCanvas::CMD_SELECT_NEXT_PART); connect(selectNextPartAction, SIGNAL(triggered()), mapper, SLOT(map())); QMenu* settingsMenu = menuBar()->addMenu(tr("Window &Config")); eventColor = settingsMenu->addMenu(tr("&Event Color")); QActionGroup* actgrp = new QActionGroup(this); actgrp->setExclusive(true); evColorNormalAction = actgrp->addAction(tr("&Part colors")); evColorNormalAction->setCheckable(true); colorMapper->setMapping(evColorNormalAction, 0); evColorPartsAction = actgrp->addAction(tr("&Gray")); evColorPartsAction->setCheckable(true); colorMapper->setMapping(evColorPartsAction, 1); connect(evColorNormalAction, SIGNAL(triggered()), colorMapper, SLOT(map())); connect(evColorPartsAction, SIGNAL(triggered()), colorMapper, SLOT(map())); eventColor->addActions(actgrp->actions()); connect(colorMapper, SIGNAL(mapped(int)), this, SLOT(eventColorModeChanged(int))); settingsMenu->addSeparator(); settingsMenu->addAction(subwinAction); settingsMenu->addAction(shareAction); settingsMenu->addAction(fullscreenAction); connect(MusEGlobal::muse, SIGNAL(configChanged()), SLOT(configChanged())); //-------------------------------------------------- // ToolBar: Solo Cursor1 Cursor2 tools2 = new MusEGui::EditToolBar(this, waveEditTools); addToolBar(tools2); addToolBarBreak(); tb1 = addToolBar(tr("WaveEdit tools")); tb1->setObjectName("WaveEdit tools"); //tb1->setLabel(tr("weTools")); solo = new QToolButton(); solo->setText(tr("Solo")); solo->setCheckable(true); solo->setFocusPolicy(Qt::NoFocus); tb1->addWidget(solo); connect(solo, SIGNAL(toggled(bool)), SLOT(soloChanged(bool))); QLabel* label = new QLabel(tr("Cursor")); tb1->addWidget(label); label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); label->setIndent(3); pos1 = new PosLabel(0); pos1->setFixedHeight(22); tb1->addWidget(pos1); pos2 = new PosLabel(0); pos2->setFixedHeight(22); pos2->setSmpte(true); tb1->addWidget(pos2); //--------------------------------------------------- // Rest //--------------------------------------------------- int yscale = 256; int xscale; if (!parts()->empty()) { // Roughly match total size of part MusECore::Part* firstPart = parts()->begin()->second; xscale = 0 - firstPart->lenFrame()/_widthInit[_type]; } else { xscale = -8000; } hscroll = new ScrollScale(-32768, 1, xscale, 10000, Qt::Horizontal, mainw, 0, false, 10000.0); //view = new WaveView(this, mainw, xscale, yscale); canvas = new WaveCanvas(this, mainw, xscale, yscale); //wview = canvas; // HACK! QSizeGrip* corner = new QSizeGrip(mainw); ymag = new QSlider(Qt::Vertical, mainw); ymag->setMinimum(1); ymag->setMaximum(256); ymag->setPageStep(256); ymag->setValue(yscale); ymag->setFocusPolicy(Qt::NoFocus); time = new MTScale(&_raster, mainw, xscale, true); ymag->setFixedWidth(16); connect(canvas, SIGNAL(mouseWheelMoved(int)), this, SLOT(moveVerticalSlider(int))); connect(ymag, SIGNAL(valueChanged(int)), canvas, SLOT(setYScale(int))); connect(canvas, SIGNAL(horizontalZoom(bool, const QPoint&)), SLOT(horizontalZoom(bool, const QPoint&))); connect(canvas, SIGNAL(horizontalZoom(int, const QPoint&)), SLOT(horizontalZoom(int, const QPoint&))); time->setOrigin(0, 0); mainGrid->setRowStretch(0, 100); mainGrid->setColumnStretch(0, 100); mainGrid->addWidget(time, 0, 0, 1, 2); mainGrid->addWidget(MusECore::hLine(mainw), 1, 0, 1, 2); mainGrid->addWidget(canvas, 2, 0); mainGrid->addWidget(ymag, 2, 1); mainGrid->addWidget(hscroll, 3, 0); mainGrid->addWidget(corner, 3, 1, Qt::AlignBottom | Qt::AlignRight); canvas->setFocus(); connect(canvas, SIGNAL(toolChanged(int)), tools2, SLOT(set(int))); connect(tools2, SIGNAL(toolChanged(int)), canvas, SLOT(setTool(int))); connect(hscroll, SIGNAL(scrollChanged(int)), canvas, SLOT(setXPos(int))); connect(hscroll, SIGNAL(scaleChanged(int)), canvas, SLOT(setXMag(int))); setWindowTitle(canvas->getCaption()); connect(canvas, SIGNAL(followEvent(int)), hscroll, SLOT(setOffset(int))); connect(hscroll, SIGNAL(scrollChanged(int)), time, SLOT(setXPos(int))); connect(hscroll, SIGNAL(scaleChanged(int)), time, SLOT(setXMag(int))); connect(time, SIGNAL(timeChanged(unsigned)), SLOT(timeChanged(unsigned))); connect(canvas, SIGNAL(timeChanged(unsigned)), SLOT(setTime(unsigned))); connect(canvas, SIGNAL(horizontalScroll(unsigned)),hscroll, SLOT(setPos(unsigned))); connect(canvas, SIGNAL(horizontalScrollNoLimit(unsigned)),hscroll, SLOT(setPosNoLimit(unsigned))); connect(hscroll, SIGNAL(scaleChanged(int)), SLOT(updateHScrollRange())); connect(MusEGlobal::song, SIGNAL(songChanged(MusECore::SongChangedFlags_t)), SLOT(songChanged1(MusECore::SongChangedFlags_t))); // For the wave editor, let's start with the operation range selection tool. canvas->setTool(MusEGui::RangeTool); tools2->set(MusEGui::RangeTool); setEventColorMode(colorMode); initShortcuts(); updateHScrollRange(); configChanged(); if(!parts()->empty()) { MusECore::WavePart* part = (MusECore::WavePart*)(parts()->begin()->second); solo->setChecked(part->track()->solo()); } initTopwinState(); finalizeInit(); }
MPConfig::MPConfig(QWidget* parent) : QFrame(parent) { setupUi(this); mdevView->setRowCount(kMaxMidiPorts); mdevView->verticalHeader()->hide(); mdevView->setSelectionMode(QAbstractItemView::SingleSelection); mdevView->setShowGrid(false); //popup = 0; instrPopup = 0; _showAliases = -1; // 0: Show first aliases, if available. Nah, stick with -1: none at first. QStringList columnnames; columnnames << tr("Port") << tr("GUI") << tr("N") << tr("I") << tr("O") << tr("Instr") << tr("D-Name") << tr("Ins") << tr("Outs") << tr("In Ch") << tr("Out Ch") << tr("State"); mdevView->setColumnCount(columnnames.size()); mdevView->setHorizontalHeaderLabels(columnnames); for (int i = 0; i < columnnames.size(); ++i) { setWhatsThis(mdevView->horizontalHeaderItem(i), i); setToolTip(mdevView->horizontalHeaderItem(i), i); } mdevView->setFocusPolicy(Qt::NoFocus); //mdevView->horizontalHeader()->setMinimumSectionSize(60); mdevView->horizontalHeader()->resizeSection(DEVCOL_NO, 50); mdevView->horizontalHeader()->resizeSection(DEVCOL_CACHE_NRPN, 20); mdevView->horizontalHeader()->resizeSection(DEVCOL_REC, 20); mdevView->horizontalHeader()->resizeSection(DEVCOL_PLAY, 20); mdevView->horizontalHeader()->resizeSection(DEVCOL_GUI, 40); mdevView->horizontalHeader()->resizeSection(DEVCOL_INROUTES, 40); mdevView->horizontalHeader()->resizeSection(DEVCOL_OUTROUTES, 140); mdevView->horizontalHeader()->resizeSection(DEVCOL_DEF_IN_CHANS, 70); mdevView->horizontalHeader()->resizeSection(DEVCOL_DEF_OUT_CHANS, 70); mdevView->horizontalHeader()->resizeSection(DEVCOL_INSTR, 140); mdevView->horizontalHeader()->resizeSection(DEVCOL_NAME, 140); mdevView->horizontalHeader()->setStretchLastSection(true); mdevView->horizontalHeader()->setDefaultAlignment(Qt::AlignVCenter | Qt::AlignLeft); connect(mdevView, SIGNAL(itemPressed(QTableWidgetItem*)), this, SLOT(rbClicked(QTableWidgetItem*))); connect(mdevView, SIGNAL(itemChanged(QTableWidgetItem*)), this, SLOT(mdevViewItemRenamed(QTableWidgetItem*))); connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int))); for (int i = kMaxMidiPorts - 1; i >= 0; --i) { mdevView->blockSignals(true); // otherwise itemChanged() is triggered and bad things happen. QString s; s.setNum(i + 1); QTableWidgetItem* itemno = new QTableWidgetItem(s); addItem(i, DEVCOL_NO, itemno, mdevView); itemno->setTextAlignment(Qt::AlignHCenter); itemno->setFlags(Qt::ItemIsEnabled); QTableWidgetItem* itemstate = new QTableWidgetItem(); addItem(i, DEVCOL_STATE, itemstate, mdevView); itemstate->setFlags(Qt::ItemIsEnabled); QTableWidgetItem* iteminstr = new QTableWidgetItem(); addItem(i, DEVCOL_INSTR, iteminstr, mdevView); iteminstr->setFlags(Qt::ItemIsEnabled); QTableWidgetItem* itemname = new QTableWidgetItem; addItem(i, DEVCOL_NAME, itemname, mdevView); itemname->setFlags(Qt::ItemIsEnabled); QTableWidgetItem* itemgui = new QTableWidgetItem; addItem(i, DEVCOL_GUI, itemgui, mdevView); itemgui->setTextAlignment(Qt::AlignHCenter); itemgui->setFlags(Qt::ItemIsEnabled); QTableWidgetItem* itemfb = new QTableWidgetItem; addItem(i, DEVCOL_CACHE_NRPN, itemfb, mdevView); itemfb->setTextAlignment(Qt::AlignHCenter); itemfb->setFlags(Qt::ItemIsEnabled); QTableWidgetItem* itemrec = new QTableWidgetItem; addItem(i, DEVCOL_REC, itemrec, mdevView); itemrec->setTextAlignment(Qt::AlignHCenter); itemrec->setFlags(Qt::ItemIsEnabled); QTableWidgetItem* itemplay = new QTableWidgetItem; addItem(i, DEVCOL_PLAY, itemplay, mdevView); itemplay->setTextAlignment(Qt::AlignHCenter); itemplay->setFlags(Qt::ItemIsEnabled); QTableWidgetItem* itemout = new QTableWidgetItem; addItem(i, DEVCOL_OUTROUTES, itemout, mdevView); itemout->setFlags(Qt::ItemIsEnabled); QTableWidgetItem* itemin = new QTableWidgetItem; addItem(i, DEVCOL_INROUTES, itemin, mdevView); itemin->setFlags(Qt::ItemIsEnabled); QTableWidgetItem* itemdefin = new QTableWidgetItem(); addItem(i, DEVCOL_DEF_IN_CHANS, itemdefin, mdevView); itemdefin->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled); QTableWidgetItem* itemdefout = new QTableWidgetItem(); addItem(i, DEVCOL_DEF_OUT_CHANS, itemdefout, mdevView); itemdefout->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled); mdevView->blockSignals(false); } songChanged(0); }