#pragma once /* ============================================================================== Copyright 2022 Nicolas Chambert This program is free software : you can redistribute itand /or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program.If not, see < http://www.gnu.org/licenses/>. ============================================================================== */ /* ============================================================================== Gestion de la sauvegarde de la configuration courante. ============================================================================== */ #include #include "Metronome.h" #include "OptionsPanel.h" class Metronome; struct OptionsPanel; class Config { public: ~Config() {}; // charge la config depuis le fichier json ou les valeurs par defaut static Config& Load(); // enregistre la config dans le fichier json static void Save(Metronome& metro, OptionsPanel& options); // paramètres sauvegardés int bpm{ 72 }; // default 72 int measures{ 4 }; // default 4 float gain{ 1.0f }; // default 1.0 juce::String sound{ "" }; // default empty int figure{ 1 }; // default 1 (noire) private: // je crois que c'est pas suffisant mais on devrait toujours passer par les méthodes statiques Config() {}; // convertisseur paramètre <-> var juce::var asVar(); void fromVar(juce::var var); // seule instance de config static Config* instance; };