/**************************************************************************** ** Modern Linbo GUI ** Copyright (C) 2020 Dorian Zedler ** ** This program is free software: you can redistribute it and/or modify ** it under the terms of the GNU Affero 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 Affero General Public License for more details. ** ** You should have received a copy of the GNU Affero General Public License ** along with this program. If not, see . ****************************************************************************/ #ifndef LINBOBACKEND_H #define LINBOBACKEND_H #include #include #include #include #include #include #include #include #include #include "linboconfig.h" #include "linboos.h" #include "linboimage.h" #include "linbodiskpartition.h" using namespace std; class LinboBackend : public QObject { Q_OBJECT public: explicit LinboBackend(QObject *parent = nullptr); LinboConfig* getConfig(); QList getOperatingSystems(); protected: void read_qstring(ifstream* input, QString& tmp ); void read_bool( ifstream* input, bool& tmp); bool read_pair(ifstream* input, QString& key, QString& value); bool toBool(const QString& value); LinboOs* read_os(ifstream* input); LinboDiskPartition* read_partition(ifstream* input); void read_globals( ifstream* input, LinboConfig* config ); void saveappend( QStringList& command, const QString& item ); QStringList mksyncstartcommand(LinboConfig& config, LinboOs& os); QStringList mksynccommand(LinboConfig& config, LinboOs& os); QStringList mksyncrcommand(LinboConfig& config, LinboOs& os); QStringList mkpartitioncommand(vector &p); QStringList mkpartitioncommand_noformat(vector &p); QStringList mkcacheinitcommand(LinboConfig& config, vector &os, const QString& type); QStringList mklinboupdatecommand(LinboConfig& config); private: LinboConfig* config; QList operatingSystems; QList diskPartitions; QProcess* process; void readFromStdout(); void readFromStderr(); void executeCommand(QStringList commandArgs, bool waitForFinished = true); public slots: void executeAutostart(); void shutdown(); void reboot(); bool startOs(LinboOs* os); //bool syncStartOs(); //bool reinstallStartOs(); signals: }; #endif // LINBOBACKEND_H