-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/ukui/ukui-sidebar
- Loading branch information
Showing
3 changed files
with
144 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,19 @@ | |
#include "ui_about.h" | ||
#include "utils/xatom-helper.h" | ||
|
||
#include <QGSettings> | ||
|
||
#define UKUI_STYLE_SCHEMA "org.ukui.style" | ||
#define STYLE_NAME "styleName" | ||
#define STYLE_NAME_KEY_DARK "ukui-dark" | ||
#define STYLE_NAME_KEY_DEFAULT "ukui-default" | ||
#define STYLE_NAME_KEY_BLACK "ukui-black" | ||
#define STYLE_NAME_KEY_LIGHT "ukui-light" | ||
#define STYLE_NAME_KEY_WHITE "ukui-white" | ||
|
||
#define SYSTEM_FONT_EKY "system-font-size" | ||
#define SYSTEM_NAME_KEY "system-font" | ||
|
||
extern void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed); | ||
|
||
About::About(QWidget *parent) : | ||
|
@@ -28,16 +41,16 @@ About::About(QWidget *parent) : | |
ui->closeBtn->setProperty("isWindowButton", 0x2); | ||
ui->closeBtn->setProperty("useIconHighlightEffect", 0x8); | ||
ui->closeBtn->setFlat(true); | ||
|
||
connect(ui->closeBtn, &QPushButton::clicked, this, [=](){ | ||
this->close(); | ||
}); | ||
ui->appnameLabel->setStyleSheet("QLabel{font-size: 18px; color: palette(windowText);}" | ||
"QLabel{font-family: NotoSansCJKsc-Medium, NotoSansCJKsc;}"); | ||
|
||
ui->versionLabel->setText(tr("Version: 2020.1.0")); | ||
ui->teamLabel->setText(tr("Service & Support: ") + | ||
"<a href=\"mailto://[email protected]\"" | ||
"style=\"color: palette(buttonText)\">" | ||
"[email protected]</a>"); | ||
// ui->teamLabel->setText(tr("Service & Support: ") + | ||
// "<a href=\"mailto://[email protected]\"" | ||
// "style=\"color: palette(buttonText)\">" | ||
// "[email protected]</a>"); | ||
ui->appiconLabel->setPixmap(QIcon::fromTheme("kylin-notebook").pixmap(96,96)); | ||
ui->appnameLabel->setText(tr("Kylin Memo")); | ||
ui->introduceLabel->setText(tr("Kylin Memo is a self-developed sidebar application plug-in, " | ||
|
@@ -49,6 +62,8 @@ About::About(QWidget *parent) : | |
QDesktopServices::openUrl(QUrl(url)); | ||
}); | ||
ui->teamLabel->setContextMenuPolicy(Qt::NoContextMenu); | ||
|
||
listenToGsettings(); | ||
} | ||
|
||
About::~About() | ||
|
@@ -64,3 +79,59 @@ void About::paintEvent(QPaintEvent *event) { | |
rectPath.addRect(this->rect()); | ||
p.fillPath(rectPath,palette().color(QPalette::Base)); | ||
} | ||
|
||
void About::listenToGsettings() | ||
{ | ||
const QByteArray styleID(UKUI_STYLE_SCHEMA); | ||
QStringList stylelist; | ||
|
||
if (QGSettings::isSchemaInstalled(styleID)){ | ||
QGSettings *styleUKUI = new QGSettings(styleID); | ||
|
||
stylelist << STYLE_NAME_KEY_DARK << STYLE_NAME_KEY_BLACK; //<<STYLE_NAME_KEY_DEFAULT; | ||
|
||
if(stylelist.contains(styleUKUI->get(STYLE_NAME).toString())){ | ||
ui->teamLabel->setText(tr("Service & Support: ") + | ||
"<a href=\"mailto://[email protected]\"" | ||
"style=\"color:white\">" | ||
"[email protected]</a>"); | ||
}else{ | ||
ui->teamLabel->setText(tr("Service & Support: ") + | ||
"<a href=\"mailto://[email protected]\"" | ||
"style=\"color:black\">" | ||
"[email protected]</a>"); | ||
} | ||
|
||
connect(styleUKUI, &QGSettings::changed, this, [=] (const QString &key){ | ||
if(key==STYLE_NAME){ | ||
if(stylelist.contains(styleUKUI->get(STYLE_NAME).toString())){ | ||
ui->teamLabel->setText(tr("Service & Support: ") + | ||
"<a href=\"mailto://[email protected]\"" | ||
"style=\"color:white\">" | ||
"[email protected]</a>"); | ||
}else{ | ||
ui->teamLabel->setText(tr("Service & Support: ") + | ||
"<a href=\"mailto://[email protected]\"" | ||
"style=\"color:black\">" | ||
"[email protected]</a>"); | ||
} | ||
} | ||
}); | ||
|
||
if(styleUKUI->get(SYSTEM_FONT_EKY).toInt()){ | ||
const int size = styleUKUI->get(SYSTEM_FONT_EKY).toInt(); | ||
QFont dateFont; | ||
dateFont.setPointSize(size * 1.3); | ||
ui->appnameLabel->setFont(dateFont); | ||
} | ||
|
||
connect(styleUKUI, &QGSettings::changed, this, [=](const QString &key){ | ||
if(key == "systemFontSize"){ | ||
const int size = styleUKUI->get(SYSTEM_FONT_EKY).toInt(); | ||
QFont dateFont; | ||
dateFont.setPointSize(size * 1.3); | ||
ui->appnameLabel->setFont(dateFont); | ||
} | ||
}); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -24,6 +24,8 @@ class About : public QDialog | |
|
||
private: | ||
Ui::About *ui; | ||
|
||
void listenToGsettings(); | ||
}; | ||
|
||
#endif // ABOUT_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