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

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <https://github.com/calamares> === /* === This file is part of Calamares - <https://github.com/calamares> ===
* *
* Copyright 2015, Teo Mrnjavac <teo@kde.org> * 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 * Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -19,13 +20,18 @@
#ifndef CALAMARES_DEBUGWINDOW_H #ifndef CALAMARES_DEBUGWINDOW_H
#define CALAMARES_DEBUGWINDOW_H #define CALAMARES_DEBUGWINDOW_H
#include "ui_DebugWindow.h"
#include <QWidget> #include <QWidget>
namespace Calamares { namespace Calamares {
class DebugWindow : public QWidget, private Ui::DebugWindow // From the .ui file
namespace Ui
{
class DebugWindow;
}
class DebugWindow : public QWidget
{ {
Q_OBJECT Q_OBJECT
@ -38,8 +44,10 @@ signals:
protected: protected:
void closeEvent( QCloseEvent* e ) override; void closeEvent( QCloseEvent* e ) override;
private:
Ui::DebugWindow *m_ui;
}; };
} // namespace Calamares } // namespace
#endif // CALAMARES_DEBUGWINDOW_H #endif

Loading…
Cancel
Save