void AnalysisFeature::bindWidget(WLibrary* libraryWidget, MixxxKeyboard* keyboard) { m_pAnalysisView = new DlgAnalysis(libraryWidget, m_pConfig, m_pTrackCollection); connect(m_pAnalysisView, SIGNAL(loadTrack(TrackPointer)), this, SIGNAL(loadTrack(TrackPointer))); connect(m_pAnalysisView, SIGNAL(loadTrackToPlayer(TrackPointer, QString)), this, SIGNAL(loadTrackToPlayer(TrackPointer, QString))); connect(m_pAnalysisView, SIGNAL(analyzeTracks(QList<int>)), this, SLOT(analyzeTracks(QList<int>))); connect(m_pAnalysisView, SIGNAL(stopAnalysis()), this, SLOT(stopAnalysis())); connect(m_pAnalysisView, SIGNAL(trackSelected(TrackPointer)), this, SIGNAL(trackSelected(TrackPointer))); connect(this, SIGNAL(analysisActive(bool)), m_pAnalysisView, SLOT(analysisActive(bool))); connect(this, SIGNAL(trackAnalysisStarted(int)), m_pAnalysisView, SLOT(trackAnalysisStarted(int))); m_pAnalysisView->installEventFilter(keyboard); // Let the DlgAnalysis know whether or not analysis is active. bool bAnalysisActive = m_pAnalyserQueue != NULL; emit(analysisActive(bAnalysisActive)); libraryWidget->registerView(m_sAnalysisViewName, m_pAnalysisView); }
DlgAnalysis::DlgAnalysis(QWidget* parent, ConfigObject<ConfigValue>* pConfig, TrackCollection* pTrackCollection) : QWidget(parent), m_pConfig(pConfig), m_pTrackCollection(pTrackCollection), m_bAnalysisActive(false), m_tracksInQueue(0), m_currentTrack(0) { setupUi(this); m_songsButtonGroup.addButton(radioButtonRecentlyAdded); m_songsButtonGroup.addButton(radioButtonAllSongs); m_pAnalysisLibraryTableView = new WAnalysisLibraryTableView(this, pConfig, pTrackCollection); connect(m_pAnalysisLibraryTableView, SIGNAL(loadTrack(TrackPointer)), this, SIGNAL(loadTrack(TrackPointer))); connect(m_pAnalysisLibraryTableView, SIGNAL(loadTrackToPlayer(TrackPointer, QString)), this, SIGNAL(loadTrackToPlayer(TrackPointer, QString))); connect(m_pAnalysisLibraryTableView, SIGNAL(trackSelected(TrackPointer)), this, SIGNAL(trackSelected(TrackPointer))); QBoxLayout* box = dynamic_cast<QBoxLayout*>(layout()); DEBUG_ASSERT_AND_HANDLE(box) { // Assumes the form layout is a QVBox/QHBoxLayout! } else {
void Library::slotLoadLocationToPlayer(QString location, QString group) { TrackDAO& track_dao = m_pTrackCollection->getTrackDAO(); int track_id = track_dao.getTrackId(location); if (track_id < 0) { // Add Track to library track_id = track_dao.addTrack(location, true); } TrackPointer pTrack; if (track_id < 0) { // Add Track to library failed, create a transient TrackInfoObject pTrack = TrackPointer(new TrackInfoObject(location), &QObject::deleteLater); } else { pTrack = track_dao.getTrack(track_id); } emit(loadTrackToPlayer(pTrack, group)); }
void PreviewButtonDelegate::buttonClicked() { if (!m_pTableView) { return; } TrackModel *pTrackModel = dynamic_cast<TrackModel*>(m_pTableView->model()); if (!pTrackModel) { return; } QString group = PlayerManager::groupForPreviewDeck(0); TrackPointer pOldTrack = PlayerInfo::instance().getTrackInfo(group); bool playing = m_pPreviewDeckPlay->get() > 0.0; TrackPointer pTrack = pTrackModel->getTrack(m_currentEditedCellIndex); if (pTrack && pTrack != pOldTrack) { emit(loadTrackToPlayer(pTrack, group, true)); } else if (pTrack == pOldTrack && !playing) { m_pPreviewDeckPlay->slotSet(1.0); } else { m_pPreviewDeckPlay->slotSet(0.0); } }
void Library::slotLoadTrackToPlayer(TrackPointer pTrack, QString group, bool play) { emit(loadTrackToPlayer(pTrack, group, play)); }
DlgPrepare::DlgPrepare(QWidget* parent, ConfigObject<ConfigValue>* pConfig, TrackCollection* pTrackCollection) : QWidget(parent), m_pConfig(pConfig), m_pTrackCollection(pTrackCollection), m_bAnalysisActive(false), m_tracksInQueue(0), m_currentTrack(0) { setupUi(this); m_songsButtonGroup.addButton(radioButtonRecentlyAdded); m_songsButtonGroup.addButton(radioButtonAllSongs); m_pPrepareLibraryTableView = new WPrepareLibraryTableView(this, pConfig, pTrackCollection); connect(m_pPrepareLibraryTableView, SIGNAL(loadTrack(TrackPointer)), this, SIGNAL(loadTrack(TrackPointer))); connect(m_pPrepareLibraryTableView, SIGNAL(loadTrackToPlayer(TrackPointer, QString)), this, SIGNAL(loadTrackToPlayer(TrackPointer, QString))); QBoxLayout* box = dynamic_cast<QBoxLayout*>(layout()); Q_ASSERT(box); //Assumes the form layout is a QVBox/QHBoxLayout! box->removeWidget(m_pTrackTablePlaceholder); m_pTrackTablePlaceholder->hide(); box->insertWidget(1, m_pPrepareLibraryTableView); m_pPrepareLibraryTableModel = new PrepareLibraryTableModel(this, pTrackCollection); m_pPrepareLibraryTableView->loadTrackModel(m_pPrepareLibraryTableModel); /* m_pCrateView = new CrateView(this, pTrackCollection); m_pPrepareCratesTableView = new WPrepareCratesTableView(this, pTrackCollection); box = dynamic_cast<QBoxLayout*>(horizontalLayoutCrates); Q_ASSERT(box); //Assumes the form layout is a QVBox/QHBoxLayout! box->removeWidget(m_pCratesViewPlaceholder); m_pCratesViewPlaceholder->hide(); //box->insertWidget(1, m_pPrepareCratesTableView); box->insertWidget(1, m_pCrateView); m_pCrateView->show(); m_pCratesTableModel = new QSqlTableModel(this); m_pCratesTableModel->setTable("crates"); m_pCratesTableModel->removeColumn(m_pCratesTableModel->fieldIndex("id")); m_pCratesTableModel->removeColumn(m_pCratesTableModel->fieldIndex("show")); m_pCratesTableModel->removeColumn(m_pCratesTableModel->fieldIndex("count")); m_pCratesTableModel->setSort(m_pCratesTableModel->fieldIndex("name"), Qt::AscendingOrder); m_pCratesTableModel->setFilter("show = 1"); m_pCratesTableModel->select(); while (m_pCratesTableModel->canFetchMore()) { m_pCratesTableModel->fetchMore(); } TransposeProxyModel* transposeProxy = new TransposeProxyModel(this); transposeProxy->setSourceModel(m_pCratesTableModel); m_pPrepareCratesTableView->setModel(m_pCratesTableModel); */ connect(radioButtonRecentlyAdded, SIGNAL(clicked()), this, SLOT(showRecentSongs())); connect(radioButtonAllSongs, SIGNAL(clicked()), this, SLOT(showAllSongs())); radioButtonRecentlyAdded->click(); labelProgress->setText(""); pushButtonAnalyze->setEnabled(false); connect(pushButtonAnalyze, SIGNAL(clicked()), this, SLOT(analyze())); connect(pushButtonSelectAll, SIGNAL(clicked()), this, SLOT(selectAll())); connect(m_pPrepareLibraryTableView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection&)), this, SLOT(tableSelectionChanged(const QItemSelection &, const QItemSelection&))); }