mirror of
https://github.com/clangen/musikcube.git
synced 2024-11-19 20:13:36 +00:00
A couple small bug fixes in the directory browser.
This commit is contained in:
parent
80a10ffe5f
commit
e5d82dc868
@ -114,7 +114,7 @@ void DirectoryLayout::SetDirectory(const std::string& directory) {
|
|||||||
this->rootDirectory = directory;
|
this->rootDirectory = directory;
|
||||||
this->adapter->SetRootDirectory(directory);
|
this->adapter->SetRootDirectory(directory);
|
||||||
this->directoryList->SetSelectedIndex(0);
|
this->directoryList->SetSelectedIndex(0);
|
||||||
this->Refresh();
|
this->Refresh(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DirectoryLayout::OnVisibilityChanged(bool visible) {
|
void DirectoryLayout::OnVisibilityChanged(bool visible) {
|
||||||
@ -126,12 +126,17 @@ void DirectoryLayout::OnVisibilityChanged(bool visible) {
|
|||||||
|
|
||||||
void DirectoryLayout::RequeryTrackList(ListWindow *view) {
|
void DirectoryLayout::RequeryTrackList(ListWindow *view) {
|
||||||
size_t selected = this->directoryList->GetSelectedIndex();
|
size_t selected = this->directoryList->GetSelectedIndex();
|
||||||
if (selected != ListWindow::NO_SELECTION) {
|
std::string fullPath = "";
|
||||||
|
|
||||||
if (selected == 0 && this->adapter->GetLeafAt(0) == "..") {
|
if (selected == 0 && this->adapter->GetLeafAt(0) == "..") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (selected == ListWindow::NO_SELECTION) {
|
||||||
std::string fullPath = this->adapter->GetFullPathAt(selected);
|
fullPath = this->rootDirectory; /* no sub directories */
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fullPath = this->adapter->GetFullPathAt(selected);
|
||||||
|
}
|
||||||
|
|
||||||
if (fullPath.size()) {
|
if (fullPath.size()) {
|
||||||
fullPath = NormalizeDir(fullPath);
|
fullPath = NormalizeDir(fullPath);
|
||||||
@ -146,7 +151,6 @@ void DirectoryLayout::RequeryTrackList(ListWindow *view) {
|
|||||||
this->trackList->Requery(query);
|
this->trackList->Requery(query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DirectoryLayout::OnDirectoryChanged(
|
void DirectoryLayout::OnDirectoryChanged(
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
#include <core/support/Common.h>
|
#include <core/support/Common.h>
|
||||||
|
#include <cursespp/Text.h>
|
||||||
#include <cursespp/ScrollAdapterBase.h>
|
#include <cursespp/ScrollAdapterBase.h>
|
||||||
#include <cursespp/SingleLineEntry.h>
|
#include <cursespp/SingleLineEntry.h>
|
||||||
|
|
||||||
@ -241,5 +241,6 @@ IScrollAdapter::EntryPtr DirectoryAdapter::GetEntry(cursespp::ScrollableWindow*
|
|||||||
--index;
|
--index;
|
||||||
}
|
}
|
||||||
|
|
||||||
return IScrollAdapter::EntryPtr(new SingleLineEntry(this->subdirs[index]));
|
auto text = text::Ellipsize(this->subdirs[index], this->GetWidth());
|
||||||
|
return IScrollAdapter::EntryPtr(new SingleLineEntry(text));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user