plugin无线新增加入其它网络功能
This commit is contained in:
parent
e07c63a966
commit
552820bd6e
|
@ -8,7 +8,7 @@
|
|||
|
||||
#define RADIUS 6.0
|
||||
|
||||
AddNetBtn::AddNetBtn(QWidget *parent) : QPushButton(parent)
|
||||
AddNetBtn::AddNetBtn(bool isWlan, QWidget *parent) : QPushButton(parent)
|
||||
{
|
||||
this->setObjectName("this");
|
||||
this->setMinimumSize(QSize(580, 60));
|
||||
|
@ -18,16 +18,24 @@ AddNetBtn::AddNetBtn(QWidget *parent) : QPushButton(parent)
|
|||
QHBoxLayout *addLyt = new QHBoxLayout;
|
||||
|
||||
QLabel *iconLabel = new QLabel();
|
||||
QLabel *textLabel = new QLabel(tr("Add WiredNetork"));
|
||||
QLabel *textLabel = new QLabel();
|
||||
|
||||
QIcon mAddIcon = QIcon::fromTheme("list-add-symbolic");
|
||||
iconLabel->setPixmap(mAddIcon.pixmap(mAddIcon.actualSize(QSize(24, 24))));
|
||||
iconLabel->setProperty("useIconHighlightEffect", true);
|
||||
iconLabel->setProperty("iconHighlightEffectMode", 1);
|
||||
if (isWlan) {
|
||||
textLabel->setText(tr("Add Others"));
|
||||
addLyt->addSpacing(8);
|
||||
addLyt->addWidget(textLabel);
|
||||
} else {
|
||||
textLabel->setText(tr("Add WiredNetork"));
|
||||
QIcon mAddIcon = QIcon::fromTheme("list-add-symbolic");
|
||||
iconLabel->setPixmap(mAddIcon.pixmap(mAddIcon.actualSize(QSize(24, 24))));
|
||||
iconLabel->setProperty("useIconHighlightEffect", true);
|
||||
iconLabel->setProperty("iconHighlightEffectMode", 1);
|
||||
|
||||
addLyt->addStretch();
|
||||
addLyt->addWidget(iconLabel);
|
||||
addLyt->addWidget(textLabel);
|
||||
}
|
||||
|
||||
addLyt->addStretch();
|
||||
addLyt->addWidget(iconLabel);
|
||||
addLyt->addWidget(textLabel);
|
||||
addLyt->addStretch();
|
||||
this->setLayout(addLyt);
|
||||
|
|
@ -11,7 +11,7 @@ class AddNetBtn : public QPushButton
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AddNetBtn(QWidget *parent = nullptr);
|
||||
AddNetBtn(bool isWlan, QWidget *parent = nullptr);
|
||||
~AddNetBtn();
|
||||
|
||||
protected:
|
|
@ -0,0 +1,9 @@
|
|||
#LIBINTERFACE_NAME = $$qtLibraryTarget(addnetbtn)
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/AddBtn/addnetbtn.cpp \
|
||||
|
||||
HEADERS += \
|
||||
$$PWD/AddBtn/addnetbtn.h \
|
||||
|
||||
|
|
@ -15,7 +15,7 @@ ItemFrame::ItemFrame(QString devName, QWidget *parent) : QFrame(parent)
|
|||
lanItemLayout = new QVBoxLayout(this);
|
||||
lanItemLayout->setContentsMargins(LAYOUT_MARGINS);
|
||||
lanItemLayout->setSpacing(1);
|
||||
addLanWidget = new AddNetBtn(this);
|
||||
addLanWidget = new AddNetBtn(false, this);
|
||||
|
||||
deviceLanLayout->setSpacing(1);
|
||||
setLayout(deviceLanLayout);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include <QVBoxLayout>
|
||||
#include "deviceframe.h"
|
||||
#include <addbtn.h>
|
||||
#include "addnetbtn.h"
|
||||
#include "../component/AddBtn/addnetbtn.h"
|
||||
#include "lanitem.h"
|
||||
|
||||
class ItemFrame : public QFrame
|
||||
|
|
|
@ -3,6 +3,7 @@ TEMPLATE = lib
|
|||
CONFIG += plugin
|
||||
|
||||
include(../component/drownlabel.pri)
|
||||
include(../component/addbtn.pri)
|
||||
|
||||
TARGET = $$qtLibraryTarget(netconnect)
|
||||
DESTDIR = ../..
|
||||
|
@ -27,7 +28,6 @@ PKGCONFIG += gsettings-qt \
|
|||
#DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
SOURCES += \
|
||||
addnetbtn.cpp \
|
||||
deviceframe.cpp \
|
||||
# drownlabel.cpp \
|
||||
itemframe.cpp \
|
||||
|
@ -35,7 +35,6 @@ SOURCES += \
|
|||
netconnect.cpp
|
||||
|
||||
HEADERS += \
|
||||
addnetbtn.h \
|
||||
deviceframe.h \
|
||||
# drownlabel.h \
|
||||
itemframe.h \
|
||||
|
|
|
@ -14,6 +14,7 @@ ItemFrame::ItemFrame(QString devName, QWidget *parent)
|
|||
lanItemLayout = new QVBoxLayout(this);
|
||||
lanItemLayout->setContentsMargins(LAYOUT_MARGINS);
|
||||
lanItemLayout->setSpacing(1);
|
||||
addWlanWidget = new AddNetBtn(true, this);
|
||||
|
||||
deviceLanLayout->setSpacing(1);
|
||||
setLayout(deviceLanLayout);
|
||||
|
@ -22,6 +23,7 @@ ItemFrame::ItemFrame(QString devName, QWidget *parent)
|
|||
deviceFrame = new DeviceFrame(devName, this);
|
||||
deviceLanLayout->addWidget(deviceFrame);
|
||||
deviceLanLayout->addWidget(lanItemFrame);
|
||||
deviceLanLayout->addWidget(addWlanWidget);
|
||||
|
||||
//下拉按钮
|
||||
connect(deviceFrame->dropDownLabel, &DrownLabel::labelClicked, this, &ItemFrame::onDrownLabelClicked);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <QFrame>
|
||||
#include <QVBoxLayout>
|
||||
#include "deviceframe.h"
|
||||
#include "../component/AddBtn/addnetbtn.h"
|
||||
#include "wlanitem.h"
|
||||
|
||||
class ItemFrame : public QFrame
|
||||
|
@ -23,7 +24,8 @@ public:
|
|||
QMap<QString, WlanItem *> itemMap;
|
||||
//已激活uuid
|
||||
QString uuid = "";
|
||||
|
||||
//新建无线连接
|
||||
AddNetBtn * addWlanWidget = nullptr;
|
||||
void filletStyleChange();
|
||||
|
||||
private slots:
|
||||
|
|
|
@ -1,58 +1,71 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1">
|
||||
<context>
|
||||
<name>AddNetBtn</name>
|
||||
<message>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="24"/>
|
||||
<source>Add Others</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="27"/>
|
||||
<source>Add WiredNetork</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WlanConnect</name>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="14"/>
|
||||
<location filename="../wlanconnect.cpp" line="97"/>
|
||||
<location filename="../wlanconnect.cpp" line="140"/>
|
||||
<source>WlanConnect</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="35"/>
|
||||
<location filename="../wlanconnect.cpp" line="168"/>
|
||||
<location filename="../wlanconnect.cpp" line="211"/>
|
||||
<source>WLAN</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="94"/>
|
||||
<location filename="../wlanconnect.cpp" line="170"/>
|
||||
<location filename="../wlanconnect.cpp" line="213"/>
|
||||
<source>open</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<extra-contents_path>/wlanconnect/open</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="147"/>
|
||||
<location filename="../wlanconnect.cpp" line="167"/>
|
||||
<location filename="../wlanconnect.cpp" line="210"/>
|
||||
<source>Advanced settings</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<extra-contents_path>/wlanconnect/Advanced settings"</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="80"/>
|
||||
<location filename="../wlanconnect.cpp" line="123"/>
|
||||
<source>ukui control center</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="83"/>
|
||||
<location filename="../wlanconnect.cpp" line="126"/>
|
||||
<source>ukui control center desktop message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="192"/>
|
||||
<location filename="../wlanconnect.cpp" line="228"/>
|
||||
<source>No wireless network card detected</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="330"/>
|
||||
<location filename="../wlanconnect.cpp" line="933"/>
|
||||
<location filename="../wlanconnect.cpp" line="995"/>
|
||||
<location filename="../wlanconnect.cpp" line="374"/>
|
||||
<location filename="../wlanconnect.cpp" line="1022"/>
|
||||
<location filename="../wlanconnect.cpp" line="1084"/>
|
||||
<source>connected</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="879"/>
|
||||
<location filename="../wlanconnect.cpp" line="959"/>
|
||||
<source>card</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
|
@ -1,58 +1,71 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1">
|
||||
<context>
|
||||
<name>AddNetBtn</name>
|
||||
<message>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="24"/>
|
||||
<source>Add Others</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="27"/>
|
||||
<source>Add WiredNetork</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WlanConnect</name>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="14"/>
|
||||
<location filename="../wlanconnect.cpp" line="97"/>
|
||||
<location filename="../wlanconnect.cpp" line="140"/>
|
||||
<source>WlanConnect</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="35"/>
|
||||
<location filename="../wlanconnect.cpp" line="168"/>
|
||||
<location filename="../wlanconnect.cpp" line="211"/>
|
||||
<source>WLAN</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="94"/>
|
||||
<location filename="../wlanconnect.cpp" line="170"/>
|
||||
<location filename="../wlanconnect.cpp" line="213"/>
|
||||
<source>open</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<extra-contents_path>/wlanconnect/open</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="147"/>
|
||||
<location filename="../wlanconnect.cpp" line="167"/>
|
||||
<location filename="../wlanconnect.cpp" line="210"/>
|
||||
<source>Advanced settings</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<extra-contents_path>/wlanconnect/Advanced settings"</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="80"/>
|
||||
<location filename="../wlanconnect.cpp" line="123"/>
|
||||
<source>ukui control center</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="83"/>
|
||||
<location filename="../wlanconnect.cpp" line="126"/>
|
||||
<source>ukui control center desktop message</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="192"/>
|
||||
<location filename="../wlanconnect.cpp" line="228"/>
|
||||
<source>No wireless network card detected</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="330"/>
|
||||
<location filename="../wlanconnect.cpp" line="933"/>
|
||||
<location filename="../wlanconnect.cpp" line="995"/>
|
||||
<location filename="../wlanconnect.cpp" line="374"/>
|
||||
<location filename="../wlanconnect.cpp" line="1022"/>
|
||||
<location filename="../wlanconnect.cpp" line="1084"/>
|
||||
<source>connected</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="879"/>
|
||||
<location filename="../wlanconnect.cpp" line="959"/>
|
||||
<source>card</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
|
|
Binary file not shown.
|
@ -1,58 +1,71 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE TS>
|
||||
<TS version="2.1" language="zh_CN">
|
||||
<context>
|
||||
<name>AddNetBtn</name>
|
||||
<message>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="24"/>
|
||||
<source>Add Others</source>
|
||||
<translation>加入其它网络</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../component/AddBtn/addnetbtn.cpp" line="27"/>
|
||||
<source>Add WiredNetork</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>WlanConnect</name>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="14"/>
|
||||
<location filename="../wlanconnect.cpp" line="97"/>
|
||||
<location filename="../wlanconnect.cpp" line="140"/>
|
||||
<source>WlanConnect</source>
|
||||
<translation>无线局域网</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="35"/>
|
||||
<location filename="../wlanconnect.cpp" line="168"/>
|
||||
<location filename="../wlanconnect.cpp" line="211"/>
|
||||
<source>WLAN</source>
|
||||
<translation>无线局域网</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="94"/>
|
||||
<location filename="../wlanconnect.cpp" line="170"/>
|
||||
<location filename="../wlanconnect.cpp" line="213"/>
|
||||
<source>open</source>
|
||||
<translation>开启</translation>
|
||||
<extra-contents_path>/wlanconnect/open</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.ui" line="147"/>
|
||||
<location filename="../wlanconnect.cpp" line="167"/>
|
||||
<location filename="../wlanconnect.cpp" line="210"/>
|
||||
<source>Advanced settings</source>
|
||||
<translation>高级设置</translation>
|
||||
<extra-contents_path>/wlanconnect/Advanced settings"</extra-contents_path>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="80"/>
|
||||
<location filename="../wlanconnect.cpp" line="123"/>
|
||||
<source>ukui control center</source>
|
||||
<translation>控制面板</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="83"/>
|
||||
<location filename="../wlanconnect.cpp" line="126"/>
|
||||
<source>ukui control center desktop message</source>
|
||||
<translation>控制面板桌面通知</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="192"/>
|
||||
<location filename="../wlanconnect.cpp" line="228"/>
|
||||
<source>No wireless network card detected</source>
|
||||
<translation>未检测到无线网卡</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="330"/>
|
||||
<location filename="../wlanconnect.cpp" line="933"/>
|
||||
<location filename="../wlanconnect.cpp" line="995"/>
|
||||
<location filename="../wlanconnect.cpp" line="374"/>
|
||||
<location filename="../wlanconnect.cpp" line="1022"/>
|
||||
<location filename="../wlanconnect.cpp" line="1084"/>
|
||||
<source>connected</source>
|
||||
<translation>已连接</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../wlanconnect.cpp" line="879"/>
|
||||
<location filename="../wlanconnect.cpp" line="959"/>
|
||||
<source>card</source>
|
||||
<translation>网卡</translation>
|
||||
</message>
|
||||
|
|
|
@ -958,6 +958,15 @@ void WlanConnect::addDeviceFrame(QString devName)
|
|||
ui->availableLayout->addWidget(itemFrame);
|
||||
itemFrame->deviceFrame->deviceLabel->setText(tr("card")+/*QString("%1").arg(count)+*/":"+devName);
|
||||
deviceFrameMap.insert(devName, itemFrame);
|
||||
|
||||
connect(itemFrame->addWlanWidget, &AddNetBtn::clicked, this, [=](){
|
||||
if (m_interface->isValid()) {
|
||||
qDebug() << "[NetConnect]call showAddOtherWlanWidget" << devName << __LINE__;
|
||||
m_interface->call(QStringLiteral("showAddOtherWlanWidget"), devName);
|
||||
qDebug() << "[NetConnect]call setDeviceEnable Respond" << __LINE__;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//减少设备
|
||||
|
|
|
@ -3,6 +3,7 @@ TEMPLATE = lib
|
|||
CONFIG += plugin
|
||||
|
||||
include(../component/drownlabel.pri)
|
||||
include(../component/addbtn.pri)
|
||||
|
||||
TARGET = $$qtLibraryTarget(wlanconnect)
|
||||
DESTDIR = ../..
|
||||
|
|
|
@ -77,6 +77,8 @@ void WlanItem::paintEvent(QPaintEvent *event)
|
|||
painter.setBrush(pal.color(QPalette::Base));
|
||||
|
||||
QRect rect = this->rect();
|
||||
|
||||
#if 0
|
||||
if (!useHalfFillet) {
|
||||
painter.drawRect(rect);
|
||||
} else {
|
||||
|
@ -96,5 +98,8 @@ void WlanItem::paintEvent(QPaintEvent *event)
|
|||
path.lineTo(rect.topLeft());
|
||||
painter.drawPath(path);
|
||||
}
|
||||
#endif
|
||||
|
||||
painter.drawRect(rect);
|
||||
QPushButton::paintEvent(event);
|
||||
}
|
||||
|
|
|
@ -199,6 +199,13 @@ void DbusAdaptor::showCreateWiredConnectWidget(QString devName)
|
|||
parent()->showCreateWiredConnectWidget(devName);
|
||||
}
|
||||
|
||||
//唤起加入其他无线网络界面
|
||||
void DbusAdaptor::showAddOtherWlanWidget(QString devName)
|
||||
{
|
||||
qDebug() << "showAddOtherWlanWidget";
|
||||
parent()->showAddOtherWlanWidget(devName);
|
||||
}
|
||||
|
||||
//开启热点
|
||||
void DbusAdaptor::activeWirelessAp(const QString apName, const QString apPassword, const QString band, const QString apDevice)
|
||||
{
|
||||
|
|
|
@ -74,6 +74,8 @@ public Q_SLOTS: // METHODS
|
|||
Q_NOREPLY void showPropertyWidget(QString devName, QString ssid);
|
||||
//唤起新建有线连接界面
|
||||
Q_NOREPLY void showCreateWiredConnectWidget(QString devName);
|
||||
//唤起加入其他无线网络界面
|
||||
Q_NOREPLY void showAddOtherWlanWidget(QString devName);
|
||||
//开启热点
|
||||
void activeWirelessAp(const QString apName, const QString apPassword, const QString band, const QString apDevice);
|
||||
//断开热点
|
||||
|
|
|
@ -748,6 +748,28 @@ void MainWindow::showCreateWiredConnectWidget(const QString devName)
|
|||
netDetail->show();
|
||||
}
|
||||
|
||||
void MainWindow::showAddOtherWlanWidget(QString devName)
|
||||
{
|
||||
qDebug() << "showAddOtherWlanWidget! devName = " << devName;
|
||||
if (m_addOtherPagePtrMap.contains(devName)) {
|
||||
if (m_addOtherPagePtrMap[devName] != nullptr) {
|
||||
qDebug() << "showAddOtherWlanWidget" << devName << "already create,just raise";
|
||||
|
||||
KWindowSystem::raiseWindow(m_addOtherPagePtrMap[devName]->winId());
|
||||
return;
|
||||
}
|
||||
}
|
||||
NetDetail *netDetail = new NetDetail(devName, "", "", false, true, true, this);
|
||||
connect(netDetail, &NetDetail::createPageClose, [&](QString interfaceName){
|
||||
if (m_addOtherPagePtrMap.contains(interfaceName)) {
|
||||
m_addOtherPagePtrMap[interfaceName] = nullptr;
|
||||
}
|
||||
});
|
||||
m_addOtherPagePtrMap.insert(devName, netDetail);
|
||||
netDetail->show();
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::getWirelessDeviceCap(QMap<QString, int> &map)
|
||||
{
|
||||
m_wlanWidget->getWirelessDeviceCap(map);
|
||||
|
|
|
@ -70,6 +70,8 @@ public:
|
|||
void showPropertyWidget(QString devName, QString ssid);
|
||||
//唤起新建有线连接界面
|
||||
void showCreateWiredConnectWidget(const QString devName);
|
||||
//唤起加入其他无线网络界面
|
||||
void showAddOtherWlanWidget(QString devName);
|
||||
|
||||
void getWirelessDeviceCap(QMap<QString, int> &map);
|
||||
|
||||
|
@ -162,6 +164,7 @@ private:
|
|||
IconActiveType iconStatus = IconActiveType::NOT_CONNECTED;
|
||||
|
||||
QMap<QString, NetDetail*> m_createPagePtrMap;
|
||||
QMap<QString, NetDetail*> m_addOtherPagePtrMap;
|
||||
|
||||
public slots:
|
||||
void onShowMainWindow(int type);
|
||||
|
|
Loading…
Reference in New Issue