[calamares] Create navigation panel in CalamaresWindow
- this is a non-functional duplicate panel, so it looks funny
This commit is contained in:
parent
6c8aa5da63
commit
d4f903b95c
@ -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() );
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user