resolv conflict.
This commit is contained in:
commit
d4fb9b05b6
|
@ -56,6 +56,31 @@ KyConnectItem *KyActiveConnectResourse::getActiveConnectionItem(NetworkManager::
|
|||
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,
|
||||
QString deviceName)
|
||||
{
|
||||
|
|
|
@ -17,6 +17,7 @@ public:
|
|||
~KyActiveConnectResourse();
|
||||
|
||||
public:
|
||||
KyConnectItem *getActiveConnectionByUuid(QString connectUuid);
|
||||
KyConnectItem *getActiveConnectionByUuid(QString connectUuid, QString deviceName);
|
||||
void getActiveConnectionList(QString deviceName,
|
||||
NetworkManager::ConnectionSettings::ConnectionType connectionType,
|
||||
|
|
|
@ -18,6 +18,11 @@ KyConnectItem::~KyConnectItem()
|
|||
|
||||
}
|
||||
|
||||
void KyConnectItem::setConnectUuid(QString uuid)
|
||||
{
|
||||
m_connectUuid = uuid;
|
||||
}
|
||||
|
||||
void KyConnectItem::dumpInfo()
|
||||
{
|
||||
qDebug()<<"wired connection item info:";
|
||||
|
|
|
@ -14,6 +14,8 @@ public:
|
|||
public:
|
||||
void dumpInfo();
|
||||
|
||||
void setConnectUuid(QString uuid);
|
||||
|
||||
public:
|
||||
QString m_connectName;
|
||||
QString m_connectUuid;
|
||||
|
|
|
@ -47,6 +47,30 @@ KyConnectItem *KyConnectResourse::getConnectionItem(NetworkManager::Connection::
|
|||
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)
|
||||
{
|
||||
NetworkManager::Connection::Ptr connectPtr =
|
||||
|
@ -552,3 +576,53 @@ void KyConnectResourse::getApConnections(QList<KyApConnectItem *> &apConnectItem
|
|||
|
||||
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();
|
||||
|
||||
public:
|
||||
KyConnectItem *getConnectionItemByUuid(QString connectUuid);
|
||||
KyConnectItem *getConnectionItemByUuid(QString connectUuid, QString deviceName);
|
||||
void getConnectionList(QString deviceName,
|
||||
NetworkManager::ConnectionSettings::ConnectionType connectionType,
|
||||
|
@ -30,6 +31,10 @@ public:
|
|||
bool getInterfaceByUuid(QString &deviceName, NetworkManager::ConnectionSettings::ConnectionType &type, const QString connUuid);
|
||||
void getConnectivity(NetworkManager::Connectivity &connectivity);
|
||||
|
||||
bool isWiredConnection(QString uuid);
|
||||
bool isWirelessConnection(QString uuid);
|
||||
bool isActivatedConnection(QString uuid);
|
||||
|
||||
private:
|
||||
KyConnectItem *getConnectionItem(NetworkManager::Connection::Ptr connectPtr);
|
||||
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::masterChanged, 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::vpnChanged, this, &KyNetworkResourceManager::onActiveConnectionUpdated);
|
||||
connect(conn.data(), &NetworkManager::ActiveConnection::uuidChanged, this, &KyNetworkResourceManager::onActiveConnectionUpdated);
|
||||
|
@ -556,6 +556,10 @@ void KyNetworkResourceManager::onActiveConnectionChanged(
|
|||
if (activeConnect->isValid()) {
|
||||
qDebug()<<"!New state change activate connect"<<activeConnect->uuid();
|
||||
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,
|
||||
NetworkManager::ActiveConnection::Reason::UknownReason);
|
||||
} else {
|
||||
|
|
|
@ -24,7 +24,6 @@ LanListItem::LanListItem(KyConnectItem *data, QString deviceName, QWidget *paren
|
|||
m_isActive = false;
|
||||
}
|
||||
}
|
||||
m_netButton->setActive(m_isActive);
|
||||
m_itemFrame->installEventFilter(this);
|
||||
connect(this->m_infoButton, &InfoButton::clicked, this, &LanListItem::onInfoButtonClicked);
|
||||
connect(m_activeConnectResource, &KyActiveConnectResourse::stateChangeReason, this, &LanListItem::onLanStatusChange);
|
||||
|
@ -43,8 +42,10 @@ void LanListItem::setIcon(bool isOn)
|
|||
{
|
||||
if (isOn) {
|
||||
m_netButton->setButtonIcon(QIcon::fromTheme("network-wired-connected-symbolic"));
|
||||
m_netButton->setActive(true); //设置图标显示不同颜色
|
||||
} else {
|
||||
m_netButton->setButtonIcon(QIcon::fromTheme("network-wired-disconnected-symbolic"));
|
||||
m_netButton->setActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,6 +64,7 @@ void LanListItem::onNetButtonClicked()
|
|||
}
|
||||
else {
|
||||
qDebug() << "[LanListItem] Wired Device not carried";
|
||||
this->showDesktopNotify(tr("Wired Device not carried"));
|
||||
m_isActive = false;
|
||||
}
|
||||
} else {
|
||||
|
@ -93,9 +95,11 @@ void LanListItem::onInfoButtonClicked()
|
|||
|
||||
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 (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;
|
||||
m_netButton->startLoading();
|
||||
} else {
|
||||
|
|
|
@ -21,11 +21,16 @@ ListItem::ListItem(QWidget *parent) : QFrame(parent)
|
|||
|
||||
ListItem::~ListItem()
|
||||
{
|
||||
delete m_netButton;
|
||||
m_netButton = NULL;
|
||||
if (nullptr != m_netButton) {
|
||||
delete m_netButton;
|
||||
m_netButton = nullptr;
|
||||
}
|
||||
|
||||
if (nullptr != m_infoButton) {
|
||||
delete m_infoButton;
|
||||
m_infoButton = nullptr;
|
||||
}
|
||||
|
||||
delete m_infoButton;
|
||||
m_infoButton = NULL;
|
||||
}
|
||||
|
||||
void ListItem::setName(const QString &name)
|
||||
|
|
|
@ -201,6 +201,7 @@ void WlanListItem::initWlanConnection()
|
|||
connect(m_resource, &KyWirelessNetResource::connectionRemove, this, &WlanListItem::onConnectionRemove);
|
||||
connect(this->m_infoButton, &InfoButton::clicked, this, &WlanListItem::onInfoButtonClicked);
|
||||
connect(m_connectResource, &KyActiveConnectResourse::stateChangeReason, this, &WlanListItem::onWlanStatusChange);
|
||||
connect(m_netButton, &RadioItemButton::animationStoped, this, &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__;
|
||||
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) {
|
||||
|
@ -367,9 +372,15 @@ void WlanListItem::onConnectButtonClicked()
|
|||
{
|
||||
if (m_data->m_secuType.isEmpty() || m_data->m_secuType == "") {
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
settings.m_connectName = 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);
|
||||
if (m_data->m_NetSsid == ssid) {
|
||||
qDebug() << "[WlanPage] State changed to :" << state << Q_FUNC_INFO <<__LINE__;
|
||||
m_state = state;
|
||||
if ((state == NetworkManager::ActiveConnection::State::Activating || state == NetworkManager::ActiveConnection::State::Deactivating)
|
||||
&& devName == m_wlanDevice) {
|
||||
m_netButton->startLoading();
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -35,64 +35,88 @@ public:
|
|||
protected:
|
||||
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:
|
||||
void lanAdd(QString devName, QStringList info);
|
||||
void lanRemove(QString dbusPath);
|
||||
void lanUpdate(QString devName, QStringList info);
|
||||
|
||||
void lanActiveConnectionStateChanged(QString interface, QString uuid, int status);
|
||||
void lanConnectChanged();
|
||||
|
||||
private:
|
||||
void initDeviceState();
|
||||
void initDeviceCombox();
|
||||
void initUI();
|
||||
void initList(QString m_deviceName);
|
||||
void addNewItem(KyConnectItem *itemData, QListWidget *listWidget);
|
||||
void addNUllItem(QListWidget *listWidget);
|
||||
void initNetSwitch();
|
||||
private slots:
|
||||
void onUpdateLanlist(QString uuid, NetworkManager::ActiveConnection::State state, NetworkManager::ActiveConnection::Reason reason);
|
||||
|
||||
void onAddConnection(QString uuid);
|
||||
void onRemoveConnection(QString path);
|
||||
void onUpdateConnection(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 onShowControlCenter();
|
||||
|
||||
private:
|
||||
QListWidget * m_activatedLanListWidget = nullptr;
|
||||
QListWidget * m_inactivatedLanListWidget = nullptr;
|
||||
|
||||
LanListItem * m_nullLanItem = nullptr;
|
||||
QListWidgetItem *m_nullItem = nullptr;
|
||||
QListWidgetItem *m_listWidgetItem = nullptr;
|
||||
|
||||
KyNetworkDeviceResourse *m_device = nullptr;
|
||||
KyNetworkDeviceResourse *m_deviceResource = nullptr;
|
||||
KyWiredConnectOperation *m_wiredConnectOperation = nullptr;
|
||||
KyActiveConnectResourse *m_activeResourse = 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_activeMap;
|
||||
|
||||
// QMap<LanListItem *, QListWidgetItem *> m_deactiveMap;
|
||||
// QMap<LanListItem *, QListWidgetItem *> m_activeMap;
|
||||
|
||||
QString m_deviceName;
|
||||
QString m_currentDeviceName;
|
||||
QStringList m_devList;
|
||||
QStringList enableDevice;
|
||||
QGSettings * m_switchGsettings = nullptr;
|
||||
QStringList m_enableDeviceList;
|
||||
|
||||
private slots:
|
||||
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);
|
||||
QGSettings *m_switchGsettings = nullptr;
|
||||
|
||||
bool m_wiredSwitch = true;
|
||||
};
|
||||
|
||||
#endif // LANPAGE_H
|
||||
|
|
|
@ -93,8 +93,8 @@ void TabPage::initUI()
|
|||
m_mainLayout->addWidget(m_activatedNetFrame);
|
||||
m_mainLayout->addWidget(m_activatedNetDivider);
|
||||
m_mainLayout->addWidget(m_inactivatedNetFrame);
|
||||
m_mainLayout->addWidget(m_inactivatedNetDivider);
|
||||
m_mainLayout->addStretch();
|
||||
m_mainLayout->addWidget(m_inactivatedNetDivider);
|
||||
m_mainLayout->addWidget(m_settingsFrame);
|
||||
}
|
||||
|
||||
|
@ -128,6 +128,33 @@ void TabPage::showDesktopNotify(const QString &message)
|
|||
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)
|
||||
{
|
||||
QString key;
|
||||
|
@ -140,15 +167,17 @@ void setDefaultDevice(KyDeviceType deviceType, QString deviceName)
|
|||
break;
|
||||
default:
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat);
|
||||
m_settings->beginGroup("DEFAULTCARD");
|
||||
m_settings->setValue(key, deviceName);
|
||||
m_settings->endGroup();
|
||||
m_settings->sync();
|
||||
|
||||
delete m_settings;
|
||||
m_settings = nullptr;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -188,6 +217,18 @@ void saveDeviceEnableState(QString deviceName, bool enable)
|
|||
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)
|
||||
{
|
||||
map.clear();
|
||||
|
|
|
@ -40,8 +40,10 @@ enum KyDeviceType
|
|||
|
||||
const QString CONFIG_FILE_PATH = QDir::homePath() + "/.config/ukui/kylin-nm.conf";
|
||||
bool checkDeviceExist(KyDeviceType deviceType, QString deviceName);
|
||||
QString getDefaultDeviceName(KyDeviceType deviceType);
|
||||
void setDefaultDevice(KyDeviceType deviceType, QString deviceName);
|
||||
void saveDeviceEnableState(QString deviceName, bool enable);
|
||||
void deleteDeviceEnableState(QString deviceName);
|
||||
void getDeviceEnableState(int type, QMap<QString, bool> &map);
|
||||
|
||||
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::addAndActivateConnectionError, this, &WlanPage::activateFailed);
|
||||
connect(this, &WlanPage::activateFailed, this, &WlanPage::onActiveFailed);
|
||||
connect(m_wirelessConnectOpreation, &KyWirelessConnectOperation::deactivateConnectionError, this, &WlanPage::deactivateFailed);
|
||||
|
||||
connect(this, &WlanPage::hiddenWlanClicked, this, &WlanPage::onHiddenWlanClicked);
|
||||
|
@ -138,6 +139,19 @@ void WlanPage::initConnections()
|
|||
connect(m_switchGsettings, &QGSettings::changed, this, [ = ](const QString &key) {
|
||||
if (key == WIRELESS_SWITCH) {
|
||||
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_netSwitch->setSwitchStatus(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;
|
||||
if (getDefaultDevice().isEmpty())
|
||||
{
|
||||
m_devList.clear();
|
||||
updateDefaultDevice(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()
|
||||
{
|
||||
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__;
|
||||
QList<KyWirelessNetItem> wlanList;
|
||||
if (!m_resource->getDeviceWifiNetwork(m_defaultDevice, wlanList)) {
|
||||
|
@ -718,6 +742,8 @@ void WlanPage::updateByStrength()
|
|||
} else {//找到了该位置的wifi而且与现在的排序不符,需要调整
|
||||
KyWirelessNetItem *data = new KyWirelessNetItem(wlanList.at(i));
|
||||
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;
|
||||
newPair.first = m_itemsMap.value(lastWlan->getSsid()).first;
|
||||
newPair.second = currentWlan;
|
||||
|
|
|
@ -123,6 +123,7 @@ private slots:
|
|||
void onHiddenWlanClicked();
|
||||
void showControlCenter();
|
||||
void onWifiEnabledChanged(bool isWifiOn);
|
||||
void onActiveFailed(QString errorMessage);
|
||||
|
||||
// void onRefreshIconTimer();
|
||||
|
||||
|
|
|
@ -61,6 +61,8 @@ void InfoButton::paintEvent(QPaintEvent *event)
|
|||
|
||||
painter.fillPath(outerPath, pal.color(QPalette::Text));
|
||||
painter.setPen(m_foregroundColor);
|
||||
QFont font("Noto Sans CJK SC", 11, QFont::Normal, false);
|
||||
painter.setFont(font);
|
||||
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__;
|
||||
return;
|
||||
} else {
|
||||
m_iconLabel->setPixmap(m_pixmap);
|
||||
m_animation->stop();
|
||||
emit this->animationStoped();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ public:
|
|||
signals:
|
||||
void requestStartLoading();
|
||||
void requestStopLoading();
|
||||
void animationStoped();
|
||||
|
||||
protected:
|
||||
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