Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Themes.h « mumble « src - github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0b0e90429d5af72f1c0a23615c7049f25a606813 (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Copyright 2015-2021 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#ifndef MUMBLE_MUMBLE_THEMES_H_
#define MUMBLE_MUMBLE_THEMES_H_

#include <Settings.h>
#include <ThemeInfo.h>
#ifndef Q_MOC_RUN
#	include <boost/optional.hpp>
#endif

class Themes {
public:
	/// Returns the style configured in the given settings structure
	static boost::optional< ThemeInfo::StyleInfo > getConfiguredStyle(const Settings &settings);

	/// Updates the given settings object to be configured to the given style
	///
	/// @note Does not apply the theme @see apply
	///
	/// @param settings Settings object to update
	/// @param style Style to set
	/// @param outChanged Will be set to true if the style in settings actually changed. Will not be changed otherwise.
	static void setConfiguredStyle(Settings &settings, boost::optional< ThemeInfo::StyleInfo > style, bool &outChanged);

	/// Applies the theme
	///
	/// @note Can only apply a theme before MainWindow etc. is opened
	static bool apply();

	/// Return a theme name to theme map
	static ThemeMap getThemes();

	/// Returns the per user themes directory
	static QDir getUserThemesDirectory();

private:
	/// Applies the fallback stylesheet
	static void applyFallback();

	/// Tries to apply the configured theme.
	/// @return True on success. False on failure.
	static bool applyConfigured();

	// Sets the theme to a QSS theme
	static void setTheme(QString &themeQss, QStringList &skinPaths);

	/// Returns list of theme search directories ordered ascending by priorty (lowest first)
	static QVector< QDir > getSearchDirectories();

	/// Returns default style-sheet used for fall-backs
	static QString getDefaultStylesheet();

	/// userStylesheetPath returns the absolute path to the
	/// user.qss file.
	static QString userStylesheetPath();

	/// readStylesheet fills stylesheetContent with the content
	/// of the file at stylesheetFn, if available.
	/// If a the file is is available, the function returns true.
	/// If no file is available, it returns false.
	static bool readStylesheet(const QString &stylesheetFn, QString &stylesheetContent);
};

#endif // MUMBLE_MUMBLE_THEMES_H_