[libcalamaresui] Don't expose build details in DebugWindow

- In a library class, don't include uic-generated headers inside
   the public headers.
main
Adriaan de Groot 6 years ago
parent de2b85eabf
commit a482d7be44

@ -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" ) );
)
}

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <https://github.com/calamares> ===
*
* Copyright 2015, 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
@ -19,13 +20,18 @@
#ifndef CALAMARES_DEBUGWINDOW_H
#define CALAMARES_DEBUGWINDOW_H
#include "ui_DebugWindow.h"
#include <QWidget>
namespace Calamares {
class DebugWindow : public QWidget, private Ui::DebugWindow
// From the .ui file
namespace Ui
{
class DebugWindow;
}
class DebugWindow : public QWidget
{
Q_OBJECT
@ -38,8 +44,10 @@ signals:
protected:
void closeEvent( QCloseEvent* e ) override;
private:
Ui::DebugWindow *m_ui;
};
} // namespace Calamares
#endif // CALAMARES_DEBUGWINDOW_H
} // namespace
#endif

Loading…
Cancel
Save