1 /* 2 * Copyright (C) 2021 Emeric Poupon 3 * 4 * This file is part of LMS. 5 * 6 * LMS is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * LMS is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with LMS. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #include "LmsApplicationManager.hpp" 21 22 #include "LmsApplication.hpp" 23 24 namespace UserInterface 25 { 26 void registerApplication(LmsApplication & application)27 LmsApplicationManager::registerApplication(LmsApplication& application) 28 { 29 { 30 std::scoped_lock lock {_mutex}; 31 m_applications[application.getUserId()].insert(&application); 32 } 33 34 applicationRegistered.emit(application); 35 } 36 37 void unregisterApplication(LmsApplication & application)38 LmsApplicationManager::unregisterApplication(LmsApplication& application) 39 { 40 { 41 std::scoped_lock lock {_mutex}; 42 m_applications[application.getUserId()].erase(&application); 43 } 44 45 applicationUnregistered.emit(application); 46 } 47 48 } // UserInterface 49