Merge branch 'dbus-interface' of http://gitlab2.kylin.com/kylin-desktop/kylin-nm into up-dbus
This commit is contained in:
commit
2f8f8a9e4a
|
@ -156,16 +156,16 @@ void WlanListItem::refreshIcon()
|
||||||
switch (m_data->m_signalStrength / STEP + 1) {
|
switch (m_data->m_signalStrength / STEP + 1) {
|
||||||
case FULL_SIGNAL:
|
case FULL_SIGNAL:
|
||||||
case EXCELLENT_SIGNAL:
|
case EXCELLENT_SIGNAL:
|
||||||
m_netButton->setIcon(QIcon::fromTheme("network-wireless-signal-excellent-symbolic", QIcon(":/res/w/wifi-full.png")));
|
m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-excellent-symbolic", QIcon(":/res/w/wifi-full.png")));
|
||||||
break;
|
break;
|
||||||
case GOOD_SIGNAL:
|
case GOOD_SIGNAL:
|
||||||
m_netButton->setIcon(QIcon::fromTheme("network-wireless-signal-good-symbolic", QIcon(":/res/w/wifi-high.png")));
|
m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-good-symbolic", QIcon(":/res/w/wifi-high.png")));
|
||||||
break;
|
break;
|
||||||
case OK_SIGNAL:
|
case OK_SIGNAL:
|
||||||
m_netButton->setIcon(QIcon::fromTheme("network-wireless-signal-ok", QIcon(":/res/w/wifi-medium.png")));
|
m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-ok", QIcon(":/res/w/wifi-medium.png")));
|
||||||
break;
|
break;
|
||||||
case LOW_SIGNAL:
|
case LOW_SIGNAL:
|
||||||
m_netButton->setIcon(QIcon::fromTheme("network-wireless-signal-low", QIcon(":/res/w/wifi-low.png")));
|
m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-low", QIcon(":/res/w/wifi-low.png")));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qDebug() << "Set wlan(without passwd) icon failed, signal = " << m_data->m_signalStrength << Q_FUNC_INFO << __LINE__;
|
qDebug() << "Set wlan(without passwd) icon failed, signal = " << m_data->m_signalStrength << Q_FUNC_INFO << __LINE__;
|
||||||
|
@ -176,16 +176,16 @@ void WlanListItem::refreshIcon()
|
||||||
switch (m_data->m_signalStrength / STEP + 1) {
|
switch (m_data->m_signalStrength / STEP + 1) {
|
||||||
case FULL_SIGNAL:
|
case FULL_SIGNAL:
|
||||||
case EXCELLENT_SIGNAL:
|
case EXCELLENT_SIGNAL:
|
||||||
m_netButton->setIcon(QIcon::fromTheme("network-wireless-signal-excellent-secure-symbolic", QIcon(":/res/w/wifi-full-pwd.png")));
|
m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-excellent-secure-symbolic", QIcon(":/res/w/wifi-full-pwd.png")));
|
||||||
break;
|
break;
|
||||||
case GOOD_SIGNAL:
|
case GOOD_SIGNAL:
|
||||||
m_netButton->setIcon(QIcon::fromTheme("network-wireless-signal-good-secure-symbolic", QIcon(":/res/w/wifi-high-pwd.png")));
|
m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-good-secure-symbolic", QIcon(":/res/w/wifi-high-pwd.png")));
|
||||||
break;
|
break;
|
||||||
case OK_SIGNAL:
|
case OK_SIGNAL:
|
||||||
m_netButton->setIcon(QIcon::fromTheme("network-wireless-signal-ok-secure-symbolic", QIcon(":/res/w/wifi-medium-pwd.png")));
|
m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-ok-secure-symbolic", QIcon(":/res/w/wifi-medium-pwd.png")));
|
||||||
break;
|
break;
|
||||||
case LOW_SIGNAL:
|
case LOW_SIGNAL:
|
||||||
m_netButton->setIcon(QIcon::fromTheme("network-wireless-signal-low-secure-symbolic", QIcon(":/res/w/wifi-low-pwd.png")));
|
m_netButton->setButtonIcon(QIcon::fromTheme("network-wireless-signal-low-secure-symbolic", QIcon(":/res/w/wifi-low-pwd.png")));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
qDebug() << "Set wlan(with passwd) icon failed, signal = " << m_data->m_signalStrength << Q_FUNC_INFO << __LINE__;
|
qDebug() << "Set wlan(with passwd) icon failed, signal = " << m_data->m_signalStrength << Q_FUNC_INFO << __LINE__;
|
||||||
|
@ -237,6 +237,7 @@ void WlanListItem::onNetButtonClicked()
|
||||||
|
|
||||||
if (m_data->m_isConfigured) {
|
if (m_data->m_isConfigured) {
|
||||||
m_connoperation->activeWirelessConnect(m_wlanDevice,m_data->m_connectUuid);
|
m_connoperation->activeWirelessConnect(m_wlanDevice,m_data->m_connectUuid);
|
||||||
|
// m_netButton->startLoading();
|
||||||
qDebug()<<"Has configuration, will be activated. ssid = " << m_data->m_NetSsid << Q_FUNC_INFO << __LINE__;
|
qDebug()<<"Has configuration, will be activated. ssid = " << m_data->m_NetSsid << Q_FUNC_INFO << __LINE__;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ void WlanPage::initWlanUI()
|
||||||
{
|
{
|
||||||
m_titleLabel->setText(tr("WLAN"));
|
m_titleLabel->setText(tr("WLAN"));
|
||||||
m_activatedNetLabel->setText(tr("Activated WLAN"));
|
m_activatedNetLabel->setText(tr("Activated WLAN"));
|
||||||
m_inactivatedNetLabel->setText(tr("Inactivated WLAN"));
|
m_inactivatedNetLabel->setText(tr("Other WLAN"));
|
||||||
|
|
||||||
//一些独有控件
|
//一些独有控件
|
||||||
m_inactivatedWlanListAreaCentralWidget = new QFrame(m_inactivatedNetListArea);
|
m_inactivatedWlanListAreaCentralWidget = new QFrame(m_inactivatedNetListArea);
|
||||||
|
|
|
@ -53,3 +53,9 @@ bool InfoButton::eventFilter(QObject *w, QEvent *e)
|
||||||
}
|
}
|
||||||
return QPushButton::eventFilter(w, e);
|
return QPushButton::eventFilter(w, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InfoButton::paintEvent(QPaintEvent *event)
|
||||||
|
{
|
||||||
|
|
||||||
|
return QPushButton::paintEvent(event);
|
||||||
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ protected:
|
||||||
virtual void enterEvent(QEvent *event) override;
|
virtual void enterEvent(QEvent *event) override;
|
||||||
virtual void leaveEvent(QEvent *event);
|
virtual void leaveEvent(QEvent *event);
|
||||||
bool eventFilter(QObject *watched, QEvent *event);
|
bool eventFilter(QObject *watched, QEvent *event);
|
||||||
|
void paintEvent(QPaintEvent *event);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INFOBUTTON_H
|
#endif // INFOBUTTON_H
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#include "radioitembutton.h"
|
#include "radioitembutton.h"
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QStyle>
|
||||||
#define BUTTON_SIZE 32,32
|
#define BUTTON_SIZE 32,32
|
||||||
|
#define ICON_SIZE 16,16
|
||||||
|
|
||||||
RadioItemButton::RadioItemButton(bool isActivated, QWidget *parent) : QPushButton(parent)
|
RadioItemButton::RadioItemButton(bool isActivated, QWidget *parent) : QPushButton(parent)
|
||||||
{
|
{
|
||||||
|
@ -8,8 +11,14 @@ RadioItemButton::RadioItemButton(bool isActivated, QWidget *parent) : QPushButto
|
||||||
m_isActivated = isActivated;
|
m_isActivated = isActivated;
|
||||||
this->setAutoFillBackground(false);
|
this->setAutoFillBackground(false);
|
||||||
m_iconLabel = new QLabel(this);
|
m_iconLabel = new QLabel(this);
|
||||||
m_iconLabel->setScaledContents(true);
|
|
||||||
this->setFixedSize(BUTTON_SIZE);
|
this->setFixedSize(BUTTON_SIZE);
|
||||||
|
m_iconLabel->setFixedSize(BUTTON_SIZE);
|
||||||
|
m_iconLabel->setAlignment(Qt::AlignCenter);
|
||||||
|
|
||||||
|
//JXJ_TODO loading动画
|
||||||
|
// switchTimer = new QTimer(this);
|
||||||
|
// connect(switchTimer, &QTimer::timeout, this, &RadioItemButton::onLoadingStarted);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadioItemButton::startLoading()
|
void RadioItemButton::startLoading()
|
||||||
|
@ -38,20 +47,71 @@ void RadioItemButton::setReleased()
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadioItemButton::setButtonIcon(QIcon *icon)
|
void RadioItemButton::setButtonIcon(const QIcon &icon)
|
||||||
{
|
{
|
||||||
if (!icon) {
|
if (icon.isNull()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//ZJP_TODO 绘制圆形按钮
|
//ZJP_TODO 绘制圆形按钮
|
||||||
m_iconLabel->setPixmap(icon->pixmap(this->size()));
|
m_iconLabel->setPixmap(icon.pixmap(ICON_SIZE));
|
||||||
}
|
}
|
||||||
void RadioItemButton::onLoadingStarted()
|
void RadioItemButton::onLoadingStarted()
|
||||||
{
|
{
|
||||||
|
//ZJP_TODO 开始播放转圈动画
|
||||||
|
// switchTimer->start(FRAMESPEED);
|
||||||
|
// QString qpmQss = ":/res/s/conning-b/";
|
||||||
|
// qpmQss.append(QString::number(this->currentPage));
|
||||||
|
// qpmQss.append(".png");
|
||||||
|
// m_iconLabel->setPixmap(QPixmap(qpmQss));
|
||||||
|
//// m_iconLabel->setProperty("useIconHighlightEffect", true);
|
||||||
|
//// m_iconLabel->setProperty("iconHighlightEffectMode", true);
|
||||||
|
|
||||||
|
// this->currentPage --;
|
||||||
|
|
||||||
|
// if (this->currentPage < 1) {
|
||||||
|
// this->currentPage = 12; //循环播放
|
||||||
|
// }
|
||||||
|
// this->countCurrentTime += FRAMESPEED;
|
||||||
|
// //达到一定的时间退出。应该是收到连接成功或者失败的信号断开
|
||||||
|
// if (this->countCurrentTime >= ALLTIME) {
|
||||||
|
// emit this->onLoadingStopped();
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadioItemButton::onLoadingStopped()
|
void RadioItemButton::onLoadingStopped()
|
||||||
{
|
{
|
||||||
//ZJP_TODO 停止播放转圈动画
|
//ZJP_TODO 停止播放转圈动画
|
||||||
|
this->switchTimer->stop();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void RadioItemButton::paintEvent(QPaintEvent *event)
|
||||||
|
{
|
||||||
|
QPalette pal = this->palette();
|
||||||
|
pal.setColor(QPalette::Base, QColor(0,0,0,0));
|
||||||
|
pal.setColor(QPalette::Text, QColor(230,230,230,255));
|
||||||
|
|
||||||
|
QPainterPath cPath;
|
||||||
|
cPath.addRect(0, 0, this->width(), this->height());
|
||||||
|
cPath.addEllipse(0, 0, this->width(), this->width());
|
||||||
|
|
||||||
|
QPainterPath innerPath;
|
||||||
|
innerPath.addEllipse(0, 0, this->width(), this->width());
|
||||||
|
|
||||||
|
QPainter painter(this);
|
||||||
|
painter.setRenderHint(QPainter:: Antialiasing, true); //设置渲染,启动反锯齿
|
||||||
|
painter.setPen(Qt::NoPen);
|
||||||
|
|
||||||
|
painter.setBrush(pal.color(QPalette::Base));
|
||||||
|
painter.drawPath(cPath);
|
||||||
|
|
||||||
|
painter.fillPath(innerPath, pal.color(QPalette::Text));
|
||||||
|
|
||||||
|
// QRect iconRect;
|
||||||
|
// iconRect = this->rect();
|
||||||
|
// iconRect.adjust(8,8,-8,-8);
|
||||||
|
// QPixmap pixmap = this->icon().pixmap(32,32);
|
||||||
|
// painter.drawPixmap(iconRect, pixmap);
|
||||||
|
|
||||||
|
// return QPushButton::paintEvent(event);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include<QTimer>
|
||||||
#define ACTIVATED true
|
#define ACTIVATED true
|
||||||
#define INACTIVATED false
|
#define INACTIVATED false
|
||||||
|
|
||||||
|
@ -16,15 +17,20 @@ public:
|
||||||
void stopLoading();
|
void stopLoading();
|
||||||
void setPressed();
|
void setPressed();
|
||||||
void setReleased();
|
void setReleased();
|
||||||
void setButtonIcon(QIcon *);
|
void setButtonIcon(const QIcon &icon);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void requestStartLoading();
|
void requestStartLoading();
|
||||||
void requestStopLoading();
|
void requestStopLoading();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void paintEvent(QPaintEvent *event);
|
||||||
bool m_isActivated = INACTIVATED;
|
bool m_isActivated = INACTIVATED;
|
||||||
QLabel * m_iconLabel = nullptr;
|
QLabel * m_iconLabel = nullptr;
|
||||||
|
QTimer * switchTimer = nullptr;
|
||||||
|
|
||||||
|
int currentPage;
|
||||||
|
int countCurrentTime;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onLoadingStarted();
|
void onLoadingStarted();
|
||||||
|
|
Loading…
Reference in New Issue