Skip to content

Commit

Permalink
Merge pull request #2 from daschuer/libraryFocus
Browse files Browse the repository at this point in the history
Enable keybord navigation for the search box.
  • Loading branch information
jmigual authored Oct 14, 2016
2 parents 7e745bc + 440d458 commit 70ed385
Show file tree
Hide file tree
Showing 43 changed files with 891 additions and 1,052 deletions.
3 changes: 1 addition & 2 deletions build/depends.py
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ def sources(self, build):
"widget/wtracktableview.cpp",
"widget/wtracktableviewheader.cpp",
"widget/wlibrarysidebar.cpp",
"widget/wlibrary.cpp",
"widget/wlibrarypane.cpp",
"widget/wbaselibrary.cpp",
"widget/wlibrarytableview.cpp",
"widget/wanalysislibrarytableview.cpp",
Expand Down Expand Up @@ -933,7 +933,6 @@ def sources(self, build):
"library/library.cpp",
"library/librarypanemanager.cpp",
"library/librarysidebarexpandedmanager.cpp",
"library/sidebarmodel.cpp",

"library/scanner/libraryscanner.cpp",
"library/scanner/libraryscannerdlg.cpp",
Expand Down
Binary file modified res/images/library/ic_library_notpreselect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/images/library/ic_library_preselect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions res/skins/LateNight/style.qss
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,10 @@
#LibrarySidebarButtons:focus,
#LibrarySidebarButtons QToolButton:focus,
#LibrarySidebarExpanded > QWidget:focus,
#LibrarySidebarExpanded QAbstractScrollArea > QWidget:focus {
#LibrarySidebarExpanded QAbstractScrollArea > QWidget:focus,
WLibrarySidebar:focus,
WLibrary:focus,
QTableView:focus {
border: 1px solid #8E5C00;
}

Expand Down Expand Up @@ -1406,12 +1409,14 @@ WSearchLineEdit {
color: #cfb32c;
}


WSearchLineEdit:focus {
border: 2px solid #FF6600;
border: 1px solid #8E5C00;
background: #0f0f0f;
color: #eece33;
}


