forked from qt-creator/qt-creator
Core: Inline systemsettings.ui
And convert text to QLabel for "Grid" layout too. Change-Id: I50488462f8795337a2cd59fc88bb9834d988912d Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -39,19 +39,27 @@
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/checkablemessagebox.h>
|
||||
#include <utils/elidinglabel.h>
|
||||
#include <utils/environment.h>
|
||||
#include <utils/environmentdialog.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
#include <utils/pathchooser.h>
|
||||
#include <utils/terminalcommand.h>
|
||||
#include <utils/unixutils.h>
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QCoreApplication>
|
||||
#include <QLineEdit>
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
#include <QSettings>
|
||||
|
||||
#include "ui_systemsettings.h"
|
||||
#include <QSpinBox>
|
||||
#include <QToolButton>
|
||||
|
||||
using namespace Utils;
|
||||
using namespace Layouting;
|
||||
|
||||
namespace Core {
|
||||
namespace Internal {
|
||||
@@ -83,61 +91,166 @@ class SystemSettingsWidget : public IOptionsPageWidget
|
||||
|
||||
public:
|
||||
SystemSettingsWidget()
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
m_ui.terminalOpenArgs->setToolTip(
|
||||
tr("Command line arguments used for \"%1\".").arg(FileUtils::msgTerminalHereAction()));
|
||||
: m_fileSystemCaseSensitivityChooser(new QComboBox)
|
||||
, m_autoSuspendMinDocumentCount(new QSpinBox)
|
||||
, m_externalFileBrowserEdit(new QLineEdit)
|
||||
, m_autoSuspendCheckBox(new QCheckBox(tr("Auto-suspend unmodified files")))
|
||||
, m_maxRecentFilesSpinBox(new QSpinBox)
|
||||
, m_enableCrashReportingCheckBox(new QCheckBox(tr("Enable crash reporting")))
|
||||
, m_warnBeforeOpeningBigFiles(
|
||||
new QCheckBox(tr("Warn before opening text files greater than")))
|
||||
, m_bigFilesLimitSpinBox(new QSpinBox)
|
||||
, m_terminalComboBox(new QComboBox)
|
||||
, m_terminalOpenArgs(new QLineEdit)
|
||||
, m_terminalExecuteArgs(new QLineEdit)
|
||||
, m_patchChooser(new Utils::PathChooser)
|
||||
, m_environmentChangesLabel(new Utils::ElidingLabel)
|
||||
, m_askBeforeExitCheckBox(new QCheckBox(tr("Ask for confirmation before exiting")))
|
||||
, m_reloadBehavior(new QComboBox)
|
||||
, m_autoSaveCheckBox(new QCheckBox(tr("Auto-save modified files")))
|
||||
, m_clearCrashReportsButton(new QPushButton(tr("Clear Local Crash Reports")))
|
||||
, m_crashReportsSizeText(new QLabel)
|
||||
, m_autoSaveInterval(new QSpinBox)
|
||||
, m_autoSaveRefactoringCheckBox(new QCheckBox(tr("Auto-save files after refactoring")))
|
||||
|
||||
m_ui.reloadBehavior->setCurrentIndex(EditorManager::reloadSetting());
|
||||
{
|
||||
m_autoSuspendCheckBox->setToolTip(
|
||||
tr("Automatically free resources of old documents that are not visible and not "
|
||||
"modified. They stay visible in the list of open documents."));
|
||||
m_autoSuspendMinDocumentCount->setMinimum(1);
|
||||
m_autoSuspendMinDocumentCount->setMaximum(500);
|
||||
m_autoSuspendMinDocumentCount->setValue(30);
|
||||
m_enableCrashReportingCheckBox->setToolTip(
|
||||
tr("Allow crashes to be automatically reported. Collected reports are "
|
||||
"used for the sole purpose of fixing bugs."));
|
||||
m_bigFilesLimitSpinBox->setSuffix(tr("MB"));
|
||||
m_bigFilesLimitSpinBox->setMinimum(1);
|
||||
m_bigFilesLimitSpinBox->setMaximum(500);
|
||||
m_bigFilesLimitSpinBox->setValue(5);
|
||||
m_terminalExecuteArgs->setToolTip(
|
||||
tr("Command line arguments used for \"Run in terminal\"."));
|
||||
QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
sizePolicy.setHorizontalStretch(5);
|
||||
m_environmentChangesLabel->setSizePolicy(sizePolicy);
|
||||
m_reloadBehavior->addItem(tr("Always Ask"));
|
||||
m_reloadBehavior->addItem(tr("Reload All Unchanged Editors"));
|
||||
m_reloadBehavior->addItem(tr("Ignore Modifications"));
|
||||
m_autoSaveInterval->setSuffix(tr("min"));
|
||||
QSizePolicy termSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
|
||||
termSizePolicy.setHorizontalStretch(3);
|
||||
m_terminalComboBox->setSizePolicy(termSizePolicy);
|
||||
m_terminalComboBox->setMinimumSize(QSize(100, 0));
|
||||
m_terminalComboBox->setEditable(true);
|
||||
m_terminalOpenArgs->setToolTip(
|
||||
tr("Command line arguments used for \"%1\".").arg(FileUtils::msgTerminalHereAction()));
|
||||
m_autoSaveInterval->setMinimum(1);
|
||||
|
||||
auto fileSystemCaseSensitivityLabel = new QLabel(tr("File system case sensitivity:"));
|
||||
fileSystemCaseSensitivityLabel->setToolTip(
|
||||
tr("Influences how file names are matched to decide if they are the same."));
|
||||
auto autoSuspendLabel = new QLabel(tr("Files to keep open:"));
|
||||
autoSuspendLabel->setToolTip(
|
||||
tr("Minimum number of open documents that should be kept in memory. Increasing this "
|
||||
"number will lead to greater resource usage when not manually closing documents."));
|
||||
auto resetFileBrowserButton = new QPushButton(tr("Reset"));
|
||||
resetFileBrowserButton->setToolTip(tr("Reset to default."));
|
||||
auto helpExternalFileBrowserButton = new QToolButton;
|
||||
helpExternalFileBrowserButton->setText(tr("?"));
|
||||
auto helpCrashReportingButton = new QToolButton;
|
||||
helpCrashReportingButton->setText(tr("?"));
|
||||
auto resetTerminalButton = new QPushButton(tr("Reset"));
|
||||
resetTerminalButton->setToolTip(tr("Reset to default.", "Terminal"));
|
||||
auto patchCommandLabel = new QLabel(tr("Patch command:"));
|
||||
auto environmentButton = new QPushButton(tr("Change..."));
|
||||
environmentButton->setSizePolicy(QSizePolicy::Fixed,
|
||||
environmentButton->sizePolicy().verticalPolicy());
|
||||
|
||||
Grid form;
|
||||
form.addRow(
|
||||
{tr("Environment:"), Span(2, Row{m_environmentChangesLabel, environmentButton})});
|
||||
if (HostOsInfo::isAnyUnixHost()) {
|
||||
const QVector<TerminalCommand> availableTerminals = TerminalCommand::availableTerminalEmulators();
|
||||
form.addRow({tr("Terminal:"),
|
||||
Span(2,
|
||||
Row{m_terminalComboBox,
|
||||
m_terminalOpenArgs,
|
||||
m_terminalExecuteArgs,
|
||||
resetTerminalButton})});
|
||||
}
|
||||
if (HostOsInfo::isAnyUnixHost() && !HostOsInfo::isMacHost()) {
|
||||
form.addRow({tr("External file browser:"),
|
||||
Span(2,
|
||||
Row{m_externalFileBrowserEdit,
|
||||
resetFileBrowserButton,
|
||||
helpExternalFileBrowserButton})});
|
||||
}
|
||||
form.addRow({patchCommandLabel, Span(2, m_patchChooser)});
|
||||
if (HostOsInfo::isMacHost()) {
|
||||
form.addRow({fileSystemCaseSensitivityLabel,
|
||||
Span(2, Row{m_fileSystemCaseSensitivityChooser, Stretch()})});
|
||||
}
|
||||
form.addRow(
|
||||
{tr("When files are externally modified:"), Span(2, Row{m_reloadBehavior, Stretch()})});
|
||||
form.addRow(
|
||||
{m_autoSaveCheckBox, Span(2, Row{tr("Interval:"), m_autoSaveInterval, Stretch()})});
|
||||
form.addRow(Span(3, m_autoSaveRefactoringCheckBox));
|
||||
form.addRow({m_autoSuspendCheckBox,
|
||||
Span(2, Row{autoSuspendLabel, m_autoSuspendMinDocumentCount, Stretch()})});
|
||||
form.addRow(Span(3, Row{m_warnBeforeOpeningBigFiles, m_bigFilesLimitSpinBox, Stretch()}));
|
||||
form.addRow(Span(3,
|
||||
Row{tr("Maximum number of entries in \"Recent Files\":"),
|
||||
m_maxRecentFilesSpinBox,
|
||||
Stretch()}));
|
||||
form.addRow(m_askBeforeExitCheckBox);
|
||||
#ifdef ENABLE_CRASHPAD
|
||||
form.addRow(
|
||||
Span(3, Row{m_enableCrashReportingCheckBox, helpCrashReportingButton, Stretch()}));
|
||||
form.addRow(Span(3, Row{m_clearCrashReportsButton, m_crashReportsSizeText, Stretch()}));
|
||||
#endif
|
||||
|
||||
Column{Group{Title(tr("System")), form, Stretch()}}.attachTo(this);
|
||||
|
||||
m_reloadBehavior->setCurrentIndex(EditorManager::reloadSetting());
|
||||
if (HostOsInfo::isAnyUnixHost()) {
|
||||
const QVector<TerminalCommand> availableTerminals
|
||||
= TerminalCommand::availableTerminalEmulators();
|
||||
for (const TerminalCommand &term : availableTerminals)
|
||||
m_ui.terminalComboBox->addItem(term.command, QVariant::fromValue(term));
|
||||
m_terminalComboBox->addItem(term.command, QVariant::fromValue(term));
|
||||
updateTerminalUi(TerminalCommand::terminalEmulator());
|
||||
connect(m_ui.terminalComboBox, &QComboBox::currentIndexChanged, this,
|
||||
[this](int index) {
|
||||
updateTerminalUi(m_ui.terminalComboBox->itemData(index).value<TerminalCommand>());
|
||||
connect(m_terminalComboBox, &QComboBox::currentIndexChanged, this, [this](int index) {
|
||||
updateTerminalUi(m_terminalComboBox->itemData(index).value<TerminalCommand>());
|
||||
});
|
||||
} else {
|
||||
m_ui.terminalLabel->hide();
|
||||
m_ui.terminalComboBox->hide();
|
||||
m_ui.terminalOpenArgs->hide();
|
||||
m_ui.terminalExecuteArgs->hide();
|
||||
m_ui.resetTerminalButton->hide();
|
||||
}
|
||||
|
||||
if (HostOsInfo::isAnyUnixHost() && !HostOsInfo::isMacHost()) {
|
||||
m_ui.externalFileBrowserEdit->setText(UnixUtils::fileBrowser(ICore::settings()));
|
||||
} else {
|
||||
m_ui.externalFileBrowserLabel->hide();
|
||||
m_ui.externalFileBrowserWidget->hide();
|
||||
m_externalFileBrowserEdit->setText(UnixUtils::fileBrowser(ICore::settings()));
|
||||
}
|
||||
|
||||
const QString patchToolTip = tr("Command used for reverting diff chunks.");
|
||||
m_ui.patchCommandLabel->setToolTip(patchToolTip);
|
||||
m_ui.patchChooser->setToolTip(patchToolTip);
|
||||
m_ui.patchChooser->setExpectedKind(PathChooser::ExistingCommand);
|
||||
m_ui.patchChooser->setHistoryCompleter(QLatin1String("General.PatchCommand.History"));
|
||||
m_ui.patchChooser->setFilePath(PatchTool::patchCommand());
|
||||
m_ui.autoSaveCheckBox->setChecked(EditorManagerPrivate::autoSaveEnabled());
|
||||
m_ui.autoSaveCheckBox->setToolTip(tr("Automatically creates temporary copies of "
|
||||
"modified files. If %1 is restarted after "
|
||||
"a crash or power failure, it asks whether to "
|
||||
"recover the auto-saved content.")
|
||||
.arg(Constants::IDE_DISPLAY_NAME));
|
||||
m_ui.autoSaveRefactoringCheckBox->setChecked(EditorManager::autoSaveAfterRefactoring());
|
||||
m_ui.autoSaveRefactoringCheckBox->setToolTip(tr("Automatically saves all open files "
|
||||
"affected by a refactoring operation,\n provided they were unmodified before the "
|
||||
"refactoring."));
|
||||
m_ui.autoSaveInterval->setValue(EditorManagerPrivate::autoSaveInterval());
|
||||
m_ui.autoSuspendCheckBox->setChecked(EditorManagerPrivate::autoSuspendEnabled());
|
||||
m_ui.autoSuspendMinDocumentCount->setValue(EditorManagerPrivate::autoSuspendMinDocumentCount());
|
||||
m_ui.warnBeforeOpeningBigFiles->setChecked(
|
||||
EditorManagerPrivate::warnBeforeOpeningBigFilesEnabled());
|
||||
m_ui.bigFilesLimitSpinBox->setValue(EditorManagerPrivate::bigFileSizeLimit());
|
||||
m_ui.maxRecentFilesSpinBox->setMinimum(1);
|
||||
m_ui.maxRecentFilesSpinBox->setMaximum(99);
|
||||
m_ui.maxRecentFilesSpinBox->setValue(EditorManagerPrivate::maxRecentFiles());
|
||||
patchCommandLabel->setToolTip(patchToolTip);
|
||||
m_patchChooser->setToolTip(patchToolTip);
|
||||
m_patchChooser->setExpectedKind(PathChooser::ExistingCommand);
|
||||
m_patchChooser->setHistoryCompleter(QLatin1String("General.PatchCommand.History"));
|
||||
m_patchChooser->setFilePath(PatchTool::patchCommand());
|
||||
m_autoSaveCheckBox->setChecked(EditorManagerPrivate::autoSaveEnabled());
|
||||
m_autoSaveCheckBox->setToolTip(tr("Automatically creates temporary copies of "
|
||||
"modified files. If %1 is restarted after "
|
||||
"a crash or power failure, it asks whether to "
|
||||
"recover the auto-saved content.")
|
||||
.arg(Constants::IDE_DISPLAY_NAME));
|
||||
m_autoSaveRefactoringCheckBox->setChecked(EditorManager::autoSaveAfterRefactoring());
|
||||
m_autoSaveRefactoringCheckBox->setToolTip(
|
||||
tr("Automatically saves all open files "
|
||||
"affected by a refactoring operation,\n provided they were unmodified before the "
|
||||
"refactoring."));
|
||||
m_autoSaveInterval->setValue(EditorManagerPrivate::autoSaveInterval());
|
||||
m_autoSuspendCheckBox->setChecked(EditorManagerPrivate::autoSuspendEnabled());
|
||||
m_autoSuspendMinDocumentCount->setValue(EditorManagerPrivate::autoSuspendMinDocumentCount());
|
||||
m_warnBeforeOpeningBigFiles->setChecked(
|
||||
EditorManagerPrivate::warnBeforeOpeningBigFilesEnabled());
|
||||
m_bigFilesLimitSpinBox->setValue(EditorManagerPrivate::bigFileSizeLimit());
|
||||
m_maxRecentFilesSpinBox->setMinimum(1);
|
||||
m_maxRecentFilesSpinBox->setMaximum(99);
|
||||
m_maxRecentFilesSpinBox->setValue(EditorManagerPrivate::maxRecentFiles());
|
||||
#ifdef ENABLE_CRASHPAD
|
||||
if (ICore::settings()->value(showCrashButtonKey).toBool()) {
|
||||
auto crashButton = new QPushButton("CRASH!!!");
|
||||
@@ -148,12 +261,12 @@ public:
|
||||
});
|
||||
}
|
||||
|
||||
m_ui.enableCrashReportingCheckBox->setChecked(
|
||||
ICore::settings()->value(crashReportingEnabledKey).toBool());
|
||||
connect(m_ui.helpCrashReportingButton, &QAbstractButton::clicked, this, [this] {
|
||||
m_enableCrashReportingCheckBox->setChecked(
|
||||
ICore::settings()->value(crashReportingEnabledKey).toBool());
|
||||
connect(helpCrashReportingButton, &QAbstractButton::clicked, this, [this] {
|
||||
showHelpDialog(tr("Crash Reporting"), CorePlugin::msgCrashpadInformation());
|
||||
});
|
||||
connect(m_ui.enableCrashReportingCheckBox, &QCheckBox::stateChanged, this, [this] {
|
||||
connect(m_enableCrashReportingCheckBox, &QCheckBox::stateChanged, this, [this] {
|
||||
const QString restartText = tr("The change will take effect after restart.");
|
||||
Core::RestartDialog restartDialog(Core::ICore::dialogParent(), restartText);
|
||||
restartDialog.exec();
|
||||
@@ -162,7 +275,7 @@ public:
|
||||
});
|
||||
|
||||
updateClearCrashWidgets();
|
||||
connect(m_ui.clearCrashReportsButton, &QPushButton::clicked, this, [&] {
|
||||
connect(m_clearCrashReportsButton, &QPushButton::clicked, this, [&] {
|
||||
QDir crashReportsDir = ICore::crashReportsPath().toDir();
|
||||
crashReportsDir.setFilter(QDir::Files);
|
||||
const QStringList crashFiles = crashReportsDir.entryList();
|
||||
@@ -170,24 +283,26 @@ public:
|
||||
crashReportsDir.remove(file);
|
||||
updateClearCrashWidgets();
|
||||
});
|
||||
#else
|
||||
m_ui.enableCrashReportingCheckBox->setVisible(false);
|
||||
m_ui.helpCrashReportingButton->setVisible(false);
|
||||
m_ui.clearCrashReportsButton->setVisible(false);
|
||||
m_ui.crashReportsSizeText->setVisible(false);
|
||||
#endif
|
||||
|
||||
m_ui.askBeforeExitCheckBox->setChecked(
|
||||
static_cast<Core::Internal::MainWindow *>(ICore::mainWindow())->askConfirmationBeforeExit());
|
||||
m_askBeforeExitCheckBox->setChecked(
|
||||
static_cast<Core::Internal::MainWindow *>(ICore::mainWindow())
|
||||
->askConfirmationBeforeExit());
|
||||
|
||||
if (HostOsInfo::isAnyUnixHost()) {
|
||||
connect(m_ui.resetTerminalButton, &QAbstractButton::clicked,
|
||||
this, &SystemSettingsWidget::resetTerminal);
|
||||
connect(resetTerminalButton,
|
||||
&QAbstractButton::clicked,
|
||||
this,
|
||||
&SystemSettingsWidget::resetTerminal);
|
||||
if (!HostOsInfo::isMacHost()) {
|
||||
connect(m_ui.resetFileBrowserButton, &QAbstractButton::clicked,
|
||||
this, &SystemSettingsWidget::resetFileBrowser);
|
||||
connect(m_ui.helpExternalFileBrowserButton, &QAbstractButton::clicked,
|
||||
this, &SystemSettingsWidget::showHelpForFileBrowser);
|
||||
connect(resetFileBrowserButton,
|
||||
&QAbstractButton::clicked,
|
||||
this,
|
||||
&SystemSettingsWidget::resetFileBrowser);
|
||||
connect(helpExternalFileBrowserButton,
|
||||
&QAbstractButton::clicked,
|
||||
this,
|
||||
&SystemSettingsWidget::showHelpForFileBrowser);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,38 +310,34 @@ public:
|
||||
Qt::CaseSensitivity defaultSensitivity
|
||||
= OsSpecificAspects::fileNameCaseSensitivity(HostOsInfo::hostOs());
|
||||
if (defaultSensitivity == Qt::CaseSensitive) {
|
||||
m_ui.fileSystemCaseSensitivityChooser->addItem(tr("Case Sensitive (Default)"),
|
||||
Qt::CaseSensitive);
|
||||
m_fileSystemCaseSensitivityChooser->addItem(tr("Case Sensitive (Default)"),
|
||||
Qt::CaseSensitive);
|
||||
} else {
|
||||
m_ui.fileSystemCaseSensitivityChooser->addItem(tr("Case Sensitive"),
|
||||
Qt::CaseSensitive);
|
||||
m_fileSystemCaseSensitivityChooser->addItem(tr("Case Sensitive"), Qt::CaseSensitive);
|
||||
}
|
||||
if (defaultSensitivity == Qt::CaseInsensitive) {
|
||||
m_ui.fileSystemCaseSensitivityChooser->addItem(tr("Case Insensitive (Default)"),
|
||||
Qt::CaseInsensitive);
|
||||
m_fileSystemCaseSensitivityChooser->addItem(tr("Case Insensitive (Default)"),
|
||||
Qt::CaseInsensitive);
|
||||
} else {
|
||||
m_ui.fileSystemCaseSensitivityChooser->addItem(tr("Case Insensitive"),
|
||||
Qt::CaseInsensitive);
|
||||
m_fileSystemCaseSensitivityChooser->addItem(tr("Case Insensitive"),
|
||||
Qt::CaseInsensitive);
|
||||
}
|
||||
const Qt::CaseSensitivity sensitivity = EditorManagerPrivate::readFileSystemSensitivity(
|
||||
ICore::settings());
|
||||
if (sensitivity == Qt::CaseSensitive)
|
||||
m_ui.fileSystemCaseSensitivityChooser->setCurrentIndex(0);
|
||||
m_fileSystemCaseSensitivityChooser->setCurrentIndex(0);
|
||||
else
|
||||
m_ui.fileSystemCaseSensitivityChooser->setCurrentIndex(1);
|
||||
} else {
|
||||
m_ui.fileSystemCaseSensitivityLabel->hide();
|
||||
m_ui.fileSystemCaseSensitivityWidget->hide();
|
||||
m_fileSystemCaseSensitivityChooser->setCurrentIndex(1);
|
||||
}
|
||||
|
||||
updatePath();
|
||||
|
||||
m_ui.environmentChangesLabel->setElideMode(Qt::ElideRight);
|
||||
m_environmentChangesLabel->setElideMode(Qt::ElideRight);
|
||||
m_environmentChanges = CorePlugin::environmentChanges();
|
||||
updateEnvironmentChangesLabel();
|
||||
connect(m_ui.environmentButton, &QPushButton::clicked, [this] {
|
||||
connect(environmentButton, &QPushButton::clicked, this, [this, environmentButton] {
|
||||
Utils::optional<EnvironmentItems> changes
|
||||
= Utils::EnvironmentDialog::getEnvironmentItems(m_ui.environmentButton,
|
||||
= Utils::EnvironmentDialog::getEnvironmentItems(environmentButton,
|
||||
m_environmentChanges);
|
||||
if (!changes)
|
||||
return;
|
||||
@@ -251,7 +362,27 @@ private:
|
||||
void updateClearCrashWidgets();
|
||||
|
||||
void showHelpDialog(const QString &title, const QString &helpText);
|
||||
Ui::SystemSettings m_ui;
|
||||
|
||||
QComboBox *m_fileSystemCaseSensitivityChooser;
|
||||
QSpinBox *m_autoSuspendMinDocumentCount;
|
||||
QLineEdit *m_externalFileBrowserEdit;
|
||||
QCheckBox *m_autoSuspendCheckBox;
|
||||
QSpinBox *m_maxRecentFilesSpinBox;
|
||||
QCheckBox *m_enableCrashReportingCheckBox;
|
||||
QCheckBox *m_warnBeforeOpeningBigFiles;
|
||||
QSpinBox *m_bigFilesLimitSpinBox;
|
||||
QComboBox *m_terminalComboBox;
|
||||
QLineEdit *m_terminalOpenArgs;
|
||||
QLineEdit *m_terminalExecuteArgs;
|
||||
Utils::PathChooser *m_patchChooser;
|
||||
Utils::ElidingLabel *m_environmentChangesLabel;
|
||||
QCheckBox *m_askBeforeExitCheckBox;
|
||||
QComboBox *m_reloadBehavior;
|
||||
QCheckBox *m_autoSaveCheckBox;
|
||||
QPushButton *m_clearCrashReportsButton;
|
||||
QLabel *m_crashReportsSizeText;
|
||||
QSpinBox *m_autoSaveInterval;
|
||||
QCheckBox *m_autoSaveRefactoringCheckBox;
|
||||
QPointer<QMessageBox> m_dialog;
|
||||
EnvironmentItems m_environmentChanges;
|
||||
};
|
||||
@@ -259,39 +390,38 @@ private:
|
||||
void SystemSettingsWidget::apply()
|
||||
{
|
||||
QtcSettings *settings = ICore::settings();
|
||||
EditorManager::setReloadSetting(IDocument::ReloadSetting(m_ui.reloadBehavior->currentIndex()));
|
||||
EditorManager::setReloadSetting(IDocument::ReloadSetting(m_reloadBehavior->currentIndex()));
|
||||
if (HostOsInfo::isAnyUnixHost()) {
|
||||
TerminalCommand::setTerminalEmulator({m_ui.terminalComboBox->lineEdit()->text(),
|
||||
m_ui.terminalOpenArgs->text(),
|
||||
m_ui.terminalExecuteArgs->text()});
|
||||
TerminalCommand::setTerminalEmulator({m_terminalComboBox->lineEdit()->text(),
|
||||
m_terminalOpenArgs->text(),
|
||||
m_terminalExecuteArgs->text()});
|
||||
if (!HostOsInfo::isMacHost()) {
|
||||
UnixUtils::setFileBrowser(settings, m_ui.externalFileBrowserEdit->text());
|
||||
UnixUtils::setFileBrowser(settings, m_externalFileBrowserEdit->text());
|
||||
}
|
||||
}
|
||||
PatchTool::setPatchCommand(m_ui.patchChooser->filePath());
|
||||
EditorManagerPrivate::setAutoSaveEnabled(m_ui.autoSaveCheckBox->isChecked());
|
||||
EditorManagerPrivate::setAutoSaveInterval(m_ui.autoSaveInterval->value());
|
||||
EditorManagerPrivate::setAutoSaveAfterRefactoring(
|
||||
m_ui.autoSaveRefactoringCheckBox->isChecked());
|
||||
EditorManagerPrivate::setAutoSuspendEnabled(m_ui.autoSuspendCheckBox->isChecked());
|
||||
EditorManagerPrivate::setAutoSuspendMinDocumentCount(m_ui.autoSuspendMinDocumentCount->value());
|
||||
PatchTool::setPatchCommand(m_patchChooser->filePath());
|
||||
EditorManagerPrivate::setAutoSaveEnabled(m_autoSaveCheckBox->isChecked());
|
||||
EditorManagerPrivate::setAutoSaveInterval(m_autoSaveInterval->value());
|
||||
EditorManagerPrivate::setAutoSaveAfterRefactoring(m_autoSaveRefactoringCheckBox->isChecked());
|
||||
EditorManagerPrivate::setAutoSuspendEnabled(m_autoSuspendCheckBox->isChecked());
|
||||
EditorManagerPrivate::setAutoSuspendMinDocumentCount(m_autoSuspendMinDocumentCount->value());
|
||||
EditorManagerPrivate::setWarnBeforeOpeningBigFilesEnabled(
|
||||
m_ui.warnBeforeOpeningBigFiles->isChecked());
|
||||
EditorManagerPrivate::setBigFileSizeLimit(m_ui.bigFilesLimitSpinBox->value());
|
||||
EditorManagerPrivate::setMaxRecentFiles(m_ui.maxRecentFilesSpinBox->value());
|
||||
m_warnBeforeOpeningBigFiles->isChecked());
|
||||
EditorManagerPrivate::setBigFileSizeLimit(m_bigFilesLimitSpinBox->value());
|
||||
EditorManagerPrivate::setMaxRecentFiles(m_maxRecentFilesSpinBox->value());
|
||||
#ifdef ENABLE_CRASHPAD
|
||||
ICore::settings()->setValue(crashReportingEnabledKey,
|
||||
m_ui.enableCrashReportingCheckBox->isChecked());
|
||||
m_enableCrashReportingCheckBox->isChecked());
|
||||
#endif
|
||||
|
||||
static_cast<Core::Internal::MainWindow *>(ICore::mainWindow())->setAskConfirmationBeforeExit(
|
||||
m_ui.askBeforeExitCheckBox->isChecked());
|
||||
static_cast<Core::Internal::MainWindow *>(ICore::mainWindow())
|
||||
->setAskConfirmationBeforeExit(m_askBeforeExitCheckBox->isChecked());
|
||||
|
||||
if (HostOsInfo::isMacHost()) {
|
||||
const Qt::CaseSensitivity sensitivity = EditorManagerPrivate::readFileSystemSensitivity(
|
||||
settings);
|
||||
const Qt::CaseSensitivity selectedSensitivity = Qt::CaseSensitivity(
|
||||
m_ui.fileSystemCaseSensitivityChooser->currentData().toInt());
|
||||
m_fileSystemCaseSensitivityChooser->currentData().toInt());
|
||||
if (selectedSensitivity != sensitivity) {
|
||||
EditorManagerPrivate::writeFileSystemSensitivity(settings, selectedSensitivity);
|
||||
RestartDialog dialog(
|
||||
@@ -307,35 +437,35 @@ void SystemSettingsWidget::apply()
|
||||
void SystemSettingsWidget::resetTerminal()
|
||||
{
|
||||
if (HostOsInfo::isAnyUnixHost())
|
||||
m_ui.terminalComboBox->setCurrentIndex(0);
|
||||
m_terminalComboBox->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
void SystemSettingsWidget::updateTerminalUi(const TerminalCommand &term)
|
||||
{
|
||||
m_ui.terminalComboBox->lineEdit()->setText(term.command);
|
||||
m_ui.terminalOpenArgs->setText(term.openArgs);
|
||||
m_ui.terminalExecuteArgs->setText(term.executeArgs);
|
||||
m_terminalComboBox->lineEdit()->setText(term.command);
|
||||
m_terminalOpenArgs->setText(term.openArgs);
|
||||
m_terminalExecuteArgs->setText(term.executeArgs);
|
||||
}
|
||||
|
||||
void SystemSettingsWidget::resetFileBrowser()
|
||||
{
|
||||
if (HostOsInfo::isAnyUnixHost() && !HostOsInfo::isMacHost())
|
||||
m_ui.externalFileBrowserEdit->setText(UnixUtils::defaultFileBrowser());
|
||||
m_externalFileBrowserEdit->setText(UnixUtils::defaultFileBrowser());
|
||||
}
|
||||
|
||||
void SystemSettingsWidget::updatePath()
|
||||
{
|
||||
EnvironmentChange change;
|
||||
change.addAppendToPath(VcsManager::additionalToolsPath());
|
||||
m_ui.patchChooser->setEnvironmentChange(change);
|
||||
m_patchChooser->setEnvironmentChange(change);
|
||||
}
|
||||
|
||||
void SystemSettingsWidget::updateEnvironmentChangesLabel()
|
||||
{
|
||||
const QString shortSummary = Utils::EnvironmentItem::toStringList(m_environmentChanges)
|
||||
.join("; ");
|
||||
m_ui.environmentChangesLabel->setText(shortSummary.isEmpty() ? tr("No changes to apply.")
|
||||
: shortSummary);
|
||||
m_environmentChangesLabel->setText(shortSummary.isEmpty() ? tr("No changes to apply.")
|
||||
: shortSummary);
|
||||
}
|
||||
|
||||
void SystemSettingsWidget::showHelpDialog(const QString &title, const QString &helpText)
|
||||
@@ -367,8 +497,8 @@ void SystemSettingsWidget::updateClearCrashWidgets()
|
||||
for (QString file : crashFiles)
|
||||
size += QFileInfo(crashReportsDir, file).size();
|
||||
|
||||
m_ui.clearCrashReportsButton->setEnabled(!crashFiles.isEmpty());
|
||||
m_ui.crashReportsSizeText->setText(formatSize(size));
|
||||
m_clearCrashReportsButton->setEnabled(!crashFiles.isEmpty());
|
||||
m_crashReportsSizeText->setText(formatSize(size));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user