Subversion Repositories tpanel

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
22 andreas 1
/*
2
 * Copyright (C) 2021 by Andreas Theofilu <andreas@theosys.at>
3
 *
4
 * This program is free software; you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation; either version 3 of the License, or
7
 * (at your option) any later version.
8
 *
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program; if not, write to the Free Software Foundation,
16
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
17
 */
18
#ifndef TTPINIT_H
19
#define TTPINIT_H
20
 
21
#include <string>
122 andreas 22
#include <vector>
120 andreas 23
#include <functional>
22 andreas 24
 
137 andreas 25
#define MAX_TMP_LEN     10
26
 
22 andreas 27
class TTPInit
28
{
29
    public:
30
        TTPInit(const std::string& path);
51 andreas 31
        TTPInit();
22 andreas 32
 
51 andreas 33
        void setPath(const std::string& p) { mPath = p; }
34
        bool createDirectoryStructure();
115 andreas 35
        bool loadSurfaceFromController(bool force=false);
122 andreas 36
        std::vector<std::string>& getFileList(const std::string& filter);
37
        bool isSystemDefault();
38
        bool isVirgin();
159 andreas 39
        bool makeSystemFiles();
156 andreas 40
        bool reinitialize();
51 andreas 41
 
120 andreas 42
        int progressCallback(off64_t xfer);
43
        void regCallbackProcessEvents(std::function<void ()> pe) { _processEvents = pe; }
44
 
22 andreas 45
    private:
120 andreas 46
        std::function<void ()> _processEvents{nullptr};
47
 
22 andreas 48
        bool createPanelConfigs();
117 andreas 49
        bool createSystemConfigs();
50 andreas 50
        bool _makeDir(const std::string& dir);
113 andreas 51
        bool copyFile(const std::string& fname);
137 andreas 52
        std::string getTmpFileName();
43 andreas 53
#ifdef __ANDROID__
54
        bool askPermissions();
55
#endif
22 andreas 56
        std::string mPath;
122 andreas 57
        std::vector<std::string> mDirList;
137 andreas 58
        void logging(int level, const std::string& msg);
22 andreas 59
};
60
 
61
#endif // TTPINIT_H