File indexing completed on 2024-05-12 05:39:54
0001 /*************************************************************************** 0002 * Copyright (C) 2019 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 #ifndef CORE_MODEL_HELPER_H 0021 #define CORE_MODEL_HELPER_H 0022 #include <QJsonObject> 0023 #include <QString> 0024 #include <core_global.h> 0025 class SessionItemModel; 0026 class ProfileModel; 0027 class CharacterSheetModel; 0028 class DiceAliasModel; 0029 class CharacterStateModel; 0030 class AudioController; 0031 class MusicModel; 0032 namespace campaign 0033 { 0034 class Campaign; 0035 class NonPlayableCharacterModel; 0036 } // namespace campaign 0037 namespace charactersheet 0038 { 0039 class ImageModel; 0040 } 0041 namespace history 0042 { 0043 class HistoryModel; 0044 } 0045 class ContentController; 0046 namespace SettingsHelper 0047 { 0048 CORE_EXPORT void readConnectionProfileModel(ProfileModel* model); 0049 CORE_EXPORT void writeConnectionProfileModel(ProfileModel* model); 0050 0051 CORE_EXPORT void readHistoryModel(history::HistoryModel* model); 0052 CORE_EXPORT void writeHistoryModel(history::HistoryModel* model); 0053 0054 } // namespace SettingsHelper 0055 0056 namespace ModelHelper 0057 { 0058 CORE_EXPORT bool saveSession(const ContentController* ctrl); 0059 CORE_EXPORT bool saveAudioController(const AudioController* ctrl); 0060 0061 CORE_EXPORT bool saveCharacterSheet(const QString& path, const CharacterSheetModel* model); 0062 CORE_EXPORT bool loadCharacterSheet(const QString& path, CharacterSheetModel* model, 0063 charactersheet::ImageModel* imgModel, QJsonObject& root, QString& qmlCode); 0064 0065 CORE_EXPORT bool fetchThemeModel(const QJsonObject& themes, DiceAliasModel* model); 0066 CORE_EXPORT void fetchDiceModel(const QJsonArray& dice, DiceAliasModel* model); 0067 CORE_EXPORT void fetchMedia(const QJsonArray& medias, campaign::Campaign* campaign); 0068 CORE_EXPORT void fetchNpcModel(const QJsonArray& npcs, campaign::NonPlayableCharacterModel* model, 0069 const QString& rootDir); 0070 0071 CORE_EXPORT void fetchCharacterStateModel(const QJsonArray& states, CharacterStateModel* model); 0072 CORE_EXPORT QJsonArray saveCharacterStateModel(CharacterStateModel* model); 0073 0074 CORE_EXPORT void fetchMusicModelWithTableTop(MusicModel* model); 0075 0076 CORE_EXPORT QJsonObject saveCampaign(); 0077 0078 } // namespace ModelHelper 0079 #endif