mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 10:55:46 -05:00
[calamares] Migrate the about-dialog to the debug (meta) window manager
- DebugWindowManager already manages not-really-Calamares windows like the Debug window, add About-Dialog to its responsibilities. - Make about() accessible to the QML progress panel.
This commit is contained in:
parent
00898b18d6
commit
d34f593562
4 changed files with 60 additions and 31 deletions
|
@ -14,9 +14,7 @@
|
||||||
#include "CalamaresWindow.h"
|
#include "CalamaresWindow.h"
|
||||||
|
|
||||||
#include "Branding.h"
|
#include "Branding.h"
|
||||||
#include "CalamaresAbout.h"
|
|
||||||
#include "CalamaresConfig.h"
|
#include "CalamaresConfig.h"
|
||||||
#include "CalamaresVersion.h"
|
|
||||||
#include "DebugWindow.h"
|
#include "DebugWindow.h"
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
#include "ViewManager.h"
|
#include "ViewManager.h"
|
||||||
|
@ -25,7 +23,6 @@
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
#include "utils/Qml.h"
|
#include "utils/Qml.h"
|
||||||
#include "utils/Retranslator.h"
|
#include "utils/Retranslator.h"
|
||||||
#include "widgets/TranslationFix.h"
|
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QBoxLayout>
|
#include <QBoxLayout>
|
||||||
|
@ -34,7 +31,6 @@
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QMessageBox>
|
|
||||||
#ifdef WITH_QML
|
#ifdef WITH_QML
|
||||||
#include <QQmlContext>
|
#include <QQmlContext>
|
||||||
#include <QQmlEngine>
|
#include <QQmlEngine>
|
||||||
|
@ -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*
|
static QWidget*
|
||||||
getWidgetSidebar( Calamares::DebugWindowManager* debug,
|
getWidgetSidebar( Calamares::DebugWindowManager* debug,
|
||||||
Calamares::ViewManager* viewManager,
|
Calamares::ViewManager* viewManager,
|
||||||
|
@ -177,7 +149,7 @@ getWidgetSidebar( Calamares::DebugWindowManager* debug,
|
||||||
extraButtons->addWidget( aboutDialog );
|
extraButtons->addWidget( aboutDialog );
|
||||||
aboutDialog->setFlat( true );
|
aboutDialog->setFlat( true );
|
||||||
aboutDialog->setCheckable( true );
|
aboutDialog->setCheckable( true );
|
||||||
QObject::connect( aboutDialog, &QPushButton::clicked, []() { showAboutBox(); } );
|
QObject::connect( aboutDialog, &QPushButton::clicked, debug, &Calamares::DebugWindowManager::about );
|
||||||
}
|
}
|
||||||
if ( debug && debug->enabled() )
|
if ( debug && debug->enabled() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
#include "ui_DebugWindow.h"
|
#include "ui_DebugWindow.h"
|
||||||
|
|
||||||
#include "Branding.h"
|
#include "Branding.h"
|
||||||
|
#include "CalamaresAbout.h"
|
||||||
|
#include "CalamaresVersion.h"
|
||||||
#include "GlobalStorage.h"
|
#include "GlobalStorage.h"
|
||||||
#include "Job.h"
|
#include "Job.h"
|
||||||
#include "JobQueue.h"
|
#include "JobQueue.h"
|
||||||
|
@ -19,9 +21,11 @@
|
||||||
#include "VariantModel.h"
|
#include "VariantModel.h"
|
||||||
#include "modulesystem/Module.h"
|
#include "modulesystem/Module.h"
|
||||||
#include "modulesystem/ModuleManager.h"
|
#include "modulesystem/ModuleManager.h"
|
||||||
|
#include "utils/CalamaresUtilsGui.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
#include "utils/Paste.h"
|
#include "utils/Paste.h"
|
||||||
#include "utils/Retranslator.h"
|
#include "utils/Retranslator.h"
|
||||||
|
#include "widgets/TranslationFix.h"
|
||||||
|
|
||||||
#ifdef WITH_PYTHONQT
|
#ifdef WITH_PYTHONQT
|
||||||
#include "ViewManager.h"
|
#include "ViewManager.h"
|
||||||
|
@ -30,6 +34,7 @@
|
||||||
#include <gui/PythonQtScriptingConsole.h>
|
#include <gui/PythonQtScriptingConsole.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <QMessageBox>
|
||||||
#include <QSplitter>
|
#include <QSplitter>
|
||||||
#include <QStringListModel>
|
#include <QStringListModel>
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
|
@ -307,5 +312,28 @@ DebugWindowManager::toggle()
|
||||||
show( !m_visible );
|
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
|
} // namespace Calamares
|
||||||
|
|
|
@ -49,11 +49,13 @@ private:
|
||||||
std::unique_ptr< VariantModel > m_module_model;
|
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
|
* Only one DebugWindow is expected to be around. This class manages
|
||||||
* (exactly one) DebugWindow and can create and destroy it as needed.
|
* (exactly one) DebugWindow and can create and destroy it as needed.
|
||||||
* It is available to the Calamares panels as object `DebugWindow`.
|
* It is available to the Calamares panels as object `DebugWindow`.
|
||||||
|
*
|
||||||
|
* The about() method shows a modal pop-up about Calamares.
|
||||||
*/
|
*/
|
||||||
class DebugWindowManager : public QObject
|
class DebugWindowManager : public QObject
|
||||||
{
|
{
|
||||||
|
@ -79,6 +81,8 @@ public Q_SLOTS:
|
||||||
void show( bool visible );
|
void show( bool visible );
|
||||||
void toggle();
|
void toggle();
|
||||||
|
|
||||||
|
void about();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void visibleChanged( bool visible );
|
void visibleChanged( bool visible );
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,31 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
Layout.fillWidth: true;
|
||||||
height: 35
|
height: 35
|
||||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
|
||||||
|
@ -69,7 +94,7 @@ Rectangle {
|
||||||
visible: debug.enabled
|
visible: debug.enabled
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: mouseArea
|
id: mouseAreaDebug
|
||||||
anchors.fill: parent;
|
anchors.fill: parent;
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
|
Loading…
Add table
Reference in a new issue