[welcome] Move about-calamares box to Calamares (main)

This commit is contained in:
Adriaan de Groot 2022-05-29 15:31:25 +02:00
parent 006c3f99e6
commit 18363ca183
3 changed files with 29 additions and 30 deletions

View File

@ -14,7 +14,9 @@
#include "CalamaresWindow.h"
#include "Branding.h"
#include "CalamaresAbout.h"
#include "CalamaresConfig.h"
#include "CalamaresVersion.h"
#include "DebugWindow.h"
#include "Settings.h"
#include "ViewManager.h"
@ -23,6 +25,7 @@
#include "utils/Logger.h"
#include "utils/Qml.h"
#include "utils/Retranslator.h"
#include "widgets/TranslationFix.h"
#include <QApplication>
#include <QBoxLayout>
@ -31,6 +34,7 @@
#include <QFile>
#include <QFileInfo>
#include <QLabel>
#include <QMessageBox>
#ifdef WITH_QML
#include <QQmlContext>
#include <QQmlEngine>
@ -87,6 +91,30 @@ setButtonIcon( QPushButton* button, const QString& name )
}
}
static void
showAboutBox()
{
QString title = Calamares::Settings::instance()->isSetupMode()
? QCoreApplication::translate( "WelcomePage", "About %1 setup" )
: QCoreApplication::translate( "WelcomePage", "About %1 installer" );
QMessageBox mb( QMessageBox::Information,
title.arg( CALAMARES_APPLICATION_NAME ),
Calamares::aboutString().arg( Calamares::Branding::instance()->versionedName() ),
QMessageBox::Ok,
nullptr );
Calamares::fixButtonLabels( &mb );
mb.setIconPixmap( CalamaresUtils::defaultPixmap(
CalamaresUtils::Squid,
CalamaresUtils::Original,
QSize( CalamaresUtils::defaultFontHeight() * 6, CalamaresUtils::defaultFontHeight() * 6 ) ) );
QGridLayout* layout = reinterpret_cast< QGridLayout* >( mb.layout() );
if ( layout )
{
layout->setColumnMinimumWidth( 2, CalamaresUtils::defaultFontHeight() * 24 );
}
mb.exec();
}
static QWidget*
getWidgetSidebar( Calamares::DebugWindowManager* debug,
Calamares::ViewManager* viewManager,
@ -149,7 +177,7 @@ getWidgetSidebar( Calamares::DebugWindowManager* debug,
extraButtons->addWidget( aboutDialog );
aboutDialog->setFlat( true );
aboutDialog->setCheckable( true );
QObject::connect( aboutDialog, &QPushButton::clicked, debug, &Calamares::DebugWindowManager::show );
QObject::connect( aboutDialog, &QPushButton::clicked, []() { showAboutBox(); } );
}
if ( debug && debug->enabled() )
{

View File

@ -27,7 +27,6 @@
#include "utils/Logger.h"
#include "utils/NamedEnum.h"
#include "utils/Retranslator.h"
#include "widgets/TranslationFix.h"
#include <QApplication>
#include <QBoxLayout>
@ -48,8 +47,6 @@ WelcomePage::WelcomePage( Config* config, QWidget* parent )
const int defaultFontHeight = CalamaresUtils::defaultFontHeight();
ui->setupUi( this );
ui->aboutButton->setIcon( CalamaresUtils::defaultPixmap(
CalamaresUtils::Information, CalamaresUtils::Original, 2 * QSize( defaultFontHeight, defaultFontHeight ) ) );
// insert system-check widget below welcome text
const int welcome_text_idx = ui->verticalLayout->indexOf( ui->mainText );
@ -78,7 +75,6 @@ WelcomePage::WelcomePage( Config* config, QWidget* parent )
CALAMARES_RETRANSLATE_SLOT( &WelcomePage::retranslate );
connect( ui->aboutButton, &QPushButton::clicked, this, &WelcomePage::showAboutBox );
connect( Calamares::ModuleManager::instance(),
&Calamares::ModuleManager::requirementsComplete,
m_checkingWidget,
@ -216,30 +212,6 @@ WelcomePage::retranslate()
ui->supportButton->setText( tr( "%1 support" ).arg( Calamares::Branding::instance()->shortProductName() ) );
}
void
WelcomePage::showAboutBox()
{
QString title
= Calamares::Settings::instance()->isSetupMode() ? tr( "About %1 setup" ) : tr( "About %1 installer" );
QMessageBox mb( QMessageBox::Information,
title.arg( CALAMARES_APPLICATION_NAME ),
m_conf->aboutMessage().arg( Calamares::Branding::instance()->versionedName() ),
QMessageBox::Ok,
this );
Calamares::fixButtonLabels( &mb );
mb.setIconPixmap( CalamaresUtils::defaultPixmap(
CalamaresUtils::Squid,
CalamaresUtils::Original,
QSize( CalamaresUtils::defaultFontHeight() * 6, CalamaresUtils::defaultFontHeight() * 6 ) ) );
QGridLayout* layout = reinterpret_cast< QGridLayout* >( mb.layout() );
if ( layout )
{
layout->setColumnMinimumWidth( 2, CalamaresUtils::defaultFontHeight() * 24 );
}
mb.exec();
}
void
LocaleTwoColumnDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
{

View File

@ -53,7 +53,6 @@ public:
public slots:
void retranslate();
void showAboutBox();
protected:
void focusInEvent( QFocusEvent* e ) override; //choose the child widget to focus