1 /* SoundcloudLibraryContainer.cpp */ 2 3 /* Copyright (C) 2011-2020 Michael Lugmair (Lucio Carreras) 4 * 5 * This file is part of sayonara player 6 * 7 * This program is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 17 * You should have received a copy of the GNU General Public License 18 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 21 /* SoundcloudLibraryContainer.cpp */ 22 23 #include "SoundcloudLibraryContainer.h" 24 #include "Gui/Soundcloud/GUI_SoundcloudLibrary.h" 25 26 #include "Components/Streaming/Soundcloud/SoundcloudLibrary.h" 27 #include "Interfaces/LibraryPlaylistInteractor.h" 28 UI_FWD(GUI_SoundcloudLibrary)29#include <qglobal.h> 30 #include <QIcon> 31 32 static void sc_init_icons() 33 { 34 Q_INIT_RESOURCE(SoundcloudIcons); 35 } 36 37 struct SC::LibraryContainer::Private 38 { 39 LibraryPlaylistInteractor* playlistInteractor; 40 41 explicit Private(LibraryPlaylistInteractor* playlistInteractor) : 42 playlistInteractor(playlistInteractor) 43 {} 44 }; 45 46 SC::LibraryContainer::LibraryContainer(LibraryPlaylistInteractor* playlistInteractor, QObject* parent) : 47 ::Library::Container(parent) 48 { 49 sc_init_icons(); 50 51 m = Pimpl::make<Private>(playlistInteractor); 52 } 53 54 SC::LibraryContainer::~LibraryContainer() = default; 55 56 QString SC::LibraryContainer::name() const 57 { 58 return "soundcloud"; 59 } 60 61 QString SC::LibraryContainer::displayName() const 62 { 63 return "Soundcloud"; 64 } 65 66 QWidget* SC::LibraryContainer::widget() const 67 { 68 return static_cast<QWidget*>(ui); 69 } 70 71 QMenu* SC::LibraryContainer::menu() 72 { 73 if(ui){ 74 return ui->getMenu(); 75 } 76 77 return nullptr; 78 } 79 80 void SC::LibraryContainer::initUi() 81 { 82 auto* library = new SC::Library(m->playlistInteractor, this); 83 ui = new SC::GUI_Library(library); 84 } 85 86 QFrame* SC::LibraryContainer::header() const 87 { 88 return ui->headerFrame(); 89 } 90 91 QIcon SC::LibraryContainer::icon() const 92 { 93 sc_init_icons(); 94 return QIcon(":/sc_icons/icon.png"); 95 } 96