|
@@ -40,6 +40,7 @@ namespace components {
|
|
|
auto video_list = m_builder->get_widget<Gtk::ListView>("videoList");
|
|
|
auto search_button = m_builder->get_widget<Gtk::Button>("searchButton");
|
|
|
auto start_search_button = m_builder->get_widget<Gtk::Button>("startSearchButton");
|
|
|
+ auto queue_play_button = m_builder->get_widget<Gtk::Button>("queuePlay");
|
|
|
m_search_body = m_builder->get_widget<Gtk::Paned>("searchBody");
|
|
|
m_search_entry = m_builder->get_widget<Gtk::Entry>("searchEntry");
|
|
|
m_start_search_entry = m_builder->get_widget<Gtk::Entry>("startSearchEntry");
|
|
@@ -54,6 +55,7 @@ namespace components {
|
|
|
assert(m_start_search_entry != nullptr);
|
|
|
assert(m_stackswitcher != nullptr);
|
|
|
assert(m_body != nullptr);
|
|
|
+ assert(queue_play_button != nullptr);
|
|
|
|
|
|
// -- Создание модели выбора видео в поиске --
|
|
|
m_video_storage = Gio::ListStore<components::VideoModel>::create();
|
|
@@ -101,6 +103,10 @@ namespace components {
|
|
|
m_rate_like_btn->signal_clicked().connect(sigc::bind(
|
|
|
sigc::mem_fun(*this, &MainWindow::onRateButtonClicked),
|
|
|
RateButtonParams { core::VideoRating::LIKE } ));
|
|
|
+
|
|
|
+ // Кнопки очереди
|
|
|
+ queue_play_button->signal_clicked().connect(
|
|
|
+ sigc::mem_fun(*this, &MainWindow::onQueueButtonClick));
|
|
|
}
|
|
|
|
|
|
void MainWindow::searchVideoByQuery(Glib::ustring query)
|
|
@@ -306,18 +312,25 @@ namespace components {
|
|
|
|
|
|
void MainWindow::playSingleVideo(std::string ytid)
|
|
|
{
|
|
|
+ // Создать процесс для проигрывания видео
|
|
|
Glib::spawn_async(
|
|
|
"",
|
|
|
- m_appcore->getMPVLaunchParams(ytid),
|
|
|
+ m_appcore->getMPVLaunchParams(m_appcore->getYTLink(ytid)),
|
|
|
Glib::SpawnFlags::DEFAULT
|
|
|
);
|
|
|
}
|
|
|
|
|
|
void MainWindow::playQueue()
|
|
|
{
|
|
|
+ // Создаётся файл .m3u в который помещаются все видео очереди
|
|
|
+ // Затем mpv открывает этот файл и проигрывает
|
|
|
+
|
|
|
+ m_appcore->createQueuePlaylist();
|
|
|
+ std::string playlist_path = m_appcore->getQueueFilePath();
|
|
|
+
|
|
|
Glib::spawn_async(
|
|
|
"",
|
|
|
- m_appcore->getMPVLaunchParams(m_appcore->getQueueYTIDs()),
|
|
|
+ m_appcore->getMPVLaunchParams(playlist_path),
|
|
|
Glib::SpawnFlags::DEFAULT
|
|
|
);
|
|
|
}
|
|
@@ -515,4 +528,9 @@ namespace components {
|
|
|
auto queue_container = m_builder->get_widget<Gtk::Box>("queue");
|
|
|
queue_container->set_visible(visible);
|
|
|
}
|
|
|
+
|
|
|
+ void MainWindow::onQueueButtonClick()
|
|
|
+ {
|
|
|
+ playQueue();
|
|
|
+ }
|
|
|
}
|