[libcalamares] Add a reload-stylesheet button

- This is a debugging-option to test stylesheet changes quickly.
 - Right now, the stylesheet is cached, so it doesn't even work.
main
Adriaan de Groot 6 years ago
parent ee3a2bcbe8
commit b5625fc14d

@ -59,7 +59,7 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
// If we can never cancel, don't show the window-close button
if ( Calamares::Settings::instance()->disableCancel() )
setWindowFlag( Qt::WindowCloseButtonHint, false );
CALAMARES_RETRANSLATE(
setWindowTitle( Calamares::Settings::instance()->isSetupMode()
? tr( "%1 Setup Program" ).arg( *Calamares::Branding::ProductName )
@ -74,6 +74,7 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
using CalamaresUtils::windowPreferredHeight;
using CalamaresUtils::windowPreferredWidth;
// Needs to match what's checked in DebugWindow
this->setObjectName("mainApp");
QSize availableSize = qApp->desktop()->availableGeometry( this ).size();
@ -173,7 +174,7 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
// and requires an extra show() (at least with KWin/X11) which
// is too annoying. Instead, leave it up to ignoring-the-quit-
// event, which is also the ViewManager's responsibility.
mainLayout->addWidget( m_viewManager->centralWidget() );
setStyleSheet( Calamares::Branding::instance()->stylesheet() );
}

@ -20,8 +20,10 @@
#include "DebugWindow.h"
#include "ui_DebugWindow.h"
#include "Branding.h"
#include "utils/Retranslator.h"
#include "utils/qjsonmodel.h"
#include "JobQueue.h"
#include "Job.h"
#include "GlobalStorage.h"
@ -186,7 +188,20 @@ DebugWindow::DebugWindow()
}
} );
// Tools page
connect( m_ui->crashButton, &QPushButton::clicked, this, [] { ::crash(); } );
connect( m_ui->reloadStylesheetButton, &QPushButton::clicked,
[]()
{
for ( auto* w : qApp->topLevelWidgets() )
{
// Needs to match what's set in CalamaresWindow
if ( w->objectName() == QStringLiteral( "mainApp" ) )
{
w->setStyleSheet( Calamares::Branding::instance()->stylesheet() );
}
}
});
CALAMARES_RETRANSLATE(
m_ui->retranslateUi( this );

@ -100,6 +100,13 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="reloadStylesheetButton">
<property name="text">
<string>Reload Stylesheet</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">

Loading…
Cancel
Save