diff --git a/src/calamares/progresstree/ProgressTreeDelegate.cpp b/src/calamares/progresstree/ProgressTreeDelegate.cpp index ccc8f9a58..4b2ab65bb 100644 --- a/src/calamares/progresstree/ProgressTreeDelegate.cpp +++ b/src/calamares/progresstree/ProgressTreeDelegate.cpp @@ -1,6 +1,6 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Teo Mrnjavac + * Copyright 2014-2015, Teo Mrnjavac * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,8 +30,7 @@ #include #define ITEM_MARGIN 12 -#define VS_FONTSIZE CalamaresUtils::defaultFontSize() + 2 -#define CAT_FONTSIZE CalamaresUtils::defaultFontSize() + 5 +#define VS_FONTSIZE CalamaresUtils::defaultFontSize() + 4 ProgressTreeDelegate::ProgressTreeDelegate( QAbstractItemView* parent ) : QStyledItemDelegate( parent ) @@ -47,18 +46,9 @@ ProgressTreeDelegate::sizeHint( const QStyleOptionViewItem& option, if ( !index.isValid() ) return option.rect.size(); - bool isFirstLevel = !index.parent().isValid(); - QFont font = qApp->font(); - if ( isFirstLevel ) - { - font.setPointSize( CAT_FONTSIZE ); - } - else - { - font.setPointSize( VS_FONTSIZE ); - } + font.setPointSize( VS_FONTSIZE ); QFontMetrics fm( font ); int height = fm.height(); @@ -87,43 +77,18 @@ ProgressTreeDelegate::paint( QPainter* painter, painter->setPen( QColor( Calamares::Branding::instance()-> styleString( Calamares::Branding::SidebarText ) ) ); - if ( isFirstLevel ) - paintCategory( painter, opt, index ); - else - paintViewStep( painter, opt, index ); + paintViewStep( painter, opt, index ); painter->restore(); } -void -ProgressTreeDelegate::paintCategory( QPainter* painter, - const QStyleOptionViewItem& option, - const QModelIndex& index ) const -{ - QRect textRect = option.rect.adjusted( ITEM_MARGIN, - ITEM_MARGIN, - ITEM_MARGIN, - ITEM_MARGIN ); - - bool isCurrent = index.data( ProgressTreeModel::ProgressTreeItemCurrentRole ).toBool(); - - QFont font = qApp->font(); - font.setPointSize( CAT_FONTSIZE ); - font.setBold( false ); - font.setUnderline( isCurrent ); // FIXME: Figure out a nicer way to highlight the current category step - painter->setFont( font ); - - painter->drawText( textRect, index.data().toString() ); -} - - void ProgressTreeDelegate::paintViewStep( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const { - QRect textRect = option.rect.adjusted( ITEM_MARGIN + 32 /*indentation*/, + QRect textRect = option.rect.adjusted( ITEM_MARGIN, ITEM_MARGIN, ITEM_MARGIN, ITEM_MARGIN ); diff --git a/src/calamares/progresstree/ProgressTreeDelegate.h b/src/calamares/progresstree/ProgressTreeDelegate.h index 660623267..b3f6d4ab2 100644 --- a/src/calamares/progresstree/ProgressTreeDelegate.h +++ b/src/calamares/progresstree/ProgressTreeDelegate.h @@ -1,6 +1,6 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Teo Mrnjavac + * Copyright 2014-2015, Teo Mrnjavac * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,9 +35,6 @@ protected: const QModelIndex& index ) const override; private: - void paintCategory( QPainter* painter, - const QStyleOptionViewItem& option, - const QModelIndex& index ) const; void paintViewStep( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const;