!39 Task: 需求#17430 用户登录前展示一个用户使用特别提示页面

Merge pull request !39 from 刘远鹏/upstream
This commit is contained in:
杨敏 2023-09-13 08:59:20 +00:00 committed by Gitee
commit e350c3c327
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
16 changed files with 640 additions and 193 deletions

140
agreementwindow.cpp Normal file
View File

@ -0,0 +1,140 @@
#include "agreementwindow.h"
#include <QSettings>
#include <QVBoxLayout>
#include <QTextCodec>
#include <QDebug>
#include <QScrollBar>
#define CONFIG_FILE "/usr/share/ukui-greeter/ukui-greeter.conf"
AgreementWindow::AgreementWindow(QWidget *parent) :
QWidget(parent)
{
init();
}
bool AgreementWindow::getShowLoginPrompt()
{
return showLoginPrompt;
}
void AgreementWindow::initUI()
{
centerWidget = new QWidget(this);
centerWidget->setObjectName("centerWidget");
// centerWidget->setFixedSize(960,744);
centerWidget->setStyleSheet("#centerWidget{background-color: rgba(0,0,0,15%);border-radius: 12px;}");
QVBoxLayout *layout = new QVBoxLayout(centerWidget);
ensureBtn = new QPushButton(this);
ensureBtn->setText(tr("I know"));
ensureBtn->setObjectName("ensureBtn");
ensureBtn->setFixedSize(240,48);
ensureBtn->setDefault(true);
ensureBtn->setFocusPolicy(Qt::StrongFocus);
ensureBtn->setStyleSheet("#ensureBtn{background-color:rgba(55, 144, 250, 1);border-radius: 6px;}");
ensureBtn->setStyleSheet("QPushButton{text-align:center;background-color:#3790FA;border-radius: 6px;color:white} \
QPushButton::hover{background-color:#3489EE;} \
QPushButton::pressed {background-color:#2C73C8;}");
connect(ensureBtn, &QPushButton::clicked, this, &AgreementWindow::switchPage);
titleLbl = new QLabel(centerWidget);
titleLbl->setText(promptTitle);
titleLbl->setObjectName("titleLbl");
titleLbl->setStyleSheet("#titleLbl{color: white;font-size: 24px;}");
browser = new QTextBrowser(centerWidget);
browser->setObjectName("browser");
browser->setAttribute(Qt::WA_TranslucentBackground);
browser->setStyleSheet("#browser{background-color:transparent;border-radius: none;color: white;font-size: 16px;}");
browser->verticalScrollBar()->setProperty("drawScrollBarGroove", false);
browser->setContextMenuPolicy(Qt::NoContextMenu);
browser->verticalScrollBar()->setContextMenuPolicy(Qt::NoContextMenu);
setFocusProxy(ensureBtn);
bool res = loadText();
if(!res || (promptTitle.isEmpty() && !hideTitle)){
emit switchToGreeter();
}
layout->addSpacing(24);
layout->addWidget(titleLbl);
layout->addWidget(browser);
layout->setAlignment(ensureBtn,Qt::AlignCenter);
layout->setAlignment(titleLbl,Qt::AlignCenter);
if(hideTitle)
titleLbl->hide();
}
void AgreementWindow::switchPage()
{
emit switchToGreeter();
}
void AgreementWindow::resizeEvent(QResizeEvent *event)
{
// qDebug()<<""
int m_width = 960,m_height = 722 - 88;
if(this->width() < (960+80))
m_width = (width() - 80)/2;
if(this->height() < (722+80))
m_height = (height() - 80)/2;
centerWidget->setGeometry((width()-m_width)/2,(height()-m_height)/2,m_width,m_height);
ensureBtn->move((width()-ensureBtn->width())/2,centerWidget->geometry().bottom() + 40);
}
bool AgreementWindow::loadText()
{
if(!promptText.isEmpty()){
browser->setText(promptText);
return true;
}
if(promptTextFilePath.isEmpty())
return false;
QFile file(promptTextFilePath);
if(!file.exists())
return false;
file.open(QFile::ReadOnly);
QString str(file.readAll());
if(str == "")
return false;
browser->setText(str);
file.close();
return true;
}
void AgreementWindow::init()
{
QSettings *settings = new QSettings(CONFIG_FILE,QSettings::IniFormat);
settings->setIniCodec(QTextCodec::codecForName("utf-8"));
if(settings->contains("Greeter/showLoginPrompt")){
showLoginPrompt = settings->value("Greeter/showLoginPrompt").toBool();
}
if(settings->contains("Greeter/hideTitle")){
hideTitle = settings->value("Greeter/hideTitle").toBool();
}
if(settings->contains("Greeter/promptTitle")){
promptTitle = settings->value("Greeter/promptTitle").toString();
}
if(settings->contains("Greeter/promptText")){
promptText = settings->value("Greeter/promptText").toString();
}
if(settings->contains("Greeter/promptTextFilePath")){
promptTextFilePath = settings->value("Greeter/promptTextFilePath").toString();
}
}

48
agreementwindow.h Normal file
View File

@ -0,0 +1,48 @@
#ifndef AGREEMENTWINDOW_H
#define AGREEMENTWINDOW_H
#include <QWidget>
#include <QTextBrowser>
#include <QPushButton>
#include <QLabel>
#include <QFile>
class AgreementWindow : public QWidget
{
Q_OBJECT
public:
explicit AgreementWindow(QWidget *parent = nullptr);
bool getShowLoginPrompt();
void initUI();
signals:
void switchToGreeter();
protected:
void resizeEvent(QResizeEvent *event);
protected Q_SLOTS:
void switchPage();
private:
void init();
bool loadText();
QTextBrowser *browser = nullptr;
QLabel *titleLbl = nullptr;
QPushButton *ensureBtn = nullptr;
QFile *file = nullptr;
bool showLoginPrompt = false;
bool hideTitle = true;
QString promptTitle = "";
QString promptText = "";
QString promptTextFilePath = "";
QWidget *centerWidget = nullptr;
};
#endif // AGREEMENTWINDOW_H

View File

@ -1,10 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>AgreementWindow</name>
<message>
<location filename="../agreementwindow.cpp" line="32"/>
<location filename="../src/agreementwindow.cpp" line="32"/>
<source>I know</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AuthDialog</name>
<message>
<location filename="../src/authdialog.cpp" line="985"/>
<location filename="../src/authdialog.cpp" line="984"/>
<source>Authentication failure, Please try again</source>
<translation type="unfinished"></translation>
</message>
@ -43,80 +52,80 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="620"/>
<location filename="../src/authdialog.cpp" line="619"/>
<source>Verify face recognition or enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="625"/>
<location filename="../src/authdialog.cpp" line="624"/>
<source>Press fingerprint or enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="630"/>
<location filename="../src/authdialog.cpp" line="629"/>
<source>Verify voiceprint or enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="635"/>
<location filename="../src/authdialog.cpp" line="634"/>
<source>Verify finger vein or enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="640"/>
<location filename="../src/authdialog.cpp" line="639"/>
<source>Verify iris or enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="645"/>
<location filename="../src/authdialog.cpp" line="644"/>
<source>Use the bound wechat scanning code or enter the password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="713"/>
<location filename="../src/authdialog.cpp" line="714"/>
<location filename="../src/authdialog.cpp" line="715"/>
<source>Password cannot be empty</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="938"/>
<location filename="../src/authdialog.cpp" line="937"/>
<source>Password: </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="940"/>
<location filename="../src/authdialog.cpp" line="939"/>
<source>Input Password</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1025"/>
<location filename="../src/authdialog.cpp" line="1024"/>
<source>Login</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1042"/>
<location filename="../src/authdialog.cpp" line="1041"/>
<source>Retry</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1356"/>
<location filename="../src/authdialog.cpp" line="1355"/>
<source>Failed to verify %1, please enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1360"/>
<location filename="../src/authdialog.cpp" line="1362"/>
<location filename="../src/authdialog.cpp" line="1359"/>
<location filename="../src/authdialog.cpp" line="1361"/>
<source>Unable to verify %1, please enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1375"/>
<location filename="../src/authdialog.cpp" line="1379"/>
<location filename="../src/authdialog.cpp" line="1374"/>
<location filename="../src/authdialog.cpp" line="1378"/>
<source>Failed to verify %1, you still have %2 verification opportunities</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1392"/>
<location filename="../src/authdialog.cpp" line="1391"/>
<source>Abnormal network</source>
<translation type="unfinished"></translation>
</message>
@ -1815,37 +1824,37 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="762"/>
<location filename="../src/lockwidget.cpp" line="832"/>
<source>PowerInfo</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="785"/>
<location filename="../src/lockwidget.cpp" line="855"/>
<source>Power</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="814"/>
<location filename="../src/lockwidget.cpp" line="882"/>
<source>VirtualKeyboard</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="827"/>
<location filename="../src/lockwidget.cpp" line="895"/>
<source>SwitchUser</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="1109"/>
<location filename="../src/lockwidget.cpp" line="1177"/>
<source>Multiple users are logged in at the same time.Are you sure you want to reboot this system?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="1410"/>
<location filename="../src/lockwidget.cpp" line="1478"/>
<source>LAN</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="1412"/>
<location filename="../src/lockwidget.cpp" line="1480"/>
<source>WLAN</source>
<translation type="unfinished"></translation>
</message>
@ -2142,17 +2151,17 @@
<context>
<name>Screensaver</name>
<message>
<location filename="../screensaver/screensaver.cpp" line="167"/>
<location filename="../screensaver/screensaver.cpp" line="159"/>
<source>Picture does not exist</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../screensaver/screensaver.cpp" line="170"/>
<location filename="../screensaver/screensaver.cpp" line="162"/>
<source>View</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../screensaver/screensaver.cpp" line="1461"/>
<location filename="../screensaver/screensaver.cpp" line="1453"/>
<source>You have new notification</source>
<translation type="unfinished"></translation>
</message>

View File

@ -1,6 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="bo_CN">
<context>
<name>AgreementWindow</name>
<message>
<source>I know</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AuthDialog</name>
<message>

View File

@ -1,6 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="es">
<context>
<name>AgreementWindow</name>
<message>
<source>I know</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AuthDialog</name>
<message>

View File

@ -1,6 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="fr">
<context>
<name>AgreementWindow</name>
<message>
<source>I know</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AuthDialog</name>
<message>

View File

@ -4,8 +4,10 @@
<context>
<name>AgreementWindow</name>
<message>
<location filename="../agreementwindow.cpp" line="32"/>
<location filename="../src/agreementwindow.cpp" line="32"/>
<source>I know</source>
<translation type="vanished"> </translation>
<translation> </translation>
</message>
</context>
<context>
@ -23,7 +25,7 @@
<translation type="obsolete">使</translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1042"/>
<location filename="../src/authdialog.cpp" line="1041"/>
<source>Retry</source>
<translation> </translation>
</message>
@ -44,7 +46,7 @@
<translation type="obsolete"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="938"/>
<location filename="../src/authdialog.cpp" line="937"/>
<source>Password: </source>
<translation></translation>
</message>
@ -77,48 +79,48 @@
<translation> </translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="620"/>
<location filename="../src/authdialog.cpp" line="619"/>
<source>Verify face recognition or enter password to unlock</source>
<translation> </translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="625"/>
<location filename="../src/authdialog.cpp" line="624"/>
<source>Press fingerprint or enter password to unlock</source>
<translation> </translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="630"/>
<location filename="../src/authdialog.cpp" line="629"/>
<source>Verify voiceprint or enter password to unlock</source>
<translation> </translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="635"/>
<location filename="../src/authdialog.cpp" line="634"/>
<source>Verify finger vein or enter password to unlock</source>
<translation> </translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="640"/>
<location filename="../src/authdialog.cpp" line="639"/>
<source>Verify iris or enter password to unlock</source>
<translation> </translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="940"/>
<location filename="../src/authdialog.cpp" line="939"/>
<source>Input Password</source>
<translation> </translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1356"/>
<location filename="../src/authdialog.cpp" line="1355"/>
<source>Failed to verify %1, please enter password to unlock</source>
<translation>%1 </translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1360"/>
<location filename="../src/authdialog.cpp" line="1362"/>
<location filename="../src/authdialog.cpp" line="1359"/>
<location filename="../src/authdialog.cpp" line="1361"/>
<source>Unable to verify %1, please enter password to unlock</source>
<translation>%1/ </translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1392"/>
<location filename="../src/authdialog.cpp" line="1391"/>
<source>Abnormal network</source>
<translation> </translation>
</message>
@ -127,8 +129,8 @@
<translation type="vanished">使</translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="713"/>
<location filename="../src/authdialog.cpp" line="714"/>
<location filename="../src/authdialog.cpp" line="715"/>
<source>Password cannot be empty</source>
<translation> </translation>
</message>
@ -141,8 +143,8 @@
<translation type="vanished">%1.</translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1375"/>
<location filename="../src/authdialog.cpp" line="1379"/>
<location filename="../src/authdialog.cpp" line="1374"/>
<location filename="../src/authdialog.cpp" line="1378"/>
<source>Failed to verify %1, you still have %2 verification opportunities</source>
<translation>%1/ %2 </translation>
</message>
@ -171,12 +173,12 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="985"/>
<location filename="../src/authdialog.cpp" line="984"/>
<source>Authentication failure, Please try again</source>
<translation> </translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="645"/>
<location filename="../src/authdialog.cpp" line="644"/>
<source>Use the bound wechat scanning code or enter the password to unlock</source>
<translation> </translation>
</message>
@ -195,7 +197,7 @@
<translation type="vanished"> </translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1025"/>
<location filename="../src/authdialog.cpp" line="1024"/>
<source>Login</source>
<translation> </translation>
</message>
@ -2130,37 +2132,37 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="762"/>
<location filename="../src/lockwidget.cpp" line="832"/>
<source>PowerInfo</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="785"/>
<location filename="../src/lockwidget.cpp" line="855"/>
<source>Power</source>
<translation> </translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="814"/>
<location filename="../src/lockwidget.cpp" line="882"/>
<source>VirtualKeyboard</source>
<translation> </translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="827"/>
<location filename="../src/lockwidget.cpp" line="895"/>
<source>SwitchUser</source>
<translation> </translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="1109"/>
<location filename="../src/lockwidget.cpp" line="1177"/>
<source>Multiple users are logged in at the same time.Are you sure you want to reboot this system?</source>
<translation> ?</translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="1410"/>
<location filename="../src/lockwidget.cpp" line="1478"/>
<source>LAN</source>
<translation> </translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="1412"/>
<location filename="../src/lockwidget.cpp" line="1480"/>
<source>WLAN</source>
<translation> </translation>
</message>
@ -2510,72 +2512,6 @@
<message>
<location filename="../src/enginedevice.cpp" line="308"/>
<source></source>
<comment>this is only shown for laptops with multiple batteries</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="313"/>
<source></source>
<comment>this is only shown for laptops with multiple batteries</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="337"/>
<source></source>
<comment>laptop primary battery</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="341"/>
<source></source>
<comment>battery-backed AC power source</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="345"/>
<source></source>
<comment>a monitor is a device to measure voltage and current</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="349"/>
<source></source>
<comment>wireless mice with internal batteries</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="353"/>
<source></source>
<comment>wireless keyboard with internal battery</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="357"/>
<source></source>
<comment>portable device</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="361"/>
<source></source>
<comment>cell phone (mobile...)</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="365"/>
<source></source>
<comment>media player, mp3 etc</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="369"/>
<source></source>
<comment>tablet device</comment>
<translation></translation>
</message>
<message>
<location filename="../src/enginedevice.cpp" line="373"/>
<source></source>
<comment>tablet device</comment>
<translation></translation>
</message>
@ -2591,7 +2527,7 @@
<translation type="vanished">退</translation>
</message>
<message>
<location filename="../screensaver/screensaver.cpp" line="167"/>
<location filename="../screensaver/screensaver.cpp" line="159"/>
<source>Picture does not exist</source>
<translation> </translation>
</message>
@ -2608,12 +2544,12 @@
<translation type="obsolete">%1</translation>
</message>
<message>
<location filename="../screensaver/screensaver.cpp" line="1461"/>
<location filename="../screensaver/screensaver.cpp" line="1453"/>
<source>You have new notification</source>
<translation> </translation>
</message>
<message>
<location filename="../screensaver/screensaver.cpp" line="170"/>
<location filename="../screensaver/screensaver.cpp" line="162"/>
<source>View</source>
<translation> </translation>
</message>

View File

@ -1,6 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="pt">
<context>
<name>AgreementWindow</name>
<message>
<source>I know</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AuthDialog</name>
<message>

View File

@ -1,6 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="ru">
<context>
<name>AgreementWindow</name>
<message>
<source>I know</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AuthDialog</name>
<message>

View File

@ -1,6 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="tr">
<context>
<name>AgreementWindow</name>
<message>
<location filename="../agreementwindow.cpp" line="32"/>
<location filename="../src/agreementwindow.cpp" line="32"/>
<source>I know</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AuthDialog</name>
<message>
@ -16,7 +25,7 @@
<translation type="obsolete">Parola</translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1042"/>
<location filename="../src/authdialog.cpp" line="1041"/>
<source>Retry</source>
<translation type="unfinished">Yeniden Dene</translation>
</message>
@ -25,7 +34,7 @@
<translation type="obsolete">Kilidi </translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="938"/>
<location filename="../src/authdialog.cpp" line="937"/>
<source>Password: </source>
<translation type="unfinished">Parola</translation>
</message>
@ -42,7 +51,7 @@
<translation type="vanished">Kimlik doğrulama hatası, hala %1 kalan denemen var</translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="985"/>
<location filename="../src/authdialog.cpp" line="984"/>
<source>Authentication failure, Please try again</source>
<translation type="unfinished"></translation>
</message>
@ -81,70 +90,70 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="620"/>
<location filename="../src/authdialog.cpp" line="619"/>
<source>Verify face recognition or enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="625"/>
<location filename="../src/authdialog.cpp" line="624"/>
<source>Press fingerprint or enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="630"/>
<location filename="../src/authdialog.cpp" line="629"/>
<source>Verify voiceprint or enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="635"/>
<location filename="../src/authdialog.cpp" line="634"/>
<source>Verify finger vein or enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="640"/>
<location filename="../src/authdialog.cpp" line="639"/>
<source>Verify iris or enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="645"/>
<location filename="../src/authdialog.cpp" line="644"/>
<source>Use the bound wechat scanning code or enter the password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="713"/>
<location filename="../src/authdialog.cpp" line="714"/>
<location filename="../src/authdialog.cpp" line="715"/>
<source>Password cannot be empty</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="940"/>
<location filename="../src/authdialog.cpp" line="939"/>
<source>Input Password</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1025"/>
<location filename="../src/authdialog.cpp" line="1024"/>
<source>Login</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1356"/>
<location filename="../src/authdialog.cpp" line="1355"/>
<source>Failed to verify %1, please enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1360"/>
<location filename="../src/authdialog.cpp" line="1362"/>
<location filename="../src/authdialog.cpp" line="1359"/>
<location filename="../src/authdialog.cpp" line="1361"/>
<source>Unable to verify %1, please enter password to unlock</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1375"/>
<location filename="../src/authdialog.cpp" line="1379"/>
<location filename="../src/authdialog.cpp" line="1374"/>
<location filename="../src/authdialog.cpp" line="1378"/>
<source>Failed to verify %1, you still have %2 verification opportunities</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1392"/>
<location filename="../src/authdialog.cpp" line="1391"/>
<source>Abnormal network</source>
<translation type="unfinished"></translation>
</message>
@ -1897,37 +1906,37 @@
<translation type="obsolete">Misafir</translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="762"/>
<location filename="../src/lockwidget.cpp" line="832"/>
<source>PowerInfo</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="785"/>
<location filename="../src/lockwidget.cpp" line="855"/>
<source>Power</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="814"/>
<location filename="../src/lockwidget.cpp" line="882"/>
<source>VirtualKeyboard</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="827"/>
<location filename="../src/lockwidget.cpp" line="895"/>
<source>SwitchUser</source>
<translation>Kullanıcı Değiştir</translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="1109"/>
<location filename="../src/lockwidget.cpp" line="1177"/>
<source>Multiple users are logged in at the same time.Are you sure you want to reboot this system?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="1410"/>
<location filename="../src/lockwidget.cpp" line="1478"/>
<source>LAN</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="1412"/>
<location filename="../src/lockwidget.cpp" line="1480"/>
<source>WLAN</source>
<translation type="unfinished"></translation>
</message>
@ -2256,17 +2265,17 @@
<translation type="obsolete">çıkış</translation>
</message>
<message>
<location filename="../screensaver/screensaver.cpp" line="167"/>
<location filename="../screensaver/screensaver.cpp" line="159"/>
<source>Picture does not exist</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../screensaver/screensaver.cpp" line="170"/>
<location filename="../screensaver/screensaver.cpp" line="162"/>
<source>View</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../screensaver/screensaver.cpp" line="1461"/>
<location filename="../screensaver/screensaver.cpp" line="1453"/>
<source>You have new notification</source>
<translation type="unfinished"></translation>
</message>

View File

@ -1,6 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="zh_CN">
<context>
<name>AgreementWindow</name>
<message>
<location filename="../agreementwindow.cpp" line="32"/>
<location filename="../src/agreementwindow.cpp" line="32"/>
<source>I know</source>
<translation></translation>
</message>
</context>
<context>
<name>AuthDialog</name>
<message>
@ -16,7 +25,7 @@
<translation type="obsolete">使</translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1042"/>
<location filename="../src/authdialog.cpp" line="1041"/>
<source>Retry</source>
<translation></translation>
</message>
@ -37,7 +46,7 @@
<translation type="obsolete"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="938"/>
<location filename="../src/authdialog.cpp" line="937"/>
<source>Password: </source>
<translation></translation>
</message>
@ -70,48 +79,48 @@
<translation></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="620"/>
<location filename="../src/authdialog.cpp" line="619"/>
<source>Verify face recognition or enter password to unlock</source>
<translation></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="625"/>
<location filename="../src/authdialog.cpp" line="624"/>
<source>Press fingerprint or enter password to unlock</source>
<translation></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="630"/>
<location filename="../src/authdialog.cpp" line="629"/>
<source>Verify voiceprint or enter password to unlock</source>
<translation></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="635"/>
<location filename="../src/authdialog.cpp" line="634"/>
<source>Verify finger vein or enter password to unlock</source>
<translation></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="640"/>
<location filename="../src/authdialog.cpp" line="639"/>
<source>Verify iris or enter password to unlock</source>
<translation></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="940"/>
<location filename="../src/authdialog.cpp" line="939"/>
<source>Input Password</source>
<translation></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1356"/>
<location filename="../src/authdialog.cpp" line="1355"/>
<source>Failed to verify %1, please enter password to unlock</source>
<translation>%1</translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1360"/>
<location filename="../src/authdialog.cpp" line="1362"/>
<location filename="../src/authdialog.cpp" line="1359"/>
<location filename="../src/authdialog.cpp" line="1361"/>
<source>Unable to verify %1, please enter password to unlock</source>
<translation>%1</translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1392"/>
<location filename="../src/authdialog.cpp" line="1391"/>
<source>Abnormal network</source>
<translation></translation>
</message>
@ -120,8 +129,8 @@
<translation type="vanished">使</translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="713"/>
<location filename="../src/authdialog.cpp" line="714"/>
<location filename="../src/authdialog.cpp" line="715"/>
<source>Password cannot be empty</source>
<translation></translation>
</message>
@ -134,8 +143,8 @@
<translation type="vanished">%1.</translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1375"/>
<location filename="../src/authdialog.cpp" line="1379"/>
<location filename="../src/authdialog.cpp" line="1374"/>
<location filename="../src/authdialog.cpp" line="1378"/>
<source>Failed to verify %1, you still have %2 verification opportunities</source>
<translation>%1%2</translation>
</message>
@ -164,12 +173,12 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="985"/>
<location filename="../src/authdialog.cpp" line="984"/>
<source>Authentication failure, Please try again</source>
<translation></translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="645"/>
<location filename="../src/authdialog.cpp" line="644"/>
<source>Use the bound wechat scanning code or enter the password to unlock</source>
<translation>使</translation>
</message>
@ -188,7 +197,7 @@
<translation type="vanished"> </translation>
</message>
<message>
<location filename="../src/authdialog.cpp" line="1025"/>
<location filename="../src/authdialog.cpp" line="1024"/>
<source>Login</source>
<translation></translation>
</message>
@ -2109,16 +2118,6 @@
<source>123</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../VirtualKeyboard/src/letterswidget.cpp" line="198"/>
<source>Ctrl</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../VirtualKeyboard/src/letterswidget.cpp" line="226"/>
<source>Alt</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LockWidget</name>
@ -2142,37 +2141,37 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="762"/>
<location filename="../src/lockwidget.cpp" line="832"/>
<source>PowerInfo</source>
<translation></translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="785"/>
<location filename="../src/lockwidget.cpp" line="855"/>
<source>Power</source>
<translation></translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="814"/>
<location filename="../src/lockwidget.cpp" line="882"/>
<source>VirtualKeyboard</source>
<translation></translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="827"/>
<location filename="../src/lockwidget.cpp" line="895"/>
<source>SwitchUser</source>
<translation></translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="1109"/>
<location filename="../src/lockwidget.cpp" line="1177"/>
<source>Multiple users are logged in at the same time.Are you sure you want to reboot this system?</source>
<translation>退</translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="1410"/>
<location filename="../src/lockwidget.cpp" line="1478"/>
<source>LAN</source>
<translation type="unfinished">线</translation>
</message>
<message>
<location filename="../src/lockwidget.cpp" line="1412"/>
<location filename="../src/lockwidget.cpp" line="1480"/>
<source>WLAN</source>
<translation type="unfinished">线</translation>
</message>
@ -2545,7 +2544,7 @@
<translation type="vanished">退</translation>
</message>
<message>
<location filename="../screensaver/screensaver.cpp" line="167"/>
<location filename="../screensaver/screensaver.cpp" line="159"/>
<source>Picture does not exist</source>
<translation></translation>
</message>
@ -2562,12 +2561,12 @@
<translation type="obsolete">%1</translation>
</message>
<message>
<location filename="../screensaver/screensaver.cpp" line="1461"/>
<location filename="../screensaver/screensaver.cpp" line="1453"/>
<source>You have new notification</source>
<translation></translation>
</message>
<message>
<location filename="../screensaver/screensaver.cpp" line="170"/>
<location filename="../screensaver/screensaver.cpp" line="162"/>
<source>View</source>
<translation></translation>
</message>

View File

@ -73,6 +73,7 @@ qt5_add_resources(dialog_SRC
# Xlib.h
qt5_wrap_cpp(dialog_SRC
agreementwindow.h
pam-tally.h
fullbackgroundwidget.h
lockwidget.h
@ -133,7 +134,8 @@ qt5_wrap_cpp(dialog_SRC
set(dialog_SRC
${dialog_SRC}
pam-tally.c
agreementwindow.cpp
pam-tally.c
ukui-screensaver-dialog.cpp
fullbackgroundwidget.cpp
lockwidget.cpp

140
src/agreementwindow.cpp Normal file
View File

@ -0,0 +1,140 @@
#include "agreementwindow.h"
#include <QSettings>
#include <QVBoxLayout>
#include <QTextCodec>
#include <QDebug>
#include <QScrollBar>
#define CONFIG_FILE "/usr/share/ukui-greeter/ukui-greeter.conf"
AgreementWindow::AgreementWindow(QWidget *parent) :
QWidget(parent)
{
init();
}
bool AgreementWindow::getShowLoginPrompt()
{
return showLoginPrompt;
}
void AgreementWindow::initUI()
{
centerWidget = new QWidget(this);
centerWidget->setObjectName("centerWidget");
// centerWidget->setFixedSize(960,744);
centerWidget->setStyleSheet("#centerWidget{background-color: rgba(0,0,0,15%);border-radius: 12px;}");
QVBoxLayout *layout = new QVBoxLayout(centerWidget);
ensureBtn = new QPushButton(this);
ensureBtn->setText(tr("I know"));
ensureBtn->setObjectName("ensureBtn");
ensureBtn->setFixedSize(240,48);
ensureBtn->setDefault(true);
ensureBtn->setFocusPolicy(Qt::StrongFocus);
ensureBtn->setStyleSheet("#ensureBtn{background-color:rgba(55, 144, 250, 1);border-radius: 6px;}");
ensureBtn->setStyleSheet("QPushButton{text-align:center;background-color:#3790FA;border-radius: 6px;color:white} \
QPushButton::hover{background-color:#3489EE;} \
QPushButton::pressed {background-color:#2C73C8;}");
connect(ensureBtn, &QPushButton::clicked, this, &AgreementWindow::switchPage);
titleLbl = new QLabel(centerWidget);
titleLbl->setText(promptTitle);
titleLbl->setObjectName("titleLbl");
titleLbl->setStyleSheet("#titleLbl{color: white;font-size: 24px;}");
browser = new QTextBrowser(centerWidget);
browser->setObjectName("browser");
browser->setAttribute(Qt::WA_TranslucentBackground);
browser->setStyleSheet("#browser{background-color:transparent;border-radius: none;color: white;font-size: 16px;}");
browser->verticalScrollBar()->setProperty("drawScrollBarGroove", false);
browser->setContextMenuPolicy(Qt::NoContextMenu);
browser->verticalScrollBar()->setContextMenuPolicy(Qt::NoContextMenu);
setFocusProxy(ensureBtn);
bool res = loadText();
if(!res || (promptTitle.isEmpty() && !hideTitle)){
emit switchToGreeter();
}
layout->addSpacing(24);
layout->addWidget(titleLbl);
layout->addWidget(browser);
layout->setAlignment(ensureBtn,Qt::AlignCenter);
layout->setAlignment(titleLbl,Qt::AlignCenter);
if(hideTitle)
titleLbl->hide();
}
void AgreementWindow::switchPage()
{
emit switchToGreeter();
}
void AgreementWindow::resizeEvent(QResizeEvent *event)
{
// qDebug()<<""
int m_width = 960,m_height = 722 - 88;
if(this->width() < (960+80))
m_width = (width() - 80)/2;
if(this->height() < (722+80))
m_height = (height() - 80)/2;
centerWidget->setGeometry((width()-m_width)/2,(height()-m_height)/2,m_width,m_height);
ensureBtn->move((width()-ensureBtn->width())/2,centerWidget->geometry().bottom() + 40);
}
bool AgreementWindow::loadText()
{
if(!promptText.isEmpty()){
browser->setText(promptText);
return true;
}
if(promptTextFilePath.isEmpty())
return false;
QFile file(promptTextFilePath);
if(!file.exists())
return false;
file.open(QFile::ReadOnly);
QString str(file.readAll());
if(str == "")
return false;
browser->setText(str);
file.close();
return true;
}
void AgreementWindow::init()
{
QSettings *settings = new QSettings(CONFIG_FILE,QSettings::IniFormat);
settings->setIniCodec(QTextCodec::codecForName("utf-8"));
if(settings->contains("Greeter/showLoginPrompt")){
showLoginPrompt = settings->value("Greeter/showLoginPrompt").toBool();
}
if(settings->contains("Greeter/hideTitle")){
hideTitle = settings->value("Greeter/hideTitle").toBool();
}
if(settings->contains("Greeter/promptTitle")){
promptTitle = settings->value("Greeter/promptTitle").toString();
}
if(settings->contains("Greeter/promptText")){
promptText = settings->value("Greeter/promptText").toString();
}
if(settings->contains("Greeter/promptTextFilePath")){
promptTextFilePath = settings->value("Greeter/promptTextFilePath").toString();
}
}

48
src/agreementwindow.h Normal file
View File

@ -0,0 +1,48 @@
#ifndef AGREEMENTWINDOW_H
#define AGREEMENTWINDOW_H
#include <QWidget>
#include <QTextBrowser>
#include <QPushButton>
#include <QLabel>
#include <QFile>
class AgreementWindow : public QWidget
{
Q_OBJECT
public:
explicit AgreementWindow(QWidget *parent = nullptr);
bool getShowLoginPrompt();
void initUI();
signals:
void switchToGreeter();
protected:
void resizeEvent(QResizeEvent *event);
protected Q_SLOTS:
void switchPage();
private:
void init();
bool loadText();
QTextBrowser *browser = nullptr;
QLabel *titleLbl = nullptr;
QPushButton *ensureBtn = nullptr;
QFile *file = nullptr;
bool showLoginPrompt = false;
bool hideTitle = true;
QString promptTitle = "";
QString promptText = "";
QString promptTextFilePath = "";
QWidget *centerWidget = nullptr;
};
#endif // AGREEMENTWINDOW_H

View File

@ -210,6 +210,79 @@ void LockWidget::setStartupMode(bool mode)
m_futureLoadDeskBg = QtConcurrent::run([=](){
setRootWindow();
});
m_agreementWindow = new AgreementWindow(this);
connect(m_agreementWindow, &AgreementWindow::switchToGreeter, this,
[this]() {
switchWnd(0);
update();
});
if(m_agreementWindow->getShowLoginPrompt()){
switchWnd(1);
m_agreementWindow->initUI();
}else{
m_agreementWindow->hide();
}
}
}
void LockWidget::switchWnd(int index)
{
if(authDialog)
authDialog->hide();
if(m_agreementWindow)
m_agreementWindow->hide();
ui->widgetTime->show();
repaint();
switch (index) {
case 0:
if(m_agreementWindow){
m_agreementWindow->clearFocus();
}
if(authDialog){
authDialog->show();
authDialog->setFocus();
}
setBottomBtnVisible(true);
break;
case 1:
if(m_agreementWindow)
m_agreementWindow->show();
ui->widgetTime->hide();
setBottomBtnVisible(false);
authDialog->clearFocus();
m_agreementWindow->setFocusPolicy(Qt::StrongFocus);
setFocusProxy(m_agreementWindow);
m_agreementWindow->setFocus();
default:
break;
}
}
void LockWidget::setBottomBtnVisible(bool visible)
{
if(visible){
ui->btnSwitchUser->setVisible(btnVisMap.value(ui->btnSwitchUser));
ui->btnPowerManager->setVisible(btnVisMap.value(ui->btnPowerManager));
ui->btnKeyboard->setVisible(btnVisMap.value(ui->btnKeyboard));
btnNetworkManager->setVisible(btnVisMap.value(btnNetworkManager));
ui->btnBatteryStatus->setVisible(btnVisMap.value(btnNetworkManager));
}else{
btnVisMap.insert(ui->btnSwitchUser,!ui->btnSwitchUser->isHidden());
ui->btnSwitchUser->setVisible(visible);
btnVisMap.insert(ui->btnPowerManager,!ui->btnPowerManager->isHidden());
ui->btnPowerManager->setVisible(visible);
btnVisMap.insert(ui->btnKeyboard,!ui->btnKeyboard->isHidden());
ui->btnKeyboard->setVisible(visible);
btnVisMap.insert(btnNetworkManager,!btnNetworkManager->isHidden());
btnNetworkManager->setVisible(visible);
btnVisMap.insert(ui->btnBatteryStatus,!ui->btnBatteryStatus->isHidden());
ui->btnBatteryStatus->setVisible(visible);
}
}
@ -1697,6 +1770,10 @@ void LockWidget::resizeEvent(QResizeEvent *event)
authDialog->setGeometry((width()-authDialog->geometry().width())/2,height()/(4-0.65*scale), \
authDialog->width(), (height()*3/4));
if(m_agreementWindow){
m_agreementWindow->setGeometry(this->geometry());
}
if(scale > 1)
scale = 1;
@ -1705,7 +1782,7 @@ void LockWidget::resizeEvent(QResizeEvent *event)
x = x + ui->btnPowerManager->width();
ui->btnPowerManager->move(width() - x,height() - y);
if(!ui->btnKeyboard->isHidden()){
if(ui->btnKeyboard){
x = x+ui->btnKeyboard->width()+16;
ui->btnKeyboard->move(width() - x, height() - y);
}
@ -1713,7 +1790,7 @@ void LockWidget::resizeEvent(QResizeEvent *event)
x = x + widgetNetworkManager->width()+16;
widgetNetworkManager->move(width() - x, height() - y);
if(!ui->btnSwitchUser->isHidden()) {
if(ui->btnSwitchUser && (!ui->btnSwitchUser->isHidden()||m_isShowUserSwitch) ) {
x = x + ui->btnSwitchUser->width()+16;
ui->btnSwitchUser->move(width() - x, height() - y);
}

View File

@ -35,6 +35,7 @@
#include "xeventmonitor.h"
#include "batterywidget.h"
#include "libinputswitchevent.h"
#include "agreementwindow.h"
#include <libkydate.h>
namespace Ui {
@ -109,6 +110,7 @@ Q_SIGNALS:
// void capsLockChanged();
private:
void switchWnd(int);
void initUI();
void initUserMenu();
void setVirkeyboardPos();
@ -123,6 +125,7 @@ private:
void setBottomBtnSheet();
void setCheckedSheet(int type, bool show);
void netResetLocation();
void setBottomBtnVisible(bool visible);
QString getLongFormatDate(int type);
/**
@ -220,7 +223,7 @@ private:
QDBusInterface *batInterface = nullptr;
QDBusInterface *iface = nullptr;
QDBusInterface *dface = nullptr;
AgreementWindow *m_agreementWindow = nullptr;
// 监听键盘插拔
LibinputSwitchEvent *libswitch = nullptr;
@ -231,6 +234,7 @@ private:
QFuture<void> m_futureLoadDeskBg;
QTimer *m_timerChkActive = nullptr;
QMap<QPushButton*,bool> btnVisMap;
bool m_isCustomDefault = false; /** 是否默认使用第三方认证 */
bool m_isShowNetwork = true; /** 是否显示网络插件 */
bool m_isShowUserSwitch = true; /** 是否显示用户切换 */