diff --git a/src/fs/filesystem.cpp b/src/fs/filesystem.cpp index 414d158..42c7bf0 100644 --- a/src/fs/filesystem.cpp +++ b/src/fs/filesystem.cpp @@ -23,6 +23,37 @@ #include #include + +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 diff --git a/src/fs/filesystem.h b/src/fs/filesystem.h index 82a7408..d89b48f 100644 --- a/src/fs/filesystem.h +++ b/src/fs/filesystem.h @@ -21,11 +21,14 @@ #include "../util/libpartitionmanagerexport.h" #include +#include #include #include #include #include +#include + 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: diff --git a/src/gui/partwidget.cpp b/src/gui/partwidget.cpp index 2a26888..447ba8b 100644 --- a/src/gui/partwidget.cpp +++ b/src/gui/partwidget.cpp @@ -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); diff --git a/src/gui/partwidget.h b/src/gui/partwidget.h index cc2c394..9ac1ad6 100644 --- a/src/gui/partwidget.h +++ b/src/gui/partwidget.h @@ -21,8 +21,13 @@ #include "../util/libpartitionmanagerexport.h" +#include "../fs/filesystem.h" #include "partwidgetbase.h" +#include + +#include + 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