blob: 2d3bf6872f3b64508622eca254ca112414b67cff [file] [log] [blame]
Aline Gondim Santos329f8622022-11-08 08:04:22 -03001/**
2 * Copyright (C) 2021 Savoir-faire Linux Inc.
3 *
4 * Author: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com>
5 *
6 * This program 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 * 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, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20
21#pragma once
22
23#include "plugin/jamiplugin.h"
24#include "plugin/preferencehandler.h"
25
26#include <string>
27#include <map>
28#include <memory>
29#include <set>
30#include <mutex>
31
32namespace jami {
Aline Gondim Santosbd032f82022-11-25 15:39:12 -030033
34enum Parameter {
35 POSITION,
36 BACKGROUND,
37 FONTSIZE,
38 LANGUAGE
39};
40
Aline Gondim Santos329f8622022-11-08 08:04:22 -030041class TranscriptMediaHandler;
42
43class PluginPreferenceHandler : public jami::PreferenceHandler
44{
45public:
46 PluginPreferenceHandler(const JAMI_PluginAPI* api,
47 std::map<std::string, std::map<std::string, std::string>>&& preferences,
48 const std::string& dataPath);
49 ~PluginPreferenceHandler();
50
51 std::map<std::string, std::string> getHandlerDetails() override;
52 bool preferenceMapHasKey(const std::string& key) override;
53 void setPreferenceAttribute(const std::string& accountId,
54 const std::string& key,
55 const std::string& value) override;
56 void resetPreferenceAttributes(const std::string& accountId) override;
57
58 std::map<std::string, std::string> getPreferences(const std::string& accountId);
59 void setTranscriptHandler(TranscriptMediaHandler* handler);
60
61private:
62 const JAMI_PluginAPI* api_;
63 TranscriptMediaHandler* tmh_;
64 const std::string datapath_;
65 std::map<std::string, std::map<std::string, std::string>> preferences_;
66 std::mutex mtx_;
67};
68} // namespace jami