Fixed win32 compile, and a couple small bugs.

This commit is contained in:
casey langen 2017-01-25 07:42:15 -08:00
parent 5c4ef10f5f
commit 545d179873
6 changed files with 19 additions and 4 deletions

View File

@ -95,6 +95,7 @@
<ClInclude Include="pch.hpp" />
<ClInclude Include="query\CategoryListQuery.h" />
<ClInclude Include="query\CategoryTrackListQuery.h" />
<ClInclude Include="query\GetPlaylistQuery.h" />
<ClInclude Include="query\NowPlayingTrackListQuery.h" />
<ClInclude Include="query\SearchTrackListQuery.h" />
<ClInclude Include="query\TrackListQueryBase.h" />
@ -109,6 +110,7 @@
</ClCompile>
<ClCompile Include="query\CategoryListQuery.cpp" />
<ClCompile Include="query\CategoryTrackListQuery.cpp" />
<ClCompile Include="query\GetPlaylistQuery.cpp" />
<ClCompile Include="query\NowPlayingTrackListQuery.cpp" />
<ClCompile Include="query\SearchTrackListQuery.cpp" />
<ClCompile Include="util\Duration.cpp" />

View File

@ -42,6 +42,9 @@
<ClInclude Include="query\CategoryListQuery.h">
<Filter>src\query</Filter>
</ClInclude>
<ClInclude Include="query\GetPlaylistQuery.h">
<Filter>src\query</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="pch.cpp">
@ -68,5 +71,8 @@
<ClCompile Include="query\CategoryListQuery.cpp">
<Filter>src\query</Filter>
</ClCompile>
<ClCompile Include="query\GetPlaylistQuery.cpp">
<Filter>src\query</Filter>
</ClCompile>
</ItemGroup>
</Project>

View File

@ -214,7 +214,6 @@ bool NowPlayingLayout::KeyPress(const std::string& key) {
return true;
}
else if (key == "M-s") {
PlayQueueOverlays::ShowSavePlaylistOverlay(this->playback, this->library);
}
else if (ProcessEditOperation(key)) {
return true;

View File

@ -123,6 +123,10 @@ void PlayQueueOverlays::ShowAddCategoryOverlay(
.SetItemSelectedCallback(
[&playback, library, fieldColumn, fieldId]
(cursespp::IScrollAdapterPtr adapter, size_t index) {
if (index == (size_t)-1) {
return;
}
std::shared_ptr<CategoryTrackListQuery>
query(new CategoryTrackListQuery(
library,
@ -184,7 +188,7 @@ void PlayQueueOverlays::ShowLoadPlaylistOverlay(
.SetItemSelectedCallback(
[&playback, library, result, callback]
(cursespp::IScrollAdapterPtr adapter, size_t index) {
if (callback) {
if (index != (size_t) -1 && callback) {
DBID playlistId = (*result)[index]->id;
callback(std::shared_ptr<GetPlaylistQuery>(

View File

@ -225,6 +225,10 @@ void ListWindow::SetSelectedIndex(size_t index) {
}
size_t ListWindow::GetSelectedIndex() {
if (this->selectedIndex >= this->GetScrollAdapter().GetEntryCount()) {
return NO_SELECTION;
}
return this->selectedIndex;
}

View File

@ -528,8 +528,8 @@ void Window::Create() {
this->content = newwin(
this->height - 2,
this->width - 2,
this->GetY() + 1,
this->GetX() + 1);
absoluteYOffset + this->y + 1,
absoluteXOffset + this->x + 1);
if (!this->content) {
/* should never happen. if there's enough room for this->frame,