some polishing
This commit is contained in:
parent
e6d21804ef
commit
bdcb7f670a
14 changed files with 203 additions and 212 deletions
|
@ -75,32 +75,6 @@
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QPushButton" name="shutdownButton">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>600</x>
|
|
||||||
<y>390</y>
|
|
||||||
<width>33</width>
|
|
||||||
<height>33</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QPushButton" name="rebootButton">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>600</x>
|
|
||||||
<y>436</y>
|
|
||||||
<width>33</width>
|
|
||||||
<height>33</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QLabel" name="timeLabel">
|
<widget class="QLabel" name="timeLabel">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
|
@ -351,7 +325,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>10</x>
|
<x>10</x>
|
||||||
<y>390</y>
|
<y>390</y>
|
||||||
<width>581</width>
|
<width>620</width>
|
||||||
<height>80</height>
|
<height>80</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -34,6 +34,11 @@
|
||||||
#include "linboimage.h"
|
#include "linboimage.h"
|
||||||
#include "linbodiskpartition.h"
|
#include "linbodiskpartition.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The LinboBackend class is used to execute Linbo commands (control linbo_cmd) very comfortable.
|
||||||
|
*
|
||||||
|
* The LinboBackend class offeres some easy to use functions to manage all Linbo functionality
|
||||||
|
*/
|
||||||
class LinboBackend : public QObject
|
class LinboBackend : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
|
@ -25,42 +25,42 @@ class linboLogConsole;
|
||||||
|
|
||||||
class linboPasswordBoxImpl : public QWidget, public Ui::linboPasswordBox, public linboDialog
|
class linboPasswordBoxImpl : public QWidget, public Ui::linboPasswordBox, public linboDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWidget* myMainApp,*myParent;
|
QWidget* myMainApp,*myParent;
|
||||||
linboGUIImpl* app;
|
linboGUIImpl* app;
|
||||||
QStringList myCommand, arguments;
|
QStringList myCommand, arguments;
|
||||||
QProcess* process;
|
QProcess* process;
|
||||||
QString line;
|
QString line;
|
||||||
QTextEdit *Console;
|
QTextEdit *Console;
|
||||||
linboCounterImpl* myCounter;
|
linboCounterImpl* myCounter;
|
||||||
QTimer* myTimer;
|
QTimer* myTimer;
|
||||||
int currentTimeout;
|
int currentTimeout;
|
||||||
linboLogConsole *logConsole;
|
linboLogConsole *logConsole;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
linboPasswordBoxImpl( QDialog* parent = 0 );
|
linboPasswordBoxImpl( QDialog* parent = 0 );
|
||||||
|
|
||||||
~linboPasswordBoxImpl();
|
~linboPasswordBoxImpl();
|
||||||
|
|
||||||
virtual void precmd();
|
virtual void precmd();
|
||||||
virtual void setMainApp( QWidget* newMainApp );
|
virtual void setMainApp( QWidget* newMainApp );
|
||||||
virtual void setCommand(const QStringList& arglist);
|
virtual void setCommand(const QStringList& arglist);
|
||||||
virtual QStringList getCommand();
|
virtual QStringList getCommand();
|
||||||
|
|
||||||
void setTextBrowser( const QString& new_consolefontcolorstdout,
|
void setTextBrowser( const QString& new_consolefontcolorstdout,
|
||||||
const QString& new_consolefontcolorstderr,
|
const QString& new_consolefontcolorstderr,
|
||||||
QTextEdit* newBrowser );
|
QTextEdit* newBrowser );
|
||||||
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void postcmd();
|
virtual void postcmd();
|
||||||
void readFromStdout();
|
void readFromStdout();
|
||||||
void readFromStderr();
|
void readFromStderr();
|
||||||
void processTimeout();
|
void processTimeout();
|
||||||
void processFinished( int retval,
|
void processFinished( int retval,
|
||||||
QProcess::ExitStatus status);
|
QProcess::ExitStatus status);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,12 +3,10 @@ DEPENDPATH += .
|
||||||
INCLUDEPATH += .
|
INCLUDEPATH += .
|
||||||
CFLAGS += -DQWS -static
|
CFLAGS += -DQWS -static
|
||||||
QT += \
|
QT += \
|
||||||
qt3support \
|
#qt3support \
|
||||||
widgets \
|
gui \
|
||||||
widgets \
|
|
||||||
widgets \
|
|
||||||
widgets \
|
|
||||||
svg
|
svg
|
||||||
|
|
||||||
QMAKE_POST_LINK=strip $(TARGET)
|
QMAKE_POST_LINK=strip $(TARGET)
|
||||||
|
|
||||||
# deployment
|
# deployment
|
||||||
|
|
|
@ -45,7 +45,7 @@ QString LinboLogger::logTypeToString(LinboLogType logType) {
|
||||||
void LinboLogger::log(QString logText, LinboLogType logType) {
|
void LinboLogger::log(QString logText, LinboLogType logType) {
|
||||||
if(logText.isEmpty() || logText == "")
|
if(logText.isEmpty() || logText == "")
|
||||||
return;
|
return;
|
||||||
qDebug() << qPrintable("[" + this->logTypeToString(logType) + "]") << logText;
|
qDebug() << qPrintable("[" + this->logTypeToString(logType) + "] " + logText);
|
||||||
|
|
||||||
LinboLog latestLog {logText, logType, QDateTime::currentDateTime()};
|
LinboLog latestLog {logText, logType, QDateTime::currentDateTime()};
|
||||||
this->logHistory.append(latestLog);
|
this->logHistory.append(latestLog);
|
||||||
|
|
|
@ -109,6 +109,8 @@ void linboConsoleImpl::readFromStderr()
|
||||||
|
|
||||||
void linboConsoleImpl::processFinished( int retval,
|
void linboConsoleImpl::processFinished( int retval,
|
||||||
QProcess::ExitStatus status) {
|
QProcess::ExitStatus status) {
|
||||||
|
Q_UNUSED(retval)
|
||||||
|
Q_UNUSED(status)
|
||||||
// nothing to do
|
// nothing to do
|
||||||
static_cast<linboGUIImpl*>(myMainApp)->restoreButtonsState();
|
static_cast<linboGUIImpl*>(myMainApp)->restoreButtonsState();
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,8 @@ void linboCounterImpl::setCommand(const QStringList& arglist)
|
||||||
|
|
||||||
void linboCounterImpl::processFinished( int retval,
|
void linboCounterImpl::processFinished( int retval,
|
||||||
QProcess::ExitStatus status) {
|
QProcess::ExitStatus status) {
|
||||||
|
Q_UNUSED(retval)
|
||||||
|
Q_UNUSED(status)
|
||||||
// nothing to do
|
// nothing to do
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -304,7 +304,7 @@ linboGUIImpl::linboGUIImpl(QWidget* parent) : QDialog(parent)
|
||||||
logfilepath = QString("/tmp/linbo.log");
|
logfilepath = QString("/tmp/linbo.log");
|
||||||
|
|
||||||
// connect our shutdown and reboot buttons
|
// connect our shutdown and reboot buttons
|
||||||
connect( shutdownButton, SIGNAL(clicked()), this, SLOT(shutdown()) );
|
/*connect( shutdownButton, SIGNAL(clicked()), this, SLOT(shutdown()) );
|
||||||
connect( rebootButton, SIGNAL(clicked()), this, SLOT(reboot()) );
|
connect( rebootButton, SIGNAL(clicked()), this, SLOT(reboot()) );
|
||||||
|
|
||||||
// set and scale up our icons
|
// set and scale up our icons
|
||||||
|
@ -314,7 +314,7 @@ linboGUIImpl::linboGUIImpl(QWidget* parent) : QDialog(parent)
|
||||||
|
|
||||||
shutdownButton->setIconSet( QIcon(":/icons/system-shutdown-32x32.png" ) );
|
shutdownButton->setIconSet( QIcon(":/icons/system-shutdown-32x32.png" ) );
|
||||||
shutdownButton->setIconSize(QSize(32,32));
|
shutdownButton->setIconSize(QSize(32,32));
|
||||||
QToolTip::add( shutdownButton, QString("Schaltet den Rechner aus.") );
|
QToolTip::add( shutdownButton, QString("Schaltet den Rechner aus.") );*/
|
||||||
|
|
||||||
hdlogowidget->setPixmap( QPixmap(":/icons/drive-harddisk-64x64.png" ) );
|
hdlogowidget->setPixmap( QPixmap(":/icons/drive-harddisk-64x64.png" ) );
|
||||||
// hdlogowidget->setIconSize(QSize(64,64));
|
// hdlogowidget->setIconSize(QSize(64,64));
|
||||||
|
@ -409,17 +409,17 @@ linboGUIImpl::linboGUIImpl(QWidget* parent) : QDialog(parent)
|
||||||
|
|
||||||
// since some tabs can be hidden, we have to maintain this counter
|
// since some tabs can be hidden, we have to maintain this counter
|
||||||
int nextPosForTabInsert = 0;
|
int nextPosForTabInsert = 0;
|
||||||
int horizontalOffset = 0;
|
//int horizontalOffset = 0;
|
||||||
// this is for separating the elements
|
// this is for separating the elements
|
||||||
int innerVerticalOffset = 32;
|
//int innerVerticalOffset = 32;
|
||||||
|
|
||||||
for( unsigned int i = 0; i < elements.size(); i++ ) {
|
for( unsigned int i = 0; i < elements.size(); i++ ) {
|
||||||
// this determines our vertical offset
|
// this determines our vertical offset
|
||||||
if( i % 2 == 1 ) {
|
if( i % 2 == 1 ) {
|
||||||
// an odd element is moved to the right
|
// an odd element is moved to the right
|
||||||
horizontalOffset = 300;
|
//horizontalOffset = 300;
|
||||||
} else {
|
} else {
|
||||||
horizontalOffset = 0;
|
//horizontalOffset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int n = elements[i].find_current_image();
|
int n = elements[i].find_current_image();
|
||||||
|
|
|
@ -287,9 +287,9 @@ void linboImageSelectorImpl::postcmd() {
|
||||||
upload = false;
|
upload = false;
|
||||||
|
|
||||||
if ( this->checkShutdown->isChecked() ) {
|
if ( this->checkShutdown->isChecked() ) {
|
||||||
system("busybox poweroff");
|
QProcess::execute("busybox poweroff");
|
||||||
} else if ( this->checkReboot->isChecked() ) {
|
} else if ( this->checkReboot->isChecked() ) {
|
||||||
system("busybox reboot");
|
QProcess::execute("busybox reboot");
|
||||||
}
|
}
|
||||||
this->close();
|
this->close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,40 +9,40 @@
|
||||||
|
|
||||||
linboImageUploadImpl::linboImageUploadImpl( QWidget* parent ) : linboDialog()
|
linboImageUploadImpl::linboImageUploadImpl( QWidget* parent ) : linboDialog()
|
||||||
{
|
{
|
||||||
Ui_linboImageUpload::setupUi((QDialog*)this);
|
Ui_linboImageUpload::setupUi((QDialog*)this);
|
||||||
process = new QProcess( this );
|
process = new QProcess( this );
|
||||||
|
|
||||||
if( parent )
|
if( parent )
|
||||||
myParent = parent;
|
myParent = parent;
|
||||||
|
|
||||||
connect( cancelButton, SIGNAL(pressed()), this, SLOT(close()) );
|
connect( cancelButton, SIGNAL(pressed()), this, SLOT(close()) );
|
||||||
connect( okButton, SIGNAL(pressed()), this, SLOT(postcmd()) );
|
connect( okButton, SIGNAL(pressed()), this, SLOT(postcmd()) );
|
||||||
|
|
||||||
// connect SLOT for finished process
|
// connect SLOT for finished process
|
||||||
connect( process, SIGNAL(finished(int, QProcess::ExitStatus) ),
|
connect( process, SIGNAL(finished(int, QProcess::ExitStatus) ),
|
||||||
this, SLOT(processFinished(int, QProcess::ExitStatus)) );
|
this, SLOT(processFinished(int, QProcess::ExitStatus)) );
|
||||||
|
|
||||||
// connect stdout and stderr to linbo console
|
// connect stdout and stderr to linbo console
|
||||||
connect( process, SIGNAL(readyReadStandardOutput()),
|
connect( process, SIGNAL(readyReadStandardOutput()),
|
||||||
this, SLOT(readFromStdout()) );
|
this, SLOT(readFromStdout()) );
|
||||||
connect( process, SIGNAL(readyReadStandardError()),
|
connect( process, SIGNAL(readyReadStandardError()),
|
||||||
this, SLOT(readFromStderr()) );
|
this, SLOT(readFromStderr()) );
|
||||||
|
|
||||||
|
|
||||||
Qt::WindowFlags flags;
|
Qt::WindowFlags flags;
|
||||||
flags = Qt::Dialog | Qt::WindowStaysOnTopHint | Qt::WindowTitleHint;
|
flags = Qt::Dialog | Qt::WindowStaysOnTopHint | Qt::WindowTitleHint;
|
||||||
setWindowFlags( flags );
|
setWindowFlags( flags );
|
||||||
|
|
||||||
progwindow = new linboProgressImpl(0);
|
progwindow = new linboProgressImpl(0);
|
||||||
|
|
||||||
logConsole = new linboLogConsole(0);
|
logConsole = new linboLogConsole(0);
|
||||||
|
|
||||||
QRect qRect(QApplication::desktop()->screenGeometry());
|
QRect qRect(QApplication::desktop()->screenGeometry());
|
||||||
// open in the center of our screen
|
// open in the center of our screen
|
||||||
int xpos=qRect.width()/2-this->width()/2;
|
int xpos=qRect.width()/2-this->width()/2;
|
||||||
int ypos=qRect.height()/2-this->height()/2;
|
int ypos=qRect.height()/2-this->height()/2;
|
||||||
this->move(xpos,ypos);
|
this->move(xpos,ypos);
|
||||||
this->setFixedSize( this->width(), this->height() );
|
this->setFixedSize( this->width(), this->height() );
|
||||||
}
|
}
|
||||||
|
|
||||||
linboImageUploadImpl::~linboImageUploadImpl()
|
linboImageUploadImpl::~linboImageUploadImpl()
|
||||||
|
@ -50,105 +50,105 @@ linboImageUploadImpl::~linboImageUploadImpl()
|
||||||
}
|
}
|
||||||
|
|
||||||
void linboImageUploadImpl::setTextBrowser( const QString& new_consolefontcolorstdout,
|
void linboImageUploadImpl::setTextBrowser( const QString& new_consolefontcolorstdout,
|
||||||
const QString& new_consolefontcolorstderr,
|
const QString& new_consolefontcolorstderr,
|
||||||
QTextEdit* newBrowser )
|
QTextEdit* newBrowser )
|
||||||
{
|
{
|
||||||
logConsole->setLinboLogConsole( new_consolefontcolorstdout,
|
logConsole->setLinboLogConsole( new_consolefontcolorstdout,
|
||||||
new_consolefontcolorstderr,
|
new_consolefontcolorstderr,
|
||||||
newBrowser );
|
newBrowser );
|
||||||
}
|
}
|
||||||
|
|
||||||
void linboImageUploadImpl::setMainApp( QWidget* newMainApp ) {
|
void linboImageUploadImpl::setMainApp( QWidget* newMainApp ) {
|
||||||
myMainApp = newMainApp;
|
myMainApp = newMainApp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void linboImageUploadImpl::precmd() {
|
void linboImageUploadImpl::precmd() {
|
||||||
// nothing to do
|
// nothing to do
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void linboImageUploadImpl::postcmd() {
|
void linboImageUploadImpl::postcmd() {
|
||||||
|
|
||||||
app = static_cast<linboGUIImpl*>( myMainApp );
|
|
||||||
|
|
||||||
this->hide();
|
|
||||||
arguments[6] = listBox->currentText();
|
|
||||||
|
|
||||||
|
app = static_cast<linboGUIImpl*>( myMainApp );
|
||||||
if( app ) {
|
|
||||||
// do something
|
|
||||||
|
|
||||||
progwindow->setProcess( process );
|
this->hide();
|
||||||
// connect( process, SIGNAL(processExited()), progwindow, SLOT(close()));
|
arguments[6] = listBox->currentText();
|
||||||
progwindow->show();
|
|
||||||
progwindow->raise();
|
|
||||||
|
|
||||||
progwindow->setActiveWindow();
|
|
||||||
progwindow->setUpdatesEnabled( true );
|
|
||||||
progwindow->setEnabled( true );
|
|
||||||
|
|
||||||
app->disableButtons();
|
|
||||||
|
|
||||||
|
|
||||||
QStringList processargs( arguments );
|
if( app ) {
|
||||||
QString command = processargs.takeFirst();
|
// do something
|
||||||
|
|
||||||
logConsole->writeStdErr( QString("Executing ") + command + processargs.join(" ") );
|
progwindow->setProcess( process );
|
||||||
|
// connect( process, SIGNAL(processExited()), progwindow, SLOT(close()));
|
||||||
|
progwindow->show();
|
||||||
|
progwindow->raise();
|
||||||
|
|
||||||
progwindow->startTimer();
|
progwindow->setActiveWindow();
|
||||||
process->start( command, processargs );
|
progwindow->setUpdatesEnabled( true );
|
||||||
|
progwindow->setEnabled( true );
|
||||||
|
|
||||||
while( process->state() == QProcess::Running ) {
|
app->disableButtons();
|
||||||
for( int i = 0; i <= 100; i++ ) {
|
|
||||||
usleep(10000);
|
|
||||||
progwindow->progressBar->setValue(i);
|
QStringList processargs( arguments );
|
||||||
progwindow->update();
|
QString command = processargs.takeFirst();
|
||||||
|
|
||||||
qApp->processEvents();
|
logConsole->writeStdErr( QString("Executing ") + command + processargs.join(" ") );
|
||||||
}
|
|
||||||
|
progwindow->startTimer();
|
||||||
|
process->start( command, processargs );
|
||||||
|
|
||||||
|
while( process->state() == QProcess::Running ) {
|
||||||
|
for( int i = 0; i <= 100; i++ ) {
|
||||||
|
usleep(10000);
|
||||||
|
progwindow->progressBar->setValue(i);
|
||||||
|
progwindow->update();
|
||||||
|
|
||||||
|
qApp->processEvents();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ( this->checkShutdown->isChecked() ) {
|
if ( this->checkShutdown->isChecked() ) {
|
||||||
system("busybox poweroff");
|
QProcess::execute("busybox poweroff");
|
||||||
} else if ( this->checkReboot->isChecked() ) {
|
} else if ( this->checkReboot->isChecked() ) {
|
||||||
system("busybox reboot");
|
QProcess::execute("busybox reboot");
|
||||||
}
|
}
|
||||||
|
|
||||||
this->close();
|
this->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void linboImageUploadImpl::setCommand(const QStringList& arglist)
|
void linboImageUploadImpl::setCommand(const QStringList& arglist)
|
||||||
{
|
{
|
||||||
arguments = arglist;
|
arguments = arglist;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList linboImageUploadImpl::getCommand()
|
QStringList linboImageUploadImpl::getCommand()
|
||||||
{
|
{
|
||||||
return arguments;
|
return arguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
void linboImageUploadImpl::readFromStdout()
|
void linboImageUploadImpl::readFromStdout()
|
||||||
{
|
{
|
||||||
logConsole->writeStdOut( process->readAllStandardOutput() );
|
logConsole->writeStdOut( process->readAllStandardOutput() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void linboImageUploadImpl::readFromStderr()
|
void linboImageUploadImpl::readFromStderr()
|
||||||
{
|
{
|
||||||
logConsole->writeStdErr( process->readAllStandardError() );
|
logConsole->writeStdErr( process->readAllStandardError() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void linboImageUploadImpl::processFinished( int retval,
|
void linboImageUploadImpl::processFinished( int retval,
|
||||||
QProcess::ExitStatus status) {
|
QProcess::ExitStatus status) {
|
||||||
|
|
||||||
logConsole->writeResult( retval, status, process->error() );
|
logConsole->writeResult( retval, status, process->error() );
|
||||||
|
|
||||||
app->restoreButtonsState();
|
|
||||||
|
|
||||||
if( progwindow ) {
|
app->restoreButtonsState();
|
||||||
progwindow->close();
|
|
||||||
}
|
if( progwindow ) {
|
||||||
|
progwindow->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,11 +23,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
#include "linboLogConsole.hh"
|
#include "linboLogConsole.hh"
|
||||||
|
|
||||||
linboLogConsole::linboLogConsole( QWidget* parent,
|
linboLogConsole::linboLogConsole( QWidget* parent,
|
||||||
const char* name )
|
const char* name )
|
||||||
{
|
{
|
||||||
consolefontcolorstdout = QColor( QString("white") );
|
Q_UNUSED(parent)
|
||||||
consolefontcolorstderr = QColor( QString("red") );
|
Q_UNUSED(name)
|
||||||
Console = 0;
|
consolefontcolorstdout = QColor( QString("white") );
|
||||||
|
consolefontcolorstderr = QColor( QString("red") );
|
||||||
|
Console = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
linboLogConsole::~linboLogConsole() {
|
linboLogConsole::~linboLogConsole() {
|
||||||
|
@ -36,93 +38,93 @@ linboLogConsole::~linboLogConsole() {
|
||||||
|
|
||||||
|
|
||||||
void linboLogConsole::setLinboLogConsole( const QString& new_consolefontcolorstdout,
|
void linboLogConsole::setLinboLogConsole( const QString& new_consolefontcolorstdout,
|
||||||
const QString& new_consolefontcolorstderr,
|
const QString& new_consolefontcolorstderr,
|
||||||
QTextEdit* new_console ) {
|
QTextEdit* new_console ) {
|
||||||
|
|
||||||
consolefontcolorstdout = QColor( new_consolefontcolorstdout );
|
consolefontcolorstdout = QColor( new_consolefontcolorstdout );
|
||||||
consolefontcolorstderr = QColor( new_consolefontcolorstderr );
|
consolefontcolorstderr = QColor( new_consolefontcolorstderr );
|
||||||
|
|
||||||
if ( new_console != 0 )
|
if ( new_console != 0 )
|
||||||
Console = new_console;
|
Console = new_console;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void linboLogConsole::writeStdOut( const QByteArray& stdoutdata ) {
|
void linboLogConsole::writeStdOut( const QByteArray& stdoutdata ) {
|
||||||
|
|
||||||
if ( Console != 0 ) {
|
if ( Console != 0 ) {
|
||||||
Console->setColor( consolefontcolorstdout );
|
Console->setColor( consolefontcolorstdout );
|
||||||
Console->insert( stdoutdata );
|
Console->insert( stdoutdata );
|
||||||
Console->moveCursor(QTextCursor::End);
|
Console->moveCursor(QTextCursor::End);
|
||||||
Console->ensureCursorVisible();
|
Console->ensureCursorVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void linboLogConsole::writeStdOut( const QString& stdoutdata ) {
|
void linboLogConsole::writeStdOut( const QString& stdoutdata ) {
|
||||||
|
|
||||||
if ( Console != 0 ) {
|
if ( Console != 0 ) {
|
||||||
Console->setColor( consolefontcolorstdout );
|
Console->setColor( consolefontcolorstdout );
|
||||||
Console->insert( stdoutdata );
|
Console->insert( stdoutdata );
|
||||||
Console->insert(QString(QChar::LineSeparator));
|
Console->insert(QString(QChar::LineSeparator));
|
||||||
Console->moveCursor(QTextCursor::End);
|
Console->moveCursor(QTextCursor::End);
|
||||||
Console->ensureCursorVisible();
|
Console->ensureCursorVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void linboLogConsole::writeStdErr( const QByteArray& stderrdata ) {
|
void linboLogConsole::writeStdErr( const QByteArray& stderrdata ) {
|
||||||
if ( Console != 0 ) {
|
if ( Console != 0 ) {
|
||||||
|
|
||||||
Console->setColor( consolefontcolorstderr );
|
Console->setColor( consolefontcolorstderr );
|
||||||
Console->insert( stderrdata );
|
Console->insert( stderrdata );
|
||||||
Console->setColor( consolefontcolorstdout );
|
Console->setColor( consolefontcolorstdout );
|
||||||
Console->moveCursor(QTextCursor::End);
|
Console->moveCursor(QTextCursor::End);
|
||||||
Console->ensureCursorVisible();
|
Console->ensureCursorVisible();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void linboLogConsole::writeStdErr( const QString& stderrdata ) {
|
void linboLogConsole::writeStdErr( const QString& stderrdata ) {
|
||||||
if ( Console != 0 ) {
|
if ( Console != 0 ) {
|
||||||
|
|
||||||
Console->setColor( consolefontcolorstderr );
|
Console->setColor( consolefontcolorstderr );
|
||||||
Console->insert( stderrdata );
|
Console->insert( stderrdata );
|
||||||
Console->insert(QString(QChar::LineSeparator));
|
Console->insert(QString(QChar::LineSeparator));
|
||||||
Console->setColor( consolefontcolorstdout );
|
Console->setColor( consolefontcolorstdout );
|
||||||
Console->moveCursor(QTextCursor::End);
|
Console->moveCursor(QTextCursor::End);
|
||||||
Console->ensureCursorVisible();
|
Console->ensureCursorVisible();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void linboLogConsole::writeResult( const int& processRetval,
|
void linboLogConsole::writeResult( const int& processRetval,
|
||||||
QProcess::ExitStatus status,
|
QProcess::ExitStatus status,
|
||||||
const int& errorstatus ) {
|
const int& errorstatus ) {
|
||||||
|
|
||||||
if ( Console != 0 ) {
|
if ( Console != 0 ) {
|
||||||
Console->setColor( consolefontcolorstderr );
|
Console->setColor( consolefontcolorstderr );
|
||||||
Console->insert( QString("Command executed with exit value ") + QString::number( processRetval ) );
|
Console->insert( QString("Command executed with exit value ") + QString::number( processRetval ) );
|
||||||
|
|
||||||
if( status == 0)
|
if( status == 0)
|
||||||
Console->insert( QString("Exit status: ") + QString("The process exited normally.") );
|
Console->insert( QString("Exit status: ") + QString("The process exited normally.") );
|
||||||
else
|
else
|
||||||
Console->insert( QString("Exit status: ") + QString("The process crashed.") );
|
Console->insert( QString("Exit status: ") + QString("The process crashed.") );
|
||||||
|
|
||||||
if( status == 1 ) {
|
if( status == 1 ) {
|
||||||
switch ( errorstatus ) {
|
switch ( errorstatus ) {
|
||||||
case 0: Console->insert( QString("The process failed to start. Either the invoked program is missing, or you may have insufficient permissions to invoke the program.") ); break;
|
case 0: Console->insert( QString("The process failed to start. Either the invoked program is missing, or you may have insufficient permissions to invoke the program.") ); break;
|
||||||
case 1: Console->insert( QString("The process crashed some time after starting successfully.") ); break;
|
case 1: Console->insert( QString("The process crashed some time after starting successfully.") ); break;
|
||||||
case 2: Console->insert( QString("The last waitFor...() function timed out.") ); break;
|
case 2: Console->insert( QString("The last waitFor...() function timed out.") ); break;
|
||||||
case 3: Console->insert( QString("An error occurred when attempting to write to the process. For example, the process may not be running, or it may have closed its input channel.") ); break;
|
case 3: Console->insert( QString("An error occurred when attempting to write to the process. For example, the process may not be running, or it may have closed its input channel.") ); break;
|
||||||
case 4: Console->insert( QString("An error occurred when attempting to read from the process. For example, the process may not be running.") ); break;
|
case 4: Console->insert( QString("An error occurred when attempting to read from the process. For example, the process may not be running.") ); break;
|
||||||
case 5: Console->insert( QString("An unknown error occurred.") ); break;
|
case 5: Console->insert( QString("An unknown error occurred.") ); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
Console->insert(QString(QChar::LineSeparator));
|
||||||
|
|
||||||
|
Console->setColor( consolefontcolorstdout );
|
||||||
|
Console->moveCursor(QTextCursor::End);
|
||||||
|
Console->ensureCursorVisible();
|
||||||
}
|
}
|
||||||
Console->insert(QString(QChar::LineSeparator));
|
|
||||||
|
|
||||||
Console->setColor( consolefontcolorstdout );
|
|
||||||
Console->moveCursor(QTextCursor::End);
|
|
||||||
Console->ensureCursorVisible();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,6 +85,8 @@ void linboMsgImpl::readFromStderr()
|
||||||
|
|
||||||
void linboMsgImpl::processFinished( int retval,
|
void linboMsgImpl::processFinished( int retval,
|
||||||
QProcess::ExitStatus status) {
|
QProcess::ExitStatus status) {
|
||||||
|
Q_UNUSED(retval)
|
||||||
|
Q_UNUSED(status)
|
||||||
// let user read the process results
|
// let user read the process results
|
||||||
this->close();
|
this->close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,6 @@ void linboPasswordBoxImpl::precmd() {
|
||||||
|
|
||||||
void linboPasswordBoxImpl::postcmd() {
|
void linboPasswordBoxImpl::postcmd() {
|
||||||
|
|
||||||
this->hide();
|
|
||||||
app = static_cast<linboGUIImpl*>( myMainApp );
|
app = static_cast<linboGUIImpl*>( myMainApp );
|
||||||
|
|
||||||
if( app ) {
|
if( app ) {
|
||||||
|
@ -145,12 +144,17 @@ void linboPasswordBoxImpl::postcmd() {
|
||||||
myCounter->show();
|
myCounter->show();
|
||||||
myCounter->raise();
|
myCounter->raise();
|
||||||
myCounter->move( QPoint( 5, 5 ) );
|
myCounter->move( QPoint( 5, 5 ) );
|
||||||
|
|
||||||
|
this->close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
this->passwordLabel->setText("Falsches Passwort!");
|
||||||
|
this->passwordLabel->setStyleSheet("QLabel { color : red; }");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
passwordInput->clear();
|
passwordInput->clear();
|
||||||
this->close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void linboPasswordBoxImpl::setCommand(const QStringList& arglist)
|
void linboPasswordBoxImpl::setCommand(const QStringList& arglist)
|
||||||
|
|
|
@ -90,6 +90,8 @@ void linboProgressImpl::processTimer() {
|
||||||
|
|
||||||
void linboProgressImpl::processFinished( int retval,
|
void linboProgressImpl::processFinished( int retval,
|
||||||
QProcess::ExitStatus status) {
|
QProcess::ExitStatus status) {
|
||||||
|
Q_UNUSED(retval)
|
||||||
|
Q_UNUSED(status)
|
||||||
myTimer->stop();
|
myTimer->stop();
|
||||||
this->close();
|
this->close();
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue