Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a combobox instead of a lineedit widget for library search history #3171

Merged
merged 27 commits into from
Oct 29, 2020
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d1a0c3b
Use a combobox instead of a lineedit widget and utalize the combobox
poelzi Oct 12, 2020
0d491ad
WSearchLineEdit: apply library font to both QLineEdit and QListView
ronso0 Oct 13, 2020
b992c17
Fix resize problem, update history behaviour
poelzi Oct 13, 2020
1a5b9d5
Merge branch 'apply-lib-font' of https://github.com/ronso0/mixxx into…
poelzi Oct 13, 2020
b74f850
Implement control object for navigating history
poelzi Oct 13, 2020
407ae68
Allow tab key emulation to reach search bar again.
poelzi Oct 14, 2020
118f4e5
WSearchLineEdit: fully enable controllers to scroll previous search q…
ronso0 Oct 15, 2020
5797c14
WSearchLineEdit: when focused use [Library],GoToItem to jump to track…
ronso0 Oct 15, 2020
11a4a34
Fix debug assert in searchbox
poelzi Oct 17, 2020
9424035
fix wrong control name
poelzi Oct 17, 2020
e711daf
Clearer variable naming. Remove spam log entries.
poelzi Oct 17, 2020
824bc57
fix typo, rename variable
poelzi Oct 17, 2020
864f4f7
Merge branch 'main' into searchbox-combo
ronso0 Oct 26, 2020
6529419
Merge branch 'main' of https://github.com/mixxxdj/mixxx into searchbo…
poelzi Oct 26, 2020
6d26c26
Take layout direction into account when writing stylesheet
poelzi Oct 26, 2020
cec5382
Add ctrl + space to open/close search history
poelzi Oct 26, 2020
db327fd
Start search on enter
poelzi Oct 26, 2020
a1f8358
Merge branch 'searchbox-combo' of github.com:poelzi/mixxx into search…
poelzi Oct 26, 2020
9d995a6
Use function to return current history index.
poelzi Oct 26, 2020
0c78b61
remove unnecessary casts
poelzi Oct 26, 2020
d108955
fix selection after clearing the search field
poelzi Oct 27, 2020
0b5adb2
Rename history search control, fix typo
poelzi Oct 27, 2020
f12cb97
Check for values ge 1.0
poelzi Oct 27, 2020
94dfdb2
rename padding argument
poelzi Oct 29, 2020
8fdd642
make pre commit happy again
poelzi Oct 29, 2020
787f770
fix camelcase
poelzi Oct 29, 2020
9e29613
Fix widget size on very long entries in the history
poelzi Oct 29, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion res/skins/LateNight/style.qss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ WTrackText,
WTrackProperty,
WBeatSpinBox,
QSpinBox,
QComboBox,
WLibrary QHeaderView,
WLibrary QHeaderView::item,
QToolTip,
Expand All @@ -27,6 +26,7 @@ WCoverArtMenu,
WTrackMenu,
WTrackMenu QMenu,
WOverview /* Hotcue labels in the overview */,
WBeatSpinBox, #spinBoxTransition,
WEffectSelector,
WEffectSelector QAbstractScrollArea,
#fadeModeCombobox,
Expand Down
31 changes: 30 additions & 1 deletion src/controllers/controlpickermenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,36 @@ ControlPickerMenu::ControlPickerMenu(QWidget* pParent)
tr("Add to Auto DJ Queue (replace)"),
tr("Replace Auto DJ Queue with selected tracks"),
libraryMenu, false, m_libraryStr);
libraryMenu->addSeparator();
addControl("[Library]",
"search_history_next",
tr("Select next search history"),
tr("Selects the next search history entry"),
libraryMenu,
false,
m_libraryStr);
addControl("[Library]",
"search_history_prev",
tr("Select previous search history"),
tr("Selects the previous search history entry"),
libraryMenu,
false,
m_libraryStr);
addControl("[Library]",
"search_history_move",
tr("Move selected search entry"),
tr("Moves the selected search history item into given direction "
"and steps"),
libraryMenu,
false,
m_libraryStr);

// Load track (these can be loaded into any channel)
addDeckAndSamplerControl("LoadSelectedTrack",
tr("Load Track"),
tr("Load selected track"), libraryMenu);
addDeckAndSamplerAndPreviewDeckControl("LoadSelectedTrackAndPlay", tr("Track Load and Play"),
tr("Load selected track and play"), libraryMenu);

addControl("[Recording]", "toggle_recording",
tr("Record Mix"),
tr("Toggle mix recording"),
Expand Down
47 changes: 46 additions & 1 deletion src/library/librarycontrol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,38 @@ LibraryControl::LibraryControl(Library* pLibrary)
this,
&LibraryControl::slotTrackColorNext);

