Import Upstream version 3.1.1.34update1
|
@ -0,0 +1,9 @@
|
||||||
|
SOURCES += \
|
||||||
|
$$PWD/biometricproxy.cpp \
|
||||||
|
$$PWD/biometricauthwidget.cpp \
|
||||||
|
$$PWD/biometricdeviceswidget.cpp
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
$$PWD/biometricproxy.h \
|
||||||
|
$$PWD/biometricauthwidget.h \
|
||||||
|
$$PWD/biometricdeviceswidget.h
|
|
@ -0,0 +1,37 @@
|
||||||
|
#-------------------------------------------------
|
||||||
|
#
|
||||||
|
# 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 +=
|
|
@ -0,0 +1,28 @@
|
||||||
|
qt5_wrap_cpp(BiometricAuth_SRC
|
||||||
|
biometricdeviceinfo.h
|
||||||
|
biometricproxy.h
|
||||||
|
biometricauthwidget.h
|
||||||
|
biometricdeviceswidget.h
|
||||||
|
giodbus.h
|
||||||
|
)
|
||||||
|
|
||||||
|
set(BiometricAuth_SRC
|
||||||
|
${BiometricAuth_SRC}
|
||||||
|
biometricdeviceinfo.cpp
|
||||||
|
biometricproxy.cpp
|
||||||
|
biometricauthwidget.cpp
|
||||||
|
biometricdeviceswidget.cpp
|
||||||
|
giodbus.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
include_directories(
|
||||||
|
${Qt5Core_INCLUDE_DIRS}
|
||||||
|
${Qt5Widgets_INCLUDE_DIRS}
|
||||||
|
${Qt5DBus_INCLUDE_DIRS}
|
||||||
|
${OpenCV_INCLUDE_DIRS}
|
||||||
|
${GLIB2_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
add_library(BiometricAuth STATIC ${BiometricAuth_SRC})
|
||||||
|
target_link_libraries(BiometricAuth Qt5::Core Qt5::DBus Qt5::Widgets ${OpenCV_LIBS} ${GIOUNIX2_LIBRARIES})
|
|
@ -0,0 +1,344 @@
|
||||||
|
/**
|
||||||
|
* 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 2, 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, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||||
|
* 02110-1301, USA.
|
||||||
|
**/
|
||||||
|
#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);
|
||||||
|
}
|
|
@ -0,0 +1,94 @@
|
||||||
|
/**
|
||||||
|
* 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 2, 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, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||||
|
* 02110-1301, USA.
|
||||||
|
**/
|
||||||
|
#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
|
|
@ -0,0 +1,248 @@
|
||||||
|
/**
|
||||||
|
* 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 2, 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, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||||
|
* 02110-1301, USA.
|
||||||
|
**/
|
||||||
|
#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);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
void registerMetaType()
|
||||||
|
{
|
||||||
|
qRegisterMetaType<DeviceInfo>("DeviceInfo");
|
||||||
|
qDBusRegisterMetaType<DeviceInfo>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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");
|
||||||
|
}
|
|
@ -0,0 +1,272 @@
|
||||||
|
/**
|
||||||
|
* 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 2, 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, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||||
|
* 02110-1301, USA.
|
||||||
|
**/
|
||||||
|
#ifndef BIOMETRICDEVICEINFO_H
|
||||||
|
#define BIOMETRICDEVICEINFO_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#define BIOMETRIC_DBUS_SERVICE "org.ukui.Biometric"
|
||||||
|
#define BIOMETRIC_DBUS_PATH "/org/ukui/Biometric"
|
||||||
|
#define BIOMETRIC_DBUS_INTERFACE "org.ukui.Biometric"
|
||||||
|
|
||||||
|
#define UKUI_BIOMETRIC_IMAGES_PATH "/usr/share/ukui-biometric/images/"
|
||||||
|
#define UKUI_BIOMETRIC_CONFIG_PATH ".biometric_auth/ukui_biometric.conf"
|
||||||
|
#define UKUI_BIOMETRIC_SYS_CONFIG_PATH "/etc/biometric-auth/ukui-biometric.conf"
|
||||||
|
#define SHARE_BIOMETRIC_CONFIG_PATH "/var/lib/lightdm-data/%1/ukui-biometric.conf" //greeter、screensaver、polkit share conf
|
||||||
|
|
||||||
|
#define BIOMETRIC_PAM_DOUBLE "BIOMETRIC_PAM_DOUBLE"
|
||||||
|
#define BIOMETRIC_PAM "BIOMETRIC_PAM"
|
||||||
|
#define BIOMETRIC_PAM_QRCODE "BIOMETRIC_PAM_QRCODE"
|
||||||
|
#define BIOMETRIC_IGNORE "BIOMETRIC_IGNORE"
|
||||||
|
#define BIOMETRIC_SUCCESS "BIOMETRIC_SUCCESS"
|
||||||
|
|
||||||
|
#define REMOTE_QRCODE_TYPE (8)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 设备类型
|
||||||
|
*/
|
||||||
|
class DeviceType : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
DeviceType();
|
||||||
|
enum Type {
|
||||||
|
FingerPrint,
|
||||||
|
FingerVein,
|
||||||
|
Iris,
|
||||||
|
Face,
|
||||||
|
VoicePrint,
|
||||||
|
__MAX_NR_TYPES
|
||||||
|
};
|
||||||
|
Q_ENUM(Type)
|
||||||
|
/**
|
||||||
|
* @brief 获取设备类型的字符串表现形式
|
||||||
|
* @param deviceType 设备类型
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
static QString getDeviceType(int deviceType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 获取设备类型的国际化字符串
|
||||||
|
* @param deviceType 设备类型
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
static QString getDeviceType_tr(int deviceType);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief StatusChanged D-Bus 信号触发时的状态变化类型
|
||||||
|
*/
|
||||||
|
enum StatusType {
|
||||||
|
STATUS_DEVICE,
|
||||||
|
STATUS_OPERATION,
|
||||||
|
STATUS_NOTIFY
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 识别、终止操作等DBus调用的结果,即返回值里的 result
|
||||||
|
*/
|
||||||
|
enum DBusResult {
|
||||||
|
DBUS_RESULT_SUCCESS = 0,
|
||||||
|
DBUS_RESULT_NOTMATCH = -1,
|
||||||
|
DBUS_RESULT_ERROR = -2,
|
||||||
|
DBUS_RESULT_DEVICEBUSY = -3,
|
||||||
|
DBUS_RESULT_NOSUCHDEVICE = -4,
|
||||||
|
DBUS_RESULT_PERMISSIONDENIED = -5
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 识别操作(Identify)的ops状态
|
||||||
|
*/
|
||||||
|
/* 定义操作类型 */
|
||||||
|
typedef enum {
|
||||||
|
OPS_TYPE_COMM = 0,
|
||||||
|
OPS_TYPE_OPEN,
|
||||||
|
OPS_TYPE_ENROLL,
|
||||||
|
OPS_TYPE_VERIFY,
|
||||||
|
OPS_TYPE_IDENTIFY,
|
||||||
|
OPS_TYPE_CAPTURE,
|
||||||
|
OPS_TYPE_SEARCH,
|
||||||
|
OPS_TYPE_CLEAN,
|
||||||
|
OPS_TYPE_GET_FLIST,
|
||||||
|
OPS_TYPE_RENAME,
|
||||||
|
OPS_TYPE_CLOSE,
|
||||||
|
}BioOpsType;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 定义各种操作结果
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
OPS_COMM_SUCCESS = OPS_TYPE_COMM * 100, /** 空闲状态 **/
|
||||||
|
OPS_COMM_FAIL, /** 操作失败 **/
|
||||||
|
OPS_COMM_NO_MATCH = OPS_COMM_FAIL, /** 不匹配 **/
|
||||||
|
OPS_COMM_ERROR, /** 通用操作错误 **/
|
||||||
|
OPS_COMM_STOP_BY_USER, /** 用户取消 **/
|
||||||
|
OPS_COMM_TIMEOUT, /** 操作超时 **/
|
||||||
|
OPS_COMM_OUT_OF_MEM, /** 无法分配内存 **/
|
||||||
|
OPS_COMM_MAX,
|
||||||
|
|
||||||
|
OPS_OPEN_SUCCESS = OPS_TYPE_OPEN * 100, /** 打开设备完成 **/
|
||||||
|
OPS_OPEN_FAIL, /** 打开设备失败 **/
|
||||||
|
OPS_OPEN_ERROR, /** 打开设备遇到错误 **/
|
||||||
|
OPS_OPEN_MAX,
|
||||||
|
|
||||||
|
OPS_ENROLL_SUCCESS = OPS_TYPE_ENROLL * 100, /** 录入信息成功 **/
|
||||||
|
OPS_ENROLL_FAIL, /** 录入失败 **/
|
||||||
|
OPS_ENROLL_ERROR, /** 录入过程中遇到错误 **/
|
||||||
|
OPS_ENROLL_STOP_BY_USER, /** 录入被用户中断 **/
|
||||||
|
OPS_ENROLL_TIMEOUT, /** 操作超时 **/
|
||||||
|
OPS_ENROLL_MAX,
|
||||||
|
|
||||||
|
OPS_VERIFY_MATCH = OPS_TYPE_VERIFY * 100, /** 认证匹配 **/
|
||||||
|
OPS_VERIFY_NO_MATCH, /** 认证不匹配 **/
|
||||||
|
OPS_VERIFY_ERROR, /** 认证过程中遇到错误 **/
|
||||||
|
OPS_VERIFY_STOP_BY_USER, /** 认证被用户中断 **/
|
||||||
|
OPS_VERIFY_TIMEOUT, /** 操作超时 **/
|
||||||
|
OPS_VERIFY_MAX,
|
||||||
|
|
||||||
|
OPS_IDENTIFY_MATCH = OPS_TYPE_IDENTIFY * 100, /** 识别到指定特征 **/
|
||||||
|
OPS_IDENTIFY_NO_MATCH, /** 未识别出指定特征 **/
|
||||||
|
OPS_IDENTIFY_ERROR, /** 识别过程中遇到错误 **/
|
||||||
|
OPS_IDENTIFY_STOP_BY_USER, /** 识别被用户中断 **/
|
||||||
|
OPS_IDENTIFY_TIMEOUT, /** 操作超时 **/
|
||||||
|
OPS_IDENTIFY_MAX,
|
||||||
|
|
||||||
|
OPS_CAPTURE_SUCCESS = OPS_TYPE_CAPTURE * 100, /** 捕获成功 **/
|
||||||
|
OPS_CAPTURE_FAIL, /** 捕获失败 **/
|
||||||
|
OPS_CAPTURE_ERROR, /** 捕获过程中遇到错误 **/
|
||||||
|
OPS_CAPTURE_STOP_BY_USER, /** 捕获被用户中断 **/
|
||||||
|
OPS_CAPTURE_TIMEOUT, /** 操作超时 **/
|
||||||
|
OPS_CAPTURE_MAX,
|
||||||
|
|
||||||
|
OPS_SEARCH_MATCH = OPS_TYPE_SEARCH * 100, /** 搜索到指定特征 **/
|
||||||
|
OPS_SEARCH_NO_MATCH, /** 未搜索到指定特征 **/
|
||||||
|
OPS_SEARCH_ERROR, /** 搜索过程中遇到错误 **/
|
||||||
|
OPS_SEARCH_STOP_BY_USER, /** 搜索被用户中断 **/
|
||||||
|
OPS_SEARCH_TIMEOUT, /** 操作超时 **/
|
||||||
|
OPS_SEARCH_MAX,
|
||||||
|
|
||||||
|
OPS_CLEAN_SUCCESS = OPS_TYPE_CLEAN * 100, /** 清理特征成功 **/
|
||||||
|
OPS_CLEAN_FAIL, /** 清理失败 **/
|
||||||
|
OPS_CLEAN_ERROR, /** 清理过程中遇到错误 **/
|
||||||
|
OPS_CLEAN_STOP_BY_USER, /** 清理被用户中断 **/
|
||||||
|
OPS_CLEAN_TIMEOUT, /** 操作超时 **/
|
||||||
|
OPS_CLEAN_MAX,
|
||||||
|
|
||||||
|
OPS_GET_FLIST_SUCCESS = OPS_TYPE_GET_FLIST * 100, /** 获取特征列表完成 **/
|
||||||
|
OPS_GET_FLIST_FAIL, /** 获取特征列表失败 **/
|
||||||
|
OPS_GET_FLIST_ERROR, /** 获取特征列表过程中遇到错误 **/
|
||||||
|
OPS_GET_FLIST_STOP_BY_USER, /** 获取特征列表被用户中断 **/
|
||||||
|
OPS_GET_FLIST_TIMEOUT, /** 获取特征列表超时 **/
|
||||||
|
OPS_GET_FLIST_MAX,
|
||||||
|
|
||||||
|
OPS_RENAME_SUCCESS = OPS_TYPE_RENAME * 100, /** 重命名特征完成 **/
|
||||||
|
OPS_RENAME_FAIL, /** 重命名特征失败 **/
|
||||||
|
OPS_RENAME_ERROR, /** 重命名特征过程中遇到错误 **/
|
||||||
|
OPS_RENAME_STOP_BY_USER, /** 重命名特征被用户中断 **/
|
||||||
|
OPS_RENAME_TIMEOUT, /** 重命名特征超时 **/
|
||||||
|
OPS_RENAME_MAX,
|
||||||
|
|
||||||
|
OPS_CLOSE_SUCCESS = OPS_TYPE_CLOSE * 100, /** 关闭设备完成 **/
|
||||||
|
OPS_CLOSE_FAIL, /** 关闭设备失败 **/
|
||||||
|
OPS_CLOSE_ERROR, /** 关闭设备过程中遇到错误 **/
|
||||||
|
OPS_CLOSE_MAX,
|
||||||
|
}OpsResult;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 设备的信息
|
||||||
|
*/
|
||||||
|
struct DeviceInfo
|
||||||
|
{
|
||||||
|
int id;
|
||||||
|
QString shortName;
|
||||||
|
QString fullName;
|
||||||
|
int driverEnable;
|
||||||
|
int deviceNum;
|
||||||
|
int deviceType;
|
||||||
|
int storageType;
|
||||||
|
int eigType;
|
||||||
|
int verifyType;
|
||||||
|
int identifyType;
|
||||||
|
int busType;
|
||||||
|
int deviceStatus;
|
||||||
|
int OpsStatus;
|
||||||
|
};
|
||||||
|
|
||||||
|
class QDBusArgument;
|
||||||
|
|
||||||
|
QDBusArgument &operator <<(QDBusArgument &arg, const DeviceInfo &deviceInfo);
|
||||||
|
const QDBusArgument &operator >>(const QDBusArgument &arg, DeviceInfo &deviceInfo);
|
||||||
|
|
||||||
|
void registerMetaType();
|
||||||
|
|
||||||
|
typedef std::shared_ptr<DeviceInfo> DeviceInfoPtr;
|
||||||
|
typedef QList<DeviceInfoPtr> DeviceList;
|
||||||
|
typedef QMap<int, DeviceList> DeviceMap;
|
||||||
|
|
||||||
|
QDebug operator <<(QDebug stream, const DeviceInfo &deviceInfo);
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(DeviceInfo)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 获取默认设备
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
QString GetDefaultDevice(const QString &userName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 获取上次选择的设备
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int GetLastDevice(const QString &userName);
|
||||||
|
|
||||||
|
void SetLastDevice(const QString &userName, int drvid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 获取失败后自动重新开始的最大次数
|
||||||
|
* @param userName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int GetMaxFailedAutoRetry(const QString &userName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 获取超时后自动重新开始的最大次数
|
||||||
|
* @param userName
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int GetMaxTimeoutAutoRetry(const QString &userName);
|
||||||
|
bool GetHiddenSwitchButton();
|
||||||
|
int GetFailedTimes();
|
||||||
|
bool GetAuthEnable();
|
||||||
|
bool GetQRCodeEnable();
|
||||||
|
|
||||||
|
enum LOGINOPT_TYPE {
|
||||||
|
LOGINOPT_TYPE_PASSWORD = 0, // 密码
|
||||||
|
LOGINOPT_TYPE_FACE, // 人脸
|
||||||
|
LOGINOPT_TYPE_FINGERPRINT, // 指纹
|
||||||
|
LOGINOPT_TYPE_IRIS, // 虹膜
|
||||||
|
LOGINOPT_TYPE_VOICEPRINT, // 声纹
|
||||||
|
LOGINOPT_TYPE_FINGERVEIN, // 指静脉
|
||||||
|
LOGINOPT_TYPE_QRCODE, // 二维码
|
||||||
|
LOGINOPT_TYPE_OTHERS, // 其他
|
||||||
|
LOGINOPT_TYPE_COUNT
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // BIOMETRICDEVICEINFO_H
|
|
@ -0,0 +1,280 @@
|
||||||
|
/**
|
||||||
|
* 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 2, 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, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||||
|
* 02110-1301, USA.
|
||||||
|
**/
|
||||||
|
#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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,79 @@
|
||||||
|
/**
|
||||||
|
* 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 2, 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, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||||
|
* 02110-1301, USA.
|
||||||
|
**/
|
||||||
|
#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
|
|
@ -0,0 +1,212 @@
|
||||||
|
/**
|
||||||
|
* 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 2, 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, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||||
|
* 02110-1301, USA.
|
||||||
|
**/
|
||||||
|
#include "biometricproxy.h"
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
BiometricProxy::BiometricProxy(QObject *parent)
|
||||||
|
: QDBusAbstractInterface(BIOMETRIC_DBUS_SERVICE,
|
||||||
|
BIOMETRIC_DBUS_PATH,
|
||||||
|
BIOMETRIC_DBUS_INTERFACE,
|
||||||
|
QDBusConnection::systemBus(),
|
||||||
|
parent)
|
||||||
|
{
|
||||||
|
registerMetaType();
|
||||||
|
setTimeout(2147483647);
|
||||||
|
}
|
||||||
|
|
||||||
|
QDBusPendingCall BiometricProxy::Identify(int drvid, int uid, int indexStart, int indexEnd)
|
||||||
|
{
|
||||||
|
QList<QVariant> argList;
|
||||||
|
argList << drvid << uid << indexStart << indexEnd;
|
||||||
|
return asyncCallWithArgumentList(QStringLiteral("Identify"), argList);
|
||||||
|
}
|
||||||
|
|
||||||
|
int BiometricProxy::GetFeatureCount(int uid, int indexStart, int indexEnd)
|
||||||
|
{
|
||||||
|
QDBusMessage result = call(QStringLiteral("GetDevList"));
|
||||||
|
if(result.type() == QDBusMessage::ErrorMessage)
|
||||||
|
{
|
||||||
|
qWarning() << "GetDevList error:" << result.errorMessage();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
auto dbusArg = result.arguments().at(1).value<QDBusArgument>();
|
||||||
|
QList<QVariant> variantList;
|
||||||
|
dbusArg >> variantList;
|
||||||
|
int res = 0;
|
||||||
|
for(int i = 0; i < variantList.size(); i++)
|
||||||
|
{
|
||||||
|
|
||||||
|
DeviceInfoPtr pDeviceInfo = std::make_shared<DeviceInfo>();
|
||||||
|
|
||||||
|
auto arg = variantList.at(i).value<QDBusArgument>();
|
||||||
|
arg >> *pDeviceInfo;
|
||||||
|
|
||||||
|
QDBusMessage FeatureResult = call(QStringLiteral("GetFeatureList"),pDeviceInfo->id,uid,indexStart,indexEnd);
|
||||||
|
if(FeatureResult.type() == QDBusMessage::ErrorMessage)
|
||||||
|
{
|
||||||
|
qWarning() << "GetFeatureList error:" << FeatureResult.errorMessage();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
res += FeatureResult.arguments().takeFirst().toInt();
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
int BiometricProxy::StopOps(int drvid, int waiting)
|
||||||
|
{
|
||||||
|
QDBusReply<int> reply = call(QStringLiteral("StopOps"), drvid, waiting);
|
||||||
|
if(!reply.isValid())
|
||||||
|
{
|
||||||
|
qWarning() << "StopOps error:" << reply.error();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return reply.value();
|
||||||
|
}
|
||||||
|
|
||||||
|
int BiometricProxy::GetUserDevCount(int uid)
|
||||||
|
{
|
||||||
|
QDBusMessage result = call(QStringLiteral("GetDevList"));
|
||||||
|
if(result.type() == QDBusMessage::ErrorMessage)
|
||||||
|
{
|
||||||
|
qWarning() << "GetDevList error:" << result.errorMessage();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
auto dbusArg = result.arguments().at(1).value<QDBusArgument>();
|
||||||
|
QList<QVariant> variantList;
|
||||||
|
DeviceList deviceList;
|
||||||
|
dbusArg >> variantList;
|
||||||
|
for(int i = 0; i < variantList.size(); i++)
|
||||||
|
{
|
||||||
|
DeviceInfoPtr pDeviceInfo = std::make_shared<DeviceInfo>();
|
||||||
|
|
||||||
|
auto arg = variantList.at(i).value<QDBusArgument>();
|
||||||
|
arg >> *pDeviceInfo;
|
||||||
|
|
||||||
|
int count = GetUserDevFeatureCount(uid,pDeviceInfo->id);
|
||||||
|
|
||||||
|
if(count>0)
|
||||||
|
deviceList.push_back(pDeviceInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
return deviceList.count();
|
||||||
|
}
|
||||||
|
|
||||||
|
int BiometricProxy::GetUserDevFeatureCount(int uid,int drvid)
|
||||||
|
{
|
||||||
|
StopOps(drvid);
|
||||||
|
QDBusMessage FeatureResult = call(QStringLiteral("GetFeatureList"),drvid,uid,0,-1);
|
||||||
|
if(FeatureResult.type() == QDBusMessage::ErrorMessage)
|
||||||
|
{
|
||||||
|
qWarning() << "GetFeatureList error:" << FeatureResult.errorMessage();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return FeatureResult.arguments().takeFirst().toInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
DeviceList BiometricProxy::GetDevList()
|
||||||
|
{
|
||||||
|
QDBusMessage result = call(QStringLiteral("GetDevList"));
|
||||||
|
if(result.type() == QDBusMessage::ErrorMessage)
|
||||||
|
{
|
||||||
|
qWarning() << "GetDevList error:" << result.errorMessage();
|
||||||
|
return DeviceList();
|
||||||
|
}
|
||||||
|
auto dbusArg = result.arguments().at(1).value<QDBusArgument>();
|
||||||
|
QList<QVariant> variantList;
|
||||||
|
DeviceList deviceList;
|
||||||
|
dbusArg >> variantList;
|
||||||
|
for(int i = 0; i < variantList.size(); i++)
|
||||||
|
{
|
||||||
|
DeviceInfoPtr pDeviceInfo = std::make_shared<DeviceInfo>();
|
||||||
|
|
||||||
|
auto arg = variantList.at(i).value<QDBusArgument>();
|
||||||
|
arg >> *pDeviceInfo;
|
||||||
|
|
||||||
|
deviceList.push_back(pDeviceInfo);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return deviceList;
|
||||||
|
}
|
||||||
|
|
||||||
|
int BiometricProxy::GetDevCount()
|
||||||
|
{
|
||||||
|
QDBusMessage result = call(QStringLiteral("GetDevList"));
|
||||||
|
if(result.type() == QDBusMessage::ErrorMessage)
|
||||||
|
{
|
||||||
|
qWarning() << "GetDevList error:" << result.errorMessage();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int count = result.arguments().at(0).value<int>();
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString BiometricProxy::GetDevMesg(int drvid)
|
||||||
|
{
|
||||||
|
QDBusMessage result = call(QStringLiteral("GetDevMesg"), drvid);
|
||||||
|
if(result.type() == QDBusMessage::ErrorMessage)
|
||||||
|
{
|
||||||
|
qWarning() << "GetDevMesg error:" << result.errorMessage();
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return result.arguments().at(0).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString BiometricProxy::GetNotifyMesg(int drvid)
|
||||||
|
{
|
||||||
|
QDBusMessage result = call(QStringLiteral("GetNotifyMesg"), drvid);
|
||||||
|
if(result.type() == QDBusMessage::ErrorMessage)
|
||||||
|
{
|
||||||
|
qWarning() << "GetNotifyMesg error:" << result.errorMessage();
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return result.arguments().at(0).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
QString BiometricProxy::GetOpsMesg(int drvid)
|
||||||
|
{
|
||||||
|
QDBusMessage result = call(QStringLiteral("GetOpsMesg"), drvid);
|
||||||
|
if(result.type() == QDBusMessage::ErrorMessage)
|
||||||
|
{
|
||||||
|
qWarning() << "GetOpsMesg error:" << result.errorMessage();
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return result.arguments().at(0).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
StatusReslut BiometricProxy::UpdateStatus(int drvid)
|
||||||
|
{
|
||||||
|
StatusReslut status;
|
||||||
|
QDBusMessage result = call(QStringLiteral("UpdateStatus"), drvid);
|
||||||
|
if(result.type() == QDBusMessage::ErrorMessage)
|
||||||
|
{
|
||||||
|
qWarning() << "UpdateStatus error:" << result.errorMessage();
|
||||||
|
status.result = -1;
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
status.result = result.arguments().at(0).toInt();
|
||||||
|
status.enable = result.arguments().at(1).toInt();
|
||||||
|
status.devNum = result.arguments().at(2).toInt();
|
||||||
|
status.devStatus = result.arguments().at(3).toInt();
|
||||||
|
status.opsStatus = result.arguments().at(4).toInt();
|
||||||
|
status.notifyMessageId = result.arguments().at(5).toInt();
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
|
@ -0,0 +1,139 @@
|
||||||
|
/**
|
||||||
|
* 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 2, 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, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||||
|
* 02110-1301, USA.
|
||||||
|
**/
|
||||||
|
#ifndef BIOMETRICPROXY_H
|
||||||
|
#define BIOMETRICPROXY_H
|
||||||
|
|
||||||
|
#include <QtDBus>
|
||||||
|
#include <QDBusAbstractInterface>
|
||||||
|
#include <QDBusUnixFileDescriptor>
|
||||||
|
#include "biometricdeviceinfo.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief UpdateStauts调用返回的结果
|
||||||
|
*/
|
||||||
|
struct StatusReslut
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
int enable;
|
||||||
|
int devNum;
|
||||||
|
int devStatus;
|
||||||
|
int opsStatus;
|
||||||
|
int notifyMessageId;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief USB设备插拔动作
|
||||||
|
*/
|
||||||
|
enum USBDeviceAction
|
||||||
|
{
|
||||||
|
ACTION_ATTACHED = 1,
|
||||||
|
ACTION_DETACHED = -1
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief DBus代理类,负责调用对应的DBus接口
|
||||||
|
*/
|
||||||
|
class BiometricProxy : public QDBusAbstractInterface
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit BiometricProxy(QObject *parent = nullptr);
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
/**
|
||||||
|
* @brief 使用指定id的设备进行用户认证
|
||||||
|
* @param drvid 驱动(设备)id
|
||||||
|
* @param uid 用户id
|
||||||
|
* @param indexStart 用于认证的特征索引范围
|
||||||
|
* @param indexEnd
|
||||||
|
* @return 结果:<int result, int uid> (结果,用户id)
|
||||||
|
*/
|
||||||
|
QDBusPendingCall Identify(int drvid, int uid, int indexStart = 0, int indexEnd = -1);
|
||||||
|
/**
|
||||||
|
* @brief 终止设备上正在进行的操作
|
||||||
|
* @param drvid 设备id
|
||||||
|
* @param waiting 等待时间(秒)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int StopOps(int drvid, int waiting = 3000);
|
||||||
|
/**
|
||||||
|
* @brief 获取当前用户已连接设备对应特征数目
|
||||||
|
* @param uid 用户id
|
||||||
|
* @param indexStart 用于认证的特征索引范围
|
||||||
|
* @param indexEnd
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int GetFeatureCount(int uid, int indexStart = 0, int indexEnd = -1);
|
||||||
|
/**
|
||||||
|
* @brief 获取已连接的设备列表
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
DeviceList GetDevList();
|
||||||
|
/**
|
||||||
|
* @brief 获取设备数量
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int GetDevCount();
|
||||||
|
/**
|
||||||
|
* @brief 获取设备消息
|
||||||
|
* @param drvid 驱动id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
QString GetDevMesg(int drvid);
|
||||||
|
/**
|
||||||
|
* @brief GetNotifyMesg 获取通知消息
|
||||||
|
* @param drvid 驱动id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
QString GetNotifyMesg(int drvid);
|
||||||
|
/**
|
||||||
|
* @brief GetOpsMesg 获取操作消息
|
||||||
|
* @param drvid 驱动id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
QString GetOpsMesg(int drvid);
|
||||||
|
/**
|
||||||
|
* @brief UpdateStatus 获取更新的设备状态
|
||||||
|
* @param drvid 驱动id
|
||||||
|
* @return 结果:<int result, int enable, int devNum,
|
||||||
|
* int devStatus, int opsStatus, notifyMessageId, ...>
|
||||||
|
*/
|
||||||
|
StatusReslut UpdateStatus(int drvid);
|
||||||
|
int GetUserDevCount(int uid);
|
||||||
|
int GetUserDevFeatureCount(int uid,int drvid);
|
||||||
|
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
/**
|
||||||
|
* @brief 设备状态发生变化
|
||||||
|
* @param drvid 设备id
|
||||||
|
* @param status 设备状态
|
||||||
|
*/
|
||||||
|
void StatusChanged(int drvid, int status);
|
||||||
|
/**
|
||||||
|
* @brief USB设备热插拔
|
||||||
|
* @param drvid 设备id
|
||||||
|
* @param action 插拔动作(1:插入,-1:拔出)
|
||||||
|
* @param deviceNum 插拔动作后该驱动拥有的设备数量
|
||||||
|
*/
|
||||||
|
void USBDeviceHotPlug(int drvid, int action, int deviceNum);
|
||||||
|
void FrameWritten(int drvid);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // BIOMETRICPROXY_H
|
|
@ -0,0 +1,54 @@
|
||||||
|
#include "giodbus.h"
|
||||||
|
#include <gio/gio.h>
|
||||||
|
#include <gio-unix-2.0/gio/gunixfdlist.h>
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
|
int get_server_gvariant_stdout (int drvid)
|
||||||
|
{
|
||||||
|
GDBusMessage *method_call_message;
|
||||||
|
GDBusMessage *method_reply_message;
|
||||||
|
GUnixFDList *fd_list;
|
||||||
|
GError **error = NULL;
|
||||||
|
|
||||||
|
gint fd,dup_fd;
|
||||||
|
const gchar * response;
|
||||||
|
fd = -1;
|
||||||
|
dup_fd = -1;
|
||||||
|
method_call_message = NULL;
|
||||||
|
method_reply_message = NULL;
|
||||||
|
GDBusConnection *con = g_bus_get_sync(G_BUS_TYPE_SYSTEM,NULL,NULL);
|
||||||
|
method_call_message = g_dbus_message_new_method_call ("org.ukui.Biometric",
|
||||||
|
"/org/ukui/Biometric",
|
||||||
|
"org.ukui.Biometric",
|
||||||
|
"GetFrameFd");
|
||||||
|
|
||||||
|
g_dbus_message_set_body (method_call_message, g_variant_new ("(i)", drvid));
|
||||||
|
method_reply_message = g_dbus_connection_send_message_with_reply_sync (con,
|
||||||
|
method_call_message,
|
||||||
|
G_DBUS_SEND_MESSAGE_FLAGS_NONE,
|
||||||
|
-1,
|
||||||
|
NULL, /* out_serial */
|
||||||
|
NULL, /* cancellable */
|
||||||
|
error);
|
||||||
|
if (method_reply_message == NULL)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
if (g_dbus_message_get_message_type (method_reply_message) == G_DBUS_MESSAGE_TYPE_ERROR)
|
||||||
|
{
|
||||||
|
g_dbus_message_to_gerror (method_reply_message, error);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
g_print("%s",g_dbus_message_print(method_reply_message,0));
|
||||||
|
|
||||||
|
fd_list = g_dbus_message_get_unix_fd_list(method_reply_message);
|
||||||
|
fd = g_unix_fd_list_get(fd_list,0,error);
|
||||||
|
g_print("get fd : %d\n", fd);
|
||||||
|
dup_fd = dup(fd);
|
||||||
|
g_print("dup fd : %d\n", dup_fd);
|
||||||
|
|
||||||
|
out:
|
||||||
|
g_object_unref (method_call_message);
|
||||||
|
g_object_unref (method_reply_message);
|
||||||
|
return dup_fd;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
#ifndef GIODBUS_H
|
||||||
|
#define GIODBUS_H
|
||||||
|
|
||||||
|
int get_server_gvariant_stdout(int drvid);
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,45 @@
|
||||||
|
/**
|
||||||
|
* 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 2, 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, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||||
|
* 02110-1301, USA.
|
||||||
|
**/
|
||||||
|
#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();
|
||||||
|
}
|
|
@ -0,0 +1,67 @@
|
||||||
|
cmake_minimum_required(VERSION 2.6)
|
||||||
|
project(ukui-screensaver)
|
||||||
|
|
||||||
|
find_package(Qt5 COMPONENTS Core Widgets DBus X11Extras Xml Network Svg)
|
||||||
|
find_package(PkgConfig REQUIRED)
|
||||||
|
find_package(OpenCV REQUIRED)
|
||||||
|
find_package(PkgConfig)
|
||||||
|
pkg_check_modules(GIOUNIX2 REQUIRED gio-unix-2.0)
|
||||||
|
pkg_check_modules(GLIB2 REQUIRED glib-2.0 gio-2.0)
|
||||||
|
|
||||||
|
# 是否是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
|
||||||
|
)
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${TS_FILES}
|
||||||
|
COMMAND lupdate src/ screensaver/ -ts ${TS_FILES}
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
)
|
||||||
|
add_custom_target(
|
||||||
|
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_INCLUDE_CURRENT_DIR ON)
|
||||||
|
set(CMAKE_INSTALL_PREFIX /usr)
|
||||||
|
|
||||||
|
set(Debug ON)
|
||||||
|
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)
|
||||||
|
add_dependencies(ukui-screensaver-default Common)
|
|
@ -0,0 +1,22 @@
|
||||||
|
qt5_wrap_cpp(Common_SRC
|
||||||
|
autoresize.h
|
||||||
|
checkbutton.h
|
||||||
|
commonfunc.h
|
||||||
|
)
|
||||||
|
|
||||||
|
set(Common_SRC
|
||||||
|
${Common_SRC}
|
||||||
|
autoresize.cpp
|
||||||
|
checkbutton.cpp
|
||||||
|
commonfunc.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
include_directories(
|
||||||
|
${Qt5Core_INCLUDE_DIRS}
|
||||||
|
${Qt5Widgets_INCLUDE_DIRS}
|
||||||
|
${Qt5DBus_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
add_library(Common STATIC ${Common_SRC})
|
||||||
|
target_link_libraries(Common Qt5::Core Qt5::DBus Qt5::Widgets)
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
* 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)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
/*
|
||||||
|
* 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
|
|
@ -0,0 +1,186 @@
|
||||||
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||||
|
*
|
||||||
|
* 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 2 of the License, 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, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "checkbutton.h"
|
||||||
|
|
||||||
|
checkButton::checkButton(QWidget *parent)
|
||||||
|
:QFrame(parent)
|
||||||
|
{
|
||||||
|
this->setFixedSize(QSize(52, 24));
|
||||||
|
checked = false;
|
||||||
|
|
||||||
|
borderColorOff = QColor("#cccccc");
|
||||||
|
|
||||||
|
bgColorOff = QColor("#ffffff");
|
||||||
|
bgColorOn = QColor("#0078d7");
|
||||||
|
|
||||||
|
sliderColorOff = QColor("#cccccc");
|
||||||
|
sliderColorOn = QColor("#ffffff");
|
||||||
|
|
||||||
|
space = 4;
|
||||||
|
|
||||||
|
|
||||||
|
step = width() / 50;
|
||||||
|
startX = 0;
|
||||||
|
endX= 0;
|
||||||
|
|
||||||
|
timer = new QTimer(this);
|
||||||
|
timer->setInterval(5);
|
||||||
|
connect(timer, SIGNAL(timeout()), this, SLOT(updatevalue()));
|
||||||
|
setWindowFlags(Qt::FramelessWindowHint);
|
||||||
|
setAttribute(Qt::WA_TranslucentBackground, true);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkButton::paintEvent(QPaintEvent *){
|
||||||
|
//启用反锯齿
|
||||||
|
QPainter painter(this);
|
||||||
|
painter.setRenderHint(QPainter::Antialiasing, true);
|
||||||
|
|
||||||
|
drawBg(&painter);
|
||||||
|
drawSlider(&painter);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void checkButton::drawBg(QPainter *painter){
|
||||||
|
painter->save();
|
||||||
|
|
||||||
|
if (!checked){
|
||||||
|
painter->setPen(QColor(255,255,255,30));
|
||||||
|
painter->setBrush(QColor(255,255,255,30));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
painter->setPen(Qt::NoPen);
|
||||||
|
painter->setBrush(bgColorOn);
|
||||||
|
}
|
||||||
|
|
||||||
|
//circle in
|
||||||
|
QRect rect(0, 0, width(), height());
|
||||||
|
//半径为高度的一半
|
||||||
|
int radius = rect.height() / 2;
|
||||||
|
//圆的宽度为高度
|
||||||
|
int circleWidth = rect.height();
|
||||||
|
|
||||||
|
QPainterPath path;
|
||||||
|
path.moveTo(radius, rect.left());
|
||||||
|
path.arcTo(QRectF(rect.left(), rect.top(), circleWidth, circleWidth), 90, 180);
|
||||||
|
path.lineTo(rect.width() - radius, rect.height());
|
||||||
|
path.arcTo(QRectF(rect.width() - rect.height(), rect.top(), circleWidth, circleWidth), 270, 180);
|
||||||
|
path.lineTo(radius, rect.top());
|
||||||
|
|
||||||
|
painter->drawPath(path);
|
||||||
|
|
||||||
|
painter->restore();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void checkButton::drawSlider(QPainter *painter){
|
||||||
|
painter->save();
|
||||||
|
painter->setPen(Qt::NoPen);
|
||||||
|
|
||||||
|
if (!checked){
|
||||||
|
painter->setBrush(sliderColorOff);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
painter->setBrush(sliderColorOn);
|
||||||
|
|
||||||
|
//circle in
|
||||||
|
QRect rect(0, 0, width(), height());
|
||||||
|
int sliderWidth = rect.height() - space * 2;
|
||||||
|
QRect sliderRect(startX + space, space, sliderWidth, sliderWidth);
|
||||||
|
painter->drawEllipse(sliderRect);
|
||||||
|
|
||||||
|
painter->restore();
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkButton::mousePressEvent(QMouseEvent *){
|
||||||
|
checked = !checked;
|
||||||
|
emit checkedChanged(checked);
|
||||||
|
|
||||||
|
step = width() / 50;
|
||||||
|
|
||||||
|
if (checked){
|
||||||
|
|
||||||
|
endX = width() - height();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
endX = 0;
|
||||||
|
}
|
||||||
|
timer->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkButton::resizeEvent(QResizeEvent *){
|
||||||
|
step = width() / 50;
|
||||||
|
|
||||||
|
if (checked){
|
||||||
|
startX = width() - height();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
startX = 0;
|
||||||
|
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void checkButton::updatevalue(){
|
||||||
|
if (checked)
|
||||||
|
if (startX < endX){
|
||||||
|
startX = startX + step;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
startX = endX;
|
||||||
|
timer->stop();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if (startX > endX){
|
||||||
|
startX = startX - step;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
startX = endX;
|
||||||
|
timer->stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void checkButton::setChecked(bool checked){
|
||||||
|
if (this->checked != checked){
|
||||||
|
this->checked = checked;
|
||||||
|
emit checkedChanged(checked);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
step = width() / 50;
|
||||||
|
|
||||||
|
if (checked){
|
||||||
|
endX = width() - height();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
endX = 0;
|
||||||
|
}
|
||||||
|
timer->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool checkButton::isChecked(){
|
||||||
|
return this->checked;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||||
|
*
|
||||||
|
* 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 2 of the License, 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, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CHECKBUTTON_H
|
||||||
|
#define CHECKBUTTON_H
|
||||||
|
#include <QWidget>
|
||||||
|
#include <QFrame>
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QPainterPath>
|
||||||
|
#include <QEvent>
|
||||||
|
|
||||||
|
class checkButton : public QFrame
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
checkButton(QWidget *parent = 0);
|
||||||
|
void setChecked(bool checked);
|
||||||
|
|
||||||
|
bool isChecked();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void mousePressEvent(QMouseEvent *);
|
||||||
|
void resizeEvent(QResizeEvent *);
|
||||||
|
void paintEvent(QPaintEvent *);
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool checked;
|
||||||
|
|
||||||
|
QColor borderColorOff;
|
||||||
|
QColor bgColorOff;
|
||||||
|
QColor bgColorOn;
|
||||||
|
QColor sliderColorOff;
|
||||||
|
QColor sliderColorOn;
|
||||||
|
int space; //滑块离背景间隔
|
||||||
|
int rectRadius; //圆角角度
|
||||||
|
int step; //移动步长
|
||||||
|
int startX;
|
||||||
|
int endX;
|
||||||
|
QTimer * timer;
|
||||||
|
|
||||||
|
void drawBg(QPainter *painter);
|
||||||
|
void drawSlider(QPainter *painter);
|
||||||
|
|
||||||
|
|
||||||
|
private Q_SLOTS:
|
||||||
|
void updatevalue();
|
||||||
|
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
void checkedChanged(bool checked);
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CHECKBUTTON_H
|
|
@ -0,0 +1,77 @@
|
||||||
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||||
|
*
|
||||||
|
* 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 2 of the License, 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, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <QMimeType>
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QMimeDatabase>
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QFontMetrics>
|
||||||
|
#include "commonfunc.h"
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||||
|
*
|
||||||
|
* 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 2 of the License, 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, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef COMMONFUNC_H
|
||||||
|
#define COMMONFUNC_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
#include <QFont>
|
||||||
|
|
||||||
|
bool ispicture(QString filepath);
|
||||||
|
QString getSystemVersion();
|
||||||
|
QString getSystemDistrib();
|
||||||
|
bool getUseFirstDevice();
|
||||||
|
QString ElideText(QFont font,int width,QString strInfo);
|
||||||
|
|
||||||
|
class commonFunc
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
commonFunc();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COMMONFUNC_H
|
|
@ -0,0 +1,95 @@
|
||||||
|
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)
|
|
@ -0,0 +1,15 @@
|
||||||
|
# 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
|
|
@ -0,0 +1,155 @@
|
||||||
|
/*
|
||||||
|
* 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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,71 @@
|
||||||
|
/*
|
||||||
|
* 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
|
|
@ -0,0 +1,169 @@
|
||||||
|
<?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>
|
|
@ -0,0 +1,70 @@
|
||||||
|
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
|
||||||
|
|
|
@ -0,0 +1,129 @@
|
||||||
|
#-------------------------------------------------
|
||||||
|
#
|
||||||
|
# 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 +=
|
|
@ -0,0 +1,102 @@
|
||||||
|
<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>
|
|
@ -0,0 +1,10 @@
|
||||||
|
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;}
|
|
@ -0,0 +1 @@
|
||||||
|
<RCC/>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<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>
|
After Width: | Height: | Size: 1.6 KiB |
|
@ -0,0 +1,3 @@
|
||||||
|
<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>
|
After Width: | Height: | Size: 976 B |
After Width: | Height: | Size: 205 B |
After Width: | Height: | Size: 152 B |
After Width: | Height: | Size: 113 B |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 506 B |
|
@ -0,0 +1,23 @@
|
||||||
|
<?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>
|
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 406 B |
|
@ -0,0 +1 @@
|
||||||
|
<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>
|
After Width: | Height: | Size: 785 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 351 B |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 349 B |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 355 B |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 359 B |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 652 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 646 B |
After Width: | Height: | Size: 623 B |
After Width: | Height: | Size: 354 B |
After Width: | Height: | Size: 355 B |
After Width: | Height: | Size: 345 B |
After Width: | Height: | Size: 364 B |
After Width: | Height: | Size: 376 B |
After Width: | Height: | Size: 367 B |
After Width: | Height: | Size: 405 B |
After Width: | Height: | Size: 411 B |
After Width: | Height: | Size: 406 B |
After Width: | Height: | Size: 381 B |
After Width: | Height: | Size: 362 B |
After Width: | Height: | Size: 354 B |
After Width: | Height: | Size: 709 B |
After Width: | Height: | Size: 686 B |
After Width: | Height: | Size: 769 B |
After Width: | Height: | Size: 787 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 736 B |
After Width: | Height: | Size: 664 B |
After Width: | Height: | Size: 613 B |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 15 KiB |