[calamares] Apply current coding style
This commit is contained in:
parent
ea0acf1606
commit
f5af4818fb
@ -22,11 +22,11 @@
|
||||
#include "CalamaresWindow.h"
|
||||
|
||||
#include "Branding.h"
|
||||
#include "DebugWindow.h"
|
||||
#include "Settings.h"
|
||||
#include "ViewManager.h"
|
||||
#include "progresstree/ProgressTreeView.h"
|
||||
#include "utils/CalamaresUtilsGui.h"
|
||||
#include "DebugWindow.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "utils/Retranslator.h"
|
||||
|
||||
|
@ -55,21 +55,29 @@ crash()
|
||||
}
|
||||
|
||||
/// @brief Print out the widget tree (names) in indented form.
|
||||
static void dumpWidgetTree( QDebug& deb, const QWidget* widget, int depth )
|
||||
static void
|
||||
dumpWidgetTree( QDebug& deb, const QWidget* widget, int depth )
|
||||
{
|
||||
if ( !widget )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
deb << Logger::Continuation;
|
||||
for ( int i = 0; i < depth; ++i )
|
||||
{
|
||||
deb << ' ';
|
||||
}
|
||||
deb << widget->objectName();
|
||||
|
||||
for ( const auto* w : widget->findChildren< QWidget* >( QString(), Qt::FindDirectChildrenOnly ) )
|
||||
{
|
||||
dumpWidgetTree( deb, w, depth + 1 );
|
||||
}
|
||||
}
|
||||
|
||||
namespace Calamares {
|
||||
namespace Calamares
|
||||
{
|
||||
|
||||
DebugWindow::DebugWindow()
|
||||
: QWidget( nullptr )
|
||||
@ -86,9 +94,7 @@ DebugWindow::DebugWindow()
|
||||
m_ui->globalStorageView->expandAll();
|
||||
|
||||
// Do above when the GS changes, too
|
||||
connect( gs, &GlobalStorage::changed,
|
||||
this, [ = ]
|
||||
{
|
||||
connect( gs, &GlobalStorage::changed, this, [=] {
|
||||
m_globals = JobQueue::instance()->globalStorage()->data();
|
||||
m_globals_model->reload();
|
||||
m_ui->globalStorageView->expandAll();
|
||||
@ -96,9 +102,7 @@ DebugWindow::DebugWindow()
|
||||
|
||||
// JobQueue page
|
||||
m_ui->jobQueueText->setReadOnly( true );
|
||||
connect( JobQueue::instance(), &JobQueue::queueChanged,
|
||||
this, [ this ]( const JobList& jobs )
|
||||
{
|
||||
connect( JobQueue::instance(), &JobQueue::queueChanged, this, [this]( const JobList& jobs ) {
|
||||
QStringList text;
|
||||
for ( const auto& job : jobs )
|
||||
{
|
||||
@ -121,21 +125,17 @@ DebugWindow::DebugWindow()
|
||||
m_ui->modulesVerticalLayout->insertWidget( 1, pythonConsoleButton );
|
||||
pythonConsoleButton->hide();
|
||||
|
||||
QObject::connect( pythonConsoleButton, &QPushButton::clicked,
|
||||
this, [ this, moduleConfigModel ]
|
||||
{
|
||||
QObject::connect( pythonConsoleButton, &QPushButton::clicked, this, [this, moduleConfigModel] {
|
||||
QString moduleName = m_ui->modulesListView->currentIndex().data().toString();
|
||||
Module* module = ModuleManager::instance()->moduleInstance( moduleName );
|
||||
if ( module->interface() != Module::Interface::PythonQt ||
|
||||
module->type() != Module::Type::View )
|
||||
if ( module->interface() != Module::Interface::PythonQt || module->type() != Module::Type::View )
|
||||
return;
|
||||
|
||||
for ( ViewStep* step : ViewManager::instance()->viewSteps() )
|
||||
{
|
||||
if ( step->moduleInstanceKey() == module->instanceKey() )
|
||||
{
|
||||
PythonQtViewStep* pqvs =
|
||||
qobject_cast< PythonQtViewStep* >( step );
|
||||
PythonQtViewStep* pqvs = qobject_cast< PythonQtViewStep* >( step );
|
||||
if ( pqvs )
|
||||
{
|
||||
QWidget* consoleWindow = new QWidget;
|
||||
@ -152,8 +152,7 @@ DebugWindow::DebugWindow()
|
||||
|
||||
QLabel* bottomLabel = new QLabel( consoleWindow );
|
||||
bottomLayout->addWidget( bottomLabel );
|
||||
QString line =
|
||||
QString( "Module: <font color=\"#008000\"><code>%1</code></font><br/>"
|
||||
QString line = QString( "Module: <font color=\"#008000\"><code>%1</code></font><br/>"
|
||||
"Python class: <font color=\"#008000\"><code>%2</code></font>" )
|
||||
.arg( module->instanceKey() )
|
||||
.arg( console->property( "classname" ).toString() );
|
||||
@ -161,14 +160,9 @@ DebugWindow::DebugWindow()
|
||||
|
||||
QPushButton* closeButton = new QPushButton( consoleWindow );
|
||||
closeButton->setText( "&Close" );
|
||||
QObject::connect( closeButton, &QPushButton::clicked,
|
||||
[ consoleWindow ]
|
||||
{
|
||||
consoleWindow->close();
|
||||
} );
|
||||
QObject::connect( closeButton, &QPushButton::clicked, [consoleWindow] { consoleWindow->close(); } );
|
||||
bottomLayout->addWidget( closeButton );
|
||||
bottomLabel->setSizePolicy( QSizePolicy::Expanding,
|
||||
QSizePolicy::Preferred );
|
||||
bottomLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
|
||||
|
||||
consoleWindow->setParent( this );
|
||||
consoleWindow->setWindowFlags( Qt::Window );
|
||||
@ -183,13 +177,15 @@ DebugWindow::DebugWindow()
|
||||
|
||||
#endif
|
||||
|
||||
connect( m_ui->modulesListView->selectionModel(), &QItemSelectionModel::selectionChanged,
|
||||
this, [ this
|
||||
connect( m_ui->modulesListView->selectionModel(),
|
||||
&QItemSelectionModel::selectionChanged,
|
||||
this,
|
||||
[this
|
||||
#ifdef WITH_PYTHONQT
|
||||
, pythonConsoleButton
|
||||
,
|
||||
pythonConsoleButton
|
||||
#endif
|
||||
]
|
||||
{
|
||||
] {
|
||||
QString moduleName = m_ui->modulesListView->currentIndex().data().toString();
|
||||
Module* module = ModuleManager::instance()->moduleInstance( moduleName );
|
||||
if ( module )
|
||||
@ -200,18 +196,15 @@ DebugWindow::DebugWindow()
|
||||
m_ui->moduleTypeLabel->setText( module->typeString() );
|
||||
m_ui->moduleInterfaceLabel->setText( module->interfaceString() );
|
||||
#ifdef WITH_PYTHONQT
|
||||
pythonConsoleButton->setVisible(
|
||||
module->interface() == Module::Interface::PythonQt &&
|
||||
module->type() == Module::Type::View );
|
||||
pythonConsoleButton->setVisible( module->interface() == Module::Interface::PythonQt
|
||||
&& module->type() == Module::Type::View );
|
||||
#endif
|
||||
}
|
||||
} );
|
||||
|
||||
// Tools page
|
||||
connect( m_ui->crashButton, &QPushButton::clicked, this, [] { ::crash(); } );
|
||||
connect( m_ui->reloadStylesheetButton, &QPushButton::clicked,
|
||||
[]()
|
||||
{
|
||||
connect( m_ui->reloadStylesheetButton, &QPushButton::clicked, []() {
|
||||
for ( auto* w : qApp->topLevelWidgets() )
|
||||
{
|
||||
// Needs to match what's set in CalamaresWindow
|
||||
@ -221,9 +214,7 @@ DebugWindow::DebugWindow()
|
||||
}
|
||||
}
|
||||
} );
|
||||
connect( m_ui->widgetTreeButton, &QPushButton::clicked,
|
||||
[]()
|
||||
{
|
||||
connect( m_ui->widgetTreeButton, &QPushButton::clicked, []() {
|
||||
for ( auto* w : qApp->topLevelWidgets() )
|
||||
{
|
||||
Logger::CDebug deb;
|
||||
@ -231,10 +222,7 @@ DebugWindow::DebugWindow()
|
||||
}
|
||||
} );
|
||||
|
||||
CALAMARES_RETRANSLATE(
|
||||
m_ui->retranslateUi( this );
|
||||
setWindowTitle( tr( "Debug information" ) );
|
||||
)
|
||||
CALAMARES_RETRANSLATE( m_ui->retranslateUi( this ); setWindowTitle( tr( "Debug information" ) ); )
|
||||
}
|
||||
|
||||
|
||||
|
@ -27,7 +27,8 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace Calamares {
|
||||
namespace Calamares
|
||||
{
|
||||
|
||||
// From the .ui file
|
||||
namespace Ui
|
||||
@ -57,5 +58,5 @@ private:
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
} // namespace Calamares
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user