[calamares] Tidying after fixing fit-text-in-sidepane
- Simplify delegate: unused m_parent, tidy up inheritance, then drop unnecessary custom constructor and extra Q_OBJECT macro. - Drop some unnecessary included headers - Drop single-use #define. APP was used in only one place; remove it (that would be stylistically correct, anyway). - Update copyright headers - Document new label-handling
This commit is contained in:
parent
dc8cfd2fce
commit
f7494864be
3
CHANGES
3
CHANGES
@ -14,6 +14,9 @@ This release contains contributions from (alphabetically by first name):
|
||||
|
||||
## Core ##
|
||||
|
||||
- The side-pane, which shows the list of steps that will be executed,
|
||||
now tries to fit the text (name of each module) into the available space
|
||||
by shrinking the font as needed. #1137
|
||||
- *libcalamares* (accidentally) linked with Qt's GUI libraries when
|
||||
PythonQt was found. This led to the odd situation where the non-GUI
|
||||
Calamares library depends on a bunch of GUI libraries.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
||||
* Copyright 2018, Adriaan de Groot <groot@kde.org>
|
||||
* Copyright 2018-2019, 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
|
||||
@ -24,8 +24,6 @@
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
#define APP CalamaresApplication::instance()
|
||||
|
||||
class CalamaresWindow;
|
||||
|
||||
namespace Calamares
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
||||
* Copyright 2017, Adriaan de Groot <groot@kde.org>
|
||||
* Copyright 2017, 2019, 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
|
||||
@ -18,29 +18,19 @@
|
||||
*/
|
||||
|
||||
#include "ProgressTreeDelegate.h"
|
||||
#include "ProgressTreeModel.h"
|
||||
|
||||
#include "Branding.h"
|
||||
#include "CalamaresApplication.h"
|
||||
#include "CalamaresWindow.h"
|
||||
#include "ProgressTreeModel.h"
|
||||
#include "ViewManager.h"
|
||||
#include "ViewStepItem.h"
|
||||
|
||||
#include "utils/CalamaresUtilsGui.h"
|
||||
|
||||
#include <QAbstractItemView>
|
||||
#include <QPainter>
|
||||
|
||||
static constexpr int const item_margin = 8;
|
||||
static inline int item_fontsize() { return CalamaresUtils::defaultFontSize() + 4; }
|
||||
|
||||
ProgressTreeDelegate::ProgressTreeDelegate( QAbstractItemView* parent )
|
||||
: QStyledItemDelegate( parent )
|
||||
, m_parent( parent )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
QSize
|
||||
ProgressTreeDelegate::sizeHint( const QStyleOptionViewItem& option,
|
||||
const QModelIndex& index ) const
|
||||
@ -104,7 +94,7 @@ ProgressTreeDelegate::paintViewStep( QPainter* painter,
|
||||
QString textHighlight = Calamares::Branding::instance()->
|
||||
styleString( Calamares::Branding::SidebarTextHighlight );
|
||||
if ( textHighlight.isEmpty() )
|
||||
painter->setBrush( APP->mainWindow()->palette().background() );
|
||||
painter->setBrush( CalamaresApplication::instance()->mainWindow()->palette().background() );
|
||||
else
|
||||
painter->setBrush( QColor( textHighlight ) );
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
||||
*
|
||||
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
||||
* Copyright 2019, 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
|
||||
@ -21,7 +22,6 @@
|
||||
|
||||
#include <QStyledItemDelegate>
|
||||
|
||||
|
||||
/**
|
||||
* @brief The ProgressTreeDelegate class customizes the look and feel of the
|
||||
* ProgressTreeView elements.
|
||||
@ -29,9 +29,8 @@
|
||||
*/
|
||||
class ProgressTreeDelegate : public QStyledItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ProgressTreeDelegate( QAbstractItemView* parent = nullptr );
|
||||
using QStyledItemDelegate::QStyledItemDelegate;
|
||||
|
||||
protected:
|
||||
QSize sizeHint( const QStyleOptionViewItem& option,
|
||||
@ -44,8 +43,6 @@ private:
|
||||
void paintViewStep( QPainter* painter,
|
||||
const QStyleOptionViewItem& option,
|
||||
const QModelIndex& index ) const;
|
||||
|
||||
QAbstractItemView* m_parent;
|
||||
};
|
||||
|
||||
#endif // PROGRESSTREEDELEGATE_H
|
||||
|
Loading…
Reference in New Issue
Block a user