File indexing completed on 2024-05-05 05:40:23

0001 /***************************************************************************
0002  *  Copyright (C) 2021 by Renaud Guezennec                               *
0003  *   http://www.rolisteam.org/contact                                      *
0004  *                                                                         *
0005  *   This software is free software; you can redistribute it and/or modify *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  *                                                                         *
0010  *   This program is distributed in the hope that it will be useful,       *
0011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0013  *   GNU General Public License for more details.                          *
0014  *                                                                         *
0015  *   You should have received a copy of the GNU General Public License     *
0016  *   along with this program; if not, write to the                         *
0017  *   Free Software Foundation, Inc.,                                       *
0018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
0019  ***************************************************************************/
0020 #include "controller/audiocontroller.h"
0021 
0022 AudioController::AudioController(campaign::CampaignManager* campaign, PreferencesManager* pref, QObject* parent)
0023     : QObject(parent)
0024     , m_firstCtrl(new AudioPlayerController(First, Core::preferences::KEY_DIRECTORY_AP1, pref))
0025     , m_secondCtrl(new AudioPlayerController(Second, Core::preferences::KEY_DIRECTORY_AP2, pref))
0026     , m_thirdCtrl(new AudioPlayerController(Third, Core::preferences::KEY_DIRECTORY_AP3, pref))
0027     , m_updater(new AudioPlayerUpdater(campaign, this))
0028 {
0029     connect(m_firstCtrl.get(), &AudioPlayerController::localIsGmChanged, this, &AudioController::localisGMChanged);
0030 }
0031 
0032 AudioPlayerController* AudioController::firstController() const
0033 {
0034     return m_firstCtrl.get();
0035 }
0036 AudioPlayerController* AudioController::secondController() const
0037 {
0038     return m_secondCtrl.get();
0039 }
0040 AudioPlayerController* AudioController::thirdController() const
0041 {
0042     return m_thirdCtrl.get();
0043 }
0044 
0045 bool AudioController::localIsGM() const
0046 {
0047     return m_firstCtrl->localIsGm();
0048 }
0049 
0050 void AudioController::setLocalIsGM(bool m)
0051 {
0052     m_firstCtrl->setLocalIsGm(m);
0053     m_secondCtrl->setLocalIsGm(m);
0054     m_thirdCtrl->setLocalIsGm(m);
0055     m_updater->setLocalIsGM(m);
0056 }