内存释放及命名修改
This commit is contained in:
parent
08443a1df8
commit
3e4862e718
|
@ -155,10 +155,11 @@ void LanPage::initNetSwitch()
|
||||||
m_switchGsettings->set(WIRED_SWITCH, wiredEnable);
|
m_switchGsettings->set(WIRED_SWITCH, wiredEnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool oldState;
|
//从3.0升级上来 先读取老的配置文件来保证和升级前状态一致
|
||||||
if (getOldWiredSwitchState(oldState)) {
|
bool oldVersionState;
|
||||||
if (wiredEnable != oldState) {
|
if (getOldVersionWiredSwitchState(oldVersionState)) {
|
||||||
m_wiredConnectOperation->setWiredEnabled(oldState);
|
if (wiredEnable != oldVersionState) {
|
||||||
|
m_wiredConnectOperation->setWiredEnabled(oldVersionState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -302,15 +302,19 @@ void getDeviceEnableState(int type, QMap<QString, bool> &map)
|
||||||
kdr = nullptr;
|
kdr = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool getOldWiredSwitchState(bool state)
|
bool getOldVersionWiredSwitchState(bool state)
|
||||||
{
|
{
|
||||||
QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat);
|
QSettings * m_settings = new QSettings(CONFIG_FILE_PATH, QSettings::IniFormat);
|
||||||
QVariant value = m_settings->value("lan_switch_opened");
|
QVariant value = m_settings->value("lan_switch_opened");
|
||||||
|
|
||||||
if (!value.isValid())
|
if (!value.isValid()) {
|
||||||
|
delete m_settings;
|
||||||
|
m_settings = nullptr;
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
state = value.toBool();
|
state = value.toBool();
|
||||||
m_settings->remove("lan_switch_opened");
|
m_settings->remove("lan_switch_opened");
|
||||||
delete m_settings;
|
delete m_settings;
|
||||||
|
m_settings = nullptr;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ bool checkDeviceExist(KyDeviceType deviceType, QString deviceName);
|
||||||
QString getDefaultDeviceName(KyDeviceType deviceType);
|
QString getDefaultDeviceName(KyDeviceType deviceType);
|
||||||
void setDefaultDevice(KyDeviceType deviceType, QString deviceName);
|
void setDefaultDevice(KyDeviceType deviceType, QString deviceName);
|
||||||
void getDeviceEnableState(int type, QMap<QString, bool> &map);
|
void getDeviceEnableState(int type, QMap<QString, bool> &map);
|
||||||
bool getOldWiredSwitchState(bool state);
|
bool getOldVersionWiredSwitchState(bool state);
|
||||||
|
|
||||||
class TabPage : public QWidget
|
class TabPage : public QWidget
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue