1 /* 2 * %kadu copyright begin% 3 * Copyright 2015 Rafał Przemysław Malinowski (rafal.przemyslaw.malinowski@gmail.com) 4 * %kadu copyright end% 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License as 8 * published by the Free Software Foundation; either version 2 of 9 * the License, or (at your option) any later version. 10 * 11 * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #include "sound-actions.h" 21 22 #include "gui/sound-mute-action.h" 23 #include "sound-manager.h" 24 25 #include "gui/actions/actions.h" 26 #include "gui/menu/menu-inventory.h" 27 #include "plugin/plugin-injected-factory.h" 28 SoundActions(QObject * parent)29SoundActions::SoundActions(QObject *parent) : 30 QObject{parent} 31 { 32 } 33 ~SoundActions()34SoundActions::~SoundActions() 35 { 36 } 37 setActions(Actions * actions)38void SoundActions::setActions(Actions *actions) 39 { 40 m_actions = actions; 41 } 42 setPluginInjectedFactory(PluginInjectedFactory * pluginInjectedFactory)43void SoundActions::setPluginInjectedFactory(PluginInjectedFactory *pluginInjectedFactory) 44 { 45 m_pluginInjectedFactory = pluginInjectedFactory; 46 } 47 setMenuInventory(MenuInventory * menuInventory)48void SoundActions::setMenuInventory(MenuInventory *menuInventory) 49 { 50 m_menuInventory = menuInventory; 51 } 52 setSoundManager(SoundManager * soundManager)53void SoundActions::setSoundManager(SoundManager *soundManager) 54 { 55 m_soundManager = soundManager; 56 } 57 init()58void SoundActions::init() 59 { 60 m_soundMuteAction = m_pluginInjectedFactory->makeInjected<SoundMuteAction>(this); 61 m_actions->insert(m_soundMuteAction); 62 63 m_menuInventory 64 ->menu("main") 65 ->addAction(m_soundMuteAction, KaduMenu::SectionMiscTools, 7) 66 ->update(); 67 68 m_soundMuteAction->setSoundManager(m_soundManager); 69 m_soundMuteAction->updateActionStates(); 70 } 71 done()72void SoundActions::done() 73 { 74 m_menuInventory 75 ->menu("main") 76 ->removeAction(m_soundMuteAction) 77 ->update(); 78 } 79 configurationUpdated()80void SoundActions::configurationUpdated() 81 { 82 m_soundMuteAction->updateActionStates(); 83 } 84 85 #include "moc_sound-actions.cpp" 86