!88 登录界面字体更改未生效 登录界面的时间显示格式不正确
Merge pull request !88 from liudunfa/openkylin/nile
This commit is contained in:
commit
666a04929e
|
@ -34,6 +34,7 @@
|
|||
#include <QTextStream>
|
||||
#include <QtX11Extras/QX11Info>
|
||||
#include <X11/XKBlib.h>
|
||||
#include <QSettings>
|
||||
|
||||
#define DRM_DIR "/sys/class/leds/"
|
||||
|
||||
|
@ -149,3 +150,34 @@ double getDefaultFontSize()
|
|||
}
|
||||
return defaultFontSize;
|
||||
}
|
||||
|
||||
double getUserFontSize(QString userName)
|
||||
{
|
||||
getDefaultFontSize();
|
||||
QString configPath;
|
||||
configPath = QString("/var/lib/lightdm-data/%1/ukui-greeter.conf").arg(userName);
|
||||
QFile configFile(configPath);
|
||||
double fontSize;
|
||||
if (configFile.exists()) {
|
||||
QSettings settings(configPath, QSettings::IniFormat);
|
||||
settings.beginGroup("Greeter");
|
||||
fontSize = settings.value("fontSize").toDouble();
|
||||
} else {
|
||||
fontSize = getDefaultFontSize();
|
||||
}
|
||||
return fontSize - getDefaultFontSize();
|
||||
}
|
||||
|
||||
QString getUserThemeColor(QString userName)
|
||||
{
|
||||
QString configPath;
|
||||
configPath = QString("/var/lib/lightdm-data/%1/ukui-greeter.conf").arg(userName);
|
||||
QFile configFile(configPath);
|
||||
QString themeColor = "daybreakBlue";
|
||||
if (configFile.exists()) {
|
||||
QSettings settings(configPath, QSettings::IniFormat);
|
||||
settings.beginGroup("Greeter");
|
||||
themeColor = settings.value("themeColor").toString();
|
||||
}
|
||||
return themeColor;
|
||||
}
|
||||
|
|
|
@ -40,4 +40,8 @@ bool ispicture(QString filepath);
|
|||
|
||||
double getDefaultFontSize();
|
||||
|
||||
double getUserFontSize(QString userName);
|
||||
|
||||
QString getUserThemeColor(QString userName);
|
||||
|
||||
#endif // UTILS_H
|
||||
|
|
|
@ -124,7 +124,7 @@ bool SessionHelper::doAction(const QString &powerManagerfunc)
|
|||
up_to_time = new QTimer();
|
||||
up_to_time->setSingleShot(true);
|
||||
|
||||
qDebug() << "playShutdownMusic(powerManagerfunc) = " << playShutdownMusic(powerManagerfunc);
|
||||
// qDebug() << "playShutdownMusic(powerManagerfunc) = " << playShutdownMusic(powerManagerfunc);
|
||||
|
||||
if (!playShutdownMusic(powerManagerfunc)) {
|
||||
doPowerManager(powerManagerfunc);
|
||||
|
@ -197,21 +197,24 @@ bool SessionHelper::playShutdownMusic(const QString &powerManagerfunc)
|
|||
// otherwise run ukui-session-tools --suspend with segmente error.
|
||||
// because they will be delate at the end of the playShutdownMusic().
|
||||
bool play_music = false;
|
||||
QDBusMessage msg;
|
||||
GSettingsHelper *gsettingsHelper = new GSettingsHelper(this);
|
||||
if (powerManagerfunc == "Reboot" || powerManagerfunc == "PowerOff") {
|
||||
play_music = gsettingsHelper->GetSessionConf(KEY_SESSION_POWEROFF_MUSIC).toBool();
|
||||
} else if (powerManagerfunc == "Logout") {
|
||||
play_music = gsettingsHelper->GetSessionConf(KEY_SESSION_LOGOUT_MUSIC).toBool();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
QDBusMessage msg;
|
||||
if (powerManagerfunc == "SwitchUser") {
|
||||
msg = m_sessionInterface->call("emitPrepareForSwitchuser");
|
||||
msg = m_sessionInterface->call("emitStartLogout");
|
||||
if (!msg.errorName().isEmpty()) {
|
||||
qWarning() << "Dbus error: " << msg;
|
||||
}
|
||||
} else {
|
||||
if (powerManagerfunc == "SwitchUser") {
|
||||
msg = m_sessionInterface->call("emitPrepareForSwitchuser");
|
||||
if (!msg.errorName().isEmpty()) {
|
||||
qWarning() << "Dbus error: " << msg;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (play_music) {
|
||||
|
|
|
@ -55,7 +55,7 @@ void LanguageSetting::onLanguageChanged(QString languageCode)
|
|||
if (languageCode.startsWith("zh_CN")) { /*这里写的有问题,忘记之前为什么写了,会导致繁体也会加载zh_CN*/
|
||||
qmFile = QString(WORKING_DIRECTORY "/i18n_qm/%1.qm").arg("zh_CN");
|
||||
setenv("LANGUAGE", "zh_CN", 1);
|
||||
// setenv("LANG","zh_CN",1);
|
||||
setenv("LANG","zh_CN",1);
|
||||
setlocale(LC_ALL, "zh_CN.utf8");
|
||||
QLocale lang("zh_CN");
|
||||
/*这里设置一个QLocale的默认值,用来影响插件的语言。插件加载翻译文件时,不使用QLocale::system().name()来获取语言,
|
||||
|
@ -64,7 +64,7 @@ void LanguageSetting::onLanguageChanged(QString languageCode)
|
|||
} else {
|
||||
qmFile = QString(WORKING_DIRECTORY "/i18n_qm/%1.qm").arg(languageCode);
|
||||
setenv("LANGUAGE", languageCode.toLatin1().data(), 1);
|
||||
// setenv("LANG",languageCode.toLatin1().data(),1);
|
||||
setenv("LANG",languageCode.toLatin1().data(),1);
|
||||
setlocale(LC_ALL, "");
|
||||
QLocale lang(languageCode);
|
||||
/*这里设置一个QLocale的默认值,用来影响插件的语言。插件加载翻译文件时,不使用QLocale::system().name()来获取语言,
|
||||
|
|
|
@ -537,6 +537,8 @@ Q_SIGNALS:
|
|||
|
||||
void fontChanged(QString font);
|
||||
|
||||
void setUserThemeColor(QString keyStr, QVariant themeColor);
|
||||
|
||||
private:
|
||||
QString getXScreensaverPath(const QString &theme);
|
||||
|
||||
|
|
|
@ -171,6 +171,7 @@ void LockDialogPerformer::initConnections()
|
|||
connect(m_modelLockDialog, &LockDialogModel::lockStateChanged, m_bdHelper, &BackendDbusHelper::lockStateChanged);
|
||||
connect(m_modelLockDialog, &LockDialogModel::getPublicEncrypt, m_bdHelper, &BackendDbusHelper::getPublicEncrypt);
|
||||
connect(m_modelLockDialog, &LockDialogModel::sendPassword, m_bdHelper, &BackendDbusHelper::sendPassword);
|
||||
connect(m_modelLockDialog, &LockDialogModel::setUserThemeColor, m_bdHelper, &BackendDbusHelper::setThemeStyleConf);
|
||||
}
|
||||
|
||||
void LockDialogPerformer::initData()
|
||||
|
|
|
@ -263,6 +263,9 @@ void AuthDialog::updateAuthFontSize(double fontSize)
|
|||
if (m_labelQRCodeMsg) {
|
||||
m_labelQRCodeMsg->setFontSize((14 + fontSize) * m_ptToPx);
|
||||
}
|
||||
if (m_passwordEdit) {
|
||||
m_passwordEdit->setFontSize((16 + fontSize) * m_ptToPx);
|
||||
}
|
||||
}
|
||||
|
||||
void AuthDialog::initTipWidget()
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <QDir>
|
||||
#include <QDebug>
|
||||
#include <QTimer>
|
||||
#include <QApplication>
|
||||
#include "commonfunc.h"
|
||||
#include "utils.h"
|
||||
|
||||
|
@ -282,6 +283,13 @@ void IconEdit::updateUI()
|
|||
m_capsIcon->setPixmap(QIcon::fromTheme("ukui-capslock-symbolic").pixmap(QSize(16, 16)));
|
||||
}
|
||||
|
||||
void IconEdit::setFontSize(double fontSize)
|
||||
{
|
||||
QFont font = qApp->font();
|
||||
font.setPointSize(fontSize);
|
||||
m_edit->setFont(font);
|
||||
}
|
||||
|
||||
void IconEdit::updatePixmap()
|
||||
{
|
||||
m_iconButton->setEnabled(true);
|
||||
|
|
|
@ -49,6 +49,7 @@ public:
|
|||
void startWaiting();
|
||||
void stopWaiting();
|
||||
void updateUI();
|
||||
void setFontSize(double fontSize);
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
#include "../lock-dialog/languagesetting.h"
|
||||
#include "../lock-dialog/rootWindowBackground.h"
|
||||
#include "configuration.h"
|
||||
#include "utils.h"
|
||||
|
||||
#define BLUR_RADIUS 300
|
||||
#define RIGHT_MARGIN 24
|
||||
|
@ -727,6 +728,10 @@ void LockWidget::onCurUserChanged(const QString &strUserName)
|
|||
}
|
||||
if (authDialog)
|
||||
authDialog->onCurUserChanged(m_curUserInfo);
|
||||
m_curFontSize = getUserFontSize(strUserName);
|
||||
updateFontSize();
|
||||
QVariant curUserThemeColor = getUserThemeColor(strUserName);
|
||||
Q_EMIT m_modelLockDialog->setUserThemeColor("themeColor", curUserThemeColor);
|
||||
// 登录后绘制桌面背景而不是登录背景
|
||||
QString backgroundPath = m_curUserInfo->backGround();
|
||||
QFile backgroundPathFile(backgroundPath);
|
||||
|
@ -1293,6 +1298,7 @@ void LockWidget::onFontChanged(QString font)
|
|||
void LockWidget::onFontSizeChanged(double fontSize)
|
||||
{
|
||||
m_curFontSize = fontSize;
|
||||
updateFontSize();
|
||||
}
|
||||
|
||||
void LockWidget::SwitchToUser(QString strUserName)
|
||||
|
|
|
@ -102,7 +102,10 @@ void TimeWidget::updateTimeFontSize(double fontSize)
|
|||
|
||||
QString TimeWidget::getLongFormatDate(int type)
|
||||
{
|
||||
kdk_logn_dateinfo *dateInfo = kdk_system_login_lock_dateinfo(getenv("USER"));
|
||||
char* userName;
|
||||
QByteArray ba = m_modelLockDialog->currentUserName().toLatin1();
|
||||
userName = ba.data();
|
||||
kdk_logn_dateinfo *dateInfo = kdk_system_login_lock_dateinfo(userName);
|
||||
if (type == DATE)
|
||||
{
|
||||
QString date = dateInfo->date;
|
||||
|
|
Loading…
Reference in New Issue