diff --git a/README.md b/README.md
index 00e9a29..c54cdb6 100644
--- a/README.md
+++ b/README.md
@@ -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))
\ No newline at end of file
+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.
diff --git a/forms/linboGUI.ui b/forms/linboGUI.ui
index c3dce29..ae6eb07 100644
--- a/forms/linboGUI.ui
+++ b/forms/linboGUI.ui
@@ -40,48 +40,6 @@
0
-
-
- Start
-
-
-
-
- 10
- 10
- 600
- 180
-
-
-
- true
-
-
-
-
-
- 10
- 200
- 600
- 21
-
-
-
-
- 8
-
-
-
- Version
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
-
-
- false
-
-
-
false
diff --git a/forumsbeitrag.md b/forumsbeitrag.md
new file mode 100644
index 0000000..0f2f407
--- /dev/null
+++ b/forumsbeitrag.md
@@ -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
diff --git a/headers/backend/linbobackend.h b/headers/backend/linbobackend.h
index ffeff6a..9e8ffc2 100644
--- a/headers/backend/linbobackend.h
+++ b/headers/backend/linbobackend.h
@@ -25,12 +25,8 @@
#include
#include
#include
-
-#include
-#include
-#include
-#include
-#include
+#include
+#include
#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 config, LinboConfig* linboConfig);
+ void writeToPartitionConfig(QMap config, LinboDiskPartition* partition);
+ void writeToOsConfig(QMap 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();
diff --git a/headers/backend/linboconfig.h b/headers/backend/linboconfig.h
index 933835e..acf9223 100644
--- a/headers/backend/linboconfig.h
+++ b/headers/backend/linboconfig.h
@@ -2,6 +2,10 @@
** Modern Linbo GUI
** Copyright (C) 2020 Dorian Zedler
**
+ ** Portions of the code in this file are based on code by:
+ ** Copyright (C) 2007 Martin Oehler
+ ** Copyright (C) 2007 Klaus Knopper
+ **
** 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:
diff --git a/headers/backend/linbodiskpartition.h b/headers/backend/linbodiskpartition.h
index b2170e2..53fe779 100644
--- a/headers/backend/linbodiskpartition.h
+++ b/headers/backend/linbodiskpartition.h
@@ -2,6 +2,10 @@
** Modern Linbo GUI
** Copyright (C) 2020 Dorian Zedler
**
+ ** Portions of the code in this file are based on code by:
+ ** Copyright (C) 2007 Martin Oehler
+ ** Copyright (C) 2007 Klaus Knopper
+ **
** 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,10 +46,11 @@ protected:
void setSize( const unsigned int& size ) {this->size = size;}
void setBootable( const bool& bootable ) {this->bootable = bootable;}
-private:
- QString path, id, fstype;
- unsigned int size;
- bool bootable;
+ QString path;
+ QString id;
+ QString fstype;
+ unsigned int size;
+ bool bootable;
signals:
diff --git a/headers/backend/linboimage.h b/headers/backend/linboimage.h
index 1f7c69e..eed7c08 100644
--- a/headers/backend/linboimage.h
+++ b/headers/backend/linboimage.h
@@ -2,6 +2,10 @@
** Modern Linbo GUI
** Copyright (C) 2020 Dorian Zedler
**
+ ** Portions of the code in this file are based on code by:
+ ** Copyright (C) 2007 Martin Oehler
+ ** Copyright (C) 2007 Klaus Knopper
+ **
** 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;
};
diff --git a/headers/backend/linbologger.h b/headers/backend/linbologger.h
index 8a3c47f..48287da 100644
--- a/headers/backend/linbologger.h
+++ b/headers/backend/linbologger.h
@@ -1,9 +1,28 @@
+/****************************************************************************
+ ** Modern Linbo GUI
+ ** Copyright (C) 2020 Dorian Zedler
+ **
+ ** This program is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU Affero General Public License as published
+ ** by the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** This program is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU Affero General Public License for more details.
+ **
+ ** You should have received a copy of the GNU Affero General Public License
+ ** along with this program. If not, see .
+ ****************************************************************************/
+
#ifndef LINBOLOGGER_H
#define LINBOLOGGER_H
#include
#include
#include
+#include
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 logHistory;
signals:
diff --git a/headers/backend/linboos.h b/headers/backend/linboos.h
index 6f6b2b1..274dd71 100644
--- a/headers/backend/linboos.h
+++ b/headers/backend/linboos.h
@@ -2,6 +2,10 @@
** Modern Linbo GUI
** Copyright (C) 2020 Dorian Zedler
**
+ ** Portions of the code in this file are based on code by:
+ ** Copyright (C) 2007 Martin Oehler
+ ** Copyright (C) 2007 Klaus Knopper
+ **
** 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,74 +52,61 @@ 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;
- }
- }
-
- static LinboOsStartAction startActionFromString(const QString& name) {
- if(name == "start")
- return StartOs;
- else if(name == "sync")
- return SyncOs;
- else if(name == "new")
- return ReinstallOs;
- return UnknownAction;
- }
-
-protected:
- explicit LinboOs(QObject *parent = nullptr);
-
- void setName( const QString& name ) {this->name = name;}
- void setDescription ( const QString& description ) {this->description = description;}
- void setVersion( const QString& version ) {this->version = version;}
- void setBaseImage( LinboImage* baseImage ) {this->baseImage = baseImage;}
- void setDifferentialImage(LinboImage* differentialImage) {this->differentialImage = differentialImage;}
- void setIconName( const QString& iconName ) {this->iconName = iconName;}
- void setRootPartition( const QString& rootPartition ) {this->rootPartition = rootPartition;}
- void setBootPartition( const QString& bootPartition ) {this->bootPartition = bootPartition;}
- void setKernel( const QString& kernel ) {this->kernel = kernel;}
- void setInitrd( const QString& initrd ) {this->initrd = initrd;}
- void setKernelOptions( const QString& kernelOptions ) {this->kernelOptions = kernelOptions;}
- void setSyncButton ( const bool& syncButton ) {this->syncButton = syncButton;}
- void setStartButton( const bool& startButton) {this->startButton = startButton;}
- void setNewButton ( const bool& newButton ) {this->newButton = newButton;}
- void setAutostart ( const bool& autostart ) {this->autostart = autostart;}
- void setAutostartTimeout ( const int& autostartTimeout ) {this->autostartTimeout = autostartTimeout;}
- void setDefaultAction ( const LinboOsStartAction& defaultAction ) {this->defaultAction = defaultAction;}
- void setHidden ( const bool& hidden ) {this->hidden = hidden;}
+ bool getActionEnabled(LinboOsStartAction action);
+ static LinboOsStartAction startActionFromString(const QString& name);
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;
+ explicit LinboOs(QObject *parent = nullptr);
+ void setName (const QString& name) {this->name = name;}
+ void setDescription (const QString& description) {this->description = description;}
+ void setVersion (const QString& version) {this->version = version;}
+ void setBaseImage (LinboImage* baseImage) {this->baseImage = baseImage;}
+ void setDifferentialImage(LinboImage* differentialImage) {this->differentialImage = differentialImage;}
+ void setIconName (const QString& iconName) {this->iconName = iconName;}
+ void setRootPartition (const QString& rootPartition) {this->rootPartition = rootPartition;}
+ void setBootPartition (const QString& bootPartition) {this->bootPartition = bootPartition;}
+ void setKernel (const QString& kernel) {this->kernel = kernel;}
+ void setInitrd (const QString& initrd) {this->initrd = initrd;}
+ void setKernelOptions (const QString& kernelOptions) {this->kernelOptions = kernelOptions;}
+ void setSyncButtonEnabled (const bool& syncButtonEnabled) {this->syncButtonEnabled = syncButtonEnabled;}
+ void setStartButtonEnabled (const bool& startButtonEnabled) {this->startButtonEnabled = startButtonEnabled;}
+ void setReinstallButtonEnabled (const bool& reinstallButtonEnabled) {this->reinstallButtonEnabled = reinstallButtonEnabled;}
+ void setAutostartEnabled (const bool& autostartEnabled) {this->autostartEnabled = autostartEnabled;}
+ void setAutostartTimeout (const int& autostartTimeout) {this->autostartTimeout = autostartTimeout;}
+ void setDefaultAction (const LinboOsStartAction& defaultAction) {this->defaultAction = defaultAction;}
+ void setHidden (const bool& hidden) {this->hidden = hidden;}
+
+ QString name;
+ QString version;
+ QString description;
+ QString iconName;
+ QString rootPartition;
+ QString bootPartition;
+ QString image;
+ QString kernel;
+ QString initrd;
+ QString kernelOptions;
+
+ int autostartTimeout;
+
+ bool syncButtonEnabled;
+ bool startButtonEnabled;
+ bool reinstallButtonEnabled;
+ bool autostartEnabled;
+ bool hidden;
+
+ LinboOsStartAction defaultAction;
LinboImage* baseImage;
LinboImage* differentialImage;
-
};
#endif // LINBOOS_H
diff --git a/headers/legacy/linboGUIImpl.hh b/headers/legacy/linboGUIImpl.hh
index 8faa13e..a45e70b 100644
--- a/headers/legacy/linboGUIImpl.hh
+++ b/headers/legacy/linboGUIImpl.hh
@@ -48,56 +48,57 @@ class linboPasswordBoxImpl;
class linboGUIImpl : public QDialog, public Ui::linboGUI
{
- Q_OBJECT
+ Q_OBJECT
public slots:
- void readFromStdout();
- void readFromStderr();
- void enableButtons();
- void resetButtons();
- void disableButtons();
- void restoreButtonsState();
- void tabWatcher( QWidget* );
- void processTimeout();
- void executeAutostart();
- void shutdown();
- void reboot();
- void autostartTimeoutSlot();
+ void readFromStdout();
+ void readFromStderr();
+ void enableButtons();
+ void resetButtons();
+ void disableButtons();
+ void restoreButtonsState();
+ void tabWatcher( QWidget* );
+ void processTimeout();
+ void executeAutostart();
+ void shutdown();
+ void reboot();
+ void autostartTimeoutSlot();
+ void loginAndOpen();
private:
- linboCounterImpl* myCounter;
- QTimer* myTimer;
- QTimer* myAutostartTimer;
- linboMsgImpl *waiting;
- QString linestdout, linestderr;
- QString logfilepath, fonttemplate;
- bool root, withicons, outputvisible;
- QProcess* process;
- QDialog* myQPasswordBox;
- linboPasswordBoxImpl* myLPasswordBox;
- linbopushbutton *autostart, *autopartition, *autoinitcache;
- int preTab, autostarttimeout;
- linboLogConsole* logConsole;
-
- vector buttons_config;
- vector buttons_config_save;
+ linboCounterImpl* myCounter;
+ QTimer* myTimer;
+ QTimer* myAutostartTimer;
+ linboMsgImpl *waiting;
+ QString linestdout, linestderr;
+ QString logfilepath, fonttemplate;
+ bool root, withicons, outputvisible;
+ QProcess* process;
+ QDialog* myQPasswordBox;
+ linboPasswordBoxImpl* myLPasswordBox;
+ linbopushbutton *autostart, *autopartition, *autoinitcache;
+ int preTab, autostarttimeout;
+ linboLogConsole* logConsole;
+
+ vector buttons_config;
+ vector buttons_config_save;
public:
- vector p_buttons;
- // 0 = disabled
- // 1 = enabled
- // 2 = admin button
+ vector p_buttons;
+ // 0 = disabled
+ // 1 = enabled
+ // 2 = admin button
- globals config;
- vector elements;
- vector partitions;
+ globals config;
+ vector elements;
+ vector partitions;
- linboGUIImpl(QWidget* parent = nullptr);
+ linboGUIImpl(QWidget* parent = nullptr);
- ~linboGUIImpl();
+ ~linboGUIImpl();
- bool isRoot() const;
- void showImagingTab();
- void log( const QString& data );
+ bool isRoot() const;
+ void showImagingTab();
+ void log( const QString& data );
};
diff --git a/headers/linboosselectbutton.h b/headers/linboosselectbutton.h
index af29440..7e5dd41 100644
--- a/headers/linboosselectbutton.h
+++ b/headers/linboosselectbutton.h
@@ -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;
diff --git a/headers/linboosselectionrow.h b/headers/linboosselectionrow.h
index a42cf63..f45fe41 100644
--- a/headers/linboosselectionrow.h
+++ b/headers/linboosselectionrow.h
@@ -1,9 +1,28 @@
+/****************************************************************************
+ ** Modern Linbo GUI
+ ** Copyright (C) 2020 Dorian Zedler
+ **
+ ** This program is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU Affero General Public License as published
+ ** by the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** This program is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU Affero General Public License for more details.
+ **
+ ** You should have received a copy of the GNU Affero General Public License
+ ** along with this program. If not, see .
+ ****************************************************************************/
+
#ifndef LINBOOSSELECTIONROW_H
#define LINBOOSSELECTIONROW_H
#include
#include
-#include
+#include
+#include
#include "linbobackend.h"
#include "linboosselectbutton.h"
@@ -24,7 +43,12 @@ private:
LinboBackend* backend;
QList osButtons;
QButtonGroup* osButtonGroup;
+ QLabel* noOsLabel;
+ QFont noOsLabelFont;
+ QLabel* environmentValuesLabel;
+ QFont environmentValuesLabelFont;
bool showOnlySelectedButton;
+ bool inited;
private slots:
void resizeAndPositionAllButtons();
diff --git a/headers/linbostartactions.h b/headers/linbostartactions.h
index 2bc94a3..059c302 100644
--- a/headers/linbostartactions.h
+++ b/headers/linbostartactions.h
@@ -1,3 +1,21 @@
+/****************************************************************************
+ ** Modern Linbo GUI
+ ** Copyright (C) 2020 Dorian Zedler
+ **
+ ** This program is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU Affero General Public License as published
+ ** by the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** This program is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU Affero General Public License for more details.
+ **
+ ** You should have received a copy of the GNU Affero General Public License
+ ** along with this program. If not, see .
+ ****************************************************************************/
+
#ifndef LINBOSTARTACTIONS_H
#define LINBOSTARTACTIONS_H
@@ -33,7 +51,10 @@ private:
QModernPushButton* startOsButton;
QModernPushButton* syncOsButton;
QModernPushButton* reinstallOsButton;
+ QModernPushButton* cancelButton;
QList actionButtons;
+ QLabel* noBaseImageLabel;
+ QFont noBaseImageLabelFont;
QWidget* progressBarWidget;
QModernProgressBar* progressBar;
diff --git a/headers/linbostartpage.h b/headers/linbostartpage.h
index f6654f4..6d291a1 100644
--- a/headers/linbostartpage.h
+++ b/headers/linbostartpage.h
@@ -19,6 +19,24 @@
#ifndef LINBOGUISTARTPAGE_H
#define LINBOGUISTARTPAGE_H
+/****************************************************************************
+ ** Modern Linbo GUI
+ ** Copyright (C) 2020 Dorian Zedler
+ **
+ ** This program is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU Affero General Public License as published
+ ** by the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** This program is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU Affero General Public License for more details.
+ **
+ ** You should have received a copy of the GNU Affero General Public License
+ ** along with this program. If not, see .
+ ****************************************************************************/
+
#include
#include
#include
@@ -46,6 +64,8 @@ private:
LinboStartActions* startActionsWidget;
QList powerActionButtons;
+ bool inited;
+
private slots:
void handleLinboStateChanged(LinboBackend::LinboState newState);
diff --git a/headers/qmodernprogressbar.h b/headers/qmodernprogressbar.h
index 2061fbc..3619046 100644
--- a/headers/qmodernprogressbar.h
+++ b/headers/qmodernprogressbar.h
@@ -1,3 +1,21 @@
+/****************************************************************************
+ ** Modern Linbo GUI
+ ** Copyright (C) 2020 Dorian Zedler
+ **
+ ** This program is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU Affero General Public License as published
+ ** by the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** This program is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU Affero General Public License for more details.
+ **
+ ** You should have received a copy of the GNU Affero General Public License
+ ** along with this program. If not, see .
+ ****************************************************************************/
+
#ifndef QMODERNPROGRESSBAR_H
#define QMODERNPROGRESSBAR_H
diff --git a/headers/qmodernpushbutton.h b/headers/qmodernpushbutton.h
index 2ae054d..8cd000b 100644
--- a/headers/qmodernpushbutton.h
+++ b/headers/qmodernpushbutton.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);
diff --git a/headers/qmodernpushbuttonoverlay.h b/headers/qmodernpushbuttonoverlay.h
index 120bee3..897e20a 100644
--- a/headers/qmodernpushbuttonoverlay.h
+++ b/headers/qmodernpushbuttonoverlay.h
@@ -1,3 +1,21 @@
+/****************************************************************************
+ ** Modern Linbo GUI
+ ** Copyright (C) 2020 Dorian Zedler
+ **
+ ** This program is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU Affero General Public License as published
+ ** by the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** This program is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU Affero General Public License for more details.
+ **
+ ** You should have received a copy of the GNU Affero General Public License
+ ** along with this program. If not, see .
+ ****************************************************************************/
+
#ifndef 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:
diff --git a/headers/qmodernstackedwidget.h b/headers/qmodernstackedwidget.h
index e8c5606..1609f1e 100644
--- a/headers/qmodernstackedwidget.h
+++ b/headers/qmodernstackedwidget.h
@@ -1,3 +1,21 @@
+/****************************************************************************
+ ** Modern Linbo GUI
+ ** Copyright (C) 2020 Dorian Zedler
+ **
+ ** This program is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU Affero General Public License as published
+ ** by the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** This program is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU Affero General Public License for more details.
+ **
+ ** You should have received a copy of the GNU Affero General Public License
+ ** along with this program. If not, see .
+ ****************************************************************************/
+
#ifndef QMODERNSTACKEDWIDGET_H
#define QMODERNSTACKEDWIDGET_H
diff --git a/linboGUI.pro b/linboGUI.pro
index 1c6b028..9ca5105 100644
--- a/linboGUI.pro
+++ b/linboGUI.pro
@@ -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 \
diff --git a/resources/linbo.qrc b/resources/linbo.qrc
index 2a7d248..b2d4d16 100644
--- a/resources/linbo.qrc
+++ b/resources/linbo.qrc
@@ -27,5 +27,6 @@
svgIcons/rebootAction.svg
svgIcons/settingsAction.svg
fonts/SegoeUI.ttf
+ svgIcons/cancel.svg
diff --git a/resources/svgIcons/cancel.svg b/resources/svgIcons/cancel.svg
new file mode 100644
index 0000000..834b1d4
--- /dev/null
+++ b/resources/svgIcons/cancel.svg
@@ -0,0 +1,38 @@
+
+
diff --git a/sources/backend/linbobackend.cpp b/sources/backend/linbobackend.cpp
index 5f478dd..feaa486 100644
--- a/sources/backend/linbobackend.cpp
+++ b/sources/backend/linbobackend.cpp
@@ -2,6 +2,10 @@
** Modern Linbo GUI
** Copyright (C) 2020 Dorian Zedler
**
+ ** Portions of the code in this file are based on code by:
+ ** Copyright (C) 2007 Martin Oehler
+ ** Copyright (C) 2007 Klaus Knopper
+ **
** 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 linboConfig;
+ QList> partitionConfigs;
+ QList> 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());
+
+ partitionConfigs.last().insert(key, value);
+ }
+ else if(currentSection == "[os]") {
+ // we are parsing an os block
+ if(firstLineOfSection)
+ osConfigs.append(QMap());
+
+ 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 partitionConfig : partitionConfigs) {
+ LinboDiskPartition* tmpPartition = new LinboDiskPartition(this);
+ this->writeToPartitionConfig(partitionConfig, tmpPartition);
+ if(tmpPartition->getPath() != "")
+ this->diskPartitions.append(tmpPartition);
+ else
+ tmpPartition->deleteLater();
+ }
+
+ for(QMap 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 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 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 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());
}
diff --git a/sources/backend/linboconfig.cpp b/sources/backend/linboconfig.cpp
index e86eca6..ee6097d 100644
--- a/sources/backend/linboconfig.cpp
+++ b/sources/backend/linboconfig.cpp
@@ -16,7 +16,7 @@
** along with this program. If not, see .
****************************************************************************/
-#include "../../headers/backend/linboconfig.h"
+#include "linboconfig.h"
LinboConfig::LinboConfig(QObject *parent) : QObject(parent)
{
diff --git a/sources/backend/linbodiskpartition.cpp b/sources/backend/linbodiskpartition.cpp
index da6e292..f39dedb 100644
--- a/sources/backend/linbodiskpartition.cpp
+++ b/sources/backend/linbodiskpartition.cpp
@@ -16,7 +16,7 @@
** along with this program. If not, see .
****************************************************************************/
-#include "../../headers/backend/linbodiskpartition.h"
+#include "linbodiskpartition.h"
LinboDiskPartition::LinboDiskPartition(QObject *parent) : QObject(parent)
{
diff --git a/sources/backend/linboimage.cpp b/sources/backend/linboimage.cpp
index 2355bac..ef59dbe 100644
--- a/sources/backend/linboimage.cpp
+++ b/sources/backend/linboimage.cpp
@@ -16,7 +16,7 @@
** along with this program. If not, see .
****************************************************************************/
-#include "../../headers/backend/linboimage.h"
+#include "linboimage.h"
LinboImage::LinboImage(QString name, QObject *parent) : QObject(parent)
{
diff --git a/sources/backend/linbologger.cpp b/sources/backend/linbologger.cpp
index 4d62eee..58720e8 100644
--- a/sources/backend/linbologger.cpp
+++ b/sources/backend/linbologger.cpp
@@ -1,8 +1,26 @@
-#include "../../headers/backend/linbologger.h"
+/****************************************************************************
+ ** Modern Linbo GUI
+ ** Copyright (C) 2020 Dorian Zedler
+ **
+ ** This program is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU Affero General Public License as published
+ ** by the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** This program is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU Affero General Public License for more details.
+ **
+ ** You should have received a copy of the GNU Affero General Public License
+ ** along with this program. If not, see .
+ ****************************************************************************/
-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();
}
diff --git a/sources/backend/linboos.cpp b/sources/backend/linboos.cpp
index 1d44585..5b2f268 100644
--- a/sources/backend/linboos.cpp
+++ b/sources/backend/linboos.cpp
@@ -16,14 +16,35 @@
** along with this program. If not, see .
****************************************************************************/
-#include "../../headers/backend/linboos.h"
+#include "linboos.h"
LinboOs::LinboOs(QObject *parent) : QObject(parent)
{
-autostart = false;
-autostartTimeout = 0;
-hidden = false;
-defaultAction = SyncOs;
-// TODO ?? image_history.clear();
-iconName = QString("defaultIcon.svg");
+ 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();
+}
+
+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;
}
diff --git a/sources/legacy/linboCounterImpl.cc b/sources/legacy/linboCounterImpl.cc
index 850ae11..329822a 100644
--- a/sources/legacy/linboCounterImpl.cc
+++ b/sources/legacy/linboCounterImpl.cc
@@ -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;
diff --git a/sources/legacy/linboGUIImpl.cc b/sources/legacy/linboGUIImpl.cc
index cc5ac8f..bc79ad6 100644
--- a/sources/legacy/linboGUIImpl.cc
+++ b/sources/legacy/linboGUIImpl.cc
@@ -3,6 +3,9 @@
Copyright (C) 2007 Martin Oehler
Copyright (C) 2007 Klaus Knopper
+Modified by:
+Copyright (C) 2020 Dorian Zedler
+
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.
@@ -57,202 +60,202 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
void read_qstring( ifstream* input,
QString& tmp ) {
- char line[500];
- input->getline(line,500,'\n');
- tmp = QString::fromAscii( line, -1 ).stripWhiteSpace();
+ char line[500];
+ input->getline(line,500,'\n');
+ tmp = QString::fromAscii( line, -1 ).stripWhiteSpace();
}
void read_bool( ifstream* input,
bool& tmp) {
- char line[500];
- input->getline(line,500,'\n');
- tmp = atoi( line );
+ char line[500];
+ input->getline(line,500,'\n');
+ tmp = atoi( line );
}
// Return true unless beginning of new section '[' is found.
bool 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();
- }
- return true;
+ 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();
+ }
+ return true;
}
bool 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;
+ if(value.startsWith("yes",false)) return true;
+ if(value.startsWith("true",false)) return true;
+ if(value.startsWith("enable",false)) return true;
+ return false;
}
void read_os( ifstream* input, os_item& tmp_os, image_item& tmp_image ) {
- QString key, value;
- while(!input->eof() && read_pair(input, key, value)) {
- if(key.compare("name") == 0) tmp_os.set_name(value);
- else if(key.compare("description") == 0) tmp_image.set_description(value);
- else if(key.compare("version") == 0) tmp_image.set_version(value);
- else if(key.compare("iconname") == 0) tmp_os.set_iconname(value);
- else if(key.compare("image") == 0) tmp_image.set_image(value);
- else if(key.compare("baseimage") == 0) tmp_os.set_baseimage(value);
- else if(key.compare("boot") == 0) tmp_os.set_boot(value);
- else if(key.compare("root") == 0) tmp_os.set_root(value);
- else if(key.compare("kernel") == 0) tmp_image.set_kernel(value);
- else if(key.compare("initrd") == 0) tmp_image.set_initrd(value);
- else if(key.compare("append") == 0) tmp_image.set_append(value);
- else if(key.compare("syncenabled") == 0) tmp_image.set_syncbutton(toBool(value));
- else if(key.compare("startenabled") == 0) tmp_image.set_startbutton(toBool(value));
- else if((key.compare("remotesyncenabled") == 0) || (key.compare("newenabled") == 0)) tmp_image.set_newbutton(toBool(value));
- else if(key.compare("defaultaction") == 0) tmp_image.set_defaultaction(value);
- else if(key.compare("autostart") == 0) tmp_image.set_autostart(toBool(value));
- else if(key.compare("autostarttimeout") == 0) tmp_image.set_autostarttimeout(value.toInt());
- else if(key.compare("hidden") == 0) tmp_image.set_hidden(toBool(value));
- }
+ QString key, value;
+ while(!input->eof() && read_pair(input, key, value)) {
+ if(key.compare("name") == 0) tmp_os.set_name(value);
+ else if(key.compare("description") == 0) tmp_image.set_description(value);
+ else if(key.compare("version") == 0) tmp_image.set_version(value);
+ else if(key.compare("iconname") == 0) tmp_os.set_iconname(value);
+ else if(key.compare("image") == 0) tmp_image.set_image(value);
+ else if(key.compare("baseimage") == 0) tmp_os.set_baseimage(value);
+ else if(key.compare("boot") == 0) tmp_os.set_boot(value);
+ else if(key.compare("root") == 0) tmp_os.set_root(value);
+ else if(key.compare("kernel") == 0) tmp_image.set_kernel(value);
+ else if(key.compare("initrd") == 0) tmp_image.set_initrd(value);
+ else if(key.compare("append") == 0) tmp_image.set_append(value);
+ else if(key.compare("syncenabled") == 0) tmp_image.set_syncbutton(toBool(value));
+ else if(key.compare("startenabled") == 0) tmp_image.set_startbutton(toBool(value));
+ else if((key.compare("remotesyncenabled") == 0) || (key.compare("newenabled") == 0)) tmp_image.set_newbutton(toBool(value));
+ else if(key.compare("defaultaction") == 0) tmp_image.set_defaultaction(value);
+ else if(key.compare("autostart") == 0) tmp_image.set_autostart(toBool(value));
+ else if(key.compare("autostarttimeout") == 0) tmp_image.set_autostarttimeout(value.toInt());
+ else if(key.compare("hidden") == 0) tmp_image.set_hidden(toBool(value));
+ }
}
void read_partition( ifstream* input, diskpartition& p ) {
- QString key, value;
- while(!input->eof() && read_pair(input, key, value)) {
- if(key.compare("dev") == 0) p.set_dev(value);
- else if(key.compare("size") == 0) p.set_size(value.toInt());
- else if(key.compare("id") == 0) p.set_id(value);
- else if(key.compare("fstype") == 0) p.set_fstype(value);
- else if(key.startsWith("bootable", false)) p.set_bootable(toBool(value));
- }
+ QString key, value;
+ while(!input->eof() && read_pair(input, key, value)) {
+ if(key.compare("dev") == 0) p.set_dev(value);
+ else if(key.compare("size") == 0) p.set_size(value.toInt());
+ else if(key.compare("id") == 0) p.set_id(value);
+ else if(key.compare("fstype") == 0) p.set_fstype(value);
+ else if(key.startsWith("bootable", false)) p.set_bootable(toBool(value));
+ }
}
void read_globals( ifstream* input, globals& g ) {
- QString key, value;
- while(!input->eof() && read_pair(input, key, value)) {
- if(key.compare("server") == 0) g.set_server(value);
- else if(key.compare("cache") == 0) g.set_cache(value);
- else if(key.compare("roottimeout") == 0) g.set_roottimeout((unsigned int)value.toInt());
- else if(key.compare("group") == 0) g.set_hostgroup(value);
- else if(key.compare("autopartition") == 0) g.set_autopartition(toBool(value));
- else if(key.compare("autoinitcache") == 0) g.set_autoinitcache(toBool(value));
- else if(key.compare("backgroundfontcolor") == 0) g.set_backgroundfontcolor(value);
- else if(key.compare("consolefontcolorstdout") == 0) g.set_consolefontcolorstdout(value);
- else if(key.compare("consolefontcolorstderr") == 0) g.set_consolefontcolorstderr(value);
- else if(key.compare("usemulticast") == 0) {
- if( (unsigned int)value.toInt() == 0 )
- g.set_downloadtype("rsync");
- else
- g.set_downloadtype("multicast");
+ QString key, value;
+ while(!input->eof() && read_pair(input, key, value)) {
+ if(key.compare("server") == 0) g.set_server(value);
+ else if(key.compare("cache") == 0) g.set_cache(value);
+ else if(key.compare("roottimeout") == 0) g.set_roottimeout((unsigned int)value.toInt());
+ else if(key.compare("group") == 0) g.set_hostgroup(value);
+ else if(key.compare("autopartition") == 0) g.set_autopartition(toBool(value));
+ else if(key.compare("autoinitcache") == 0) g.set_autoinitcache(toBool(value));
+ else if(key.compare("backgroundfontcolor") == 0) g.set_backgroundfontcolor(value);
+ else if(key.compare("consolefontcolorstdout") == 0) g.set_consolefontcolorstdout(value);
+ else if(key.compare("consolefontcolorstderr") == 0) g.set_consolefontcolorstderr(value);
+ else if(key.compare("usemulticast") == 0) {
+ if( (unsigned int)value.toInt() == 0 )
+ g.set_downloadtype("rsync");
+ else
+ g.set_downloadtype("multicast");
+ }
+ else if(key.compare("downloadtype") == 0) g.set_downloadtype(value);
+ else if(key.compare("autoformat") == 0) g.set_autoformat(toBool(value));
}
- else if(key.compare("downloadtype") == 0) g.set_downloadtype(value);
- else if(key.compare("autoformat") == 0) g.set_autoformat(toBool(value));
- }
}
// this appends a quoted space in case item is empty and resolves
// problems with linbo_cmd's weird "shift"-usage
void saveappend( QStringList& command,
- const QString& item ) {
- if ( item.isEmpty() )
- command.append("");
- else
- command.append( item );
+ const QString& item ) {
+ if ( item.isEmpty() )
+ command.append("");
+ else
+ command.append( item );
}
// Sync+start image
QStringList mksyncstartcommand(globals& config, os_item& os, image_item& im) {
- QStringList command = LINBO_CMD("syncstart");
- saveappend( command, config.get_server() );
- saveappend( command, config.get_cache() );
- saveappend( command, os.get_baseimage() );
- saveappend( command, im.get_image() );
- saveappend( command, os.get_boot() );
- saveappend( command, os.get_root() );
- saveappend( command, im.get_kernel() );
- saveappend( command, im.get_initrd() );
- saveappend( command, im.get_append() );
- return command;
+ QStringList command = LINBO_CMD("syncstart");
+ saveappend( command, config.get_server() );
+ saveappend( command, config.get_cache() );
+ saveappend( command, os.get_baseimage() );
+ saveappend( command, im.get_image() );
+ saveappend( command, os.get_boot() );
+ saveappend( command, os.get_root() );
+ saveappend( command, im.get_kernel() );
+ saveappend( command, im.get_initrd() );
+ saveappend( command, im.get_append() );
+ return command;
}
// Sync image from cache
QStringList mksynccommand(globals& config, os_item& os, image_item& im) {
- QStringList command = LINBO_CMD("sync");
- saveappend( command, config.get_cache() );
- saveappend( command, os.get_baseimage() );
- saveappend( command, im.get_image() );
- saveappend( command, os.get_boot() );
- saveappend( command, os.get_root() );
- saveappend( command, im.get_kernel() );
- saveappend( command, im.get_initrd() );
- saveappend( command, im.get_append() );
- return command;
+ QStringList command = LINBO_CMD("sync");
+ saveappend( command, config.get_cache() );
+ saveappend( command, os.get_baseimage() );
+ saveappend( command, im.get_image() );
+ saveappend( command, os.get_boot() );
+ saveappend( command, os.get_root() );
+ saveappend( command, im.get_kernel() );
+ saveappend( command, im.get_initrd() );
+ saveappend( command, im.get_append() );
+ return command;
}
// Sync image from server
QStringList mksyncrcommand(globals& config, os_item& os, image_item& im) {
- QStringList command = LINBO_CMD("syncr");
- saveappend( command, config.get_server() );
- saveappend( command, config.get_cache() );
- saveappend( command, os.get_baseimage() );
- saveappend( command, im.get_image() );
- saveappend( command, os.get_boot() );
- saveappend( command, os.get_root() );
- saveappend( command, im.get_kernel() );
- saveappend( command, im.get_initrd() );
- saveappend( command, im.get_append() );
- saveappend( command, QString("force") );
- return command;
+ QStringList command = LINBO_CMD("syncr");
+ saveappend( command, config.get_server() );
+ saveappend( command, config.get_cache() );
+ saveappend( command, os.get_baseimage() );
+ saveappend( command, im.get_image() );
+ saveappend( command, os.get_boot() );
+ saveappend( command, os.get_root() );
+ saveappend( command, im.get_kernel() );
+ saveappend( command, im.get_initrd() );
+ saveappend( command, im.get_append() );
+ saveappend( command, QString("force") );
+ return command;
}
QStringList mkpartitioncommand(vector &p) {
- QStringList command = LINBO_CMD("partition");
- for(unsigned int i=0; i &p) {
- QStringList command = LINBO_CMD("partition_noformat");
- for(unsigned int i=0; i &os, const QString& type) {
- QStringList command = LINBO_CMD("initcache");
- saveappend( command, config.get_server() );
- saveappend( command, config.get_cache() );
- if( ! type.isEmpty() )
- command.append(type);
- else
- command.append("rsync");
+ QStringList command = LINBO_CMD("initcache");
+ saveappend( command, config.get_server() );
+ saveappend( command, config.get_cache() );
+ if( ! type.isEmpty() )
+ command.append(type);
+ else
+ command.append("rsync");
- for(unsigned int i = 0; i < os.size(); i++) {
- saveappend( command, os[i].get_baseimage() );
- for(unsigned int j = 0; j < os[i].image_history.size(); j++) {
- saveappend( command, os[i].image_history[j].get_image() );
+ for(unsigned int i = 0; i < os.size(); i++) {
+ saveappend( command, os[i].get_baseimage() );
+ for(unsigned int j = 0; j < os[i].image_history.size(); j++) {
+ saveappend( command, os[i].image_history[j].get_image() );
+ }
}
- }
- return command;
+ return command;
}
QStringList mklinboupdatecommand(globals& config) {
- QStringList command = LINBO_CMD("update");
- saveappend( command, config.get_server() );
- saveappend( command, config.get_cache() );
- return command;
+ QStringList command = LINBO_CMD("update");
+ saveappend( command, config.get_server() );
+ saveappend( command, config.get_cache() );
+ return command;
}
@@ -261,199 +264,201 @@ linboGUIImpl::linboGUIImpl(QWidget* parent) : QDialog(parent)
{
- Ui_linboGUI::setupUi((QDialog*)this);
+ Ui_linboGUI::setupUi((QDialog*)this);
- QImage tmpImage;
+ QImage tmpImage;
- // our early default
- fonttemplate = tr("%1");
+ // our early default
+ fonttemplate = tr("%1");
- logConsole = new linboLogConsole(0);
+ logConsole = new linboLogConsole(0);
- Qt::WindowFlags flags;
- flags = Qt::Dialog | Qt::WindowStaysOnTopHint | Qt::WindowTitleHint;
- setWindowFlags( flags );
+ Qt::WindowFlags flags;
+ flags = Qt::Dialog | Qt::WindowStaysOnTopHint | Qt::WindowTitleHint;
+ setWindowFlags( flags );
- QRect qRect(QApplication::desktop()->screenGeometry());
- // open in the center of our screen
- int xpos=qRect.width()/2-this->width()/2;
- int ypos=qRect.height()/2-this->height()/2;
- this->move(xpos,ypos);
- this->setFixedSize( this->width(), this->height() );
+ QRect qRect(QApplication::desktop()->screenGeometry());
+ // open in the center of our screen
+ int xpos=qRect.width()/2-this->width()/2;
+ int ypos=qRect.height()/2-this->height()/2;
+ this->move(xpos,ypos);
+ this->setFixedSize( this->width(), this->height() );
- // reset root - we're an user now
- root = false;
+ // reset root - we're an user now
+ root = false;
- // we want to see icons
- withicons = true;
+ // we want to see icons
+ withicons = true;
- // show command output on LINBO console
- outputvisible = true;
+ // show command output on LINBO console
+ outputvisible = true;
- // default setting -> no image selected for autostart
- autostart = 0;
- autostarttimeout = 0;
+ // default setting -> no image selected for autostart
+ autostart = 0;
+ autostarttimeout = 0;
- // first "last visited" tab is start tab
- preTab = 0;
+ // first "last visited" tab is start tab
+ preTab = 0;
- // logfilepath
- logfilepath = QString("/tmp/linbo.log");
+ // logfilepath
+ logfilepath = QString("/tmp/linbo.log");
- // connect our shutdown and reboot buttons
- connect( shutdownButton, SIGNAL(clicked()), this, SLOT(shutdown()) );
- connect( rebootButton, SIGNAL(clicked()), this, SLOT(reboot()) );
+ // connect our shutdown and reboot buttons
+ connect( shutdownButton, SIGNAL(clicked()), this, SLOT(shutdown()) );
+ connect( rebootButton, SIGNAL(clicked()), this, SLOT(reboot()) );
- // set and scale up our icons
- rebootButton->setIconSet( QIcon(":/icons/system-reboot-32x32.png" ) );
- rebootButton->setIconSize(QSize(32,32));
- QToolTip::add( rebootButton, QString("Startet den Rechner neu.") );
+ // set and scale up our icons
+ rebootButton->setIconSet( QIcon(":/icons/system-reboot-32x32.png" ) );
+ rebootButton->setIconSize(QSize(32,32));
+ QToolTip::add( rebootButton, QString("Startet den Rechner neu.") );
- shutdownButton->setIconSet( QIcon(":/icons/system-shutdown-32x32.png" ) );
- shutdownButton->setIconSize(QSize(32,32));
- QToolTip::add( shutdownButton, QString("Schaltet den Rechner aus.") );
+ shutdownButton->setIconSet( QIcon(":/icons/system-shutdown-32x32.png" ) );
+ shutdownButton->setIconSize(QSize(32,32));
+ QToolTip::add( shutdownButton, QString("Schaltet den Rechner aus.") );
- hdlogowidget->setPixmap( QPixmap(":/icons/drive-harddisk-64x64.png" ) );
- // hdlogowidget->setIconSize(QSize(64,64));
+ hdlogowidget->setPixmap( QPixmap(":/icons/drive-harddisk-64x64.png" ) );
+ // hdlogowidget->setIconSize(QSize(64,64));
- pclogowidget->setPixmap( QPixmap(":/icons/computer-64x64.png" ) );
- // pclogowidget->setIconSize(QSize(64,64));
+ pclogowidget->setPixmap( QPixmap(":/icons/computer-64x64.png" ) );
+ // pclogowidget->setIconSize(QSize(64,64));
- // clear buttons array
- p_buttons.clear();
- buttons_config.clear();
- // hide the main GUI
- this->hide();
+ // clear buttons array
+ p_buttons.clear();
+ buttons_config.clear();
+ // hide the main GUI
+ this->hide();
- waiting = new linboMsgImpl( this );
- waiting->message->setText( QString("LINBO
Netzwerk Check") );
+ waiting = new linboMsgImpl( this );
+ waiting->message->setText( QString("LINBO
Netzwerk Check") );
- QStringList waitCommand = LINBO_CMD("ready");
+ QStringList waitCommand = LINBO_CMD("ready");
- waiting->setCommand( waitCommand );
- waiting->move(qRect.width()/2-waiting->width()/2,
- qRect.height()/2-waiting->height()/2 );
+ waiting->setCommand( waitCommand );
+ waiting->move(qRect.width()/2-waiting->width()/2,
+ qRect.height()/2-waiting->height()/2 );
- waiting->show();
- waiting->raise();
- waiting->setActiveWindow();
- waiting->update();
- waiting->execute();
+ waiting->show();
+ waiting->raise();
+ waiting->setActiveWindow();
+ waiting->update();
+ waiting->execute();
- QWSServer* wsServer = QWSServer::instance();
- QImage bgimg( "/icons/linbo_wallpaper.png", "PNG" );
+ QWSServer* wsServer = QWSServer::instance();
+ QImage bgimg( "/icons/linbo_wallpaper.png", "PNG" );
- if ( wsServer ) {
- wsServer->setBackground( QBrush( bgimg.scaled( qRect.width(), qRect.height(), Qt::IgnoreAspectRatio ) ) );
- wsServer->refresh();
- }
+ if ( wsServer ) {
+ wsServer->setBackground( QBrush( bgimg.scaled( qRect.width(), qRect.height(), Qt::IgnoreAspectRatio ) ) );
+ wsServer->refresh();
+ }
- ifstream input;
- input.open( "start.conf", ios_base::in );
+ ifstream input;
+ input.open( "start.conf", ios_base::in );
- QString tmp_qstring;
+ QString tmp_qstring;
- while( !input.eof() ) {
- // *** Image description section ***
+ while( !input.eof() ) {
+ // *** Image description section ***
- // entry in start tab
- read_qstring(&input, tmp_qstring);
- if ( tmp_qstring.startsWith("#") || tmp_qstring.isEmpty() ) continue;
+ // entry in start tab
+ read_qstring(&input, tmp_qstring);
+ 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) {
- os_item tmp_os;
- image_item tmp_image;
- read_os(&input, tmp_os, tmp_image);
- if(!tmp_os.get_name().isEmpty()) {
- // check if this is an additional/incremental image for an existing OS
- 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;
- }
+ tmp_qstring = tmp_qstring.section("#",0,0).stripWhiteSpace(); // Strip comment
+ if(tmp_qstring.lower().compare("[os]") == 0) {
+ os_item tmp_os;
+ image_item tmp_image;
+ read_os(&input, tmp_os, tmp_image);
+ if(!tmp_os.get_name().isEmpty()) {
+ // check if this is an additional/incremental image for an existing OS
+ 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 if(tmp_qstring.lower().compare("[linbo]") == 0) {
+ read_globals(&input, config);
+ } else if(tmp_qstring.lower().compare("[partition]") == 0) {
+ diskpartition tmp_partition;
+ read_partition(&input, tmp_partition);
+ if(!tmp_partition.get_dev().isEmpty()) {
+ partitions.push_back(tmp_partition);
+ }
}
- if(i==elements.size()) { // Not included yet -> new image
- tmp_os.image_history.push_back(tmp_image);
- elements.push_back(tmp_os);
+ }
+ input.close();
+
+ // we can set this now since our globals have been read
+ logConsole->setLinboLogConsole( config.get_consolefontcolorstdout(),
+ config.get_consolefontcolorstderr(),
+ Console );
+
+ int height = 5;
+ int imagingHeight = 5;
+
+ QStringList command;
+
+ imagingView->setHScrollBarMode(Q3ScrollView::AlwaysOff);
+ imagingView->setVScrollBarMode(Q3ScrollView::Auto);
+ imagingView->setGeometry( QRect( 10, 10, 410, 180 ) );
+ imagingView->viewport()->setBackgroundColor( "white" );
+
+ partitionView->setHScrollBarMode(Q3ScrollView::AlwaysOff);
+ partitionView->setVScrollBarMode(Q3ScrollView::Auto);
+ partitionView->setGeometry( QRect( 420, 10, 180, 180 ) );
+ partitionView->viewport()->setBackgroundColor( "white" );
+
+
+ // since some tabs can be hidden, we have to maintain this counter
+ int nextPosForTabInsert = 0;
+ int horizontalOffset = 0;
+ // this is for separating the elements
+ int innerVerticalOffset = 32;
+
+ for( unsigned int i = 0; i < elements.size(); i++ ) {
+ // this determines our vertical offset
+ if( i % 2 == 1 ) {
+ // an odd element is moved to the right
+ horizontalOffset = 300;
+ } else {
+ horizontalOffset = 0;
}
- }
- } else if(tmp_qstring.lower().compare("[linbo]") == 0) {
- read_globals(&input, config);
- } else if(tmp_qstring.lower().compare("[partition]") == 0) {
- diskpartition tmp_partition;
- read_partition(&input, tmp_partition);
- if(!tmp_partition.get_dev().isEmpty()) {
- partitions.push_back(tmp_partition);
- }
- }
- }
- input.close();
- // we can set this now since our globals have been read
- logConsole->setLinboLogConsole( config.get_consolefontcolorstdout(),
- config.get_consolefontcolorstderr(),
- Console );
+ int n = elements[i].find_current_image();
+ if ( i == 0 ) {
+ height = 14;
+ imagingHeight = 14;
+ }
- int height = 5;
- int imagingHeight = 5;
-
- 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 ) );
- imagingView->viewport()->setBackgroundColor( "white" );
-
- partitionView->setHScrollBarMode(Q3ScrollView::AlwaysOff);
- partitionView->setVScrollBarMode(Q3ScrollView::Auto);
- partitionView->setGeometry( QRect( 420, 10, 180, 180 ) );
- partitionView->viewport()->setBackgroundColor( "white" );
-
-
- // since some tabs can be hidden, we have to maintain this counter
- int nextPosForTabInsert = 0;
- int horizontalOffset = 0;
- // this is for separating the elements
- int innerVerticalOffset = 32;
-
- for( unsigned int i = 0; i < elements.size(); i++ ) {
- // this determines our vertical offset
- if( i % 2 == 1 ) {
- // an odd element is moved to the right
- horizontalOffset = 300;
- } else {
- horizontalOffset = 0;
- }
-
- int n = elements[i].find_current_image();
- if ( i == 0 ) {
- height = 14;
- imagingHeight = 14;
- }
- // Start View
+ // 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() );
- imaginglabel->setGeometry( QRect( 15, imagingHeight, 165, 30 ) );
- imaginglabel->setText( elements[i].get_name() );
- imagingView->addChild( imaginglabel, 15, imagingHeight );
+ // Imaging View
+ QLabel *imaginglabel = new QLabel( imagingView->viewport() );
+ imaginglabel->setGeometry( QRect( 15, imagingHeight, 165, 30 ) );
+ imaginglabel->setText( elements[i].get_name() );
+ imagingView->addChild( imaginglabel, 15, imagingHeight );
- if( i == 0 ) {
- height = 5;
- imagingHeight = 5;
- }
+ if( i == 0 ) {
+ 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,89 +592,92 @@ 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() );
- createbutton->setGeometry( QRect( 150, imagingHeight, 120, 30 ) );
- createbutton->setText( QString("Image erstellen") );
- createbutton->setTextBrowser( config.get_consolefontcolorstdout(),
- config.get_consolefontcolorstderr(),
- Console );
+ // Imaging Tab
+ linbopushbutton *createbutton = new linbopushbutton( imagingView->viewport() );
+ createbutton->setGeometry( QRect( 150, imagingHeight, 120, 30 ) );
+ createbutton->setText( QString("Image erstellen") );
+ createbutton->setTextBrowser( config.get_consolefontcolorstdout(),
+ config.get_consolefontcolorstderr(),
+ Console );
- linboImageSelectorImpl *buildImageSelector = new linboImageSelectorImpl( createbutton );
- // clear list
- buildImageSelector->listBox->clear();
+ linboImageSelectorImpl *buildImageSelector = new linboImageSelectorImpl( createbutton );
+ // clear list
+ buildImageSelector->listBox->clear();
- // incremental image - when assigned
- if( !(elements[i].image_history[n].get_image().stripWhiteSpace()).isEmpty() )
- buildImageSelector->listBox->insertItem(elements[i].image_history[n].get_image());
+ // incremental image - when assigned
+ if( !(elements[i].image_history[n].get_image().stripWhiteSpace()).isEmpty() )
+ buildImageSelector->listBox->insertItem(elements[i].image_history[n].get_image());
- // fill list with images
- // base image
- buildImageSelector->listBox->insertItem(elements[i].get_baseimage());
+ // fill list with images
+ // base image
+ buildImageSelector->listBox->insertItem(elements[i].get_baseimage());
- // entry for creating a new image
- buildImageSelector->listBox->insertItem( QString("[Neuer Dateiname]") );
+ // entry for creating a new image
+ buildImageSelector->listBox->insertItem( QString("[Neuer Dateiname]") );
- buildImageSelector->setTextBrowser( config.get_consolefontcolorstdout(),
- config.get_consolefontcolorstderr(),
- Console );
- buildImageSelector->setCache( config.get_cache() );
- buildImageSelector->setBaseImage( elements[i].get_baseimage() );
- buildImageSelector->setMainApp( this );
+ buildImageSelector->setTextBrowser( config.get_consolefontcolorstdout(),
+ config.get_consolefontcolorstderr(),
+ Console );
+ buildImageSelector->setCache( config.get_cache() );
+ buildImageSelector->setBaseImage( elements[i].get_baseimage() );
+ buildImageSelector->setMainApp( this );
- command = LINBO_CMD("readfile");
- saveappend( command, config.get_cache() );
- saveappend( command, elements[i].get_baseimage() + QString(".desc") );
- saveappend( command, ( QString("/tmp/") + elements[i].get_baseimage() + QString(".desc") ) );
- buildImageSelector->setLoadCommand( command );
+ command = LINBO_CMD("readfile");
+ saveappend( command, config.get_cache() );
+ saveappend( command, elements[i].get_baseimage() + QString(".desc") );
+ saveappend( command, ( QString("/tmp/") + elements[i].get_baseimage() + QString(".desc") ) );
+ buildImageSelector->setLoadCommand( command );
- command = LINBO_CMD("writefile");
- saveappend( command, config.get_cache() );
- saveappend( command, ( elements[i].get_baseimage() + QString(".desc") ) );
- saveappend( command, ( QString("/tmp/") + elements[i].get_baseimage() + QString(".desc") ) );
- buildImageSelector->setSaveCommand( command );
+ command = LINBO_CMD("writefile");
+ saveappend( command, config.get_cache() );
+ saveappend( command, ( elements[i].get_baseimage() + QString(".desc") ) );
+ saveappend( command, ( QString("/tmp/") + elements[i].get_baseimage() + QString(".desc") ) );
+ buildImageSelector->setSaveCommand( command );
- createbutton->setLinboDialog( (linboDialog*)(buildImageSelector) );
- createbutton->setQDialog( (QDialog*)(buildImageSelector) );
- createbutton->setProgress( false );
- createbutton->setEnabled( true );
- createbutton->setMainApp((QDialog*)this );
+ createbutton->setLinboDialog( (linboDialog*)(buildImageSelector) );
+ createbutton->setQDialog( (QDialog*)(buildImageSelector) );
+ createbutton->setProgress( false );
+ createbutton->setEnabled( true );
+ createbutton->setMainApp((QDialog*)this );
- // add tooltip and icon
- QToolTip::add( createbutton, QString("Ein neues Image f?r " + elements[i].get_name() + " " +
- elements[i].image_history[n].get_version() +
- " erstellen") );
+ // add tooltip and icon
+ QToolTip::add( createbutton, QString("Ein neues Image f?r " + elements[i].get_name() + " " +
+ elements[i].image_history[n].get_version() +
+ " erstellen") );
- if( withicons ) {
- createbutton->setIconSet( QIcon( ":/icons/image-22x22.png" ) );
- createbutton->setIconSize( QSize(32,32) );
- }
+ if( withicons ) {
+ createbutton->setIconSet( QIcon( ":/icons/image-22x22.png" ) );
+ createbutton->setIconSize( QSize(32,32) );
+ }
- // build "create" command
- command = LINBO_CMD("create");
- saveappend( command, config.get_cache() );
+ // build "create" command
+ command = LINBO_CMD("create");
+ saveappend( command, config.get_cache() );
- saveappend( command, (elements[i].image_history[n].get_image()) );
- saveappend( command, (elements[i].get_baseimage()) );
- saveappend( command, (elements[i].get_boot()) );
- saveappend( command, (elements[i].get_root()) );
- saveappend( command, (elements[i].image_history[n].get_kernel()) );
- saveappend( command, (elements[i].image_history[n].get_initrd()) );
- buildImageSelector->setCommand( command );
+ saveappend( command, (elements[i].image_history[n].get_image()) );
+ saveappend( command, (elements[i].get_baseimage()) );
+ saveappend( command, (elements[i].get_boot()) );
+ saveappend( command, (elements[i].get_root()) );
+ saveappend( command, (elements[i].image_history[n].get_kernel()) );
+ saveappend( command, (elements[i].image_history[n].get_initrd()) );
+ buildImageSelector->setCommand( command );
- // this is done really late now to prevent segfaulting our main app (because
- // commands are not set earlier)
- buildImageSelector->listBox->setSelected(0,true);
+ // this is done really late now to prevent segfaulting our main app (because
+ // commands are not set earlier)
+ buildImageSelector->listBox->setSelected(0,true);
- // assign button to button list
- p_buttons.push_back( createbutton );
- buttons_config.push_back( 1 );
- imagingView->addChild( createbutton, 150, imagingHeight );
+ // assign button to button list
+ p_buttons.push_back( createbutton );
+ buttons_config.push_back( 1 );
+ imagingView->addChild( createbutton, 150, imagingHeight );
- // Start Tab
+ // 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,129 +762,132 @@ 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() );
- uploadbutton->setGeometry( QRect( 270, imagingHeight, 120, 30 ) );
- uploadbutton->setText( QString("Image hochladen") );
- uploadbutton->setEnabled( true );
- uploadbutton->setTextBrowser( config.get_consolefontcolorstdout(),
- config.get_consolefontcolorstderr(),
- Console );
+ // Imaging Tab
+ linbopushbutton *uploadbutton = new linbopushbutton( imagingView->viewport() );
+ uploadbutton->setGeometry( QRect( 270, imagingHeight, 120, 30 ) );
+ uploadbutton->setText( QString("Image hochladen") );
+ uploadbutton->setEnabled( true );
+ uploadbutton->setTextBrowser( config.get_consolefontcolorstdout(),
+ config.get_consolefontcolorstderr(),
+ Console );
- // add tooltip and icon
- QToolTip::add( uploadbutton, QString("Ein Image f?r " + elements[i].get_name() + " " +
- elements[i].image_history[n].get_version() +
- " auf den Server hochladen" ) );
+ // add tooltip and icon
+ QToolTip::add( uploadbutton, QString("Ein Image f?r " + elements[i].get_name() + " " +
+ elements[i].image_history[n].get_version() +
+ " auf den Server hochladen" ) );
- if( withicons )
- uploadbutton->setIconSet( QIcon( ":/icons/upload-22x22.png" ) );
+ if( withicons )
+ uploadbutton->setIconSet( QIcon( ":/icons/upload-22x22.png" ) );
- linboImageUploadImpl *imageUpload = new linboImageUploadImpl( uploadbutton);
- imageUpload->setTextBrowser( config.get_consolefontcolorstdout(),
- config.get_consolefontcolorstderr(),
- Console );
- imageUpload->setMainApp( this );
+ linboImageUploadImpl *imageUpload = new linboImageUploadImpl( uploadbutton);
+ imageUpload->setTextBrowser( config.get_consolefontcolorstdout(),
+ config.get_consolefontcolorstderr(),
+ Console );
+ imageUpload->setMainApp( this );
- // clear list
- imageUpload->listBox->clear();
- // fill list with images
+ // clear list
+ imageUpload->listBox->clear();
+ // fill list with images
- // incremental image - when assigned
- if( !(elements[i].image_history[n].get_image().stripWhiteSpace()).isEmpty() )
- imageUpload->listBox->insertItem(elements[i].image_history[n].get_image());
+ // incremental image - when assigned
+ if( !(elements[i].image_history[n].get_image().stripWhiteSpace()).isEmpty() )
+ imageUpload->listBox->insertItem(elements[i].image_history[n].get_image());
- // base image
- imageUpload->listBox->insertItem(elements[i].get_baseimage());
+ // base image
+ imageUpload->listBox->insertItem(elements[i].get_baseimage());
- command = LINBO_CMD("upload");
- saveappend( command, config.get_server() );
- saveappend( command, QString("linbo") );
- saveappend( command, QString("password") );
- saveappend( command, config.get_cache() );
- if( (elements[i].image_history[n].get_image().stripWhiteSpace()).isEmpty() ) {
- saveappend( command, elements[i].get_baseimage() );
- } else {
- saveappend( command, elements[i].image_history[n].get_image() );
- }
- imageUpload->setCommand( command );
+ command = LINBO_CMD("upload");
+ saveappend( command, config.get_server() );
+ saveappend( command, QString("linbo") );
+ saveappend( command, QString("password") );
+ saveappend( command, config.get_cache() );
+ if( (elements[i].image_history[n].get_image().stripWhiteSpace()).isEmpty() ) {
+ saveappend( command, elements[i].get_baseimage() );
+ } else {
+ saveappend( command, elements[i].image_history[n].get_image() );
+ }
+ imageUpload->setCommand( command );
- uploadbutton->setMainApp((QDialog*)this );
- uploadbutton->setLinboDialog( (linboDialog*)(imageUpload) );
- uploadbutton->setQDialog( (QDialog*)(imageUpload) );
- uploadbutton->setProgress( false );
+ uploadbutton->setMainApp((QDialog*)this );
+ uploadbutton->setLinboDialog( (linboDialog*)(imageUpload) );
+ uploadbutton->setQDialog( (QDialog*)(imageUpload) );
+ uploadbutton->setProgress( false );
- // assign button to button list
- p_buttons.push_back( uploadbutton );
- buttons_config.push_back( 1 );
- imagingView->addChild( uploadbutton, 270, imagingHeight );
+ // assign button to button list
+ p_buttons.push_back( uploadbutton );
+ buttons_config.push_back( 1 );
+ imagingView->addChild( uploadbutton, 270, imagingHeight );
- // where is my homie?
- createbutton->setNeighbour( uploadbutton );
- uploadbutton->setNeighbour( createbutton );
+ // where is my homie?
+ createbutton->setNeighbour( uploadbutton );
+ uploadbutton->setNeighbour( createbutton );
- // only for an odd element
- if( i % 2 == 1 ) {
- height += 69;
- }
-
- // the height of 69 is one complete element row, 5 is our start height
- startView->resizeContents( 600, ( (int)((i+2)/2) * 69 + 5 ) );
-
- imagingHeight += 32;
-
- int height2 = 5;
-
- // check: if one of the history entries is declared hidden,
- // hide the complete tab
- bool isHidden = false;
-
- for( unsigned int n = 0; n < elements[i].image_history.size(); n++ ) {
- isHidden |= elements[i].image_history[n].get_hidden();
- }
-
- // check whether our per-OS tabs should be displayed or not
- // we save a lot of memory by not building these elements
- if ( !isHidden ) {
- QWidget* newtab = new QWidget( Tabs );
- Q3ScrollView* view = new Q3ScrollView( newtab );
-
- view->setHScrollBarMode(Q3ScrollView::AlwaysOff);
- view->setVScrollBarMode(Q3ScrollView::Auto);
- view->viewport()->setBackgroundColor( "white" );
- view->setGeometry( QRect( 10, 10, 600, 180 ) );
-
- int iHorizontalOffset = 0;
-
- for( unsigned int n = 0; n < elements[i].image_history.size(); n++ ) {
-
- // QT BUG!
- if ( n == 0 ) {
- height2 = 14;
+ // only for an odd element
+ if( i % 2 == 1 ) {
+ height += 69;
}
- if( n % 2 == 1 ) {
- // an odd element is moved to the right
- iHorizontalOffset = 300;
- } else {
- iHorizontalOffset = 0;
- }
- QLabel *imagename = new QLabel( view->viewport() );
- imagename->setGeometry( QRect( (90 + iHorizontalOffset), height2, 180, 30 ) );
- imagename->setText( elements[i].image_history[n].get_version() + ";" + elements[i].image_history[n].get_description() );
- view->addChild( imagename, (90 + iHorizontalOffset), height2 );
- if ( n == 0 ) {
- height2 = 5;
+ // the height of 69 is one complete element row, 5 is our start height
+ //startView->resizeContents( 600, ( (int)((i+2)/2) * 69 + 5 ) );
+
+ imagingHeight += 32;
+
+ int height2 = 5;
+
+ // check: if one of the history entries is declared hidden,
+ // hide the complete tab
+ bool isHidden = false;
+
+ for( unsigned int n = 0; n < elements[i].image_history.size(); n++ ) {
+ isHidden |= elements[i].image_history[n].get_hidden();
}
- /* QLabel *imagetext = new QLabel( view->viewport() );
+ // check whether our per-OS tabs should be displayed or not
+ // we save a lot of memory by not building these elements
+ if ( !isHidden ) {
+ QWidget* newtab = new QWidget( Tabs );
+ Q3ScrollView* view = new Q3ScrollView( newtab );
+
+ view->setHScrollBarMode(Q3ScrollView::AlwaysOff);
+ view->setVScrollBarMode(Q3ScrollView::Auto);
+ view->viewport()->setBackgroundColor( "white" );
+ view->setGeometry( QRect( 10, 10, 600, 180 ) );
+
+ int iHorizontalOffset = 0;
+
+ for( unsigned int n = 0; n < elements[i].image_history.size(); n++ ) {
+
+ // QT BUG!
+ if ( n == 0 ) {
+ height2 = 14;
+ }
+
+ if( n % 2 == 1 ) {
+ // an odd element is moved to the right
+ iHorizontalOffset = 300;
+ } else {
+ iHorizontalOffset = 0;
+ }
+ QLabel *imagename = new QLabel( view->viewport() );
+ imagename->setGeometry( QRect( (90 + iHorizontalOffset), height2, 180, 30 ) );
+ imagename->setText( elements[i].image_history[n].get_version() + ";" + elements[i].image_history[n].get_description() );
+ view->addChild( imagename, (90 + iHorizontalOffset), height2 );
+ if ( n == 0 ) {
+ height2 = 5;
+ }
+
+ /* QLabel *imagetext = new QLabel( view->viewport() );
imagetext->setGeometry( QRect( 120, height2, 260, 30 ) );
imagetext->setText( elements[i].image_history[n].get_description() );
view->addChild( imagetext, 120, height2 );
*/
+ // Not required anymore
+ /*
linbopushbutton *idefaultbutton = new linbopushbutton( view->viewport() );
idefaultbutton->setGeometry( QRect( (15 + iHorizontalOffset), height2, 64, 64 ) );
@@ -1053,365 +1068,363 @@ linboGUIImpl::linboGUIImpl(QWidget* parent) : QDialog(parent)
autostart = idefaultbutton;
autostarttimeout = elements[i].image_history[n].get_autostarttimeout();
+ }*/
+
+ if( n % 2 == 1 ) {
+ height2 += 69;
+ }
+ // the height of 69 is one complete element row
+ view->resizeContents( 600, ( (int)((n+2)/2) * 69 + 5 ) );
+ }
+ Tabs->insertTab( newtab, elements[i].get_name(), (nextPosForTabInsert+1) );
+ nextPosForTabInsert++;
+ } 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() &&
+ !autostart ) {
+
+ logConsole->writeStdOut( QString("Autostart selected for OS Nr. ")
+ + QString::number(i)
+ + QString(", Image History Nr. ")
+ + QString::number( n ) );
+
+ autostart = defaultbutton;
+ autostarttimeout = elements[i].image_history[n].get_autostarttimeout();
+ }
+ }
+ */
}
-
-
- if( n % 2 == 1 ) {
- height2 += 69;
- }
- // the height of 69 is one complete element row
- view->resizeContents( 600, ( (int)((n+2)/2) * 69 + 5 ) );
- }
- Tabs->insertTab( newtab, elements[i].get_name(), (nextPosForTabInsert+1) );
- nextPosForTabInsert++;
- } else {
- // in case one of the elements is marked as "Autostart", we have to create the
- // matching, invisible sync+start button
-
- for( unsigned int n = 0; n < elements[i].image_history.size(); n++ ) {
-
- if( elements[i].image_history[n].get_autostart() &&
- !autostart ) {
-
- logConsole->writeStdOut( QString("Autostart selected for OS Nr. ")
- + QString::number(i)
- + QString(", Image History Nr. ")
- + QString::number( n ) );
-
- autostart = defaultbutton;
- autostarttimeout = elements[i].image_history[n].get_autostarttimeout();
- }
- }
}
- }
+ imagingView->resizeContents( 410, imagingHeight );
- imagingView->resizeContents( 410, imagingHeight );
+ // the first element of a view does have display problems so we add a dummy
+ QLabel *partitionlabel = new QLabel( partitionView->viewport() );
+ partitionlabel->setGeometry( QRect( 5, 5, 165, 30 ) );
+ partitionlabel->setText("");
+ partitionView->addChild( partitionlabel, 5,5 );
- // the first element of a view does have display problems so we add a dummy
- QLabel *partitionlabel = new QLabel( partitionView->viewport() );
- partitionlabel->setGeometry( QRect( 5, 5, 165, 30 ) );
- partitionlabel->setText("");
- partitionView->addChild( partitionlabel, 5,5 );
+ linbopushbutton *consolebuttonimaging = new linbopushbutton( partitionView->viewport() );
+ // left-align graphics and text
+ consolebuttonimaging->setStyleSheet("QPushButton{text-align : left; padding-left: 5px;}");
+ consolebuttonimaging->setGeometry( QRect( 15, 27, 130, 30 ) );
+ consolebuttonimaging->setText( QString("Console") );
+ consolebuttonimaging->setTextBrowser( config.get_consolefontcolorstdout(),
+ config.get_consolefontcolorstderr(),
+ Console );
- linbopushbutton *consolebuttonimaging = new linbopushbutton( partitionView->viewport() );
- // left-align graphics and text
- consolebuttonimaging->setStyleSheet("QPushButton{text-align : left; padding-left: 5px;}");
- consolebuttonimaging->setGeometry( QRect( 15, 27, 130, 30 ) );
- consolebuttonimaging->setText( QString("Console") );
- consolebuttonimaging->setTextBrowser( config.get_consolefontcolorstdout(),
- config.get_consolefontcolorstderr(),
- Console );
+ linboConsoleImpl *linboconsole = new linboConsoleImpl( consolebuttonimaging );
+ linboconsole->setMainApp(this );
+ linboconsole->setTextBrowser( config.get_consolefontcolorstdout(),
+ config.get_consolefontcolorstderr(),
+ Console );
- linboConsoleImpl *linboconsole = new linboConsoleImpl( consolebuttonimaging );
- linboconsole->setMainApp(this );
- linboconsole->setTextBrowser( config.get_consolefontcolorstdout(),
- config.get_consolefontcolorstderr(),
- Console );
+ consolebuttonimaging->setProgress( false );
+ consolebuttonimaging->setMainApp(this );
+ consolebuttonimaging->setLinboDialog( (linboDialog*)(linboconsole) );
+ consolebuttonimaging->setQDialog( (QDialog*)(linboconsole) );
- consolebuttonimaging->setProgress( false );
- consolebuttonimaging->setMainApp(this );
- consolebuttonimaging->setLinboDialog( (linboDialog*)(linboconsole) );
- consolebuttonimaging->setQDialog( (QDialog*)(linboconsole) );
+ // add tooltip and icon
+ QToolTip::add( consolebuttonimaging, QString("Öffnet das Konsolenfenster") );
- // add tooltip and icon
- QToolTip::add( consolebuttonimaging, QString("Öffnet das Konsolenfenster") );
+ if( withicons )
+ consolebuttonimaging->setIconSet( QIcon( ":/icons/console-22x22.png" ) );
- if( withicons )
- consolebuttonimaging->setIconSet( QIcon( ":/icons/console-22x22.png" ) );
+ // assign button to button list
+ p_buttons.push_back( consolebuttonimaging );
+ buttons_config.push_back( 1 );
+ partitionView->addChild( consolebuttonimaging, 15, 27 );
- // assign button to button list
- p_buttons.push_back( consolebuttonimaging );
- buttons_config.push_back( 1 );
- partitionView->addChild( consolebuttonimaging, 15, 27 );
+ linbopushbutton *multicastbuttonimaging = new linbopushbutton( partitionView->viewport() );
+ // left-align graphics and text
+ multicastbuttonimaging->setStyleSheet("QPushButton{text-align : left; padding-left: 5px;}");
+ multicastbuttonimaging->setGeometry( QRect( 15, 59, 130, 30 ) );
+ multicastbuttonimaging->setText( QString("Cache aktualisieren") );
+ multicastbuttonimaging->setTextBrowser( config.get_consolefontcolorstdout(),
+ config.get_consolefontcolorstderr(),
+ Console );
- linbopushbutton *multicastbuttonimaging = new linbopushbutton( partitionView->viewport() );
- // left-align graphics and text
- multicastbuttonimaging->setStyleSheet("QPushButton{text-align : left; padding-left: 5px;}");
- multicastbuttonimaging->setGeometry( QRect( 15, 59, 130, 30 ) );
- multicastbuttonimaging->setText( QString("Cache aktualisieren") );
- multicastbuttonimaging->setTextBrowser( config.get_consolefontcolorstdout(),
- config.get_consolefontcolorstderr(),
- Console );
+ // add tooltip and icon
+ QToolTip::add( multicastbuttonimaging, QString("Aktualisiert den lokalen Cache") );
- // add tooltip and icon
- QToolTip::add( multicastbuttonimaging, QString("Aktualisiert den lokalen Cache") );
+ if( withicons )
+ multicastbuttonimaging->setIconSet( QIcon( ":/icons/cache-22x22.png" ) );
- if( withicons )
- multicastbuttonimaging->setIconSet( QIcon( ":/icons/cache-22x22.png" ) );
+ linboMulticastBoxImpl *multicastbox = new linboMulticastBoxImpl( multicastbuttonimaging );
+ multicastbox->setMainApp(this );
+ multicastbox->setTextBrowser( config.get_consolefontcolorstdout(),
+ config.get_consolefontcolorstderr(),
+ Console );
- linboMulticastBoxImpl *multicastbox = new linboMulticastBoxImpl( multicastbuttonimaging );
- multicastbox->setMainApp(this );
- multicastbox->setTextBrowser( config.get_consolefontcolorstdout(),
- config.get_consolefontcolorstderr(),
- Console );
+ multicastbox->setRsyncCommand( mkcacheinitcommand( config, elements, QString("rsync")) );
+ multicastbox->setMulticastCommand( mkcacheinitcommand( config, elements, QString("multicast")) );
+ multicastbox->setBittorrentCommand( mkcacheinitcommand( config, elements, QString("torrent")) );
- multicastbox->setRsyncCommand( mkcacheinitcommand( config, elements, QString("rsync")) );
- multicastbox->setMulticastCommand( mkcacheinitcommand( config, elements, QString("multicast")) );
- multicastbox->setBittorrentCommand( mkcacheinitcommand( config, elements, QString("torrent")) );
+ multicastbuttonimaging->setProgress( false );
+ multicastbuttonimaging->setMainApp(this );
+ multicastbuttonimaging->setLinboDialog( (linboDialog*)(multicastbox) );
+ multicastbuttonimaging->setQDialog( (QDialog*)(multicastbox) );
- multicastbuttonimaging->setProgress( false );
- multicastbuttonimaging->setMainApp(this );
- multicastbuttonimaging->setLinboDialog( (linboDialog*)(multicastbox) );
- multicastbuttonimaging->setQDialog( (QDialog*)(multicastbox) );
+ autoinitcache = 0;
+ // this button MUSTN't have a parent, otherwise we get a artifact button
+ // inside the imaging tab
+ linbopushbutton *autoinitcachebutton = new linbopushbutton(0);
+ // this invisible button is needed für autoinitcache
+ if( config.get_autoinitcache() ) {
+ autoinitcachebutton->setTextBrowser( config.get_consolefontcolorstdout(),
+ config.get_consolefontcolorstderr(),
+ Console );
+ autoinitcachebutton->setMainApp(this );
+ autoinitcachebutton->setProgress( true );
+ autoinitcachebutton->setCommand( mkcacheinitcommand( config, elements, config.get_downloadtype() ) );
+ autoinitcache = autoinitcachebutton;
+ autoinitcachebutton->hide();
+ }
- autoinitcache = 0;
- // this button MUSTN't have a parent, otherwise we get a artifact button
- // inside the imaging tab
- linbopushbutton *autoinitcachebutton = new linbopushbutton(0);
- // this invisible button is needed für autoinitcache
- if( config.get_autoinitcache() ) {
- autoinitcachebutton->setTextBrowser( config.get_consolefontcolorstdout(),
- config.get_consolefontcolorstderr(),
- Console );
- autoinitcachebutton->setMainApp(this );
- autoinitcachebutton->setProgress( true );
- autoinitcachebutton->setCommand( mkcacheinitcommand( config, elements, config.get_downloadtype() ) );
- autoinitcache = autoinitcachebutton;
- autoinitcachebutton->hide();
- }
+ // assign button to button list
+ p_buttons.push_back( multicastbuttonimaging );
+ buttons_config.push_back( 1 );
+ partitionView->addChild( multicastbuttonimaging, 15, 59 );
- // assign button to button list
- p_buttons.push_back( multicastbuttonimaging );
- buttons_config.push_back( 1 );
- partitionView->addChild( multicastbuttonimaging, 15, 59 );
+ // Partition button - Imaging tab
+ linbopushbutton *partitionbutton = new linbopushbutton( partitionView->viewport() );
+ // left-align graphics and text
+ partitionbutton->setStyleSheet("QPushButton{text-align : left; padding-left: 5px;}");
+ partitionbutton->setGeometry( QRect( 15, 91, 130, 30 ) );
+ partitionbutton->setText( QString("Partitionieren") );
+ partitionbutton->setTextBrowser( config.get_consolefontcolorstdout(),
+ config.get_consolefontcolorstderr(),
+ Console );
+ partitionbutton->setMainApp(this );
+ partitionbutton->setEnabled( true );
- // Partition button - Imaging tab
- linbopushbutton *partitionbutton = new linbopushbutton( partitionView->viewport() );
- // left-align graphics and text
- partitionbutton->setStyleSheet("QPushButton{text-align : left; padding-left: 5px;}");
- partitionbutton->setGeometry( QRect( 15, 91, 130, 30 ) );
- partitionbutton->setText( QString("Partitionieren") );
- partitionbutton->setTextBrowser( config.get_consolefontcolorstdout(),
- config.get_consolefontcolorstderr(),
- Console );
- partitionbutton->setMainApp(this );
- partitionbutton->setEnabled( true );
+ // add tooltip and icon
+ QToolTip::add( partitionbutton, QString("Partitioniert die Festplatte neu") );
- // add tooltip and icon
- QToolTip::add( partitionbutton, QString("Partitioniert die Festplatte neu") );
+ if( withicons )
+ partitionbutton->setIconSet( QIcon( ":/icons/partition-22x22.png" ) );
- if( withicons )
- partitionbutton->setIconSet( QIcon( ":/icons/partition-22x22.png" ) );
+ linboYesNoImpl *yesNoPartition = new linboYesNoImpl( partitionbutton);
+ yesNoPartition->question->setText("Alle Daten auf der Festplatte löschen?");
+ yesNoPartition->setTextBrowser( config.get_consolefontcolorstdout(),
+ config.get_consolefontcolorstderr(),
+ Console );
+ yesNoPartition->setMainApp(this );
+ yesNoPartition->setCommand(mkpartitioncommand(partitions));
- linboYesNoImpl *yesNoPartition = new linboYesNoImpl( partitionbutton);
- yesNoPartition->question->setText("Alle Daten auf der Festplatte löschen?");
- yesNoPartition->setTextBrowser( config.get_consolefontcolorstdout(),
- config.get_consolefontcolorstderr(),
- Console );
- yesNoPartition->setMainApp(this );
- yesNoPartition->setCommand(mkpartitioncommand(partitions));
+ autopartition = 0;
+ linbopushbutton *autopartitionbutton = new linbopushbutton();
+ // this invisible button is needed f?r autopartition
+ if( config.get_autopartition() ) {
+ autopartitionbutton->setTextBrowser( config.get_consolefontcolorstdout(),
+ config.get_consolefontcolorstderr(),
+ Console );
+ autopartitionbutton->setMainApp(this );
+ autopartitionbutton->setProgress( true );
+ // here we set whether a partition should be automatically formatted after
+ // the partition table has been overwritten
+ if( config.get_autoformat() )
+ autopartitionbutton->setCommand(mkpartitioncommand(partitions));
+ else
+ autopartitionbutton->setCommand(mkpartitioncommand_noformat(partitions));
+ autopartition = autopartitionbutton;
+ autopartitionbutton->setHidden( true );
+ }
- autopartition = 0;
- linbopushbutton *autopartitionbutton = new linbopushbutton();
- // this invisible button is needed f?r autopartition
- if( config.get_autopartition() ) {
- autopartitionbutton->setTextBrowser( config.get_consolefontcolorstdout(),
- config.get_consolefontcolorstderr(),
- Console );
- autopartitionbutton->setMainApp(this );
- autopartitionbutton->setProgress( true );
- // here we set whether a partition should be automatically formatted after
- // the partition table has been overwritten
- if( config.get_autoformat() )
- autopartitionbutton->setCommand(mkpartitioncommand(partitions));
- else
- autopartitionbutton->setCommand(mkpartitioncommand_noformat(partitions));
- autopartition = autopartitionbutton;
- autopartitionbutton->setHidden( true );
- }
+ partitionbutton->setProgress( false );
- partitionbutton->setProgress( false );
-
- partitionbutton->setLinboDialog( (linboDialog*)(yesNoPartition) );
- partitionbutton->setQDialog( (QDialog*)(yesNoPartition) );
+ partitionbutton->setLinboDialog( (linboDialog*)(yesNoPartition) );
+ partitionbutton->setQDialog( (QDialog*)(yesNoPartition) );
- partitionView->addChild( partitionbutton, 15, 91 );
+ partitionView->addChild( partitionbutton, 15, 91 );
- // assign button to button list
- p_buttons.push_back( partitionbutton );
- buttons_config.push_back( 1 );
+ // assign button to button list
+ p_buttons.push_back( partitionbutton );
+ buttons_config.push_back( 1 );
- // RegisterBox button - Imaging tab
- linbopushbutton *registerbutton = new linbopushbutton( partitionView->viewport() );
- // left-align graphics and text
- registerbutton->setStyleSheet("QPushButton{text-align : left; padding-left: 5px;}");
- registerbutton->setGeometry( QRect( 15, 123, 130, 30 ) );
- registerbutton->setText( QString("Registrieren") );
- registerbutton->setTextBrowser( config.get_consolefontcolorstdout(),
- config.get_consolefontcolorstderr(),
- Console );
- registerbutton->setMainApp(this );
- registerbutton->setEnabled( true );
+ // RegisterBox button - Imaging tab
+ linbopushbutton *registerbutton = new linbopushbutton( partitionView->viewport() );
+ // left-align graphics and text
+ registerbutton->setStyleSheet("QPushButton{text-align : left; padding-left: 5px;}");
+ registerbutton->setGeometry( QRect( 15, 123, 130, 30 ) );
+ registerbutton->setText( QString("Registrieren") );
+ registerbutton->setTextBrowser( config.get_consolefontcolorstdout(),
+ config.get_consolefontcolorstderr(),
+ Console );
+ registerbutton->setMainApp(this );
+ registerbutton->setEnabled( true );
- // add tooltip and icon
- QToolTip::add( registerbutton, QString("Öffnet den Registrierungsdialog zur Aufnahme neuer Rechner") );
+ // add tooltip and icon
+ QToolTip::add( registerbutton, QString("Öffnet den Registrierungsdialog zur Aufnahme neuer Rechner") );
- if( withicons )
- registerbutton->setIconSet( QIcon( ":/icons/register-22x22.png") );
+ if( withicons )
+ registerbutton->setIconSet( QIcon( ":/icons/register-22x22.png") );
- linboRegisterBoxImpl *registerBox = new linboRegisterBoxImpl( registerbutton );
- registerBox->setTextBrowser( config.get_consolefontcolorstdout(),
- config.get_consolefontcolorstderr(),
- Console );
- registerBox->setMainApp(this );
+ linboRegisterBoxImpl *registerBox = new linboRegisterBoxImpl( registerbutton );
+ registerBox->setTextBrowser( config.get_consolefontcolorstdout(),
+ config.get_consolefontcolorstderr(),
+ Console );
+ registerBox->setMainApp(this );
- //cout << "Preregister command";
- command = LINBO_CMD("preregister");
- saveappend( command, config.get_server() );
- registerBox->setPreCommand( command );
+ //cout << "Preregister command";
+ command = LINBO_CMD("preregister");
+ saveappend( command, config.get_server() );
+ registerBox->setPreCommand( command );
- //cout << "Register Command";
- command = LINBO_CMD("register");
- saveappend( command, config.get_server() );
- saveappend( command, QString("linbo") );
- saveappend( command, QString("password") );
- saveappend( command, QString("clientRoom") );
- saveappend( command, QString("clientName") );
- saveappend( command, QString("clientIP") );
- saveappend( command, QString("clientGroup") );
+ //cout << "Register Command";
+ command = LINBO_CMD("register");
+ saveappend( command, config.get_server() );
+ saveappend( command, QString("linbo") );
+ saveappend( command, QString("password") );
+ saveappend( command, QString("clientRoom") );
+ saveappend( command, QString("clientName") );
+ saveappend( command, QString("clientIP") );
+ saveappend( command, QString("clientGroup") );
- registerBox->setCommand( command );
+ registerBox->setCommand( command );
- registerbutton->setProgress( false );
+ registerbutton->setProgress( false );
- registerbutton->setLinboDialog( (linboDialog*)(registerBox) );
- registerbutton->setQDialog( (QDialog*)(registerBox) );
+ registerbutton->setLinboDialog( (linboDialog*)(registerBox) );
+ registerbutton->setQDialog( (QDialog*)(registerBox) );
- partitionView->addChild( registerbutton, 15, 123 );
+ partitionView->addChild( registerbutton, 15, 123 );
- // assign button to button list
- p_buttons.push_back( registerbutton );
- buttons_config.push_back( 1 );
+ // assign button to button list
+ p_buttons.push_back( registerbutton );
+ buttons_config.push_back( 1 );
- buttons_config_save.clear();
- for( unsigned int i = 0; i < p_buttons.size(); i++ ) {
- buttons_config_save.push_back( p_buttons[i]->isEnabled() );
- }
+ buttons_config_save.clear();
+ for( unsigned int i = 0; i < p_buttons.size(); i++ ) {
+ buttons_config_save.push_back( p_buttons[i]->isEnabled() );
+ }
- myLPasswordBox = new linboPasswordBoxImpl( this );
- myQPasswordBox = (QDialog*)(myLPasswordBox);
- myLPasswordBox->setMainApp(this );
- myLPasswordBox->setTextBrowser( config.get_consolefontcolorstdout(),
- config.get_consolefontcolorstderr(),
- Console );
+ myLPasswordBox = new linboPasswordBoxImpl( this );
+ myQPasswordBox = (QDialog*)(myLPasswordBox);
+ myLPasswordBox->setMainApp(this );
+ myLPasswordBox->setTextBrowser( config.get_consolefontcolorstdout(),
+ config.get_consolefontcolorstderr(),
+ Console );
- // Code for detecting tab changes
- connect( Tabs, SIGNAL(currentChanged( QWidget* )),
- this, SLOT(tabWatcher( QWidget* )) );
+ // Code for detecting tab changes
+ connect( Tabs, SIGNAL(currentChanged( QWidget* )),
+ this, SLOT(tabWatcher( QWidget* )) );
- // create process for our status bar
+ // create process for our status bar
- process = new QProcess( this );
- /* connect( process, SIGNAL(readyReadStandardOutput()),
+ process = new QProcess( this );
+ /* connect( process, SIGNAL(readyReadStandardOutput()),
this, SLOT(readFromStdout()) );
connect( process, SIGNAL(readyReadStandardError()),
this, SLOT(readFromStderr()) );
*/
- // we don't want to see this on the LINBO Console
- outputvisible = false;
+ // we don't want to see this on the LINBO Console
+ outputvisible = false;
- // client ip
- command = LINBO_CMD("ip");
- // myprocess->setArguments( command );
- process->start( command.join(" ") );
- while( !process->waitForFinished(10000) ) {
- }
+ // client ip
+ command = LINBO_CMD("ip");
+ // myprocess->setArguments( command );
+ process->start( command.join(" ") );
+ while( !process->waitForFinished(10000) ) {
+ }
- clientIPLabel->setText( fonttemplate.arg(QString("Client IP: ") + process->readAllStandardOutput() ) );
+ clientIPLabel->setText( fonttemplate.arg(QString("Client IP: ") + process->readAllStandardOutput() ) );
- // server ip
+ // server ip
- // serverIPLabel->setText( QString(" Server IP: ") + config.get_server() );
+ // serverIPLabel->setText( QString(" Server IP: ") + config.get_server() );
- // mac address
- command.clear();
- command = LINBO_CMD("mac");
+ // mac address
+ command.clear();
+ command = LINBO_CMD("mac");
- process->start( command.join(" ") );
- while( !process->waitForFinished(10000) ) {
- }
- macLabel->setText( fonttemplate.arg(QString("MAC: ") + process->readAllStandardOutput() ) );
+ process->start( command.join(" ") );
+ while( !process->waitForFinished(10000) ) {
+ }
+ macLabel->setText( fonttemplate.arg(QString("MAC: ") + process->readAllStandardOutput() ) );
- // Server and Version
-// hostname and hostgroup
+ // Server and Version
+ // hostname and hostgroup
- command = LINBO_CMD("version");
- // myprocess->setArguments( command );
- process->start( command.join(" ") );
- while( !process->waitForFinished(10000) ) {
- }
+ command = LINBO_CMD("version");
+ // myprocess->setArguments( command );
+ process->start( command.join(" ") );
+ while( !process->waitForFinished(10000) ) {
+ }
- versionLabel->setText( (process->readAllStandardOutput()).stripWhiteSpace() + QString(" - (mod by Dorian Zedler) - auf Server ") + config.get_server());
+ // hostname and hostgroup
- // hostname and hostgroup
-
- command = LINBO_CMD("hostname");
- // myprocess->setArguments( command );
- process->start( command.join(" ") );
- while( !process->waitForFinished(10000) ) {
- }
+ command = LINBO_CMD("hostname");
+ // myprocess->setArguments( command );
+ process->start( command.join(" ") );
+ while( !process->waitForFinished(10000) ) {
+ }
- nameLabel->setText( fonttemplate.arg(QString("Host: ") + process->readAllStandardOutput() ) );
- groupLabel->setText( fonttemplate.arg(QString("Gruppe: ") + config.get_hostgroup() ) );
+ nameLabel->setText( fonttemplate.arg(QString("Host: ") + process->readAllStandardOutput() ) );
+ groupLabel->setText( fonttemplate.arg(QString("Gruppe: ") + config.get_hostgroup() ) );
- // our clock displaying the system time
- myTimer = new QTimer(this);
- connect( myTimer, SIGNAL(timeout()), this, SLOT(processTimeout()) );
- myTimer->start( 1000, FALSE );
+ // our clock displaying the system time
+ myTimer = new QTimer(this);
+ connect( myTimer, SIGNAL(timeout()), this, SLOT(processTimeout()) );
+ myTimer->start( 1000, FALSE );
- // CPU
- command = LINBO_CMD("cpu");
- // myprocess->setArguments( command );
- process->start( command.join(" ") );
- while( !process->waitForFinished(10000) ) {
- }
+ // CPU
+ command = LINBO_CMD("cpu");
+ // myprocess->setArguments( command );
+ process->start( command.join(" ") );
+ while( !process->waitForFinished(10000) ) {
+ }
- cpuLabel->setText( fonttemplate.arg(QString("CPU: ") + process->readAllStandardOutput() ) );
+ cpuLabel->setText( fonttemplate.arg(QString("CPU: ") + process->readAllStandardOutput() ) );
- // Memory
- command = LINBO_CMD("memory");
- process->start( command.join(" ") );
- while( !process->waitForFinished(10000) ) {
- }
+ // Memory
+ command = LINBO_CMD("memory");
+ process->start( command.join(" ") );
+ while( !process->waitForFinished(10000) ) {
+ }
- memLabel->setText( fonttemplate.arg(QString("RAM: ") + process->readAllStandardOutput() ) );
+ memLabel->setText( fonttemplate.arg(QString("RAM: ") + process->readAllStandardOutput() ) );
- // Cache Size
- command = LINBO_CMD("size");
- saveappend( command, config.get_cache() );
- process->start( command.join(" ") );
- while( !process->waitForFinished(10000) ) {
- }
- cacheLabel->setText( fonttemplate.arg(QString("Cache: ") + process->readAllStandardOutput() ) );
+ // Cache Size
+ command = LINBO_CMD("size");
+ saveappend( command, config.get_cache() );
+ process->start( command.join(" ") );
+ while( !process->waitForFinished(10000) ) {
+ }
+ cacheLabel->setText( fonttemplate.arg(QString("Cache: ") + process->readAllStandardOutput() ) );
- // Harddisk Size
- QRegExp *removePartition = new QRegExp("[0-9]{1,2}");
- QString hd = config.get_cache();
- hd.remove( *removePartition );
+ // Harddisk Size
+ QRegExp *removePartition = new QRegExp("[0-9]{1,2}");
+ QString hd = config.get_cache();
+ hd.remove( *removePartition );
- command = LINBO_CMD("size");
- saveappend( command, hd );
+ command = LINBO_CMD("size");
+ saveappend( command, hd );
- process->start( command.join(" ") );
- while( !process->waitForFinished(10000) ) {
- }
+ process->start( command.join(" ") );
+ while( !process->waitForFinished(10000) ) {
+ }
- hdLabel->setText( fonttemplate.arg(QString("HD: ") + process->readAllStandardOutput() ) );
+ hdLabel->setText( fonttemplate.arg(QString("HD: ") + process->readAllStandardOutput() ) );
- // enable console output again
- outputvisible = true;
+ // enable console output again
+ outputvisible = true;
- // select start tab
- Tabs->setCurrentPage(0);
+ // select start tab
+ Tabs->setCurrentPage(0);
}
@@ -1419,190 +1432,202 @@ linboGUIImpl::linboGUIImpl(QWidget* parent) : QDialog(parent)
void linboGUIImpl::processTimeout() {
- timeLabel->setText( fonttemplate.arg(QTime::currentTime().toString() ) );
+ timeLabel->setText( fonttemplate.arg(QTime::currentTime().toString() ) );
}
void linboGUIImpl::shutdown() {
- QStringList command;
- command.clear();
- command = QStringList("busybox");
- command.append("poweroff");
- logConsole->writeStdOut( QString("shutdown entered") );
- process->start( command.join(" ") );
+ QStringList command;
+ command.clear();
+ command = QStringList("busybox");
+ command.append("poweroff");
+ logConsole->writeStdOut( QString("shutdown entered") );
+ process->start( command.join(" ") );
}
void linboGUIImpl::reboot() {
- QStringList command;
- command.clear();
- command = QStringList("busybox");
- command.append("reboot");
- logConsole->writeStdOut( QString("reboot entered") );
- process->start( command.join(" ") );
+ QStringList command;
+ command.clear();
+ command = QStringList("busybox");
+ command.append("reboot");
+ logConsole->writeStdOut( QString("reboot entered") );
+ process->start( command.join(" ") );
}
void linboGUIImpl::log( const QString& data ) {
- // write to our logfile
- QFile logfile( logfilepath );
- logfile.open( QIODevice::WriteOnly | QIODevice::Append );
- Q3TextStream logstream( &logfile );
- logstream << data << "\n";
- logfile.flush();
- logfile.close();
+ // write to our logfile
+ QFile logfile( logfilepath );
+ logfile.open( QIODevice::WriteOnly | QIODevice::Append );
+ Q3TextStream logstream( &logfile );
+ logstream << data << "\n";
+ logfile.flush();
+ logfile.close();
}
void linboGUIImpl::readFromStdout()
{
- // TODO: reactivate log
- // log( linestdout );
+ // TODO: reactivate log
+ // log( linestdout );
- if( outputvisible ) {
- logConsole->writeStdOut( process->readAllStandardOutput() );
- }
+ if( outputvisible ) {
+ logConsole->writeStdOut( process->readAllStandardOutput() );
+ }
}
void linboGUIImpl::readFromStderr()
{
- // TODO: reactivate log
- // log( linestderr );
+ // TODO: reactivate log
+ // log( linestderr );
- if( outputvisible ) {
+ if( outputvisible ) {
- logConsole->writeStdErr( process->readAllStandardError() );
- }
+ logConsole->writeStdErr( process->readAllStandardError() );
+ }
}
linboGUIImpl::~linboGUIImpl()
{
- // nothing to do
+ // nothing to do
}
void linboGUIImpl::enableButtons() {
- root = true;
- for( unsigned int i = 0; i < p_buttons.size(); i++ ) {
- if( buttons_config[i] == 2 )
- p_buttons[i]->setEnabled( false );
- else
- p_buttons[i]->setEnabled( true );
- }
+ root = true;
+ for( unsigned int i = 0; i < p_buttons.size(); i++ ) {
+ if( buttons_config[i] == 2 )
+ p_buttons[i]->setEnabled( false );
+ else
+ p_buttons[i]->setEnabled( true );
+ }
}
void linboGUIImpl::resetButtons() {
- root = false;
- Tabs->setCurrentPage( preTab );
- for( unsigned int i = 0; i < p_buttons.size(); i++ ) {
- if( buttons_config[i] == 2 )
- p_buttons[i]->setEnabled( true );
- else
- p_buttons[i]->setEnabled( buttons_config[i] );
+ root = false;
+ Tabs->setCurrentPage( preTab );
+ for( unsigned int i = 0; i < p_buttons.size(); i++ ) {
+ if( buttons_config[i] == 2 )
+ p_buttons[i]->setEnabled( true );
+ else
+ p_buttons[i]->setEnabled( buttons_config[i] );
- buttons_config_save[i] = p_buttons[i]->isEnabled();
- }
+ buttons_config_save[i] = p_buttons[i]->isEnabled();
+ }
+ this->close();
}
void linboGUIImpl::executeAutostart() {
return; // autostart is handled by new backend
- // if there is "autopartition" set, execute the hidden button
- if( autopartition )
- autopartition->lclicked();
+ // if there is "autopartition" set, execute the hidden button
+ if( autopartition )
+ autopartition->lclicked();
- // if there is "autoinitcache" set, execute the hidden button
- if( autoinitcache )
- autoinitcache->lclicked();
+ // if there is "autoinitcache" set, execute the hidden button
+ if( autoinitcache )
+ autoinitcache->lclicked();
- // if there is a with "autostart" declared image, execute the hidden button
- if( autostart != 0 ) {
- if( autostarttimeout > 0 ) {
+ // if there is a with "autostart" declared image, execute the hidden button
+ if( autostart != 0 ) {
+ if( autostarttimeout > 0 ) {
- myAutostartTimer = new QTimer(0);
- myAutostartTimer->stop();
- myAutostartTimer->start( 1000, FALSE );
+ myAutostartTimer = new QTimer(0);
+ myAutostartTimer->stop();
+ myAutostartTimer->start( 1000, FALSE );
- myCounter = new linboCounterImpl(this);
- myCounter->text->setText("Autostart in...");
- myCounter->logoutButton->setText("Autostart abbrechen");
- myCounter->counter->display( autostarttimeout );
- myCounter->timeoutCheck->hide();
+ myCounter = new linboCounterImpl(this);
+ myCounter->text->setText("Autostart in...");
+ myCounter->logoutButton->setText("Autostart abbrechen");
+ myCounter->counter->display( autostarttimeout );
+ myCounter->timeoutCheck->hide();
- // connect( myCounter->logoutButton, SIGNAL(pressed()), app, SLOT(resetButtons()) );
- connect( myCounter->logoutButton, SIGNAL(clicked()), myAutostartTimer, SLOT(stop()) );
- connect( myAutostartTimer, SIGNAL(timeout()), this, SLOT(autostartTimeoutSlot()) );
+ // connect( myCounter->logoutButton, SIGNAL(pressed()), app, SLOT(resetButtons()) );
+ connect( myCounter->logoutButton, SIGNAL(clicked()), myAutostartTimer, SLOT(stop()) );
+ connect( myAutostartTimer, SIGNAL(timeout()), this, SLOT(autostartTimeoutSlot()) );
- myCounter->show();
- myCounter->raise();
- myCounter->move( QPoint( 5, 5 ) );
+ myCounter->show();
+ myCounter->raise();
+ myCounter->move( QPoint( 5, 5 ) );
- } else {
- autostart->lclicked();
+ } else {
+ autostart->lclicked();
+ }
}
- }
}
void linboGUIImpl::autostartTimeoutSlot() {
return; // autostart is handled by new backend
- if( !myCounter->timeoutCheck->isChecked() ) {
- // do nothing but dont stop timer
- }
- else {
- if( autostarttimeout > 0 ) {
- autostarttimeout--;
- myCounter->counter->display( autostarttimeout );
- } else {
- myCounter->hide();
- myCounter->close();
- myAutostartTimer->stop();
- autostart->lclicked();
- this->resetButtons();
+ if( !myCounter->timeoutCheck->isChecked() ) {
+ // do nothing but dont stop timer
+ }
+ else {
+ if( autostarttimeout > 0 ) {
+ autostarttimeout--;
+ myCounter->counter->display( autostarttimeout );
+ } else {
+ myCounter->hide();
+ myCounter->close();
+ myAutostartTimer->stop();
+ autostart->lclicked();
+ this->resetButtons();
+ }
}
- }
}
void linboGUIImpl::disableButtons() {
- for( unsigned int i = 0; i < p_buttons.size(); i++ ) {
- // save buttons state
+ for( unsigned int i = 0; i < p_buttons.size(); i++ ) {
+ // save buttons state
- buttons_config_save[i] = p_buttons[i]->isEnabled();
- p_buttons[i]->setEnabled( false );
- }
+ buttons_config_save[i] = p_buttons[i]->isEnabled();
+ p_buttons[i]->setEnabled( false );
+ }
}
void linboGUIImpl::restoreButtonsState() {
- for( unsigned int i = 0; i < p_buttons.size(); i++ ) {
- p_buttons[i]->setEnabled( buttons_config_save[i] );
- }
+ for( unsigned int i = 0; i < p_buttons.size(); i++ ) {
+ p_buttons[i]->setEnabled( buttons_config_save[i] );
+ }
}
-void linboGUIImpl::tabWatcher( QWidget* currentWidget) {
-
- if( !isRoot() ) {
- if( Tabs->tabLabel(currentWidget) == "Imaging" ) {
- // if our partition button is disabled, there is a linbo_cmd running
- if( p_buttons[ ( p_buttons.size() - 1 ) ]->isEnabled() ) {
+void linboGUIImpl::loginAndOpen() {
+ if( !isRoot() ) {
Tabs->setCurrentPage( preTab );
myQPasswordBox->show();
myQPasswordBox->raise();
myQPasswordBox->setActiveWindow();
myQPasswordBox->setEnabled( true );
- }
- else {
- Tabs->setCurrentPage( preTab );
- }
}
- }
- if( (Tabs->count() - 1) != Tabs->currentPageIndex() )
- preTab = Tabs->currentPageIndex();
+}
+
+void linboGUIImpl::tabWatcher( QWidget* currentWidget) {
+
+ if( !isRoot() ) {
+ if( Tabs->tabLabel(currentWidget) == "Imaging" ) {
+ // if our partition button is disabled, there is a linbo_cmd running
+ if( p_buttons[ ( p_buttons.size() - 1 ) ]->isEnabled() ) {
+ Tabs->setCurrentPage( preTab );
+ myQPasswordBox->show();
+ myQPasswordBox->raise();
+ myQPasswordBox->setActiveWindow();
+ myQPasswordBox->setEnabled( true );
+ }
+ else {
+ Tabs->setCurrentPage( preTab );
+ }
+ }
+ }
+ if( (Tabs->count() - 1) != Tabs->currentPageIndex() )
+ preTab = Tabs->currentPageIndex();
}
bool linboGUIImpl::isRoot() const {
- return root;
+ return root;
}
void linboGUIImpl::showImagingTab() {
- Tabs->setCurrentPage( (Tabs->count() - 1) );
+ this->open(); // imaging tab is now the only tab
+ //Tabs->setCurrentPage( (Tabs->count() - 1) );
}
diff --git a/sources/legacy/linboPasswordBoxImpl.cc b/sources/legacy/linboPasswordBoxImpl.cc
index 303becc..421cf9f 100644
--- a/sources/legacy/linboPasswordBoxImpl.cc
+++ b/sources/legacy/linboPasswordBoxImpl.cc
@@ -10,206 +10,204 @@
linboPasswordBoxImpl::linboPasswordBoxImpl( QDialog* parent ) : linboDialog()
{
- Ui_linboPasswordBox::setupUi((QDialog*)this);
+ Ui_linboPasswordBox::setupUi((QDialog*)this);
- connect(passwordInput,SIGNAL(returnPressed()),this,SLOT(postcmd()));
+ connect(passwordInput,SIGNAL(returnPressed()),this,SLOT(postcmd()));
- process=new QProcess( this );
- if(parent)
- myParent = parent;
+ process=new QProcess( this );
+ if(parent)
+ myParent = parent;
- myTimer = new QTimer(this);
- myCounter = new linboCounterImpl(this);
+ myTimer = new QTimer(this);
+ myCounter = new linboCounterImpl(this);
- logConsole = new linboLogConsole(0);
+ logConsole = new linboLogConsole(0);
- connect( myTimer, SIGNAL(timeout()), this, SLOT(processTimeout()) );
+ connect( myTimer, SIGNAL(timeout()), this, SLOT(processTimeout()) );
- // connect SLOT for finished process
- connect( process, SIGNAL(finished(int, QProcess::ExitStatus) ),
- this, SLOT(processFinished(int, QProcess::ExitStatus)) );
+ // connect SLOT for finished process
+ connect( process, SIGNAL(finished(int, QProcess::ExitStatus) ),
+ this, SLOT(processFinished(int, QProcess::ExitStatus)) );
- // connect stdout and stderr to linbo console
- connect( process, SIGNAL(readyReadStandardOutput()),
- this, SLOT(readFromStdout()) );
+ // connect stdout and stderr to linbo console
+ connect( process, SIGNAL(readyReadStandardOutput()),
+ this, SLOT(readFromStdout()) );
- connect( process, SIGNAL(readyReadStandardError()),
- this, SLOT(readFromStderr()) );
+ connect( process, SIGNAL(readyReadStandardError()),
+ this, SLOT(readFromStderr()) );
- Qt::WindowFlags flags;
- flags = Qt::Dialog | Qt::WindowStaysOnTopHint | Qt::WindowTitleHint;
- setWindowFlags( flags );
+ Qt::WindowFlags flags;
+ 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;
- this->move(xpos,ypos);
- this->setFixedSize( this->width(), this->height() );
+ // open in the upper left of our screen
+ int xpos=10;
+ int ypos=10;
+ this->move(xpos,ypos);
+ this->setFixedSize( this->width(), this->height() );
}
linboPasswordBoxImpl::~linboPasswordBoxImpl()
{
- delete myTimer;
- delete process;
- delete myCounter;
+ delete myTimer;
+ delete process;
+ delete myCounter;
}
void linboPasswordBoxImpl::precmd() {
- // nothing to do
+ // nothing to do
}
void linboPasswordBoxImpl::postcmd() {
- this->hide();
- app = static_cast( myMainApp );
+ this->hide();
+ app = static_cast( myMainApp );
- if( app ) {
- // build authentication command
- arguments.clear();
- arguments.append("linbo_cmd");
- arguments.append( "authenticate" );
- arguments.append( app->config.get_server() );
- arguments.append( "linbo" );
- arguments.append( passwordInput->text() );
- arguments.append( "linbo" );
+ if( app ) {
+ // build authentication command
+ arguments.clear();
+ arguments.append("linbo_cmd");
+ arguments.append( "authenticate" );
+ arguments.append( app->config.get_server() );
+ arguments.append( "linbo" );
+ arguments.append( passwordInput->text() );
+ arguments.append( "linbo" );
- QStringList processargs( arguments );
- QString command = processargs.takeFirst();
+ QStringList processargs( arguments );
+ QString command = processargs.takeFirst();
- process->start( command, processargs );
+ process->start( command, processargs );
- while( !process->waitForFinished(10000) ) {
- };
-
- // Console->insert( QString("Test linboPasswordBoxImpl exitCode() == ") + QString::number( process->exitCode() ) );
+ while( !process->waitForFinished(10000) ) {
+ };
- if ( process->exitCode() == 0 ) {
- if( app ) {
+ // Console->insert( QString("Test linboPasswordBoxImpl exitCode() == ") + QString::number( process->exitCode() ) );
- // set password in all buttons
- QStringList tmp;
+ if ( process->exitCode() == 0 ) {
+ if( app ) {
+ // set password in all buttons
+ QStringList tmp;
- for( unsigned int i = 0; i < app->p_buttons.size(); i++ )
- {
-
- linboDialog* tmpDialog = app->p_buttons[i]->getLinboDialog();
- if( tmpDialog ) {
- // in this case, we have a sub-dialogue
- tmp = tmpDialog->getCommand();
-
- // fear the segmentation fault!
- // fifth argument is password
- if( tmp.size() > 4 ) {
+ for( unsigned int i = 0; i < app->p_buttons.size(); i++ )
+ {
- if( tmp[1] == QString("upload") ||
- tmp[1] == QString("register") ) {
-
- // change upload password
- tmp[4] = passwordInput->text();
- tmpDialog->setCommand( tmp );
- }
- }
- }
-
- // this is for the case we have no associated linbo dialog
- if( app->p_buttons[i] ) {
- tmp.clear();
- tmp = app->p_buttons[i]->getCommand();
-
- // fifth argument is password
- if( tmp.size() > 4 ) {
-
- if( tmp[1] == QString("upload") ||
- tmp[1] == QString("register") ) {
- // change upload password
- tmp[4] = passwordInput->text();
- app->p_buttons[i]->setCommand( tmp );
- }
- }
- }
- }
-
- app->enableButtons();
- app->showImagingTab();
-
- myTimer->stop();
- myTimer->start( 1000, FALSE );
- currentTimeout = app->config.get_roottimeout();
-
- myCounter->counter->display( currentTimeout );
-
- connect( myCounter->logoutButton, SIGNAL(pressed()), app, SLOT(resetButtons()) );
- connect( myCounter->logoutButton, SIGNAL(clicked()), myTimer, SLOT(stop()) );
-
- myCounter->show();
- myCounter->raise();
- myCounter->move( QPoint( 5, 5 ) );
- }
+ linboDialog* tmpDialog = app->p_buttons[i]->getLinboDialog();
+ if( tmpDialog ) {
+ // in this case, we have a sub-dialogue
+ tmp = tmpDialog->getCommand();
+
+ // fear the segmentation fault!
+ // fifth argument is password
+ if( tmp.size() > 4 ) {
+
+ if( tmp[1] == QString("upload") ||
+ tmp[1] == QString("register") ) {
+
+ // change upload password
+ tmp[4] = passwordInput->text();
+ tmpDialog->setCommand( tmp );
+ }
+ }
+ }
+
+ // this is for the case we have no associated linbo dialog
+ if( app->p_buttons[i] ) {
+ tmp.clear();
+ tmp = app->p_buttons[i]->getCommand();
+
+ // fifth argument is password
+ if( tmp.size() > 4 ) {
+
+ if( tmp[1] == QString("upload") ||
+ tmp[1] == QString("register") ) {
+ // change upload password
+ tmp[4] = passwordInput->text();
+ app->p_buttons[i]->setCommand( tmp );
+ }
+ }
+ }
+ }
+
+ app->enableButtons();
+ app->showImagingTab();
+
+ myTimer->stop();
+ myTimer->start( 1000, FALSE );
+ currentTimeout = app->config.get_roottimeout();
+
+ myCounter->counter->display( currentTimeout );
+
+ connect( myCounter->logoutButton, SIGNAL(pressed()), app, SLOT(resetButtons()) );
+ connect( myCounter->logoutButton, SIGNAL(clicked()), myTimer, SLOT(stop()) );
+
+ myCounter->show();
+ myCounter->raise();
+ myCounter->move( QPoint( 5, 5 ) );
+ }
+ }
}
- }
-
- passwordInput->clear();
- this->close();
+
+ passwordInput->clear();
+ this->close();
}
void linboPasswordBoxImpl::setCommand(const QStringList& arglist)
{
- arguments = arglist;
+ arguments = arglist;
}
QStringList linboPasswordBoxImpl::getCommand()
{
- return arguments;
+ return arguments;
}
void linboPasswordBoxImpl::setMainApp( QWidget* newMainApp ) {
- if ( newMainApp ) {
- myMainApp = newMainApp;
- }
+ if ( newMainApp ) {
+ myMainApp = newMainApp;
+ }
}
void linboPasswordBoxImpl::readFromStdout()
{
- logConsole->writeStdOut( process->readAllStandardOutput() );
+ logConsole->writeStdOut( process->readAllStandardOutput() );
}
void linboPasswordBoxImpl::readFromStderr()
{
- logConsole->writeStdErr( process->readAllStandardError() );
+ logConsole->writeStdErr( process->readAllStandardError() );
}
void linboPasswordBoxImpl::setTextBrowser( const QString& new_consolefontcolorstdout,
- const QString& new_consolefontcolorstderr,
- QTextEdit* newBrowser )
+ const QString& new_consolefontcolorstderr,
+ QTextEdit* newBrowser )
{
- logConsole->setLinboLogConsole( new_consolefontcolorstdout,
- new_consolefontcolorstderr,
- newBrowser );
+ logConsole->setLinboLogConsole( new_consolefontcolorstdout,
+ new_consolefontcolorstderr,
+ newBrowser );
}
void linboPasswordBoxImpl::processTimeout() {
- if( !myCounter->timeoutCheck->isChecked() ) {
- // do nothing but dont stop timer
- }
- else {
- if( currentTimeout > 0 ) {
- currentTimeout--;
- myCounter->counter->display( currentTimeout );
+ if( !myCounter->timeoutCheck->isChecked() ) {
+ // do nothing but dont stop timer
}
else {
- app->resetButtons();
- myCounter->close();
+ if( currentTimeout > 0 ) {
+ currentTimeout--;
+ myCounter->counter->display( currentTimeout );
+ }
+ else {
+ app->resetButtons();
+ myCounter->close();
+ }
}
- }
}
void linboPasswordBoxImpl::processFinished( int retval,
- QProcess::ExitStatus status) {
+ QProcess::ExitStatus status) {
- logConsole->writeResult( retval, status, process->error() );
+ logConsole->writeResult( retval, status, process->error() );
- // app->restoreButtonsState();
+ // app->restoreButtonsState();
}
diff --git a/sources/linbogui.cpp b/sources/linbogui.cpp
index 3aa75a5..0417ea3 100644
--- a/sources/linbogui.cpp
+++ b/sources/linbogui.cpp
@@ -16,7 +16,7 @@
** along with this program. If not, see .
****************************************************************************/
-#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
diff --git a/sources/linboosselectbutton.cpp b/sources/linboosselectbutton.cpp
index d044b3e..d891b39 100644
--- a/sources/linboosselectbutton.cpp
+++ b/sources/linboosselectbutton.cpp
@@ -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) {
diff --git a/sources/linboosselectionrow.cpp b/sources/linboosselectionrow.cpp
index 881c135..53f8c8a 100644
--- a/sources/linboosselectionrow.cpp
+++ b/sources/linboosselectionrow.cpp
@@ -1,7 +1,27 @@
-#include "../headers/linboosselectionrow.h"
+/****************************************************************************
+ ** Modern Linbo GUI
+ ** Copyright (C) 2020 Dorian Zedler
+ **
+ ** This program is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU Affero General Public License as published
+ ** by the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** This program is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU Affero General Public License for more details.
+ **
+ ** You should have received a copy of the GNU Affero General Public License
+ ** along with this program. If not, see .
+ ****************************************************************************/
+
+#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();
- else {
- 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->start();
- }
+
+ 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(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,7 +143,8 @@ void LinboOsSelectionRow::setShowOnlySelectedButton(bool value) {
this->showOnlySelectedButton = value;
- this->resizeAndPositionAllButtons();
+ if(this->inited)
+ this->resizeAndPositionAllButtons();
}
void LinboOsSelectionRow::resizeEvent(QResizeEvent *event) {
@@ -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:
diff --git a/sources/linbostartactions.cpp b/sources/linbostartactions.cpp
index ccd6720..f067503 100644
--- a/sources/linbostartactions.cpp
+++ b/sources/linbostartactions.cpp
@@ -1,4 +1,22 @@
-#include "../headers/linbostartactions.h"
+/****************************************************************************
+ ** Modern Linbo GUI
+ ** Copyright (C) 2020 Dorian Zedler
+ **
+ ** This program is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU Affero General Public License as published
+ ** by the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** This program is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU Affero General Public License for more details.
+ **
+ ** You should have received a copy of the GNU Affero General Public License
+ ** along with this program. If not, see .
+ ****************************************************************************/
+
+#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 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:
diff --git a/sources/linbostartpage.cpp b/sources/linbostartpage.cpp
index 9e693fd..589e4bd 100644
--- a/sources/linbostartpage.cpp
+++ b/sources/linbostartpage.cpp
@@ -16,10 +16,11 @@
** along with this program. If not, see .
****************************************************************************/
-#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;
}
diff --git a/sources/main.cpp b/sources/main.cpp
index 2d26e24..ae21fb7 100644
--- a/sources/main.cpp
+++ b/sources/main.cpp
@@ -1,16 +1,5 @@
-// STL-includes
-#include
-#include
#include
-#include
-#include
-// qt
-#include
-#include
-#include
-#include
-#include
-#include
+#include
#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();
}
diff --git a/sources/qmodernprogressbar.cpp b/sources/qmodernprogressbar.cpp
index b3d0d04..800a0b8 100644
--- a/sources/qmodernprogressbar.cpp
+++ b/sources/qmodernprogressbar.cpp
@@ -1,4 +1,22 @@
-#include "../headers/qmodernprogressbar.h"
+/****************************************************************************
+ ** Modern Linbo GUI
+ ** Copyright (C) 2020 Dorian Zedler
+ **
+ ** This program is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU Affero General Public License as published
+ ** by the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** This program is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU Affero General Public License for more details.
+ **
+ ** You should have received a copy of the GNU Affero General Public License
+ ** along with this program. If not, see .
+ ****************************************************************************/
+
+#include "qmodernprogressbar.h"
QModernProgressBar::QModernProgressBar(QWidget* parent) : QProgressBar(parent)
{
diff --git a/sources/qmodernpushbutton.cpp b/sources/qmodernpushbutton.cpp
index 032ebfd..876c6cb 100644
--- a/sources/qmodernpushbutton.cpp
+++ b/sources/qmodernpushbutton.cpp
@@ -16,7 +16,7 @@
** along with this program. If not, see .
****************************************************************************/
-#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);
}
diff --git a/sources/qmodernpushbuttonoverlay.cpp b/sources/qmodernpushbuttonoverlay.cpp
index b9e3219..9fe739d 100644
--- a/sources/qmodernpushbuttonoverlay.cpp
+++ b/sources/qmodernpushbuttonoverlay.cpp
@@ -1,4 +1,22 @@
- #include "../headers/qmodernpushbuttonoverlay.h"
+/****************************************************************************
+ ** Modern Linbo GUI
+ ** Copyright (C) 2020 Dorian Zedler
+ **
+ ** This program is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU Affero General Public License as published
+ ** by the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** This program is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU Affero General Public License for more details.
+ **
+ ** You should have received a copy of the GNU Affero General Public License
+ ** along with this program. If not, see .
+ ****************************************************************************/
+
+#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);
diff --git a/sources/qmodernstackedwidget.cpp b/sources/qmodernstackedwidget.cpp
index 628ee5e..3610189 100644
--- a/sources/qmodernstackedwidget.cpp
+++ b/sources/qmodernstackedwidget.cpp
@@ -1,4 +1,22 @@
-#include "../headers/qmodernstackedwidget.h"
+/****************************************************************************
+ ** Modern Linbo GUI
+ ** Copyright (C) 2020 Dorian Zedler
+ **
+ ** This program is free software: you can redistribute it and/or modify
+ ** it under the terms of the GNU Affero General Public License as published
+ ** by the Free Software Foundation, either version 3 of the License, or
+ ** (at your option) any later version.
+ **
+ ** This program is distributed in the hope that it will be useful,
+ ** but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ** GNU Affero General Public License for more details.
+ **
+ ** You should have received a copy of the GNU Affero General Public License
+ ** along with this program. If not, see .
+ ****************************************************************************/
+
+#include "qmodernstackedwidget.h"
QModernStackedWidget::QModernStackedWidget(QWidget* parent) : QStackedWidget(parent)
{