2020-11-16 18:01:03 +01:00
|
|
|
/****************************************************************************
|
|
|
|
** Modern Linbo GUI
|
|
|
|
** Copyright (C) 2020 Dorian Zedler <dorian@itsblue.de>
|
|
|
|
**
|
|
|
|
** 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 <http://www.gnu.org/licenses/>.
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef LINBOOS_H
|
|
|
|
#define LINBOOS_H
|
|
|
|
|
|
|
|
#include <QObject>
|
2020-11-20 15:09:36 +01:00
|
|
|
#include <QtDebug>
|
2020-11-16 18:01:03 +01:00
|
|
|
|
|
|
|
#include "linboimage.h"
|
|
|
|
|
|
|
|
class LinboOs : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
friend class LinboBackend;
|
|
|
|
|
2020-11-20 15:09:36 +01:00
|
|
|
enum LinboOsStartAction {
|
|
|
|
UnknownAction = -1,
|
|
|
|
StartOs,
|
|
|
|
SyncOs,
|
|
|
|
ReinstallOs
|
|
|
|
};
|
|
|
|
|
2020-11-16 18:01:03 +01:00
|
|
|
const QString& getName() const {return this->name;}
|
|
|
|
const QString& getDescription() const {return this->description;}
|
|
|
|
const QString& getVersion() const {return this->version;}
|
|
|
|
const LinboImage* getBaseImage() const {return this->baseImage;}
|
|
|
|
const LinboImage* getDifferentialImage() const {return this->differentialImage;}
|
|
|
|
const QString& getIconName() const {return this->iconName;}
|
|
|
|
const QString& getRootPartition() const {return this->rootPartition;}
|
|
|
|
const QString& getBootPartition() const {return this->bootPartition;}
|
|
|
|
const QString& getKernel() const {return this->kernel;}
|
|
|
|
const QString& getInitrd() const {return this->initrd;}
|
|
|
|
const QString& getKernelOptions() const {return this->kernelOptions;}
|
|
|
|
const bool& getSyncbutton() const {return this->syncButton;}
|
|
|
|
const bool& getStartbutton() const {return this->startButton;}
|
|
|
|
const bool& getNewbutton() const {return this->newButton;}
|
|
|
|
const bool& getAutostart() const {return this->autostart;}
|
|
|
|
const int& getAutostartTimeout() const {return this->autostartTimeout;}
|
2020-11-20 15:09:36 +01:00
|
|
|
const LinboOsStartAction& getDefaultAction() const {return this->defaultAction;}
|
2020-11-16 18:01:03 +01:00
|
|
|
const bool& getHidden() const {return this->hidden;}
|
|
|
|
|
2020-11-20 15:09:36 +01:00
|
|
|
bool getActionEnabled(LinboOsStartAction action) {
|
|
|
|
switch (action) {
|
|
|
|
case StartOs: return this->getStartbutton();
|
|
|
|
case SyncOs: return this->getSyncbutton();
|
|
|
|
case ReinstallOs: return this->getNewbutton();
|
|
|
|
case UnknownAction: return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
LinboOsStartAction startActionFromString(const QString& name) const {
|
|
|
|
qDebug() << "default action name is: " << name;
|
|
|
|
if(name == "start")
|
|
|
|
return StartOs;
|
|
|
|
else if(name == "sync")
|
|
|
|
return SyncOs;
|
|
|
|
else if(name == "new")
|
|
|
|
return ReinstallOs;
|
|
|
|
return UnknownAction;
|
|
|
|
}
|
|
|
|
|
2020-11-16 18:01:03 +01:00
|
|
|
protected:
|
2020-11-19 14:39:32 +01:00
|
|
|
explicit LinboOs(QObject *parent = nullptr);
|
|
|
|
|
2020-11-16 18:01:03 +01:00
|
|
|
void setName( const QString& name ) {this->name = name;}
|
|
|
|
void setDescription ( const QString& description ) {this->description = description;}
|
|
|
|
void setVersion( const QString& version ) {this->version = version;}
|
|
|
|
void setBaseImage( LinboImage* baseImage ) {this->baseImage = baseImage;}
|
|
|
|
void setDifferentialImage(LinboImage* differentialImage) {this->differentialImage = differentialImage;}
|
|
|
|
void setIconName( const QString& iconName ) {this->iconName = iconName;}
|
|
|
|
void setRootPartition( const QString& rootPartition ) {this->rootPartition = rootPartition;}
|
|
|
|
void setBootPartition( const QString& bootPartition ) {this->bootPartition = bootPartition;}
|
|
|
|
void setKernel( const QString& kernel ) {this->kernel = kernel;}
|
|
|
|
void setInitrd( const QString& initrd ) {this->initrd = initrd;}
|
|
|
|
void setKernelOptions( const QString& kernelOptions ) {this->kernelOptions = kernelOptions;}
|
|
|
|
void setSyncButton ( const bool& syncButton ) {this->syncButton = syncButton;}
|
|
|
|
void setStartButton( const bool& startButton) {this->startButton = startButton;}
|
|
|
|
void setNewButton ( const bool& newButton ) {this->newButton = newButton;}
|
|
|
|
void setAutostart ( const bool& autostart ) {this->autostart = autostart;}
|
|
|
|
void setAutostartTimeout ( const int& autostartTimeout ) {this->autostartTimeout = autostartTimeout;}
|
2020-11-20 15:09:36 +01:00
|
|
|
void setDefaultAction ( const LinboOsStartAction& defaultAction ) {this->defaultAction = defaultAction;}
|
2020-11-16 18:01:03 +01:00
|
|
|
void setHidden ( const bool& hidden ) {this->hidden = hidden;}
|
|
|
|
|
|
|
|
private:
|
2020-11-20 15:09:36 +01:00
|
|
|
QString name, // OS Name
|
|
|
|
version,
|
|
|
|
description,
|
|
|
|
iconName, // Thumbnail for Image
|
|
|
|
rootPartition, // Root partition
|
|
|
|
bootPartition, // Root partition
|
|
|
|
image,
|
|
|
|
kernel,
|
|
|
|
initrd,
|
|
|
|
kernelOptions;
|
|
|
|
int autostartTimeout;
|
|
|
|
bool syncButton, startButton, newButton, autostart,
|
|
|
|
hidden; // show OS tab or not
|
|
|
|
LinboOsStartAction defaultAction;
|
2020-11-16 18:01:03 +01:00
|
|
|
|
2020-11-20 15:09:36 +01:00
|
|
|
LinboImage* baseImage;
|
|
|
|
LinboImage* differentialImage;
|
2020-11-16 18:01:03 +01:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // LINBOOS_H
|