Merge pull request #15769 from now-im/flow

Implement new icon/color theme
This commit is contained in:
sledgehammer999 2022-06-28 23:23:25 +03:00 committed by GitHub
commit 0e989185ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
169 changed files with 279 additions and 791 deletions

View file

@ -46,66 +46,41 @@
namespace
{
bool isDarkTheme()
{
const QPalette pal = QApplication::palette();
// QPalette::Base is used for the background of the Treeview
const QColor &color = pal.color(QPalette::Active, QPalette::Base);
return (color.lightness() < 127);
}
QColor getDefaultColorByState(const BitTorrent::TorrentState state)
{
// Color names taken from http://cloford.com/resources/colours/500col.htm
const bool dark = isDarkTheme();
switch (state)
{
case BitTorrent::TorrentState::Downloading:
case BitTorrent::TorrentState::ForcedDownloading:
case BitTorrent::TorrentState::DownloadingMetadata:
case BitTorrent::TorrentState::ForcedDownloadingMetadata:
if (!dark)
return {34, 139, 34}; // Forest Green
else
return {50, 205, 50}; // Lime Green
return QColorConstants::Svg::green;
case BitTorrent::TorrentState::StalledDownloading:
return QColorConstants::Svg::mediumseagreen;
case BitTorrent::TorrentState::StalledUploading:
if (!dark)
return {0, 0, 0}; // Black
else
return {204, 204, 204}; // Gray 80
return QColorConstants::Svg::cornflowerblue;
case BitTorrent::TorrentState::Uploading:
case BitTorrent::TorrentState::ForcedUploading:
if (!dark)
return {65, 105, 225}; // Royal Blue
else
return {99, 184, 255}; // Steel Blue 1
return QColorConstants::Svg::royalblue;
case BitTorrent::TorrentState::PausedDownloading:
return {250, 128, 114}; // Salmon
return QColorConstants::Svg::grey;
case BitTorrent::TorrentState::PausedUploading:
if (!dark)
return {0, 0, 139}; // Dark Blue
else
return {79, 148, 205}; // Steel Blue 3
case BitTorrent::TorrentState::Error:
case BitTorrent::TorrentState::MissingFiles:
return {255, 0, 0}; // red
return QColorConstants::Svg::darkslateblue;
case BitTorrent::TorrentState::QueuedDownloading:
case BitTorrent::TorrentState::QueuedUploading:
return QColorConstants::Svg::peru;
case BitTorrent::TorrentState::CheckingDownloading:
case BitTorrent::TorrentState::CheckingUploading:
case BitTorrent::TorrentState::CheckingResumeData:
case BitTorrent::TorrentState::Moving:
if (!dark)
return {0, 128, 128}; // Teal
else
return {0, 205, 205}; // Cyan 3
return QColorConstants::Svg::teal;
case BitTorrent::TorrentState::Error:
case BitTorrent::TorrentState::MissingFiles:
case BitTorrent::TorrentState::Unknown:
return {255, 0, 0}; // red
return QColorConstants::Svg::red;
default:
Q_ASSERT(false);
return {255, 0, 0}; // red
return QColorConstants::Svg::red;
}
}
@ -176,15 +151,15 @@ TransferListModel::TransferListModel(QObject *parent)
{BitTorrent::TorrentState::Error, tr("Errored", "Torrent status, the torrent has an error")}
}
, m_stateThemeColors {torrentStateColorsFromUITheme()}
, m_checkingIcon {UIThemeManager::instance()->getIcon(u"checking"_qs)}
, m_completedIcon {UIThemeManager::instance()->getIcon(u"completed"_qs)}
, m_checkingIcon {UIThemeManager::instance()->getIcon(u"force-recheck"_qs)}
, m_completedIcon {UIThemeManager::instance()->getIcon(u"checked-completed"_qs)}
, m_downloadingIcon {UIThemeManager::instance()->getIcon(u"downloading"_qs)}
, m_errorIcon {UIThemeManager::instance()->getIcon(u"error"_qs)}
, m_pausedIcon {UIThemeManager::instance()->getIcon(u"paused"_qs)}
, m_pausedIcon {UIThemeManager::instance()->getIcon(u"media-playback-pause"_qs)}
, m_queuedIcon {UIThemeManager::instance()->getIcon(u"queued"_qs)}
, m_stalledDLIcon {UIThemeManager::instance()->getIcon(u"stalledDL"_qs)}
, m_stalledUPIcon {UIThemeManager::instance()->getIcon(u"stalledUP"_qs)}
, m_uploadingIcon {UIThemeManager::instance()->getIcon(u"uploading"_qs)}
, m_uploadingIcon {UIThemeManager::instance()->getIcon(u"kt-set-max-upload-speed"_qs)}
{
configure();
connect(Preferences::instance(), &Preferences::changed, this, &TransferListModel::configure);