commit
04c084e831
@ -26,7 +26,8 @@ Repeater {
|
||||
color: "black"
|
||||
|
||||
Text {
|
||||
color: completed ? "green" : "yellow"
|
||||
anchors.centerIn: parent
|
||||
color: index == ViewManager.currentStepIndex ? "green" : "yellow"
|
||||
text: display
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
||||
* Copyright 2017, 2019, Adriaan de Groot <groot@kde.org>
|
||||
* Copyright 2017, 2019-2020, Adriaan de Groot <groot@kde.org>
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -19,10 +19,10 @@
|
||||
|
||||
#include "ProgressTreeDelegate.h"
|
||||
|
||||
#include "Branding.h"
|
||||
#include "CalamaresApplication.h"
|
||||
#include "CalamaresWindow.h"
|
||||
#include "ViewManager.h"
|
||||
#include "Branding.h"
|
||||
#include "utils/CalamaresUtilsGui.h"
|
||||
|
||||
#include <QPainter>
|
||||
@ -85,10 +85,7 @@ ProgressTreeDelegate::paintViewStep( QPainter* painter,
|
||||
font.setBold( false );
|
||||
painter->setFont( font );
|
||||
|
||||
bool isCurrent = false;
|
||||
isCurrent = index.data( Calamares::ViewManager::ProgressTreeItemCurrentRole ).toBool();
|
||||
|
||||
if ( isCurrent )
|
||||
if ( index.row() == index.data( Calamares::ViewManager::ProgressTreeItemCurrentIndex ).toInt() )
|
||||
{
|
||||
painter->setPen( Calamares::Branding::instance()->styleString( Calamares::Branding::SidebarTextSelect ) );
|
||||
QString textHighlight
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Copyright 2019, Dominic Hayes <ferenosdev@outlook.com>
|
||||
* Copyright 2019, Gabriel Craciunescu <crazy@frugalware.org>
|
||||
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
||||
* Copyright 2017-2018, Adriaan de Groot <groot@kde.org>
|
||||
* Copyright 2017-2018, 2020, Adriaan de Groot <groot@kde.org>
|
||||
*
|
||||
* Calamares is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -559,23 +559,8 @@ ViewManager::data( const QModelIndex& index, int role ) const
|
||||
{
|
||||
return QVariant();
|
||||
}
|
||||
case ProgressTreeItemCurrentRole:
|
||||
return currentStep() == step;
|
||||
case ProgressTreeItemCompletedRole:
|
||||
// Every step *before* the current step is considered "complete"
|
||||
for ( const auto* otherstep : m_steps )
|
||||
{
|
||||
if ( otherstep == currentStep() )
|
||||
{
|
||||
break;
|
||||
}
|
||||
if ( otherstep == step )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// .. and the others (including current) are not.
|
||||
return false;
|
||||
case ProgressTreeItemCurrentIndex:
|
||||
return m_currentStep;
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
@ -592,13 +577,4 @@ ViewManager::rowCount( const QModelIndex& parent ) const
|
||||
return m_steps.length();
|
||||
}
|
||||
|
||||
QHash< int, QByteArray >
|
||||
ViewManager::roleNames() const
|
||||
{
|
||||
auto h = QAbstractListModel::roleNames();
|
||||
h.insert( ProgressTreeItemCurrentRole, "current" );
|
||||
h.insert( ProgressTreeItemCompletedRole, "completed" );
|
||||
return h;
|
||||
}
|
||||
|
||||
} // namespace Calamares
|
||||
|
@ -37,6 +37,8 @@ namespace Calamares
|
||||
class UIDLLEXPORT ViewManager : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY( int currentStepIndex READ currentStepIndex NOTIFY currentStepChanged FINAL )
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief instance access to the ViewManager singleton.
|
||||
@ -151,14 +153,11 @@ public:
|
||||
*/
|
||||
enum Role
|
||||
{
|
||||
ProgressTreeItemCurrentRole = Qt::UserRole + 11, ///< Is this the *current* step?
|
||||
ProgressTreeItemCompletedRole = Qt::UserRole + 12 ///< Are we past this one?
|
||||
ProgressTreeItemCurrentIndex = Qt::UserRole + 13 ///< Index (row) of the current step
|
||||
};
|
||||
|
||||
QVariant data( const QModelIndex& index, int role = Qt::DisplayRole ) const override;
|
||||
int rowCount( const QModelIndex& parent = QModelIndex() ) const override;
|
||||
|
||||
QHash< int, QByteArray > roleNames() const override;
|
||||
};
|
||||
|
||||
} // namespace Calamares
|
||||
|
Loading…
Reference in New Issue
Block a user