diff options
Diffstat (limited to 'src/library')
29 files changed, 4273 insertions, 6 deletions
diff --git a/src/library/analysisfeature.cpp b/src/library/analysisfeature.cpp index 16dea26639..f1bffb7ce3 100644 --- a/src/library/analysisfeature.cpp +++ b/src/library/analysisfeature.cpp @@ -7,7 +7,7 @@ #include "library/analysisfeature.h" #include "library/librarytablemodel.h" #include "library/trackcollection.h" -#include "dlganalysis.h" +#include "library/dlganalysis.h" #include "widget/wlibrary.h" #include "mixxxkeyboard.h" #include "analyzer/analyzerqueue.h" diff --git a/src/library/analysisfeature.h b/src/library/analysisfeature.h index 6e5e98a989..ac5e75b7c2 100644 --- a/src/library/analysisfeature.h +++ b/src/library/analysisfeature.h @@ -15,7 +15,7 @@ #include "library/libraryfeature.h" #include "configobject.h" #include "treeitemmodel.h" -#include "dlganalysis.h" +#include "library/dlganalysis.h" class AnalyzerQueue; class TrackCollection; diff --git a/src/library/autodj/autodjfeature.cpp b/src/library/autodj/autodjfeature.cpp index 0c52e7441d..93f278e1b4 100644 --- a/src/library/autodj/autodjfeature.cpp +++ b/src/library/autodj/autodjfeature.cpp @@ -15,7 +15,7 @@ #include "mixer/playermanager.h" #include "library/autodj/autodjprocessor.h" #include "library/trackcollection.h" -#include "dlgautodj.h" +#include "library/autodj/dlgautodj.h" #include "library/treeitem.h" #include "widget/wlibrary.h" #include "mixxxkeyboard.h" diff --git a/src/library/autodj/dlgautodj.cpp b/src/library/autodj/dlgautodj.cpp new file mode 100644 index 0000000000..156341d509 --- /dev/null +++ b/src/library/autodj/dlgautodj.cpp @@ -0,0 +1,227 @@ +#include <QMessageBox> + +#include "library/autodj/dlgautodj.h" + +#include "library/playlisttablemodel.h" +#include "widget/wtracktableview.h" +#include "util/assert.h" +#include "util/time.h" + +DlgAutoDJ::DlgAutoDJ(QWidget* parent, + ConfigObject<ConfigValue>* pConfig, + Library* pLibrary, + AutoDJProcessor* pProcessor, + TrackCollection* pTrackCollection, + MixxxKeyboard* pKeyboard) + : QWidget(parent), + Ui::DlgAutoDJ(), + m_pAutoDJProcessor(pProcessor), + // no sorting + m_pTrackTableView(new WTrackTableView(this, pConfig, + pTrackCollection, false)), + m_pAutoDJTableModel(NULL) { + setupUi(this); + + m_pTrackTableView->installEventFilter(pKeyboard); + connect(m_pTrackTableView, SIGNAL(loadTrack(TrackPointer)), + this, SIGNAL(loadTrack(TrackPointer))); + connect(m_pTrackTableView, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool)), + this, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool))); + connect(m_pTrackTableView, SIGNAL(trackSelected(TrackPointer)), + this, SIGNAL(trackSelected(TrackPointer))); + connect(pLibrary, SIGNAL(setTrackTableFont(QFont)), + m_pTrackTableView, SLOT(setTrackTableFont(QFont))); + connect(pLibrary, SIGNAL(setTrackTableRowHeight(int)), + m_pTrackTableView, SLOT(setTrackTableRowHeight(int))); + connect(m_pTrackTableView, SIGNAL(trackSelected(TrackPointer)), + this, SLOT(updateSelectionInfo())); + + + QBoxLayout* box = dynamic_cast<QBoxLayout*>(layout()); + DEBUG_ASSERT_AND_HANDLE(box) { //Assumes the form layout is a QVBox/QHBoxLayout! + } else { + box->removeWidget(m_pTrackTablePlaceholder); + m_pTrackTablePlaceholder->hide(); + box->insertWidget(1, m_pTrackTableView); + } + + // We do _NOT_ take ownership of this from AutoDJProcessor. + m_pAutoDJTableModel = m_pAutoDJProcessor->getTableModel(); + m_pTrackTableView->loadTrackModel(m_pAutoDJTableModel); + + // Override some playlist-view properties: + + // Do not set this because it disables auto-scrolling + //m_pTrackTableView->setDragDropMode(QAbstractItemView::InternalMove); + + connect(pushButtonShuffle, SIGNAL(clicked(bool)), + this, SLOT(shufflePlaylistButton(bool))); + + connect(pushButtonSkipNext, SIGNAL(clicked(bool)), + this, SLOT(skipNextButton(bool))); + +#ifdef __AUTODJCRATES__ + connect(pushButtonAddRandom, SIGNAL(clicked(bool)), + this, SIGNAL(addRandomButton(bool))); +#else // __AUTODJCRATES__ + pushButtonAddRandom->setVisible(false); + horizontalLayout->removeWidget(pushButtonAddRandom); +#endif // __AUTODJCRATES__ + + connect(pushButtonFadeNow, SIGNAL(clicked(bool)), + this, SLOT(fadeNowButton(bool))); + + connect(spinBoxTransition, SIGNAL(valueChanged(int)), + this, SLOT(transitionSliderChanged(int))); + + connect(pushButtonAutoDJ, SIGNAL(toggled(bool)), + this, SLOT(toggleAutoDJButton(bool))); + + // Setup DlgAutoDJ UI based on the current AutoDJProcessor state. Keep in + // mind that AutoDJ may already be active when DlgAutoDJ is created (due to + // skin changes, etc.). + spinBoxTransition->setValue(m_pAutoDJProcessor->getTransitionTime()); + connect(m_pAutoDJProcessor, SIGNAL(transitionTimeChanged(int)), + this, SLOT(transitionTimeChanged(int))); + connect(m_pAutoDJProcessor, SIGNAL(autoDJStateChanged(AutoDJProcessor::AutoDJState)), + this, SLOT(autoDJStateChanged(AutoDJProcessor::AutoDJState))); + autoDJStateChanged(m_pAutoDJProcessor->getState()); + + updateSelectionInfo(); +} + +DlgAutoDJ::~DlgAutoDJ() { + qDebug() << "~DlgAutoDJ()"; + + // Delete m_pTrackTableView before the table model. This is because the + // table view saves the header state using the model. + delete m_pTrackTableView; +} + +void DlgAutoDJ::onShow() { + m_pAutoDJTableModel->select(); +} + +void DlgAutoDJ::onSearch(const QString& text) { + // Do not allow filtering the Auto DJ playlist, because + // Auto DJ will work from the filtered table + Q_UNUSED(text); +} + +void DlgAutoDJ::loadSelectedTrack() { + m_pTrackTableView->loadSelectedTrack(); +} + +void DlgAutoDJ::loadSelectedTrackToGroup(QString group, bool play) { + m_pTrackTableView->loadSelectedTrackToGroup(group, play); +} + +void DlgAutoDJ::moveSelection(int delta) { + m_pTrackTableView->moveSelection(delta); +} + +void DlgAutoDJ::shufflePlaylistButton(bool) { + QModelIndexList indexList = m_pTrackTableView->selectionModel()->selectedRows(); + + // Activate regardless of button being checked + m_pAutoDJProcessor->shufflePlaylist(indexList); +} + +void DlgAutoDJ::skipNextButton(bool) { + // Activate regardless of button being checked + m_pAutoDJProcessor->skipNext(); +} + +void DlgAutoDJ::fadeNowButton(bool) { + // Activate regardless of button being checked + m_pAutoDJProcessor->fadeNow(); +} + +void DlgAutoDJ::toggleAutoDJButton(bool enable) { + AutoDJProcessor::AutoDJError error = m_pAutoDJProcessor->toggleAutoDJ(enable); + switch (error) { + case AutoDJProcessor::ADJ_BOTH_DECKS_PLAYING: + QMessageBox::warning( + NULL, tr("Auto-DJ"), + tr("One deck must be stopped to enable Auto-DJ mode."), + QMessageBox::Ok); + // Make sure the button becomes unpushed. + pushButtonAutoDJ->setChecked(false); + break; + case AutoDJProcessor::ADJ_DECKS_3_4_PLAYING: + QMessageBox::warning( + NULL, tr("Auto-DJ"), + tr("Decks 3 and 4 must be stopped to enable Auto-DJ mode."), + QMessageBox::Ok); + pushButtonAutoDJ->setChecked(false); + break; + case AutoDJProcessor::ADJ_OK: + default: + break; + } +} + +void DlgAutoDJ::transitionTimeChanged(int time) { + spinBoxTransition->setValue(time); +} + +void DlgAutoDJ::transitionSliderChanged(int value) { + m_pAutoDJProcessor->setTransitionTime(value); +} + +void DlgAutoDJ::autoDJStateChanged(AutoDJProcessor::AutoDJState state) { + if (state == AutoDJProcessor::ADJ_DISABLED) { + pushButtonAutoDJ->setChecked(false); + pushButtonAutoDJ->setToolTip(tr("Enable Auto DJ")); + pushButtonAutoDJ->setText(tr("Enable Auto DJ")); + pushButtonFadeNow->setEnabled(false); + pushButtonSkipNext->setEnabled(false); + } else { + // No matter the mode, you can always disable once it is enabled. + pushButtonAutoDJ->setChecked(true); + pushButtonAutoDJ->setToolTip(tr("Disable Auto DJ")); + pushButtonAutoDJ->setText(tr("Disable Auto DJ")); + + // If fading, you can't hit fade now. + if (state == AutoDJProcessor::ADJ_P1FADING || + state == AutoDJProcessor::ADJ_P2FADING || + state == AutoDJProcessor::ADJ_ENABLE_P1LOADED) { + pushButtonFadeNow->setEnabled(false); + } else { + pushButtonFadeNow->setEnabled(true); + } + + // You can always skip the next track if we are enabled. + pushButtonSkipNext->setEnabled(true); + } +} + +void DlgAutoDJ::setTrackTableFont(const QFont& font) { + m_pTrackTableView->setTrackTableFont(font); +} + +void DlgAutoDJ::setTrackTableRowHeight(int rowHeight) { + m_pTrackTableView->setTrackTableRowHeight(rowHeight); +} + +void DlgAutoDJ::updateSelectionInfo() { + int duration = 0; + + QModelIndexList indices = m_pTrackTableView->selectionModel()->selectedRows(); + + for (int i = 0; i < indices.size(); ++i) { + TrackPointer pTrack = m_pAutoDJTableModel->getTrack(indices.at(i)); + if (pTrack) { + duration += pTrack->getDuration(); + } + } + + QString label; + + if (!indices.isEmpty()) { + label.append(Time::formatSeconds(duration)); + label.append(QString(" (%1)").arg(indices.size())); + } + + labelSelectionInfo->setText(label); +} diff --git a/src/library/autodj/dlgautodj.h b/src/library/autodj/dlgautodj.h new file mode 100644 index 0000000000..3031ad673d --- /dev/null +++ b/src/library/autodj/dlgautodj.h @@ -0,0 +1,58 @@ +#ifndef DLGAUTODJ_H +#define DLGAUTODJ_H + +#include <QWidget> +#include <QString> + +#include "library/autodj/ui_dlgautodj.h" +#include "configobject.h" +#include "trackinfoobject.h" +#include "library/libraryview.h" +#include "library/library.h" +#include "library/trackcollection.h" +#include "library/autodj/autodjprocessor.h" +#include "mixxxkeyboard.h" + +class PlaylistTableModel; +class WTrackTableView; + +class DlgAutoDJ : public QWidget, public Ui::DlgAutoDJ, public LibraryView { + Q_OBJECT + public: + DlgAutoDJ(QWidget* parent, ConfigObject<ConfigValue>* pConfig, + Library* pLibrary, + AutoDJProcessor* pProcessor, TrackCollection* pTrackCollection, + MixxxKeyboard* pKeyboard); + virtual ~DlgAutoDJ(); + + void onShow(); + void onSearch(const QString& text); + void loadSelectedTrack(); + void loadSelectedTrackToGroup(QString group, bool play); + void moveSelection(int delta); + + public slots: + void shufflePlaylistButton(bool buttonChecked); + void skipNextButton(bool buttonChecked); + void fadeNowButton(bool buttonChecked); + void toggleAutoDJButton(bool enable); + void transitionTimeChanged(int time); + void transitionSliderChanged(int value); + void autoDJStateChanged(AutoDJProcessor::AutoDJState state); + void setTrackTableFont(const QFont& font); + void setTrackTableRowHeight(int rowHeight); + void updateSelectionInfo(); + + signals: + void addRandomButton(bool buttonChecked); + void loadTrack(TrackPointer tio); + void loadTrackToPlayer(TrackPointer tio, QString group, bool); + void trackSelected(TrackPointer pTrack); + + private: + AutoDJProcessor* m_pAutoDJProcessor; + WTrackTableView* m_pTrackTableView; + PlaylistTableModel* m_pAutoDJTableModel; +}; + +#endif //DLGAUTODJ_H diff --git a/src/library/autodj/dlgautodj.ui b/src/library/autodj/dlgautodj.ui new file mode 100644 index 0000000000..ea2b8c164f --- /dev/null +++ b/src/library/autodj/dlgautodj.ui @@ -0,0 +1,175 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>DlgAutoDJ</class> + <widget class="QWidget" name="DlgAutoDJ"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>560</width> + <height>399</height> + </rect> + </property> + <property name="windowTitle"> + <string>Auto DJ</string> + </property> + <property name="styleSheet"> + <string notr="true"/> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <property name="sizeConstraint"> + <enum>QLayout::SetMinimumSize</enum> + </property> + <property name="leftMargin"> + <number>12</number> + </property> + <property name="rightMargin"> + <number>12</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <widget class="QPushButton" name="pushButtonShuffle"> + <property name="toolTip"> + <string>Shuffle the content of the Auto DJ playlist.</string> + </property> + <property name="text"> + <string>Shuffle</string> + </property> + <property name="checkable"> + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="pushButtonAddRandom"> + <property name="toolTip"> + <string>Add a random track from track sources (crates) or Library to the Auto DJ playlist.</string> + </property> + <property name="text"> + <string>Add Random</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="pushButtonSkipNext"> + <property name="toolTip"> + <string>Skip the next track in the Auto DJ playlist.</string> + </property> + <property name="text"> + <string>Skip Track</string> + </property> + <property name="checkable"> + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="pushButtonFadeNow"> + <property name="toolTip"> + <string>Trigger the transition to the next track.</string> + </property> + <property name="text"> + <string>Fade Now</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="spinBoxTransition"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string>Determines the duration of the transition.</string> + </property> + <property name="frame"> + <bool>false</bool> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + <property name="minimum"> + <number>-9</number> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_2"> + <property name="toolTip"> + <string comment=""sec." as in seconds">Seconds</string> + </property> + <property name="text"> + <string>sec.</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>1</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="labelSelectionInfo"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="pushButtonAutoDJ"> + <property name="toolTip"> + <string>Turn Auto DJ on or off.</string> + </property> + <property name="text"> + <string>Enable Auto DJ</string> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QTableView" name="m_pTrackTablePlaceholder"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="showGrid"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + <resources> + <include location="../res/mixxx.qrc"/> + </resources> + <connections/> +</ui> diff --git a/src/library/dlganalysis.cpp b/src/library/dlganalysis.cpp new file mode 100644 index 0000000000..3258403795 --- /dev/null +++ b/src/library/dlganalysis.cpp @@ -0,0 +1,181 @@ +#include <QSqlTableModel> + +#include "widget/wwidget.h" +#include "widget/wskincolor.h" +#include "widget/wanalysislibrarytableview.h" +#include "library/trackcollection.h" +#include "library/dlganalysis.h" +#include "util/assert.h" + +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 { + box->removeWidget(m_pTrackTablePlaceholder); + m_pTrackTablePlaceholder->hide(); + box->insertWidget(1, m_pAnalysisLibraryTableView); + } + + m_pAnalysisLibraryTableModel = new AnalysisLibraryTableModel(this, pTrackCollection); + m_pAnalysisLibraryTableView->loadTrackModel(m_pAnalysisLibraryTableModel); + + 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_pAnalysisLibraryTableView->selectionModel(), + SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection&)), + this, + SLOT(tableSelectionChanged(const QItemSelection &, const QItemSelection&))); +} + +DlgAnalysis::~DlgAnalysis() { +} + +void DlgAnalysis::onShow() { + // Refresh table + // There might be new tracks dropped to other views + m_pAnalysisLibraryTableModel->select(); +} + +void DlgAnalysis::onSearch(const QString& text) { + m_pAnalysisLibraryTableModel->search(text); +} + +void DlgAnalysis::loadSelectedTrack() { + m_pAnalysisLibraryTableView->loadSelectedTrack(); +} + +void DlgAnalysis::loadSelectedTrackToGroup(QString group, bool play) { + m_pAnalysisLibraryTableView->loadSelectedTrackToGroup(group, play); +} + +void DlgAnalysis::slotSendToAutoDJ() { + // append to auto DJ + m_pAnalysisLibraryTableView->slotSendToAutoDJ(); +} + +void DlgAnalysis::slotSendToAutoDJTop() { + m_pAnalysisLibraryTableView->slotSendToAutoDJTop(); +} + +void DlgAnalysis::moveSelection(int delta) { + m_pAnalysisLibraryTableView->moveSelection(delta); +} + +void DlgAnalysis::tableSelectionChanged(const QItemSelection& selected, + const QItemSelection& deselected) { + Q_UNUSED(selected); + Q_UNUSED(deselected); + bool tracksSelected = m_pAnalysisLibraryTableView->selectionModel()->hasSelection(); + pushButtonAnalyze->setEnabled(tracksSelected || m_bAnalysisActive); +} + +void DlgAnalysis::selectAll() { + m_pAnalysisLibraryTableView->selectAll(); +} + +void DlgAnalysis::analyze() { + //qDebug() << this << "analyze()"; + if (m_bAnalysisActive) { + emit(stopAnalysis()); + } else { + QList<TrackId> trackIds; + + QModelIndexList selectedIndexes = m_pAnalysisLibraryTableView->selectionModel()->selectedRows(); + foreach(QModelIndex selectedIndex, selectedIndexes) { + TrackId trackId(selectedIndex.sibling( + selectedIndex.row(), + m_pAnalysisLibraryTableModel->fieldIndex(LIBRARYTABLE_ID)).data()); + if (trackId.isValid()) { + trackIds.append(trackId); + } + } + m_currentTrack = 1; + emit(analyzeTracks(trackIds)); + } +} + +void DlgAnalysis::analysisActive(bool bActive) { + qDebug() << this << "analysisActive" << bActive; + m_bAnalysisActive = bActive; + if (bActive) { + pushButtonAnalyze->setEnabled(true); + pushButtonAnalyze->setText(tr("Stop Analysis")); + } else { + pushButtonAnalyze->setText(tr("Analyze")); + labelProgress->setText(""); + } +} + +// slot +void DlgAnalysis::trackAnalysisFinished(int size) { + qDebug() << "Analysis finished" << size << "tracks left"; + if (size > 0) { + m_currentTrack = m_tracksInQueue - size + 1; + } +} + +// slot +void DlgAnalysis::trackAnalysisProgress(int progress) { + if (m_bAnalysisActive) { + QString text = tr("Analyzing %1/%2 %3%").arg( + QString::number(m_currentTrack), + QString::number(m_tracksInQueue), + QString::number(progress)); + labelProgress->setText(text); + } +} + +int DlgAnalysis::getNumTracks() { + return m_tracksInQueue; +} + +void DlgAnalysis::trackAnalysisStarted(int size) { + m_tracksInQueue = size; +} + +void DlgAnalysis::showRecentSongs() { + m_pAnalysisLibraryTableModel->showRecentSongs(); +} + +void DlgAnalysis::showAllSongs() { + m_pAnalysisLibraryTableModel->showAllSongs(); +} + +void DlgAnalysis::installEventFilter(QObject* pFilter) { + QWidget::installEventFilter(pFilter); + m_pAnalysisLibraryTableView->installEventFilter(pFilter); +} diff --git a/src/library/dlganalysis.h b/src/library/dlganalysis.h new file mode 100644 index 0000000000..8e73a700bb --- /dev/null +++ b/src/library/dlganalysis.h @@ -0,0 +1,67 @@ +#ifndef DLGANALYSIS_H +#define DLGANALYSIS_H + +#include <QItemSelection> + +#include "configobject.h" +#include "library/analysislibrarytablemodel.h" +#include "library/libraryview.h" +#include "library/trackcollection.h" +#include "library/ui_dlganalysis.h" + +class AnalysisLibraryTableModel; +class WAnalysisLibraryTableView; + +class DlgAnalysis : public QWidget, public Ui::DlgAnalysis, public virtual LibraryView { + Q_OBJECT + public: + DlgAnalysis(QWidget *parent, + ConfigObject<ConfigValue>* pConfig, + TrackCollection* pTrackCollection); + virtual ~DlgAnalysis(); + + virtual void onSearch(const QString& text); + virtual void onShow(); + virtual void loadSelectedTrack(); + virtual void loadSelectedTrackToGroup(QString group, bool play); + virtual void slotSendToAutoDJ(); + virtual void slotSendToAutoDJTop(); + virtual void moveSelection(int delta); + inline const QString currentSearch() { + return m_pAnalysisLibraryTableModel->currentSearch(); + } + int getNumTracks(); + + public slots: + void tableSelectionChanged(const QItemSelection& selected, + const QItemSelection& deselected); + void selectAll(); + void analyze(); + void trackAnalysisFinished(int size); + void trackAnalysisProgress(int progress); + void trackAnalysisStarted(int size); + void showRecentSongs(); + void showAllSongs(); + void installEventFilter(QObject* pFilter); + void analysisActive(bool bActive); + + signals: + void loadTrack(TrackPointer pTrack); + void loadTrackToPlayer(TrackPointer pTrack, QString player); + void analyzeTracks(QList<TrackId> trackIds); + void stopAnalysis(); + void trackSelected(TrackPointer pTrack); + + private: + //Note m_pTrackTablePlaceholder is defined in the .ui file + ConfigObject<ConfigValue>* m_pConfig; + TrackCollection* m_pTrackCollection; + bool m_bAnalysisActive; + QButtonGroup m_songsButtonGroup; + WAnalysisLibraryTableView* m_pAnalysisLibraryTableView; + AnalysisLibraryTableModel* m_pAnalysisLibraryTableModel; + int m_tracksInQueue; + int m_currentTrack; +}; + +#endif //DLGTRIAGE_H diff --git a/src/library/dlganalysis.ui b/src/library/dlganalysis.ui new file mode 100644 index 0000000000..156bef73fc --- /dev/null +++ b/src/library/dlganalysis.ui @@ -0,0 +1,133 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>DlgAnalysis</class> + <widget class="QWidget" name="DlgAnalysis"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>500</width> + <height>399</height> + </rect> + </property> + <property name="windowTitle"> + <string>Analyze</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="rightMargin"> + <number>0</number> + </property> + <property name="bottomMargin"> + <number>0</number> + </property> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> |