2016-10-21 12:37:26 +05:30
|
|
|
#include "SystemTheme.h"
|
|
|
|
#include <QApplication>
|
|
|
|
#include <QStyle>
|
2016-10-22 05:13:36 +05:30
|
|
|
#include <QStyleFactory>
|
|
|
|
#include <QDebug>
|
2016-10-21 12:37:26 +05:30
|
|
|
|
|
|
|
SystemTheme::SystemTheme()
|
|
|
|
{
|
2016-10-22 05:13:36 +05:30
|
|
|
const auto & style = QApplication::style();
|
|
|
|
systemPalette = style->standardPalette();
|
|
|
|
QString lowerThemeName = style->objectName();
|
|
|
|
qWarning() << systemTheme;
|
|
|
|
QStringList styles = QStyleFactory::keys();
|
|
|
|
for(auto &st: styles)
|
|
|
|
{
|
|
|
|
if(st.toLower() == lowerThemeName)
|
|
|
|
{
|
|
|
|
systemTheme = st;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// fall back to fusion if we can't find the current theme.
|
|
|
|
systemTheme = "Fusion";
|
2017-01-16 03:26:03 +05:30
|
|
|
qWarning() << "System theme not found, defaulted to Fusion";
|
2016-10-21 12:37:26 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
QString SystemTheme::id()
|
|
|
|
{
|
|
|
|
return "system";
|
|
|
|
}
|
|
|
|
|
|
|
|
QString SystemTheme::name()
|
|
|
|
{
|
|
|
|
return QObject::tr("System");
|
|
|
|
}
|
|
|
|
|
2016-10-22 05:13:36 +05:30
|
|
|
QString SystemTheme::qtTheme()
|
|
|
|
{
|
|
|
|
return systemTheme;
|
|
|
|
}
|
|
|
|
|
2016-10-21 12:37:26 +05:30
|
|
|
QPalette SystemTheme::colorScheme()
|
|
|
|
{
|
|
|
|
return systemPalette;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString SystemTheme::appStyleSheet()
|
|
|
|
{
|
|
|
|
return QString();
|
|
|
|
}
|
2016-11-06 08:59:12 +05:30
|
|
|
|
|
|
|
double SystemTheme::fadeAmount()
|
|
|
|
{
|
|
|
|
return 0.5;
|
|
|
|
}
|
|
|
|
|
|
|
|
QColor SystemTheme::fadeColor()
|
|
|
|
{
|
|
|
|
return QColor(128,128,128);
|
|
|
|
}
|
2017-01-16 03:26:03 +05:30
|
|
|
|
|
|
|
bool SystemTheme::hasStyleSheet()
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool SystemTheme::hasColorScheme()
|
|
|
|
{
|
|
|
|
// FIXME: horrible hack to work around Qt's sketchy theming APIs
|
|
|
|
#if defined(Q_OS_LINUX)
|
|
|
|
return true;
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|