- 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
|
||||
|
||||
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">
|
||||
<number>0</number>
|
||||
</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">
|
||||
<property name="autoFillBackground">
|
||||
<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 <QTimer>
|
||||
#include <QElapsedTimer>
|
||||
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <istream>
|
||||
#include <stdlib.h>
|
||||
#include <QFile>
|
||||
#include <QSettings>
|
||||
|
||||
#include "linbologger.h"
|
||||
#include "linboconfig.h"
|
||||
|
@ -46,7 +42,7 @@ class LinboBackend : public QObject
|
|||
Q_PROPERTY(LinboBackend::LinboState state READ getState NOTIFY stateChanged)
|
||||
Q_PROPERTY(LinboOs* currentOs READ getCurrentOs WRITE setCurrentOs NOTIFY currentOsChanged)
|
||||
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:
|
||||
explicit LinboBackend(QObject *parent = nullptr);
|
||||
|
@ -74,11 +70,14 @@ public:
|
|||
int getAutostartTimeoutRemainingSeconds();
|
||||
|
||||
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);
|
||||
LinboOs* read_os(ifstream* input);
|
||||
LinboDiskPartition* read_partition(ifstream* input);
|
||||
void read_globals( ifstream* input, LinboConfig* config );
|
||||
|
||||
private:
|
||||
LinboState state;
|
||||
|
@ -138,6 +137,8 @@ public slots:
|
|||
bool initializeCache();
|
||||
bool updateLinbo();
|
||||
|
||||
bool cancelCurrentAction();
|
||||
|
||||
private slots:
|
||||
void executeAutostart();
|
||||
void handleAutostartTimerTimeout();
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
** Modern Linbo GUI
|
||||
** 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
|
||||
** 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
|
||||
|
@ -26,20 +30,20 @@ class LinboConfig : public QObject
|
|||
public:
|
||||
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& 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& getCpu() const {return this->cpu;}
|
||||
const QString& getCpuModel() const {return this->cpuModel;}
|
||||
const QString& getRamSize() const {return this->ramSize;}
|
||||
const QString& getCacheSize() const {return this->cacheSize;}
|
||||
const QString& getHddSize() const {return this->hddSize;}
|
||||
|
||||
const QString& getCache() const {return this->cache;}
|
||||
const QString& getHostgroup() const {return this->hostgroup;}
|
||||
const QString& getCachePath() const {return this->cachePath;}
|
||||
const QString& getHostGroup() const {return this->hostGroup;}
|
||||
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 QString& getBackgroundFontcolor() {return this->backgroundFontcolor;}
|
||||
const QString& getConsoleFontcolorStdout() {return this->consoleFontcolorStdout;}
|
||||
|
@ -47,22 +51,22 @@ public:
|
|||
const QString& getDownloadType() {return this->downloadType;}
|
||||
const bool& getAutoFormat() {return this->autoFormat;}
|
||||
|
||||
protected:
|
||||
private:
|
||||
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 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 setCpu( const QString& cpu ) {this->cpu = cpu;}
|
||||
void setCpuModel( const QString& cpuModel ) {this->cpuModel = cpuModel;}
|
||||
void setRamSize( const QString& ramSize ) {this->ramSize = ramSize;}
|
||||
void setCacheSize( const QString& cacheSize ) {this->cacheSize = cacheSize;}
|
||||
void setHddSize( const QString& hddSize ) {this->hddSize = hddSize;}
|
||||
void setCache( const QString& cache ) {this->cache = cache;}
|
||||
void setHostgroup( const QString& hostgroup ) {this->hostgroup = hostgroup;}
|
||||
void setCachePath( const QString& cachePath ) {this->cachePath = cachePath;}
|
||||
void setHostGroup( const QString& hostGroup ) {this->hostGroup = hostGroup;}
|
||||
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 setBackgroundFontcolor( const QString& backgroundFontcolor ){this->backgroundFontcolor = backgroundFontcolor;}
|
||||
void setConsoleFontcolorStdout( const QString& consoleFontcolorStdout ){this->consoleFontcolorStdout = consoleFontcolorStdout;}
|
||||
|
@ -70,10 +74,25 @@ protected:
|
|||
void setDownloadType( const QString& downloadType ){this->downloadType = downloadType;}
|
||||
void setAutoFormat( const bool& autoFormat ){this->autoFormat = autoFormat;}
|
||||
|
||||
private:
|
||||
QString server, ipAddress, macAddress, version, hostname, cpu, ramSize, cacheSize, hddSize, cache, hostgroup, downloadType, backgroundFontcolor, consoleFontcolorStdout, consoleFontcolorStderr;
|
||||
QString serverIpAddress;
|
||||
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;
|
||||
bool autoPartition, autoInitCache, autoFormat;
|
||||
bool autoPartition;
|
||||
bool autoInitCache;
|
||||
bool autoFormat;
|
||||
|
||||
signals:
|
||||
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
** Modern Linbo GUI
|
||||
** 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
|
||||
** 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
|
||||
|
@ -33,7 +37,7 @@ public:
|
|||
const unsigned int& getSize() const {return this->size;}
|
||||
const bool& getBootable() const {return this->bootable;}
|
||||
|
||||
protected:
|
||||
private:
|
||||
explicit LinboDiskPartition(QObject *parent = nullptr);
|
||||
|
||||
void setPath( const QString& path ) {this->path = path;}
|
||||
|
@ -42,8 +46,9 @@ protected:
|
|||
void setSize( const unsigned int& size ) {this->size = size;}
|
||||
void setBootable( const bool& bootable ) {this->bootable = bootable;}
|
||||
|
||||
private:
|
||||
QString path, id, fstype;
|
||||
QString path;
|
||||
QString id;
|
||||
QString fstype;
|
||||
unsigned int size;
|
||||
bool bootable;
|
||||
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
** Modern Linbo GUI
|
||||
** 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
|
||||
** 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
|
||||
|
@ -37,8 +41,8 @@ protected:
|
|||
void setName(const QString& name) {this->name = name;}
|
||||
|
||||
private:
|
||||
QString name,
|
||||
description;
|
||||
QString name;
|
||||
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
|
||||
#define LINBOLOGGER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QtDebug>
|
||||
#include <QDateTime>
|
||||
#include <QFile>
|
||||
|
||||
class LinboLogger : public QObject
|
||||
{
|
||||
|
@ -33,10 +52,12 @@ public:
|
|||
|
||||
|
||||
private:
|
||||
explicit LinboLogger(QObject *parent = nullptr);
|
||||
explicit LinboLogger(QString logFilePath, QObject *parent = nullptr);
|
||||
|
||||
void log(QString logText, LinboLogType logType);
|
||||
bool writeToLogFile(QString text);
|
||||
|
||||
QString logFilePath;
|
||||
QList<LinboLog> logHistory;
|
||||
|
||||
signals:
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
** Modern Linbo GUI
|
||||
** 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
|
||||
** 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
|
||||
|
@ -48,34 +52,18 @@ public:
|
|||
const QString& getKernel() const {return this->kernel;}
|
||||
const QString& getInitrd() const {return this->initrd;}
|
||||
const QString& getKernelOptions() const {return this->kernelOptions;}
|
||||
const bool& getSyncbutton() const {return this->syncButton;}
|
||||
const bool& getStartbutton() const {return this->startButton;}
|
||||
const bool& getNewbutton() const {return this->newButton;}
|
||||
const bool& getAutostart() const {return this->autostart;}
|
||||
bool getSyncActionEnabled() const {return this->baseImage != nullptr && this->syncButtonEnabled;}
|
||||
bool getStartActionEnabled() const {return this->baseImage != nullptr && this->startButtonEnabled;}
|
||||
bool getReinstallActionEnabled() const {return this->baseImage != nullptr && this->reinstallButtonEnabled;}
|
||||
bool getAutostartEnabled() const {return this->baseImage != nullptr && this->autostartEnabled;}
|
||||
const int& getAutostartTimeout() const {return this->autostartTimeout;}
|
||||
const LinboOsStartAction& getDefaultAction() const {return this->defaultAction;}
|
||||
const bool& getHidden() const {return this->hidden;}
|
||||
|
||||
bool getActionEnabled(LinboOsStartAction action) {
|
||||
switch (action) {
|
||||
case StartOs: return this->getStartbutton();
|
||||
case SyncOs: return this->getSyncbutton();
|
||||
case ReinstallOs: return this->getNewbutton();
|
||||
case UnknownAction: return false;
|
||||
}
|
||||
}
|
||||
bool getActionEnabled(LinboOsStartAction action);
|
||||
static LinboOsStartAction startActionFromString(const QString& name);
|
||||
|
||||
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:
|
||||
private:
|
||||
explicit LinboOs(QObject *parent = nullptr);
|
||||
|
||||
void setName (const QString& name) {this->name = name;}
|
||||
|
@ -89,33 +77,36 @@ protected:
|
|||
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 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;}
|
||||
|
||||
private:
|
||||
QString name, // OS Name
|
||||
version,
|
||||
description,
|
||||
iconName, // Thumbnail for Image
|
||||
rootPartition, // Root partition
|
||||
bootPartition, // Root partition
|
||||
image,
|
||||
kernel,
|
||||
initrd,
|
||||
kernelOptions;
|
||||
int autostartTimeout;
|
||||
bool syncButton, startButton, newButton, autostart,
|
||||
hidden; // show OS tab or not
|
||||
LinboOsStartAction defaultAction;
|
||||
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* differentialImage;
|
||||
|
||||
};
|
||||
|
||||
#endif // LINBOOS_H
|
||||
|
|
|
@ -63,6 +63,7 @@ public slots:
|
|||
void shutdown();
|
||||
void reboot();
|
||||
void autostartTimeoutSlot();
|
||||
void loginAndOpen();
|
||||
|
||||
private:
|
||||
linboCounterImpl* myCounter;
|
||||
|
|
|
@ -41,6 +41,7 @@ private:
|
|||
LinboOsSelectButton(QString icon, LinboOs* os, QButtonGroup* buttonGroup, QWidget* parent = nullptr);
|
||||
|
||||
LinboOs* getOs();
|
||||
void setVisibleAnimated(bool visible);
|
||||
void setVisible(bool visible) override;
|
||||
|
||||
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
|
||||
#define LINBOOSSELECTIONROW_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <Q3ButtonGroup>
|
||||
#include <QButtonGroup>
|
||||
#include <QLabel>
|
||||
|
||||
#include "linbobackend.h"
|
||||
#include "linboosselectbutton.h"
|
||||
|
@ -24,7 +43,12 @@ private:
|
|||
LinboBackend* backend;
|
||||
QList<LinboOsSelectButton*> osButtons;
|
||||
QButtonGroup* osButtonGroup;
|
||||
QLabel* noOsLabel;
|
||||
QFont noOsLabelFont;
|
||||
QLabel* environmentValuesLabel;
|
||||
QFont environmentValuesLabelFont;
|
||||
bool showOnlySelectedButton;
|
||||
bool inited;
|
||||
|
||||
private slots:
|
||||
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
|
||||
#define LINBOSTARTACTIONS_H
|
||||
|
||||
|
@ -33,7 +51,10 @@ private:
|
|||
QModernPushButton* startOsButton;
|
||||
QModernPushButton* syncOsButton;
|
||||
QModernPushButton* reinstallOsButton;
|
||||
QModernPushButton* cancelButton;
|
||||
QList<QModernPushButton*> actionButtons;
|
||||
QLabel* noBaseImageLabel;
|
||||
QFont noBaseImageLabelFont;
|
||||
|
||||
QWidget* progressBarWidget;
|
||||
QModernProgressBar* progressBar;
|
||||
|
|
|
@ -19,6 +19,24 @@
|
|||
#ifndef 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 <QWidget>
|
||||
#include <QBoxLayout>
|
||||
|
@ -46,6 +64,8 @@ private:
|
|||
LinboStartActions* startActionsWidget;
|
||||
QList<QModernPushButton*> powerActionButtons;
|
||||
|
||||
bool inited;
|
||||
|
||||
private slots:
|
||||
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
|
||||
#define QMODERNPROGRESSBAR_H
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ class QModernPushButton : public QAbstractButton
|
|||
public:
|
||||
QModernPushButton(QString icon, QWidget* parent = nullptr);
|
||||
|
||||
void setVisibleAnimated(bool visible, bool asynchronos = true);
|
||||
void setVisibleAnimated(bool visible);
|
||||
|
||||
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
|
||||
#define QMODERNPUSHBUTTONOVERLAY_H
|
||||
|
||||
|
@ -26,6 +44,7 @@ private:
|
|||
|
||||
void setAnimationDuration(int duration);
|
||||
void setVisible(bool visible);
|
||||
void setVisibleAnimated(bool visible);
|
||||
void setEffectEnabled(bool enabled);
|
||||
|
||||
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
|
||||
#define QMODERNSTACKEDWIDGET_H
|
||||
|
||||
|
|
|
@ -64,7 +64,6 @@ SOURCES += \
|
|||
sources/legacy/linboConsoleImpl.cc \
|
||||
sources/legacy/linboCounterImpl.cc \
|
||||
sources/legacy/linboGUIImpl.cc \
|
||||
sources/legacy/linboGUIImplTmp.cpp \
|
||||
sources/legacy/linboImageSelectorImpl.cc \
|
||||
sources/legacy/linboImageUploadImpl.cc \
|
||||
sources/legacy/linboInfoBrowserImpl.cc \
|
||||
|
|
|
@ -27,5 +27,6 @@
|
|||
<file>svgIcons/rebootAction.svg</file>
|
||||
<file>svgIcons/settingsAction.svg</file>
|
||||
<file>fonts/SegoeUI.ttf</file>
|
||||
<file>svgIcons/cancel.svg</file>
|
||||
</qresource>
|
||||
</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
|
||||
** 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
|
||||
** 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
|
||||
|
@ -18,132 +22,52 @@
|
|||
|
||||
#include "linbobackend.h"
|
||||
|
||||
#define LINBO_CMD(arg) QStringList("linbo_cmd") << (arg)
|
||||
|
||||
using namespace std;
|
||||
/*
|
||||
* TODO:
|
||||
* - State StartError (ish)
|
||||
* - enter state StartError when starting / syncing / reinstalling fails
|
||||
*/
|
||||
|
||||
LinboBackend::LinboBackend(QObject *parent) : QObject(parent)
|
||||
{
|
||||
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;
|
||||
|
||||
// read start.conf
|
||||
this->logger->log("Starting to parse start.conf", LinboLogger::LinboGuiInfo);
|
||||
ifstream input;
|
||||
input.open( "start.conf", ios_base::in );
|
||||
// Init some objects
|
||||
this->logger = new LinboLogger("/tmp/linbo.log", this);
|
||||
this->config = new LinboConfig(this);
|
||||
|
||||
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() ) {
|
||||
// *** Image description section ***
|
||||
this->autostartRemainingTimeRefreshTimer = new QTimer(this);
|
||||
this->autostartRemainingTimeRefreshTimer->setSingleShot(false);
|
||||
this->autostartRemainingTimeRefreshTimer->setInterval(10);
|
||||
connect(this->autostartRemainingTimeRefreshTimer, SIGNAL(timeout()),
|
||||
this, SIGNAL(autostartTimeoutProgressChanged()));
|
||||
|
||||
// entry in start tab
|
||||
char line[500];
|
||||
input.getline(line,500,'\n');
|
||||
tmp_qstring = QString::fromAscii( line, -1 ).stripWhiteSpace();
|
||||
this->autostartElapsedTimer = new QElapsedTimer();
|
||||
|
||||
if ( tmp_qstring.startsWith("#") || tmp_qstring.isEmpty() ) continue;
|
||||
|
||||
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;
|
||||
// Processes
|
||||
this->asynchronosProcess = new QProcess(this);
|
||||
// ascynchorons commands are logged to logger
|
||||
this->asynchronosProcess = new QProcess();
|
||||
connect( asynchronosProcess, SIGNAL(readyReadStandardOutput()),
|
||||
this, SLOT(readFromStdout()) );
|
||||
connect( asynchronosProcess, SIGNAL(readyReadStandardError()),
|
||||
this, SLOT(readFromStderr()) );
|
||||
|
||||
// synchronos commands are not logged
|
||||
this->synchronosProcess = new QProcess();
|
||||
this->synchronosProcess = new QProcess(this);
|
||||
|
||||
// client ip
|
||||
this->config->setIpAddress(this->executeCommand(true, "ip"));
|
||||
// load all configuration
|
||||
this->loadStartConfiguration("start.conf");
|
||||
this->loadEnvironmentValues();
|
||||
|
||||
// mac address
|
||||
this->config->setMacAddress(this->executeCommand(true, "mac"));
|
||||
|
||||
// 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())
|
||||
// triger autostart if necessary
|
||||
if(this->currentOs != nullptr && this->currentOs->getAutostartEnabled())
|
||||
this->executeAutostart();
|
||||
else
|
||||
this->setState(Idle);
|
||||
|
@ -204,7 +128,7 @@ void LinboBackend::reboot() {
|
|||
bool LinboBackend::startCurrentOs() {
|
||||
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;
|
||||
|
||||
this->setState(Starting);
|
||||
|
@ -217,7 +141,7 @@ bool LinboBackend::startCurrentOs() {
|
|||
os->getKernel(),
|
||||
os->getInitrd(),
|
||||
os->getKernelOptions(),
|
||||
this->config->getCache()
|
||||
this->config->getCachePath()
|
||||
);
|
||||
|
||||
return true;
|
||||
|
@ -226,18 +150,26 @@ bool LinboBackend::startCurrentOs() {
|
|||
bool LinboBackend::syncCurrentOs() {
|
||||
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;
|
||||
|
||||
this->setState(Syncing);
|
||||
|
||||
qDebug() << "TEST2";
|
||||
|
||||
QString differentialImage;
|
||||
if(os->getDifferentialImage() == nullptr)
|
||||
differentialImage = "";
|
||||
else
|
||||
differentialImage = os->getDifferentialImage()->getName();
|
||||
|
||||
this->executeCommand(
|
||||
false,
|
||||
"syncstart",
|
||||
this->config->getServer(),
|
||||
this->config->getCache(),
|
||||
this->config->getServerIpAddress(),
|
||||
this->config->getCachePath(),
|
||||
os->getBaseImage()->getName(),
|
||||
os->getDifferentialImage()->getName(),
|
||||
differentialImage,
|
||||
os->getBootPartition(),
|
||||
os->getRootPartition(),
|
||||
os->getKernel(),
|
||||
|
@ -251,18 +183,24 @@ bool LinboBackend::syncCurrentOs() {
|
|||
bool LinboBackend::reinstallCurrentOs() {
|
||||
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;
|
||||
|
||||
this->setState(Reinstalling);
|
||||
|
||||
QString differentialImage;
|
||||
if(os->getDifferentialImage() == nullptr)
|
||||
differentialImage = "";
|
||||
else
|
||||
differentialImage = os->getDifferentialImage()->getName();
|
||||
|
||||
this->executeCommand(
|
||||
false,
|
||||
"syncr",
|
||||
this->config->getServer(),
|
||||
this->config->getCache(),
|
||||
this->config->getServerIpAddress(),
|
||||
this->config->getCachePath(),
|
||||
os->getBaseImage()->getName(),
|
||||
os->getDifferentialImage()->getName(),
|
||||
differentialImage,
|
||||
os->getBootPartition(),
|
||||
os->getRootPartition(),
|
||||
os->getKernel(),
|
||||
|
@ -305,7 +243,7 @@ bool LinboBackend::initializeCache() {
|
|||
|
||||
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() )
|
||||
commandArgs.append(this->config->getDownloadType());
|
||||
|
@ -329,11 +267,35 @@ bool LinboBackend::updateLinbo() {
|
|||
if(this->state != Root)
|
||||
return false;
|
||||
|
||||
this->executeCommand("update", this->config->getServer(), this->config->getCache());
|
||||
this->executeCommand("update", this->config->getServerIpAddress(), this->config->getCachePath());
|
||||
|
||||
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() {
|
||||
return this->logger;
|
||||
}
|
||||
|
@ -393,7 +355,6 @@ QString LinboBackend::executeCommand(bool waitForFinished, QString command, QStr
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void LinboBackend::readFromStdout() {
|
||||
QString stdOut = this->asynchronosProcess->readAllStandardOutput();
|
||||
QStringList lines = stdOut.split("\n");
|
||||
|
@ -420,88 +381,235 @@ void LinboBackend::setState(LinboState state) {
|
|||
|
||||
this->state = 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.
|
||||
bool LinboBackend::read_pair(ifstream* input, QString& key, QString& value) {
|
||||
char line[1024];
|
||||
if(input->peek() == '[') return false; // Next section found.
|
||||
input->getline(line,1024,'\n');
|
||||
QString s = QString::fromAscii( line, -1 ).stripWhiteSpace();
|
||||
key = s.section("=",0,0).stripWhiteSpace().lower();
|
||||
if(s.startsWith("#")||key.isEmpty()) {
|
||||
key = QString(""); value = QString("");
|
||||
} else {
|
||||
value=s.section("=",1).section("#",0,0).stripWhiteSpace();
|
||||
void LinboBackend::loadStartConfiguration(QString startConfFilePath) {
|
||||
// read start.conf
|
||||
this->logger->log("Starting to parse start.conf", LinboLogger::LinboGuiInfo);
|
||||
|
||||
QFile inputFile(startConfFilePath);
|
||||
if (inputFile.open(QIODevice::ReadOnly))
|
||||
{
|
||||
QTextStream input(&inputFile);
|
||||
QString currentSection;
|
||||
QMap<QString, QString> linboConfig;
|
||||
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) {
|
||||
if(value.startsWith("yes",false)) return true;
|
||||
if(value.startsWith("true",false)) return true;
|
||||
if(value.startsWith("enable",false)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
QStringList trueWords("yes");
|
||||
trueWords.append("true");
|
||||
trueWords.append("enable");
|
||||
return trueWords.contains(value.stripWhiteSpace());
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
** 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)
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
** 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)
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
** 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)
|
||||
{
|
||||
|
|
|
@ -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) {
|
||||
|
@ -24,11 +42,29 @@ void LinboLogger::log(QString logText, LinboLogType logType) {
|
|||
if(logText.isEmpty() || logText == "")
|
||||
return;
|
||||
qDebug() << qPrintable("[" + this->logTypeToString(logType) + "]") << logText;
|
||||
|
||||
LinboLog latestLog {logText, logType, QDateTime::currentDateTime()};
|
||||
this->logHistory.append(latestLog);
|
||||
|
||||
// TODO: Log error, when this fails
|
||||
this->writeToLogFile("[" + this->logTypeToString(logType) + "]" + logText);
|
||||
|
||||
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() {
|
||||
return this->logHistory.last();
|
||||
}
|
||||
|
|
|
@ -16,14 +16,35 @@
|
|||
** 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)
|
||||
{
|
||||
autostart = false;
|
||||
autostartTimeout = 0;
|
||||
hidden = false;
|
||||
defaultAction = SyncOs;
|
||||
this->autostartEnabled = false;
|
||||
this->autostartTimeout = 0;
|
||||
this->hidden = false;
|
||||
this->defaultAction = SyncOs;
|
||||
this->iconName = QString("defaultIcon.svg");
|
||||
this->baseImage = nullptr;
|
||||
this->differentialImage = nullptr;
|
||||
// TODO ?? image_history.clear();
|
||||
iconName = QString("defaultIcon.svg");
|
||||
}
|
||||
|
||||
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 )
|
||||
myParent = parent;
|
||||
|
||||
QRect qRect(QApplication::desktop()->screenGeometry());
|
||||
// open in the upper left of our screen
|
||||
int xpos= 10;
|
||||
int ypos= 10;
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
Copyright (C) 2007 Martin Oehler <oehler@knopper.net>
|
||||
Copyright (C) 2007 Klaus Knopper <knopper@knopper.net>
|
||||
|
||||
Modified by:
|
||||
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 General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License.
|
||||
|
@ -401,11 +404,6 @@ linboGUIImpl::linboGUIImpl(QWidget* parent) : QDialog(parent)
|
|||
|
||||
QStringList command;
|
||||
|
||||
startView->setHScrollBarMode(Q3ScrollView::AlwaysOff);
|
||||
startView->setVScrollBarMode(Q3ScrollView::Auto);
|
||||
startView->setGeometry( QRect( 10, 10, 600, 180 ) );
|
||||
startView->viewport()->setBackgroundColor( "white" );
|
||||
|
||||
imagingView->setHScrollBarMode(Q3ScrollView::AlwaysOff);
|
||||
imagingView->setVScrollBarMode(Q3ScrollView::Auto);
|
||||
imagingView->setGeometry( QRect( 10, 10, 410, 180 ) );
|
||||
|
@ -437,11 +435,15 @@ linboGUIImpl::linboGUIImpl(QWidget* parent) : QDialog(parent)
|
|||
height = 14;
|
||||
imagingHeight = 14;
|
||||
}
|
||||
|
||||
// Start View
|
||||
// Not needed anymore!
|
||||
/*
|
||||
QLabel *startlabel = new QLabel( startView->viewport() );
|
||||
startlabel->setGeometry( QRect( (90 + horizontalOffset), height, 180, 30 ) );
|
||||
startlabel->setText( elements[i].get_name() + " " + elements[i].image_history[n].get_version() );
|
||||
startView->addChild( startlabel, (90 + horizontalOffset), height );
|
||||
*/
|
||||
|
||||
// Imaging View
|
||||
QLabel *imaginglabel = new QLabel( imagingView->viewport() );
|
||||
|
@ -453,7 +455,10 @@ linboGUIImpl::linboGUIImpl(QWidget* parent) : QDialog(parent)
|
|||
height = 5;
|
||||
imagingHeight = 5;
|
||||
}
|
||||
|
||||
/*
|
||||
// Start Tab
|
||||
// Not needed anymore
|
||||
linbopushbutton *defaultbutton = new linbopushbutton( startView->viewport() );
|
||||
defaultbutton->setGeometry( QRect( (15 + horizontalOffset), height, 64, 64 ) );
|
||||
|
||||
|
@ -551,6 +556,8 @@ linboGUIImpl::linboGUIImpl(QWidget* parent) : QDialog(parent)
|
|||
startView->addChild( syncbutton, (90 + horizontalOffset), (height + innerVerticalOffset) );
|
||||
|
||||
// Start Tab
|
||||
// Not needed anymore
|
||||
|
||||
linbopushbutton *startbutton = new linbopushbutton( startView->viewport() );
|
||||
startbutton->setGeometry( QRect( (124 + horizontalOffset), (height + innerVerticalOffset), 32, 32 ) );
|
||||
// startbutton->setText( QString("Start") );
|
||||
|
@ -585,6 +592,7 @@ linboGUIImpl::linboGUIImpl(QWidget* parent) : QDialog(parent)
|
|||
p_buttons.push_back( startbutton );
|
||||
buttons_config.push_back( elements[i].image_history[n].get_startbutton() );
|
||||
startView->addChild( startbutton, (124 + horizontalOffset), (height + innerVerticalOffset) );
|
||||
*/
|
||||
|
||||
// Imaging Tab
|
||||
linbopushbutton *createbutton = new linbopushbutton( imagingView->viewport() );
|
||||
|
@ -668,6 +676,8 @@ linboGUIImpl::linboGUIImpl(QWidget* parent) : QDialog(parent)
|
|||
imagingView->addChild( createbutton, 150, imagingHeight );
|
||||
|
||||
// Start Tab
|
||||
// Not required anymore
|
||||
/*
|
||||
linbopushbutton *newbutton = new linbopushbutton( startView->viewport() );
|
||||
newbutton->setGeometry( QRect( (158 + horizontalOffset), (height + innerVerticalOffset), 32, 32 ) );
|
||||
// newbutton->setText( QString("Neu+Start") );
|
||||
|
@ -721,6 +731,7 @@ linboGUIImpl::linboGUIImpl(QWidget* parent) : QDialog(parent)
|
|||
infoBrowser->setMainApp( this );
|
||||
infoBrowser->setFilePath( QString("/tmp/") + elements[i].get_baseimage() + QString(".desc") );
|
||||
|
||||
|
||||
command = LINBO_CMD("readfile");
|
||||
saveappend( command, config.get_cache() );
|
||||
saveappend( command, ( elements[i].get_baseimage() + QString(".desc") ) );
|
||||
|
@ -741,6 +752,7 @@ linboGUIImpl::linboGUIImpl(QWidget* parent) : QDialog(parent)
|
|||
saveappend( command, ( elements[i].get_baseimage() + QString(".desc") ) );
|
||||
infoBrowser->setUploadCommand( command );
|
||||
|
||||
|
||||
infobuttonstart->setProgress( false );
|
||||
infobuttonstart->setMainApp((QDialog*)this );
|
||||
infobuttonstart->setLinboDialog( (linboDialog*)(infoBrowser) );
|
||||
|
@ -750,6 +762,7 @@ linboGUIImpl::linboGUIImpl(QWidget* parent) : QDialog(parent)
|
|||
p_buttons.push_back( infobuttonstart );
|
||||
buttons_config.push_back( 1 );
|
||||
startView->addChild( infobuttonstart, (192 + horizontalOffset), (height + innerVerticalOffset) );
|
||||
*/
|
||||
|
||||
// Imaging Tab
|
||||
linbopushbutton *uploadbutton = new linbopushbutton( imagingView->viewport() );
|
||||
|
@ -819,7 +832,7 @@ linboGUIImpl::linboGUIImpl(QWidget* parent) : QDialog(parent)
|
|||
}
|
||||
|
||||
// the height of 69 is one complete element row, 5 is our start height
|
||||
startView->resizeContents( 600, ( (int)((i+2)/2) * 69 + 5 ) );
|
||||
//startView->resizeContents( 600, ( (int)((i+2)/2) * 69 + 5 ) );
|
||||
|
||||
imagingHeight += 32;
|
||||
|
||||
|
@ -873,6 +886,8 @@ linboGUIImpl::linboGUIImpl(QWidget* parent) : QDialog(parent)
|
|||
view->addChild( imagetext, 120, height2 );
|
||||
*/
|
||||
|
||||
// Not required anymore
|
||||
/*
|
||||
linbopushbutton *idefaultbutton = new linbopushbutton( view->viewport() );
|
||||
idefaultbutton->setGeometry( QRect( (15 + iHorizontalOffset), height2, 64, 64 ) );
|
||||
|
||||
|
@ -1053,9 +1068,7 @@ linboGUIImpl::linboGUIImpl(QWidget* parent) : QDialog(parent)
|
|||
|
||||
autostart = idefaultbutton;
|
||||
autostarttimeout = elements[i].image_history[n].get_autostarttimeout();
|
||||
}
|
||||
|
||||
|
||||
}*/
|
||||
|
||||
if( n % 2 == 1 ) {
|
||||
height2 += 69;
|
||||
|
@ -1068,7 +1081,8 @@ linboGUIImpl::linboGUIImpl(QWidget* parent) : QDialog(parent)
|
|||
} else {
|
||||
// in case one of the elements is marked as "Autostart", we have to create the
|
||||
// matching, invisible sync+start button
|
||||
|
||||
// Not required anymore
|
||||
/*
|
||||
for( unsigned int n = 0; n < elements[i].image_history.size(); n++ ) {
|
||||
|
||||
if( elements[i].image_history[n].get_autostart() &&
|
||||
|
@ -1083,6 +1097,7 @@ linboGUIImpl::linboGUIImpl(QWidget* parent) : QDialog(parent)
|
|||
autostarttimeout = elements[i].image_history[n].get_autostarttimeout();
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1348,8 +1363,6 @@ linboGUIImpl::linboGUIImpl(QWidget* parent) : QDialog(parent)
|
|||
while( !process->waitForFinished(10000) ) {
|
||||
}
|
||||
|
||||
versionLabel->setText( (process->readAllStandardOutput()).stripWhiteSpace() + QString(" - (mod by Dorian Zedler) - auf Server ") + config.get_server());
|
||||
|
||||
// hostname and hostgroup
|
||||
|
||||
command = LINBO_CMD("hostname");
|
||||
|
@ -1501,6 +1514,7 @@ void linboGUIImpl::resetButtons() {
|
|||
|
||||
buttons_config_save[i] = p_buttons[i]->isEnabled();
|
||||
}
|
||||
this->close();
|
||||
}
|
||||
|
||||
void linboGUIImpl::executeAutostart() {
|
||||
|
@ -1578,6 +1592,16 @@ void linboGUIImpl::restoreButtonsState() {
|
|||
}
|
||||
}
|
||||
|
||||
void linboGUIImpl::loginAndOpen() {
|
||||
if( !isRoot() ) {
|
||||
Tabs->setCurrentPage( preTab );
|
||||
myQPasswordBox->show();
|
||||
myQPasswordBox->raise();
|
||||
myQPasswordBox->setActiveWindow();
|
||||
myQPasswordBox->setEnabled( true );
|
||||
}
|
||||
}
|
||||
|
||||
void linboGUIImpl::tabWatcher( QWidget* currentWidget) {
|
||||
|
||||
if( !isRoot() ) {
|
||||
|
@ -1604,5 +1628,6 @@ bool linboGUIImpl::isRoot() const {
|
|||
}
|
||||
|
||||
void linboGUIImpl::showImagingTab() {
|
||||
Tabs->setCurrentPage( (Tabs->count() - 1) );
|
||||
this->open(); // imaging tab is now the only tab
|
||||
//Tabs->setCurrentPage( (Tabs->count() - 1) );
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@ linboPasswordBoxImpl::linboPasswordBoxImpl( QDialog* parent ) : linboDialog()
|
|||
flags = Qt::Dialog | Qt::WindowStaysOnTopHint | Qt::WindowTitleHint;
|
||||
setWindowFlags( flags );
|
||||
|
||||
QRect qRect(QApplication::desktop()->screenGeometry());
|
||||
// open in the upper left of our screen
|
||||
int xpos=10;
|
||||
int ypos=10;
|
||||
|
@ -88,7 +87,6 @@ void linboPasswordBoxImpl::postcmd() {
|
|||
|
||||
if ( process->exitCode() == 0 ) {
|
||||
if( app ) {
|
||||
|
||||
// set password in all buttons
|
||||
QStringList tmp;
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
****************************************************************************/
|
||||
|
||||
#include "../headers/linbogui.h"
|
||||
#include "linbogui.h"
|
||||
|
||||
LinboGui::LinboGui()
|
||||
{
|
||||
|
@ -29,9 +29,8 @@ LinboGui::LinboGui()
|
|||
this->setFixedHeight(QApplication::desktop()->screenGeometry().height());
|
||||
this->setFixedWidth(QApplication::desktop()->screenGeometry().width());
|
||||
|
||||
QFontDatabase db;
|
||||
qDebug() << QFontDatabase::addApplicationFont(":/fonts/SegoeUI.ttf");
|
||||
qDebug() << db.families();
|
||||
// Load segoe font
|
||||
QFontDatabase::addApplicationFont(":/fonts/SegoeUI.ttf");
|
||||
|
||||
// white bakground
|
||||
// linuxmuster background color: #394f5e
|
||||
|
|
|
@ -35,8 +35,12 @@ LinboOs* LinboOsSelectButton::getOs() {
|
|||
return this->os;
|
||||
}
|
||||
|
||||
void LinboOsSelectButton::setVisibleAnimated(bool visible) {
|
||||
this->button->setVisibleAnimated(visible);
|
||||
}
|
||||
|
||||
void LinboOsSelectButton::setVisible(bool visible) {
|
||||
this->button->setVisibleAnimated(visible, true);
|
||||
this->button->setVisible(visible);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
this->inited = false;
|
||||
|
||||
this->backend = backend;
|
||||
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);
|
||||
}
|
||||
|
||||
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() {
|
||||
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++) {
|
||||
if(!this->osButtons[i]->button->isChecked())
|
||||
this->osButtons[i]->hide();
|
||||
|
||||
bool visible = true;
|
||||
QRect geometry = this->osButtons[i]->geometry();
|
||||
|
||||
if(!this->osButtons[i]->button->isChecked() || !this->showOnlySelectedButton) {
|
||||
visible = !this->showOnlySelectedButton;
|
||||
geometry = QRect(buttonWidth * i, 0, buttonWidth, this->height());
|
||||
}
|
||||
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(QRect((this->width() - buttonWidth) / 2, 0, buttonWidth, this->height()));
|
||||
moveAnimation->setEndValue(geometry);
|
||||
moveAnimation->start();
|
||||
}
|
||||
else {
|
||||
// Do not animate the first time
|
||||
this->osButtons[i]->setVisible(visible);
|
||||
this->osButtons[i]->setGeometry(geometry);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for(int i = 0; i < this->osButtons.length(); i++) {
|
||||
this->osButtons[i]->setGeometry(buttonWidth * i, 0, buttonWidth, this->height());
|
||||
}
|
||||
int infoLabelHeight = 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) {
|
||||
|
@ -67,6 +143,7 @@ void LinboOsSelectionRow::setShowOnlySelectedButton(bool value) {
|
|||
|
||||
this->showOnlySelectedButton = value;
|
||||
|
||||
if(this->inited)
|
||||
this->resizeAndPositionAllButtons();
|
||||
}
|
||||
|
||||
|
@ -82,6 +159,7 @@ void LinboOsSelectionRow::handleLinboStateChanged(LinboBackend::LinboState newSt
|
|||
this->setShowOnlySelectedButton(false);
|
||||
break;
|
||||
|
||||
case LinboBackend::Autostarting:
|
||||
case LinboBackend::Starting:
|
||||
case LinboBackend::Syncing:
|
||||
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)
|
||||
{
|
||||
|
@ -24,6 +42,13 @@ LinboStartActions::LinboStartActions(LinboBackend* backend, QWidget *parent) : Q
|
|||
this->reinstallOsButton = new QModernPushButton(":/svgIcons/resetAction.svg", this->buttonWidget);
|
||||
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);
|
||||
|
||||
// Progress bar
|
||||
|
@ -38,8 +63,10 @@ LinboStartActions::LinboStartActions(LinboBackend* backend, QWidget *parent) : Q
|
|||
this->logFont = QFont("Segoe UI");
|
||||
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->setCurrentWidget(nullptr);
|
||||
|
||||
connect(this->stackView, SIGNAL(currentChanged(int)), this, SLOT(resizeAndPositionAllItems()));
|
||||
this->handleLinboStateChanged(this->backend->getState());
|
||||
|
@ -91,9 +118,9 @@ void LinboStartActions::resizeAndPositionAllItems() {
|
|||
positionsEnabled.append(false);
|
||||
|
||||
if(selectedOs != nullptr) {
|
||||
positionsEnabled[startOsPosition] = selectedOs->getStartbutton();
|
||||
positionsEnabled[syncOsPosition] = selectedOs->getSyncbutton();
|
||||
positionsEnabled[reinstallOsPosition] = selectedOs->getNewbutton();
|
||||
positionsEnabled[startOsPosition] = selectedOs->getStartActionEnabled();
|
||||
positionsEnabled[syncOsPosition] = selectedOs->getSyncActionEnabled();
|
||||
positionsEnabled[reinstallOsPosition] = selectedOs->getReinstallActionEnabled();
|
||||
}
|
||||
|
||||
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
|
||||
this->progressBarWidget->setFixedSize(this->size());
|
||||
int progressBarHeight = this->height() * 0.1;
|
||||
int progressBarWidth = this->width() * 0.5;
|
||||
int logLabelHeight = progressBarHeight * 2;
|
||||
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->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;
|
||||
}
|
||||
|
@ -180,7 +222,6 @@ void LinboStartActions::handleLinboStateChanged(LinboBackend::LinboState newStat
|
|||
|
||||
switch (newState) {
|
||||
case LinboBackend::Autostarting:
|
||||
qDebug() << "Linbo state is: autostart";
|
||||
this->progressBar->setIndeterminate(false);
|
||||
this->progressBar->setReversed(true);
|
||||
this->progressBar->setValue(0);
|
||||
|
@ -210,6 +251,9 @@ void LinboStartActions::handleLinboStateChanged(LinboBackend::LinboState newStat
|
|||
|
||||
|
||||
void LinboStartActions::handleLatestLogChanged(const LinboLogger::LinboLog& latestLog) {
|
||||
if(this->backend->getState() == LinboBackend::Idle)
|
||||
return;
|
||||
|
||||
QString logColor = "black";
|
||||
switch (latestLog.type) {
|
||||
case LinboLogger::StdErr:
|
||||
|
|
|
@ -16,10 +16,11 @@
|
|||
** 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)
|
||||
{
|
||||
this->inited = false;
|
||||
|
||||
this->backend = backend;
|
||||
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));
|
||||
|
||||
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"));
|
||||
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));
|
||||
|
||||
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);
|
||||
settingsActionButton->setFixedHeight(buttonWidth);
|
||||
settingsActionButton->setFixedWidth(buttonWidth);
|
||||
|
@ -90,23 +91,29 @@ LinboStartPage::LinboStartPage(LinboBackend* backend, QWidget *parent) : QWidget
|
|||
powerActionsLayout->addWidget(settingsActionButton);
|
||||
powerActionsLayout->addWidget(rebootActionButton);
|
||||
powerActionsLayout->addWidget(shutdownActionButton);
|
||||
|
||||
this->handleLinboStateChanged(this->backend->getState());
|
||||
}
|
||||
|
||||
void LinboStartPage::handleLinboStateChanged(LinboBackend::LinboState newState) {
|
||||
bool powerActionButtonsVisible = true;
|
||||
switch (newState) {
|
||||
case LinboBackend::Idle:
|
||||
for(QModernPushButton* powerActionButton : this->powerActionButtons)
|
||||
powerActionButton->setVisibleAnimated(true);
|
||||
break;
|
||||
|
||||
case LinboBackend::Autostarting:
|
||||
case LinboBackend::Starting:
|
||||
case LinboBackend::Syncing:
|
||||
case LinboBackend::Reinstalling:
|
||||
for(QModernPushButton* powerActionButton : this->powerActionButtons)
|
||||
powerActionButton->setVisibleAnimated(false);
|
||||
powerActionButtonsVisible = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
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 <qimage.h>
|
||||
#include <qtimer.h>
|
||||
// qt
|
||||
#include <qapplication.h>
|
||||
#include <QtGui>
|
||||
#include <QPalette>
|
||||
#include <QBrush>
|
||||
#include <QScreen>
|
||||
#include <QLocale>
|
||||
#include <QApplication>
|
||||
|
||||
#include "linbogui.h"
|
||||
|
||||
|
@ -20,12 +9,7 @@ int main( int argc, char* argv[] )
|
|||
|
||||
QWSServer* wsServer = QWSServer::instance();
|
||||
|
||||
QImage bgimg( "/icons/linbo_wallpaper.png", "PNG" );
|
||||
int width = qt_screen->deviceWidth();
|
||||
int height = qt_screen->deviceHeight();
|
||||
|
||||
if ( wsServer ) {
|
||||
wsServer->setBackground( QBrush( bgimg.scaled( width, height, Qt::IgnoreAspectRatio ) ) );
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
** 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)
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ QModernPushButton::QModernPushButton(QString icon, QWidget* parent) : QAbstractB
|
|||
this->overlays.append(overlay);
|
||||
}
|
||||
|
||||
this->overlays[0]->setVisible(true);
|
||||
this->overlays[0]->setVisibleAnimated(true);
|
||||
this->overlays[0]->setAnimationDuration(200);
|
||||
this->overlays[1]->setAnimationDuration(200);
|
||||
this->overlays[2]->setAnimationDuration(100);
|
||||
|
@ -54,7 +54,7 @@ void QModernPushButton::handleToggled(bool checked) {
|
|||
if(checked)
|
||||
emit this->checked();
|
||||
if(this->overlays.length() >= 4)
|
||||
this->overlays[3]->setVisible(checked);
|
||||
this->overlays[3]->setVisibleAnimated(checked);
|
||||
}
|
||||
|
||||
void QModernPushButton::resizeEvent(QResizeEvent *event) {
|
||||
|
@ -76,12 +76,23 @@ void QModernPushButton::setGeometryAnimated(const QRect& geometry) {
|
|||
this->geometryAnimation->start();
|
||||
}
|
||||
|
||||
void QModernPushButton::setVisibleAnimated(bool visible, bool asynchronos) {
|
||||
if(!this->isVisible())
|
||||
void QModernPushButton::setVisibleAnimated(bool visible) {
|
||||
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);
|
||||
for(QModernPushButtonOverlay* overlay : this->overlays)
|
||||
overlay->setVisible(false);
|
||||
}
|
||||
|
||||
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) {
|
||||
|
@ -101,24 +112,24 @@ void QModernPushButton::keyReleaseEvent(QKeyEvent *e) {
|
|||
void QModernPushButton::enterEvent(QEvent *e) {
|
||||
|
||||
if(this->overlays.length() >= 2 && this->isEnabled())
|
||||
this->overlays[1]->setVisible(true);
|
||||
this->overlays[1]->setVisibleAnimated(true);
|
||||
return QAbstractButton::enterEvent(e);
|
||||
}
|
||||
|
||||
void QModernPushButton::leaveEvent(QEvent *e) {
|
||||
if(this->overlays.length() >= 2)
|
||||
this->overlays[1]->setVisible(false);
|
||||
this->overlays[1]->setVisibleAnimated(false);
|
||||
return QAbstractButton::leaveEvent(e);
|
||||
}
|
||||
|
||||
void QModernPushButton::mousePressEvent(QMouseEvent *e) {
|
||||
if(this->overlays.length() >= 3 && this->isEnabled())
|
||||
this->overlays[2]->setVisible(true);
|
||||
this->overlays[2]->setVisibleAnimated(true);
|
||||
return QAbstractButton::mousePressEvent(e);
|
||||
}
|
||||
|
||||
void QModernPushButton::mouseReleaseEvent(QMouseEvent *e) {
|
||||
if(this->overlays.length() >= 3)
|
||||
this->overlays[2]->setVisible(false);
|
||||
this->overlays[2]->setVisibleAnimated(false);
|
||||
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)
|
||||
{
|
||||
|
@ -28,6 +46,14 @@ void QModernPushButtonOverlay::setVisible(bool visible) {
|
|||
if(this->widget->isVisible() == visible)
|
||||
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;
|
||||
this->animation->setStartValue(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)
|
||||
{
|
||||
|
|
Reference in a new issue