/* cover art */
WCoverArt { background: transparent; color: #ACACAC; }

Expand Down
10 changes: 6 additions & 4 deletions src/library/features/analysis/analysisfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Created 8/23/2009 by RJ Ryan (rryan@mit.edu)
// Forked 11/11/2009 by Albert Santoni (alberts@mixxx.org)

#include <widget/wlibrarypane.h>
#include <QtDebug>

#include "analyzer/analyzerqueue.h"
Expand All @@ -14,7 +15,6 @@
#include "util/debug.h"
#include "util/dnd.h"
#include "widget/wanalysislibrarytableview.h"
#include "widget/wlibrary.h"
#include "widget/wtracktableview.h"

AnalysisFeature::AnalysisFeature(UserSettingsPointer pConfig,
Expand Down Expand Up @@ -61,7 +61,7 @@ QString AnalysisFeature::getSettingsName() const {
}

QWidget* AnalysisFeature::createPaneWidget(KeyboardEventFilter* pKeyboard, int paneId) {
WTrackTableView* pTable = createTableWidget(pKeyboard, paneId);
WTrackTableView* pTable = createTableWidget(paneId);
pTable->loadTrackModel(getAnalysisTableModel());
connect(pTable->selectionModel(),
SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
Expand Down Expand Up @@ -194,9 +194,11 @@ void AnalysisFeature::tableSelectionChanged(const QItemSelection&,

bool AnalysisFeature::dropAccept(QList<QUrl> urls, QObject* pSource) {
Q_UNUSED(pSource);
QList<QFileInfo> files = DragAndDropHelper::supportedTracksFromUrls(urls, false, true);
QList<QFileInfo> files =
DragAndDropHelper::supportedTracksFromUrls(urls, false, true);
// Adds track, does not insert duplicates, handles unremoving logic.
QList<TrackId> trackIds = m_pTrackCollection->getTrackDAO().addMultipleTracks(files, true);
QList<TrackId> trackIds =
m_pTrackCollection->getTrackDAO().addMultipleTracks(files, true);
analyzeTracks(trackIds);
return trackIds.size() > 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/library/features/autodj/autodjfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ QString AutoDJFeature::getSettingsName() const {
}

QWidget* AutoDJFeature::createPaneWidget(KeyboardEventFilter* pKeyboard, int paneId) {
WTrackTableView* pTrackTableView = createTableWidget(pKeyboard, paneId);
WTrackTableView* pTrackTableView = createTableWidget(paneId);
pTrackTableView->loadTrackModel(m_pAutoDJProcessor->getTableModel());

connect(pTrackTableView->selectionModel(),
Expand Down
38 changes: 20 additions & 18 deletions src/library/features/baseplaylist/baseplaylistfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ BasePlaylistFeature::BasePlaylistFeature(UserSettingsPointer pConfig,

connect(pLibrary, SIGNAL(trackSelected(TrackPointer)),
this, SLOT(slotTrackSelected(TrackPointer)));
connect(pLibrary, SIGNAL(switchToView(const QString&)),
this, SLOT(slotResetSelectedTrack()));
}

BasePlaylistFeature::~BasePlaylistFeature() {
Expand Down Expand Up @@ -127,11 +125,19 @@ QPointer<PlaylistTableModel> BasePlaylistFeature::getPlaylistTableModel(int pane
}

void BasePlaylistFeature::activate() {
if (m_lastChildClicked[m_featurePane].isValid()) {
activateChild(m_lastChildClicked[m_featurePane]);
int preselectedPane = getPreselectedPane();
if (preselectedPane >= 0) {
m_featurePane = preselectedPane;
}

auto modelIt = m_lastChildClicked.find(m_featurePane);
if (modelIt != m_lastChildClicked.end() && (*modelIt).isValid()) {
qDebug() << "BasePlaylistFeature::activate" << "m_lastChildClicked found";
// Open last clicked Playlist in the preselectded pane
activateChild(*modelIt);
return;
}

showBrowse(m_featurePane);
switchToFeature();
showBreadCrumb();
Expand All @@ -140,8 +146,9 @@ void BasePlaylistFeature::activate() {
}

void BasePlaylistFeature::activateChild(const QModelIndex& index) {
if (getPreselectedPane() >= 0) {
m_featurePane = getPreselectedPane();
int preselectedPane = getPreselectedPane();
if (preselectedPane >= 0) {
m_featurePane = preselectedPane;
}

if (index == m_lastChildClicked[m_featurePane]) {
Expand Down Expand Up @@ -656,8 +663,8 @@ int BasePlaylistFeature::playlistIdFromIndex(const QModelIndex& index) const {

void BasePlaylistFeature::showTable(int paneId) {
auto it = m_panes.find(paneId);
auto itId = m_idTable.find(paneId);
if (it == m_panes.end() || it->isNull() || itId == m_idTable.end()) {
auto itId = m_tableIndexByPaneId.find(paneId);
if (it == m_panes.end() || it->isNull() || itId == m_tableIndexByPaneId.end()) {
return;
}

Expand All @@ -666,8 +673,8 @@ void BasePlaylistFeature::showTable(int paneId) {

void BasePlaylistFeature::showBrowse(int paneId) {
auto it = m_panes.find(paneId);
auto itId = m_idBrowse.find(paneId);
if (it == m_panes.end() || it->isNull() || itId == m_idBrowse.end()) {
auto itId = m_browseIndexByPaneId.find(paneId);
if (it == m_panes.end() || it->isNull() || itId == m_browseIndexByPaneId.end()) {
return;
}

Expand Down Expand Up @@ -700,11 +707,11 @@ QWidget* BasePlaylistFeature::createPaneWidget(KeyboardEventFilter* pKeyboard,
edit->installEventFilter(pKeyboard);
connect(edit, SIGNAL(anchorClicked(const QUrl)),
this, SLOT(htmlLinkClicked(const QUrl)));
m_idBrowse[paneId] = pStack->addWidget(edit);
m_browseIndexByPaneId[paneId] = pStack->addWidget(edit);

QWidget* pTable = LibraryFeature::createPaneWidget(pKeyboard, paneId);
pTable->setParent(pStack);
m_idTable[paneId] = pStack->addWidget(pTable);
m_tableIndexByPaneId[paneId] = pStack->addWidget(pTable);

return pStack;
}
Expand Down Expand Up @@ -812,8 +819,3 @@ void BasePlaylistFeature::slotTrackSelected(TrackPointer pTrack) {

m_childModel->triggerRepaint();
}


void BasePlaylistFeature::slotResetSelectedTrack() {
slotTrackSelected(TrackPointer());
}
7 changes: 3 additions & 4 deletions src/library/features/baseplaylist/baseplaylistfeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class KeyboardEventFilter;
class PlaylistTableModel;
class TrackCollection;
class TreeItem;
class WLibrary;
class WLibraryPane;
class WLibraryStack;

class BasePlaylistFeature : public LibraryFeature {
Expand Down Expand Up @@ -126,16 +126,15 @@ class BasePlaylistFeature : public LibraryFeature {

private slots:
void slotTrackSelected(TrackPointer pTrack);
void slotResetSelectedTrack();

private:
virtual QString getRootViewHtml() const = 0;

QSet<int> m_playlistsSelectedTrackIsIn;

QHash<int, QPointer<WLibraryStack> > m_panes;
QHash<int, int> m_idBrowse;
QHash<int, int> m_idTable;
QHash<int, int> m_browseIndexByPaneId;
QHash<int, int> m_tableIndexByPaneId;
};

#endif /* BASEPLAYLISTFEATURE_H */
2 changes: 1 addition & 1 deletion src/library/features/browse/browsefeature.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// browsefeature.cpp
// Created 9/8/2009 by RJ Ryan (rryan@mit.edu)

#include <widget/wlibrarypane.h>
#include <QAction>
#include <QDesktopServices>
#include <QDirModel>
Expand All @@ -13,7 +14,6 @@
#include "library/features/browse/browsefeature.h"
#include "library/trackcollection.h"
#include "util/sandbox.h"
#include "widget/wlibrary.h"
#include "widget/wlibrarystack.h"
#include "widget/wlibrarytextbrowser.h"

Expand Down
15 changes: 11 additions & 4 deletions src/library/features/crates/cratefeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,14 @@ TreeItemModel* CrateFeature::getChildModel() {
}

void CrateFeature::activate() {
if (m_lastClickedIndex[m_featurePane].isValid()) {
activateChild(m_lastClickedIndex[m_featurePane]);
int preselectedPane = getPreselectedPane();
if (preselectedPane >= 0) {
m_featurePane = preselectedPane;
}

auto modelIt = m_lastClickedIndex.find(m_featurePane);
if (modelIt != m_lastClickedIndex.end() && (*modelIt).isValid()) {
activateChild(*modelIt);
return;
}

Expand All @@ -231,8 +237,9 @@ void CrateFeature::activate() {
}

void CrateFeature::activateChild(const QModelIndex& index) {
if (getPreselectedPane() >= 0) {
m_featurePane = getPreselectedPane();
int preselectedPane = getPreselectedPane();
if (preselectedPane >= 0) {
m_featurePane = preselectedPane;
}

m_lastClickedIndex[m_featurePane] = index;
Expand Down
3 changes: 2 additions & 1 deletion src/library/features/maintenance/maintenancefeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ QWidget* MaintenanceFeature::createInnerSidebarWidget(KeyboardEventFilter* pKeyb

QWidget* MaintenanceFeature::createPaneWidget(KeyboardEventFilter* pKeyboard,
int paneId) {
WTrackTableView* pTable = LibraryFeature::createTableWidget(pKeyboard, paneId);
Q_UNUSED(pKeyboard);
WTrackTableView* pTable = LibraryFeature::createTableWidget(paneId);

return pTable;
}
Expand Down
6 changes: 3 additions & 3 deletions src/library/features/mixxxlibrary/mixxxlibraryfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,11 +172,11 @@ void MixxxLibraryFeature::setChildModel(TreeItemModel* pChild) {

m_pChildModel = pChild;
connect(&m_trackDao, SIGNAL(trackChanged(TrackId)),
m_pChildModel, SLOT(reloadTracksTree()));
m_pChildModel, SLOT(reloadTree()));
connect(&m_trackDao, SIGNAL(tracksRemoved(QSet<TrackId>)),
m_pChildModel, SLOT(reloadTracksTree()));
m_pChildModel, SLOT(reloadTree()));
connect(&m_trackDao, SIGNAL(tracksAdded(QSet<TrackId>)),
m_pChildModel, SLOT(reloadTracksTree()));
m_pChildModel, SLOT(reloadTree()));
}

void MixxxLibraryFeature::activate() {
Expand Down
14 changes: 9 additions & 5 deletions src/library/features/recording/recordingfeature.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// recordingfeature.cpp
// Created 03/26/2010 by Tobias Rafreider

#include <widget/wlibrarypane.h>
#include "controllers/keyboard/keyboardeventfilter.h"
#include "library/features/recording/dlgrecording.h"
#include "library/features/recording/recordingfeature.h"
#include "library/library.h"
#include "library/trackcollection.h"
#include "track/track.h"
#include "widget/wlibrary.h"
#include "widget/wtracktableview.h"

RecordingFeature::RecordingFeature(UserSettingsPointer pConfig,
Expand Down Expand Up @@ -47,13 +47,16 @@ TreeItemModel* RecordingFeature::getChildModel() {
return &m_childModel;
}

QWidget* RecordingFeature::createPaneWidget(KeyboardEventFilter* pKeyboard, int paneId) {
WTrackTableView* pTable = LibraryFeature::createTableWidget(pKeyboard, paneId);
QWidget* RecordingFeature::createPaneWidget(
KeyboardEventFilter* pKeyboard, int paneId) {
Q_UNUSED(pKeyboard);
WTrackTableView* pTable = LibraryFeature::createTableWidget(paneId);
pTable->setSorting(false);
return pTable;
}

QWidget *RecordingFeature::createInnerSidebarWidget(KeyboardEventFilter* pKeyboard) {
QWidget *RecordingFeature::createInnerSidebarWidget(
KeyboardEventFilter* pKeyboard) {
m_pRecordingView = new DlgRecording(nullptr,
m_pTrackCollection,
m_pRecordingManager);
Expand All @@ -79,7 +82,8 @@ void RecordingFeature::activate() {

BrowseTableModel* RecordingFeature::getBrowseTableModel() {
if (m_pBrowseModel.isNull()) {
m_pBrowseModel = new BrowseTableModel(this, m_pTrackCollection, m_pRecordingManager);
m_pBrowseModel = new BrowseTableModel(
this, m_pTrackCollection, m_pRecordingManager);
}

return m_pBrowseModel;
Expand Down
Loading

0 comments on commit 70ed385

Please sign in to comment.