add log widget to ExecutionViewStep
This commit is contained in:
parent
d4812bbb36
commit
a6afb6be7c
@ -30,6 +30,14 @@
|
|||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QProgressBar>
|
#include <QProgressBar>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
#include <QHBoxLayout>
|
||||||
|
#include <QToolBar>
|
||||||
|
#include <QAction>
|
||||||
|
#include <QToolButton>
|
||||||
|
#include <QTabWidget>
|
||||||
|
#include <QPlainTextEdit>
|
||||||
|
#include <QTabBar>
|
||||||
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
static Calamares::Slideshow*
|
static Calamares::Slideshow*
|
||||||
makeSlideshow( QWidget* parent )
|
makeSlideshow( QWidget* parent )
|
||||||
@ -60,23 +68,43 @@ ExecutionViewStep::ExecutionViewStep( QObject* parent )
|
|||||||
, m_progressBar( new QProgressBar )
|
, m_progressBar( new QProgressBar )
|
||||||
, m_label( new QLabel )
|
, m_label( new QLabel )
|
||||||
, m_slideshow( makeSlideshow( m_widget ) )
|
, m_slideshow( makeSlideshow( m_widget ) )
|
||||||
|
, m_tab_widget( new QTabWidget )
|
||||||
{
|
{
|
||||||
m_widget->setObjectName( "slideshow" );
|
m_widget->setObjectName( "slideshow" );
|
||||||
m_progressBar->setObjectName( "exec-progress" );
|
m_progressBar->setObjectName( "exec-progress" );
|
||||||
m_label->setObjectName( "exec-message" );
|
m_label->setObjectName( "exec-message" );
|
||||||
|
|
||||||
QVBoxLayout* layout = new QVBoxLayout( m_widget );
|
QVBoxLayout* layout = new QVBoxLayout( m_widget );
|
||||||
QVBoxLayout* innerLayout = new QVBoxLayout;
|
QVBoxLayout* bottomLayout = new QVBoxLayout;
|
||||||
|
QHBoxLayout* barLayout = new QHBoxLayout;
|
||||||
|
|
||||||
m_progressBar->setMaximum( 10000 );
|
m_progressBar->setMaximum( 10000 );
|
||||||
|
|
||||||
layout->addWidget( m_slideshow->widget() );
|
auto m_log_widget = new QPlainTextEdit;
|
||||||
CalamaresUtils::unmarginLayout( layout );
|
m_log_widget->setReadOnly(true);
|
||||||
layout->addLayout( innerLayout );
|
|
||||||
|
|
||||||
|
m_tab_widget->addTab(m_slideshow->widget(), "Slideshow");
|
||||||
|
m_tab_widget->addTab(m_log_widget, "Log");
|
||||||
|
m_tab_widget->tabBar()->hide();
|
||||||
|
|
||||||
|
layout->addWidget( m_tab_widget );
|
||||||
|
CalamaresUtils::unmarginLayout( layout );
|
||||||
|
layout->addLayout( bottomLayout );
|
||||||
|
|
||||||
|
bottomLayout->addSpacing( CalamaresUtils::defaultFontHeight() / 2 );
|
||||||
|
bottomLayout->addLayout( barLayout );
|
||||||
|
bottomLayout->addWidget( m_label );
|
||||||
|
|
||||||
|
QToolBar* toolBar = new QToolBar;
|
||||||
|
auto toggleLogAction = toolBar->addAction(QIcon::fromTheme("file-icon"), "Toggle log");
|
||||||
|
auto toggleLogButton = dynamic_cast<QToolButton*>(toolBar->widgetForAction(toggleLogAction));
|
||||||
|
connect( toggleLogButton, &QToolButton::clicked, this, &ExecutionViewStep::toggleLog );
|
||||||
|
|
||||||
|
|
||||||
|
barLayout->addWidget(m_progressBar);
|
||||||
|
barLayout->addWidget(toolBar);
|
||||||
|
|
||||||
innerLayout->addSpacing( CalamaresUtils::defaultFontHeight() / 2 );
|
|
||||||
innerLayout->addWidget( m_progressBar );
|
|
||||||
innerLayout->addWidget( m_label );
|
|
||||||
|
|
||||||
connect( JobQueue::instance(), &JobQueue::progress, this, &ExecutionViewStep::updateFromJobQueue );
|
connect( JobQueue::instance(), &JobQueue::progress, this, &ExecutionViewStep::updateFromJobQueue );
|
||||||
}
|
}
|
||||||
@ -200,6 +228,12 @@ ExecutionViewStep::updateFromJobQueue( qreal percent, const QString& message )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ExecutionViewStep::toggleLog()
|
||||||
|
{
|
||||||
|
m_tab_widget->setCurrentIndex((m_tab_widget->currentIndex() + 1) % m_tab_widget->count());
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ExecutionViewStep::onLeave()
|
ExecutionViewStep::onLeave()
|
||||||
{
|
{
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
class QLabel;
|
class QLabel;
|
||||||
class QObject;
|
class QObject;
|
||||||
class QProgressBar;
|
class QProgressBar;
|
||||||
|
class QTabWidget;
|
||||||
|
class QPlainTextEdit;
|
||||||
|
|
||||||
namespace Calamares
|
namespace Calamares
|
||||||
{
|
{
|
||||||
@ -56,10 +58,14 @@ private:
|
|||||||
QProgressBar* m_progressBar;
|
QProgressBar* m_progressBar;
|
||||||
QLabel* m_label;
|
QLabel* m_label;
|
||||||
Slideshow* m_slideshow;
|
Slideshow* m_slideshow;
|
||||||
|
QTabWidget* m_tab_widget;
|
||||||
|
QPlainTextEdit* m_log_widget;
|
||||||
|
|
||||||
QList< ModuleSystem::InstanceKey > m_jobInstanceKeys;
|
QList< ModuleSystem::InstanceKey > m_jobInstanceKeys;
|
||||||
|
|
||||||
void updateFromJobQueue( qreal percent, const QString& message );
|
void updateFromJobQueue( qreal percent, const QString& message );
|
||||||
|
|
||||||
|
void toggleLog();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Calamares
|
} // namespace Calamares
|
||||||
|
Loading…
Reference in New Issue
Block a user