// Control to navigate between widgets (tab/shit+tab button)
m_pSelectHistroyNext = std::make_unique<ControlPushButton>(
poelzi marked this conversation as resolved.
Show resolved Hide resolved
ConfigKey("[Library]", "search_history_next"));
m_pSelectHistoryPrev = std::make_unique<ControlPushButton>(
ConfigKey("[Library]", "search_history_prev"));
m_pSelectHistoryMove = std::make_unique<ControlEncoder>(
ConfigKey("[Library]", "search_history_move"), false);
poelzi marked this conversation as resolved.
Show resolved Hide resolved
connect(m_pSelectHistroyNext.get(),
&ControlPushButton::valueChanged,
this,
[this]() {
if (m_pSearchbox) {
poelzi marked this conversation as resolved.
Show resolved Hide resolved
m_pSearchbox->slotMoveSelectedHistory(1);
}
});
connect(m_pSelectHistoryPrev.get(),
&ControlPushButton::valueChanged,
this,
[this]() {
if (m_pSearchbox) {
m_pSearchbox->slotMoveSelectedHistory(-1);
}
});
connect(m_pSelectHistoryMove.get(),
&ControlEncoder::valueChanged,
this,
[this](double direction) {
if (m_pSearchbox) {
m_pSearchbox->slotMoveSelectedHistory(static_cast<int>(direction));
poelzi marked this conversation as resolved.
Show resolved Hide resolved
}
});

/// Deprecated controls
m_pSelectNextTrack = std::make_unique<ControlPushButton>(ConfigKey("[Playlist]", "SelectNextTrack"));
connect(m_pSelectNextTrack.get(),
Expand Down Expand Up @@ -537,19 +569,27 @@ void LibraryControl::emitKeyEvent(QKeyEvent&& event) {
VERIFY_OR_DEBUG_ASSERT(m_pLibraryWidget) {
return;
}
VERIFY_OR_DEBUG_ASSERT(m_pSearchbox) {
return;
}
if (!QApplication::focusWindow()) {
qDebug() << "Mixxx window is not focused, don't send key events";
return;
}

bool keyIsTab = event.key() == static_cast<int>(Qt::Key_Tab);
bool keyIsUpDown = event.key() == static_cast<int>(Qt::Key_Up) ||
poelzi marked this conversation as resolved.
Show resolved Hide resolved
event.key() == static_cast<int>(Qt::Key_Down);

// If the main window has focus, any widget can receive Tab.
// Other keys should be sent to library widgets only to not
// accidentally alter spinboxes etc.
// If the searchbox has focus allow only Up/Down to select previous queries.
if (!keyIsTab && !m_pSidebarWidget->hasFocus()
&& !m_pLibraryWidget->getActiveView()->hasFocus()) {
setLibraryFocus();
if (keyIsUpDown && !m_pSearchbox->hasFocus()) {
setLibraryFocus();
}
}
if (keyIsTab && !QApplication::focusWidget()){
setLibraryFocus();
Expand Down Expand Up @@ -643,6 +683,11 @@ void LibraryControl::slotGoToItem(double v) {
return activeView->loadSelectedTrack();
}

// If searchbox has focus jump to the tracks table
if (m_pSearchbox->hasFocus()) {
return setLibraryFocus();
}

// Clear the search if the searchbox has focus
emit clearSearchIfClearButtonHasFocus();

Expand Down
5 changes: 5 additions & 0 deletions src/library/librarycontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ class LibraryControl : public QObject {
std::unique_ptr<ControlPushButton> m_pTrackColorPrev;
std::unique_ptr<ControlPushButton> m_pTrackColorNext;

// Controls to navigate search history
std::unique_ptr<ControlPushButton> m_pSelectHistroyNext;
std::unique_ptr<ControlPushButton> m_pSelectHistoryPrev;
std::unique_ptr<ControlEncoder> m_pSelectHistoryMove;

// Font sizes
std::unique_ptr<ControlPushButton> m_pFontSizeIncrement;
std::unique_ptr<ControlPushButton> m_pFontSizeDecrement;
Expand Down
2 changes: 2 additions & 0 deletions src/preferences/dialog/dlgpreflibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ void DlgPrefLibrary::slotRemoveDir() {
} else if (removeMsgBox.clickedButton() == deleteAllButton) {
removalType = Library::RemovalType::PurgeTracks;
} else {
// Only used in DEBUG_ASSERT
Q_UNUSED(leaveUnchangedButton);
DEBUG_ASSERT(removeMsgBox.clickedButton() == leaveUnchangedButton);
removalType = Library::RemovalType::KeepTracks;
}
Expand Down
Loading