mirror of
https://github.com/clangen/musikcube.git
synced 2025-01-01 17:58:29 +00:00
Added "Append to playlist" option in OpenURL dialog.
This commit is contained in:
parent
294cf5279e
commit
a6ba49b423
@ -38,6 +38,7 @@
|
||||
|
||||
#include <core/PlaybackQueue.h>
|
||||
#include <core/TrackFactory.h>
|
||||
#include <core/tracklist/MultiLibraryList.h>
|
||||
|
||||
#include <cube/dialog/OpenURLController.hpp>
|
||||
|
||||
@ -45,6 +46,7 @@
|
||||
#include <win32cpp/Button.hpp>
|
||||
#include <win32cpp/EditView.hpp>
|
||||
#include <win32cpp/RedrawLock.hpp>
|
||||
#include <win32cpp/CheckBox.hpp>
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
using namespace musik::cube::dialog;
|
||||
@ -79,7 +81,20 @@ void OpenURLController::OnCancel(win32cpp::Button* button){
|
||||
}
|
||||
|
||||
void OpenURLController::OnOK(win32cpp::Button* button){
|
||||
(*musik::core::PlaybackQueue::Instance().NowPlayingTracklist()) += musik::core::TrackFactory::CreateTrack( this->view->url->Caption().c_str() );
|
||||
musik::core::TrackPtr track = musik::core::TrackFactory::CreateTrack( this->view->url->Caption().c_str() );
|
||||
if(track){
|
||||
if(this->view->append->IsChecked()){
|
||||
// Append
|
||||
(*musik::core::PlaybackQueue::Instance().NowPlayingTracklist()) += track;
|
||||
}else{
|
||||
// Create a playlist to play
|
||||
musik::core::tracklist::MultiLibraryList playlist;
|
||||
playlist += track;
|
||||
playlist.SetPosition(0);
|
||||
|
||||
musik::core::PlaybackQueue::Instance().Play(playlist);
|
||||
}
|
||||
}
|
||||
this->mainWindow.Close();
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include <win32cpp/Button.hpp>
|
||||
#include <win32cpp/LinearLayout.hpp>
|
||||
#include <win32cpp/EditView.hpp>
|
||||
#include <win32cpp/CheckBox.hpp>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -62,18 +63,16 @@ void OpenURLView::OnCreated()
|
||||
// Top Row layout
|
||||
LinearLayout* rowLayout = new LinearLayout(VerticalLayout,win32cpp::LayoutFillFill);
|
||||
|
||||
LinearLayout* firstRow = new LinearLayout(HorizontalLayout,win32cpp::LayoutFillFill);
|
||||
Label *label = firstRow->AddChild(new Label(_T("URL:") ));
|
||||
Label *label = rowLayout->AddChild(new Label(_T("URL:") ));
|
||||
label->SetFont(boldFont);
|
||||
this->url = firstRow->AddChild(new EditView(_T("url"),win32cpp::LayoutFillFill ));
|
||||
rowLayout->AddChild(firstRow);
|
||||
this->url = rowLayout->AddChild(new EditView(_T(""),win32cpp::LayoutFillFill ));
|
||||
this->append = rowLayout->AddChild(new CheckBox(_T("Append to playlist"),win32cpp::LayoutFillFill ));
|
||||
|
||||
// Last rows column layout
|
||||
LinearLayout* bottomButtonLayout = new LinearLayout(HorizontalLayout);
|
||||
this->cancelButton = bottomButtonLayout->AddChild(new Button(_T("Cancel")));
|
||||
this->okButton = bottomButtonLayout->AddChild(new Button(_T("OK")));
|
||||
// this->cancelButton->Resize(60,20);
|
||||
// this->okButton->Resize(60,20);
|
||||
|
||||
rowLayout->AddChild(bottomButtonLayout);
|
||||
bottomButtonLayout->SetLayoutAlignment(LayoutAlignRight);
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
namespace win32cpp{
|
||||
class Button;
|
||||
class EditView;
|
||||
class CheckBox;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -61,6 +62,7 @@ class OpenURLView: public win32cpp::Frame{
|
||||
|
||||
win32cpp::Button *okButton, *cancelButton;
|
||||
win32cpp::EditView *url;
|
||||
win32cpp::CheckBox *append;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user