mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
5f91c69f9c
Create the themes only when needed (singleton pattern). If the themes should do more than colors, such as for example fonts, it is not clear whether that can be done before main() runs. By creating the themes on demand, the Qt UI should be initialized in the constructors of the themes. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
55 lines
1.7 KiB
C++
55 lines
1.7 KiB
C++
// SPDX-License-Identifier: GPL-2.0
|
|
// Color constants for the various series
|
|
#ifndef STATSCOLORS_H
|
|
#define STATSCOLORS_H
|
|
|
|
#include <memory>
|
|
#include <QColor>
|
|
#include <QString>
|
|
|
|
class QSGTexture;
|
|
|
|
class StatsTheme {
|
|
public:
|
|
StatsTheme();
|
|
virtual QString name() const = 0;
|
|
QColor backgroundColor;
|
|
QColor fillColor;
|
|
QColor borderColor;
|
|
QColor selectedColor;
|
|
QColor selectedBorderColor;
|
|
QColor highlightedColor;
|
|
QColor highlightedBorderColor;
|
|
// The dark and light label colors are with respect to the light theme.
|
|
// In the dark theme, dark is light and light is dark. Might want to change the names!
|
|
QColor darkLabelColor;
|
|
QColor lightLabelColor;
|
|
QColor axisColor;
|
|
QColor gridColor;
|
|
QColor informationBorderColor;
|
|
QColor informationColor;
|
|
QColor legendColor;
|
|
QColor legendBorderColor;
|
|
QColor quartileMarkerColor;
|
|
QColor regressionItemColor;
|
|
QColor meanMarkerColor;
|
|
QColor medianMarkerColor;
|
|
QColor selectionLassoColor;
|
|
QColor selectionOverlayColor;
|
|
virtual QColor binColor(int bin, int numBins) const = 0;
|
|
virtual QColor labelColor(int bin, size_t numBins) const = 0;
|
|
|
|
// These are cashes for the QSG rendering engine
|
|
// Note: Originally these were std::unique_ptrs, which automatically
|
|
// freed the textures on exit. However, destroying textures after
|
|
// QApplication finished its thread leads to crashes. Therefore, these
|
|
// are now normal pointers and the texture objects are leaked.
|
|
mutable QSGTexture *scatterItemTexture = nullptr;
|
|
mutable QSGTexture *scatterItemSelectedTexture = nullptr;
|
|
mutable QSGTexture *scatterItemHighlightedTexture = nullptr;
|
|
mutable QSGTexture *selectedTexture = nullptr; // A checkerboard pattern.
|
|
};
|
|
|
|
extern const StatsTheme &getStatsTheme(bool dark);
|
|
|
|
#endif
|