resolv conflict.
This commit is contained in:
commit
d4fb9b05b6
|
@ -56,6 +56,31 @@ KyConnectItem *KyActiveConnectResourse::getActiveConnectionItem(NetworkManager::
|
||||||
return activeConnectItem;
|
return activeConnectItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KyConnectItem *KyActiveConnectResourse::getActiveConnectionByUuid(QString connectUuid)
|
||||||
|
{
|
||||||
|
NetworkManager::ActiveConnection::Ptr activeConnectPtr =
|
||||||
|
m_networkResourceInstance->getActiveConnect(connectUuid);
|
||||||
|
|
||||||
|
if (nullptr == activeConnectPtr) {
|
||||||
|
qWarning()<< "[KyActiveConnectResourse]" <<"it can not find connect "<< connectUuid;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
KyConnectItem *activeConnectItem = getActiveConnectionItem(activeConnectPtr);
|
||||||
|
if (nullptr == activeConnectItem) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList interfaces = activeConnectPtr->devices();
|
||||||
|
QString ifaceUni = interfaces.at(0);
|
||||||
|
NetworkManager::Device:: Ptr devicePtr =
|
||||||
|
m_networkResourceInstance->findDeviceUni(ifaceUni);
|
||||||
|
activeConnectItem->m_ifaceName = devicePtr->interfaceName();
|
||||||
|
activeConnectItem->m_itemType = activeConnectPtr->type();
|
||||||
|
|
||||||
|
return activeConnectItem;
|
||||||
|
}
|
||||||
|
|
||||||
KyConnectItem *KyActiveConnectResourse::getActiveConnectionByUuid(QString connectUuid,
|
KyConnectItem *KyActiveConnectResourse::getActiveConnectionByUuid(QString connectUuid,
|
||||||
QString deviceName)
|
QString deviceName)
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,6 +17,7 @@ public:
|
||||||
~KyActiveConnectResourse();
|
~KyActiveConnectResourse();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
KyConnectItem *getActiveConnectionByUuid(QString connectUuid);
|
||||||
KyConnectItem *getActiveConnectionByUuid(QString connectUuid, QString deviceName);
|
KyConnectItem *getActiveConnectionByUuid(QString connectUuid, QString deviceName);
|
||||||
void getActiveConnectionList(QString deviceName,
|
void getActiveConnectionList(QString deviceName,
|
||||||
NetworkManager::ConnectionSettings::ConnectionType connectionType,
|
NetworkManager::ConnectionSettings::ConnectionType connectionType,
|
||||||
|
|
|
@ -18,6 +18,11 @@ KyConnectItem::~KyConnectItem()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KyConnectItem::setConnectUuid(QString uuid)
|
||||||
|
{
|
||||||
|
m_connectUuid = uuid;
|
||||||
|
}
|
||||||
|
|
||||||
void KyConnectItem::dumpInfo()
|
void KyConnectItem::dumpInfo()
|
||||||
{
|
{
|
||||||
qDebug()<<"wired connection item info:";
|
qDebug()<<"wired connection item info:";
|
||||||
|
|
|
@ -14,6 +14,8 @@ public:
|
||||||
public:
|
public:
|
||||||
void dumpInfo();
|
void dumpInfo();
|
||||||
|
|
||||||
|
void setConnectUuid(QString uuid);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QString m_connectName;
|
QString m_connectName;
|
||||||
QString m_connectUuid;
|
QString m_connectUuid;
|
||||||
|
|
|
@ -47,6 +47,30 @@ KyConnectItem *KyConnectResourse::getConnectionItem(NetworkManager::Connection::
|
||||||
return connectionItem;
|
return connectionItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KyConnectItem * KyConnectResourse::getConnectionItemByUuid(QString connectUuid)
|
||||||
|
{
|
||||||
|
NetworkManager::Connection::Ptr connectPtr =
|
||||||
|
m_networkResourceInstance->getConnect(connectUuid);
|
||||||
|
|
||||||
|
if (nullptr == connectPtr) {
|
||||||
|
qWarning()<< "[KyConnectResourse]" <<"get connect failed, connect uuid"<<connectUuid;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_networkResourceInstance->isActiveConnection(connectPtr->uuid())) {
|
||||||
|
qDebug()<<"[KyConnectResourse]"<<connectPtr->name()<<"is active connection";
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
KyConnectItem *connectItem = getConnectionItem(connectPtr);
|
||||||
|
if (nullptr != connectItem) {
|
||||||
|
connectItem->dumpInfo();
|
||||||
|
return connectItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
KyConnectItem * KyConnectResourse::getConnectionItemByUuid(QString connectUuid, QString deviceName)
|
KyConnectItem * KyConnectResourse::getConnectionItemByUuid(QString connectUuid, QString deviceName)
|
||||||
{
|
{
|
||||||
NetworkManager::Connection::Ptr connectPtr =
|
NetworkManager::Connection::Ptr connectPtr =
|
||||||
|
@ -552,3 +576,53 @@ void KyConnectResourse::getApConnections(QList<KyApConnectItem *> &apConnectItem
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool KyConnectResourse::isWiredConnection(QString uuid)
|
||||||
|
{
|
||||||
|
NetworkManager::Connection::Ptr connectPtr =
|
||||||
|
m_networkResourceInstance->getConnect(uuid);
|
||||||
|
|
||||||
|
if (connectPtr->isValid()) {
|
||||||
|
NetworkManager::ConnectionSettings::Ptr connectSettingPtr = connectPtr->settings();
|
||||||
|
|
||||||
|
if (connectSettingPtr.isNull()) {
|
||||||
|
qWarning()<<"[KyConnectResourse]"<<"get connect setting failed, connect uuid"<<uuid;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NetworkManager::ConnectionSettings::ConnectionType::Wired ==
|
||||||
|
connectPtr->settings()->connectionType()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool KyConnectResourse::isWirelessConnection(QString uuid)
|
||||||
|
{
|
||||||
|
NetworkManager::Connection::Ptr connectPtr =
|
||||||
|
m_networkResourceInstance->getConnect(uuid);
|
||||||
|
|
||||||
|
if (connectPtr->isValid()) {
|
||||||
|
NetworkManager::ConnectionSettings::Ptr connectSettingPtr = connectPtr->settings();
|
||||||
|
|
||||||
|
if (connectSettingPtr.isNull()) {
|
||||||
|
qWarning()<<"[KyConnectResourse]"<<"get connect setting failed, connect uuid"<<uuid;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NetworkManager::ConnectionSettings::ConnectionType::Wireless ==
|
||||||
|
connectPtr->settings()->connectionType()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool KyConnectResourse::isActivatedConnection(QString uuid)
|
||||||
|
{
|
||||||
|
return m_networkResourceInstance->isActiveConnection(uuid);
|
||||||
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ public:
|
||||||
~KyConnectResourse();
|
~KyConnectResourse();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
KyConnectItem *getConnectionItemByUuid(QString connectUuid);
|
||||||
KyConnectItem *getConnectionItemByUuid(QString connectUuid, QString deviceName);
|
KyConnectItem *getConnectionItemByUuid(QString connectUuid, QString deviceName);
|
||||||
void getConnectionList(QString deviceName,
|
void getConnectionList(QString deviceName,
|
||||||
NetworkManager::ConnectionSettings::ConnectionType connectionType,
|
NetworkManager::ConnectionSettings::ConnectionType connectionType,
|
||||||
|
@ -30,6 +31,10 @@ public:
|
||||||
bool getInterfaceByUuid(QString &deviceName, NetworkManager::ConnectionSettings::ConnectionType &type, const QString connUuid);
|
bool getInterfaceByUuid(QString &deviceName, NetworkManager::ConnectionSettings::ConnectionType &type, const QString connUuid);
|
||||||
void getConnectivity(NetworkManager::Connectivity &connectivity);
|
void getConnectivity(NetworkManager::Connectivity &connectivity);
|
||||||
|
|
||||||
|
bool isWiredConnection(QString uuid);
|
||||||
|
bool isWirelessConnection(QString uuid);
|
||||||
|
bool isActivatedConnection(QString uuid);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
KyConnectItem *getConnectionItem(NetworkManager::Connection::Ptr connectPtr);
|
KyConnectItem *getConnectionItem(NetworkManager::Connection::Ptr connectPtr);
|
||||||
void getConnectIp(NetworkManager::ConnectionSettings::Ptr settingPtr,
|
void getConnectIp(NetworkManager::ConnectionSettings::Ptr settingPtr,
|
||||||
|
|
|
@ -166,7 +166,7 @@ void KyNetworkResourceManager::addActiveConnection(NetworkManager::ActiveConnect
|
||||||
connect(conn.data(), &NetworkManager::ActiveConnection::typeChanged, this, &KyNetworkResourceManager::onActiveConnectionUpdated);
|
connect(conn.data(), &NetworkManager::ActiveConnection::typeChanged, this, &KyNetworkResourceManager::onActiveConnectionUpdated);
|
||||||
connect(conn.data(), &NetworkManager::ActiveConnection::masterChanged, this, &KyNetworkResourceManager::onActiveConnectionUpdated);
|
connect(conn.data(), &NetworkManager::ActiveConnection::masterChanged, this, &KyNetworkResourceManager::onActiveConnectionUpdated);
|
||||||
connect(conn.data(), &NetworkManager::ActiveConnection::specificObjectChanged, this, &KyNetworkResourceManager::onActiveConnectionUpdated);
|
connect(conn.data(), &NetworkManager::ActiveConnection::specificObjectChanged, this, &KyNetworkResourceManager::onActiveConnectionUpdated);
|
||||||
connect(conn.data(), &NetworkManager::ActiveConnection::stateChangedReason, this, &KyNetworkResourceManager::onActiveConnectionChangedReason);
|
//connect(conn.data(), &NetworkManager::ActiveConnection::stateChangedReason, this, &KyNetworkResourceManager::onActiveConnectionChangedReason);
|
||||||
connect(conn.data(), &NetworkManager::ActiveConnection::stateChanged, this, &KyNetworkResourceManager::onActiveConnectionChanged);
|
connect(conn.data(), &NetworkManager::ActiveConnection::stateChanged, this, &KyNetworkResourceManager::onActiveConnectionChanged);
|
||||||
connect(conn.data(), &NetworkManager::ActiveConnection::vpnChanged, this, &KyNetworkResourceManager::onActiveConnectionUpdated);
|
connect(conn.data(), &NetworkManager::ActiveConnection::vpnChanged, this, &KyNetworkResourceManager::onActiveConnectionUpdated);
|
||||||
connect(conn.data(), &NetworkManager::ActiveConnection::uuidChanged, this, &KyNetworkResourceManager::onActiveConnectionUpdated);
|
connect(conn.data(), &NetworkManager::ActiveConnection::uuidChanged, this, &KyNetworkResourceManager::onActiveConnectionUpdated);
|
||||||
|
@ -556,6 +556,10 @@ void KyNetworkResourceManager::onActiveConnectionChanged(
|
||||||
if (activeConnect->isValid()) {
|
if (activeConnect->isValid()) {
|
||||||
qDebug()<<"!New state change activate connect"<<activeConnect->uuid();
|
qDebug()<<"!New state change activate connect"<<activeConnect->uuid();
|
||||||
qDebug()<<"!New the active connect state"<<state;
|
qDebug()<<"!New the active connect state"<<state;
|
||||||
|
while(activeConnect->state() != state) {
|
||||||
|
qDebug()<<"connect real state"<<activeConnect->state() <<"change state"<<state;
|
||||||
|
::usleep(10000);
|
||||||
|
}
|
||||||
emit activeConnectStateChangeReason(activeConnect->uuid(), state,
|
emit activeConnectStateChangeReason(activeConnect->uuid(), state,
|
||||||
NetworkManager::ActiveConnection::Reason::UknownReason);
|
NetworkManager::ActiveConnection::Reason::UknownReason);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -24,7 +24,6 @@ LanListItem::LanListItem(KyConnectItem *data, QString deviceName, QWidget *paren
|
||||||
m_isActive = false;
|
m_isActive = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_netButton->setActive(m_isActive);
|
|
||||||
m_itemFrame->installEventFilter(this);
|
m_itemFrame->installEventFilter(this);
|
||||||
connect(this->m_infoButton, &InfoButton::clicked, this, &LanListItem::onInfoButtonClicked);
|
connect(this->m_infoButton, &InfoButton::clicked, this, &LanListItem::onInfoButtonClicked);
|
||||||
connect(m_activeConnectResource, &KyActiveConnectResourse::stateChangeReason, this, &LanListItem::onLanStatusChange);
|
connect(m_activeConnectResource, &KyActiveConnectResourse::stateChangeReason, this, &LanListItem::onLanStatusChange);
|
||||||
|
@ -43,8 +42,10 @@ void LanListItem::setIcon(bool isOn)
|
||||||
{
|
{
|
||||||
if (isOn) {
|
if (isOn) {
|
||||||
m_netButton->setButtonIcon(QIcon::fromTheme("network-wired-connected-symbolic"));
|
m_netButton->setButtonIcon(QIcon::fromTheme("network-wired-connected-symbolic"));
|
||||||
|
m_netButton->setActive(true); //设置图标显示不同颜色
|
||||||
} else {
|
} else {
|
||||||
m_netButton->setButtonIcon(QIcon::fromTheme("network-wired-disconnected-symbolic"));
|
m_netButton->setButtonIcon(QIcon::fromTheme("network-wired-disconnected-symbolic"));
|
||||||
|
m_netButton->setActive(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,6 +64,7 @@ void LanListItem::onNetButtonClicked()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
qDebug() << "[LanListItem] Wired Device not carried";
|
qDebug() << "[LanListItem] Wired Device not carried";
|
||||||
|
this->showDesktopNotify(tr("Wired Device not carried"));
|
||||||
m_isActive = false;
|
m_isActive = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -93,9 +95,11 @@ void LanListItem::onInfoButtonClicked()
|
||||||
|
|
||||||
void LanListItem::onLanStatusChange(QString uuid, NetworkManager::ActiveConnection::State state, NetworkManager::ActiveConnection::Reason reason)
|
void LanListItem::onLanStatusChange(QString uuid, NetworkManager::ActiveConnection::State state, NetworkManager::ActiveConnection::Reason reason)
|
||||||
{
|
{
|
||||||
qDebug() <<"[LanListItem]Connection State Change to:" << state;
|
qDebug() <<"[LanListItem] Connection State Change to:" << state << uuid;
|
||||||
|
|
||||||
if (m_data->m_connectUuid == uuid) {
|
if (m_data->m_connectUuid == uuid) {
|
||||||
if (state == NetworkManager::ActiveConnection::State::Activating || state == NetworkManager::ActiveConnection::State::Deactivating) {
|
if (state == NetworkManager::ActiveConnection::State::Activating
|
||||||
|
|| state == NetworkManager::ActiveConnection::State::Deactivating) {
|
||||||
qDebug() << "[LanListItem]Activating!Loading!" << state;
|
qDebug() << "[LanListItem]Activating!Loading!" << state;
|
||||||
m_netButton->startLoading();
|
m_netButton->startLoading();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -21,11 +21,16 @@ ListItem::ListItem(QWidget *parent) : QFrame(parent)
|
||||||
|
|
||||||
ListItem::~ListItem()
|
ListItem::~ListItem()
|
||||||
{
|
{
|
||||||
|
if (nullptr != m_netButton) {
|
||||||
delete m_netButton;
|
delete m_netButton;
|
||||||
m_netButton = NULL;
|
m_netButton = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nullptr != m_infoButton) {
|
||||||
delete m_infoButton;
|
delete m_infoButton;
|
||||||
m_infoButton = NULL;
|
m_infoButton = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListItem::setName(const QString &name)
|
void ListItem::setName(const QString &name)
|
||||||
|
|
|
@ -201,6 +201,7 @@ void WlanListItem::initWlanConnection()
|
||||||
connect(m_resource, &KyWirelessNetResource::connectionRemove, this, &WlanListItem::onConnectionRemove);
|
connect(m_resource, &KyWirelessNetResource::connectionRemove, this, &WlanListItem::onConnectionRemove);
|
||||||
connect(this->m_infoButton, &InfoButton::clicked, this, &WlanListItem::onInfoButtonClicked);
|
connect(this->m_infoButton, &InfoButton::clicked, this, &WlanListItem::onInfoButtonClicked);
|
||||||
connect(m_connectResource, &KyActiveConnectResourse::stateChangeReason, this, &WlanListItem::onWlanStatusChange);
|
connect(m_connectResource, &KyActiveConnectResourse::stateChangeReason, this, &WlanListItem::onWlanStatusChange);
|
||||||
|
connect(m_netButton, &RadioItemButton::animationStoped, this, &WlanListItem::refreshIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WlanListItem::refreshIcon()
|
void WlanListItem::refreshIcon()
|
||||||
|
@ -276,6 +277,10 @@ void WlanListItem::onNetButtonClicked()
|
||||||
qDebug() << "On wlan clicked! But there is no wlan connect!" << Q_FUNC_INFO << __LINE__;
|
qDebug() << "On wlan clicked! But there is no wlan connect!" << Q_FUNC_INFO << __LINE__;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if ((m_state == NetworkManager::ActiveConnection::State::Activating || m_state == NetworkManager::ActiveConnection::State::Deactivating)) {
|
||||||
|
qDebug() << "On wlan clicked! But there is nothing to do because it is already activating/deactivating!" << Q_FUNC_INFO << __LINE__;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//执行连接或断开
|
//执行连接或断开
|
||||||
if (m_isActive) {
|
if (m_isActive) {
|
||||||
|
@ -367,9 +372,15 @@ void WlanListItem::onConnectButtonClicked()
|
||||||
{
|
{
|
||||||
if (m_data->m_secuType.isEmpty() || m_data->m_secuType == "") {
|
if (m_data->m_secuType.isEmpty() || m_data->m_secuType == "") {
|
||||||
qDebug() << "connect to no password wifi" << Q_FUNC_INFO << __LINE__;
|
qDebug() << "connect to no password wifi" << Q_FUNC_INFO << __LINE__;
|
||||||
} else if (!m_connectButton->isEnabled() || !m_data) {
|
} else if ((!m_connectButton->isEnabled()&&m_connectButton->isVisible()) || !m_data) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((m_state == NetworkManager::ActiveConnection::State::Activating || m_state == NetworkManager::ActiveConnection::State::Deactivating)) {
|
||||||
|
qDebug() << "On wlan clicked! But there is nothing to do because it is already activating/deactivating!" << Q_FUNC_INFO << __LINE__;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
KyWirelessConnectSetting settings;
|
KyWirelessConnectSetting settings;
|
||||||
settings.m_connectName = m_data->m_NetSsid;
|
settings.m_connectName = m_data->m_NetSsid;
|
||||||
settings.m_ssid = m_data->m_NetSsid;
|
settings.m_ssid = m_data->m_NetSsid;
|
||||||
|
@ -413,6 +424,7 @@ void WlanListItem::onWlanStatusChange(QString uuid, NetworkManager::ActiveConnec
|
||||||
m_resource->getSsidByUuid(uuid, ssid, devName);
|
m_resource->getSsidByUuid(uuid, ssid, devName);
|
||||||
if (m_data->m_NetSsid == ssid) {
|
if (m_data->m_NetSsid == ssid) {
|
||||||
qDebug() << "[WlanPage] State changed to :" << state << Q_FUNC_INFO <<__LINE__;
|
qDebug() << "[WlanPage] State changed to :" << state << Q_FUNC_INFO <<__LINE__;
|
||||||
|
m_state = state;
|
||||||
if ((state == NetworkManager::ActiveConnection::State::Activating || state == NetworkManager::ActiveConnection::State::Deactivating)
|
if ((state == NetworkManager::ActiveConnection::State::Activating || state == NetworkManager::ActiveConnection::State::Deactivating)
|
||||||
&& devName == m_wlanDevice) {
|
&& devName == m_wlanDevice) {
|
||||||
m_netButton->startLoading();
|
m_netButton->startLoading();
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -35,64 +35,88 @@ public:
|
||||||
protected:
|
protected:
|
||||||
bool eventFilter(QObject *watched, QEvent *event);
|
bool eventFilter(QObject *watched, QEvent *event);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void initLanDevice();
|
||||||
|
void initUI();
|
||||||
|
void initLanArea();
|
||||||
|
void initNetSwitch();
|
||||||
|
|
||||||
|
void initDeviceCombox();
|
||||||
|
void updateDeviceCombox(QString oldDeviceName, QString newDeviceName);
|
||||||
|
void deleteDeviceFromCombox(QString deviceName);
|
||||||
|
void addDeviceForCombox(QString deviceName);
|
||||||
|
|
||||||
|
QListWidgetItem *addNewItem(KyConnectItem *itemData, QListWidget *listWidget);
|
||||||
|
|
||||||
|
void getEnabledDevice(QStringList &enableDeviceList);
|
||||||
|
void getDisabledDevices(QStringList &disableDeviceList);
|
||||||
|
|
||||||
|
void constructConnectionArea();
|
||||||
|
void constructActiveConnectionArea();
|
||||||
|
|
||||||
|
void updateConnectionArea(QString uuid);
|
||||||
|
void updateActivatedConnectionArea(QString uuid);
|
||||||
|
|
||||||
|
void updateActiveConnectionProperty(KyConnectItem *p_connectItem, bool &needDeleteItem);
|
||||||
|
void updateConnectionProperty(KyConnectItem *p_connectItem, bool &needDeleteItem);
|
||||||
|
|
||||||
|
void sendLanUpdateSignal(KyConnectItem *p_connectItem);
|
||||||
|
void sendLanAddSignal(KyConnectItem *p_connectItem);
|
||||||
|
|
||||||
|
void addEmptyConnectItem(QMap<KyConnectItem *, QListWidgetItem *> &connectMap,
|
||||||
|
QListWidget *lanListWidget);
|
||||||
|
void clearConnectionMap(QMap<KyConnectItem *, QListWidgetItem *> &connectMap,
|
||||||
|
QListWidget *lanListWidget);
|
||||||
|
void deleteConnectionMapItem(QMap<KyConnectItem *, QListWidgetItem *> &connectMap,
|
||||||
|
QListWidget *lanListWidget, QString uuid);
|
||||||
|
bool connectionItemIsExist(QMap<KyConnectItem *, QListWidgetItem *> &connectMap,
|
||||||
|
QString uuid);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void lanAdd(QString devName, QStringList info);
|
void lanAdd(QString devName, QStringList info);
|
||||||
void lanRemove(QString dbusPath);
|
void lanRemove(QString dbusPath);
|
||||||
void lanUpdate(QString devName, QStringList info);
|
void lanUpdate(QString devName, QStringList info);
|
||||||
|
|
||||||
void lanActiveConnectionStateChanged(QString interface, QString uuid, int status);
|
void lanActiveConnectionStateChanged(QString interface, QString uuid, int status);
|
||||||
void lanConnectChanged();
|
void lanConnectChanged();
|
||||||
|
|
||||||
private:
|
private slots:
|
||||||
void initDeviceState();
|
void onUpdateLanlist(QString uuid, NetworkManager::ActiveConnection::State state, NetworkManager::ActiveConnection::Reason reason);
|
||||||
void initDeviceCombox();
|
|
||||||
void initUI();
|
void onAddConnection(QString uuid);
|
||||||
void initList(QString m_deviceName);
|
void onRemoveConnection(QString path);
|
||||||
void addNewItem(KyConnectItem *itemData, QListWidget *listWidget);
|
void onUpdateConnection(QString uuid);
|
||||||
void addNUllItem(QListWidget *listWidget);
|
|
||||||
void initNetSwitch();
|
void onSwithGsettingsChanged(const QString &key);
|
||||||
|
void onLanSwitchClicked();
|
||||||
|
|
||||||
|
void onDeviceAdd(QString deviceName, NetworkManager::Device::Type deviceType);
|
||||||
|
void onDeviceRemove(QString deviceName);
|
||||||
|
void onDeviceNameUpdate(QString oldName, QString newName);
|
||||||
|
|
||||||
|
void onDeviceComboxIndexChanged(int currentIndex);
|
||||||
|
|
||||||
|
void onShowControlCenter();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QListWidget * m_activatedLanListWidget = nullptr;
|
QListWidget * m_activatedLanListWidget = nullptr;
|
||||||
QListWidget * m_inactivatedLanListWidget = nullptr;
|
QListWidget * m_inactivatedLanListWidget = nullptr;
|
||||||
|
|
||||||
LanListItem * m_nullLanItem = nullptr;
|
KyNetworkDeviceResourse *m_deviceResource = nullptr;
|
||||||
QListWidgetItem *m_nullItem = nullptr;
|
|
||||||
QListWidgetItem *m_listWidgetItem = nullptr;
|
|
||||||
|
|
||||||
KyNetworkDeviceResourse *m_device = nullptr;
|
|
||||||
KyWiredConnectOperation *m_wiredConnectOperation = nullptr;
|
KyWiredConnectOperation *m_wiredConnectOperation = nullptr;
|
||||||
KyActiveConnectResourse *m_activeResourse = nullptr; //激活的连接
|
KyActiveConnectResourse *m_activeResourse = nullptr; //激活的连接
|
||||||
KyConnectResourse *m_connectResourse = nullptr; //未激活的连接
|
KyConnectResourse *m_connectResourse = nullptr; //未激活的连接
|
||||||
|
|
||||||
QList<KyConnectItem *> m_activedList;
|
|
||||||
QList<KyConnectItem *> m_deactivedList;
|
|
||||||
|
|
||||||
// QMap<QString, QVector<QStringList> > m_deviceMap;
|
|
||||||
|
|
||||||
QMap<KyConnectItem *, QListWidgetItem *> m_deactiveMap;
|
QMap<KyConnectItem *, QListWidgetItem *> m_deactiveMap;
|
||||||
QMap<KyConnectItem *, QListWidgetItem *> m_activeMap;
|
QMap<KyConnectItem *, QListWidgetItem *> m_activeMap;
|
||||||
|
|
||||||
// QMap<LanListItem *, QListWidgetItem *> m_deactiveMap;
|
QString m_currentDeviceName;
|
||||||
// QMap<LanListItem *, QListWidgetItem *> m_activeMap;
|
|
||||||
|
|
||||||
QString m_deviceName;
|
|
||||||
QStringList m_devList;
|
QStringList m_devList;
|
||||||
QStringList enableDevice;
|
QStringList m_enableDeviceList;
|
||||||
|
|
||||||
QGSettings *m_switchGsettings = nullptr;
|
QGSettings *m_switchGsettings = nullptr;
|
||||||
|
|
||||||
private slots:
|
bool m_wiredSwitch = true;
|
||||||
void updateLanlist(QString uuid, NetworkManager::ActiveConnection::State state, NetworkManager::ActiveConnection::Reason reason);
|
|
||||||
void addConnectionSlot(QString uuid);
|
|
||||||
void removeConnectionSlot(QString path);
|
|
||||||
void connectionUpdateSlot(QString uuid);
|
|
||||||
void onSwithGsettingsChanged(const QString &key);
|
|
||||||
void onLanSwitchClicked();
|
|
||||||
void onDeviceAdd(QString deviceName, NetworkManager::Device::Type deviceType);
|
|
||||||
void onDeviceRemove(QString deviceName);
|
|
||||||
void onDeviceNameUpdate(QString oldName, QString newName);
|
|
||||||
void onDeviceComboxIndexChanged(int currentIndex);
|
|
||||||
void showControlCenter();
|
|
||||||
// void onLanDataChange(QString uuid);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LANPAGE_H
|
#endif // LANPAGE_H
|
||||||
|
|
|
@ -93,8 +93,8 @@ void TabPage::initUI()
|
||||||
m_mainLayout->addWidget(m_activatedNetFrame);
|
m_mainLayout->addWidget(m_activatedNetFrame);
|
||||||
m_mainLayout->addWidget(m_activatedNetDivider);
|
m_mainLayout->addWidget(m_activatedNetDivider);
|
||||||
m_mainLayout->addWidget(m_inactivatedNetFrame);
|
m_mainLayout->addWidget(m_inactivatedNetFrame);
|
||||||
m_mainLayout->addWidget(m_inactivatedNetDivider);
|
|
||||||
m_mainLayout->addStretch();
|
m_mainLayout->addStretch();
|
||||||
|
m_mainLayout->addWidget(m_inactivatedNetDivider);
|
||||||
m_mainLayout->addWidget(m_settingsFrame);
|
m_mainLayout->addWidget(m_settingsFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,6 +128,33 @@ void TabPage::showDesktopNotify(const QString &message)
|
||||||
iface.callWithArgumentList(QDBus::AutoDetect,"Notify",args);
|
iface.callWithArgumentList(QDBus::AutoDetect,"Notify",args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString getDefaultDeviceName(KyDeviceType deviceType)
|
||||||
|
{
|
||||||
|
QString defaultDevice = "";
|
||||||
|
|
||||||
|
QString key;
|
||||||
|
switch (deviceType) {
|
||||||
|
case WIRED:
|
||||||
|
key = "wired";
|
||||||
|
break;
|
||||||
|
case WIRELESS:
|
||||||
|
key = "wireless";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return defaultDevice;
|
||||||
|
}
|
||||||
|
|
||||||
|
QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat);
|
||||||
|
m_settings->beginGroup("DEFAULTCARD");
|
||||||
|
defaultDevice = m_settings->value(key).toString();
|
||||||
|
m_settings->endGroup();
|
||||||
|
|
||||||
|
delete m_settings;
|
||||||
|
m_settings = nullptr;
|
||||||
|
|
||||||
|
return defaultDevice;
|
||||||
|
}
|
||||||
|
|
||||||
void setDefaultDevice(KyDeviceType deviceType, QString deviceName)
|
void setDefaultDevice(KyDeviceType deviceType, QString deviceName)
|
||||||
{
|
{
|
||||||
QString key;
|
QString key;
|
||||||
|
@ -140,15 +167,17 @@ void setDefaultDevice(KyDeviceType deviceType, QString deviceName)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat);
|
QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat);
|
||||||
m_settings->beginGroup("DEFAULTCARD");
|
m_settings->beginGroup("DEFAULTCARD");
|
||||||
m_settings->setValue(key, deviceName);
|
m_settings->setValue(key, deviceName);
|
||||||
m_settings->endGroup();
|
m_settings->endGroup();
|
||||||
m_settings->sync();
|
m_settings->sync();
|
||||||
|
|
||||||
delete m_settings;
|
delete m_settings;
|
||||||
m_settings = nullptr;
|
m_settings = nullptr;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,6 +217,18 @@ void saveDeviceEnableState(QString deviceName, bool enable)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void deleteDeviceEnableState(QString deviceName)
|
||||||
|
{
|
||||||
|
QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat);
|
||||||
|
m_settings->beginGroup("CARDEABLE");
|
||||||
|
m_settings->remove(deviceName);
|
||||||
|
m_settings->endGroup();
|
||||||
|
m_settings->sync();
|
||||||
|
delete m_settings;
|
||||||
|
m_settings = nullptr;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
void getDeviceEnableState(int type, QMap<QString, bool> &map)
|
void getDeviceEnableState(int type, QMap<QString, bool> &map)
|
||||||
{
|
{
|
||||||
map.clear();
|
map.clear();
|
||||||
|
|
|
@ -40,8 +40,10 @@ enum KyDeviceType
|
||||||
|
|
||||||
const QString CONFIG_FILE_PATH = QDir::homePath() + "/.config/ukui/kylin-nm.conf";
|
const QString CONFIG_FILE_PATH = QDir::homePath() + "/.config/ukui/kylin-nm.conf";
|
||||||
bool checkDeviceExist(KyDeviceType deviceType, QString deviceName);
|
bool checkDeviceExist(KyDeviceType deviceType, QString deviceName);
|
||||||
|
QString getDefaultDeviceName(KyDeviceType deviceType);
|
||||||
void setDefaultDevice(KyDeviceType deviceType, QString deviceName);
|
void setDefaultDevice(KyDeviceType deviceType, QString deviceName);
|
||||||
void saveDeviceEnableState(QString deviceName, bool enable);
|
void saveDeviceEnableState(QString deviceName, bool enable);
|
||||||
|
void deleteDeviceEnableState(QString deviceName);
|
||||||
void getDeviceEnableState(int type, QMap<QString, bool> &map);
|
void getDeviceEnableState(int type, QMap<QString, bool> &map);
|
||||||
|
|
||||||
class TabPage : public QWidget
|
class TabPage : public QWidget
|
||||||
|
|
|
@ -32,6 +32,7 @@ WlanPage::WlanPage(QWidget *parent) : TabPage(parent)
|
||||||
|
|
||||||
connect(m_wirelessConnectOpreation, &KyWirelessConnectOperation::activateConnectionError, this, &WlanPage::activateFailed);
|
connect(m_wirelessConnectOpreation, &KyWirelessConnectOperation::activateConnectionError, this, &WlanPage::activateFailed);
|
||||||
connect(m_wirelessConnectOpreation, &KyWirelessConnectOperation::addAndActivateConnectionError, this, &WlanPage::activateFailed);
|
connect(m_wirelessConnectOpreation, &KyWirelessConnectOperation::addAndActivateConnectionError, this, &WlanPage::activateFailed);
|
||||||
|
connect(this, &WlanPage::activateFailed, this, &WlanPage::onActiveFailed);
|
||||||
connect(m_wirelessConnectOpreation, &KyWirelessConnectOperation::deactivateConnectionError, this, &WlanPage::deactivateFailed);
|
connect(m_wirelessConnectOpreation, &KyWirelessConnectOperation::deactivateConnectionError, this, &WlanPage::deactivateFailed);
|
||||||
|
|
||||||
connect(this, &WlanPage::hiddenWlanClicked, this, &WlanPage::onHiddenWlanClicked);
|
connect(this, &WlanPage::hiddenWlanClicked, this, &WlanPage::onHiddenWlanClicked);
|
||||||
|
@ -138,6 +139,19 @@ void WlanPage::initConnections()
|
||||||
connect(m_switchGsettings, &QGSettings::changed, this, [ = ](const QString &key) {
|
connect(m_switchGsettings, &QGSettings::changed, this, [ = ](const QString &key) {
|
||||||
if (key == WIRELESS_SWITCH) {
|
if (key == WIRELESS_SWITCH) {
|
||||||
bool status = m_switchGsettings->get(WIRELESS_SWITCH).toBool();
|
bool status = m_switchGsettings->get(WIRELESS_SWITCH).toBool();
|
||||||
|
if (!status) {
|
||||||
|
// m_deviceFrame->hide();
|
||||||
|
m_activatedNetFrame->hide();
|
||||||
|
m_inactivatedNetFrame->hide();
|
||||||
|
m_activatedNetDivider->hide();
|
||||||
|
m_inactivatedNetDivider->hide();
|
||||||
|
} else {
|
||||||
|
// m_deviceFrame->show();
|
||||||
|
m_activatedNetFrame->show();
|
||||||
|
m_inactivatedNetFrame->show();
|
||||||
|
m_activatedNetDivider->show();
|
||||||
|
m_inactivatedNetDivider->show();
|
||||||
|
}
|
||||||
m_wirelessConnectOpreation->setWirelessEnabled(status);
|
m_wirelessConnectOpreation->setWirelessEnabled(status);
|
||||||
m_netSwitch->setSwitchStatus(m_switchGsettings->get(WIRELESS_SWITCH).toBool());
|
m_netSwitch->setSwitchStatus(m_switchGsettings->get(WIRELESS_SWITCH).toBool());
|
||||||
onWlanSwitchStatusChanged(m_switchGsettings->get(WIRELESS_SWITCH).toBool());
|
onWlanSwitchStatusChanged(m_switchGsettings->get(WIRELESS_SWITCH).toBool());
|
||||||
|
@ -389,6 +403,7 @@ void WlanPage::onDeviceAdd(QString deviceName, NetworkManager::Device::Type devi
|
||||||
m_devList << deviceName;
|
m_devList << deviceName;
|
||||||
if (getDefaultDevice().isEmpty())
|
if (getDefaultDevice().isEmpty())
|
||||||
{
|
{
|
||||||
|
m_devList.clear();
|
||||||
updateDefaultDevice(deviceName);
|
updateDefaultDevice(deviceName);
|
||||||
setDefaultDevice(WIRELESS, deviceName);
|
setDefaultDevice(WIRELESS, deviceName);
|
||||||
|
|
||||||
|
@ -682,8 +697,17 @@ void WlanPage::onWifiEnabledChanged(bool isWifiOn)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WlanPage::onActiveFailed(QString errorMessage)
|
||||||
|
{
|
||||||
|
qDebug() << "active failed and the message is: " << errorMessage << Q_FUNC_INFO << __LINE__;
|
||||||
|
}
|
||||||
|
|
||||||
void WlanPage::updateByStrength()
|
void WlanPage::updateByStrength()
|
||||||
{
|
{
|
||||||
|
if (m_expandedItem) {
|
||||||
|
qDebug() << "Has expanded item and forbid refresh wifi strength" << Q_FUNC_INFO << __LINE__;
|
||||||
|
return;
|
||||||
|
}
|
||||||
qDebug() << "Will update Wlan list by strength." << Q_FUNC_INFO << __LINE__;
|
qDebug() << "Will update Wlan list by strength." << Q_FUNC_INFO << __LINE__;
|
||||||
QList<KyWirelessNetItem> wlanList;
|
QList<KyWirelessNetItem> wlanList;
|
||||||
if (!m_resource->getDeviceWifiNetwork(m_defaultDevice, wlanList)) {
|
if (!m_resource->getDeviceWifiNetwork(m_defaultDevice, wlanList)) {
|
||||||
|
@ -718,6 +742,8 @@ void WlanPage::updateByStrength()
|
||||||
} else {//找到了该位置的wifi而且与现在的排序不符,需要调整
|
} else {//找到了该位置的wifi而且与现在的排序不符,需要调整
|
||||||
KyWirelessNetItem *data = new KyWirelessNetItem(wlanList.at(i));
|
KyWirelessNetItem *data = new KyWirelessNetItem(wlanList.at(i));
|
||||||
WlanListItem * currentWlan = new WlanListItem(m_resource, data, m_defaultDevice);
|
WlanListItem * currentWlan = new WlanListItem(m_resource, data, m_defaultDevice);
|
||||||
|
connect(currentWlan, &WlanListItem::itemHeightChanged, this, &WlanPage::onItemHeightChanged);
|
||||||
|
connect(currentWlan, &WlanListItem::connectButtonClicked, this, &WlanPage::onConnectButtonClicked);
|
||||||
QPair<QListWidgetItem*, WlanListItem*> newPair;
|
QPair<QListWidgetItem*, WlanListItem*> newPair;
|
||||||
newPair.first = m_itemsMap.value(lastWlan->getSsid()).first;
|
newPair.first = m_itemsMap.value(lastWlan->getSsid()).first;
|
||||||
newPair.second = currentWlan;
|
newPair.second = currentWlan;
|
||||||
|
|
|
@ -123,6 +123,7 @@ private slots:
|
||||||
void onHiddenWlanClicked();
|
void onHiddenWlanClicked();
|
||||||
void showControlCenter();
|
void showControlCenter();
|
||||||
void onWifiEnabledChanged(bool isWifiOn);
|
void onWifiEnabledChanged(bool isWifiOn);
|
||||||
|
void onActiveFailed(QString errorMessage);
|
||||||
|
|
||||||
// void onRefreshIconTimer();
|
// void onRefreshIconTimer();
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,8 @@ void InfoButton::paintEvent(QPaintEvent *event)
|
||||||
|
|
||||||
painter.fillPath(outerPath, pal.color(QPalette::Text));
|
painter.fillPath(outerPath, pal.color(QPalette::Text));
|
||||||
painter.setPen(m_foregroundColor);
|
painter.setPen(m_foregroundColor);
|
||||||
|
QFont font("Noto Sans CJK SC", 11, QFont::Normal, false);
|
||||||
|
painter.setFont(font);
|
||||||
painter.drawText(TEXT_POS, "i");
|
painter.drawText(TEXT_POS, "i");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,9 @@ void RadioItemButton::onLoadingStopped()
|
||||||
qWarning() << "Stop loading failed, m_animation is null pointer!" << Q_FUNC_INFO << __LINE__;
|
qWarning() << "Stop loading failed, m_animation is null pointer!" << Q_FUNC_INFO << __LINE__;
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
m_iconLabel->setPixmap(m_pixmap);
|
||||||
m_animation->stop();
|
m_animation->stop();
|
||||||
|
emit this->animationStoped();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ public:
|
||||||
signals:
|
signals:
|
||||||
void requestStartLoading();
|
void requestStartLoading();
|
||||||
void requestStopLoading();
|
void requestStopLoading();
|
||||||
|
void animationStoped();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *event);
|
void paintEvent(QPaintEvent *event);
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue