diff --git a/src/calamares/CalamaresWindow.cpp b/src/calamares/CalamaresWindow.cpp index f05bdc7d4..054fb8639 100644 --- a/src/calamares/CalamaresWindow.cpp +++ b/src/calamares/CalamaresWindow.cpp @@ -143,6 +143,43 @@ CalamaresWindow::getQmlSidebar( int desiredWidth ) return w; } +/** @brief Get a button-sized icon. */ +static inline QPixmap +getButtonIcon( const QString& name ) +{ + return Calamares::Branding::instance()->image( name, QSize( 22, 22 ) ); +} + +QWidget* +CalamaresWindow::getWidgetNavigation() +{ + QWidget* navigation = new QWidget( this ); + + // Create buttons and sets an initial icon; the icons may change + auto* back = new QPushButton( getButtonIcon( QStringLiteral( "go-previous" ) ), tr( "&Back" ), navigation ); + back->setObjectName( "view-button-back" ); + auto* next = new QPushButton( getButtonIcon( QStringLiteral( "go-next" ) ), tr( "&Next" ), navigation ); + next->setObjectName( "view-button-next" ); + auto* quit = new QPushButton( getButtonIcon( QStringLiteral( "dialog-cancel" ) ), tr( "&Cancel" ), navigation ); + quit->setObjectName( "view-button-cancel" ); + + QBoxLayout* bottomLayout = new QHBoxLayout; + bottomLayout->addStretch(); + bottomLayout->addWidget( back ); + bottomLayout->addWidget( next ); + bottomLayout->addSpacing( 12 ); + bottomLayout->addWidget( quit ); + + navigation->setLayout( bottomLayout ); + return navigation; +} + +QWidget* +CalamaresWindow::getQmlNavigation() +{ + return nullptr; +} + CalamaresWindow::CalamaresWindow( QWidget* parent ) : QWidget( parent ) , m_debugWindow( nullptr ) @@ -219,9 +256,29 @@ 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. + QBoxLayout* contentsLayout = new QVBoxLayout; + contentsLayout->addWidget( m_viewManager->centralWidget() ); + QWidget* navigation = nullptr; + switch ( branding->navigationFlavor() ) + { + case Calamares::Branding::PanelFlavor::Widget: + navigation = getWidgetNavigation(); + break; + case Calamares::Branding::PanelFlavor::Qml: + navigation = getQmlNavigation(); + break; + case Calamares::Branding::PanelFlavor::None: + navigation = nullptr; + } + if ( navigation ) + { + contentsLayout->addWidget( navigation ); + } + + mainLayout->addLayout( contentsLayout ); - mainLayout->addWidget( m_viewManager->centralWidget() ); CalamaresUtils::unmarginLayout( mainLayout ); + CalamaresUtils::unmarginLayout( contentsLayout ); setStyleSheet( Calamares::Branding::instance()->stylesheet() ); } diff --git a/src/calamares/CalamaresWindow.h b/src/calamares/CalamaresWindow.h index 5cbbdfca6..d6592c99a 100644 --- a/src/calamares/CalamaresWindow.h +++ b/src/calamares/CalamaresWindow.h @@ -51,9 +51,14 @@ protected: virtual void closeEvent( QCloseEvent* e ) override; private: + // Two variations on sidebar (the progress view) QWidget* getWidgetSidebar( int desiredWidth ); QWidget* getQmlSidebar( int desiredWidth ); + // Two variations on navigation (buttons at bottom) + QWidget* getWidgetNavigation(); + QWidget* getQmlNavigation(); + QPointer< Calamares::DebugWindow > m_debugWindow; // Managed by self Calamares::ViewManager* m_viewManager; };