Add Modules page to DebugWindow.
This commit is contained in:
parent
dda7ea211d
commit
5951208c1b
@ -22,8 +22,12 @@
|
||||
#include "JobQueue.h"
|
||||
#include "Job.h"
|
||||
#include "GlobalStorage.h"
|
||||
#include "modulesystem/ModuleManager.h"
|
||||
#include "modulesystem/Module.h"
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QSplitter>
|
||||
#include <QStringListModel>
|
||||
#include <QTreeView>
|
||||
|
||||
namespace Calamares {
|
||||
@ -34,6 +38,7 @@ DebugWindow::DebugWindow()
|
||||
|
||||
setupUi( this );
|
||||
|
||||
// GlobalStorage page
|
||||
QJsonModel* jsonModel = new QJsonModel( this );
|
||||
|
||||
globalStorageView->setModel( jsonModel );
|
||||
@ -47,6 +52,7 @@ DebugWindow::DebugWindow()
|
||||
jsonModel->loadJson( QJsonDocument::fromVariant( gs->m ).toJson() );
|
||||
globalStorageView->expandAll();
|
||||
|
||||
// JobQueue page
|
||||
jobQueueText->setReadOnly( true );
|
||||
connect( JobQueue::instance(), &JobQueue::queueChanged,
|
||||
[ this ]( const QList< Calamares::job_ptr >& jobs )
|
||||
@ -60,6 +66,31 @@ DebugWindow::DebugWindow()
|
||||
jobQueueText->setText( text.join( '\n' ) );
|
||||
} );
|
||||
|
||||
// Modules page
|
||||
QSplitter* splitter = new QSplitter( modulesTab );
|
||||
modulesTab->layout()->addWidget( splitter );
|
||||
splitter->addWidget( modulesListView );
|
||||
splitter->addWidget( moduleConfigView );
|
||||
|
||||
QStringListModel* modulesModel = new QStringListModel( ModuleManager::instance()->availableModules() );
|
||||
modulesListView->setModel( modulesModel );
|
||||
modulesListView->setSelectionMode( QAbstractItemView::SingleSelection );
|
||||
|
||||
QJsonModel* moduleConfigModel = new QJsonModel( this );
|
||||
moduleConfigView->setModel( moduleConfigModel );
|
||||
|
||||
connect( modulesListView->selectionModel(), &QItemSelectionModel::selectionChanged,
|
||||
[ this, moduleConfigModel ]
|
||||
{
|
||||
QString moduleName = modulesListView->currentIndex().data().toString();
|
||||
Module* module = ModuleManager::instance()->module( moduleName );
|
||||
if ( module )
|
||||
{
|
||||
moduleConfigModel->loadJson( QJsonDocument::fromVariant( module->configurationMap() ).toJson() );
|
||||
moduleConfigView->expandAll();
|
||||
}
|
||||
} );
|
||||
|
||||
CALAMARES_RETRANSLATE( retranslateUi( this ); )
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<widget class="QWidget" name="globalStorageTab">
|
||||
<attribute name="title">
|
||||
<string>GlobalStorage</string>
|
||||
</attribute>
|
||||
@ -29,7 +29,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_2">
|
||||
<widget class="QWidget" name="jobQueueTab">
|
||||
<attribute name="title">
|
||||
<string>JobQueue</string>
|
||||
</attribute>
|
||||
@ -39,6 +39,19 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="modulesTab">
|
||||
<attribute name="title">
|
||||
<string>Modules</string>
|
||||
</attribute>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QListView" name="modulesListView"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeView" name="moduleConfigView"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
Loading…
Reference in New Issue
Block a user