解决KyNetworkResourceManager未完成初始化KyNetworkDeviceResourse获取设备列表失败无法初始化kylin-nm

This commit is contained in:
Jinxujie 2021-12-01 16:03:25 +08:00
parent 62b99acdbe
commit 4341aad5ea
3 changed files with 17 additions and 0 deletions

View File

@ -77,6 +77,9 @@ void KyNetworkResourceManager::onInitNetwork()
<< "active connections:" << m_activeConns.size()
<< "connections:" << m_connections.size()
<< "network device:" << m_devices.size();
m_initFinished = true;
return;
}
KyNetworkResourceManager::~KyNetworkResourceManager()
@ -497,6 +500,11 @@ void KyNetworkResourceManager::getConnectivity(NetworkManager::Connectivity &con
connectivity = NetworkManager::connectivity();
}
bool KyNetworkResourceManager::NetworkManagerIsInited()
{
return m_initFinished;
}
void KyNetworkResourceManager::requestScan(NetworkManager::WirelessDevice * dev)
{
if (nullptr == dev) {

View File

@ -103,6 +103,8 @@ public:
void getConnectivity(NetworkManager::Connectivity &connectivity);
bool NetworkManagerIsInited();
signals:
void connectionAdd(QString uuid);
void connectionUpdate(QString uuid);
@ -184,6 +186,9 @@ private:
void onWifiNetworkUpdate(NetworkManager::WirelessNetwork * net);
void onWifiNetworkRemove(NetworkManager::Device * dev, QString const & ssid);
private:
bool m_initFinished = false;
public:
static KyNetworkResourceManager* m_pInstance;

View File

@ -109,6 +109,10 @@ int main(int argc, char *argv[])
qWarning() << "Translations load fail";
}
while (!p_networkResource->NetworkManagerIsInited()) {
::usleep(1000);
}
MainWindow w;
a.setActivationWindow(&w);
w.setProperty("useStyleWindowManager", false); //禁用拖动