summaryrefslogtreecommitdiffstats
path: root/application/themes/SystemTheme.cpp
blob: 6d8a0ee872864138f51878efd476bcad6002428d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "SystemTheme.h"
#include <QApplication>
#include <QStyle>
#include <QStyleFactory>
#include <QDebug>

SystemTheme::SystemTheme()
{
	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";
}

QString SystemTheme::id()
{
	return "system";
}

QString SystemTheme::name()
{
	return QObject::tr("System");
}

QString SystemTheme::qtTheme()
{
	return systemTheme;
}

QPalette SystemTheme::colorScheme()
{
	return systemPalette;
}

QString SystemTheme::appStyleSheet()
{
	return QString();
}