diff --git a/src/calamares/CalamaresWindow.cpp b/src/calamares/CalamaresWindow.cpp index b6a34083c..50abb776e 100644 --- a/src/calamares/CalamaresWindow.cpp +++ b/src/calamares/CalamaresWindow.cpp @@ -14,9 +14,7 @@ #include "CalamaresWindow.h" #include "Branding.h" -#include "CalamaresAbout.h" #include "CalamaresConfig.h" -#include "CalamaresVersion.h" #include "DebugWindow.h" #include "Settings.h" #include "ViewManager.h" @@ -25,7 +23,6 @@ #include "utils/Logger.h" #include "utils/Qml.h" #include "utils/Retranslator.h" -#include "widgets/TranslationFix.h" #include #include @@ -34,7 +31,6 @@ #include #include #include -#include #ifdef WITH_QML #include #include @@ -91,30 +87,6 @@ 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, @@ -177,7 +149,7 @@ getWidgetSidebar( Calamares::DebugWindowManager* debug, extraButtons->addWidget( aboutDialog ); aboutDialog->setFlat( true ); aboutDialog->setCheckable( true ); - QObject::connect( aboutDialog, &QPushButton::clicked, []() { showAboutBox(); } ); + QObject::connect( aboutDialog, &QPushButton::clicked, debug, &Calamares::DebugWindowManager::about ); } if ( debug && debug->enabled() ) { diff --git a/src/calamares/DebugWindow.cpp b/src/calamares/DebugWindow.cpp index 8813999a4..13e8ccfdd 100644 --- a/src/calamares/DebugWindow.cpp +++ b/src/calamares/DebugWindow.cpp @@ -12,6 +12,8 @@ #include "ui_DebugWindow.h" #include "Branding.h" +#include "CalamaresAbout.h" +#include "CalamaresVersion.h" #include "GlobalStorage.h" #include "Job.h" #include "JobQueue.h" @@ -19,9 +21,11 @@ #include "VariantModel.h" #include "modulesystem/Module.h" #include "modulesystem/ModuleManager.h" +#include "utils/CalamaresUtilsGui.h" #include "utils/Logger.h" #include "utils/Paste.h" #include "utils/Retranslator.h" +#include "widgets/TranslationFix.h" #ifdef WITH_PYTHONQT #include "ViewManager.h" @@ -30,6 +34,7 @@ #include #endif +#include #include #include #include @@ -307,5 +312,28 @@ DebugWindowManager::toggle() show( !m_visible ); } +void +DebugWindowManager::about() +{ + 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(); +} } // namespace Calamares diff --git a/src/calamares/DebugWindow.h b/src/calamares/DebugWindow.h index 41d92588d..7bc789a89 100644 --- a/src/calamares/DebugWindow.h +++ b/src/calamares/DebugWindow.h @@ -49,11 +49,13 @@ private: std::unique_ptr< VariantModel > m_module_model; }; -/** @brief Manager for the (single) DebugWindow +/** @brief Manager for meta-windows (Debug and About windows) * * Only one DebugWindow is expected to be around. This class manages * (exactly one) DebugWindow and can create and destroy it as needed. * It is available to the Calamares panels as object `DebugWindow`. + * + * The about() method shows a modal pop-up about Calamares. */ class DebugWindowManager : public QObject { @@ -79,6 +81,8 @@ public Q_SLOTS: void show( bool visible ); void toggle(); + void about(); + signals: void visibleChanged( bool visible ); diff --git a/src/calamares/calamares-sidebar.qml b/src/calamares/calamares-sidebar.qml index 5c94fb6b2..06b61d8c7 100644 --- a/src/calamares/calamares-sidebar.qml +++ b/src/calamares/calamares-sidebar.qml @@ -62,6 +62,31 @@ Rectangle { } Rectangle { + id: aboutArea + Layout.fillWidth: true; + height: 35 + Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom + color: Branding.styleString( mouseArea.containsMouse ? Branding.SidebarTextHighlight : Branding.SidebarBackground); + visible: true; + + MouseArea { + id: mouseAreaAbout + anchors.fill: parent; + cursorShape: Qt.PointingHandCursor + hoverEnabled: true + Text { + anchors.verticalCenter: parent.verticalCenter; + x: parent.x + 4; + text: qsTr("About Calamares") + color: Branding.styleString( mouseArea.containsMouse ? Branding.SidebarTextSelect : Branding.SidebarBackground ); + font.pointSize : 9 + } + + onClicked: debug.about() + } + } + Rectangle { + id: debugArea Layout.fillWidth: true; height: 35 Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom @@ -69,7 +94,7 @@ Rectangle { visible: debug.enabled MouseArea { - id: mouseArea + id: mouseAreaDebug anchors.fill: parent; cursorShape: Qt.PointingHandCursor hoverEnabled: true