diff options
-rw-r--r-- | src/library/autodj/dlgautodj.cpp | 16 | ||||
-rw-r--r-- | src/library/autodj/dlgautodj.h | 2 | ||||
-rw-r--r-- | src/library/dlganalysis.cpp | 11 | ||||
-rw-r--r-- | src/library/dlghidden.cpp | 12 | ||||
-rw-r--r-- | src/library/dlghidden.h | 2 | ||||
-rw-r--r-- | src/library/dlgmissing.cpp | 16 | ||||
-rw-r--r-- | src/library/dlgmissing.h | 2 | ||||
-rw-r--r-- | src/library/library.cpp | 15 | ||||
-rw-r--r-- | src/library/library.h | 8 | ||||
-rw-r--r-- | src/library/librarycontrol.cpp | 2 | ||||
-rw-r--r-- | src/library/recording/dlgrecording.cpp | 10 | ||||
-rw-r--r-- | src/library/recording/dlgrecording.h | 2 | ||||
-rw-r--r-- | src/preferences/dialog/dlgpreflibrary.cpp | 26 | ||||
-rw-r--r-- | src/preferences/dialog/dlgpreflibrary.h | 5 | ||||
-rw-r--r-- | src/widget/wlibrarytableview.cpp | 12 | ||||
-rw-r--r-- | src/widget/wlibrarytableview.h | 1 | ||||
-rw-r--r-- | src/widget/wtracktableview.cpp | 4 |
17 files changed, 70 insertions, 76 deletions
diff --git a/src/library/autodj/dlgautodj.cpp b/src/library/autodj/dlgautodj.cpp index 26298e16db..6798d0a618 100644 --- a/src/library/autodj/dlgautodj.cpp +++ b/src/library/autodj/dlgautodj.cpp @@ -29,13 +29,15 @@ DlgAutoDJ::DlgAutoDJ(QWidget* parent, this, SIGNAL(loadTrackToPlayer(TrackPointer, QString, bool))); connect(m_pTrackTableView, SIGNAL(trackSelected(TrackPointer)), this, SIGNAL(trackSelected(TrackPointer))); + connect(m_pTrackTableView, SIGNAL(trackSelected(TrackPointer)), + this, SLOT(updateSelectionInfo())); + 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())); - + connect(pLibrary, SIGNAL(setSelectedClick(bool)), + m_pTrackTableView, SLOT(setSelectedClick(bool))); QBoxLayout* box = dynamic_cast<QBoxLayout*>(layout()); VERIFY_OR_DEBUG_ASSERT(box) { //Assumes the form layout is a QVBox/QHBoxLayout! @@ -191,14 +193,6 @@ void DlgAutoDJ::autoDJStateChanged(AutoDJProcessor::AutoDJState state) { } } -void DlgAutoDJ::setTrackTableFont(const QFont& font) { - m_pTrackTableView->setTrackTableFont(font); -} - -void DlgAutoDJ::setTrackTableRowHeight(int rowHeight) { - m_pTrackTableView->setTrackTableRowHeight(rowHeight); -} - void DlgAutoDJ::updateSelectionInfo() { double duration = 0.0; diff --git a/src/library/autodj/dlgautodj.h b/src/library/autodj/dlgautodj.h index 902c88d03b..fd77900e06 100644 --- a/src/library/autodj/dlgautodj.h +++ b/src/library/autodj/dlgautodj.h @@ -40,8 +40,6 @@ class DlgAutoDJ : public QWidget, public Ui::DlgAutoDJ, public LibraryView { 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: diff --git a/src/library/dlganalysis.cpp b/src/library/dlganalysis.cpp index 52e27740a3..4ff4751be8 100644 --- a/src/library/dlganalysis.cpp +++ b/src/library/dlganalysis.cpp @@ -8,10 +8,10 @@ #include "library/dlganalysis.h" #include "util/assert.h" -DlgAnalysis::DlgAnalysis(QWidget* parent, +DlgAnalysis::DlgAnalysis(QWidget* pLibrary, UserSettingsPointer pConfig, TrackCollection* pTrackCollection) - : QWidget(parent), + : QWidget(pLibrary), m_pConfig(pConfig), m_pTrackCollection(pTrackCollection), m_bAnalysisActive(false), @@ -62,6 +62,13 @@ DlgAnalysis::DlgAnalysis(QWidget* parent, SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection&)), this, SLOT(tableSelectionChanged(const QItemSelection &, const QItemSelection&))); + + connect(pLibrary, SIGNAL(setTrackTableFont(QFont)), + m_pAnalysisLibraryTableView, SLOT(setTrackTableFont(QFont))); + connect(pLibrary, SIGNAL(setTrackTableRowHeight(int)), + m_pAnalysisLibraryTableView, SLOT(setTrackTableRowHeight(int))); + connect(pLibrary, SIGNAL(setSelectedClick(bool)), + m_pAnalysisLibraryTableView, SLOT(setSelectedClick(bool))); } DlgAnalysis::~DlgAnalysis() { diff --git a/src/library/dlghidden.cpp b/src/library/dlghidden.cpp index dda58b0893..b17bcd8d95 100644 --- a/src/library/dlghidden.cpp +++ b/src/library/dlghidden.cpp @@ -41,13 +41,15 @@ DlgHidden::DlgHidden(QWidget* parent, UserSettingsPointer pConfig, SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), this, SLOT(selectionChanged(const QItemSelection&, const QItemSelection&))); - 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(pLibrary, SIGNAL(setSelectedClick(bool)), + m_pTrackTableView, SLOT(setSelectedClick(bool))); } DlgHidden::~DlgHidden() { @@ -87,14 +89,6 @@ void DlgHidden::selectionChanged(const QItemSelection &selected, activateButtons(!selected.indexes().isEmpty()); } -void DlgHidden::setTrackTableFont(const QFont& font) { - m_pTrackTableView->setTrackTableFont(font); -} - -void DlgHidden::setTrackTableRowHeight(int rowHeight) { - m_pTrackTableView->setTrackTableRowHeight(rowHeight); -} - bool DlgHidden::hasFocus() const { return QWidget::hasFocus(); } diff --git a/src/library/dlghidden.h b/src/library/dlghidden.h index a59a542546..06fa62c83e 100644 --- a/src/library/dlghidden.h +++ b/src/library/dlghidden.h @@ -28,8 +28,6 @@ class DlgHidden : public QWidget, public Ui::DlgHidden, public LibraryView { void clicked(); void selectAll(); void selectionChanged(const QItemSelection&, const QItemSelection&); - void setTrackTableFont(const QFont& font); - void setTrackTableRowHeight(int rowHeight); signals: void trackSelected(TrackPointer pTrack); diff --git a/src/library/dlgmissing.cpp b/src/library/dlgmissing.cpp index 5eeca8dec8..2aa2efd356 100644 --- a/src/library/dlgmissing.cpp +++ b/src/library/dlgmissing.cpp @@ -36,13 +36,15 @@ DlgMissing::DlgMissing(QWidget* parent, UserSettingsPointer pConfig, SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), this, SLOT(selectionChanged(const QItemSelection&, const QItemSelection&))); + 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, SIGNAL(trackSelected(TrackPointer))); + connect(pLibrary, SIGNAL(setSelectedClick(bool)), + m_pTrackTableView, SLOT(setSelectedClick(bool))); } DlgMissing::~DlgMissing() { @@ -80,14 +82,6 @@ void DlgMissing::selectionChanged(const QItemSelection &selected, activateButtons(!selected.indexes().isEmpty()); } -void DlgMissing::setTrackTableFont(const QFont& font) { - m_pTrackTableView->setTrackTableFont(font); -} - -void DlgMissing::setTrackTableRowHeight(int rowHeight) { - m_pTrackTableView->setTrackTableRowHeight(rowHeight); -} - bool DlgMissing::hasFocus() const { return QWidget::hasFocus(); } diff --git a/src/library/dlgmissing.h b/src/library/dlgmissing.h index e3879a397c..2b3ec2d0e7 100644 --- a/src/library/dlgmissing.h +++ b/src/library/dlgmissing.h @@ -27,8 +27,6 @@ class DlgMissing : public QWidget, public Ui::DlgMissing, public LibraryView { void clicked(); void selectAll(); void selectionChanged(const QItemSelection&, const QItemSelection&); - void setTrackTableFont(const QFont& font); - void setTrackTableRowHeight(int rowHeight); signals: void trackSelected(TrackPointer pTrack); diff --git a/src/library/library.cpp b/src/library/library.cpp index 745a609beb..d5c7daf1ee 100644 --- a/src/library/library.cpp +++ b/src/library/library.cpp @@ -172,6 +172,9 @@ Library::Library( } else { m_trackTableFont = QApplication::font(); } + + m_editMetadata = m_pConfig->getValue( + ConfigKey(kConfigGroup, "EditMetadata"), true); } Library::~Library() { @@ -242,6 +245,8 @@ void Library::bindWidget(WLibrary* pLibraryWidget, pTrackTableView, SLOT(setTrackTableFont(QFont))); connect(this, SIGNAL(setTrackTableRowHeight(int)), pTrackTableView, SLOT(setTrackTableRowHeight(int))); + connect(this, SIGNAL(setSelectedClick(bool)), + pTrackTableView, SLOT(setSelectedClick(bool))); connect(this, SIGNAL(searchStarting()), pTrackTableView, SLOT(onSearchStarting())); @@ -260,6 +265,7 @@ void Library::bindWidget(WLibrary* pLibraryWidget, // just connected to us. emit(setTrackTableFont(m_trackTableFont)); emit(setTrackTableRowHeight(m_iTrackTableRowHeight)); + emit(setSelectedClick(m_editMetadata)); } void Library::addFeature(LibraryFeature* feature) { @@ -412,16 +418,21 @@ QStringList Library::getDirs() { return m_pTrackCollection->getDirectoryDAO().getDirs(); } -void Library::slotSetTrackTableFont(const QFont& font) { +void Library::setFont(const QFont& font) { m_trackTableFont = font; emit(setTrackTableFont(font)); } -void Library::slotSetTrackTableRowHeight(int rowHeight) { +void Library::setRowHeight(int rowHeight) { m_iTrackTableRowHeight = rowHeight; emit(setTrackTableRowHeight(rowHeight)); } +void Library::setEditMedatata(bool enabled) { + m_editMetadata = enabled; + emit(setSelectedClick(enabled)); +} + void Library::saveCachedTrack(Track* pTrack) noexcept { // It can produce dangerous signal loops if the track is still // sending signals while being saved! diff --git a/src/library/library.h b/src/library/library.h index b84eafd1de..065395cb07 100644 --- a/src/library/library.h +++ b/src/library/library.h @@ -81,6 +81,10 @@ class Library: public QObject, static const int kDefaultRowHeightPx; + void setFont(const QFont& font); + void setRowHeight(int rowHeight); + void setEditMedatata(bool enable); + public slots: void slotShowTrackModel(QAbstractItemModel* model); void slotSwitchToView(const QString& view); @@ -95,8 +99,6 @@ class Library: public QObject, void slotRequestRemoveDir(QString directory, Library::RemovalType removalType); void slotRequestRelocateDir(QString previousDirectory, QString newDirectory); void onSkinLoadFinished(); - void slotSetTrackTableFont(const QFont& font); - void slotSetTrackTableRowHeight(int rowHeight); void scan() { m_scanner.scan(); @@ -117,6 +119,7 @@ class Library: public QObject, void setTrackTableFont(const QFont& font); void setTrackTableRowHeight(int rowHeight); + void setSelectedClick(bool enable); // Emitted when a library scan starts and finishes. void scanStarted(); @@ -144,6 +147,7 @@ class Library: public QObject, LibraryScanner m_scanner; QFont m_trackTableFont; int m_iTrackTableRowHeight; + bool m_editMetadata; QScopedPointer<ControlObject> m_pKeyNotation; }; diff --git a/src/library/librarycontrol.cpp b/src/library/librarycontrol.cpp index 2153e5fbb2..f9c48e7ba8 100644 --- a/src/library/librarycontrol.cpp +++ b/src/library/librarycontrol.cpp @@ -471,7 +471,7 @@ void LibraryControl::slotFontSize(double v) { } QFont font = m_pLibrary->getTrackTableFont(); font.setPointSizeF(font.pointSizeF() + v); - m_pLibrary->slotSetTrackTableFont(font); + m_pLibrary->setFont(font); } void LibraryControl::slotIncrementFontSize(double v) { diff --git a/src/library/recording/dlgrecording.cpp b/src/library/recording/dlgrecording.cpp index 308c916f46..684d06fe7d 100644 --- a/src/library/recording/dlgrecording.cpp +++ b/src/library/recording/dlgrecording.cpp @@ -31,6 +31,8 @@ DlgRecording::DlgRecording(QWidget* parent, UserSettingsPointer pConfig, m_pTrackTableView, SLOT(setTrackTableFont(QFont))); connect(pLibrary, SIGNAL(setTrackTableRowHeight(int)), m_pTrackTableView, SLOT(setTrackTableRowHeight(int))); + connect(pLibrary, SIGNAL(setSelectedClick(bool)), + m_pTrackTableView, SLOT(setSelectedClick(bool))); connect(m_pRecordingManager, SIGNAL(isRecording(bool)), this, SLOT(slotRecordingEnabled(bool))); @@ -157,11 +159,3 @@ void DlgRecording::refreshLabel() { .arg(m_durationRecordedStr); label->setText(text); } - -void DlgRecording::setTrackTableFont(const QFont& font) { - m_pTrackTableView->setTrackTableFont(font); -} - -void DlgRecording::setTrackTableRowHeight(int rowHeight) { - m_pTrackTableView->setTrackTableRowHeight(rowHeight); -} diff --git a/src/library/recording/dlgrecording.h b/src/library/recording/dlgrecording.h index 56c8d9e4aa..0851065d04 100644 --- a/src/library/recording/dlgrecording.h +++ b/src/library/recording/dlgrecording.h @@ -42,8 +42,6 @@ class DlgRecording : public QWidget, public Ui::DlgRecording, public virtual Lib void refreshBrowseModel(); void slotRestoreSearch(); void slotDurationRecorded(QString durationRecorded); - void setTrackTableFont(const QFont& font); - void setTrackTableRowHeight(int rowHeight); signals: void loadTrack(TrackPointer tio); diff --git a/src/preferences/dialog/dlgpreflibrary.cpp b/src/preferences/dialog/dlgpreflibrary.cpp index 026fae930a..01f1f7f3a4 100644 --- a/src/preferences/dialog/dlgpreflibrary.cpp +++ b/src/preferences/dialog/dlgpreflibrary.cpp @@ -57,10 +57,6 @@ DlgPrefLibrary::DlgPrefLibrary( connect(libraryFontButton, SIGNAL(clicked()), this, SLOT(slotSelectFont())); - connect(this, SIGNAL(setTrackTableFont(QFont)), - m_pLibrary, SLOT(slotSetTrackTableFont(QFont))); - connect(this, SIGNAL(setTrackTableRowHeight(int)), - m_pLibrary, SLOT(slotSetTrackTableRowHeight(int))); // TODO(XXX) this string should be extracted from the soundsources QString builtInFormatsStr = "Ogg Vorbis, FLAC, WAVe, AIFF"; @@ -143,6 +139,7 @@ void DlgPrefLibrary::slotResetToDefaults() { checkBox_show_itunes->setChecked(true); checkBox_show_traktor->setChecked(true); radioButton_dbclick_bottom->setChecked(false); + checkBoxEditMetadata->setChecked(true); radioButton_dbclick_top->setChecked(false); radioButton_dbclick_deck->setChecked(true); spinBoxRowHeight->setValue(Library::kDefaultRowHeightPx); @@ -174,14 +171,15 @@ void DlgPrefLibrary::slotUpdate() { case ADD_TO_AUTODJ_TOP: radioButton_dbclick_top->setChecked(true); break; - case EDIT_METADATA: - radioButton_dbclick_edit_metadata->setChecked(true); - break; default: radioButton_dbclick_deck->setChecked(true); break; } + checkBoxEditMetadata->setChecked( + m_pConfig->getValue( + ConfigKey("[Library]","EditMetadata"), true)); + m_originalTrackTableFont = m_pLibrary->getTrackTableFont(); m_iOriginalTrackTableRowHeight = m_pLibrary->getTrackTableRowHeight(); spinBoxRowHeight->setValue(m_iOriginalTrackTableRowHeight); @@ -190,8 +188,8 @@ void DlgPrefLibrary::slotUpdate() { void DlgPrefLibrary::slotCancel() { // Undo any changes in the library font or row height. - emit(setTrackTableRowHeight(m_iOriginalTrackTableRowHeight)); - emit(setTrackTableFont(m_originalTrackTableFont)); + m_pLibrary->setFont(m_originalTrackTableFont); + m_pLibrary->setRowHeight(m_iOriginalTrackTableRowHeight); } void DlgPrefLibrary::slotAddDir() { @@ -306,14 +304,16 @@ void DlgPrefLibrary::slotApply() { dbclick_status = ADD_TO_AUTODJ_BOTTOM; } else if (radioButton_dbclick_top->isChecked()) { dbclick_status = ADD_TO_AUTODJ_TOP; - } else if (radioButton_dbclick_edit_metadata->isChecked()) { - dbclick_status = EDIT_METADATA; } else { dbclick_status = LOAD_TO_DECK; } m_pConfig->set(ConfigKey("[Library]","TrackLoadAction"), ConfigValue(dbclick_status)); + m_pConfig->set(ConfigKey("[Library]","EditMetadata"), + ConfigValue(checkBoxEditMetadata->checkState())); + m_pLibrary->setEditMedatata(checkBoxEditMetadata->checkState()); + QFont font = m_pLibrary->getTrackTableFont(); if (m_originalTrackTableFont != font) { m_pConfig->set(ConfigKey("[Library]", "Font"), @@ -331,13 +331,13 @@ void DlgPrefLibrary::slotApply() { } void DlgPrefLibrary::slotRowHeightValueChanged(int height) { - emit(setTrackTableRowHeight(height)); + m_pLibrary->setRowHeight(height); } void DlgPrefLibrary::setLibraryFont(const QFont& font) { libraryFont->setText(QString("%1 %2 %3pt").arg( font.family(), font.styleName(), QString::number(font.pointSizeF()))); - emit(setTrackTableFont(font)); + m_pLibrary->setFont(font); // Don't let the row height exceed the library height. QFontMetrics metrics(font); diff --git a/src/preferences/dialog/dlgpreflibrary.h b/src/preferences/dialog/dlgpreflibrary.h index 6f94c5c022..a344431f77 100644 --- a/src/preferences/dialog/dlgpreflibrary.h +++ b/src/preferences/dialog/dlgpreflibrary.h @@ -20,8 +20,7 @@ class DlgPrefLibrary : public DlgPreferencePage, public Ui::DlgPrefLibraryDlg { enum TrackDoubleClickAction { LOAD_TO_DECK, ADD_TO_AUTODJ_BOTTOM, - ADD_TO_AUTODJ_TOP, - EDIT_METADATA + ADD_TO_AUTODJ_TOP }; DlgPrefLibrary( @@ -51,8 +50,6 @@ class DlgPrefLibrary : public DlgPreferencePage, public Ui::DlgPrefLibraryDlg { void requestAddDir(QString dir); void requestRemoveDir(QString dir, Library::RemovalType removalType); void requestRelocateDir(QString currentDir, QString newDir); - void setTrackTableFont(const QFont& font); - void setTrackTableRowHeight(int rowHeight); private slots: void slotRowHeightValueChanged(int); diff --git a/src/widget/wlibrarytableview.cpp b/src/widget/wlibrarytableview.cpp index 9fb6719ed5..6e86e2a2e4 100644 --- a/src/widget/wlibrarytableview.cpp +++ b/src/widget/wlibrarytableview.cpp @@ -18,10 +18,12 @@ WLibraryTableView::WLibraryTableView(QWidget* parent, m_pConfig(pConfig), m_vScrollBarPosKey(vScrollBarPosKey) { + loadVScrollBarPosState(); + // Setup properties for table // Editing starts when clicking on an already selected item. - setEditTriggers(QAbstractItemView::SelectedClicked); + setEditTriggers(QAbstractItemView::SelectedClicked|QAbstractItemView::EditKeyPressed); //Enable selection by rows and extended selection (ctrl/shift click) setSelectionBehavior(QAbstractItemView::SelectRows); @@ -135,3 +137,11 @@ void WLibraryTableView::setTrackTableRowHeight(int rowHeight) { verticalHeader()->setDefaultSectionSize(math_max( rowHeight, fontHeightPx)); } + +void WLibraryTableView::setSelectedClick(bool enable) { + if (enable) { + setEditTriggers(QAbstractItemView::SelectedClicked|QAbstractItemView::EditKeyPressed); + } else { + setEditTriggers(QAbstractItemView::EditKeyPressed); + } +} diff --git a/src/widget/wlibrarytableview.h b/src/widget/wlibrarytableview.h index 5bb70d9268..14d3233dd5 100644 --- a/src/widget/wlibrarytableview.h +++ b/src/widget/wlibrarytableview.h @@ -51,6 +51,7 @@ class WLibraryTableView : public QTableView, public virtual LibraryView { void restoreVScrollBarPos(); void setTrackTableFont(const QFont& font); void setTrackTableRowHeight(int rowHeight); + void setSelectedClick(bool enable); private: void loadVScrollBarPosState(); diff --git a/src/widget/wtracktableview.cpp b/src/widget/wtracktableview.cpp index 0d3ba67423..45ad1f9814 100644 --- a/src/widget/wtracktableview.cpp +++ b/src/widget/wtracktableview.cpp @@ -105,8 +105,6 @@ WTrackTableView::WTrackTableView(QWidget * parent, connect(m_pCoverMenu, SIGNAL(reloadCoverArt()), this, SLOT(slotReloadCoverArt())); - setEditTriggers(QAbstractItemView::EditKeyPressed); - // Create all the context m_pMenu->actions (stuff that shows up when you //right-click) createActions(); @@ -563,8 +561,6 @@ void WTrackTableView::slotMouseDoubleClicked(const QModelIndex &index) { } else if (doubleClickAction == DlgPrefLibrary::ADD_TO_AUTODJ_TOP && modelHasCapabilities(TrackModel::TRACKMODELCAPS_ADDTOAUTODJ)) { sendToAutoDJ(PlaylistDAO::AutoDJSendLoc::TOP); - } else if (doubleClickAction == DlgPrefLibrary::EDIT_METADATA) { - edit(index); } } |