Have PartWidget color codes not use KConfig.
This commit is contained in:
parent
fda3c2c814
commit
93d933c498
|
@ -23,6 +23,37 @@
|
|||
#include <blkid/blkid.h>
|
||||
#include <KLocalizedString>
|
||||
|
||||
|
||||
const std::array< QColor, FileSystem::__lastType > FileSystem::defaultColorCode =
|
||||
{
|
||||
QColor( 220,205,175 ),
|
||||
QColor( 187,249,207 ),
|
||||
QColor( 102,121,150 ),
|
||||
QColor( 122,145,180 ),
|
||||
QColor( 143,170,210 ),
|
||||
QColor( 155,155,130 ),
|
||||
QColor( 204,179,215 ),
|
||||
QColor( 229,201,240 ),
|
||||
QColor( 244,214,255 ),
|
||||
QColor( 216,220,135 ),
|
||||
QColor( 251,255,157 ),
|
||||
QColor( 200,255,254 ),
|
||||
QColor( 137,200,198 ),
|
||||
QColor( 210,136,142 ),
|
||||
QColor( 240,165,171 ),
|
||||
QColor( 151,220,134 ),
|
||||
QColor( 220,205,175 ),
|
||||
QColor( 173,205,255 ),
|
||||
QColor( 176,155,185 ),
|
||||
QColor( 170,30,77 ),
|
||||
QColor( 96,140,85 ),
|
||||
QColor( 33,137,108 ),
|
||||
QColor( 250,230,255 ),
|
||||
QColor( 242,155,104 ),
|
||||
QColor( 160,210,180 )
|
||||
};
|
||||
|
||||
|
||||
/** Creates a new FileSystem object
|
||||
@param firstsector the first sector used by this FileSystem on the Device
|
||||
@param lastsector the last sector used by this FileSystem on the Device
|
||||
|
|
|
@ -21,11 +21,14 @@
|
|||
#include "../util/libpartitionmanagerexport.h"
|
||||
|
||||
#include <qglobal.h>
|
||||
#include <QColor>
|
||||
#include <QStringList>
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
#include <QUrl>
|
||||
|
||||
#include <array>
|
||||
|
||||
class Device;
|
||||
class Report;
|
||||
|
||||
|
@ -90,6 +93,8 @@ public:
|
|||
cmdSupportBackend = 4 /**< supported by the backend */
|
||||
};
|
||||
|
||||
static const std::array< QColor, __lastType > defaultColorCode;
|
||||
|
||||
Q_DECLARE_FLAGS(CommandSupportTypes, CommandSupportType)
|
||||
|
||||
protected:
|
||||
|
|
|
@ -39,6 +39,7 @@ PartWidget::PartWidget(QWidget* parent, const Partition* p) :
|
|||
{
|
||||
setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
|
||||
init(p);
|
||||
m_fileSystemColorCode = FileSystem::defaultColorCode;
|
||||
}
|
||||
|
||||
void PartWidget::init(const Partition* p)
|
||||
|
@ -72,6 +73,12 @@ void PartWidget::updateChildren()
|
|||
}
|
||||
}
|
||||
|
||||
void PartWidget::setFileSystemColorCode(const std::array< QColor, FileSystem::__lastType >& colorCode)
|
||||
{
|
||||
m_fileSystemColorCode = colorCode;
|
||||
repaint();
|
||||
}
|
||||
|
||||
void PartWidget::resizeEvent(QResizeEvent*)
|
||||
{
|
||||
if (partition())
|
||||
|
@ -95,11 +102,13 @@ void PartWidget::paintEvent(QPaintEvent*)
|
|||
painter.setRenderHints(QPainter::Antialiasing);
|
||||
|
||||
if (partition()->roles().has(PartitionRole::Extended)) {
|
||||
drawGradient(&painter, activeColor(Config::fileSystemColorCode(partition()->fileSystem().type())), QRect(0, 0, width(), height()));
|
||||
drawGradient(&painter, activeColor(
|
||||
m_fileSystemColorCode[ partition()->fileSystem().type() ]),
|
||||
QRect(0, 0, width(), height()));
|
||||
return;
|
||||
}
|
||||
|
||||
const QColor base = activeColor(Config::fileSystemColorCode(partition()->fileSystem().type()));
|
||||
const QColor base = activeColor(m_fileSystemColorCode[ partition()->fileSystem().type() ]);
|
||||
|
||||
if (!partition()->roles().has(PartitionRole::Unallocated)) {
|
||||
const QColor dark = base.darker(105);
|
||||
|
|
|
@ -21,8 +21,13 @@
|
|||
|
||||
#include "../util/libpartitionmanagerexport.h"
|
||||
|
||||
#include "../fs/filesystem.h"
|
||||
#include "partwidgetbase.h"
|
||||
|
||||
#include <QColor>
|
||||
|
||||
#include <array>
|
||||
|
||||
class Partition;
|
||||
|
||||
class QPaintEvent;
|
||||
|
@ -55,6 +60,8 @@ public:
|
|||
return m_Partition; /**< @return the widget's Partition */
|
||||
}
|
||||
|
||||
void setFileSystemColorCode( const std::array< QColor, FileSystem::__lastType >& colorCode );
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* event);
|
||||
void resizeEvent(QResizeEvent* event);
|
||||
|
@ -66,6 +73,7 @@ protected:
|
|||
private:
|
||||
const Partition* m_Partition;
|
||||
bool m_Active;
|
||||
std::array< QColor, FileSystem::__lastType > m_fileSystemColorCode;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue