默认设置点击确定按钮自动保存
This commit is contained in:
parent
fbf6e44334
commit
1963c091dc
|
@ -1872,13 +1872,28 @@ void hg_settingdialog::closeEvent(QCloseEvent* e)
|
||||||
QString oldFile = QString::fromStdString(cfgPath) + "olddefault.ini";
|
QString oldFile = QString::fromStdString(cfgPath) + "olddefault.ini";
|
||||||
QString newFile = QString::fromStdString(cfgPath) + "default.ini";
|
QString newFile = QString::fromStdString(cfgPath) + "default.ini";
|
||||||
|
|
||||||
|
int index = comb_->currentIndex();
|
||||||
|
if (m_closeButton == closeButtonOk)
|
||||||
|
{
|
||||||
|
if (0 == index)
|
||||||
|
{
|
||||||
|
QFile::remove(oldFile);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
QFile::remove(newFile);
|
QFile::remove(newFile);
|
||||||
QFile file(oldFile);
|
QFile file(oldFile);
|
||||||
file.rename(newFile);
|
file.rename(newFile);
|
||||||
|
}
|
||||||
|
|
||||||
int index = comb_->currentIndex();
|
|
||||||
if (m_closeButton == closeButtonOk)
|
|
||||||
saveDefaultCfgValue("current", "index", index);
|
saveDefaultCfgValue("current", "index", index);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QFile::remove(newFile);
|
||||||
|
QFile file(oldFile);
|
||||||
|
file.rename(newFile);
|
||||||
|
}
|
||||||
|
|
||||||
e->accept();
|
e->accept();
|
||||||
}
|
}
|
||||||
|
@ -2403,9 +2418,11 @@ void hg_settingdialog::on_current_scheme_changed()
|
||||||
{
|
{
|
||||||
m_deleteCur->setEnabled(true);
|
m_deleteCur->setEnabled(true);
|
||||||
m_deleteAll->setEnabled(true);
|
m_deleteAll->setEnabled(true);
|
||||||
|
m_pbtn_Save->setEnabled(true);
|
||||||
if (comb_->currentIndex() == 0)
|
if (comb_->currentIndex() == 0)
|
||||||
{
|
{
|
||||||
m_deleteCur->setEnabled(false);
|
m_deleteCur->setEnabled(false);
|
||||||
|
m_pbtn_Save->setEnabled(false);
|
||||||
}
|
}
|
||||||
if (comb_->count() == 1)
|
if (comb_->count() == 1)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue