Refactoring all functions
|
@ -1,9 +0,0 @@
|
|||
SOURCES += \
|
||||
$$PWD/biometricproxy.cpp \
|
||||
$$PWD/biometricauthwidget.cpp \
|
||||
$$PWD/biometricdeviceswidget.cpp
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/biometricproxy.h \
|
||||
$$PWD/biometricauthwidget.h \
|
||||
$$PWD/biometricdeviceswidget.h
|
|
@ -1,37 +0,0 @@
|
|||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2018-12-06T09:17:41
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += core gui dbus
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = BiometricAuth
|
||||
TEMPLATE = app
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any feature of Qt which has been marked as deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
# You can also make your code fail to compile if you use deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
biometricauthwidget.cpp \
|
||||
biometricproxy.cpp \
|
||||
biometricdeviceswidget.cpp
|
||||
|
||||
HEADERS += \
|
||||
biometricauthwidget.h \
|
||||
biometricproxy.h \
|
||||
biometricdeviceswidget.h
|
||||
|
||||
FORMS +=
|
|
@ -1,27 +0,0 @@
|
|||
qt5_wrap_cpp(BiometricAuth_SRC
|
||||
biometricdeviceinfo.h
|
||||
biometricproxy.h
|
||||
giodbus.h
|
||||
uniauthservice.h
|
||||
)
|
||||
|
||||
set(BiometricAuth_SRC
|
||||
${BiometricAuth_SRC}
|
||||
biometricdeviceinfo.cpp
|
||||
biometricproxy.cpp
|
||||
giodbus.cpp
|
||||
uniauthservice.cpp
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${Qt5Core_INCLUDE_DIRS}
|
||||
${Qt5Widgets_INCLUDE_DIRS}
|
||||
${Qt5DBus_INCLUDE_DIRS}
|
||||
${GLIB2_INCLUDE_DIRS}
|
||||
${GIOUNIX2_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
|
||||
add_library(BiometricAuth STATIC ${BiometricAuth_SRC})
|
||||
target_link_libraries(BiometricAuth Qt5::Core Qt5::DBus Qt5::Widgets
|
||||
${GIOUNIX2_LIBRARIES})
|
|
@ -1,343 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
**/
|
||||
#include "biometricauthwidget.h"
|
||||
#include <QLabel>
|
||||
#include <QDebug>
|
||||
#include <QDBusUnixFileDescriptor>
|
||||
#include <unistd.h>
|
||||
#include <pwd.h>
|
||||
|
||||
#include <opencv2/core/core.hpp>
|
||||
#include <opencv2/imgproc/imgproc.hpp>
|
||||
#include <opencv2/highgui/highgui.hpp>
|
||||
#include <opencv2/opencv.hpp>
|
||||
|
||||
#include "giodbus.h"
|
||||
|
||||
BiometricAuthWidget::BiometricAuthWidget(BiometricProxy *proxy, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
proxy(proxy),
|
||||
isInAuth(false),
|
||||
movieTimer(nullptr),
|
||||
failedCount(0),
|
||||
timeoutCount(0),
|
||||
beStopped(false),
|
||||
retrytimer(nullptr),
|
||||
usebind(false)
|
||||
{
|
||||
usebind = getAuthDouble();
|
||||
initUI();
|
||||
resize(400, 260);
|
||||
|
||||
if(this->proxy)
|
||||
{
|
||||
connect(this->proxy, &BiometricProxy::StatusChanged,
|
||||
this, &BiometricAuthWidget::onStatusChanged);
|
||||
|
||||
connect(this->proxy, &BiometricProxy::FrameWritten,
|
||||
this, &BiometricAuthWidget::onFrameWritten);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void BiometricAuthWidget::initUI()
|
||||
{
|
||||
//显示提示信息
|
||||
lblNotify = new QLabel(this);
|
||||
lblNotify->setWordWrap(true);
|
||||
lblNotify->setAlignment(Qt::AlignHCenter | Qt::AlignBottom);
|
||||
|
||||
//显示当前设备
|
||||
lblDevice = new QLabel(this);
|
||||
lblDevice->setWordWrap(true);
|
||||
lblDevice->setAlignment(Qt::AlignCenter);
|
||||
|
||||
//显示图片
|
||||
lblImage = new QLabel(this);
|
||||
lblImage->setFixedSize(100, 100);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void BiometricAuthWidget::resizeEvent(QResizeEvent */*event*/)
|
||||
{
|
||||
lblNotify->setGeometry(0, 0, width(), 45);
|
||||
lblDevice->setGeometry(0, lblNotify->geometry().bottom()+5, width(), 30);
|
||||
lblImage->setGeometry((width() - lblImage->width()) / 2,
|
||||
lblDevice->geometry().bottom() + 10,
|
||||
lblImage->width(), lblImage->height());
|
||||
//qDebug()
|
||||
}
|
||||
|
||||
void BiometricAuthWidget::startAuth(DeviceInfoPtr device, int uid)
|
||||
{
|
||||
if(!proxy)
|
||||
{
|
||||
qWarning() << "BiometricProxy doesn't exist.";
|
||||
return;
|
||||
}
|
||||
|
||||
if(isInAuth)
|
||||
{
|
||||
qDebug() << "Identification is currently under way, stop it";
|
||||
stopAuth();
|
||||
}
|
||||
|
||||
this->device = device;
|
||||
this->uid = uid;
|
||||
this->userName = getpwuid(uid)->pw_name;
|
||||
this->failedCount = 0;
|
||||
this->timeoutCount = 0;
|
||||
this->beStopped = false;
|
||||
proxy->StopOps(device->id);
|
||||
startAuth_();
|
||||
|
||||
if(device->deviceType != DeviceType::Type::Face){
|
||||
updateImage(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void BiometricAuthWidget::startAuth_()
|
||||
{
|
||||
lblDevice->setText(tr("Current device: ") + device->shortName);
|
||||
|
||||
//qDebug().noquote() << QString("Identify:[drvid: %1, uid: %2]").arg(1).arg(2);
|
||||
|
||||
isInAuth = true;
|
||||
dup_fd = -1;
|
||||
|
||||
QDBusPendingCall call = proxy->Identify(device->id, uid);
|
||||
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(call, this);
|
||||
connect(watcher, &QDBusPendingCallWatcher::finished,
|
||||
this, &BiometricAuthWidget::onIdentifyComplete);
|
||||
|
||||
}
|
||||
|
||||
void BiometricAuthWidget::stopAuth()
|
||||
{
|
||||
beStopped = true;
|
||||
if(!isInAuth)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
proxy->StopOps(device->id);
|
||||
if(retrytimer&&retrytimer->isActive()){
|
||||
retrytimer->stop();
|
||||
delete retrytimer;
|
||||
retrytimer = nullptr;
|
||||
}
|
||||
isInAuth = false;
|
||||
updateImage(0);
|
||||
}
|
||||
|
||||
void BiometricAuthWidget::onIdentifyComplete(QDBusPendingCallWatcher *watcher)
|
||||
{
|
||||
QDBusPendingReply<int, int> reply = *watcher;
|
||||
if(reply.isError())
|
||||
{
|
||||
qWarning() << "Identify error: " << reply.error().message();
|
||||
Q_EMIT authComplete(false);
|
||||
updateImage(0);
|
||||
return;
|
||||
}
|
||||
int result = reply.argumentAt(0).toInt();
|
||||
int authUid = reply.argumentAt(1).toInt();
|
||||
|
||||
// 特征识别成功,而且用户id匹配
|
||||
if(result == DBUS_RESULT_SUCCESS && authUid == uid)
|
||||
{
|
||||
qDebug() << "Identify success";
|
||||
Q_EMIT authComplete(true);
|
||||
}
|
||||
// 特征识别不匹配
|
||||
else if(result == DBUS_RESULT_NOTMATCH)
|
||||
{
|
||||
if(usebind){
|
||||
Q_EMIT authComplete(false);
|
||||
return;
|
||||
}
|
||||
qDebug() << "Identify failed";
|
||||
failedCount++;
|
||||
if(failedCount >= GetMaxFailedAutoRetry(userName))
|
||||
{
|
||||
Q_EMIT authComplete(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
lblNotify->setText(tr("Identify failed, Please retry."));
|
||||
if(!beStopped){
|
||||
// QTimer::singleShot(1000, this, &BiometricAuthWidget::startAuth_);
|
||||
if(!retrytimer){
|
||||
retrytimer = new QTimer(this);
|
||||
retrytimer->setSingleShot(true);
|
||||
connect(retrytimer, &QTimer::timeout, this, &BiometricAuthWidget::startAuth_);
|
||||
}
|
||||
retrytimer->start(1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
//识别发生错误
|
||||
else if(result == DBUS_RESULT_ERROR)
|
||||
{
|
||||
if(usebind){
|
||||
Q_EMIT authComplete(false);
|
||||
return;
|
||||
}
|
||||
StatusReslut ret = proxy->UpdateStatus(device->id);
|
||||
//识别操作超时
|
||||
if(ret.result == 0 && ret.opsStatus == OPS_IDENTIFY_TIMEOUT)
|
||||
{
|
||||
timeoutCount++;
|
||||
if(timeoutCount >= GetMaxTimeoutAutoRetry(userName))
|
||||
{
|
||||
Q_EMIT authComplete(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
QTimer::singleShot(1000, [&]{
|
||||
if(!beStopped)
|
||||
{
|
||||
startAuth_();
|
||||
}
|
||||
});
|
||||
}
|
||||
}else{
|
||||
Q_EMIT authComplete(false);
|
||||
}
|
||||
}else{
|
||||
Q_EMIT authComplete(false);
|
||||
}
|
||||
updateImage(0);
|
||||
}
|
||||
|
||||
void BiometricAuthWidget::onFrameWritten(int drvid)
|
||||
{
|
||||
|
||||
if(dup_fd == -1){
|
||||
dup_fd = get_server_gvariant_stdout(drvid);
|
||||
}
|
||||
|
||||
if(dup_fd <= 0)
|
||||
return ;
|
||||
|
||||
cv::Mat img;
|
||||
lseek(dup_fd, 0, SEEK_SET);
|
||||
char base64_bufferData[1024*1024];
|
||||
int rc = read(dup_fd, base64_bufferData, 1024*1024);
|
||||
printf("rc = %d\n", rc);
|
||||
|
||||
cv::Mat mat2(1, sizeof(base64_bufferData), CV_8U, base64_bufferData);
|
||||
img = cv::imdecode(mat2, cv::IMREAD_COLOR);
|
||||
cv::cvtColor(img,img,cv::COLOR_BGR2RGB);
|
||||
|
||||
QImage srcQImage = QImage((uchar*)(img.data), img.cols, img.rows, QImage::Format_RGB888);
|
||||
lblImage->setFixedSize(160,160);
|
||||
lblImage->setGeometry((width() - lblImage->width()) / 2,
|
||||
lblDevice->geometry().bottom() + 10,
|
||||
lblImage->width(), lblImage->height());
|
||||
lblImage->setPixmap(QPixmap::fromImage(srcQImage).scaled(lblImage->size()));
|
||||
|
||||
}
|
||||
|
||||
void BiometricAuthWidget::onStatusChanged(int drvid, int status)
|
||||
{
|
||||
if(!isInAuth)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(drvid != device->id)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// 显示来自服务的提示信息
|
||||
if(status == STATUS_NOTIFY)
|
||||
{
|
||||
QString notifyMsg = proxy->GetNotifyMesg(drvid);
|
||||
lblNotify->setText(notifyMsg);
|
||||
}
|
||||
}
|
||||
|
||||
static int count = 0;
|
||||
void BiometricAuthWidget::updateImage(int type)
|
||||
{
|
||||
if(device->deviceType == DeviceType::Type::Face)
|
||||
return ;
|
||||
|
||||
if(type == 0)
|
||||
{
|
||||
if(movieTimer && movieTimer->isActive())
|
||||
{
|
||||
movieTimer->stop();
|
||||
}
|
||||
|
||||
QString imagePath = QString(UKUI_BIOMETRIC_IMAGES_PATH "%1/01.png")
|
||||
.arg(DeviceType::getDeviceType(device->deviceType));
|
||||
setImage(imagePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!movieTimer)
|
||||
{
|
||||
movieTimer = new QTimer(this);
|
||||
movieTimer->setInterval(100);
|
||||
connect(movieTimer, &QTimer::timeout,
|
||||
this, &BiometricAuthWidget::onMoviePixmapUpdate);
|
||||
}
|
||||
count = 0;
|
||||
movieTimer->start();
|
||||
}
|
||||
}
|
||||
|
||||
void BiometricAuthWidget::onMoviePixmapUpdate()
|
||||
{
|
||||
if(count >= 18)
|
||||
{
|
||||
count = 0;
|
||||
}
|
||||
count++;
|
||||
QString fileName = (count < 10 ? "0" : "") + QString::number(count);
|
||||
QString imagePath = QString(UKUI_BIOMETRIC_IMAGES_PATH "%1/%2.png")
|
||||
.arg(DeviceType::getDeviceType(device->deviceType))
|
||||
.arg(fileName);
|
||||
setImage(imagePath);
|
||||
}
|
||||
|
||||
void BiometricAuthWidget::setImage(const QString &path)
|
||||
{
|
||||
QPixmap image(path);
|
||||
image = image.scaled(lblImage->width(), lblImage->height(),
|
||||
Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||
|
||||
lblImage->setPixmap(image);
|
||||
}
|
||||
|
||||
bool BiometricAuthWidget::getAuthDouble()
|
||||
{
|
||||
QSettings settings("/etc/biometric-auth/ukui-biometric.conf", QSettings::IniFormat);
|
||||
bool distribId = settings.value("DoubleAuth").toBool();
|
||||
return distribId;
|
||||
}
|
||||
|
||||
void BiometricAuthWidget::setMinImage(float val)
|
||||
{
|
||||
resize(400,100+100*val);
|
||||
lblImage->setFixedSize(100*val, 100*val);
|
||||
}
|
|
@ -1,93 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
**/
|
||||
#ifndef BIOMETRICAUTHWIDGET_H
|
||||
#define BIOMETRICAUTHWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "biometricproxy.h"
|
||||
|
||||
class QLabel;
|
||||
//class QDBusPendingCallWatcher;
|
||||
//class BiometricProxy;
|
||||
//class DeviceIdentityPtr;
|
||||
class BiometricAuthWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit BiometricAuthWidget(BiometricProxy *proxy, QWidget *parent = 0);
|
||||
|
||||
/**
|
||||
* @brief 进行生物识别认证
|
||||
* @param deviceInfo 使用的设备
|
||||
* @param uid 待认证的用户id
|
||||
*/
|
||||
void startAuth(DeviceInfoPtr device, int uid);
|
||||
|
||||
/**
|
||||
* @brief 终止生物识别认证
|
||||
*/
|
||||
void stopAuth();
|
||||
|
||||
bool isAuthenticating() { return isInAuth; }
|
||||
|
||||
void setMinImage(float val);
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
Q_SIGNALS:
|
||||
/**
|
||||
* @brief 认证完成
|
||||
* @param result 认证结果
|
||||
*/
|
||||
void authComplete(bool result);
|
||||
|
||||
private Q_SLOTS:
|
||||
void onIdentifyComplete(QDBusPendingCallWatcher *watcher);
|
||||
void onStatusChanged(int drvid, int status);
|
||||
void onFrameWritten(int drvid);
|
||||
void onMoviePixmapUpdate();
|
||||
void startAuth_();
|
||||
|
||||
private:
|
||||
void initUI();
|
||||
void updateImage(int type = 0);
|
||||
void setImage(const QString &path);
|
||||
bool getAuthDouble();
|
||||
|
||||
private:
|
||||
QLabel *lblNotify;
|
||||
QLabel *lblDevice;
|
||||
QLabel *lblImage;
|
||||
|
||||
BiometricProxy *proxy;
|
||||
int uid;
|
||||
QString userName;
|
||||
DeviceInfoPtr device;
|
||||
bool isInAuth;
|
||||
QTimer *movieTimer;
|
||||
int failedCount;
|
||||
int timeoutCount;
|
||||
bool beStopped;
|
||||
QTimer *retrytimer;
|
||||
bool usebind;
|
||||
int fd = -1;
|
||||
int dup_fd = -1;
|
||||
};
|
||||
|
||||
#endif // BIOMETRICAUTHWIDGET_H
|
|
@ -1,291 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
**/
|
||||
#include "biometricdeviceinfo.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QtDBus>
|
||||
#include <QFile>
|
||||
//#include <QDBusAbstractInterface>
|
||||
|
||||
QString DeviceType::getDeviceType(int deviceType)
|
||||
{
|
||||
if(deviceType >= __MAX_NR_TYPES)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
QMetaEnum meta = QMetaEnum::fromType<Type>();
|
||||
const char *typeString = meta.valueToKey(deviceType);
|
||||
return QString(typeString);
|
||||
}
|
||||
|
||||
int DeviceType::getBioType(int bioType)
|
||||
{
|
||||
switch(bioType)
|
||||
{
|
||||
case Face:
|
||||
return 0;
|
||||
case FingerPrint:
|
||||
return 1;
|
||||
case FingerVein:
|
||||
return 2;
|
||||
case Iris:
|
||||
return 3;
|
||||
case VoicePrint:
|
||||
return 4;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
QString DeviceType::getDeviceType_tr(int deviceType)
|
||||
{
|
||||
switch(deviceType)
|
||||
{
|
||||
case FingerPrint:
|
||||
return tr("FingerPrint");
|
||||
case FingerVein:
|
||||
return tr("FingerVein");
|
||||
case Iris:
|
||||
return tr("Iris");
|
||||
case Face:
|
||||
return tr("Face");
|
||||
case VoicePrint:
|
||||
return tr("VoicePrint");
|
||||
case LOGINOPT_TYPE_GENERAL_UKEY:
|
||||
return tr("Ukey");
|
||||
case REMOTE_QRCODE_TYPE:
|
||||
return tr("QRCode");
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
QDebug operator <<(QDebug stream, const DeviceInfo &deviceInfo)
|
||||
{
|
||||
stream << "["
|
||||
<< deviceInfo.id
|
||||
<< deviceInfo.shortName
|
||||
<< deviceInfo.fullName
|
||||
<< deviceInfo.deviceType
|
||||
<< deviceInfo.driverEnable
|
||||
<< deviceInfo.deviceNum
|
||||
<< "]";
|
||||
return stream;
|
||||
}
|
||||
|
||||
QDBusArgument &operator <<(QDBusArgument &arg, const DeviceInfo &deviceInfo)
|
||||
{
|
||||
arg.beginStructure();
|
||||
arg << deviceInfo.id
|
||||
<< deviceInfo.shortName
|
||||
<< deviceInfo.fullName
|
||||
<< deviceInfo.driverEnable
|
||||
<< deviceInfo.deviceNum
|
||||
<< deviceInfo.deviceType
|
||||
<< deviceInfo.storageType
|
||||
<< deviceInfo.eigType
|
||||
<< deviceInfo.verifyType
|
||||
<< deviceInfo.identifyType
|
||||
<< deviceInfo.busType
|
||||
<< deviceInfo.deviceStatus
|
||||
<< deviceInfo.OpsStatus;
|
||||
arg.endStructure();
|
||||
return arg;
|
||||
}
|
||||
const QDBusArgument &operator >>(const QDBusArgument &arg, DeviceInfo &deviceInfo)
|
||||
{
|
||||
arg.beginStructure();
|
||||
arg >> deviceInfo.id
|
||||
>> deviceInfo.shortName
|
||||
>> deviceInfo.fullName
|
||||
>> deviceInfo.driverEnable
|
||||
>> deviceInfo.deviceNum
|
||||
>> deviceInfo.deviceType
|
||||
>> deviceInfo.storageType
|
||||
>> deviceInfo.eigType
|
||||
>> deviceInfo.verifyType
|
||||
>> deviceInfo.identifyType
|
||||
>> deviceInfo.busType
|
||||
>> deviceInfo.deviceStatus
|
||||
>> deviceInfo.OpsStatus;
|
||||
arg.endStructure();
|
||||
return arg;
|
||||
}
|
||||
|
||||
/* For the type FeatureInfo */
|
||||
QDBusArgument &operator<<(QDBusArgument &argument, const FeatureInfo &featureInfo)
|
||||
{
|
||||
argument.beginStructure();
|
||||
argument << featureInfo.uid << featureInfo.biotype
|
||||
<< featureInfo.device_shortname << featureInfo.index
|
||||
<< featureInfo.index_name;
|
||||
argument.endStructure();
|
||||
return argument;
|
||||
}
|
||||
|
||||
const QDBusArgument &operator>>(const QDBusArgument &argument, FeatureInfo &featureInfo)
|
||||
{
|
||||
argument.beginStructure();
|
||||
argument >> featureInfo.uid >> featureInfo.biotype
|
||||
>> featureInfo.device_shortname >> featureInfo.index
|
||||
>> featureInfo.index_name;
|
||||
argument.endStructure();
|
||||
return argument;
|
||||
}
|
||||
|
||||
void registerMetaType()
|
||||
{
|
||||
qRegisterMetaType<DeviceInfo>("DeviceInfo");
|
||||
qDBusRegisterMetaType<DeviceInfo>();
|
||||
qRegisterMetaType<FeatureInfo>("FeatureInfo");
|
||||
qDBusRegisterMetaType<FeatureInfo>();
|
||||
}
|
||||
|
||||
|
||||
QString GetDefaultDevice(const QString &userName)
|
||||
{
|
||||
//QString configPath = QString("/home/%1/" UKUI_BIOMETRIC_CONFIG_PATH).arg(userName);
|
||||
QString configPath = QDir::homePath() + "/" + UKUI_BIOMETRIC_CONFIG_PATH;
|
||||
QSettings settings(configPath, QSettings::IniFormat);
|
||||
qDebug() << "configure path: " << settings.fileName();
|
||||
|
||||
QString defaultDevice = settings.value("DefaultDevice").toString();
|
||||
if(defaultDevice.isEmpty())
|
||||
{
|
||||
QSettings sysSettings(UKUI_BIOMETRIC_SYS_CONFIG_PATH, QSettings::IniFormat);
|
||||
defaultDevice = sysSettings.value("DefaultDevice").toString();
|
||||
}
|
||||
|
||||
return defaultDevice;
|
||||
}
|
||||
|
||||
int GetLastDevice(const QString &userName)
|
||||
{
|
||||
int nLastDevId = -1;
|
||||
QSettings sysSettings(QString(SHARE_BIOMETRIC_CONFIG_PATH).arg(userName), QSettings::IniFormat);
|
||||
sysSettings.beginGroup("Common");
|
||||
if (sysSettings.allKeys().contains("LastDeviceId")) {
|
||||
nLastDevId = sysSettings.value("LastDeviceId").toInt();
|
||||
}
|
||||
sysSettings.endGroup();
|
||||
return nLastDevId;
|
||||
}
|
||||
|
||||
void SetLastDevice(const QString &userName, int drvid)
|
||||
{
|
||||
if (drvid < 0) {
|
||||
return;
|
||||
}
|
||||
QString desConfPath = QString(SHARE_BIOMETRIC_CONFIG_PATH).arg(userName);
|
||||
QFile fileConf(desConfPath);
|
||||
if (fileConf.exists()) {
|
||||
QSettings sysSettings(desConfPath, QSettings::IniFormat);
|
||||
sysSettings.beginGroup("Common");
|
||||
sysSettings.setValue("LastDeviceId", drvid);
|
||||
sysSettings.endGroup();
|
||||
} else {
|
||||
QSettings sysSettings(desConfPath, QSettings::IniFormat);
|
||||
sysSettings.beginGroup("Common");
|
||||
sysSettings.setValue("LastDeviceId", drvid);
|
||||
sysSettings.endGroup();
|
||||
sysSettings.sync();
|
||||
QFile file(desConfPath);
|
||||
file.setPermissions(QFile::WriteUser | QFile::ReadUser | QFile::WriteOther | QFile::ReadOther);
|
||||
}
|
||||
}
|
||||
|
||||
static int getValueFromSettings(const QString &userName, const QString &key, int defaultValue = 3)
|
||||
{
|
||||
//从家目录下的配置文件中获取
|
||||
//QString configPath = QString("/home/%1/" UKUI_BIOMETRIC_CONFIG_PATH).arg(userName);
|
||||
QString configPath = QDir::homePath() + "/" + UKUI_BIOMETRIC_CONFIG_PATH;
|
||||
QSettings settings(configPath, QSettings::IniFormat);
|
||||
QString valueStr = settings.value(key).toString();
|
||||
|
||||
//如果没有获取到,则从系统配置文件中获取
|
||||
if(valueStr.isEmpty())
|
||||
{
|
||||
QSettings sysSettings(UKUI_BIOMETRIC_SYS_CONFIG_PATH, QSettings::IniFormat);
|
||||
valueStr = sysSettings.value(key).toString();
|
||||
}
|
||||
|
||||
bool ok;
|
||||
int value = valueStr.toInt(&ok);
|
||||
if( (value == 0 && !ok) || valueStr.isEmpty() )
|
||||
{
|
||||
value = defaultValue;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
bool GetHiddenSwitchButton()
|
||||
{
|
||||
QSettings sysSettings(UKUI_BIOMETRIC_SYS_CONFIG_PATH, QSettings::IniFormat);
|
||||
if(sysSettings.contains("HiddenSwitchButton"))
|
||||
return sysSettings.value("HiddenSwitchButton").toBool();
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
int GetFailedTimes()
|
||||
{
|
||||
QSettings sysSettings(UKUI_BIOMETRIC_SYS_CONFIG_PATH, QSettings::IniFormat);
|
||||
if(sysSettings.contains("MaxFailedTimes"))
|
||||
return sysSettings.value("MaxFailedTimes").toInt();
|
||||
else
|
||||
return 3;
|
||||
}
|
||||
|
||||
bool GetAuthEnable()
|
||||
{
|
||||
bool isEnable = false;
|
||||
QSettings sysSettings(UKUI_BIOMETRIC_SYS_CONFIG_PATH, QSettings::IniFormat);
|
||||
if(sysSettings.contains("EnableAuth"))
|
||||
isEnable = sysSettings.value("EnableAuth").toBool();
|
||||
else
|
||||
isEnable = false;
|
||||
|
||||
if(isEnable && sysSettings.allKeys().contains("EnableAuthApp")){
|
||||
int isEnableApp = sysSettings.value("EnableAuthApp").toInt();
|
||||
isEnable = isEnableApp & (1<<1);
|
||||
}
|
||||
|
||||
return isEnable;
|
||||
}
|
||||
|
||||
bool GetQRCodeEnable()
|
||||
{
|
||||
bool isEnable = false;
|
||||
QSettings sysSettings(UKUI_BIOMETRIC_SYS_CONFIG_PATH, QSettings::IniFormat);
|
||||
sysSettings.beginGroup("Functions");
|
||||
if (sysSettings.allKeys().contains("EnableQRCode")) {
|
||||
isEnable = sysSettings.value("EnableQRCode").toBool();
|
||||
}
|
||||
sysSettings.endGroup();
|
||||
return isEnable;
|
||||
}
|
||||
|
||||
int GetMaxFailedAutoRetry(const QString &userName)
|
||||
{
|
||||
return getValueFromSettings(userName, "MaxFailedAutoRetry");
|
||||
}
|
||||
|
||||
int GetMaxTimeoutAutoRetry(const QString &userName)
|
||||
{
|
||||
return getValueFromSettings(userName, "MaxTimeoutAutoRetry");
|
||||
}
|
|
@ -1,279 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
**/
|
||||
#include "biometricdeviceswidget.h"
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QComboBox>
|
||||
#include <QDebug>
|
||||
#include <QAbstractItemView>
|
||||
#include <QStyledItemDelegate>
|
||||
|
||||
|
||||
BiometricDevicesWidget::BiometricDevicesWidget(BiometricProxy *proxy, int uid,QWidget *parent)
|
||||
: QWidget(parent),
|
||||
proxy(proxy),
|
||||
m_uid(uid)
|
||||
{
|
||||
initUI();
|
||||
if(proxy && proxy->isValid())
|
||||
{
|
||||
connect(proxy, &BiometricProxy::USBDeviceHotPlug,
|
||||
this, &BiometricDevicesWidget::onUSBDeviceHotPlug);
|
||||
updateDevice();
|
||||
}
|
||||
|
||||
resize(500, 500);
|
||||
}
|
||||
|
||||
void BiometricDevicesWidget::initUI()
|
||||
{
|
||||
lblPrompt = new QLabel(this);
|
||||
lblPrompt->setObjectName(QStringLiteral("lblBioetricDevicesPrompt"));
|
||||
lblPrompt->setText(tr("Please select the biometric device"));
|
||||
lblPrompt->setAlignment(Qt::AlignHCenter);
|
||||
|
||||
lblDeviceType = new QLabel(this);
|
||||
lblDeviceType->setObjectName(QStringLiteral("lblDeviceType"));
|
||||
lblDeviceType->setText(tr("Device type:"));
|
||||
lblDeviceType->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||
|
||||
QStyledItemDelegate* itemDelegate = new QStyledItemDelegate();
|
||||
|
||||
cmbDeviceType = new QComboBox(this);
|
||||
cmbDeviceType->view()->parentWidget()->setWindowFlags(Qt::Popup|Qt::FramelessWindowHint);
|
||||
cmbDeviceType->view()->parentWidget()->setAttribute(Qt::WA_TranslucentBackground);
|
||||
cmbDeviceType->setObjectName(QStringLiteral("cmbDeviceType"));
|
||||
cmbDeviceType->setMaxVisibleItems(5);
|
||||
cmbDeviceType->setItemDelegate(itemDelegate);
|
||||
connect(cmbDeviceType, SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(onCmbDeviceTypeCurrentIndexChanged(int)));
|
||||
|
||||
lblDeviceName = new QLabel(this);
|
||||
lblDeviceName->setObjectName(QStringLiteral("lblDeviceName"));
|
||||
lblDeviceName->setText(tr("Device name:"));
|
||||
lblDeviceName->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
|
||||
|
||||
cmbDeviceName = new QComboBox(this);
|
||||
cmbDeviceName->view()->parentWidget()->setWindowFlags(Qt::Popup|Qt::FramelessWindowHint);
|
||||
cmbDeviceName->view()->parentWidget()->setAttribute(Qt::WA_TranslucentBackground);
|
||||
cmbDeviceName->setObjectName(QStringLiteral("cmbDeviceName"));
|
||||
cmbDeviceName->setMaxVisibleItems(5);
|
||||
cmbDeviceName->setItemDelegate(itemDelegate);
|
||||
|
||||
btnOK = new QPushButton(tr("OK"), this);
|
||||
btnOK->setObjectName(QStringLiteral("OKButton"));
|
||||
btnOK->setCursor(Qt::PointingHandCursor);
|
||||
connect(btnOK, &QPushButton::clicked,
|
||||
this, &BiometricDevicesWidget::onOKButtonClicked);
|
||||
}
|
||||
|
||||
void BiometricDevicesWidget::setUser(int user)
|
||||
{
|
||||
m_uid = user;
|
||||
}
|
||||
|
||||
void BiometricDevicesWidget::resizeEvent(QResizeEvent */*event*/)
|
||||
{
|
||||
lblPrompt->setGeometry(0, 0, width(), 40);
|
||||
lblDeviceType->setGeometry(100, lblPrompt->geometry().bottom() + 40,
|
||||
120, 20);
|
||||
cmbDeviceType->setGeometry(100, lblDeviceType->geometry().bottom() + 15,
|
||||
300, 40);
|
||||
lblDeviceName->setGeometry(100, cmbDeviceType->geometry().bottom() + 80,
|
||||
120, 20);
|
||||
cmbDeviceName->setGeometry(100, lblDeviceName->geometry().bottom() + 15,
|
||||
300, 40);
|
||||
btnOK->setGeometry(100, cmbDeviceName->geometry().bottom() + 80, 140, 38);
|
||||
|
||||
}
|
||||
|
||||
void BiometricDevicesWidget::updateDevice()
|
||||
{
|
||||
deviceMap.clear();
|
||||
DeviceList deviceList = proxy->GetDevList();
|
||||
for(auto pDeviceInfo : deviceList)
|
||||
{
|
||||
qDebug() << *pDeviceInfo;
|
||||
if(proxy->GetUserDevFeatureCount(m_uid,pDeviceInfo->id) > 0)
|
||||
deviceMap[pDeviceInfo->deviceType].push_back(pDeviceInfo);
|
||||
}
|
||||
cmbDeviceType->clear();
|
||||
for(int type : deviceMap.keys())
|
||||
{
|
||||
QString iconPath = QString(UKUI_BIOMETRIC_IMAGES_PATH"icon/%1.png")
|
||||
.arg(DeviceType::getDeviceType(type));
|
||||
qDebug() << iconPath;
|
||||
cmbDeviceType->addItem(QIcon(iconPath), DeviceType::getDeviceType_tr(type), type);
|
||||
}
|
||||
if(deviceMap.size() > 0)
|
||||
{
|
||||
int index = deviceMap.keys().at(0);
|
||||
setCurrentDevice(deviceMap[index].at(0));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void BiometricDevicesWidget::setCurrentDevice(int drvid)
|
||||
{
|
||||
DeviceInfoPtr pDeviceInfo = findDeviceById(drvid);
|
||||
if(pDeviceInfo)
|
||||
{
|
||||
setCurrentDevice(pDeviceInfo);
|
||||
}
|
||||
}
|
||||
|
||||
void BiometricDevicesWidget::setCurrentDevice(const QString &deviceName)
|
||||
{
|
||||
DeviceInfoPtr pDeviceInfo = findDeviceByName(deviceName);
|
||||
if(pDeviceInfo)
|
||||
{
|
||||
setCurrentDevice(pDeviceInfo);
|
||||
}
|
||||
}
|
||||
|
||||
void BiometricDevicesWidget::setCurrentDevice(const DeviceInfoPtr &pDeviceInfo)
|
||||
{
|
||||
this->currentDevice = pDeviceInfo;
|
||||
cmbDeviceType->setCurrentText(DeviceType::getDeviceType_tr(pDeviceInfo->deviceType));
|
||||
cmbDeviceName->setCurrentText(pDeviceInfo->shortName);
|
||||
}
|
||||
|
||||
bool BiometricDevicesWidget::deviceExists(int drvid)
|
||||
{
|
||||
return (findDeviceById(drvid) != nullptr);
|
||||
}
|
||||
|
||||
bool BiometricDevicesWidget::deviceExists(const QString &deviceName)
|
||||
{
|
||||
return (findDeviceByName(deviceName) != nullptr);
|
||||
}
|
||||
|
||||
DeviceInfoPtr BiometricDevicesWidget::findDeviceById(int drvid)
|
||||
{
|
||||
for(int type : deviceMap.keys())
|
||||
{
|
||||
DeviceList &deviceList = deviceMap[type];
|
||||
auto iter = std::find_if(deviceList.begin(), deviceList.end(),
|
||||
[&](DeviceInfoPtr ptr){
|
||||
return ptr->id == drvid;
|
||||
});
|
||||
if(iter != deviceList.end())
|
||||
{
|
||||
return *iter;
|
||||
}
|
||||
}
|
||||
return DeviceInfoPtr();
|
||||
}
|
||||
|
||||
DeviceInfoPtr BiometricDevicesWidget::findDeviceByName(const QString &name)
|
||||
{
|
||||
for(int type : deviceMap.keys())
|
||||
{
|
||||
DeviceList &deviceList = deviceMap[type];
|
||||
auto iter = std::find_if(deviceList.begin(), deviceList.end(),
|
||||
[&](DeviceInfoPtr ptr){
|
||||
return ptr->shortName == name;
|
||||
});
|
||||
if(iter != deviceList.end())
|
||||
{
|
||||
return *iter;
|
||||
}
|
||||
}
|
||||
return DeviceInfoPtr();
|
||||
}
|
||||
|
||||
void BiometricDevicesWidget::onCmbDeviceTypeCurrentIndexChanged(int index)
|
||||
{
|
||||
if(index < 0 || index >= deviceMap.keys().size())
|
||||
{
|
||||
return;
|
||||
}
|
||||
int type = cmbDeviceType->itemData(index).toInt();
|
||||
cmbDeviceName->clear();
|
||||
for(auto &deviceInfo : deviceMap.value(type))
|
||||
{
|
||||
cmbDeviceName->addItem(deviceInfo->shortName);
|
||||
}
|
||||
}
|
||||
|
||||
void BiometricDevicesWidget::onOKButtonClicked()
|
||||
{
|
||||
int type = cmbDeviceType->currentData().toInt();
|
||||
int index = cmbDeviceName->currentIndex();
|
||||
qDebug() << type << index;
|
||||
DeviceInfoPtr deviceInfo = deviceMap.value(type).at(index);
|
||||
Q_EMIT deviceChanged(deviceInfo);
|
||||
hide();
|
||||
}
|
||||
|
||||
void BiometricDevicesWidget::onUSBDeviceHotPlug(int drvid, int action, int /*devNum*/)
|
||||
{
|
||||
int savedDeviceId = currentDevice->id;
|
||||
int savedCount = 0;
|
||||
for(int type : deviceMap.keys())
|
||||
savedCount += deviceMap.value(type).count();
|
||||
|
||||
switch(action)
|
||||
{
|
||||
case ACTION_ATTACHED:
|
||||
{
|
||||
//插入设备后,需要更新设备列表
|
||||
deviceMap.clear();
|
||||
updateDevice();
|
||||
setCurrentDevice(savedDeviceId);
|
||||
break;
|
||||
}
|
||||
case ACTION_DETACHED:
|
||||
{
|
||||
DeviceInfoPtr pDeviceInfo = findDeviceById(drvid);
|
||||
if(pDeviceInfo)
|
||||
{
|
||||
int type = pDeviceInfo->deviceType;
|
||||
deviceMap[type].removeOne(pDeviceInfo);
|
||||
int index = cmbDeviceName->findText(pDeviceInfo->shortName);
|
||||
cmbDeviceName->removeItem(index);
|
||||
|
||||
//如果该类型的设备全被移除,删除该类型相关的列表
|
||||
if(deviceMap[type].isEmpty())
|
||||
{
|
||||
deviceMap.remove(type);
|
||||
index = cmbDeviceType->findData(type);
|
||||
cmbDeviceType->removeItem(index);
|
||||
}
|
||||
}
|
||||
if(savedDeviceId != drvid)
|
||||
{
|
||||
setCurrentDevice(savedDeviceId);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
for(int type : deviceMap.keys())
|
||||
count += deviceMap.value(type).count();
|
||||
|
||||
//设备数量发生了变化
|
||||
if(count != savedCount)
|
||||
{
|
||||
Q_EMIT deviceCountChanged(count);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
**/
|
||||
#ifndef BIOMETRICDEVICESWIDGET_H
|
||||
#define BIOMETRICDEVICESWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "biometricproxy.h"
|
||||
|
||||
class QLabel;
|
||||
class QPushButton;
|
||||
class QComboBox;
|
||||
|
||||
|
||||
class BiometricDevicesWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit BiometricDevicesWidget(BiometricProxy *proxy, int uid,QWidget *parent = nullptr);
|
||||
void setCurrentDevice(int drvid);
|
||||
void setCurrentDevice(const QString &deviceName);
|
||||
void setCurrentDevice(const DeviceInfoPtr &pDeviceInfo);
|
||||
DeviceInfoPtr findDeviceById(int drvid);
|
||||
DeviceInfoPtr findDeviceByName(const QString &name);
|
||||
bool deviceExists(int drvid);
|
||||
bool deviceExists(const QString &deviceName);
|
||||
void setUser(int user);
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
Q_SIGNALS:
|
||||
void deviceChanged(const DeviceInfoPtr &pDeviceInfo);
|
||||
void deviceCountChanged(int newCount);
|
||||
|
||||
public Q_SLOTS:
|
||||
void onOKButtonClicked();
|
||||
|
||||
private Q_SLOTS:
|
||||
void onCmbDeviceTypeCurrentIndexChanged(int index);
|
||||
void onUSBDeviceHotPlug(int drvid, int action, int devNum);
|
||||
|
||||
private:
|
||||
void initUI();
|
||||
void updateDevice();
|
||||
|
||||
private:
|
||||
typedef QMap<int, QPushButton*> QButtonMap;
|
||||
|
||||
QLabel *lblPrompt;
|
||||
QLabel *lblDeviceType;
|
||||
QLabel *lblDeviceName;
|
||||
QComboBox *cmbDeviceType;
|
||||
QComboBox *cmbDeviceName;
|
||||
QPushButton *btnOK;
|
||||
QPushButton *btnCancel;
|
||||
|
||||
BiometricProxy *proxy;
|
||||
DeviceMap deviceMap;
|
||||
DeviceInfoPtr currentDevice;
|
||||
int m_uid;
|
||||
};
|
||||
|
||||
#endif // BIOMETRICDEVICESWIDGET_H
|
|
@ -1,44 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
**/
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include "biometricproxy.h"
|
||||
#include "biometricauthwidget.h"
|
||||
#include "biometricdeviceswidget.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
|
||||
BiometricProxy proxy;
|
||||
BiometricAuthWidget biometricAuthWidget(&proxy);
|
||||
biometricAuthWidget.hide();
|
||||
BiometricDevicesWidget biometricDeviceWidget(&proxy);
|
||||
QObject::connect(&biometricDeviceWidget, &BiometricDevicesWidget::deviceChanged,
|
||||
&a, [&](const DeviceInfoPtr &pDeviceInfo){
|
||||
biometricAuthWidget.startAuth(pDeviceInfo, 1000);
|
||||
biometricAuthWidget.show();
|
||||
});
|
||||
QObject::connect(&biometricDeviceWidget, &BiometricDevicesWidget::deviceCountChanged,
|
||||
&a, [&](int count){
|
||||
qDebug() << "device count changed: " << count;
|
||||
});
|
||||
biometricDeviceWidget.show();
|
||||
|
||||
return a.exec();
|
||||
}
|
|
@ -1,60 +1,24 @@
|
|||
cmake_minimum_required(VERSION 2.6)
|
||||
project(ukui-screensaver)
|
||||
|
||||
find_package(Qt5 COMPONENTS Core Widgets DBus X11Extras Xml Network Svg Multimedia MultimediaWidgets)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
find_package(OpenCV REQUIRED)
|
||||
find_package(PkgConfig)
|
||||
find_package(KF5Screen REQUIRED)
|
||||
find_package(KF5Wayland REQUIRED)
|
||||
find_package(LayerShellQt REQUIRED)
|
||||
|
||||
pkg_check_modules(GIOUNIX2 REQUIRED gio-unix-2.0)
|
||||
pkg_check_modules(GLIB2 REQUIRED glib-2.0 gio-2.0)
|
||||
pkg_check_modules(kylin-nm-base REQUIRED kylin-nm-base)
|
||||
pkg_check_modules(KScreen REQUIRED kscreen2)
|
||||
|
||||
# 是否是intel项目
|
||||
option (USE_INTEL "intel项目" OFF)
|
||||
# 用于测试替换用的变量
|
||||
set(TEST_ON 1)
|
||||
set(TEST_OF 0)
|
||||
set(VAR "VAR_NEW")
|
||||
|
||||
# 加入一个配置头文件,用于处理 CMake 对源码的设置
|
||||
configure_file (
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/config.h.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/config.h"
|
||||
)
|
||||
|
||||
set(TS_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/i18n_ts/zh_CN.ts
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/i18n_ts/es.ts
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/i18n_ts/fr.ts
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/i18n_ts/bo_CN.ts
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/i18n_ts/pt.ts
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/i18n_ts/ru.ts
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/i18n_ts/tr.ts
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/i18n_ts/nm.ts
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/i18n_ts/kk.ts
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/i18n_ts/ug.ts
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/i18n_ts/ky.ts
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/i18n_ts/de.ts
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/i18n_ts/zh_HK.ts
|
||||
)
|
||||
## 更新翻译字段
|
||||
file(GLOB TS_FILES ./i18n_ts/*.ts)
|
||||
add_custom_command(
|
||||
OUTPUT ${TS_FILES}
|
||||
COMMAND lupdate src/ screensaver/ -ts ${TS_FILES}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
OUTPUT ${TS_FILES}
|
||||
COMMAND lupdate src/ screensaver/ -ts ${TS_FILES}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
add_custom_target(
|
||||
i18n_ts
|
||||
DEPENDS ${TS_FILES}
|
||||
)
|
||||
i18n_ts
|
||||
DEPENDS ${TS_FILES}
|
||||
)
|
||||
|
||||
add_compile_options(-fPIC)
|
||||
|
||||
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror")
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
set(CMAKE_INSTALL_PREFIX /usr)
|
||||
|
||||
|
@ -63,17 +27,9 @@ if(Debug)
|
|||
set(CMAKE_BUILD_TYPE "Debug")
|
||||
endif()
|
||||
|
||||
#add_subdirectory(BioAuth)
|
||||
add_subdirectory(BiometricAuth)
|
||||
add_subdirectory(VirtualKeyboard)
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(i18n_ts)
|
||||
add_subdirectory(set4kScale)
|
||||
add_subdirectory(data)
|
||||
add_subdirectory(screensaver)
|
||||
add_subdirectory(screensaver-focus-helper)
|
||||
add_subdirectory(Common)
|
||||
add_subdirectory(KylinNM)
|
||||
|
||||
add_dependencies(ukui-screensaver-dialog BiometricAuth VirtualKeyboard Common Screensaver)
|
||||
add_dependencies(ukui-screensaver-default Common)
|
||||
# 让主目标依赖翻译文件,这样才会执行i18n
|
||||
add_dependencies(ukui-screensaver-dialog i18n)
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
pkg_check_modules(GLIB REQUIRED glib-2.0)
|
||||
find_package(X11 REQUIRED)
|
||||
find_package(KF5WindowSystem)
|
||||
|
||||
include_directories(
|
||||
${Qt5Core_INCLUDE_DIRS}
|
||||
${Qt5Widgets_INCLUDE_DIRS}
|
||||
${Qt5DBus_INCLUDE_DIRS}
|
||||
${GLIB2_INCLUDE_DIRS}
|
||||
${KF5Wayland_LIBRARIES}
|
||||
)
|
||||
|
||||
qt5_wrap_cpp(Common_SRC
|
||||
autoresize.h
|
||||
checkbutton.h
|
||||
commonfunc.h
|
||||
glibinterface.h
|
||||
plasma-shell-manager.h
|
||||
)
|
||||
|
||||
set(Common_SRC
|
||||
${Common_SRC}
|
||||
autoresize.cpp
|
||||
checkbutton.cpp
|
||||
commonfunc.cpp
|
||||
glibinterface.cpp
|
||||
plasma-shell-manager.cpp
|
||||
)
|
||||
|
||||
add_library(Common STATIC ${Common_SRC})
|
||||
target_link_libraries(Common Qt5::Core Qt5::DBus Qt5::Widgets Qt5::X11Extras ${GIOUNIX2_LIBRARIES} ${KF5Wayland_LIBRARIES} -lKF5WaylandClient -lKF5WaylandServer KF5::WindowSystem)
|
|
@ -1,32 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
**/
|
||||
|
||||
#include "autoresize.h"
|
||||
|
||||
AutoResize::AutoResize(QWidget* obj,int baseWidth,int baseHeight):
|
||||
obj(obj),
|
||||
baseWidth(baseWidth),
|
||||
baseHeight(baseHeight)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
AutoResize::~AutoResize(void)
|
||||
{
|
||||
}
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef AUTORESIZE_H
|
||||
#define AUTORESIZE_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
struct AutoResizeOriginalData
|
||||
{
|
||||
QRect data_rect;
|
||||
QFont data_font;
|
||||
};
|
||||
class AutoResize
|
||||
{
|
||||
public:
|
||||
AutoResize(QWidget* obj,int baseWidth,int baseHeight);
|
||||
~AutoResize(void);
|
||||
private:
|
||||
QWidget *obj;
|
||||
int baseWidth;
|
||||
int baseHeight;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,150 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
**/
|
||||
|
||||
#include <QMimeType>
|
||||
#include <QSettings>
|
||||
#include <QPainterPath>
|
||||
#include <QMimeDatabase>
|
||||
#include <QPainter>
|
||||
#include <QFileInfo>
|
||||
#include <QFontMetrics>
|
||||
#include <QDir>
|
||||
#include <QTextStream>
|
||||
#include <QtX11Extras/QX11Info>
|
||||
#include <X11/XKBlib.h>
|
||||
#include "commonfunc.h"
|
||||
|
||||
#define DRM_DIR "/sys/class/leds/"
|
||||
|
||||
/**
|
||||
* @brief 判断大写键状态
|
||||
* @return true: 大写锁定
|
||||
*/
|
||||
bool checkCapsLockState()
|
||||
{
|
||||
QDir ledDir(DRM_DIR);
|
||||
QStringList leds = ledDir.entryList(QDir::Dirs);
|
||||
QString capsFile;
|
||||
|
||||
for(int i = 0;i<leds.count();i++){
|
||||
if(leds.at(i).contains("capslock"))
|
||||
capsFile = leds.at(i);
|
||||
}
|
||||
QFile drmStatusFile(DRM_DIR + capsFile + "/brightness");
|
||||
if(drmStatusFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QTextStream in(&drmStatusFile);
|
||||
QString status = in.readLine();
|
||||
|
||||
if(status == "0") {
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool capsState = false;
|
||||
unsigned int n;
|
||||
XkbGetIndicatorState(QX11Info::display(), XkbUseCoreKbd, &n);
|
||||
capsState = (n & 0x01) == 1;
|
||||
|
||||
return capsState;
|
||||
}
|
||||
|
||||
bool ispicture(QString filepath)
|
||||
{
|
||||
QFileInfo file(filepath);
|
||||
if(file.exists() == false)
|
||||
return false;
|
||||
|
||||
QMimeDatabase db;
|
||||
QMimeType mime = db.mimeTypeForFile(filepath);
|
||||
return mime.name().startsWith("image/");
|
||||
}
|
||||
|
||||
QString getSystemVersion()
|
||||
{
|
||||
QSettings settings("/etc/lsb-release", QSettings::IniFormat);
|
||||
QString release = settings.value("DISTRIB_RELEASE").toString();
|
||||
QString description = settings.value("DISTRIB_DESCRIPTION").toString();
|
||||
if(description.right(3) == "LTS")
|
||||
release = release + " LTS";
|
||||
return release;
|
||||
}
|
||||
|
||||
QString getSystemDistrib()
|
||||
{
|
||||
QSettings settings("/etc/lsb-release", QSettings::IniFormat);
|
||||
QString distribId = settings.value("DISTRIB_ID").toString();
|
||||
return distribId;
|
||||
}
|
||||
|
||||
bool getUseFirstDevice()
|
||||
{
|
||||
QSettings settings("/etc/biometric-auth/ukui-biometric.conf", QSettings::IniFormat);
|
||||
return settings.value("UseFirstDevice").toBool();
|
||||
}
|
||||
|
||||
commonFunc::commonFunc()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QString ElideText(QFont font,int width,QString strInfo)
|
||||
{
|
||||
QFontMetrics fontMetrics(font);
|
||||
//如果当前字体下,字符串长度大于指定宽度
|
||||
if(fontMetrics.width(strInfo) > width)
|
||||
{
|
||||
strInfo= QFontMetrics(font).elidedText(strInfo, Qt::ElideRight, width);
|
||||
}
|
||||
return strInfo;
|
||||
}
|
||||
|
||||
/*修改图片缩放机制,图片长宽不一致时,先取图片中央的部分*/
|
||||
QPixmap scaledPixmap(QPixmap src)
|
||||
{
|
||||
QPixmap rectPixmap;
|
||||
if (src.width() > src.height()) {
|
||||
QPixmap iconPixmap = src.copy((src.width() - src.height())/2, 0, src.height(), src.height());
|
||||
// 根据label高度等比例缩放图片
|
||||
rectPixmap = iconPixmap.scaledToHeight(src.height());
|
||||
} else {
|
||||
QPixmap iconPixmap = src.copy(0, (src.height() - src.width())/2, src.width(), src.width());
|
||||
// 根据label宽度等比例缩放图片
|
||||
rectPixmap = iconPixmap.scaledToWidth(src.width());
|
||||
}
|
||||
return rectPixmap;
|
||||
}
|
||||
|
||||
QPixmap PixmapToRound(const QPixmap &src, int radius)
|
||||
{
|
||||
if (src.isNull()) {
|
||||
return QPixmap();
|
||||
}
|
||||
|
||||
QPixmap pixmapa(src);
|
||||
QPixmap pixmap(radius*2,radius*2);
|
||||
pixmap.fill(Qt::transparent);
|
||||
QPainter painter(&pixmap);
|
||||
painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
|
||||
QPainterPath path;
|
||||
path.addEllipse(0, 0, radius*2, radius*2);
|
||||
painter.setClipPath(path);
|
||||
painter.drawPixmap(0, 0, radius*2, radius*2, pixmapa);
|
||||
return pixmap;
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2019 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef COMMONFUNC_H
|
||||
#define COMMONFUNC_H
|
||||
|
||||
#include <QString>
|
||||
#include <QFont>
|
||||
#include <QPixmap>
|
||||
|
||||
#define G_FONT_SIZE (11.0)
|
||||
|
||||
bool checkCapsLockState();
|
||||
bool ispicture(QString filepath);
|
||||
QString getSystemVersion();
|
||||
QString getSystemDistrib();
|
||||
bool getUseFirstDevice();
|
||||
QString ElideText(QFont font,int width,QString strInfo);
|
||||
QPixmap scaledPixmap(QPixmap src);
|
||||
QPixmap PixmapToRound(const QPixmap &src, int radius);
|
||||
|
||||
class commonFunc
|
||||
{
|
||||
public:
|
||||
commonFunc();
|
||||
};
|
||||
|
||||
#endif // COMMONFUNC_H
|
|
@ -1,48 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2023 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
**/
|
||||
#include "glibinterface.h"
|
||||
#include <QString>
|
||||
#include <gio/gio.h>
|
||||
|
||||
#define STYLE_TYPE_SCHEMA "org.ukui.style"
|
||||
#define KEY_SYSTEM_FONT_SIZE "system-font-size"
|
||||
#define DEFAULT_FONT_SIZE (10.0)
|
||||
|
||||
double getDefaultFontSize()
|
||||
{
|
||||
GSettingsSchemaSource *schema_source = NULL;
|
||||
GSettingsSchema *schema = NULL;
|
||||
double defaultFontSize = DEFAULT_FONT_SIZE;
|
||||
|
||||
schema_source = g_settings_schema_source_get_default();
|
||||
if (schema_source) {
|
||||
schema = g_settings_schema_source_lookup(schema_source,STYLE_TYPE_SCHEMA,TRUE);
|
||||
if (schema) {
|
||||
GSettings *gs = g_settings_new(STYLE_TYPE_SCHEMA);
|
||||
if (gs) {
|
||||
GVariant *size = g_settings_get_default_value(gs, KEY_SYSTEM_FONT_SIZE);
|
||||
QString fontsize(g_variant_get_string(size, NULL));
|
||||
g_variant_unref(size);
|
||||
g_object_unref(gs);
|
||||
defaultFontSize = fontsize.toDouble();
|
||||
}
|
||||
g_settings_schema_unref(schema);
|
||||
}
|
||||
}
|
||||
return defaultFontSize;
|
||||
}
|
|
@ -1,95 +0,0 @@
|
|||
find_package(Qt5 COMPONENTS Core Widgets REQUIRED)
|
||||
find_package(X11 REQUIRED)
|
||||
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
#pkg_check_modules(X11 REQUIRED x11)
|
||||
|
||||
qt5_wrap_ui(Kylin_NM_SRC
|
||||
src/confform.ui
|
||||
src/kylinnm.ui
|
||||
src/oneconnform.ui
|
||||
src/onelancform.ui
|
||||
wireless-security/dlgconnhidwifi.ui
|
||||
wireless-security/dlgconnhidwifisecfast.ui
|
||||
wireless-security/dlgconnhidwifisectunneltls.ui
|
||||
wireless-security/dlgconnhidwifisecpeap.ui
|
||||
wireless-security/dlgconnhidwifisectls.ui
|
||||
wireless-security/dlgconnhidwifisecleap.ui
|
||||
wireless-security/dlgconnhidwifisecpwd.ui
|
||||
wireless-security/dlgconnhidwifiwep.ui
|
||||
wireless-security/dlgconnhidwifileap.ui
|
||||
wireless-security/dlgconnhidwifiwpa.ui
|
||||
hot-spot/dlghotspotcreate.ui
|
||||
)
|
||||
|
||||
#qt5_wrap_cpp(Kylin_NM_SRC
|
||||
# src/backthread.h
|
||||
# src/confform.h
|
||||
# src/ksimplenm.h
|
||||
# src/kylin-dbus-interface.h
|
||||
# src/kylin-network-interface.h
|
||||
# src/loadingdiv.h
|
||||
# src/kylinnm.h
|
||||
# src/oneconnform.h
|
||||
# src/onelancform.h
|
||||
# src/switchbutton.h
|
||||
# src/utils.h
|
||||
# wireless-security/dlgconnhidwifi.h
|
||||
# wireless-security/dlgconnhidwifisecfast.h
|
||||
# wireless-security/dlgconnhidwifisectunneltls.h
|
||||
# wireless-security/dlgconnhidwifisecpeap.h
|
||||
# wireless-security/dlgconnhidwifisectls.h
|
||||
# wireless-security/dlgconnhidwifisecleap.h
|
||||
# wireless-security/dlgconnhidwifisecpwd.h
|
||||
# wireless-security/dlgconnhidwifiwep.h
|
||||
# wireless-security/dlgconnhidwifileap.h
|
||||
# wireless-security/dlgconnhidwifiwpa.h
|
||||
# wireless-security/kylinheadfile.h
|
||||
# hot-spot/dlghotspotcreate.h
|
||||
# )
|
||||
|
||||
qt5_add_resources(Kylin_NM_SRC
|
||||
nmqrc.qrc
|
||||
res.qrc)
|
||||
|
||||
set(Kylin_NM_SRC
|
||||
${Kylin_NM_SRC}
|
||||
src/backthread.cpp
|
||||
src/confform.cpp
|
||||
src/ksimplenm.cpp
|
||||
src/kylin-dbus-interface.cpp
|
||||
src/kylin-network-interface.c
|
||||
src/loadingdiv.cpp
|
||||
src/kylinnm.cpp
|
||||
src/oneconnform.cpp
|
||||
src/onelancform.cpp
|
||||
src/switchbutton.cpp
|
||||
src/utils.cpp
|
||||
src/swipegesturerecognizer.cpp
|
||||
wireless-security/dlgconnhidwifi.cpp
|
||||
wireless-security/dlgconnhidwifisecfast.cpp
|
||||
wireless-security/dlgconnhidwifisectunneltls.cpp
|
||||
wireless-security/dlgconnhidwifisecpeap.cpp
|
||||
wireless-security/dlgconnhidwifisectls.cpp
|
||||
wireless-security/dlgconnhidwifisecleap.cpp
|
||||
wireless-security/dlgconnhidwifisecpwd.cpp
|
||||
wireless-security/dlgconnhidwifiwep.cpp
|
||||
wireless-security/dlgconnhidwifileap.cpp
|
||||
wireless-security/dlgconnhidwifiwpa.cpp
|
||||
wireless-security/kylinheadfile.cpp
|
||||
hot-spot/dlghotspotcreate.cpp
|
||||
nmqrc.qrc
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${Qt5Core_INCLUDE_DIRS}
|
||||
${Qt5Widgets_INCLUDE_DIRS}
|
||||
${Qt5DBus_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
find_package(KF5WindowSystem)
|
||||
|
||||
add_library(Kylin-nm STATIC ${Kylin_NM_SRC})
|
||||
target_link_libraries(Kylin-nm Qt5::Core Qt5::Widgets KF5::WindowSystem Qt5::DBus Qt5::X11Extras)
|
|
@ -1,15 +0,0 @@
|
|||
# NAME
|
||||
kylin-nm - kylin network monitor used in ubuntu-kylin operation system
|
||||
|
||||
# DESCRIPTION
|
||||
kylin-nm is a Qt based applet and uses some interface provided by NetworkManager.
|
||||
It provides a GUI for users to connect or disconnect wired or wireless network which managed by NetworkManager.
|
||||
Users can also create new wired network and configure a old network.
|
||||
By click button at left bottom in the main window, a network configure window of NetworkManager will show in the screen.
|
||||
Users can get some information about network directly by clicking one item in the network list, these information shown in extension area.
|
||||
|
||||
# BUILD KYLIN-NM
|
||||
down the source sode
|
||||
install dependency packages(see cntrol files in the debian directory)
|
||||
execute debuild command in the root directory of project
|
||||
execute sudo dpkg -i packagename.deb to install
|
|
@ -1,155 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "dlghotspotcreate.h"
|
||||
#include "ui_dlghotspotcreate.h"
|
||||
#include "src/utils.h"
|
||||
|
||||
DlgHotspotCreate::DlgHotspotCreate(QString wiFiCardName, QWidget *parent) :
|
||||
wirelessCardName(wiFiCardName),
|
||||
QDialog(parent),
|
||||
ui(new Ui::DlgHotspotCreate)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
this->setWindowFlags(Qt::FramelessWindowHint);
|
||||
this->setStyleSheet("background-color:white;");
|
||||
|
||||
ui->lbLeftup->setStyleSheet("QLabel{background-color:#266ab5;}");
|
||||
ui->lbLeftupIcon->setStyleSheet("QLabel{background-image:url(:/res/h/no-pwd-wifi.png);background-color:transparent;}");
|
||||
ui->lbLeftupTitle->setStyleSheet("QLabel{font-size:12px;color:#ffffff;background-color:transparent;}");
|
||||
ui->btnCancel->setStyleSheet("QPushButton{border:1px solid #aaaaaa;background-color:#f5f5f5;}"
|
||||
"QPushButton:Hover{border:2px solid #629ee8;background-color:#eeeeee;}"
|
||||
"QPushButton:Pressed{border:1px solid #aaaaaa;background-color:#d8d8d8;}");
|
||||
ui->btnOk->setStyleSheet("QPushButton{border:1px solid #aaaaaa;background-color:#f5f5f5;}"
|
||||
"QPushButton:Hover{border:2px solid #629ee8;background-color:#eeeeee;}"
|
||||
"QPushButton:Pressed{border:1px solid #aaaaaa;background-color:#d8d8d8;}");
|
||||
ui->checkBoxPwd->setStyleSheet("QCheckBox::indicator {width: 18px; height: 9px;}"
|
||||
"QCheckBox::indicator:checked {image: url(:/res/h/show-pwd.png);}"
|
||||
"QCheckBox::indicator:unchecked {image: url(:/res/h/hide-pwd.png);}");
|
||||
|
||||
ui->lbLeftupTitle->setText(tr("Create Hotspot")); //创建个人热点
|
||||
ui->lbNetName->setText(tr("Network name")); //网络名称:
|
||||
ui->lbSecurity->setText(tr("Wi-Fi security")); //Wi-Fi 安全性:
|
||||
ui->lbPassword->setText(tr("Password")); //密码:
|
||||
ui->btnCancel->setText(tr("Cancel")); //取消
|
||||
ui->btnOk->setText(tr("Ok")); //确定
|
||||
ui->btnOk->setEnabled(false);
|
||||
|
||||
ui->cbxSecurity->addItem(tr("None")); //无
|
||||
ui->cbxSecurity->addItem(tr("WPA & WPA2 Personal")); //WPA 及 WPA2 个人
|
||||
ui->cbxSecurity->setCurrentIndex(1);
|
||||
connect(ui->cbxSecurity,SIGNAL(currentIndexChanged(QString)),this,SLOT(changeDialog()));
|
||||
}
|
||||
|
||||
DlgHotspotCreate::~DlgHotspotCreate()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void DlgHotspotCreate::mousePressEvent(QMouseEvent *event){
|
||||
if(event->button() == Qt::LeftButton){
|
||||
this->isPress = true;
|
||||
this->winPos = this->pos();
|
||||
this->dragPos = event->globalPos();
|
||||
event->accept();
|
||||
}
|
||||
}
|
||||
void DlgHotspotCreate::mouseReleaseEvent(QMouseEvent *event){
|
||||
this->isPress = false;
|
||||
this->setWindowOpacity(1);
|
||||
}
|
||||
void DlgHotspotCreate::mouseMoveEvent(QMouseEvent *event){
|
||||
if(this->isPress){
|
||||
this->move(this->winPos - (this->dragPos - event->globalPos()));
|
||||
this->setWindowOpacity(0.9);
|
||||
event->accept();
|
||||
}
|
||||
}
|
||||
|
||||
void DlgHotspotCreate::on_btnCancel_clicked()
|
||||
{
|
||||
this->close();
|
||||
emit btnHotspotState();
|
||||
}
|
||||
|
||||
void DlgHotspotCreate::on_btnOk_clicked()
|
||||
{
|
||||
//nmcli device wifi hotspot [ifname ifname] [con-name name] [ssid SSID] [band {a | bg}] [channel channel] [password password]
|
||||
//example: nmcli device wifi hotspot ifname wlan0 con-name MyHostspot ssid MyHostspotSSID password 12345678
|
||||
QString str;
|
||||
if(ui->cbxSecurity->currentIndex() == 0 ){
|
||||
str = "nmcli device wifi hotspot ifname " + wirelessCardName + " con-name " + ui->leNetName->text() + " ssid " + ui->leNetName->text() + "SSID";
|
||||
}else{
|
||||
str = "nmcli device wifi hotspot ifname " + wirelessCardName + " con-name " + ui->leNetName->text() + " ssid " + ui->leNetName->text() + " password " + ui->lePassword->text();
|
||||
}
|
||||
Utils::m_system(str.toUtf8().data());
|
||||
// int status = system(str.toUtf8().data());
|
||||
// if (status != 0){ syslog(LOG_ERR, "execute 'nmcli device wifi hotspot' in function 'on_btnOk_clicked' failed");}
|
||||
|
||||
this->close();
|
||||
emit updateHotspotList();
|
||||
}
|
||||
|
||||
void DlgHotspotCreate::on_checkBoxPwd_stateChanged(int arg1)
|
||||
{
|
||||
if (arg1 == 0) {
|
||||
ui->lePassword ->setEchoMode(QLineEdit::Password);
|
||||
} else {
|
||||
ui->lePassword->setEchoMode(QLineEdit::Normal);
|
||||
}
|
||||
}
|
||||
|
||||
void DlgHotspotCreate::on_leNetName_textEdited(const QString &arg1)
|
||||
{
|
||||
if(ui->cbxSecurity->currentIndex() == 0 ){
|
||||
if (ui->leNetName->text() == ""){
|
||||
ui->btnOk->setEnabled(false);
|
||||
} else {
|
||||
ui->btnOk->setEnabled(true);
|
||||
}
|
||||
}else{
|
||||
if (ui->leNetName->text() == "" || ui->lePassword->text().size() < 5){
|
||||
ui->btnOk->setEnabled(false);
|
||||
} else {
|
||||
ui->btnOk->setEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DlgHotspotCreate::on_lePassword_textEdited(const QString &arg1)
|
||||
{
|
||||
if (ui->leNetName->text() == "" || ui->lePassword->text().size() < 5){
|
||||
ui->btnOk->setEnabled(false);
|
||||
} else {
|
||||
ui->btnOk->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void DlgHotspotCreate::changeDialog()
|
||||
{
|
||||
if(ui->cbxSecurity->currentIndex()==0){
|
||||
ui->lbPassword->setEnabled(false);
|
||||
ui->lePassword->setEnabled(false);
|
||||
ui->checkBoxPwd->setEnabled(false);
|
||||
} else {
|
||||
ui->lbPassword->setEnabled(true);
|
||||
ui->lePassword->setEnabled(true);
|
||||
ui->checkBoxPwd->setEnabled(true);
|
||||
}
|
||||
}
|
|
@ -1,71 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DLGHOTSPOTCREATE_H
|
||||
#define DLGHOTSPOTCREATE_H
|
||||
|
||||
#include <sys/syslog.h>
|
||||
|
||||
#include <QDialog>
|
||||
#include <QMouseEvent>
|
||||
#include <QDebug>
|
||||
|
||||
namespace Ui {
|
||||
class DlgHotspotCreate;
|
||||
}
|
||||
|
||||
class DlgHotspotCreate : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DlgHotspotCreate(QString wiFiCardName, QWidget *parent = nullptr);
|
||||
~DlgHotspotCreate();
|
||||
|
||||
public Q_SLOTS:
|
||||
void changeDialog();
|
||||
|
||||
private Q_SLOTS:
|
||||
void on_btnCancel_clicked();
|
||||
|
||||
void on_btnOk_clicked();
|
||||
|
||||
void on_checkBoxPwd_stateChanged(int arg1);
|
||||
|
||||
void on_leNetName_textEdited(const QString &arg1);
|
||||
|
||||
void on_lePassword_textEdited(const QString &arg1);
|
||||
|
||||
private:
|
||||
Ui::DlgHotspotCreate *ui;
|
||||
|
||||
QString wirelessCardName;
|
||||
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
bool isPress;
|
||||
QPoint winPos;
|
||||
QPoint dragPos;
|
||||
|
||||
Q_SIGNALS:
|
||||
void updateHotspotList();
|
||||
void btnHotspotState();
|
||||
};
|
||||
|
||||
#endif // DLGHOTSPOTCREATE_H
|
|
@ -1,169 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DlgHotspotCreate</class>
|
||||
<widget class="QDialog" name="DlgHotspotCreate">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>432</width>
|
||||
<height>250</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="lbLeftup">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>120</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="lbLeftupIcon">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>9</x>
|
||||
<y>9</y>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="lbLeftupTitle">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>34</x>
|
||||
<y>6</y>
|
||||
<width>80</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btnCancel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>215</x>
|
||||
<y>210</y>
|
||||
<width>90</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btnOk">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>315</x>
|
||||
<y>210</y>
|
||||
<width>90</width>
|
||||
<height>30</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="lbSecurity">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>76</x>
|
||||
<y>60</y>
|
||||
<width>90</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="cbxSecurity">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>175</x>
|
||||
<y>55</y>
|
||||
<width>200</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="lbNetName">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>76</x>
|
||||
<y>105</y>
|
||||
<width>90</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="leNetName">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>175</x>
|
||||
<y>100</y>
|
||||
<width>200</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="lbPassword">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>76</x>
|
||||
<y>150</y>
|
||||
<width>90</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lePassword">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>175</x>
|
||||
<y>145</y>
|
||||
<width>200</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBoxPwd">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>350</x>
|
||||
<y>157</y>
|
||||
<width>18</width>
|
||||
<height>9</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,70 +0,0 @@
|
|||
SOURCES += \
|
||||
$$PWD/src/backthread.cpp \
|
||||
$$PWD/src/confform.cpp \
|
||||
$$PWD/src/ksimplenm.cpp \
|
||||
$$PWD/src/kylin-dbus-interface.cpp \
|
||||
$$PWD/src/kylin-network-interface.c \
|
||||
$$PWD/src/loadingdiv.cpp \
|
||||
$$PWD/src/kylinnm.cpp \
|
||||
$$PWD/src/oneconnform.cpp \
|
||||
$$PWD/src/onelancform.cpp \
|
||||
$$PWD/src/switchbutton.cpp \
|
||||
$$PWD/src/utils.cpp \
|
||||
$$PWD/wireless-security/dlgconnhidwifi.cpp \
|
||||
$$PWD/wireless-security/dlgconnhidwifisecfast.cpp \
|
||||
$$PWD/wireless-security/dlgconnhidwifisectunneltls.cpp \
|
||||
$$PWD/wireless-security/dlgconnhidwifisecpeap.cpp \
|
||||
$$PWD/wireless-security/dlgconnhidwifisectls.cpp \
|
||||
$$PWD/wireless-security/dlgconnhidwifisecleap.cpp \
|
||||
$$PWD/wireless-security/dlgconnhidwifisecpwd.cpp \
|
||||
$$PWD/wireless-security/dlgconnhidwifiwep.cpp \
|
||||
$$PWD/wireless-security/dlgconnhidwifileap.cpp \
|
||||
$$PWD/wireless-security/dlgconnhidwifiwpa.cpp \
|
||||
$$PWD/wireless-security/kylinheadfile.cpp \
|
||||
$$PWD/hot-spot/dlghotspotcreate.cpp
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/src/backthread.h \
|
||||
$$PWD/src/confform.h \
|
||||
$$PWD/src/ksimplenm.h \
|
||||
$$PWD/src/kylin-dbus-interface.h \
|
||||
$$PWD/src/kylin-network-interface.h \
|
||||
$$PWD/src/loadingdiv.h \
|
||||
$$PWD/src/kylinnm.h \
|
||||
$$PWD/src/oneconnform.h \
|
||||
$$PWD/src/onelancform.h \
|
||||
$$PWD/src/switchbutton.h \
|
||||
$$PWD/src/utils.h \
|
||||
$$PWD/wireless-security/dlgconnhidwifi.h \
|
||||
$$PWD/wireless-security/dlgconnhidwifisecfast.h \
|
||||
$$PWD/wireless-security/dlgconnhidwifisectunneltls.h \
|
||||
$$PWD/wireless-security/dlgconnhidwifisecpeap.h \
|
||||
$$PWD/wireless-security/dlgconnhidwifisectls.h \
|
||||
$$PWD/wireless-security/dlgconnhidwifisecleap.h \
|
||||
$$PWD/wireless-security/dlgconnhidwifisecpwd.h \
|
||||
$$PWD/wireless-security/dlgconnhidwifiwep.h \
|
||||
$$PWD/wireless-security/dlgconnhidwifileap.h \
|
||||
$$PWD/wireless-security/dlgconnhidwifiwpa.h \
|
||||
$$PWD/wireless-security/kylinheadfile.h \
|
||||
$$PWD/hot-spot/dlghotspotcreate.h
|
||||
|
||||
FORMS += \
|
||||
$$PWD/src/confform.ui \
|
||||
$$PWD/src/kylinnm.ui \
|
||||
$$PWD/src/oneconnform.ui \
|
||||
$$PWD/src/onelancform.ui \
|
||||
$$PWD/wireless-security/dlgconnhidwifi.ui \
|
||||
$$PWD/wireless-security/dlgconnhidwifisecfast.ui \
|
||||
$$PWD/wireless-security/dlgconnhidwifisectunneltls.ui \
|
||||
$$PWD/wireless-security/dlgconnhidwifisecpeap.ui \
|
||||
$$PWD/wireless-security/dlgconnhidwifisectls.ui \
|
||||
$$PWD/wireless-security/dlgconnhidwifisecleap.ui \
|
||||
$$PWD/wireless-security/dlgconnhidwifisecpwd.ui \
|
||||
$$PWD/wireless-security/dlgconnhidwifiwep.ui \
|
||||
$$PWD/wireless-security/dlgconnhidwifileap.ui \
|
||||
$$PWD/wireless-security/dlgconnhidwifiwpa.ui \
|
||||
$$PWD/hot-spot/dlghotspotcreate.ui
|
||||
|
||||
RESOURCES += \
|
||||
$$PWD/nmqrc.qrc
|
||||
|
|
@ -1,129 +0,0 @@
|
|||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2018-10-19T15:29:47
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += core gui x11extras dbus
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = kylin-nm
|
||||
TEMPLATE = app
|
||||
LANGUAGE = C++
|
||||
|
||||
CONFIG += c++11
|
||||
|
||||
# CONFIG += link_pkgconfig
|
||||
# PKGCONFIG += gsettings-qt
|
||||
LIBS += -L/usr/lib/ -lgsettings-qt -lX11
|
||||
|
||||
target.path = /usr/bin
|
||||
target.source += $$TARGET
|
||||
desktop.path = /etc/xdg/autostart/
|
||||
desktop.files = kylin-nm.desktop
|
||||
|
||||
INSTALLS += target \
|
||||
desktop
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any feature of Qt which has been marked as deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
# You can also make your code fail to compile if you use deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
# QMAKE_CXXFLAGS += -Wno-unused-parameter
|
||||
QMAKE_CPPFLAGS *= $(shell dpkg-buildflags --get CPPFLAGS)
|
||||
QMAKE_CFLAGS *= $(shell dpkg-buildflags --get CFLAGS)
|
||||
QMAKE_CXXFLAGS *= $(shell dpkg-buildflags --get CXXFLAGS)
|
||||
QMAKE_LFLAGS *= $(shell dpkg-buildflags --get LDFLAGS)
|
||||
|
||||
|
||||
SOURCES += \
|
||||
src/backthread.cpp \
|
||||
src/confform.cpp \
|
||||
src/ksimplenm.cpp \
|
||||
src/kylin-dbus-interface.cpp \
|
||||
src/kylin-network-interface.c \
|
||||
src/loadingdiv.cpp \
|
||||
src/main.cpp \
|
||||
src/kylinnm.cpp \
|
||||
src/oneconnform.cpp \
|
||||
src/onelancform.cpp \
|
||||
src/switchbutton.cpp \
|
||||
src/utils.cpp \
|
||||
wireless-security/dlgconnhidwifi.cpp \
|
||||
wireless-security/dlgconnhidwifisecfast.cpp \
|
||||
wireless-security/dlgconnhidwifisectunneltls.cpp \
|
||||
wireless-security/dlgconnhidwifisecpeap.cpp \
|
||||
wireless-security/dlgconnhidwifisectls.cpp \
|
||||
wireless-security/dlgconnhidwifisecleap.cpp \
|
||||
wireless-security/dlgconnhidwifisecpwd.cpp \
|
||||
wireless-security/dlgconnhidwifiwep.cpp \
|
||||
wireless-security/dlgconnhidwifileap.cpp \
|
||||
wireless-security/dlgconnhidwifiwpa.cpp \
|
||||
wireless-security/kylinheadfile.cpp \
|
||||
hot-spot/dlghotspotcreate.cpp
|
||||
|
||||
|
||||
HEADERS += \
|
||||
src/backthread.h \
|
||||
src/confform.h \
|
||||
src/ksimplenm.h \
|
||||
src/kylin-dbus-interface.h \
|
||||
src/kylin-network-interface.h \
|
||||
src/loadingdiv.h \
|
||||
src/kylinnm.h \
|
||||
src/oneconnform.h \
|
||||
src/onelancform.h \
|
||||
src/switchbutton.h \
|
||||
src/utils.h \
|
||||
wireless-security/dlgconnhidwifi.h \
|
||||
wireless-security/dlgconnhidwifisecfast.h \
|
||||
wireless-security/dlgconnhidwifisectunneltls.h \
|
||||
wireless-security/dlgconnhidwifisecpeap.h \
|
||||
wireless-security/dlgconnhidwifisectls.h \
|
||||
wireless-security/dlgconnhidwifisecleap.h \
|
||||
wireless-security/dlgconnhidwifisecpwd.h \
|
||||
wireless-security/dlgconnhidwifiwep.h \
|
||||
wireless-security/dlgconnhidwifileap.h \
|
||||
wireless-security/dlgconnhidwifiwpa.h \
|
||||
wireless-security/kylinheadfile.h \
|
||||
hot-spot/dlghotspotcreate.h
|
||||
|
||||
FORMS += \
|
||||
src/confform.ui \
|
||||
src/kylinnm.ui \
|
||||
src/oneconnform.ui \
|
||||
src/onelancform.ui \
|
||||
wireless-security/dlgconnhidwifi.ui \
|
||||
wireless-security/dlgconnhidwifisecfast.ui \
|
||||
wireless-security/dlgconnhidwifisectunneltls.ui \
|
||||
wireless-security/dlgconnhidwifisecpeap.ui \
|
||||
wireless-security/dlgconnhidwifisectls.ui \
|
||||
wireless-security/dlgconnhidwifisecleap.ui \
|
||||
wireless-security/dlgconnhidwifisecpwd.ui \
|
||||
wireless-security/dlgconnhidwifiwep.ui \
|
||||
wireless-security/dlgconnhidwifileap.ui \
|
||||
wireless-security/dlgconnhidwifiwpa.ui \
|
||||
hot-spot/dlghotspotcreate.ui
|
||||
|
||||
RESOURCES += \
|
||||
nmqrc.qrc
|
||||
|
||||
unix {
|
||||
UI_DIR = .ui
|
||||
MOC_DIR = .moc
|
||||
OBJECTS_DIR = .obj
|
||||
}
|
||||
|
||||
TRANSLATIONS = translations/kylin-nm_zh_CN.ts \
|
||||
translations/kylin-nm_tr.ts \
|
||||
translations/kylin-nm_bo.ts
|
||||
|
||||
DISTFILES +=
|
|
@ -1,102 +0,0 @@
|
|||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>res/s/conning-b/1.png</file>
|
||||
<file>res/s/conning-b/2.png</file>
|
||||
<file>res/s/conning-b/3.png</file>
|
||||
<file>res/s/conning-b/4.png</file>
|
||||
<file>res/s/conning-b/5.png</file>
|
||||
<file>res/s/conning-b/6.png</file>
|
||||
<file>res/s/conning-b/7.png</file>
|
||||
<file>res/s/conning-b/8.png</file>
|
||||
<file>res/s/conning-b/9.png</file>
|
||||
<file>res/s/conning-b/10.png</file>
|
||||
<file>res/s/conning-b/11.png</file>
|
||||
<file>res/s/conning-b/12.png</file>
|
||||
<file>res/g/down_arrow.png</file>
|
||||
<file>res/g/checkbox-checked.svg</file>
|
||||
<file>res/g/checkbox-unchecked.svg</file>
|
||||
<file>res/s/rescan/1.png</file>
|
||||
<file>res/s/rescan/2.png</file>
|
||||
<file>res/s/rescan/3.png</file>
|
||||
<file>res/s/rescan/4.png</file>
|
||||
<file>res/s/rescan/5.png</file>
|
||||
<file>res/s/rescan/6.png</file>
|
||||
<file>res/s/rescan/7.png</file>
|
||||
<file>res/s/rescan/8.png</file>
|
||||
<file>res/s/rescan/9.png</file>
|
||||
<file>res/s/rescan/10.png</file>
|
||||
<file>res/s/rescan/11.png</file>
|
||||
<file>res/s/rescan/12.png</file>
|
||||
<file>res/h/hide-pwd.png</file>
|
||||
<file>res/h/right-pwd.png</file>
|
||||
<file>res/h/show-pwd.png</file>
|
||||
<file>res/h/no-pwd-wifi.png</file>
|
||||
<file>res/x/fly-mode-off.svg</file>
|
||||
<file>res/x/fly-mode-on.svg</file>
|
||||
<file>res/x/hot-spot-off.svg</file>
|
||||
<file>res/x/hot-spot-on.svg</file>
|
||||
<file>res/x/net-list-bg.svg</file>
|
||||
<file>res/x/wifi-list-bg.svg</file>
|
||||
<file>res/x/load-down.png</file>
|
||||
<file>res/x/load-up.png</file>
|
||||
<file>res/l/network-offline.png</file>
|
||||
<file>res/l/network-offline.svg</file>
|
||||
<file>res/l/network-online.png</file>
|
||||
<file>res/l/network-online.svg</file>
|
||||
<file>res/w/wifi-full.png</file>
|
||||
<file>res/w/wifi-full-pwd.png</file>
|
||||
<file>res/w/wifi-high.png</file>
|
||||
<file>res/w/wifi-high-pwd.png</file>
|
||||
<file>res/w/wifi-low.png</file>
|
||||
<file>res/w/wifi-low-pwd.png</file>
|
||||
<file>res/w/wifi-medium.png</file>
|
||||
<file>res/w/wifi-medium-pwd.png</file>
|
||||
<file>res/w/wifi-none.png</file>
|
||||
<file>res/w/wifi-none-pwd.png</file>
|
||||
<file>res/s/conning-a/1.png</file>
|
||||
<file>res/s/conning-a/2.png</file>
|
||||
<file>res/s/conning-a/3.png</file>
|
||||
<file>res/s/conning-a/4.png</file>
|
||||
<file>res/s/conning-a/5.png</file>
|
||||
<file>res/s/conning-a/6.png</file>
|
||||
<file>res/s/conning-a/7.png</file>
|
||||
<file>res/s/conning-a/8.png</file>
|
||||
<file>qss/style.qss</file>
|
||||
<file>res/g/close_black.png</file>
|
||||
<file>res/g/close_white.png</file>
|
||||
<file>res/s/conning-s/1.png</file>
|
||||
<file>res/s/conning-s/2.png</file>
|
||||
<file>res/s/conning-s/3.png</file>
|
||||
<file>res/s/conning-s/4.png</file>
|
||||
<file>res/s/conning-s/5.png</file>
|
||||
<file>res/s/conning-s/6.png</file>
|
||||
<file>res/s/conning-s/7.png</file>
|
||||
<file>res/s/conning-s/8.png</file>
|
||||
<file>res/s/conning-s/9.png</file>
|
||||
<file>res/s/conning-s/10.png</file>
|
||||
<file>res/s/conning-s/11.png</file>
|
||||
<file>res/s/conning-s/12.png</file>
|
||||
<file>res/x/setup.png</file>
|
||||
<file>res/x/pb-wifi-n.png</file>
|
||||
<file>res/x/pb-wifi-y.png</file>
|
||||
<file>res/x/pb-conn-dis.png</file>
|
||||
<file>res/l/pb-network-online.png</file>
|
||||
<file>res/l/pb-network-info.png</file>
|
||||
<file>res/l/pb-network-offline.png</file>
|
||||
<file>res/x/pb-newConn.png</file>
|
||||
<file>res/x/pb-close.png</file>
|
||||
<file>res/l/pb-top-network-offline.png</file>
|
||||
<file>res/w/pb-all-wifi-offline.png</file>
|
||||
<file>res/w/pb-top-wifi-offline.png</file>
|
||||
<file>res/w/wifi-full-off.png</file>
|
||||
<file>res/w/wifi-high-off.png</file>
|
||||
<file>res/w/wifi-low-off.png</file>
|
||||
<file>res/w/wifi-medium-off.png</file>
|
||||
<file>res/w/wifi-low-pwd-off.png</file>
|
||||
<file>res/w/wifi-full-pwd-off.png</file>
|
||||
<file>res/w/wifi-high-pwd-off.png</file>
|
||||
<file>res/w/wifi-medium-pwd-off.png</file>
|
||||
<file>res/w/wifi-none-off.png</file>
|
||||
<file>res/w/wifi-none-pwd-off.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
|
@ -1,10 +0,0 @@
|
|||
QScrollBar:vertical{margin:0px 2px 0px 2px;width:10px;background:rgba(48,48,51,0);border-radius:6px;}
|
||||
QScrollBar::up-arrow:vertical{height:0px;}
|
||||
QScrollBar::sub-line:vertical{border:0px solid;height:0px}
|
||||
QScrollBar::sub-page:vertical{background:transparent;}
|
||||
QScrollBar::handle:vertical{width:6px;background:rgba(72,72,76,1);border-radius:3px;}
|
||||
QScrollBar::handle:vertical:hover{width:6px;background:rgba(97,97,102,1);border-radius:3px;}
|
||||
QScrollBar::handle:vertical:pressed{width:6px;background:rgba(133,133,140,1);border-radius:3px;}
|
||||
QScrollBar::add-page:vertical{background:transparent;}
|
||||
QScrollBar::add-line:vertical{border:0px solid;height:0px}
|
||||
QScrollBar::down-arrow:vertical{height:0px;}
|
|
@ -1 +0,0 @@
|
|||
<RCC/>
|
|
@ -1,6 +0,0 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
|
||||
<g fill="none" fill-rule="evenodd">
|
||||
<path fill="#F7F9FC" stroke="#2FB3E8" stroke-width="2" d="M5.1277704,1 L10.8722296,1 C12.3720699,1 12.9300026,1.12081769 13.4820925,1.41607861 C13.9570983,1.67011445 14.3298856,2.04290172 14.5839214,2.51790745 C14.8791823,3.06999737 15,3.62793014 15,5.1277704 L15,5.1277704 L15,10.8722296 C15,12.3720699 14.8791823,12.9300026 14.5839214,13.4820925 C14.3298856,13.9570983 13.9570983,14.3298856 13.4820925,14.5839214 C12.9300026,14.8791823 12.3720699,15 10.8722296,15 L10.8722296,15 L5.1277704,15 C3.62793014,15 3.06999737,14.8791823 2.51790745,14.5839214 C2.04290172,14.3298856 1.67011445,13.9570983 1.41607861,13.4820925 C1.12081769,12.9300026 1,12.3720699 1,10.8722296 L1,10.8722296 L1,5.1277704 C1,3.62793014 1.12081769,3.06999737 1.41607861,2.51790745 C1.67011445,2.04290172 2.04290172,1.67011445 2.51790745,1.41607861 C3.06999737,1.12081769 3.62793014,1 5.1277704,1 L5.1277704,1 Z"/>
|
||||
<path fill="#2FB3E8" fill-rule="nonzero" d="M11.6095656,4.68765248 L12.3904344,5.31234752 C12.6060654,5.4848523 12.6410261,5.79949848 12.4685213,6.01512945 L7.64301704,12.0470098 C7.47051227,12.2626407 7.15586608,12.2976014 6.94023512,12.1250966 C6.93002911,12.1169318 6.92014717,12.10837 6.91061207,12.0994308 L3.68082747,9.07150777 C3.47937134,8.88264264 3.46916431,8.56622474 3.65802944,8.3647686 L4.34197056,7.6352314 C4.53074655,7.43369169 4.84716445,7.42348466 5.04862059,7.61234979 C5.04865031,7.61237765 5.04868002,7.61240551 5.04862614,7.6125225 L7.094,9.531 L7.094,9.531 L10.9067571,4.76571811 C11.0792948,4.5501305 11.3939238,4.51518256 11.6095656,4.68765248 Z"/>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 1.6 KiB |
|
@ -1,3 +0,0 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
|
||||
<path fill="#FFF" fill-rule="evenodd" stroke="#A8A8A8" stroke-width="2" d="M5.1277704,1 L10.8722296,1 C12.3720699,1 12.9300026,1.12081769 13.4820925,1.41607861 C13.9570983,1.67011445 14.3298856,2.04290172 14.5839214,2.51790745 C14.8791823,3.06999737 15,3.62793014 15,5.1277704 L15,5.1277704 L15,10.8722296 C15,12.3720699 14.8791823,12.9300026 14.5839214,13.4820925 C14.3298856,13.9570983 13.9570983,14.3298856 13.4820925,14.5839214 C12.9300026,14.8791823 12.3720699,15 10.8722296,15 L10.8722296,15 L5.1277704,15 C3.62793014,15 3.06999737,14.8791823 2.51790745,14.5839214 C2.04290172,14.3298856 1.67011445,13.9570983 1.41607861,13.4820925 C1.12081769,12.9300026 1,12.3720699 1,10.8722296 L1,10.8722296 L1,5.1277704 C1,3.62793014 1.12081769,3.06999737 1.41607861,2.51790745 C1.67011445,2.04290172 2.04290172,1.67011445 2.51790745,1.41607861 C3.06999737,1.12081769 3.62793014,1 5.1277704,1 L5.1277704,1 Z"/>
|
||||
</svg>
|
Before Width: | Height: | Size: 976 B |
Before Width: | Height: | Size: 205 B |
Before Width: | Height: | Size: 152 B |
Before Width: | Height: | Size: 113 B |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 506 B |
|
@ -1,23 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 32 32" style="enable-background:new 0 0 32 32;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#607D8B;}
|
||||
.st1{fill:#324347;}
|
||||
.st2{fill:#4CAF50;}
|
||||
.st3{fill:#03A9F4;}
|
||||
.st4{fill:#324347;stroke:#324347;stroke-width:0.4;stroke-miterlimit:10;}
|
||||
.st5{fill:#FA6056;}
|
||||
.st6{fill:none;stroke:#FFFFFF;stroke-miterlimit:10;}
|
||||
</style>
|
||||
<rect x="15.4" y="21.7" class="st0" width="1.3" height="4.4"/>
|
||||
<rect x="1.2" y="26.3" class="st0" width="29.6" height="0.9"/>
|
||||
<path class="st1" d="M10.8,24.7h10.3c1.1,0,2,0.9,2,2v0c0,1.1-0.9,2-2,2H10.8c-1.1,0-2-0.9-2-2v0C8.9,25.5,9.7,24.7,10.8,24.7z"/>
|
||||
<ellipse class="st2" cx="11.2" cy="26.6" rx="0.6" ry="0.6"/>
|
||||
<rect x="1.4" y="3.8" class="st3" width="29.2" height="17.9"/>
|
||||
<path class="st4" d="M1,3.4v18.7h30V3.4H1z M30.6,21.7H1.4V3.8h29.2V21.7z"/>
|
||||
<circle class="st5" cx="26.5" cy="26.5" r="5.5"/>
|
||||
<line class="st6" x1="24" y1="24" x2="29" y2="29"/>
|
||||
<line class="st6" x1="29" y1="24" x2="24" y2="29"/>
|
||||
</svg>
|
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 406 B |
|
@ -1 +0,0 @@
|
|||
<svg id="图层_1" data-name="图层 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><defs><style>.cls-1{fill:#607d8b;}.cls-2,.cls-5{fill:#324347;}.cls-3{fill:#4caf50;}.cls-4{fill:#03a9f4;}.cls-5{stroke:#324347;stroke-miterlimit:10;stroke-width:0.4px;}</style></defs><title>gnome-dev-ethernet32</title><rect class="cls-1" x="15.35" y="21.66" width="1.3" height="4.38"/><rect class="cls-1" x="15.54" y="11.96" width="0.92" height="29.61" transform="translate(42.77 10.77) rotate(90)"/><rect class="cls-2" x="8.87" y="24.67" width="14.26" height="3.93" rx="1.96"/><ellipse class="cls-3" cx="11.21" cy="26.64" rx="0.58" ry="0.59"/><rect class="cls-4" x="1.39" y="3.8" width="29.22" height="17.93"/><path class="cls-5" d="M1,3.4V22.12H31V3.4ZM30.61,21.73H1.39V3.8H30.61Z"/></svg>
|
Before Width: | Height: | Size: 785 B |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 351 B |
Before Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 349 B |
Before Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 355 B |
Before Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 359 B |
Before Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 652 B |
Before Width: | Height: | Size: 627 B |
Before Width: | Height: | Size: 646 B |
Before Width: | Height: | Size: 623 B |
Before Width: | Height: | Size: 354 B |
Before Width: | Height: | Size: 355 B |
Before Width: | Height: | Size: 345 B |
Before Width: | Height: | Size: 364 B |
Before Width: | Height: | Size: 376 B |
Before Width: | Height: | Size: 367 B |
Before Width: | Height: | Size: 405 B |
Before Width: | Height: | Size: 411 B |
Before Width: | Height: | Size: 406 B |
Before Width: | Height: | Size: 381 B |
Before Width: | Height: | Size: 362 B |
Before Width: | Height: | Size: 354 B |
Before Width: | Height: | Size: 709 B |
Before Width: | Height: | Size: 686 B |
Before Width: | Height: | Size: 769 B |
Before Width: | Height: | Size: 787 B |
Before Width: | Height: | Size: 673 B |
Before Width: | Height: | Size: 736 B |
Before Width: | Height: | Size: 664 B |
Before Width: | Height: | Size: 613 B |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 4.0 KiB |