2021-12-26 23:18:28 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2021-11-08 21:19:48 +08:00
|
|
|
#include "environmentperformancewidget.h"
|
|
|
|
#include "ui_environmentperformancewidget.h"
|
|
|
|
#include "../settings.h"
|
|
|
|
|
|
|
|
EnvironmentPerformanceWidget::EnvironmentPerformanceWidget(const QString& name, const QString& group, QWidget *parent) :
|
|
|
|
SettingsWidget(name,group,parent),
|
|
|
|
ui(new Ui::EnvironmentPerformanceWidget)
|
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
EnvironmentPerformanceWidget::~EnvironmentPerformanceWidget()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
void EnvironmentPerformanceWidget::doLoad()
|
|
|
|
{
|
|
|
|
ui->chkClearWhenEditorHidden->setChecked(pSettings->codeCompletion().clearWhenEditorHidden());
|
2023-01-06 11:59:21 +08:00
|
|
|
//#ifdef Q_OS_WIN
|
|
|
|
// MEMORYSTATUSEX statex;
|
2021-11-09 21:32:23 +08:00
|
|
|
|
2023-01-06 11:59:21 +08:00
|
|
|
// statex.dwLength = sizeof (statex);
|
2021-11-09 21:32:23 +08:00
|
|
|
|
2023-01-06 11:59:21 +08:00
|
|
|
// GlobalMemoryStatusEx (&statex);
|
|
|
|
// if (statex.ullTotalPhys < (long long int)2*1024*1024*1024) {
|
|
|
|
// ui->chkClearWhenEditorHidden->setEnabled(false);
|
|
|
|
// ui->chkClearWhenEditorHidden->setChecked(true);
|
|
|
|
// pSettings->codeCompletion().setClearWhenEditorHidden(true);
|
|
|
|
// pSettings->codeCompletion().save();
|
|
|
|
// }
|
|
|
|
// if (statex.ullTotalPhys < (long long int)1024*1024*1024) {
|
|
|
|
// ui->chkEditorsShareParser->setEnabled(false);
|
|
|
|
// ui->chkEditorsShareParser->setChecked(true);
|
|
|
|
// pSettings->codeCompletion().setShareParser(true);
|
|
|
|
// pSettings->codeCompletion().save();
|
|
|
|
// }
|
|
|
|
//#endif
|
2022-10-27 15:18:57 +08:00
|
|
|
ui->chkEditorsShareParser->setChecked(pSettings->codeCompletion().shareParser());
|
2023-01-06 11:59:21 +08:00
|
|
|
ui->spinMaxUndoMemory->setValue(pSettings->editor().undoMemoryUsage());
|
2021-11-08 21:19:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void EnvironmentPerformanceWidget::doSave()
|
|
|
|
{
|
|
|
|
pSettings->codeCompletion().setClearWhenEditorHidden(ui->chkClearWhenEditorHidden->isChecked());
|
2022-10-27 15:18:57 +08:00
|
|
|
pSettings->codeCompletion().setShareParser(ui->chkEditorsShareParser->isChecked());
|
2021-11-08 21:19:48 +08:00
|
|
|
|
|
|
|
pSettings->codeCompletion().save();
|
2023-01-06 11:59:21 +08:00
|
|
|
pSettings->editor().setUndoMemoryUsage(ui->spinMaxUndoMemory->value());
|
|
|
|
pSettings->editor().save();
|
2021-11-08 21:19:48 +08:00
|
|
|
}
|