CuteLogger
Fast and simple logging solution for Qt based applications
FlatpakWrapperGenerator.h
1/*
2 * Copyright (c) 2025 Meltytech, LLC
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, see <http://www.gnu.org/licenses/>.
16 */
17
18#pragma once
19
20#include <QList>
21#include <QString>
22#include <QStringList>
23
24struct AppEntry
25{
26 QString appId;
27 QString branch; // e.g., "stable"
28};
29
30class FlatpakWrapperGenerator
31{
32public:
33 void setOutputDir(const QString &dir) { m_outputDir = dir; }
34 void setForce(bool v) { m_force = v; }
35 void setDryRun(bool v) { m_dryRun = v; }
36 void setPrefix(const QString &p) { m_prefix = p; }
37
38 bool generateAllInstalled();
39 bool generateFor(const QStringList &appIds);
40
41private:
42 bool ensureOutputDir() const;
43 QList<AppEntry> listInstalledApps() const;
44 QString getBranchForAppId(const QString &appId) const;
45 bool writeWrapper(const AppEntry &app) const;
46 QString buildWrapperScript(const AppEntry &app) const;
47
48 QString m_outputDir;
49 bool m_force = false;
50 bool m_dryRun = false;
51 QString m_prefix;
52};