mirror of
https://github.com/clangen/musikcube.git
synced 2024-11-19 11:10:52 +00:00
Added the ability to start playback directly from the directory pane in
DirectoryLayout by using the context menu key.
This commit is contained in:
parent
82931b3669
commit
b96c2e6c17
@ -38,6 +38,7 @@
|
||||
#include <core/support/Messages.h>
|
||||
#include <core/i18n/Locale.h>
|
||||
#include <cursespp/Colors.h>
|
||||
#include <cursespp/ToastOverlay.h>
|
||||
#include <app/util/Hotkeys.h>
|
||||
#include <app/util/Playback.h>
|
||||
#include <app/util/Messages.h>
|
||||
@ -218,8 +219,11 @@ bool DirectoryLayout::IsParentRoot() {
|
||||
|
||||
bool DirectoryLayout::KeyPress(const std::string& key) {
|
||||
if (key == "KEY_ENTER") {
|
||||
if (this->GetFocus() = this->directoryList) {
|
||||
if (this->GetFocus() == this->directoryList) {
|
||||
if (!this->adapter->HasSubDirectories(this->directoryList->GetSelectedIndex())) {
|
||||
std::string message = _TSTR("browse_no_subdirectories_toast");
|
||||
message = (boost::format(message) % Hotkeys::Get(Hotkeys::ContextMenu)).str();
|
||||
ToastOverlay::Show(message);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -236,6 +240,12 @@ bool DirectoryLayout::KeyPress(const std::string& key) {
|
||||
this->Requery();
|
||||
}
|
||||
}
|
||||
else if (Hotkeys::Is(Hotkeys::ContextMenu, key)) {
|
||||
auto tracks = this->trackList->GetTrackList();
|
||||
auto index = this->trackList->GetSelectedTrackIndex();
|
||||
index = (index == ListWindow::NO_SELECTION) ? 0 : index;
|
||||
this->playback.Play(*tracks.get(), index);
|
||||
}
|
||||
else if (Hotkeys::Is(Hotkeys::ViewRefresh, key)) {
|
||||
this->queryHash = 0;
|
||||
this->Refresh();
|
||||
|
@ -28,6 +28,7 @@
|
||||
"browse_pick_path_last_directory": "last directory",
|
||||
"browse_no_paths_overlay_error_title": "no paths configured",
|
||||
"browse_no_paths_overlay_error_message": "you have not configured any metadata paths.\n\nyou must add at least one path in the settings screen before you can browse by directory.",
|
||||
"browse_no_subdirectories_toast": "there are no more sub-directories.\n\npress '%s' to play the selection.",
|
||||
|
||||
"console_command_output_title": "command output",
|
||||
"console_debug_logs_title": "debug logs",
|
||||
|
Loading…
Reference in New Issue
Block a user