- Bugfixes and cleanup
This commit is contained in:
parent
90c68fcd37
commit
e72cdd81df
40 changed files with 2004 additions and 1451 deletions
|
@ -1,3 +1,6 @@
|
||||||
# Modern Linbo GUI
|
# Modern Linbo GUI
|
||||||
|
|
||||||
A new and more modern GUI for the image manager Linbo (from [linuxmuster.net](https://github.com/linuxmuster/linuxmuster-linbo))
|
A new and more modern GUI for the image manager Linbo (from [linuxmuster.net](https://github.com/linuxmuster/linuxmuster-linbo))
|
||||||
|
|
||||||
|
# Icons
|
||||||
|
All of the SVG icons in this Gui were taken from [fontawesome.com](https://fontawesome.com/license) and slighlty modified.
|
||||||
|
|
|
@ -40,48 +40,6 @@
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Start</string>
|
|
||||||
</attribute>
|
|
||||||
<widget class="Q3ScrollView" name="startView" native="true">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>10</x>
|
|
||||||
<y>10</y>
|
|
||||||
<width>600</width>
|
|
||||||
<height>180</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="autoFillBackground">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QLabel" name="versionLabel">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>10</x>
|
|
||||||
<y>200</y>
|
|
||||||
<width>600</width>
|
|
||||||
<height>21</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<pointsize>8</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Version</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
|
||||||
</property>
|
|
||||||
<property name="wordWrap">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="tab">
|
<widget class="QWidget" name="tab">
|
||||||
<property name="autoFillBackground">
|
<property name="autoFillBackground">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
|
|
15
forumsbeitrag.md
Normal file
15
forumsbeitrag.md
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
Hallo zusammen,
|
||||||
|
|
||||||
|
Ich habe vor einiger Zeit mein erstes Linuxmuster.net Netzwerk aufgesetzt und bin begeistert von dem Funktionsumfang, den es bietet. Nur eines stört mich: das GUI von Linbo. Es sieht einfach nicht mehr zeitgemäß aus und viele Leihen sind damit überfordert.
|
||||||
|
|
||||||
|
Daher habe ich mir ein bisschen Zeit genommen und angefangen, ein neues GUI für Linbo zu programmieren. Das neue Frontend (Entspricht dem "Start" Tab) ist so gut wie fertig. Für das Imaging habe ich erstmal das alte GUI gelassen, weil der normale Nutzer das eh fast nie zu Gesicht bekommt.
|
||||||
|
|
||||||
|
Hier ein kurzes Video mit einer Demo:
|
||||||
|
|
||||||
|
|
||||||
|
Sobald alles richtig funktioniert, werde ich eine Pullrequest bei LinboRepo öffnen.
|
||||||
|
|
||||||
|
Hat noch jemand von euch Vorschläge, was geändert werden sollte?
|
||||||
|
|
||||||
|
Viele Grüße
|
||||||
|
Dorian
|
|
@ -25,12 +25,8 @@
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
||||||
|
#include <QFile>
|
||||||
#include <vector>
|
#include <QSettings>
|
||||||
#include <iostream>
|
|
||||||
#include <fstream>
|
|
||||||
#include <istream>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "linbologger.h"
|
#include "linbologger.h"
|
||||||
#include "linboconfig.h"
|
#include "linboconfig.h"
|
||||||
|
@ -46,7 +42,7 @@ class LinboBackend : public QObject
|
||||||
Q_PROPERTY(LinboBackend::LinboState state READ getState NOTIFY stateChanged)
|
Q_PROPERTY(LinboBackend::LinboState state READ getState NOTIFY stateChanged)
|
||||||
Q_PROPERTY(LinboOs* currentOs READ getCurrentOs WRITE setCurrentOs NOTIFY currentOsChanged)
|
Q_PROPERTY(LinboOs* currentOs READ getCurrentOs WRITE setCurrentOs NOTIFY currentOsChanged)
|
||||||
Q_PROPERTY(double autostartTimeoutProgress READ getAutostartTimeoutProgress NOTIFY autostartTimeoutProgressChanged)
|
Q_PROPERTY(double autostartTimeoutProgress READ getAutostartTimeoutProgress NOTIFY autostartTimeoutProgressChanged)
|
||||||
//Q_PROPERTY(int autostartTimeoutRemainingSeconds READ getAutostartTimeoutRemainingSeconds NOTIFY autostartTimeoutProgressChanged)
|
Q_PROPERTY(int autostartTimeoutRemainingSeconds READ getAutostartTimeoutRemainingSeconds NOTIFY autostartTimeoutProgressChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit LinboBackend(QObject *parent = nullptr);
|
explicit LinboBackend(QObject *parent = nullptr);
|
||||||
|
@ -74,11 +70,14 @@ public:
|
||||||
int getAutostartTimeoutRemainingSeconds();
|
int getAutostartTimeoutRemainingSeconds();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool read_pair(ifstream* input, QString& key, QString& value);
|
void loadStartConfiguration(QString startConfFilePath);
|
||||||
|
void loadEnvironmentValues();
|
||||||
|
|
||||||
|
void writeToLinboConfig(QMap<QString, QString> config, LinboConfig* linboConfig);
|
||||||
|
void writeToPartitionConfig(QMap<QString, QString> config, LinboDiskPartition* partition);
|
||||||
|
void writeToOsConfig(QMap<QString, QString> config, LinboOs* os);
|
||||||
|
|
||||||
bool toBool(const QString& value);
|
bool toBool(const QString& value);
|
||||||
LinboOs* read_os(ifstream* input);
|
|
||||||
LinboDiskPartition* read_partition(ifstream* input);
|
|
||||||
void read_globals( ifstream* input, LinboConfig* config );
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LinboState state;
|
LinboState state;
|
||||||
|
@ -138,6 +137,8 @@ public slots:
|
||||||
bool initializeCache();
|
bool initializeCache();
|
||||||
bool updateLinbo();
|
bool updateLinbo();
|
||||||
|
|
||||||
|
bool cancelCurrentAction();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void executeAutostart();
|
void executeAutostart();
|
||||||
void handleAutostartTimerTimeout();
|
void handleAutostartTimerTimeout();
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
** Modern Linbo GUI
|
** Modern Linbo GUI
|
||||||
** Copyright (C) 2020 Dorian Zedler <dorian@itsblue.de>
|
** Copyright (C) 2020 Dorian Zedler <dorian@itsblue.de>
|
||||||
**
|
**
|
||||||
|
** Portions of the code in this file are based on code by:
|
||||||
|
** Copyright (C) 2007 Martin Oehler <oehler@knopper.net>
|
||||||
|
** Copyright (C) 2007 Klaus Knopper <knopper@knopper.net>
|
||||||
|
**
|
||||||
** This program is free software: you can redistribute it and/or modify
|
** 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
|
** 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
|
** by the Free Software Foundation, either version 3 of the License, or
|
||||||
|
@ -26,20 +30,20 @@ class LinboConfig : public QObject
|
||||||
public:
|
public:
|
||||||
friend class LinboBackend;
|
friend class LinboBackend;
|
||||||
|
|
||||||
const QString& getServer() const {return this->server;}
|
const QString& getServerIpAddress() const {return this->serverIpAddress;}
|
||||||
const QString& getIpAddress() const {return this->ipAddress;}
|
const QString& getIpAddress() const {return this->ipAddress;}
|
||||||
const QString& getMacAddress() const {return this->macAddress;}
|
const QString& getMacAddress() const {return this->macAddress;}
|
||||||
const QString& getVersion() const {return this->version;}
|
const QString& getLinboVersion() const {return this->LinboVersion;}
|
||||||
const QString& getHostname() const {return this->hostname;}
|
const QString& getHostname() const {return this->hostname;}
|
||||||
const QString& getCpu() const {return this->cpu;}
|
const QString& getCpuModel() const {return this->cpuModel;}
|
||||||
const QString& getRamSize() const {return this->ramSize;}
|
const QString& getRamSize() const {return this->ramSize;}
|
||||||
const QString& getCacheSize() const {return this->cacheSize;}
|
const QString& getCacheSize() const {return this->cacheSize;}
|
||||||
const QString& getHddSize() const {return this->hddSize;}
|
const QString& getHddSize() const {return this->hddSize;}
|
||||||
|
|
||||||
const QString& getCache() const {return this->cache;}
|
const QString& getCachePath() const {return this->cachePath;}
|
||||||
const QString& getHostgroup() const {return this->hostgroup;}
|
const QString& getHostGroup() const {return this->hostGroup;}
|
||||||
const unsigned int& getRootTimeout() const {return this->rootTimeout;}
|
const unsigned int& getRootTimeout() const {return this->rootTimeout;}
|
||||||
const bool& getAutopartition() {return this->autoPartition;}
|
const bool& getAutoPartition() {return this->autoPartition;}
|
||||||
const bool& getAutoInitCache() {return this->autoInitCache;}
|
const bool& getAutoInitCache() {return this->autoInitCache;}
|
||||||
const QString& getBackgroundFontcolor() {return this->backgroundFontcolor;}
|
const QString& getBackgroundFontcolor() {return this->backgroundFontcolor;}
|
||||||
const QString& getConsoleFontcolorStdout() {return this->consoleFontcolorStdout;}
|
const QString& getConsoleFontcolorStdout() {return this->consoleFontcolorStdout;}
|
||||||
|
@ -47,22 +51,22 @@ public:
|
||||||
const QString& getDownloadType() {return this->downloadType;}
|
const QString& getDownloadType() {return this->downloadType;}
|
||||||
const bool& getAutoFormat() {return this->autoFormat;}
|
const bool& getAutoFormat() {return this->autoFormat;}
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
explicit LinboConfig(QObject *parent = nullptr);
|
explicit LinboConfig(QObject *parent = nullptr);
|
||||||
|
|
||||||
void setServer( const QString& server ) {this->server = server;}
|
void setServerIpAddress( const QString& serverIpAddress ) {this->serverIpAddress = serverIpAddress;}
|
||||||
void setIpAddress( const QString& ipAddress ) {this->ipAddress = ipAddress;}
|
void setIpAddress( const QString& ipAddress ) {this->ipAddress = ipAddress;}
|
||||||
void setMacAddress( const QString& macAddress ) {this->macAddress = macAddress;}
|
void setMacAddress( const QString& macAddress ) {this->macAddress = macAddress;}
|
||||||
void setVersion( const QString& version ) {this->version = version;}
|
void setLinboVersion( const QString& linboVersion ) {this->LinboVersion = linboVersion;}
|
||||||
void setHostname( const QString& hostname ) {this->hostname = hostname;}
|
void setHostname( const QString& hostname ) {this->hostname = hostname;}
|
||||||
void setCpu( const QString& cpu ) {this->cpu = cpu;}
|
void setCpuModel( const QString& cpuModel ) {this->cpuModel = cpuModel;}
|
||||||
void setRamSize( const QString& ramSize ) {this->ramSize = ramSize;}
|
void setRamSize( const QString& ramSize ) {this->ramSize = ramSize;}
|
||||||
void setCacheSize( const QString& cacheSize ) {this->cacheSize = cacheSize;}
|
void setCacheSize( const QString& cacheSize ) {this->cacheSize = cacheSize;}
|
||||||
void setHddSize( const QString& hddSize ) {this->hddSize = hddSize;}
|
void setHddSize( const QString& hddSize ) {this->hddSize = hddSize;}
|
||||||
void setCache( const QString& cache ) {this->cache = cache;}
|
void setCachePath( const QString& cachePath ) {this->cachePath = cachePath;}
|
||||||
void setHostgroup( const QString& hostgroup ) {this->hostgroup = hostgroup;}
|
void setHostGroup( const QString& hostGroup ) {this->hostGroup = hostGroup;}
|
||||||
void setRootTimeout( const unsigned int& rootTimeout ) {this->rootTimeout = rootTimeout;}
|
void setRootTimeout( const unsigned int& rootTimeout ) {this->rootTimeout = rootTimeout;}
|
||||||
void setAutopartition( const bool& autoPartition ){this->autoPartition = autoPartition;}
|
void setAutoPartition( const bool& autoPartition ){this->autoPartition = autoPartition;}
|
||||||
void setAutoInitCache( const bool& autoInitCache ){this->autoInitCache = autoInitCache;}
|
void setAutoInitCache( const bool& autoInitCache ){this->autoInitCache = autoInitCache;}
|
||||||
void setBackgroundFontcolor( const QString& backgroundFontcolor ){this->backgroundFontcolor = backgroundFontcolor;}
|
void setBackgroundFontcolor( const QString& backgroundFontcolor ){this->backgroundFontcolor = backgroundFontcolor;}
|
||||||
void setConsoleFontcolorStdout( const QString& consoleFontcolorStdout ){this->consoleFontcolorStdout = consoleFontcolorStdout;}
|
void setConsoleFontcolorStdout( const QString& consoleFontcolorStdout ){this->consoleFontcolorStdout = consoleFontcolorStdout;}
|
||||||
|
@ -70,10 +74,25 @@ protected:
|
||||||
void setDownloadType( const QString& downloadType ){this->downloadType = downloadType;}
|
void setDownloadType( const QString& downloadType ){this->downloadType = downloadType;}
|
||||||
void setAutoFormat( const bool& autoFormat ){this->autoFormat = autoFormat;}
|
void setAutoFormat( const bool& autoFormat ){this->autoFormat = autoFormat;}
|
||||||
|
|
||||||
private:
|
QString serverIpAddress;
|
||||||
QString server, ipAddress, macAddress, version, hostname, cpu, ramSize, cacheSize, hddSize, cache, hostgroup, downloadType, backgroundFontcolor, consoleFontcolorStdout, consoleFontcolorStderr;
|
QString ipAddress;
|
||||||
|
QString macAddress;
|
||||||
|
QString LinboVersion;
|
||||||
|
QString hostname;
|
||||||
|
QString cpuModel;
|
||||||
|
QString ramSize;
|
||||||
|
QString cacheSize;
|
||||||
|
QString hddSize;
|
||||||
|
QString cachePath;
|
||||||
|
QString hostGroup;
|
||||||
|
QString downloadType;
|
||||||
|
QString backgroundFontcolor;
|
||||||
|
QString consoleFontcolorStdout;
|
||||||
|
QString consoleFontcolorStderr;
|
||||||
unsigned int rootTimeout;
|
unsigned int rootTimeout;
|
||||||
bool autoPartition, autoInitCache, autoFormat;
|
bool autoPartition;
|
||||||
|
bool autoInitCache;
|
||||||
|
bool autoFormat;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
** Modern Linbo GUI
|
** Modern Linbo GUI
|
||||||
** Copyright (C) 2020 Dorian Zedler <dorian@itsblue.de>
|
** Copyright (C) 2020 Dorian Zedler <dorian@itsblue.de>
|
||||||
**
|
**
|
||||||
|
** Portions of the code in this file are based on code by:
|
||||||
|
** Copyright (C) 2007 Martin Oehler <oehler@knopper.net>
|
||||||
|
** Copyright (C) 2007 Klaus Knopper <knopper@knopper.net>
|
||||||
|
**
|
||||||
** This program is free software: you can redistribute it and/or modify
|
** 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
|
** 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
|
** by the Free Software Foundation, either version 3 of the License, or
|
||||||
|
@ -33,7 +37,7 @@ public:
|
||||||
const unsigned int& getSize() const {return this->size;}
|
const unsigned int& getSize() const {return this->size;}
|
||||||
const bool& getBootable() const {return this->bootable;}
|
const bool& getBootable() const {return this->bootable;}
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
explicit LinboDiskPartition(QObject *parent = nullptr);
|
explicit LinboDiskPartition(QObject *parent = nullptr);
|
||||||
|
|
||||||
void setPath( const QString& path ) {this->path = path;}
|
void setPath( const QString& path ) {this->path = path;}
|
||||||
|
@ -42,10 +46,11 @@ protected:
|
||||||
void setSize( const unsigned int& size ) {this->size = size;}
|
void setSize( const unsigned int& size ) {this->size = size;}
|
||||||
void setBootable( const bool& bootable ) {this->bootable = bootable;}
|
void setBootable( const bool& bootable ) {this->bootable = bootable;}
|
||||||
|
|
||||||
private:
|
QString path;
|
||||||
QString path, id, fstype;
|
QString id;
|
||||||
unsigned int size;
|
QString fstype;
|
||||||
bool bootable;
|
unsigned int size;
|
||||||
|
bool bootable;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
** Modern Linbo GUI
|
** Modern Linbo GUI
|
||||||
** Copyright (C) 2020 Dorian Zedler <dorian@itsblue.de>
|
** Copyright (C) 2020 Dorian Zedler <dorian@itsblue.de>
|
||||||
**
|
**
|
||||||
|
** Portions of the code in this file are based on code by:
|
||||||
|
** Copyright (C) 2007 Martin Oehler <oehler@knopper.net>
|
||||||
|
** Copyright (C) 2007 Klaus Knopper <knopper@knopper.net>
|
||||||
|
**
|
||||||
** This program is free software: you can redistribute it and/or modify
|
** 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
|
** 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
|
** by the Free Software Foundation, either version 3 of the License, or
|
||||||
|
@ -37,8 +41,8 @@ protected:
|
||||||
void setName(const QString& name) {this->name = name;}
|
void setName(const QString& name) {this->name = name;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString name,
|
QString name;
|
||||||
description;
|
QString description;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,9 +1,28 @@
|
||||||
|
/****************************************************************************
|
||||||
|
** 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 LINBOLOGGER_H
|
#ifndef LINBOLOGGER_H
|
||||||
#define LINBOLOGGER_H
|
#define LINBOLOGGER_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
#include <QFile>
|
||||||
|
|
||||||
class LinboLogger : public QObject
|
class LinboLogger : public QObject
|
||||||
{
|
{
|
||||||
|
@ -33,10 +52,12 @@ public:
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit LinboLogger(QObject *parent = nullptr);
|
explicit LinboLogger(QString logFilePath, QObject *parent = nullptr);
|
||||||
|
|
||||||
void log(QString logText, LinboLogType logType);
|
void log(QString logText, LinboLogType logType);
|
||||||
|
bool writeToLogFile(QString text);
|
||||||
|
|
||||||
|
QString logFilePath;
|
||||||
QList<LinboLog> logHistory;
|
QList<LinboLog> logHistory;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
** Modern Linbo GUI
|
** Modern Linbo GUI
|
||||||
** Copyright (C) 2020 Dorian Zedler <dorian@itsblue.de>
|
** Copyright (C) 2020 Dorian Zedler <dorian@itsblue.de>
|
||||||
**
|
**
|
||||||
|
** Portions of the code in this file are based on code by:
|
||||||
|
** Copyright (C) 2007 Martin Oehler <oehler@knopper.net>
|
||||||
|
** Copyright (C) 2007 Klaus Knopper <knopper@knopper.net>
|
||||||
|
**
|
||||||
** This program is free software: you can redistribute it and/or modify
|
** 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
|
** 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
|
** by the Free Software Foundation, either version 3 of the License, or
|
||||||
|
@ -48,74 +52,61 @@ public:
|
||||||
const QString& getKernel() const {return this->kernel;}
|
const QString& getKernel() const {return this->kernel;}
|
||||||
const QString& getInitrd() const {return this->initrd;}
|
const QString& getInitrd() const {return this->initrd;}
|
||||||
const QString& getKernelOptions() const {return this->kernelOptions;}
|
const QString& getKernelOptions() const {return this->kernelOptions;}
|
||||||
const bool& getSyncbutton() const {return this->syncButton;}
|
bool getSyncActionEnabled() const {return this->baseImage != nullptr && this->syncButtonEnabled;}
|
||||||
const bool& getStartbutton() const {return this->startButton;}
|
bool getStartActionEnabled() const {return this->baseImage != nullptr && this->startButtonEnabled;}
|
||||||
const bool& getNewbutton() const {return this->newButton;}
|
bool getReinstallActionEnabled() const {return this->baseImage != nullptr && this->reinstallButtonEnabled;}
|
||||||
const bool& getAutostart() const {return this->autostart;}
|
bool getAutostartEnabled() const {return this->baseImage != nullptr && this->autostartEnabled;}
|
||||||
const int& getAutostartTimeout() const {return this->autostartTimeout;}
|
const int& getAutostartTimeout() const {return this->autostartTimeout;}
|
||||||
const LinboOsStartAction& getDefaultAction() const {return this->defaultAction;}
|
const LinboOsStartAction& getDefaultAction() const {return this->defaultAction;}
|
||||||
const bool& getHidden() const {return this->hidden;}
|
const bool& getHidden() const {return this->hidden;}
|
||||||
|
|
||||||
bool getActionEnabled(LinboOsStartAction action) {
|
bool getActionEnabled(LinboOsStartAction action);
|
||||||
switch (action) {
|
static LinboOsStartAction startActionFromString(const QString& name);
|
||||||
case StartOs: return this->getStartbutton();
|
|
||||||
case SyncOs: return this->getSyncbutton();
|
|
||||||
case ReinstallOs: return this->getNewbutton();
|
|
||||||
case UnknownAction: return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static LinboOsStartAction startActionFromString(const QString& name) {
|
|
||||||
if(name == "start")
|
|
||||||
return StartOs;
|
|
||||||
else if(name == "sync")
|
|
||||||
return SyncOs;
|
|
||||||
else if(name == "new")
|
|
||||||
return ReinstallOs;
|
|
||||||
return UnknownAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
explicit LinboOs(QObject *parent = nullptr);
|
|
||||||
|
|
||||||
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;}
|
|
||||||
void setDefaultAction ( const LinboOsStartAction& defaultAction ) {this->defaultAction = defaultAction;}
|
|
||||||
void setHidden ( const bool& hidden ) {this->hidden = hidden;}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString name, // OS Name
|
explicit LinboOs(QObject *parent = nullptr);
|
||||||
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;
|
|
||||||
|
|
||||||
|
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 setSyncButtonEnabled (const bool& syncButtonEnabled) {this->syncButtonEnabled = syncButtonEnabled;}
|
||||||
|
void setStartButtonEnabled (const bool& startButtonEnabled) {this->startButtonEnabled = startButtonEnabled;}
|
||||||
|
void setReinstallButtonEnabled (const bool& reinstallButtonEnabled) {this->reinstallButtonEnabled = reinstallButtonEnabled;}
|
||||||
|
void setAutostartEnabled (const bool& autostartEnabled) {this->autostartEnabled = autostartEnabled;}
|
||||||
|
void setAutostartTimeout (const int& autostartTimeout) {this->autostartTimeout = autostartTimeout;}
|
||||||
|
void setDefaultAction (const LinboOsStartAction& defaultAction) {this->defaultAction = defaultAction;}
|
||||||
|
void setHidden (const bool& hidden) {this->hidden = hidden;}
|
||||||
|
|
||||||
|
QString name;
|
||||||
|
QString version;
|
||||||
|
QString description;
|
||||||
|
QString iconName;
|
||||||
|
QString rootPartition;
|
||||||
|
QString bootPartition;
|
||||||
|
QString image;
|
||||||
|
QString kernel;
|
||||||
|
QString initrd;
|
||||||
|
QString kernelOptions;
|
||||||
|
|
||||||
|
int autostartTimeout;
|
||||||
|
|
||||||
|
bool syncButtonEnabled;
|
||||||
|
bool startButtonEnabled;
|
||||||
|
bool reinstallButtonEnabled;
|
||||||
|
bool autostartEnabled;
|
||||||
|
bool hidden;
|
||||||
|
|
||||||
|
LinboOsStartAction defaultAction;
|
||||||
LinboImage* baseImage;
|
LinboImage* baseImage;
|
||||||
LinboImage* differentialImage;
|
LinboImage* differentialImage;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LINBOOS_H
|
#endif // LINBOOS_H
|
||||||
|
|
|
@ -48,56 +48,57 @@ class linboPasswordBoxImpl;
|
||||||
|
|
||||||
class linboGUIImpl : public QDialog, public Ui::linboGUI
|
class linboGUIImpl : public QDialog, public Ui::linboGUI
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void readFromStdout();
|
void readFromStdout();
|
||||||
void readFromStderr();
|
void readFromStderr();
|
||||||
void enableButtons();
|
void enableButtons();
|
||||||
void resetButtons();
|
void resetButtons();
|
||||||
void disableButtons();
|
void disableButtons();
|
||||||
void restoreButtonsState();
|
void restoreButtonsState();
|
||||||
void tabWatcher( QWidget* );
|
void tabWatcher( QWidget* );
|
||||||
void processTimeout();
|
void processTimeout();
|
||||||
void executeAutostart();
|
void executeAutostart();
|
||||||
void shutdown();
|
void shutdown();
|
||||||
void reboot();
|
void reboot();
|
||||||
void autostartTimeoutSlot();
|
void autostartTimeoutSlot();
|
||||||
|
void loginAndOpen();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
linboCounterImpl* myCounter;
|
linboCounterImpl* myCounter;
|
||||||
QTimer* myTimer;
|
QTimer* myTimer;
|
||||||
QTimer* myAutostartTimer;
|
QTimer* myAutostartTimer;
|
||||||
linboMsgImpl *waiting;
|
linboMsgImpl *waiting;
|
||||||
QString linestdout, linestderr;
|
QString linestdout, linestderr;
|
||||||
QString logfilepath, fonttemplate;
|
QString logfilepath, fonttemplate;
|
||||||
bool root, withicons, outputvisible;
|
bool root, withicons, outputvisible;
|
||||||
QProcess* process;
|
QProcess* process;
|
||||||
QDialog* myQPasswordBox;
|
QDialog* myQPasswordBox;
|
||||||
linboPasswordBoxImpl* myLPasswordBox;
|
linboPasswordBoxImpl* myLPasswordBox;
|
||||||
linbopushbutton *autostart, *autopartition, *autoinitcache;
|
linbopushbutton *autostart, *autopartition, *autoinitcache;
|
||||||
int preTab, autostarttimeout;
|
int preTab, autostarttimeout;
|
||||||
linboLogConsole* logConsole;
|
linboLogConsole* logConsole;
|
||||||
|
|
||||||
vector<int> buttons_config;
|
vector<int> buttons_config;
|
||||||
vector<bool> buttons_config_save;
|
vector<bool> buttons_config_save;
|
||||||
public:
|
public:
|
||||||
vector<linbopushbutton*> p_buttons;
|
vector<linbopushbutton*> p_buttons;
|
||||||
// 0 = disabled
|
// 0 = disabled
|
||||||
// 1 = enabled
|
// 1 = enabled
|
||||||
// 2 = admin button
|
// 2 = admin button
|
||||||
|
|
||||||
globals config;
|
globals config;
|
||||||
vector<os_item> elements;
|
vector<os_item> elements;
|
||||||
vector<diskpartition> partitions;
|
vector<diskpartition> partitions;
|
||||||
|
|
||||||
linboGUIImpl(QWidget* parent = nullptr);
|
linboGUIImpl(QWidget* parent = nullptr);
|
||||||
|
|
||||||
~linboGUIImpl();
|
~linboGUIImpl();
|
||||||
|
|
||||||
bool isRoot() const;
|
bool isRoot() const;
|
||||||
void showImagingTab();
|
void showImagingTab();
|
||||||
void log( const QString& data );
|
void log( const QString& data );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ private:
|
||||||
LinboOsSelectButton(QString icon, LinboOs* os, QButtonGroup* buttonGroup, QWidget* parent = nullptr);
|
LinboOsSelectButton(QString icon, LinboOs* os, QButtonGroup* buttonGroup, QWidget* parent = nullptr);
|
||||||
|
|
||||||
LinboOs* getOs();
|
LinboOs* getOs();
|
||||||
|
void setVisibleAnimated(bool visible);
|
||||||
void setVisible(bool visible) override;
|
void setVisible(bool visible) override;
|
||||||
|
|
||||||
QModernPushButton* button;
|
QModernPushButton* button;
|
||||||
|
|
|
@ -1,9 +1,28 @@
|
||||||
|
/****************************************************************************
|
||||||
|
** 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 LINBOOSSELECTIONROW_H
|
#ifndef LINBOOSSELECTIONROW_H
|
||||||
#define LINBOOSSELECTIONROW_H
|
#define LINBOOSSELECTIONROW_H
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <Q3ButtonGroup>
|
#include <QButtonGroup>
|
||||||
|
#include <QLabel>
|
||||||
|
|
||||||
#include "linbobackend.h"
|
#include "linbobackend.h"
|
||||||
#include "linboosselectbutton.h"
|
#include "linboosselectbutton.h"
|
||||||
|
@ -24,7 +43,12 @@ private:
|
||||||
LinboBackend* backend;
|
LinboBackend* backend;
|
||||||
QList<LinboOsSelectButton*> osButtons;
|
QList<LinboOsSelectButton*> osButtons;
|
||||||
QButtonGroup* osButtonGroup;
|
QButtonGroup* osButtonGroup;
|
||||||
|
QLabel* noOsLabel;
|
||||||
|
QFont noOsLabelFont;
|
||||||
|
QLabel* environmentValuesLabel;
|
||||||
|
QFont environmentValuesLabelFont;
|
||||||
bool showOnlySelectedButton;
|
bool showOnlySelectedButton;
|
||||||
|
bool inited;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void resizeAndPositionAllButtons();
|
void resizeAndPositionAllButtons();
|
||||||
|
|
|
@ -1,3 +1,21 @@
|
||||||
|
/****************************************************************************
|
||||||
|
** 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 LINBOSTARTACTIONS_H
|
#ifndef LINBOSTARTACTIONS_H
|
||||||
#define LINBOSTARTACTIONS_H
|
#define LINBOSTARTACTIONS_H
|
||||||
|
|
||||||
|
@ -33,7 +51,10 @@ private:
|
||||||
QModernPushButton* startOsButton;
|
QModernPushButton* startOsButton;
|
||||||
QModernPushButton* syncOsButton;
|
QModernPushButton* syncOsButton;
|
||||||
QModernPushButton* reinstallOsButton;
|
QModernPushButton* reinstallOsButton;
|
||||||
|
QModernPushButton* cancelButton;
|
||||||
QList<QModernPushButton*> actionButtons;
|
QList<QModernPushButton*> actionButtons;
|
||||||
|
QLabel* noBaseImageLabel;
|
||||||
|
QFont noBaseImageLabelFont;
|
||||||
|
|
||||||
QWidget* progressBarWidget;
|
QWidget* progressBarWidget;
|
||||||
QModernProgressBar* progressBar;
|
QModernProgressBar* progressBar;
|
||||||
|
|
|
@ -19,6 +19,24 @@
|
||||||
#ifndef LINBOGUISTARTPAGE_H
|
#ifndef LINBOGUISTARTPAGE_H
|
||||||
#define LINBOGUISTARTPAGE_H
|
#define LINBOGUISTARTPAGE_H
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
** 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/>.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QBoxLayout>
|
#include <QBoxLayout>
|
||||||
|
@ -46,6 +64,8 @@ private:
|
||||||
LinboStartActions* startActionsWidget;
|
LinboStartActions* startActionsWidget;
|
||||||
QList<QModernPushButton*> powerActionButtons;
|
QList<QModernPushButton*> powerActionButtons;
|
||||||
|
|
||||||
|
bool inited;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void handleLinboStateChanged(LinboBackend::LinboState newState);
|
void handleLinboStateChanged(LinboBackend::LinboState newState);
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,21 @@
|
||||||
|
/****************************************************************************
|
||||||
|
** 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 QMODERNPROGRESSBAR_H
|
#ifndef QMODERNPROGRESSBAR_H
|
||||||
#define QMODERNPROGRESSBAR_H
|
#define QMODERNPROGRESSBAR_H
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ class QModernPushButton : public QAbstractButton
|
||||||
public:
|
public:
|
||||||
QModernPushButton(QString icon, QWidget* parent = nullptr);
|
QModernPushButton(QString icon, QWidget* parent = nullptr);
|
||||||
|
|
||||||
void setVisibleAnimated(bool visible, bool asynchronos = true);
|
void setVisibleAnimated(bool visible);
|
||||||
|
|
||||||
void setGeometryAnimated(const QRect& geometry);
|
void setGeometryAnimated(const QRect& geometry);
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,21 @@
|
||||||
|
/****************************************************************************
|
||||||
|
** 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 QMODERNPUSHBUTTONOVERLAY_H
|
#ifndef QMODERNPUSHBUTTONOVERLAY_H
|
||||||
#define QMODERNPUSHBUTTONOVERLAY_H
|
#define QMODERNPUSHBUTTONOVERLAY_H
|
||||||
|
|
||||||
|
@ -26,6 +44,7 @@ private:
|
||||||
|
|
||||||
void setAnimationDuration(int duration);
|
void setAnimationDuration(int duration);
|
||||||
void setVisible(bool visible);
|
void setVisible(bool visible);
|
||||||
|
void setVisibleAnimated(bool visible);
|
||||||
void setEffectEnabled(bool enabled);
|
void setEffectEnabled(bool enabled);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
|
@ -1,3 +1,21 @@
|
||||||
|
/****************************************************************************
|
||||||
|
** 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 QMODERNSTACKEDWIDGET_H
|
#ifndef QMODERNSTACKEDWIDGET_H
|
||||||
#define QMODERNSTACKEDWIDGET_H
|
#define QMODERNSTACKEDWIDGET_H
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,6 @@ SOURCES += \
|
||||||
sources/legacy/linboConsoleImpl.cc \
|
sources/legacy/linboConsoleImpl.cc \
|
||||||
sources/legacy/linboCounterImpl.cc \
|
sources/legacy/linboCounterImpl.cc \
|
||||||
sources/legacy/linboGUIImpl.cc \
|
sources/legacy/linboGUIImpl.cc \
|
||||||
sources/legacy/linboGUIImplTmp.cpp \
|
|
||||||
sources/legacy/linboImageSelectorImpl.cc \
|
sources/legacy/linboImageSelectorImpl.cc \
|
||||||
sources/legacy/linboImageUploadImpl.cc \
|
sources/legacy/linboImageUploadImpl.cc \
|
||||||
sources/legacy/linboInfoBrowserImpl.cc \
|
sources/legacy/linboInfoBrowserImpl.cc \
|
||||||
|
|
|
@ -27,5 +27,6 @@
|
||||||
<file>svgIcons/rebootAction.svg</file>
|
<file>svgIcons/rebootAction.svg</file>
|
||||||
<file>svgIcons/settingsAction.svg</file>
|
<file>svgIcons/settingsAction.svg</file>
|
||||||
<file>fonts/SegoeUI.ttf</file>
|
<file>fonts/SegoeUI.ttf</file>
|
||||||
|
<file>svgIcons/cancel.svg</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
38
resources/svgIcons/cancel.svg
Normal file
38
resources/svgIcons/cancel.svg
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
aria-hidden="true"
|
||||||
|
focusable="false"
|
||||||
|
data-prefix="far"
|
||||||
|
data-icon="times-circle"
|
||||||
|
class="svg-inline--fa fa-times-circle fa-w-16"
|
||||||
|
role="img"
|
||||||
|
viewBox="0 0 500 500"
|
||||||
|
version="1.1"
|
||||||
|
id="svg4"
|
||||||
|
width="500"
|
||||||
|
height="500">
|
||||||
|
<metadata
|
||||||
|
id="metadata10">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<defs
|
||||||
|
id="defs8" />
|
||||||
|
<path
|
||||||
|
fill="currentColor"
|
||||||
|
d="m 250,99.999998 c -82.8629,0 -150,67.137092 -150,150.000002 0,82.8629 67.1371,150 150,150 82.8629,0 150,-67.1371 150,-150 C 400,167.13709 332.8629,99.999998 250,99.999998 Z m 0,270.967742 c -66.83468,0 -120.96774,-54.13306 -120.96774,-120.96774 0,-66.83468 54.13306,-120.96774 120.96774,-120.96774 66.83467,0 120.96773,54.13306 120.96773,120.96774 0,66.83468 -54.13306,120.96774 -120.96773,120.96774 z M 311.57258,212.37903 273.95161,250 l 37.62097,37.62097 c 2.84274,2.84274 2.84274,7.43951 0,10.28226 l -13.66935,13.66935 c -2.84276,2.84274 -7.43953,2.84274 -10.28226,0 L 250,273.95161 212.37903,311.57258 c -2.84274,2.84274 -7.43951,2.84274 -10.28227,0 l -13.66935,-13.66935 c -2.84274,-2.84275 -2.84274,-7.43952 0,-10.28226 L 226.04838,250 188.42741,212.37903 c -2.84274,-2.84274 -2.84274,-7.43951 0,-10.28226 l 13.66935,-13.66935 c 2.84276,-2.84275 7.43953,-2.84275 10.28227,0 L 250,226.04839 287.62097,188.42742 c 2.84273,-2.84275 7.4395,-2.84275 10.28226,0 l 13.66935,13.66935 c 2.84274,2.84275 2.84274,7.43952 0,10.28226 z"
|
||||||
|
id="path2"
|
||||||
|
style="stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke:none;stroke-opacity:1" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2 KiB |
|
@ -2,6 +2,10 @@
|
||||||
** Modern Linbo GUI
|
** Modern Linbo GUI
|
||||||
** Copyright (C) 2020 Dorian Zedler <dorian@itsblue.de>
|
** Copyright (C) 2020 Dorian Zedler <dorian@itsblue.de>
|
||||||
**
|
**
|
||||||
|
** Portions of the code in this file are based on code by:
|
||||||
|
** Copyright (C) 2007 Martin Oehler <oehler@knopper.net>
|
||||||
|
** Copyright (C) 2007 Klaus Knopper <knopper@knopper.net>
|
||||||
|
**
|
||||||
** This program is free software: you can redistribute it and/or modify
|
** 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
|
** 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
|
** by the Free Software Foundation, either version 3 of the License, or
|
||||||
|
@ -18,132 +22,52 @@
|
||||||
|
|
||||||
#include "linbobackend.h"
|
#include "linbobackend.h"
|
||||||
|
|
||||||
#define LINBO_CMD(arg) QStringList("linbo_cmd") << (arg)
|
/*
|
||||||
|
* TODO:
|
||||||
using namespace std;
|
* - State StartError (ish)
|
||||||
|
* - enter state StartError when starting / syncing / reinstalling fails
|
||||||
|
*/
|
||||||
|
|
||||||
LinboBackend::LinboBackend(QObject *parent) : QObject(parent)
|
LinboBackend::LinboBackend(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
this->setState(Initializing);
|
this->setState(Initializing);
|
||||||
this->logger = new LinboLogger(this);
|
|
||||||
this->config = new LinboConfig(this);
|
|
||||||
this->autostartTimer = new QTimer();
|
|
||||||
this->autostartTimer->setSingleShot(true);
|
|
||||||
connect(this->autostartTimer, SIGNAL(timeout()), this, SLOT(handleAutostartTimerTimeout()));
|
|
||||||
this->autostartRemainingTimeRefreshTimer = new QTimer();
|
|
||||||
this->autostartRemainingTimeRefreshTimer->setSingleShot(false);
|
|
||||||
this->autostartRemainingTimeRefreshTimer->setInterval(10);
|
|
||||||
connect(this->autostartRemainingTimeRefreshTimer, SIGNAL(timeout()), this, SIGNAL(autostartTimeoutProgressChanged()));
|
|
||||||
this->autostartElapsedTimer = new QElapsedTimer();
|
|
||||||
this->currentOs = nullptr;
|
this->currentOs = nullptr;
|
||||||
|
|
||||||
// read start.conf
|
// Init some objects
|
||||||
this->logger->log("Starting to parse start.conf", LinboLogger::LinboGuiInfo);
|
this->logger = new LinboLogger("/tmp/linbo.log", this);
|
||||||
ifstream input;
|
this->config = new LinboConfig(this);
|
||||||
input.open( "start.conf", ios_base::in );
|
|
||||||
|
|
||||||
QString tmp_qstring;
|
// autostart timers
|
||||||
|
this->autostartTimer = new QTimer(this);
|
||||||
|
this->autostartTimer->setSingleShot(true);
|
||||||
|
connect(this->autostartTimer, SIGNAL(timeout()),
|
||||||
|
this, SLOT(handleAutostartTimerTimeout()));
|
||||||
|
|
||||||
while( !input.eof() ) {
|
this->autostartRemainingTimeRefreshTimer = new QTimer(this);
|
||||||
// *** Image description section ***
|
this->autostartRemainingTimeRefreshTimer->setSingleShot(false);
|
||||||
|
this->autostartRemainingTimeRefreshTimer->setInterval(10);
|
||||||
|
connect(this->autostartRemainingTimeRefreshTimer, SIGNAL(timeout()),
|
||||||
|
this, SIGNAL(autostartTimeoutProgressChanged()));
|
||||||
|
|
||||||
// entry in start tab
|
this->autostartElapsedTimer = new QElapsedTimer();
|
||||||
char line[500];
|
|
||||||
input.getline(line,500,'\n');
|
|
||||||
tmp_qstring = QString::fromAscii( line, -1 ).stripWhiteSpace();
|
|
||||||
|
|
||||||
if ( tmp_qstring.startsWith("#") || tmp_qstring.isEmpty() ) continue;
|
// Processes
|
||||||
|
this->asynchronosProcess = new QProcess(this);
|
||||||
tmp_qstring = tmp_qstring.section("#",0,0).stripWhiteSpace(); // Strip comment
|
|
||||||
if(tmp_qstring.lower().compare("[os]") == 0) {
|
|
||||||
LinboOs* tmpOs = read_os(&input);
|
|
||||||
if(!tmpOs->getName().isEmpty()) {
|
|
||||||
this->operatingSystems.append(tmpOs);
|
|
||||||
|
|
||||||
if(tmpOs->getAutostart() && this->currentOs == nullptr)
|
|
||||||
this->currentOs = tmpOs;
|
|
||||||
|
|
||||||
// check if this is an additional/incremental image for an existing OS
|
|
||||||
/* TODO unsigned int i; // Being checked later.
|
|
||||||
for(i = 0; i < elements.size(); i++ ) {
|
|
||||||
if(tmp_os.get_name().lower().compare(elements[i].get_name().lower()) == 0) {
|
|
||||||
elements[i].image_history.push_back(tmp_image); break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(i==elements.size()) { // Not included yet -> new image
|
|
||||||
tmp_os.image_history.push_back(tmp_image);
|
|
||||||
elements.push_back(tmp_os);
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
tmpOs->deleteLater();
|
|
||||||
}
|
|
||||||
} else if(tmp_qstring.lower().compare("[linbo]") == 0) {
|
|
||||||
read_globals(&input, config);
|
|
||||||
} else if(tmp_qstring.lower().compare("[partition]") == 0) {
|
|
||||||
LinboDiskPartition* tmpPartition = read_partition(&input);
|
|
||||||
if(!tmpPartition->getPath().isEmpty()) {
|
|
||||||
diskPartitions.append(tmpPartition);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
tmpPartition->deleteLater();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
input.close();
|
|
||||||
|
|
||||||
this->logger->log("Finished to parsing start.conf", LinboLogger::LinboGuiInfo);
|
|
||||||
this->logger->log("Loading global configuration", LinboLogger::LinboGuiInfo);
|
|
||||||
|
|
||||||
// load global config
|
|
||||||
QStringList command;
|
|
||||||
// ascynchorons commands are logged to logger
|
// ascynchorons commands are logged to logger
|
||||||
this->asynchronosProcess = new QProcess();
|
|
||||||
connect( asynchronosProcess, SIGNAL(readyReadStandardOutput()),
|
connect( asynchronosProcess, SIGNAL(readyReadStandardOutput()),
|
||||||
this, SLOT(readFromStdout()) );
|
this, SLOT(readFromStdout()) );
|
||||||
connect( asynchronosProcess, SIGNAL(readyReadStandardError()),
|
connect( asynchronosProcess, SIGNAL(readyReadStandardError()),
|
||||||
this, SLOT(readFromStderr()) );
|
this, SLOT(readFromStderr()) );
|
||||||
|
|
||||||
// synchronos commands are not logged
|
// synchronos commands are not logged
|
||||||
this->synchronosProcess = new QProcess();
|
this->synchronosProcess = new QProcess(this);
|
||||||
|
|
||||||
// client ip
|
// load all configuration
|
||||||
this->config->setIpAddress(this->executeCommand(true, "ip"));
|
this->loadStartConfiguration("start.conf");
|
||||||
|
this->loadEnvironmentValues();
|
||||||
|
|
||||||
// mac address
|
// triger autostart if necessary
|
||||||
this->config->setMacAddress(this->executeCommand(true, "mac"));
|
if(this->currentOs != nullptr && this->currentOs->getAutostartEnabled())
|
||||||
|
|
||||||
// Version
|
|
||||||
this->config->setVersion(this->executeCommand(true, "version").stripWhiteSpace());
|
|
||||||
|
|
||||||
// hostname
|
|
||||||
this->config->setHostname(this->executeCommand(true, "hostname"));
|
|
||||||
|
|
||||||
// CPU
|
|
||||||
this->config->setCpu(this->executeCommand(true, "cpu"));
|
|
||||||
|
|
||||||
// Memory
|
|
||||||
this->config->setRamSize(this->executeCommand(true, "memory"));
|
|
||||||
|
|
||||||
// Cache Size
|
|
||||||
this->config->setCacheSize(this->executeCommand(true, "size"));
|
|
||||||
|
|
||||||
// Harddisk Size
|
|
||||||
QRegExp *removePartition = new QRegExp("[0-9]{1,2}");
|
|
||||||
QString hd = this->config->getCache();
|
|
||||||
// e.g. turn /dev/sda1 into /dev/sda
|
|
||||||
hd.remove( *removePartition );
|
|
||||||
this->config->setHddSize(this->executeCommand(true, "size", hd));
|
|
||||||
|
|
||||||
|
|
||||||
this->logger->log("Finished loading global configuration", LinboLogger::LinboGuiInfo);
|
|
||||||
|
|
||||||
// default select first OS if no other OS has been selected yet
|
|
||||||
if(this->operatingSystems.length() > 0 && this->currentOs == nullptr)
|
|
||||||
this->currentOs = this->operatingSystems[0];
|
|
||||||
|
|
||||||
// triger autostart
|
|
||||||
if(this->currentOs->getAutostart())
|
|
||||||
this->executeAutostart();
|
this->executeAutostart();
|
||||||
else
|
else
|
||||||
this->setState(Idle);
|
this->setState(Idle);
|
||||||
|
@ -204,7 +128,7 @@ void LinboBackend::reboot() {
|
||||||
bool LinboBackend::startCurrentOs() {
|
bool LinboBackend::startCurrentOs() {
|
||||||
LinboOs* os = this->currentOs;
|
LinboOs* os = this->currentOs;
|
||||||
|
|
||||||
if(os == nullptr || (this->state != Idle && this->state != Autostarting) || !os->getStartbutton())
|
if(os == nullptr || (this->state != Idle && this->state != Autostarting) || !os->getActionEnabled(LinboOs::StartOs))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
this->setState(Starting);
|
this->setState(Starting);
|
||||||
|
@ -217,7 +141,7 @@ bool LinboBackend::startCurrentOs() {
|
||||||
os->getKernel(),
|
os->getKernel(),
|
||||||
os->getInitrd(),
|
os->getInitrd(),
|
||||||
os->getKernelOptions(),
|
os->getKernelOptions(),
|
||||||
this->config->getCache()
|
this->config->getCachePath()
|
||||||
);
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -226,18 +150,26 @@ bool LinboBackend::startCurrentOs() {
|
||||||
bool LinboBackend::syncCurrentOs() {
|
bool LinboBackend::syncCurrentOs() {
|
||||||
LinboOs* os = this->currentOs;
|
LinboOs* os = this->currentOs;
|
||||||
|
|
||||||
if(os == nullptr || (this->state != Idle && this->state != Autostarting) || !os->getSyncbutton())
|
if(os == nullptr || (this->state != Idle && this->state != Autostarting) || !os->getActionEnabled(LinboOs::SyncOs))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
this->setState(Syncing);
|
this->setState(Syncing);
|
||||||
|
|
||||||
|
qDebug() << "TEST2";
|
||||||
|
|
||||||
|
QString differentialImage;
|
||||||
|
if(os->getDifferentialImage() == nullptr)
|
||||||
|
differentialImage = "";
|
||||||
|
else
|
||||||
|
differentialImage = os->getDifferentialImage()->getName();
|
||||||
|
|
||||||
this->executeCommand(
|
this->executeCommand(
|
||||||
false,
|
false,
|
||||||
"syncstart",
|
"syncstart",
|
||||||
this->config->getServer(),
|
this->config->getServerIpAddress(),
|
||||||
this->config->getCache(),
|
this->config->getCachePath(),
|
||||||
os->getBaseImage()->getName(),
|
os->getBaseImage()->getName(),
|
||||||
os->getDifferentialImage()->getName(),
|
differentialImage,
|
||||||
os->getBootPartition(),
|
os->getBootPartition(),
|
||||||
os->getRootPartition(),
|
os->getRootPartition(),
|
||||||
os->getKernel(),
|
os->getKernel(),
|
||||||
|
@ -251,18 +183,24 @@ bool LinboBackend::syncCurrentOs() {
|
||||||
bool LinboBackend::reinstallCurrentOs() {
|
bool LinboBackend::reinstallCurrentOs() {
|
||||||
LinboOs* os = this->currentOs;
|
LinboOs* os = this->currentOs;
|
||||||
|
|
||||||
if(os == nullptr || (this->state != Idle && this->state != Autostarting) || !os->getNewbutton())
|
if(os == nullptr || (this->state != Idle && this->state != Autostarting) || !os->getActionEnabled(LinboOs::ReinstallOs))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
this->setState(Reinstalling);
|
this->setState(Reinstalling);
|
||||||
|
|
||||||
|
QString differentialImage;
|
||||||
|
if(os->getDifferentialImage() == nullptr)
|
||||||
|
differentialImage = "";
|
||||||
|
else
|
||||||
|
differentialImage = os->getDifferentialImage()->getName();
|
||||||
|
|
||||||
this->executeCommand(
|
this->executeCommand(
|
||||||
false,
|
false,
|
||||||
"syncr",
|
"syncr",
|
||||||
this->config->getServer(),
|
this->config->getServerIpAddress(),
|
||||||
this->config->getCache(),
|
this->config->getCachePath(),
|
||||||
os->getBaseImage()->getName(),
|
os->getBaseImage()->getName(),
|
||||||
os->getDifferentialImage()->getName(),
|
differentialImage,
|
||||||
os->getBootPartition(),
|
os->getBootPartition(),
|
||||||
os->getRootPartition(),
|
os->getRootPartition(),
|
||||||
os->getKernel(),
|
os->getKernel(),
|
||||||
|
@ -305,7 +243,7 @@ bool LinboBackend::initializeCache() {
|
||||||
|
|
||||||
this->setState(InitializingCache);
|
this->setState(InitializingCache);
|
||||||
|
|
||||||
QStringList commandArgs = this->buildCommand("initcache", config->getServer(), config->getCache());
|
QStringList commandArgs = this->buildCommand("initcache", config->getServerIpAddress(), config->getCachePath());
|
||||||
|
|
||||||
if( this->config->getDownloadType().isEmpty() )
|
if( this->config->getDownloadType().isEmpty() )
|
||||||
commandArgs.append(this->config->getDownloadType());
|
commandArgs.append(this->config->getDownloadType());
|
||||||
|
@ -329,11 +267,35 @@ bool LinboBackend::updateLinbo() {
|
||||||
if(this->state != Root)
|
if(this->state != Root)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
this->executeCommand("update", this->config->getServer(), this->config->getCache());
|
this->executeCommand("update", this->config->getServerIpAddress(), this->config->getCachePath());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool LinboBackend::cancelCurrentAction() {
|
||||||
|
switch (this->state) {
|
||||||
|
case Autostarting:
|
||||||
|
this->logger->log("Cancelling autostart", LinboLogger::LinboGuiInfo);
|
||||||
|
this->autostartTimer->stop();
|
||||||
|
this->autostartRemainingTimeRefreshTimer->stop();
|
||||||
|
this->autostartElapsedTimer->invalidate();
|
||||||
|
this->setState(Idle);
|
||||||
|
return true;
|
||||||
|
|
||||||
|
case Starting:
|
||||||
|
case Syncing:
|
||||||
|
case Reinstalling:
|
||||||
|
this->logger->log("Cancelling current start action: " + QString::number(this->state), LinboLogger::LinboGuiInfo);
|
||||||
|
this->asynchronosProcess->kill();
|
||||||
|
this->setState(Idle);
|
||||||
|
return true;
|
||||||
|
|
||||||
|
default:
|
||||||
|
this->logger->log("Cannot cancel current action: " + QString::number(this->state), LinboLogger::LinboGuiInfo);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LinboLogger* LinboBackend::getLogger() {
|
LinboLogger* LinboBackend::getLogger() {
|
||||||
return this->logger;
|
return this->logger;
|
||||||
}
|
}
|
||||||
|
@ -393,7 +355,6 @@ QString LinboBackend::executeCommand(bool waitForFinished, QString command, QStr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LinboBackend::readFromStdout() {
|
void LinboBackend::readFromStdout() {
|
||||||
QString stdOut = this->asynchronosProcess->readAllStandardOutput();
|
QString stdOut = this->asynchronosProcess->readAllStandardOutput();
|
||||||
QStringList lines = stdOut.split("\n");
|
QStringList lines = stdOut.split("\n");
|
||||||
|
@ -420,88 +381,235 @@ void LinboBackend::setState(LinboState state) {
|
||||||
|
|
||||||
this->state = state;
|
this->state = state;
|
||||||
emit this->stateChanged(this->state);
|
emit this->stateChanged(this->state);
|
||||||
|
|
||||||
|
this->logger->log("Linbo state changed to: " + QString::number(state), LinboLogger::LinboGuiInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return true unless beginning of new section '[' is found.
|
void LinboBackend::loadStartConfiguration(QString startConfFilePath) {
|
||||||
bool LinboBackend::read_pair(ifstream* input, QString& key, QString& value) {
|
// read start.conf
|
||||||
char line[1024];
|
this->logger->log("Starting to parse start.conf", LinboLogger::LinboGuiInfo);
|
||||||
if(input->peek() == '[') return false; // Next section found.
|
|
||||||
input->getline(line,1024,'\n');
|
QFile inputFile(startConfFilePath);
|
||||||
QString s = QString::fromAscii( line, -1 ).stripWhiteSpace();
|
if (inputFile.open(QIODevice::ReadOnly))
|
||||||
key = s.section("=",0,0).stripWhiteSpace().lower();
|
{
|
||||||
if(s.startsWith("#")||key.isEmpty()) {
|
QTextStream input(&inputFile);
|
||||||
key = QString(""); value = QString("");
|
QString currentSection;
|
||||||
} else {
|
QMap<QString, QString> linboConfig;
|
||||||
value=s.section("=",1).section("#",0,0).stripWhiteSpace();
|
QList<QMap<QString, QString>> partitionConfigs;
|
||||||
|
QList<QMap<QString, QString>> osConfigs;
|
||||||
|
bool firstLineOfSection = false;
|
||||||
|
|
||||||
|
while(!input.atEnd()) {
|
||||||
|
QString thisLine = input.readLine();
|
||||||
|
|
||||||
|
// ignore comments and empty lines
|
||||||
|
if(thisLine.startsWith("#")||thisLine.isEmpty())
|
||||||
|
continue;
|
||||||
|
// Remove comments from the end of the line
|
||||||
|
thisLine = thisLine.split("#")[0];
|
||||||
|
// ignore capitalization
|
||||||
|
thisLine = thisLine.toLower();
|
||||||
|
// remove empty characters
|
||||||
|
thisLine = thisLine.stripWhiteSpace();
|
||||||
|
thisLine = thisLine.simplified();
|
||||||
|
|
||||||
|
//qDebug() << "reading line: " << thisLine;
|
||||||
|
|
||||||
|
if(thisLine.startsWith("[")) {
|
||||||
|
// we found a new section!
|
||||||
|
currentSection = thisLine;
|
||||||
|
firstLineOfSection = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// parse key value pair
|
||||||
|
// ignore invalid lines
|
||||||
|
if(!thisLine.contains("=") || thisLine.startsWith("="))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// split string at
|
||||||
|
QStringList keyValueList = thisLine.split("=");
|
||||||
|
|
||||||
|
if(keyValueList.length() < 2)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
QString key = keyValueList[0].stripWhiteSpace();
|
||||||
|
QString value = keyValueList[1].stripWhiteSpace();
|
||||||
|
|
||||||
|
// ignore empty keys and values
|
||||||
|
if(key.isEmpty() || value.isEmpty())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// insert the values into our internal objects
|
||||||
|
if(currentSection == "[linbo]") {
|
||||||
|
// we are parsing the linbo config
|
||||||
|
linboConfig.insert(key, value);
|
||||||
|
}
|
||||||
|
else if(currentSection == "[partition]") {
|
||||||
|
// we are parsing a partition block
|
||||||
|
if(firstLineOfSection)
|
||||||
|
partitionConfigs.append(QMap<QString, QString>());
|
||||||
|
|
||||||
|
partitionConfigs.last().insert(key, value);
|
||||||
|
}
|
||||||
|
else if(currentSection == "[os]") {
|
||||||
|
// we are parsing an os block
|
||||||
|
if(firstLineOfSection)
|
||||||
|
osConfigs.append(QMap<QString, QString>());
|
||||||
|
|
||||||
|
osConfigs.last().insert(key, value);
|
||||||
|
}
|
||||||
|
// ignore everything else
|
||||||
|
|
||||||
|
firstLineOfSection = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
inputFile.close();
|
||||||
|
|
||||||
|
// write the config our internal objects
|
||||||
|
this->writeToLinboConfig(linboConfig, this->config);
|
||||||
|
|
||||||
|
for(QMap<QString, QString> partitionConfig : partitionConfigs) {
|
||||||
|
LinboDiskPartition* tmpPartition = new LinboDiskPartition(this);
|
||||||
|
this->writeToPartitionConfig(partitionConfig, tmpPartition);
|
||||||
|
if(tmpPartition->getPath() != "")
|
||||||
|
this->diskPartitions.append(tmpPartition);
|
||||||
|
else
|
||||||
|
tmpPartition->deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
|
for(QMap<QString, QString> osConfig : osConfigs) {
|
||||||
|
LinboOs* tmpOs = new LinboOs(this);
|
||||||
|
this->writeToOsConfig(osConfig, tmpOs);
|
||||||
|
if(tmpOs->getName() != "") {
|
||||||
|
this->operatingSystems.append(tmpOs);
|
||||||
|
if(tmpOs->getAutostartEnabled() && this->currentOs == nullptr)
|
||||||
|
// If the autostart of this OS is enabled and there is
|
||||||
|
// no other OS active yet -> set this OS as current OS
|
||||||
|
this->currentOs = tmpOs;
|
||||||
|
|
||||||
|
// check if this is an additional/incremental image for an existing OS
|
||||||
|
/* TODO unsigned int i; // Being checked later.
|
||||||
|
for(i = 0; i < elements.size(); i++ ) {
|
||||||
|
if(tmp_os.get_name().lower().compare(elements[i].get_name().lower()) == 0) {
|
||||||
|
elements[i].image_history.push_back(tmp_image); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(i==elements.size()) { // Not included yet -> new image
|
||||||
|
tmp_os.image_history.push_back(tmp_image);
|
||||||
|
elements.push_back(tmp_os);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
tmpOs->deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
|
// default select first OS if no other OS has been selected yet
|
||||||
|
if(this->operatingSystems.length() > 0 && this->currentOs == nullptr)
|
||||||
|
this->currentOs = this->operatingSystems[0];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
this->logger->log("Error opening the start configuration file: " + startConfFilePath, LinboLogger::LinboGuiError);
|
||||||
|
|
||||||
|
this->logger->log("Finished parsing start.conf", LinboLogger::LinboGuiInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LinboBackend::loadEnvironmentValues() {
|
||||||
|
this->logger->log("Loading environment values", LinboLogger::LinboGuiInfo);
|
||||||
|
// client ip
|
||||||
|
this->config->setIpAddress(this->executeCommand(true, "ip").replace("\n", ""));
|
||||||
|
|
||||||
|
// mac address
|
||||||
|
this->config->setMacAddress(this->executeCommand(true, "mac").replace("\n", ""));
|
||||||
|
|
||||||
|
// Version
|
||||||
|
this->config->setLinboVersion(this->executeCommand(true, "version").stripWhiteSpace().replace("\n", ""));
|
||||||
|
|
||||||
|
// hostname
|
||||||
|
this->config->setHostname(this->executeCommand(true, "hostname").replace("\n", ""));
|
||||||
|
|
||||||
|
// CPU
|
||||||
|
this->config->setCpuModel(this->executeCommand(true, "cpu").replace("\n", ""));
|
||||||
|
|
||||||
|
// Memory
|
||||||
|
this->config->setRamSize(this->executeCommand(true, "memory").replace("\n", ""));
|
||||||
|
|
||||||
|
// Cache Size
|
||||||
|
this->config->setCacheSize(this->executeCommand(true, "size", this->config->getCachePath()).replace("\n", ""));
|
||||||
|
|
||||||
|
// Harddisk Size
|
||||||
|
QRegExp *removePartition = new QRegExp("[0-9]{1,2}");
|
||||||
|
QString hd = this->config->getCachePath();
|
||||||
|
// e.g. turn /dev/sda1 into /dev/sda
|
||||||
|
hd.remove( *removePartition );
|
||||||
|
this->config->setHddSize(this->executeCommand(true, "size", hd).replace("\n", ""));
|
||||||
|
|
||||||
|
this->logger->log("Finished loading environment values", LinboLogger::LinboGuiInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LinboBackend::writeToLinboConfig(QMap<QString, QString> config, LinboConfig* linboConfig) {
|
||||||
|
for(QString key : config.keys()) {
|
||||||
|
QString value = config[key];
|
||||||
|
|
||||||
|
if(key == "server") linboConfig->setServerIpAddress(value);
|
||||||
|
else if(key == "cache") linboConfig->setCachePath(value);
|
||||||
|
else if(key == "roottimeout") linboConfig->setRootTimeout((unsigned int)value.toInt());
|
||||||
|
else if(key == "group") linboConfig->setHostGroup(value);
|
||||||
|
else if(key == "autopartition") linboConfig->setAutoPartition(toBool(value));
|
||||||
|
else if(key == "autoinitcache") linboConfig->setAutoInitCache(toBool(value));
|
||||||
|
else if(key == "autoformat") linboConfig->setAutoFormat(toBool(value));
|
||||||
|
else if(key == "backgroundfontcolor") linboConfig->setBackgroundFontcolor(value);
|
||||||
|
else if(key == "consolefontcolorstdout") linboConfig->setConsoleFontcolorStdout(value);
|
||||||
|
else if(key == "consolefontcolorstderr") linboConfig->setConsoleFontcolorStderr(value);
|
||||||
|
else if(key == "usemulticast") {
|
||||||
|
if(value.toInt() == 0)
|
||||||
|
linboConfig->setDownloadType("rsync");
|
||||||
|
else
|
||||||
|
linboConfig->setDownloadType("multicast");
|
||||||
|
}
|
||||||
|
else if(key == "downloadtype") linboConfig->setDownloadType(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LinboBackend::writeToPartitionConfig(QMap<QString, QString> config, LinboDiskPartition* partition) {
|
||||||
|
for(QString key : config.keys()) {
|
||||||
|
QString value = config[key];
|
||||||
|
if(key == "dev") partition->setPath(value);
|
||||||
|
else if(key == "size") partition->setSize(value.toInt());
|
||||||
|
else if(key == "id") partition->setId(value);
|
||||||
|
else if(key == "fstype") partition->setFstype(value);
|
||||||
|
else if(key.startsWith("bootable", false)) partition->setBootable(toBool(value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LinboBackend::writeToOsConfig(QMap<QString, QString> config, LinboOs* os) {
|
||||||
|
for(QString key : config.keys()) {
|
||||||
|
QString value = config[key];
|
||||||
|
if(key == "name") os->setName(value);
|
||||||
|
else if(key == "description") os->setDescription(value);
|
||||||
|
else if(key == "version") os->setVersion(value);
|
||||||
|
else if(key == "iconname") os->setIconName(value);
|
||||||
|
else if(key == "image") os->setDifferentialImage(new LinboImage(value, os));
|
||||||
|
else if(key == "baseimage") os->setBaseImage(new LinboImage(value, os));
|
||||||
|
else if(key == "boot") os->setBootPartition(value);
|
||||||
|
else if(key == "root") os->setRootPartition(value);
|
||||||
|
else if(key == "kernel") os->setKernel(value);
|
||||||
|
else if(key == "initrd") os->setInitrd(value);
|
||||||
|
else if(key == "append") os->setKernelOptions(value);
|
||||||
|
else if(key == "syncenabled") os->setSyncButtonEnabled(toBool(value));
|
||||||
|
else if(key == "startenabled") os->setStartButtonEnabled(toBool(value));
|
||||||
|
else if((key == "remotesyncenabled") || (key == "newenabled")) os->setReinstallButtonEnabled(toBool(value));
|
||||||
|
else if(key == "defaultaction") os->setDefaultAction(os->startActionFromString(value));
|
||||||
|
else if(key == "autostart") os->setAutostartEnabled(toBool(value));
|
||||||
|
else if(key == "autostarttimeout") os->setAutostartTimeout(value.toInt());
|
||||||
|
else if(key == "hidden") os->setHidden(toBool(value));
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LinboBackend::toBool(const QString& value) {
|
bool LinboBackend::toBool(const QString& value) {
|
||||||
if(value.startsWith("yes",false)) return true;
|
QStringList trueWords("yes");
|
||||||
if(value.startsWith("true",false)) return true;
|
trueWords.append("true");
|
||||||
if(value.startsWith("enable",false)) return true;
|
trueWords.append("enable");
|
||||||
return false;
|
return trueWords.contains(value.stripWhiteSpace());
|
||||||
}
|
|
||||||
|
|
||||||
LinboOs* LinboBackend::read_os(ifstream* input) {
|
|
||||||
LinboOs* os = new LinboOs(this);
|
|
||||||
QString key, value;
|
|
||||||
while(!input->eof() && read_pair(input, key, value)) {
|
|
||||||
if(key.compare("name") == 0) os->setName(value);
|
|
||||||
else if(key.compare("description") == 0) os->setDescription(value);
|
|
||||||
else if(key.compare("version") == 0) os->setVersion(value);
|
|
||||||
else if(key.compare("iconname") == 0) os->setIconName(value);
|
|
||||||
else if(key.compare("image") == 0) os->setDifferentialImage(new LinboImage(value, os));
|
|
||||||
else if(key.compare("baseimage") == 0) os->setBaseImage(new LinboImage(value, os));
|
|
||||||
else if(key.compare("boot") == 0) os->setBootPartition(value);
|
|
||||||
else if(key.compare("root") == 0) os->setRootPartition(value);
|
|
||||||
else if(key.compare("kernel") == 0) os->setKernel(value);
|
|
||||||
else if(key.compare("initrd") == 0) os->setInitrd(value);
|
|
||||||
else if(key.compare("append") == 0) os->setKernelOptions(value);
|
|
||||||
else if(key.compare("syncenabled") == 0) os->setSyncButton(toBool(value));
|
|
||||||
else if(key.compare("startenabled") == 0) os->setStartButton(toBool(value));
|
|
||||||
else if((key.compare("remotesyncenabled") == 0) || (key.compare("newenabled") == 0)) os->setNewButton(toBool(value));
|
|
||||||
else if(key.compare("defaultaction") == 0) os->setDefaultAction(os->startActionFromString(value));
|
|
||||||
else if(key.compare("autostart") == 0) os->setAutostart(toBool(value));
|
|
||||||
else if(key.compare("autostarttimeout") == 0) os->setAutostartTimeout(value.toInt());
|
|
||||||
else if(key.compare("hidden") == 0) os->setHidden(toBool(value));
|
|
||||||
}
|
|
||||||
return os;
|
|
||||||
}
|
|
||||||
|
|
||||||
LinboDiskPartition* LinboBackend::read_partition(ifstream* input) {
|
|
||||||
LinboDiskPartition* partition = new LinboDiskPartition(this);
|
|
||||||
QString key, value;
|
|
||||||
while(!input->eof() && read_pair(input, key, value)) {
|
|
||||||
if(key.compare("dev") == 0) partition->setPath(value);
|
|
||||||
else if(key.compare("size") == 0) partition->setSize(value.toInt());
|
|
||||||
else if(key.compare("id") == 0) partition->setId(value);
|
|
||||||
else if(key.compare("fstype") == 0) partition->setFstype(value);
|
|
||||||
else if(key.startsWith("bootable", false)) partition->setBootable(toBool(value));
|
|
||||||
}
|
|
||||||
return partition;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LinboBackend::read_globals( ifstream* input, LinboConfig* config ) {
|
|
||||||
QString key, value;
|
|
||||||
while(!input->eof() && read_pair(input, key, value)) {
|
|
||||||
if(key.compare("server") == 0) config->setServer(value);
|
|
||||||
else if(key.compare("cache") == 0) config->setCache(value);
|
|
||||||
else if(key.compare("roottimeout") == 0) config->setRootTimeout((unsigned int)value.toInt());
|
|
||||||
else if(key.compare("group") == 0) config->setHostgroup(value);
|
|
||||||
else if(key.compare("autopartition") == 0) config->setAutopartition(toBool(value));
|
|
||||||
else if(key.compare("autoinitcache") == 0) config->setAutoInitCache(toBool(value));
|
|
||||||
else if(key.compare("autoformat") == 0) config->setAutoFormat(toBool(value));
|
|
||||||
else if(key.compare("backgroundfontcolor") == 0) config->setBackgroundFontcolor(value);
|
|
||||||
else if(key.compare("consolefontcolorstdout") == 0) config->setConsoleFontcolorStdout(value);
|
|
||||||
else if(key.compare("consolefontcolorstderr") == 0) config->setConsoleFontcolorStderr(value);
|
|
||||||
else if(key.compare("usemulticast") == 0) {
|
|
||||||
if( (unsigned int)value.toInt() == 0 )
|
|
||||||
config->setDownloadType("rsync");
|
|
||||||
else
|
|
||||||
config->setDownloadType("multicast");
|
|
||||||
}
|
|
||||||
else if(key.compare("downloadtype") == 0) config->setDownloadType(value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "../../headers/backend/linboconfig.h"
|
#include "linboconfig.h"
|
||||||
|
|
||||||
LinboConfig::LinboConfig(QObject *parent) : QObject(parent)
|
LinboConfig::LinboConfig(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "../../headers/backend/linbodiskpartition.h"
|
#include "linbodiskpartition.h"
|
||||||
|
|
||||||
LinboDiskPartition::LinboDiskPartition(QObject *parent) : QObject(parent)
|
LinboDiskPartition::LinboDiskPartition(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "../../headers/backend/linboimage.h"
|
#include "linboimage.h"
|
||||||
|
|
||||||
LinboImage::LinboImage(QString name, QObject *parent) : QObject(parent)
|
LinboImage::LinboImage(QString name, QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,8 +1,26 @@
|
||||||
#include "../../headers/backend/linbologger.h"
|
/****************************************************************************
|
||||||
|
** 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/>.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
LinboLogger::LinboLogger(QObject *parent) : QObject(parent)
|
#include "linbologger.h"
|
||||||
|
|
||||||
|
LinboLogger::LinboLogger(QString logFilePath, QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
|
this->logFilePath = logFilePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString LinboLogger::logTypeToString(LinboLogType logType) {
|
QString LinboLogger::logTypeToString(LinboLogType logType) {
|
||||||
|
@ -24,11 +42,29 @@ void LinboLogger::log(QString logText, LinboLogType logType) {
|
||||||
if(logText.isEmpty() || logText == "")
|
if(logText.isEmpty() || logText == "")
|
||||||
return;
|
return;
|
||||||
qDebug() << qPrintable("[" + this->logTypeToString(logType) + "]") << logText;
|
qDebug() << qPrintable("[" + this->logTypeToString(logType) + "]") << logText;
|
||||||
|
|
||||||
LinboLog latestLog {logText, logType, QDateTime::currentDateTime()};
|
LinboLog latestLog {logText, logType, QDateTime::currentDateTime()};
|
||||||
this->logHistory.append(latestLog);
|
this->logHistory.append(latestLog);
|
||||||
|
|
||||||
|
// TODO: Log error, when this fails
|
||||||
|
this->writeToLogFile("[" + this->logTypeToString(logType) + "]" + logText);
|
||||||
|
|
||||||
emit this->latestLogChanged(latestLog);
|
emit this->latestLogChanged(latestLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool LinboLogger::writeToLogFile(QString text) {
|
||||||
|
// write to logfile
|
||||||
|
QFile logfile(this->logFilePath);
|
||||||
|
if(!logfile.open( QIODevice::WriteOnly | QIODevice::Append ))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
QTextStream logstream( &logfile );
|
||||||
|
logstream << text << "\n";
|
||||||
|
logfile.flush();
|
||||||
|
logfile.close();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
const LinboLogger::LinboLog& LinboLogger::getLatestLog() {
|
const LinboLogger::LinboLog& LinboLogger::getLatestLog() {
|
||||||
return this->logHistory.last();
|
return this->logHistory.last();
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,14 +16,35 @@
|
||||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "../../headers/backend/linboos.h"
|
#include "linboos.h"
|
||||||
|
|
||||||
LinboOs::LinboOs(QObject *parent) : QObject(parent)
|
LinboOs::LinboOs(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
autostart = false;
|
this->autostartEnabled = false;
|
||||||
autostartTimeout = 0;
|
this->autostartTimeout = 0;
|
||||||
hidden = false;
|
this->hidden = false;
|
||||||
defaultAction = SyncOs;
|
this->defaultAction = SyncOs;
|
||||||
// TODO ?? image_history.clear();
|
this->iconName = QString("defaultIcon.svg");
|
||||||
iconName = QString("defaultIcon.svg");
|
this->baseImage = nullptr;
|
||||||
|
this->differentialImage = nullptr;
|
||||||
|
// TODO ?? image_history.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LinboOs::getActionEnabled(LinboOsStartAction action) {
|
||||||
|
switch (action) {
|
||||||
|
case StartOs: return this->getStartActionEnabled();
|
||||||
|
case SyncOs: return this->getSyncActionEnabled();
|
||||||
|
case ReinstallOs: return this->getReinstallActionEnabled();
|
||||||
|
default: return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LinboOs::LinboOsStartAction LinboOs::startActionFromString(const QString& name) {
|
||||||
|
if(name == "start")
|
||||||
|
return StartOs;
|
||||||
|
else if(name == "sync")
|
||||||
|
return SyncOs;
|
||||||
|
else if(name == "new")
|
||||||
|
return ReinstallOs;
|
||||||
|
return UnknownAction;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ linboCounterImpl::linboCounterImpl( QWidget* parent ) : linboDialog()
|
||||||
if( parent )
|
if( parent )
|
||||||
myParent = parent;
|
myParent = parent;
|
||||||
|
|
||||||
QRect qRect(QApplication::desktop()->screenGeometry());
|
|
||||||
// open in the upper left of our screen
|
// open in the upper left of our screen
|
||||||
int xpos= 10;
|
int xpos= 10;
|
||||||
int ypos= 10;
|
int ypos= 10;
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -10,206 +10,204 @@
|
||||||
|
|
||||||
linboPasswordBoxImpl::linboPasswordBoxImpl( QDialog* parent ) : linboDialog()
|
linboPasswordBoxImpl::linboPasswordBoxImpl( QDialog* parent ) : linboDialog()
|
||||||
{
|
{
|
||||||
Ui_linboPasswordBox::setupUi((QDialog*)this);
|
Ui_linboPasswordBox::setupUi((QDialog*)this);
|
||||||
|
|
||||||
connect(passwordInput,SIGNAL(returnPressed()),this,SLOT(postcmd()));
|
connect(passwordInput,SIGNAL(returnPressed()),this,SLOT(postcmd()));
|
||||||
|
|
||||||
process=new QProcess( this );
|
process=new QProcess( this );
|
||||||
if(parent)
|
if(parent)
|
||||||
myParent = parent;
|
myParent = parent;
|
||||||
|
|
||||||
myTimer = new QTimer(this);
|
myTimer = new QTimer(this);
|
||||||
myCounter = new linboCounterImpl(this);
|
myCounter = new linboCounterImpl(this);
|
||||||
|
|
||||||
logConsole = new linboLogConsole(0);
|
logConsole = new linboLogConsole(0);
|
||||||
|
|
||||||
connect( myTimer, SIGNAL(timeout()), this, SLOT(processTimeout()) );
|
connect( myTimer, SIGNAL(timeout()), this, SLOT(processTimeout()) );
|
||||||
|
|
||||||
// connect SLOT for finished process
|
// connect SLOT for finished process
|
||||||
connect( process, SIGNAL(finished(int, QProcess::ExitStatus) ),
|
connect( process, SIGNAL(finished(int, QProcess::ExitStatus) ),
|
||||||
this, SLOT(processFinished(int, QProcess::ExitStatus)) );
|
this, SLOT(processFinished(int, QProcess::ExitStatus)) );
|
||||||
|
|
||||||
// connect stdout and stderr to linbo console
|
// connect stdout and stderr to linbo console
|
||||||
connect( process, SIGNAL(readyReadStandardOutput()),
|
connect( process, SIGNAL(readyReadStandardOutput()),
|
||||||
this, SLOT(readFromStdout()) );
|
this, SLOT(readFromStdout()) );
|
||||||
|
|
||||||
connect( process, SIGNAL(readyReadStandardError()),
|
connect( process, SIGNAL(readyReadStandardError()),
|
||||||
this, SLOT(readFromStderr()) );
|
this, SLOT(readFromStderr()) );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Qt::WindowFlags flags;
|
Qt::WindowFlags flags;
|
||||||
flags = Qt::Dialog | Qt::WindowStaysOnTopHint | Qt::WindowTitleHint;
|
flags = Qt::Dialog | Qt::WindowStaysOnTopHint | Qt::WindowTitleHint;
|
||||||
setWindowFlags( flags );
|
setWindowFlags( flags );
|
||||||
|
|
||||||
QRect qRect(QApplication::desktop()->screenGeometry());
|
// open in the upper left of our screen
|
||||||
// open in the upper left of our screen
|
int xpos=10;
|
||||||
int xpos=10;
|
int ypos=10;
|
||||||
int ypos=10;
|
this->move(xpos,ypos);
|
||||||
this->move(xpos,ypos);
|
this->setFixedSize( this->width(), this->height() );
|
||||||
this->setFixedSize( this->width(), this->height() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
linboPasswordBoxImpl::~linboPasswordBoxImpl()
|
linboPasswordBoxImpl::~linboPasswordBoxImpl()
|
||||||
{
|
{
|
||||||
delete myTimer;
|
delete myTimer;
|
||||||
delete process;
|
delete process;
|
||||||
delete myCounter;
|
delete myCounter;
|
||||||
}
|
}
|
||||||
|
|
||||||
void linboPasswordBoxImpl::precmd() {
|
void linboPasswordBoxImpl::precmd() {
|
||||||
// nothing to do
|
// nothing to do
|
||||||
}
|
}
|
||||||
|
|
||||||
void linboPasswordBoxImpl::postcmd() {
|
void linboPasswordBoxImpl::postcmd() {
|
||||||
|
|
||||||
this->hide();
|
this->hide();
|
||||||
app = static_cast<linboGUIImpl*>( myMainApp );
|
app = static_cast<linboGUIImpl*>( myMainApp );
|
||||||
|
|
||||||
if( app ) {
|
if( app ) {
|
||||||
// build authentication command
|
// build authentication command
|
||||||
arguments.clear();
|
arguments.clear();
|
||||||
arguments.append("linbo_cmd");
|
arguments.append("linbo_cmd");
|
||||||
arguments.append( "authenticate" );
|
arguments.append( "authenticate" );
|
||||||
arguments.append( app->config.get_server() );
|
arguments.append( app->config.get_server() );
|
||||||
arguments.append( "linbo" );
|
arguments.append( "linbo" );
|
||||||
arguments.append( passwordInput->text() );
|
arguments.append( passwordInput->text() );
|
||||||
arguments.append( "linbo" );
|
arguments.append( "linbo" );
|
||||||
|
|
||||||
QStringList processargs( arguments );
|
QStringList processargs( arguments );
|
||||||
QString command = processargs.takeFirst();
|
QString command = processargs.takeFirst();
|
||||||
|
|
||||||
process->start( command, processargs );
|
process->start( command, processargs );
|
||||||
|
|
||||||
while( !process->waitForFinished(10000) ) {
|
while( !process->waitForFinished(10000) ) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Console->insert( QString("Test linboPasswordBoxImpl exitCode() == ") + QString::number( process->exitCode() ) );
|
// Console->insert( QString("Test linboPasswordBoxImpl exitCode() == ") + QString::number( process->exitCode() ) );
|
||||||
|
|
||||||
if ( process->exitCode() == 0 ) {
|
if ( process->exitCode() == 0 ) {
|
||||||
if( app ) {
|
if( app ) {
|
||||||
|
// set password in all buttons
|
||||||
|
QStringList tmp;
|
||||||
|
|
||||||
// set password in all buttons
|
for( unsigned int i = 0; i < app->p_buttons.size(); i++ )
|
||||||
QStringList tmp;
|
{
|
||||||
|
|
||||||
for( unsigned int i = 0; i < app->p_buttons.size(); i++ )
|
linboDialog* tmpDialog = app->p_buttons[i]->getLinboDialog();
|
||||||
{
|
if( tmpDialog ) {
|
||||||
|
// in this case, we have a sub-dialogue
|
||||||
|
tmp = tmpDialog->getCommand();
|
||||||
|
|
||||||
linboDialog* tmpDialog = app->p_buttons[i]->getLinboDialog();
|
// fear the segmentation fault!
|
||||||
if( tmpDialog ) {
|
// fifth argument is password
|
||||||
// in this case, we have a sub-dialogue
|
if( tmp.size() > 4 ) {
|
||||||
tmp = tmpDialog->getCommand();
|
|
||||||
|
|
||||||
// fear the segmentation fault!
|
if( tmp[1] == QString("upload") ||
|
||||||
// fifth argument is password
|
tmp[1] == QString("register") ) {
|
||||||
if( tmp.size() > 4 ) {
|
|
||||||
|
|
||||||
if( tmp[1] == QString("upload") ||
|
// change upload password
|
||||||
tmp[1] == QString("register") ) {
|
tmp[4] = passwordInput->text();
|
||||||
|
tmpDialog->setCommand( tmp );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// change upload password
|
// this is for the case we have no associated linbo dialog
|
||||||
tmp[4] = passwordInput->text();
|
if( app->p_buttons[i] ) {
|
||||||
tmpDialog->setCommand( tmp );
|
tmp.clear();
|
||||||
}
|
tmp = app->p_buttons[i]->getCommand();
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// this is for the case we have no associated linbo dialog
|
// fifth argument is password
|
||||||
if( app->p_buttons[i] ) {
|
if( tmp.size() > 4 ) {
|
||||||
tmp.clear();
|
|
||||||
tmp = app->p_buttons[i]->getCommand();
|
|
||||||
|
|
||||||
// fifth argument is password
|
if( tmp[1] == QString("upload") ||
|
||||||
if( tmp.size() > 4 ) {
|
tmp[1] == QString("register") ) {
|
||||||
|
// change upload password
|
||||||
|
tmp[4] = passwordInput->text();
|
||||||
|
app->p_buttons[i]->setCommand( tmp );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( tmp[1] == QString("upload") ||
|
app->enableButtons();
|
||||||
tmp[1] == QString("register") ) {
|
app->showImagingTab();
|
||||||
// change upload password
|
|
||||||
tmp[4] = passwordInput->text();
|
|
||||||
app->p_buttons[i]->setCommand( tmp );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
app->enableButtons();
|
myTimer->stop();
|
||||||
app->showImagingTab();
|
myTimer->start( 1000, FALSE );
|
||||||
|
currentTimeout = app->config.get_roottimeout();
|
||||||
|
|
||||||
myTimer->stop();
|
myCounter->counter->display( currentTimeout );
|
||||||
myTimer->start( 1000, FALSE );
|
|
||||||
currentTimeout = app->config.get_roottimeout();
|
|
||||||
|
|
||||||
myCounter->counter->display( currentTimeout );
|
connect( myCounter->logoutButton, SIGNAL(pressed()), app, SLOT(resetButtons()) );
|
||||||
|
connect( myCounter->logoutButton, SIGNAL(clicked()), myTimer, SLOT(stop()) );
|
||||||
|
|
||||||
connect( myCounter->logoutButton, SIGNAL(pressed()), app, SLOT(resetButtons()) );
|
myCounter->show();
|
||||||
connect( myCounter->logoutButton, SIGNAL(clicked()), myTimer, SLOT(stop()) );
|
myCounter->raise();
|
||||||
|
myCounter->move( QPoint( 5, 5 ) );
|
||||||
myCounter->show();
|
}
|
||||||
myCounter->raise();
|
}
|
||||||
myCounter->move( QPoint( 5, 5 ) );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
passwordInput->clear();
|
passwordInput->clear();
|
||||||
this->close();
|
this->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void linboPasswordBoxImpl::setCommand(const QStringList& arglist)
|
void linboPasswordBoxImpl::setCommand(const QStringList& arglist)
|
||||||
{
|
{
|
||||||
arguments = arglist;
|
arguments = arglist;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList linboPasswordBoxImpl::getCommand()
|
QStringList linboPasswordBoxImpl::getCommand()
|
||||||
{
|
{
|
||||||
return arguments;
|
return arguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
void linboPasswordBoxImpl::setMainApp( QWidget* newMainApp ) {
|
void linboPasswordBoxImpl::setMainApp( QWidget* newMainApp ) {
|
||||||
if ( newMainApp ) {
|
if ( newMainApp ) {
|
||||||
myMainApp = newMainApp;
|
myMainApp = newMainApp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void linboPasswordBoxImpl::readFromStdout()
|
void linboPasswordBoxImpl::readFromStdout()
|
||||||
{
|
{
|
||||||
logConsole->writeStdOut( process->readAllStandardOutput() );
|
logConsole->writeStdOut( process->readAllStandardOutput() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void linboPasswordBoxImpl::readFromStderr()
|
void linboPasswordBoxImpl::readFromStderr()
|
||||||
{
|
{
|
||||||
logConsole->writeStdErr( process->readAllStandardError() );
|
logConsole->writeStdErr( process->readAllStandardError() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void linboPasswordBoxImpl::setTextBrowser( const QString& new_consolefontcolorstdout,
|
void linboPasswordBoxImpl::setTextBrowser( const QString& new_consolefontcolorstdout,
|
||||||
const QString& new_consolefontcolorstderr,
|
const QString& new_consolefontcolorstderr,
|
||||||
QTextEdit* newBrowser )
|
QTextEdit* newBrowser )
|
||||||
{
|
{
|
||||||
logConsole->setLinboLogConsole( new_consolefontcolorstdout,
|
logConsole->setLinboLogConsole( new_consolefontcolorstdout,
|
||||||
new_consolefontcolorstderr,
|
new_consolefontcolorstderr,
|
||||||
newBrowser );
|
newBrowser );
|
||||||
}
|
}
|
||||||
|
|
||||||
void linboPasswordBoxImpl::processTimeout() {
|
void linboPasswordBoxImpl::processTimeout() {
|
||||||
if( !myCounter->timeoutCheck->isChecked() ) {
|
if( !myCounter->timeoutCheck->isChecked() ) {
|
||||||
// do nothing but dont stop timer
|
// do nothing but dont stop timer
|
||||||
}
|
|
||||||
else {
|
|
||||||
if( currentTimeout > 0 ) {
|
|
||||||
currentTimeout--;
|
|
||||||
myCounter->counter->display( currentTimeout );
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
app->resetButtons();
|
if( currentTimeout > 0 ) {
|
||||||
myCounter->close();
|
currentTimeout--;
|
||||||
|
myCounter->counter->display( currentTimeout );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
app->resetButtons();
|
||||||
|
myCounter->close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void linboPasswordBoxImpl::processFinished( int retval,
|
void linboPasswordBoxImpl::processFinished( int retval,
|
||||||
QProcess::ExitStatus status) {
|
QProcess::ExitStatus status) {
|
||||||
|
|
||||||
logConsole->writeResult( retval, status, process->error() );
|
logConsole->writeResult( retval, status, process->error() );
|
||||||
|
|
||||||
// app->restoreButtonsState();
|
// app->restoreButtonsState();
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "../headers/linbogui.h"
|
#include "linbogui.h"
|
||||||
|
|
||||||
LinboGui::LinboGui()
|
LinboGui::LinboGui()
|
||||||
{
|
{
|
||||||
|
@ -29,9 +29,8 @@ LinboGui::LinboGui()
|
||||||
this->setFixedHeight(QApplication::desktop()->screenGeometry().height());
|
this->setFixedHeight(QApplication::desktop()->screenGeometry().height());
|
||||||
this->setFixedWidth(QApplication::desktop()->screenGeometry().width());
|
this->setFixedWidth(QApplication::desktop()->screenGeometry().width());
|
||||||
|
|
||||||
QFontDatabase db;
|
// Load segoe font
|
||||||
qDebug() << QFontDatabase::addApplicationFont(":/fonts/SegoeUI.ttf");
|
QFontDatabase::addApplicationFont(":/fonts/SegoeUI.ttf");
|
||||||
qDebug() << db.families();
|
|
||||||
|
|
||||||
// white bakground
|
// white bakground
|
||||||
// linuxmuster background color: #394f5e
|
// linuxmuster background color: #394f5e
|
||||||
|
|
|
@ -35,8 +35,12 @@ LinboOs* LinboOsSelectButton::getOs() {
|
||||||
return this->os;
|
return this->os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LinboOsSelectButton::setVisibleAnimated(bool visible) {
|
||||||
|
this->button->setVisibleAnimated(visible);
|
||||||
|
}
|
||||||
|
|
||||||
void LinboOsSelectButton::setVisible(bool visible) {
|
void LinboOsSelectButton::setVisible(bool visible) {
|
||||||
this->button->setVisibleAnimated(visible, true);
|
this->button->setVisible(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LinboOsSelectButton::resizeEvent(QResizeEvent *event) {
|
void LinboOsSelectButton::resizeEvent(QResizeEvent *event) {
|
||||||
|
|
|
@ -1,7 +1,27 @@
|
||||||
#include "../headers/linboosselectionrow.h"
|
/****************************************************************************
|
||||||
|
** 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/>.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "linboosselectionrow.h"
|
||||||
|
|
||||||
LinboOsSelectionRow::LinboOsSelectionRow(LinboBackend* backend, QWidget *parent) : QWidget(parent)
|
LinboOsSelectionRow::LinboOsSelectionRow(LinboBackend* backend, QWidget *parent) : QWidget(parent)
|
||||||
{
|
{
|
||||||
|
this->inited = false;
|
||||||
|
|
||||||
this->backend = backend;
|
this->backend = backend;
|
||||||
connect(this->backend, SIGNAL(stateChanged(LinboBackend::LinboState)), this, SLOT(handleLinboStateChanged(LinboBackend::LinboState)));
|
connect(this->backend, SIGNAL(stateChanged(LinboBackend::LinboState)), this, SLOT(handleLinboStateChanged(LinboBackend::LinboState)));
|
||||||
|
|
||||||
|
@ -20,29 +40,85 @@ LinboOsSelectionRow::LinboOsSelectionRow(LinboBackend* backend, QWidget *parent)
|
||||||
|
|
||||||
this->osButtons.append(osButton);
|
this->osButtons.append(osButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(this->osButtons.length() == 0) {
|
||||||
|
this->noOsLabel = new QLabel(tr("No Operating system configured in start.conf"), this);
|
||||||
|
this->noOsLabel->hide();
|
||||||
|
this->noOsLabel->setAlignment(Qt::AlignCenter);
|
||||||
|
this->noOsLabelFont = QFont("Segoe UI");
|
||||||
|
this->noOsLabelFont.setBold(true);
|
||||||
|
this->noOsLabel->setFont(this->noOsLabelFont);
|
||||||
|
|
||||||
|
QString environmentValuesText;
|
||||||
|
environmentValuesText += tr("Host") + ": " + this->backend->getConfig()->getHostname() + "\n";
|
||||||
|
//noOsText += tr("Group") + ": " + this->backend->getConfig()->getHostGroup() + "\n";
|
||||||
|
environmentValuesText += tr("IP-Address") + ": " + this->backend->getConfig()->getIpAddress() + "\n";
|
||||||
|
//noOsText += tr("Server IP-Address") + ": " + this->backend->getConfig()->getServerIpAddress() + "\n";
|
||||||
|
environmentValuesText += tr("Mac-Address") + ": " + this->backend->getConfig()->getMacAddress() + "\n";
|
||||||
|
|
||||||
|
this->environmentValuesLabel = new QLabel(environmentValuesText, this);
|
||||||
|
this->environmentValuesLabel->hide();
|
||||||
|
this->environmentValuesLabel->setAlignment(Qt::AlignCenter);
|
||||||
|
this->environmentValuesLabelFont = QFont("Segoe UI");
|
||||||
|
this->environmentValuesLabel->setFont(this->environmentValuesLabelFont);
|
||||||
|
}
|
||||||
|
|
||||||
|
this->handleLinboStateChanged(this->backend->getState());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LinboOsSelectionRow::resizeAndPositionAllButtons() {
|
void LinboOsSelectionRow::resizeAndPositionAllButtons() {
|
||||||
int buttonWidth = this->width() / this->osButtonGroup->buttons().length();
|
|
||||||
if(this->showOnlySelectedButton) {
|
if(this->osButtons.length() > 0) {
|
||||||
|
int buttonWidth = 0;
|
||||||
|
buttonWidth = this->width() / this->osButtonGroup->buttons().length();
|
||||||
|
|
||||||
for(int i = 0; i < this->osButtons.length(); i++) {
|
for(int i = 0; i < this->osButtons.length(); i++) {
|
||||||
if(!this->osButtons[i]->button->isChecked())
|
|
||||||
this->osButtons[i]->hide();
|
bool visible = true;
|
||||||
else {
|
QRect geometry = this->osButtons[i]->geometry();
|
||||||
QPropertyAnimation* moveAnimation = new QPropertyAnimation(this->osButtons[i], "geometry");
|
|
||||||
moveAnimation->setEasingCurve(QEasingCurve::InOutQuad);
|
if(!this->osButtons[i]->button->isChecked() || !this->showOnlySelectedButton) {
|
||||||
moveAnimation->setDuration(400);
|
visible = !this->showOnlySelectedButton;
|
||||||
moveAnimation->setStartValue(this->osButtons[i]->geometry());
|
geometry = QRect(buttonWidth * i, 0, buttonWidth, this->height());
|
||||||
moveAnimation->setEndValue(QRect((this->width() - buttonWidth) / 2, 0, buttonWidth, this->height()));
|
|
||||||
moveAnimation->start();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
visible = true;
|
||||||
|
geometry = QRect((this->width() - buttonWidth) / 2, 0, buttonWidth, this->height());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this->inited) {
|
||||||
|
this->osButtons[i]->setVisibleAnimated(visible);
|
||||||
|
|
||||||
|
QPropertyAnimation* moveAnimation = new QPropertyAnimation(this->osButtons[i], "geometry");
|
||||||
|
moveAnimation->setEasingCurve(QEasingCurve::InOutQuad);
|
||||||
|
moveAnimation->setDuration(400);
|
||||||
|
moveAnimation->setStartValue(this->osButtons[i]->geometry());
|
||||||
|
moveAnimation->setEndValue(geometry);
|
||||||
|
moveAnimation->start();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// Do not animate the first time
|
||||||
|
this->osButtons[i]->setVisible(visible);
|
||||||
|
this->osButtons[i]->setGeometry(geometry);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for(int i = 0; i < this->osButtons.length(); i++) {
|
int infoLabelHeight = this->height();
|
||||||
this->osButtons[i]->setGeometry(buttonWidth * i, 0, buttonWidth, this->height());
|
int infoLabelWidth = this->width() * 0.8;
|
||||||
}
|
int noOsLabelHeight = this->height() * 0.2;
|
||||||
|
this->noOsLabelFont.setPixelSize(noOsLabelHeight * 0.8);
|
||||||
|
this->noOsLabel->setFont(this->noOsLabelFont);
|
||||||
|
this->noOsLabel->setGeometry((this->width() - infoLabelWidth) / 2, 0, infoLabelWidth, noOsLabelHeight);
|
||||||
|
this->noOsLabel->show();
|
||||||
|
|
||||||
|
this->environmentValuesLabelFont.setPixelSize(infoLabelHeight * 0.1);
|
||||||
|
this->environmentValuesLabel->setFont(this->environmentValuesLabelFont);
|
||||||
|
this->environmentValuesLabel->setGeometry((this->width() - infoLabelWidth) / 2, noOsLabelHeight, infoLabelWidth, infoLabelHeight);
|
||||||
|
this->environmentValuesLabel->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this->inited = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LinboOsSelectionRow::handleButtonToggled(bool checked) {
|
void LinboOsSelectionRow::handleButtonToggled(bool checked) {
|
||||||
|
@ -67,7 +143,8 @@ void LinboOsSelectionRow::setShowOnlySelectedButton(bool value) {
|
||||||
|
|
||||||
this->showOnlySelectedButton = value;
|
this->showOnlySelectedButton = value;
|
||||||
|
|
||||||
this->resizeAndPositionAllButtons();
|
if(this->inited)
|
||||||
|
this->resizeAndPositionAllButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LinboOsSelectionRow::resizeEvent(QResizeEvent *event) {
|
void LinboOsSelectionRow::resizeEvent(QResizeEvent *event) {
|
||||||
|
@ -82,6 +159,7 @@ void LinboOsSelectionRow::handleLinboStateChanged(LinboBackend::LinboState newSt
|
||||||
this->setShowOnlySelectedButton(false);
|
this->setShowOnlySelectedButton(false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case LinboBackend::Autostarting:
|
||||||
case LinboBackend::Starting:
|
case LinboBackend::Starting:
|
||||||
case LinboBackend::Syncing:
|
case LinboBackend::Syncing:
|
||||||
case LinboBackend::Reinstalling:
|
case LinboBackend::Reinstalling:
|
||||||
|
|
|
@ -1,4 +1,22 @@
|
||||||
#include "../headers/linbostartactions.h"
|
/****************************************************************************
|
||||||
|
** 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/>.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "linbostartactions.h"
|
||||||
|
|
||||||
LinboStartActions::LinboStartActions(LinboBackend* backend, QWidget *parent) : QWidget(parent)
|
LinboStartActions::LinboStartActions(LinboBackend* backend, QWidget *parent) : QWidget(parent)
|
||||||
{
|
{
|
||||||
|
@ -24,6 +42,13 @@ LinboStartActions::LinboStartActions(LinboBackend* backend, QWidget *parent) : Q
|
||||||
this->reinstallOsButton = new QModernPushButton(":/svgIcons/resetAction.svg", this->buttonWidget);
|
this->reinstallOsButton = new QModernPushButton(":/svgIcons/resetAction.svg", this->buttonWidget);
|
||||||
connect(this->reinstallOsButton, SIGNAL(clicked()), this->backend, SLOT(reinstallCurrentOs()));
|
connect(this->reinstallOsButton, SIGNAL(clicked()), this->backend, SLOT(reinstallCurrentOs()));
|
||||||
|
|
||||||
|
this->noBaseImageLabel = new QLabel(tr("No baseimage defined"), this->buttonWidget);
|
||||||
|
this->noBaseImageLabel->setStyleSheet("QLabel { color : red; }");
|
||||||
|
this->noBaseImageLabelFont = QFont("Segoe UI");
|
||||||
|
this->noBaseImageLabel->setFont(this->noBaseImageLabelFont);
|
||||||
|
this->noBaseImageLabel->hide();
|
||||||
|
this->noBaseImageLabel->setAlignment(Qt::AlignCenter);
|
||||||
|
|
||||||
this->stackView->addWidget(this->buttonWidget);
|
this->stackView->addWidget(this->buttonWidget);
|
||||||
|
|
||||||
// Progress bar
|
// Progress bar
|
||||||
|
@ -38,8 +63,10 @@ LinboStartActions::LinboStartActions(LinboBackend* backend, QWidget *parent) : Q
|
||||||
this->logFont = QFont("Segoe UI");
|
this->logFont = QFont("Segoe UI");
|
||||||
this->logLabel->setFont(this->logFont);
|
this->logLabel->setFont(this->logFont);
|
||||||
|
|
||||||
|
this->cancelButton = new QModernPushButton(":/svgIcons/cancel.svg", this->progressBarWidget);
|
||||||
|
connect(this->cancelButton, SIGNAL(clicked()), this->backend, SLOT(cancelCurrentAction()));
|
||||||
|
|
||||||
this->stackView->addWidget(this->progressBarWidget);
|
this->stackView->addWidget(this->progressBarWidget);
|
||||||
this->stackView->setCurrentWidget(nullptr);
|
|
||||||
|
|
||||||
connect(this->stackView, SIGNAL(currentChanged(int)), this, SLOT(resizeAndPositionAllItems()));
|
connect(this->stackView, SIGNAL(currentChanged(int)), this, SLOT(resizeAndPositionAllItems()));
|
||||||
this->handleLinboStateChanged(this->backend->getState());
|
this->handleLinboStateChanged(this->backend->getState());
|
||||||
|
@ -91,9 +118,9 @@ void LinboStartActions::resizeAndPositionAllItems() {
|
||||||
positionsEnabled.append(false);
|
positionsEnabled.append(false);
|
||||||
|
|
||||||
if(selectedOs != nullptr) {
|
if(selectedOs != nullptr) {
|
||||||
positionsEnabled[startOsPosition] = selectedOs->getStartbutton();
|
positionsEnabled[startOsPosition] = selectedOs->getStartActionEnabled();
|
||||||
positionsEnabled[syncOsPosition] = selectedOs->getSyncbutton();
|
positionsEnabled[syncOsPosition] = selectedOs->getSyncActionEnabled();
|
||||||
positionsEnabled[reinstallOsPosition] = selectedOs->getNewbutton();
|
positionsEnabled[reinstallOsPosition] = selectedOs->getReinstallActionEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QRect> geometries;
|
QList<QRect> geometries;
|
||||||
|
@ -149,17 +176,32 @@ void LinboStartActions::resizeAndPositionAllItems() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(selectedOs != nullptr && selectedOs->getBaseImage() == nullptr) {
|
||||||
|
int noBaseImageLabelHeight = this->height() * 0.2;
|
||||||
|
this->noBaseImageLabelFont.setPixelSize(noBaseImageLabelHeight * 0.8);
|
||||||
|
this->noBaseImageLabel->setFont(this->noBaseImageLabelFont);
|
||||||
|
this->noBaseImageLabel->setGeometry(0, (this->height() - noBaseImageLabelHeight) / 2, this->width(), noBaseImageLabelHeight);
|
||||||
|
this->noBaseImageLabel->show();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this->noBaseImageLabel->hide();
|
||||||
|
}
|
||||||
|
|
||||||
// Progress bar
|
// Progress bar
|
||||||
this->progressBarWidget->setFixedSize(this->size());
|
this->progressBarWidget->setFixedSize(this->size());
|
||||||
int progressBarHeight = this->height() * 0.1;
|
int progressBarHeight = this->height() * 0.1;
|
||||||
int progressBarWidth = this->width() * 0.5;
|
int progressBarWidth = this->width() * 0.5;
|
||||||
int logLabelHeight = progressBarHeight * 2;
|
int logLabelHeight = progressBarHeight * 2;
|
||||||
int logLabelWidth = this->width() * 0.8;
|
int logLabelWidth = this->width() * 0.8;
|
||||||
progressBar->setGeometry((this->width() - progressBarWidth) / 2, (this->height() - logLabelHeight - progressBarHeight) / 2, progressBarWidth, progressBarHeight);
|
int cancelButtonWidth = this->height() * 0.4;
|
||||||
|
|
||||||
this->logFont.setPixelSize(logLabelHeight * 0.8);
|
this->logFont.setPixelSize(logLabelHeight * 0.8);
|
||||||
this->logLabel->setFont(this->logFont);
|
this->logLabel->setFont(this->logFont);
|
||||||
this->logLabel->setGeometry((this->width() - logLabelWidth) / 2, this->height() - logLabelHeight, logLabelWidth, logLabelHeight);
|
this->logLabel->setGeometry((this->width() - logLabelWidth) / 2, 0, logLabelWidth, logLabelHeight);
|
||||||
|
|
||||||
|
progressBar->setGeometry((this->width() - progressBarWidth) / 2, this->logLabel->y() + logLabelHeight + this->height() * 0.15, progressBarWidth, progressBarHeight);
|
||||||
|
|
||||||
|
this->cancelButton->setGeometry((this->width() - cancelButtonWidth) / 2, this->progressBar->y() + progressBarHeight + this->height() * 0.05, cancelButtonWidth, cancelButtonWidth);
|
||||||
|
|
||||||
this->inited = true;
|
this->inited = true;
|
||||||
}
|
}
|
||||||
|
@ -180,7 +222,6 @@ void LinboStartActions::handleLinboStateChanged(LinboBackend::LinboState newStat
|
||||||
|
|
||||||
switch (newState) {
|
switch (newState) {
|
||||||
case LinboBackend::Autostarting:
|
case LinboBackend::Autostarting:
|
||||||
qDebug() << "Linbo state is: autostart";
|
|
||||||
this->progressBar->setIndeterminate(false);
|
this->progressBar->setIndeterminate(false);
|
||||||
this->progressBar->setReversed(true);
|
this->progressBar->setReversed(true);
|
||||||
this->progressBar->setValue(0);
|
this->progressBar->setValue(0);
|
||||||
|
@ -210,6 +251,9 @@ void LinboStartActions::handleLinboStateChanged(LinboBackend::LinboState newStat
|
||||||
|
|
||||||
|
|
||||||
void LinboStartActions::handleLatestLogChanged(const LinboLogger::LinboLog& latestLog) {
|
void LinboStartActions::handleLatestLogChanged(const LinboLogger::LinboLog& latestLog) {
|
||||||
|
if(this->backend->getState() == LinboBackend::Idle)
|
||||||
|
return;
|
||||||
|
|
||||||
QString logColor = "black";
|
QString logColor = "black";
|
||||||
switch (latestLog.type) {
|
switch (latestLog.type) {
|
||||||
case LinboLogger::StdErr:
|
case LinboLogger::StdErr:
|
||||||
|
|
|
@ -16,10 +16,11 @@
|
||||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "../headers/linbostartpage.h"
|
#include "linbostartpage.h"
|
||||||
|
|
||||||
LinboStartPage::LinboStartPage(LinboBackend* backend, QWidget *parent) : QWidget(parent)
|
LinboStartPage::LinboStartPage(LinboBackend* backend, QWidget *parent) : QWidget(parent)
|
||||||
{
|
{
|
||||||
|
this->inited = false;
|
||||||
|
|
||||||
this->backend = backend;
|
this->backend = backend;
|
||||||
connect(this->backend, SIGNAL(stateChanged(LinboBackend::LinboState)), this, SLOT(handleLinboStateChanged(LinboBackend::LinboState)));
|
connect(this->backend, SIGNAL(stateChanged(LinboBackend::LinboState)), this, SLOT(handleLinboStateChanged(LinboBackend::LinboState)));
|
||||||
|
@ -54,7 +55,7 @@ LinboStartPage::LinboStartPage(LinboBackend* backend, QWidget *parent) : QWidget
|
||||||
|
|
||||||
mainLayout->addItem(new QSpacerItem(0,0, QSizePolicy::Minimum, QSizePolicy::Expanding));
|
mainLayout->addItem(new QSpacerItem(0,0, QSizePolicy::Minimum, QSizePolicy::Expanding));
|
||||||
|
|
||||||
QLabel* versionLabel = new QLabel(backend->getConfig()->getVersion() + " - mod by Dorian Zedler");
|
QLabel* versionLabel = new QLabel(backend->getConfig()->getLinboVersion() + " - mod by Dorian Zedler");
|
||||||
versionLabel->setFont(QFont("Segoe UI"));
|
versionLabel->setFont(QFont("Segoe UI"));
|
||||||
mainLayout->addWidget(versionLabel);
|
mainLayout->addWidget(versionLabel);
|
||||||
|
|
||||||
|
@ -68,7 +69,7 @@ LinboStartPage::LinboStartPage(LinboBackend* backend, QWidget *parent) : QWidget
|
||||||
powerActionsLayoutWidget->setGeometry(QRect(this->width() - (width + margins), this->height() - (height + margins), width * 1.1, height));
|
powerActionsLayoutWidget->setGeometry(QRect(this->width() - (width + margins), this->height() - (height + margins), width * 1.1, height));
|
||||||
|
|
||||||
QModernPushButton* settingsActionButton = new QModernPushButton(":/svgIcons/settingsAction.svg");
|
QModernPushButton* settingsActionButton = new QModernPushButton(":/svgIcons/settingsAction.svg");
|
||||||
connect(settingsActionButton, SIGNAL(clicked()), legacyGui, SLOT(open()));
|
connect(settingsActionButton, SIGNAL(clicked()), legacyGui, SLOT(loginAndOpen()));
|
||||||
this->powerActionButtons.append(settingsActionButton);
|
this->powerActionButtons.append(settingsActionButton);
|
||||||
settingsActionButton->setFixedHeight(buttonWidth);
|
settingsActionButton->setFixedHeight(buttonWidth);
|
||||||
settingsActionButton->setFixedWidth(buttonWidth);
|
settingsActionButton->setFixedWidth(buttonWidth);
|
||||||
|
@ -90,23 +91,29 @@ LinboStartPage::LinboStartPage(LinboBackend* backend, QWidget *parent) : QWidget
|
||||||
powerActionsLayout->addWidget(settingsActionButton);
|
powerActionsLayout->addWidget(settingsActionButton);
|
||||||
powerActionsLayout->addWidget(rebootActionButton);
|
powerActionsLayout->addWidget(rebootActionButton);
|
||||||
powerActionsLayout->addWidget(shutdownActionButton);
|
powerActionsLayout->addWidget(shutdownActionButton);
|
||||||
|
|
||||||
|
this->handleLinboStateChanged(this->backend->getState());
|
||||||
}
|
}
|
||||||
|
|
||||||
void LinboStartPage::handleLinboStateChanged(LinboBackend::LinboState newState) {
|
void LinboStartPage::handleLinboStateChanged(LinboBackend::LinboState newState) {
|
||||||
|
bool powerActionButtonsVisible = true;
|
||||||
switch (newState) {
|
switch (newState) {
|
||||||
case LinboBackend::Idle:
|
case LinboBackend::Autostarting:
|
||||||
for(QModernPushButton* powerActionButton : this->powerActionButtons)
|
|
||||||
powerActionButton->setVisibleAnimated(true);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case LinboBackend::Starting:
|
case LinboBackend::Starting:
|
||||||
case LinboBackend::Syncing:
|
case LinboBackend::Syncing:
|
||||||
case LinboBackend::Reinstalling:
|
case LinboBackend::Reinstalling:
|
||||||
for(QModernPushButton* powerActionButton : this->powerActionButtons)
|
powerActionButtonsVisible = false;
|
||||||
powerActionButton->setVisibleAnimated(false);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(QModernPushButton* powerActionButton : this->powerActionButtons)
|
||||||
|
if(this->inited)
|
||||||
|
powerActionButton->setVisibleAnimated(powerActionButtonsVisible);
|
||||||
|
else
|
||||||
|
powerActionButton->setVisible(powerActionButtonsVisible);
|
||||||
|
|
||||||
|
this->inited = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,5 @@
|
||||||
// STL-includes
|
|
||||||
#include <iostream>
|
|
||||||
#include <qwindowsystem_qws.h>
|
|
||||||
#include <QWSServer>
|
#include <QWSServer>
|
||||||
#include <qimage.h>
|
#include <QApplication>
|
||||||
#include <qtimer.h>
|
|
||||||
// qt
|
|
||||||
#include <qapplication.h>
|
|
||||||
#include <QtGui>
|
|
||||||
#include <QPalette>
|
|
||||||
#include <QBrush>
|
|
||||||
#include <QScreen>
|
|
||||||
#include <QLocale>
|
|
||||||
|
|
||||||
#include "linbogui.h"
|
#include "linbogui.h"
|
||||||
|
|
||||||
|
@ -20,12 +9,7 @@ int main( int argc, char* argv[] )
|
||||||
|
|
||||||
QWSServer* wsServer = QWSServer::instance();
|
QWSServer* wsServer = QWSServer::instance();
|
||||||
|
|
||||||
QImage bgimg( "/icons/linbo_wallpaper.png", "PNG" );
|
|
||||||
int width = qt_screen->deviceWidth();
|
|
||||||
int height = qt_screen->deviceHeight();
|
|
||||||
|
|
||||||
if ( wsServer ) {
|
if ( wsServer ) {
|
||||||
wsServer->setBackground( QBrush( bgimg.scaled( width, height, Qt::IgnoreAspectRatio ) ) );
|
|
||||||
wsServer->refresh();
|
wsServer->refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,22 @@
|
||||||
#include "../headers/qmodernprogressbar.h"
|
/****************************************************************************
|
||||||
|
** 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/>.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "qmodernprogressbar.h"
|
||||||
|
|
||||||
QModernProgressBar::QModernProgressBar(QWidget* parent) : QProgressBar(parent)
|
QModernProgressBar::QModernProgressBar(QWidget* parent) : QProgressBar(parent)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "../headers/qmodernpushbutton.h"
|
#include "qmodernpushbutton.h"
|
||||||
|
|
||||||
QModernPushButton::QModernPushButton(QString icon, QWidget* parent) : QAbstractButton(parent)
|
QModernPushButton::QModernPushButton(QString icon, QWidget* parent) : QAbstractButton(parent)
|
||||||
{
|
{
|
||||||
|
@ -42,7 +42,7 @@ QModernPushButton::QModernPushButton(QString icon, QWidget* parent) : QAbstractB
|
||||||
this->overlays.append(overlay);
|
this->overlays.append(overlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->overlays[0]->setVisible(true);
|
this->overlays[0]->setVisibleAnimated(true);
|
||||||
this->overlays[0]->setAnimationDuration(200);
|
this->overlays[0]->setAnimationDuration(200);
|
||||||
this->overlays[1]->setAnimationDuration(200);
|
this->overlays[1]->setAnimationDuration(200);
|
||||||
this->overlays[2]->setAnimationDuration(100);
|
this->overlays[2]->setAnimationDuration(100);
|
||||||
|
@ -54,7 +54,7 @@ void QModernPushButton::handleToggled(bool checked) {
|
||||||
if(checked)
|
if(checked)
|
||||||
emit this->checked();
|
emit this->checked();
|
||||||
if(this->overlays.length() >= 4)
|
if(this->overlays.length() >= 4)
|
||||||
this->overlays[3]->setVisible(checked);
|
this->overlays[3]->setVisibleAnimated(checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QModernPushButton::resizeEvent(QResizeEvent *event) {
|
void QModernPushButton::resizeEvent(QResizeEvent *event) {
|
||||||
|
@ -76,12 +76,23 @@ void QModernPushButton::setGeometryAnimated(const QRect& geometry) {
|
||||||
this->geometryAnimation->start();
|
this->geometryAnimation->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QModernPushButton::setVisibleAnimated(bool visible, bool asynchronos) {
|
void QModernPushButton::setVisibleAnimated(bool visible) {
|
||||||
if(!this->isVisible())
|
if(!this->isVisible()) {
|
||||||
|
// if the parent was hidden
|
||||||
|
// -> Show it to be able to fade the overlays in
|
||||||
|
// -> Hide overlays to prevent them from appearing without an animation!
|
||||||
this->setVisible(true);
|
this->setVisible(true);
|
||||||
|
for(QModernPushButtonOverlay* overlay : this->overlays)
|
||||||
|
overlay->setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
this->setEnabled(visible);
|
this->setEnabled(visible);
|
||||||
this->overlays[0]->setVisible(visible);
|
|
||||||
|
if(!visible)
|
||||||
|
for(QModernPushButtonOverlay* overlay : this->overlays)
|
||||||
|
overlay->setVisibleAnimated(false);
|
||||||
|
else
|
||||||
|
this->overlays[0]->setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QModernPushButton::paintEvent(QPaintEvent *e) {
|
void QModernPushButton::paintEvent(QPaintEvent *e) {
|
||||||
|
@ -101,24 +112,24 @@ void QModernPushButton::keyReleaseEvent(QKeyEvent *e) {
|
||||||
void QModernPushButton::enterEvent(QEvent *e) {
|
void QModernPushButton::enterEvent(QEvent *e) {
|
||||||
|
|
||||||
if(this->overlays.length() >= 2 && this->isEnabled())
|
if(this->overlays.length() >= 2 && this->isEnabled())
|
||||||
this->overlays[1]->setVisible(true);
|
this->overlays[1]->setVisibleAnimated(true);
|
||||||
return QAbstractButton::enterEvent(e);
|
return QAbstractButton::enterEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QModernPushButton::leaveEvent(QEvent *e) {
|
void QModernPushButton::leaveEvent(QEvent *e) {
|
||||||
if(this->overlays.length() >= 2)
|
if(this->overlays.length() >= 2)
|
||||||
this->overlays[1]->setVisible(false);
|
this->overlays[1]->setVisibleAnimated(false);
|
||||||
return QAbstractButton::leaveEvent(e);
|
return QAbstractButton::leaveEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QModernPushButton::mousePressEvent(QMouseEvent *e) {
|
void QModernPushButton::mousePressEvent(QMouseEvent *e) {
|
||||||
if(this->overlays.length() >= 3 && this->isEnabled())
|
if(this->overlays.length() >= 3 && this->isEnabled())
|
||||||
this->overlays[2]->setVisible(true);
|
this->overlays[2]->setVisibleAnimated(true);
|
||||||
return QAbstractButton::mousePressEvent(e);
|
return QAbstractButton::mousePressEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QModernPushButton::mouseReleaseEvent(QMouseEvent *e) {
|
void QModernPushButton::mouseReleaseEvent(QMouseEvent *e) {
|
||||||
if(this->overlays.length() >= 3)
|
if(this->overlays.length() >= 3)
|
||||||
this->overlays[2]->setVisible(false);
|
this->overlays[2]->setVisibleAnimated(false);
|
||||||
return QAbstractButton::mouseReleaseEvent(e);
|
return QAbstractButton::mouseReleaseEvent(e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,22 @@
|
||||||
#include "../headers/qmodernpushbuttonoverlay.h"
|
/****************************************************************************
|
||||||
|
** 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/>.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "qmodernpushbuttonoverlay.h"
|
||||||
|
|
||||||
QModernPushButtonOverlay::QModernPushButtonOverlay(QWidget* overlayWidget, QObject *parent) : QObject(parent)
|
QModernPushButtonOverlay::QModernPushButtonOverlay(QWidget* overlayWidget, QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
|
@ -28,6 +46,14 @@ void QModernPushButtonOverlay::setVisible(bool visible) {
|
||||||
if(this->widget->isVisible() == visible)
|
if(this->widget->isVisible() == visible)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
this->effect->setOpacity(0);
|
||||||
|
this->widget->setVisible(visible);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QModernPushButtonOverlay::setVisibleAnimated(bool visible) {
|
||||||
|
if(this->widget->isVisible() == visible)
|
||||||
|
return;
|
||||||
|
|
||||||
int startValue = visible ? 0:1;
|
int startValue = visible ? 0:1;
|
||||||
this->animation->setStartValue(startValue);
|
this->animation->setStartValue(startValue);
|
||||||
this->animation->setEndValue(1-startValue);
|
this->animation->setEndValue(1-startValue);
|
||||||
|
|
|
@ -1,4 +1,22 @@
|
||||||
#include "../headers/qmodernstackedwidget.h"
|
/****************************************************************************
|
||||||
|
** 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/>.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "qmodernstackedwidget.h"
|
||||||
|
|
||||||
QModernStackedWidget::QModernStackedWidget(QWidget* parent) : QStackedWidget(parent)
|
QModernStackedWidget::QModernStackedWidget(QWidget* parent) : QStackedWidget(parent)
|
||||||
{
|
{
|
||||||
|
|
Reference in a new issue