2
0
forked from Ivasoft/DSView

add: theme style name defines

This commit is contained in:
dreamsourcelabTAI
2022-04-06 18:00:16 +08:00
parent 050aa9b0ec
commit b787c350d5
7 changed files with 14 additions and 19 deletions

View File

@@ -137,7 +137,7 @@ void _saveDockOptions(DockOptions &o, QSettings &st, const char *group){
void _loadFrame(FrameOptions &o, QSettings &st){
st.beginGroup("MainFrame");
getFiled("style", st, o.style, "dark");
getFiled("style", st, o.style, THEME_STYLE_DARK);
getFiled("language", st, o.language, -1);
getFiled("isMax", st, o.isMax, false);
getFiled("left", st, o.left, 0);
@@ -313,7 +313,7 @@ QString GetIconPath()
{
QString style = AppConfig::Instance()._frameOptions.style;
if (style == ""){
style = "dark";
style = THEME_STYLE_DARK;
}
return ":/icons/" + style;
}

View File

@@ -29,7 +29,9 @@
#define LAN_CN 25
#define LAN_EN 31
//#define DARK_STYLE "dark"
#define THEME_STYLE_DARK "dark"
#define THEME_STYLE_LIGHT "light"
#define APP_NAME "DSView"
//--------------------api---

View File

@@ -36,10 +36,7 @@
namespace pv {
namespace toolbars {
const QString TrigBar::DARK_STYLE = "dark";
const QString TrigBar::LIGHT_STYLE = "light";
TrigBar::TrigBar(SigSession *session, QWidget *parent) :
QToolBar("Trig Bar", parent),
_session(session),
@@ -326,15 +323,15 @@ void TrigBar::on_actionMath_triggered()
void TrigBar::on_actionDark_triggered()
{
sig_setTheme(DARK_STYLE);
QString icon = GetIconPath() + "/" + DARK_STYLE + ".svg";
sig_setTheme(THEME_STYLE_DARK);
QString icon = GetIconPath() + "/" + THEME_STYLE_DARK + ".svg";
_themes->setIcon(QIcon(icon));
}
void TrigBar::on_actionLight_triggered()
{
sig_setTheme(LIGHT_STYLE);
QString icon = GetIconPath() + "/" + LIGHT_STYLE +".svg";
sig_setTheme(THEME_STYLE_LIGHT);
QString icon = GetIconPath() + "/" + THEME_STYLE_LIGHT +".svg";
_themes->setIcon(QIcon(icon));
}

View File

@@ -42,10 +42,6 @@ class TrigBar : public QToolBar
{
Q_OBJECT
protected:
static const QString DARK_STYLE;
static const QString LIGHT_STYLE;
public:
explicit TrigBar(SigSession *session, QWidget *parent = 0);

View File

@@ -65,7 +65,7 @@ DsComboBox::DsComboBox(QWidget *parent) : QComboBox(parent)
int h = rc.bottom() - rc.top() + 15;
popup->setGeometry(x, y, w, h);
if (AppConfig::Instance()._frameOptions.style == "dark"){
if (AppConfig::Instance()._frameOptions.style == THEME_STYLE_DARK){
popup->setStyleSheet("background-color:#262626;");
}
else{

View File

@@ -55,7 +55,7 @@ private:
static const int GRID_COLS = 3;
public:
DevMode(QWidget *parent, SigSession *ession);
DevMode(QWidget *parent, SigSession *session);
private:
void paintEvent(QPaintEvent *event);

View File

@@ -59,7 +59,7 @@ void Border::paintEvent(QPaintEvent *)
AppConfig &app = AppConfig::Instance();
QString style = app._frameOptions.style;
if (style == "dark") {
if (style == THEME_STYLE_DARK) {
linearGrad.setColorAt(0, dark_border0);
linearGrad.setColorAt(0.25, dark_border1);
linearGrad.setColorAt(0.5, dark_border2);
@@ -74,7 +74,7 @@ void Border::paintEvent(QPaintEvent *)
}
QRadialGradient radialGrad(QPointF(0, 0), width());
if (style == "dark") {
if (style == THEME_STYLE_DARK) {
radialGrad.setColorAt(0, dark_border0);
radialGrad.setColorAt(0.25, dark_border1);
radialGrad.setColorAt(0.5, dark_border2);