|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
|
|
|
|
*
|
|
|
|
|
* Copyright 2015-2016, Teo Mrnjavac <teo@kde.org>
|
|
|
|
|
* Copyright 2019, Adriaan de Groot <groot@kde.org>
|
|
|
|
|
*
|
|
|
|
|
* Calamares is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
@ -17,6 +18,8 @@
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "DebugWindow.h"
|
|
|
|
|
#include "ui_DebugWindow.h"
|
|
|
|
|
|
|
|
|
|
#include "utils/Retranslator.h"
|
|
|
|
|
#include "utils/qjsonmodel.h"
|
|
|
|
|
#include "JobQueue.h"
|
|
|
|
@ -51,26 +54,27 @@ namespace Calamares {
|
|
|
|
|
|
|
|
|
|
DebugWindow::DebugWindow()
|
|
|
|
|
: QWidget( nullptr )
|
|
|
|
|
, m_ui( new Ui::DebugWindow )
|
|
|
|
|
{
|
|
|
|
|
setupUi( this );
|
|
|
|
|
m_ui->setupUi( this );
|
|
|
|
|
|
|
|
|
|
// GlobalStorage page
|
|
|
|
|
QJsonModel* jsonModel = new QJsonModel( this );
|
|
|
|
|
|
|
|
|
|
globalStorageView->setModel( jsonModel );
|
|
|
|
|
m_ui->globalStorageView->setModel( jsonModel );
|
|
|
|
|
GlobalStorage* gs = JobQueue::instance()->globalStorage();
|
|
|
|
|
|
|
|
|
|
connect( gs, &GlobalStorage::changed,
|
|
|
|
|
this, [ = ]
|
|
|
|
|
{
|
|
|
|
|
jsonModel->loadJson( QJsonDocument::fromVariant( gs->m ).toJson() );
|
|
|
|
|
globalStorageView->expandAll();
|
|
|
|
|
m_ui->globalStorageView->expandAll();
|
|
|
|
|
} );
|
|
|
|
|
jsonModel->loadJson( QJsonDocument::fromVariant( gs->m ).toJson() );
|
|
|
|
|
globalStorageView->expandAll();
|
|
|
|
|
m_ui->globalStorageView->expandAll();
|
|
|
|
|
|
|
|
|
|
// JobQueue page
|
|
|
|
|
jobQueueText->setReadOnly( true );
|
|
|
|
|
m_ui->jobQueueText->setReadOnly( true );
|
|
|
|
|
connect( JobQueue::instance(), &JobQueue::queueChanged,
|
|
|
|
|
this, [ this ]( const JobList& jobs )
|
|
|
|
|
{
|
|
|
|
@ -80,16 +84,16 @@ DebugWindow::DebugWindow()
|
|
|
|
|
text.append( job->prettyName() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
jobQueueText->setText( text.join( '\n' ) );
|
|
|
|
|
m_ui->jobQueueText->setText( text.join( '\n' ) );
|
|
|
|
|
} );
|
|
|
|
|
|
|
|
|
|
// Modules page
|
|
|
|
|
QStringListModel* modulesModel = new QStringListModel( ModuleManager::instance()->loadedInstanceKeys() );
|
|
|
|
|
modulesListView->setModel( modulesModel );
|
|
|
|
|
modulesListView->setSelectionMode( QAbstractItemView::SingleSelection );
|
|
|
|
|
m_ui->modulesListView->setModel( modulesModel );
|
|
|
|
|
m_ui->modulesListView->setSelectionMode( QAbstractItemView::SingleSelection );
|
|
|
|
|
|
|
|
|
|
QJsonModel* moduleConfigModel = new QJsonModel( this );
|
|
|
|
|
moduleConfigView->setModel( moduleConfigModel );
|
|
|
|
|
m_ui->moduleConfigView->setModel( moduleConfigModel );
|
|
|
|
|
|
|
|
|
|
#ifdef WITH_PYTHONQT
|
|
|
|
|
QPushButton* pythonConsoleButton = new QPushButton;
|
|
|
|
@ -159,21 +163,21 @@ DebugWindow::DebugWindow()
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
connect( modulesListView->selectionModel(), &QItemSelectionModel::selectionChanged,
|
|
|
|
|
connect( m_ui->modulesListView->selectionModel(), &QItemSelectionModel::selectionChanged,
|
|
|
|
|
this, [ this, moduleConfigModel
|
|
|
|
|
#ifdef WITH_PYTHONQT
|
|
|
|
|
, pythonConsoleButton
|
|
|
|
|
#endif
|
|
|
|
|
]
|
|
|
|
|
{
|
|
|
|
|
QString moduleName = modulesListView->currentIndex().data().toString();
|
|
|
|
|
QString moduleName = m_ui->modulesListView->currentIndex().data().toString();
|
|
|
|
|
Module* module = ModuleManager::instance()->moduleInstance( moduleName );
|
|
|
|
|
if ( module )
|
|
|
|
|
{
|
|
|
|
|
moduleConfigModel->loadJson( QJsonDocument::fromVariant( module->configurationMap() ).toJson() );
|
|
|
|
|
moduleConfigView->expandAll();
|
|
|
|
|
moduleTypeLabel->setText( module->typeString() );
|
|
|
|
|
moduleInterfaceLabel->setText( module->interfaceString() );
|
|
|
|
|
m_ui->moduleConfigView->expandAll();
|
|
|
|
|
m_ui->moduleTypeLabel->setText( module->typeString() );
|
|
|
|
|
m_ui->moduleInterfaceLabel->setText( module->interfaceString() );
|
|
|
|
|
#ifdef WITH_PYTHONQT
|
|
|
|
|
pythonConsoleButton->setVisible(
|
|
|
|
|
module->interface() == Module::PythonQtInterface &&
|
|
|
|
@ -182,10 +186,10 @@ DebugWindow::DebugWindow()
|
|
|
|
|
}
|
|
|
|
|
} );
|
|
|
|
|
|
|
|
|
|
connect( crashButton, &QPushButton::clicked, this, [] { ::crash(); } );
|
|
|
|
|
connect( m_ui->crashButton, &QPushButton::clicked, this, [] { ::crash(); } );
|
|
|
|
|
|
|
|
|
|
CALAMARES_RETRANSLATE(
|
|
|
|
|
retranslateUi( this );
|
|
|
|
|
m_ui->retranslateUi( this );
|
|
|
|
|
setWindowTitle( tr( "Debug information" ) );
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|