-
-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
92 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include "DarkStyle.h" | ||
#include "DarkStylePlugin.h" | ||
#include "LightStyle.h" | ||
#include "TraditionalWindowsStyleTreeControl.h" | ||
|
||
#include <QApplication> | ||
|
||
QStyle *DarkStylePlugin::createLightStyle() | ||
{ | ||
return new LightStyle(); | ||
} | ||
|
||
QStyle *DarkStylePlugin::createDarkStyle() | ||
{ | ||
return new DarkStyle(); | ||
} | ||
|
||
void DarkStylePlugin::applyDarkStyle(QApplication *app) | ||
{ | ||
QStyle *style = createDarkStyle(); | ||
app->setStyle(style); | ||
app->setPalette(style->standardPalette()); | ||
} | ||
|
||
void DarkStylePlugin::applyLightStyle(QApplication *app) | ||
{ | ||
QStyle *style = createLightStyle(); | ||
app->setStyle(style); | ||
#ifndef Q_OS_WIN | ||
app->setPalette(style->standardPalette()); | ||
#endif | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#ifndef DARKSTYLEPLUGIN_H | ||
#define DARKSTYLEPLUGIN_H | ||
|
||
#include "../DarkStyleInterface.h" | ||
|
||
#include <QObject> | ||
|
||
class TraditionalWindowsStyleTreeControl; | ||
|
||
class DarkStylePlugin : public QObject, public DarkStyleInterface { | ||
Q_OBJECT | ||
Q_PLUGIN_METADATA(IID "jp.soramimi.DarkStylePlugin" FILE "darkstyleplugin.json") | ||
Q_INTERFACES(DarkStyleInterface) | ||
private: | ||
QStyle *createLightStyle(); | ||
QStyle *createDarkStyle(); | ||
public: | ||
void applyDarkStyle(QApplication *app) override; | ||
void applyLightStyle(QApplication *app) override; | ||
}; | ||
|
||
#endif // DARKSTYLEPLUGIN_H |
4 changes: 2 additions & 2 deletions
4
src/darktheme/StandardStyle.cpp → src/darktheme/LightStyle.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,18 @@ | ||
#ifndef STANDARDSTYLE_H | ||
#define STANDARDSTYLE_H | ||
#ifndef LIGHTSTYLE_H | ||
#define LIGHTSTYLE_H | ||
|
||
#include "TraditionalWindowsStyleTreeControl.h" | ||
|
||
#include <QProxyStyle> | ||
|
||
|
||
class StandardStyle : public QProxyStyle { | ||
class LightStyle : public QProxyStyle { | ||
private: | ||
TraditionalWindowsStyleTreeControl legacy_windows_; | ||
public: | ||
StandardStyle() | ||
LightStyle() | ||
: QProxyStyle(nullptr) | ||
{ | ||
} | ||
void drawPrimitive(PrimitiveElement element, QStyleOption const *option, QPainter *painter, QWidget const *widget = nullptr) const override; | ||
}; | ||
|
||
#endif // STANDARDSTYLE_H | ||
#endif // LIGHTSTYLE_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters