Merge branch 'dbus-interface' of http://gitlab2.kylin.com/kylin-desktop/kylin-nm into 1115
This commit is contained in:
commit
14d1d130d2
|
@ -2,14 +2,15 @@
|
|||
#include <QDebug>
|
||||
|
||||
#define LABEL_RECT 17, 0, 105, 23
|
||||
#define CONTENTS_MARGINS 0, 0, 40, 0
|
||||
#define FRAME_MIN_SIZE 550, 0
|
||||
#define CONTENTS_MARGINS 0, 0, 0, 0
|
||||
#define FRAME_MIN_SIZE 550, 60
|
||||
#define FRAME_MAX_SIZE 16777215, 16777215
|
||||
#define CONTECT_FRAME_MAX_SIZE 16777215, 60
|
||||
#define LABLE_MIN_WIDTH 140
|
||||
#define COMBOBOX_MIN_WIDTH 600
|
||||
#define COMBOBOX_MIN_WIDTH 200
|
||||
#define LINE_MAX_SIZE 16777215, 1
|
||||
#define LINE_MIN_SIZE 0, 1
|
||||
#define LAYOUT_LEFT_MARGINS 8
|
||||
|
||||
#define WIRELESS 1
|
||||
|
||||
|
@ -59,11 +60,11 @@ MobileHotspotWidget::MobileHotspotWidget(QWidget *parent) : QWidget(parent)
|
|||
|
||||
m_hostName = getHostName();
|
||||
|
||||
initDbusConnect();
|
||||
|
||||
initInterfaceInfo();
|
||||
getApInfo();
|
||||
|
||||
initDbusConnect();
|
||||
|
||||
connect(m_switchBtn, &SwitchButton::checkedChanged, this, &MobileHotspotWidget::setUiEnabled);
|
||||
connect(m_interfaceComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [=]() {
|
||||
m_interfaceName = m_interfaceComboBox->currentText();
|
||||
|
@ -301,9 +302,18 @@ void MobileHotspotWidget::initInterfaceInfo()
|
|||
|
||||
void MobileHotspotWidget::getApInfo()
|
||||
{
|
||||
if(!m_interface->isValid()) {
|
||||
if (!m_interface->isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_interfaceComboBox->count() <= 0) {
|
||||
m_switchBtn->setChecked(false);
|
||||
setWidgetHidden(true);
|
||||
qWarning() << "getApInfo but interface is empty";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
QDBusReply<QStringList> reply = m_interface->call("getStoredApInfo");
|
||||
if (!reply.isValid()) {
|
||||
qDebug()<<"execute dbus method 'getStoredApInfo' is invalid in func getObjectPath()";
|
||||
|
@ -350,6 +360,7 @@ void MobileHotspotWidget::setSwitchFrame()
|
|||
m_switchLabel = new QLabel(tr("Open"), this);
|
||||
m_switchLabel->setMinimumWidth(LABLE_MIN_WIDTH);
|
||||
m_switchBtn = new SwitchButton(this, false);
|
||||
switchLayout->addSpacing(LAYOUT_LEFT_MARGINS);
|
||||
switchLayout->addWidget(m_switchLabel);
|
||||
switchLayout->addStretch();
|
||||
switchLayout->addWidget(m_switchBtn);
|
||||
|
@ -372,6 +383,7 @@ void MobileHotspotWidget::setApNameFrame()
|
|||
m_apNameLine = new QLineEdit(this);
|
||||
m_apNameLine->setMinimumWidth(COMBOBOX_MIN_WIDTH);
|
||||
m_apNameLine->setMaxLength(AP_NAME_MAX_LENGTH);
|
||||
apNameHLayout->addSpacing(LAYOUT_LEFT_MARGINS);
|
||||
apNameHLayout->addWidget(m_apNameLabel);
|
||||
apNameHLayout->addWidget(m_apNameLine);
|
||||
m_ApNameFrame->setLayout(apNameHLayout);
|
||||
|
@ -393,6 +405,7 @@ void MobileHotspotWidget::setPasswordFrame()
|
|||
m_pwdNameLine = new QLineEdit(this);
|
||||
m_pwdNameLine->setMinimumWidth(COMBOBOX_MIN_WIDTH);
|
||||
m_pwdNameLine->setEchoMode(QLineEdit::Password);
|
||||
passwordHLayout->addSpacing(LAYOUT_LEFT_MARGINS);
|
||||
passwordHLayout->addWidget(m_pwdLabel);
|
||||
passwordHLayout->addWidget(m_pwdNameLine);
|
||||
|
||||
|
@ -434,6 +447,7 @@ void MobileHotspotWidget::setFreqBandFrame()
|
|||
m_freqBandComboBox->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
|
||||
m_freqBandComboBox->addItem("2.4Ghz");
|
||||
m_freqBandComboBox->addItem("5Ghz");
|
||||
freqBandHLayout->addSpacing(LAYOUT_LEFT_MARGINS);
|
||||
freqBandHLayout->addWidget(m_freqBandLabel);
|
||||
freqBandHLayout->addWidget(m_freqBandComboBox);
|
||||
|
||||
|
@ -456,6 +470,7 @@ void MobileHotspotWidget::setInterFaceFrame()
|
|||
m_interfaceComboBox->setInsertPolicy(QComboBox::NoInsert);
|
||||
m_interfaceComboBox->setMinimumWidth(COMBOBOX_MIN_WIDTH);
|
||||
m_interfaceComboBox->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Fixed);
|
||||
interfaceHLayout->addSpacing(LAYOUT_LEFT_MARGINS);
|
||||
interfaceHLayout->addWidget(m_interfaceLabel);
|
||||
interfaceHLayout->addWidget(m_interfaceComboBox);
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ const QByteArray GSETTINGS_SCHEMA = "org.ukui.kylin-nm.switch";
|
|||
#define DEACTIVATING 3
|
||||
#define DEACTIVATED 4
|
||||
|
||||
#define NO_MARGINS 0,0,0,0
|
||||
#define MAIN_LAYOUT_MARGINS 0,0,0,8
|
||||
|
||||
bool sortByVal(const QPair<QString, int> &l, const QPair<QString, int> &r) {
|
||||
|
@ -166,6 +167,7 @@ void NetConnect::initComponent() {
|
|||
wiredSwitch = new SwitchButton(pluginWidget, false);
|
||||
ui->openWIifLayout->addWidget(wiredSwitch);
|
||||
ui->detailLayOut->setContentsMargins(MAIN_LAYOUT_MARGINS);
|
||||
ui->verticalLayout_3->setContentsMargins(NO_MARGINS);
|
||||
|
||||
connect(wiredSwitch, &SwitchButton::disabledClick, this, [=]() {
|
||||
showDesktopNotify(tr("No ethernet device avaliable"));
|
||||
|
|
|
@ -33,7 +33,10 @@
|
|||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>32</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="TitleLabel" name="titleLabel">
|
||||
|
|
|
@ -55,6 +55,7 @@ const QString NoNetSymbolic = ":/img/plugins/netconnect/nonet.svg";
|
|||
#define DEACTIVATING 3
|
||||
#define DEACTIVATED 4
|
||||
|
||||
#define NO_MARGINS 0,0,0,0
|
||||
#define MAIN_LAYOUT_MARGINS 0,0,0,8
|
||||
|
||||
bool intThan(int sign1, int sign2)
|
||||
|
@ -177,6 +178,7 @@ void WlanConnect::initComponent() {
|
|||
m_wifiSwitch = new SwitchButton(pluginWidget, false);
|
||||
ui->openWIifLayout->addWidget(m_wifiSwitch);
|
||||
ui->detailLayOut_3->setContentsMargins(MAIN_LAYOUT_MARGINS);
|
||||
ui->verticalLayout_3->setContentsMargins(NO_MARGINS);
|
||||
|
||||
connect(m_wifiSwitch, &SwitchButton::disabledClick, this, [=]() {
|
||||
showDesktopNotify(tr("No wireless network card detected"));
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>32</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="TitleLabel" name="titleLabel">
|
||||
|
|
|
@ -217,7 +217,7 @@ void WlanListItem::initWlanUI()
|
|||
|
||||
#define PWD_AREA_HEIGHT 36
|
||||
#define CONNECT_BUTTON_WIDTH 96
|
||||
#define FRAME_CONTENT_MARGINS 56,4,16,4
|
||||
#define FRAME_CONTENT_MARGINS 56,0,16,4
|
||||
#define FRAME_SPACING 8
|
||||
#define PWD_CONTENT_MARGINS 8,0,34,0
|
||||
#define SHOW_PWD_BUTTON_SIZE 24,24
|
||||
|
|
|
@ -96,6 +96,8 @@ void MainWindow::firstlyStart()
|
|||
});
|
||||
m_secondaryStartTimer->start(5 * 1000);
|
||||
|
||||
m_createPagePtrMap.clear();
|
||||
|
||||
//加载key ring
|
||||
agent_init();
|
||||
}
|
||||
|
@ -624,7 +626,21 @@ void MainWindow::showPropertyWidget(QString devName, QString ssid)
|
|||
void MainWindow::showCreateWiredConnectWidget(const QString devName)
|
||||
{
|
||||
qDebug() << "showCreateWiredConnectWidget! devName = " << devName;
|
||||
if (m_createPagePtrMap.contains(devName)) {
|
||||
if (m_createPagePtrMap[devName] != nullptr) {
|
||||
qDebug() << "showCreateWiredConnectWidget" << devName << "already create,just raise";
|
||||
|
||||
KWindowSystem::raiseWindow(m_createPagePtrMap[devName]->winId());
|
||||
return;
|
||||
}
|
||||
}
|
||||
NetDetail *netDetail = new NetDetail(devName, "", "", false, false, true, this);
|
||||
connect(netDetail, &NetDetail::createPageClose, [&](QString interfaceName){
|
||||
if (m_createPagePtrMap.contains(interfaceName)) {
|
||||
m_createPagePtrMap[interfaceName] = nullptr;
|
||||
}
|
||||
});
|
||||
m_createPagePtrMap.insert(devName, netDetail);
|
||||
netDetail->show();
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <QMenu>
|
||||
#include <QAction>
|
||||
#include <QDBusInterface>
|
||||
#include <QMap>
|
||||
#include "lanpage.h"
|
||||
#include "wlanpage.h"
|
||||
#include "netdetails/netdetail.h"
|
||||
|
@ -141,6 +142,8 @@ private:
|
|||
|
||||
IconActiveType iconStatus = IconActiveType::NOT_CONNECTED;
|
||||
|
||||
QMap<QString, NetDetail*> m_createPagePtrMap;
|
||||
|
||||
private slots:
|
||||
void onTrayIconActivated();
|
||||
void onShowMainwindowActionTriggled();
|
||||
|
|
|
@ -68,6 +68,7 @@ void Ipv4Page::initComponent() {
|
|||
connect(ipv4ConfigCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(configChanged(int)));
|
||||
|
||||
connect(ipv4ConfigCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(setEnableOfSaveBtn()));
|
||||
connect(ipv4addressEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||
connect(netMaskEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||
connect(gateWayEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||
connect(firstDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||
|
|
|
@ -143,6 +143,7 @@ void Ipv6Page::initComponent() {
|
|||
connect(ipv6ConfigCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(configChanged(int)));
|
||||
|
||||
connect(ipv6ConfigCombox, SIGNAL(currentIndexChanged(int)), this, SLOT(setEnableOfSaveBtn()));
|
||||
connect(ipv6AddressEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||
connect(lengthEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||
connect(gateWayEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||
connect(firstDnsEdit, SIGNAL(textChanged(QString)), this, SLOT(setEnableOfSaveBtn()));
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
#include "netdetail.h"
|
||||
#include "backend/kylinipv4arping.h"
|
||||
#include "backend/kylinipv6arping.h"
|
||||
#include "xatom/xatom-helper.h"
|
||||
//#include "xatom/xatom-helper.h"
|
||||
|
||||
#include <QEvent>
|
||||
|
||||
#define WINDOW_WIDTH 520
|
||||
#define WINDOW_HEIGHT 590
|
||||
|
@ -48,15 +50,15 @@ NetDetail::NetDetail(QString interface, QString name, QString uuid, bool isActiv
|
|||
QDialog(parent)
|
||||
{
|
||||
//设置窗口无边框,阴影
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
|
||||
MotifWmHints window_hints;
|
||||
window_hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
|
||||
window_hints.functions = MWM_FUNC_ALL;
|
||||
window_hints.decorations = MWM_DECOR_BORDER;
|
||||
XAtomHelper::getInstance()->setWindowMotifHint(this->winId(), window_hints);
|
||||
#else
|
||||
//#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
|
||||
// MotifWmHints window_hints;
|
||||
// window_hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
|
||||
// window_hints.functions = MWM_FUNC_ALL;
|
||||
// window_hints.decorations = MWM_DECOR_BORDER;
|
||||
// XAtomHelper::getInstance()->setWindowMotifHint(this->winId(), window_hints);
|
||||
//#else
|
||||
this->setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint);
|
||||
#endif
|
||||
//#endif
|
||||
// this->setProperty("useStyleWindowManager", false); //禁用拖动
|
||||
// setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint );
|
||||
// setAttribute(Qt::WA_TranslucentBackground);
|
||||
|
@ -120,6 +122,7 @@ void NetDetail::paintEvent(QPaintEvent *event)
|
|||
void NetDetail::closeEvent(QCloseEvent *event)
|
||||
{
|
||||
emit this->detailPageClose(false);
|
||||
emit this->createPageClose(m_deviceName);
|
||||
return QDialog::closeEvent(event);
|
||||
}
|
||||
|
||||
|
@ -145,6 +148,12 @@ void NetDetail::initUI()
|
|||
securityPage = new SecurityPage(this);
|
||||
createNetPage = new CreatNetPage(this);
|
||||
|
||||
detailPage->installEventFilter(this);
|
||||
ipv4Page->installEventFilter(this);
|
||||
ipv6Page->installEventFilter(this);
|
||||
securityPage->installEventFilter(this);
|
||||
createNetPage->installEventFilter(this);
|
||||
|
||||
titleWidget = new QWidget(this);
|
||||
centerWidget = new QWidget(this);
|
||||
bottomWidget = new QWidget(this);
|
||||
|
@ -917,3 +926,19 @@ bool NetDetail::checkWirelessSecurity(KySecuType secuType)
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool NetDetail::eventFilter(QObject *w, QEvent *event)
|
||||
{
|
||||
// 回车键触发确定按钮点击事件
|
||||
if (event->type() == QEvent::KeyPress) {
|
||||
QKeyEvent *mEvent = static_cast<QKeyEvent *>(event);
|
||||
if (mEvent->key() == Qt::Key_Enter || mEvent->key() == Qt::Key_Return) {
|
||||
if (confimBtn->isEnabled()) {
|
||||
emit confimBtn->clicked();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
return QDialog::eventFilter(w, event);
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@ public:
|
|||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void closeEvent(QCloseEvent *event);
|
||||
bool eventFilter(QObject *w, QEvent *event);
|
||||
|
||||
private:
|
||||
void initUI();
|
||||
|
@ -135,5 +136,6 @@ private slots:
|
|||
|
||||
signals:
|
||||
void detailPageClose(bool on);
|
||||
void createPageClose(QString);
|
||||
};
|
||||
#endif // NETDETAIL_H
|
||||
|
|
|
@ -34,6 +34,9 @@ LanPage::LanPage(QWidget *parent) : TabPage(parent)
|
|||
initLanArea();
|
||||
|
||||
connect(m_activeResourse, &KyActiveConnectResourse::stateChangeReason, this, &LanPage::onConnectionStateChange);
|
||||
connect(m_activeResourse, &KyActiveConnectResourse::activeConnectRemove, this, [=] (QString activeConnectUuid) {
|
||||
sendLanStateChangeSignal(activeConnectUuid,Deactivated);
|
||||
} );
|
||||
|
||||
connect(m_connectResourse, &KyConnectResourse::connectionAdd, this, &LanPage::onAddConnection);
|
||||
connect(m_connectResourse, &KyConnectResourse::connectionRemove, this, &LanPage::onRemoveConnection);
|
||||
|
|
|
@ -11,8 +11,10 @@ Divider::Divider(QWidget * parent) : QFrame(parent)
|
|||
void Divider::paintEvent(QPaintEvent * e)
|
||||
{
|
||||
QPainter p(this);
|
||||
QColor color;
|
||||
color.setRgb(77,77,77);
|
||||
p.save();
|
||||
p.setBrush(this->palette().color(QPalette::Text));
|
||||
p.setBrush(color);
|
||||
p.setPen(Qt::transparent);
|
||||
p.setOpacity(0.3);
|
||||
p.drawRoundedRect(this->rect(), 6, 6);
|
||||
|
|
Loading…
Reference in New Issue