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:
Eike Ziller
2022-07-20 10:42:06 +02:00
parent 4e7daf6ea0
commit 70cfa63cb4
5 changed files with 243 additions and 679 deletions

View File

@@ -265,6 +265,8 @@ static void doLayoutHelper(QLayout *layout,
gridLayout->addWidget(widget, currentGridRow, currentGridColumn, 1, item.span, align); gridLayout->addWidget(widget, currentGridRow, currentGridColumn, 1, item.span, align);
else if (item.layout) else if (item.layout)
gridLayout->addLayout(item.layout, currentGridRow, currentGridColumn, 1, item.span, align); gridLayout->addLayout(item.layout, currentGridRow, currentGridColumn, 1, item.span, align);
else if (!item.text.isEmpty())
gridLayout->addWidget(new QLabel(item.text));
currentGridColumn += item.span; currentGridColumn += item.span;
} else if (boxLayout) { } else if (boxLayout) {
addItemToBoxLayout(boxLayout, item); addItemToBoxLayout(boxLayout, item);

View File

@@ -153,7 +153,7 @@ add_qtc_plugin(Core
sidebarwidget.cpp sidebarwidget.h sidebarwidget.cpp sidebarwidget.h
statusbarmanager.cpp statusbarmanager.h statusbarmanager.cpp statusbarmanager.h
styleanimator.cpp styleanimator.h styleanimator.cpp styleanimator.h
systemsettings.cpp systemsettings.h systemsettings.ui systemsettings.cpp systemsettings.h
textdocument.cpp textdocument.h textdocument.cpp textdocument.h
themechooser.cpp themechooser.h themechooser.cpp themechooser.h
vcsmanager.cpp vcsmanager.h vcsmanager.cpp vcsmanager.h

View File

@@ -166,7 +166,6 @@ Project {
"styleanimator.h", "styleanimator.h",
"systemsettings.cpp", "systemsettings.cpp",
"systemsettings.h", "systemsettings.h",
"systemsettings.ui",
"textdocument.cpp", "textdocument.cpp",
"textdocument.h", "textdocument.h",
"themechooser.cpp", "themechooser.cpp",

View File

@@ -39,19 +39,27 @@
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/checkablemessagebox.h> #include <utils/checkablemessagebox.h>
#include <utils/elidinglabel.h>
#include <utils/environment.h> #include <utils/environment.h>
#include <utils/environmentdialog.h> #include <utils/environmentdialog.h>
#include <utils/hostosinfo.h> #include <utils/hostosinfo.h>
#include <utils/layoutbuilder.h>
#include <utils/pathchooser.h>
#include <utils/terminalcommand.h> #include <utils/terminalcommand.h>
#include <utils/unixutils.h> #include <utils/unixutils.h>
#include <QCheckBox>
#include <QComboBox>
#include <QCoreApplication> #include <QCoreApplication>
#include <QLineEdit>
#include <QMessageBox> #include <QMessageBox>
#include <QPushButton>
#include <QSettings> #include <QSettings>
#include <QSpinBox>
#include "ui_systemsettings.h" #include <QToolButton>
using namespace Utils; using namespace Utils;
using namespace Layouting;
namespace Core { namespace Core {
namespace Internal { namespace Internal {
@@ -83,61 +91,166 @@ class SystemSettingsWidget : public IOptionsPageWidget
public: public:
SystemSettingsWidget() SystemSettingsWidget()
{ : m_fileSystemCaseSensitivityChooser(new QComboBox)
m_ui.setupUi(this); , m_autoSuspendMinDocumentCount(new QSpinBox)
m_ui.terminalOpenArgs->setToolTip( , m_externalFileBrowserEdit(new QLineEdit)
tr("Command line arguments used for \"%1\".").arg(FileUtils::msgTerminalHereAction())); , 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()) { 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) 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()); updateTerminalUi(TerminalCommand::terminalEmulator());
connect(m_ui.terminalComboBox, &QComboBox::currentIndexChanged, this, connect(m_terminalComboBox, &QComboBox::currentIndexChanged, this, [this](int index) {
[this](int index) { updateTerminalUi(m_terminalComboBox->itemData(index).value<TerminalCommand>());
updateTerminalUi(m_ui.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()) { if (HostOsInfo::isAnyUnixHost() && !HostOsInfo::isMacHost()) {
m_ui.externalFileBrowserEdit->setText(UnixUtils::fileBrowser(ICore::settings())); m_externalFileBrowserEdit->setText(UnixUtils::fileBrowser(ICore::settings()));
} else {
m_ui.externalFileBrowserLabel->hide();
m_ui.externalFileBrowserWidget->hide();
} }
const QString patchToolTip = tr("Command used for reverting diff chunks."); const QString patchToolTip = tr("Command used for reverting diff chunks.");
m_ui.patchCommandLabel->setToolTip(patchToolTip); patchCommandLabel->setToolTip(patchToolTip);
m_ui.patchChooser->setToolTip(patchToolTip); m_patchChooser->setToolTip(patchToolTip);
m_ui.patchChooser->setExpectedKind(PathChooser::ExistingCommand); m_patchChooser->setExpectedKind(PathChooser::ExistingCommand);
m_ui.patchChooser->setHistoryCompleter(QLatin1String("General.PatchCommand.History")); m_patchChooser->setHistoryCompleter(QLatin1String("General.PatchCommand.History"));
m_ui.patchChooser->setFilePath(PatchTool::patchCommand()); m_patchChooser->setFilePath(PatchTool::patchCommand());
m_ui.autoSaveCheckBox->setChecked(EditorManagerPrivate::autoSaveEnabled()); m_autoSaveCheckBox->setChecked(EditorManagerPrivate::autoSaveEnabled());
m_ui.autoSaveCheckBox->setToolTip(tr("Automatically creates temporary copies of " m_autoSaveCheckBox->setToolTip(tr("Automatically creates temporary copies of "
"modified files. If %1 is restarted after " "modified files. If %1 is restarted after "
"a crash or power failure, it asks whether to " "a crash or power failure, it asks whether to "
"recover the auto-saved content.") "recover the auto-saved content.")
.arg(Constants::IDE_DISPLAY_NAME)); .arg(Constants::IDE_DISPLAY_NAME));
m_ui.autoSaveRefactoringCheckBox->setChecked(EditorManager::autoSaveAfterRefactoring()); m_autoSaveRefactoringCheckBox->setChecked(EditorManager::autoSaveAfterRefactoring());
m_ui.autoSaveRefactoringCheckBox->setToolTip(tr("Automatically saves all open files " m_autoSaveRefactoringCheckBox->setToolTip(
"affected by a refactoring operation,\n provided they were unmodified before the " tr("Automatically saves all open files "
"refactoring.")); "affected by a refactoring operation,\n provided they were unmodified before the "
m_ui.autoSaveInterval->setValue(EditorManagerPrivate::autoSaveInterval()); "refactoring."));
m_ui.autoSuspendCheckBox->setChecked(EditorManagerPrivate::autoSuspendEnabled()); m_autoSaveInterval->setValue(EditorManagerPrivate::autoSaveInterval());
m_ui.autoSuspendMinDocumentCount->setValue(EditorManagerPrivate::autoSuspendMinDocumentCount()); m_autoSuspendCheckBox->setChecked(EditorManagerPrivate::autoSuspendEnabled());
m_ui.warnBeforeOpeningBigFiles->setChecked( m_autoSuspendMinDocumentCount->setValue(EditorManagerPrivate::autoSuspendMinDocumentCount());
EditorManagerPrivate::warnBeforeOpeningBigFilesEnabled()); m_warnBeforeOpeningBigFiles->setChecked(
m_ui.bigFilesLimitSpinBox->setValue(EditorManagerPrivate::bigFileSizeLimit()); EditorManagerPrivate::warnBeforeOpeningBigFilesEnabled());
m_ui.maxRecentFilesSpinBox->setMinimum(1); m_bigFilesLimitSpinBox->setValue(EditorManagerPrivate::bigFileSizeLimit());
m_ui.maxRecentFilesSpinBox->setMaximum(99); m_maxRecentFilesSpinBox->setMinimum(1);
m_ui.maxRecentFilesSpinBox->setValue(EditorManagerPrivate::maxRecentFiles()); m_maxRecentFilesSpinBox->setMaximum(99);
m_maxRecentFilesSpinBox->setValue(EditorManagerPrivate::maxRecentFiles());
#ifdef ENABLE_CRASHPAD #ifdef ENABLE_CRASHPAD
if (ICore::settings()->value(showCrashButtonKey).toBool()) { if (ICore::settings()->value(showCrashButtonKey).toBool()) {
auto crashButton = new QPushButton("CRASH!!!"); auto crashButton = new QPushButton("CRASH!!!");
@@ -148,12 +261,12 @@ public:
}); });
} }
m_ui.enableCrashReportingCheckBox->setChecked( m_enableCrashReportingCheckBox->setChecked(
ICore::settings()->value(crashReportingEnabledKey).toBool()); ICore::settings()->value(crashReportingEnabledKey).toBool());
connect(m_ui.helpCrashReportingButton, &QAbstractButton::clicked, this, [this] { connect(helpCrashReportingButton, &QAbstractButton::clicked, this, [this] {
showHelpDialog(tr("Crash Reporting"), CorePlugin::msgCrashpadInformation()); 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."); const QString restartText = tr("The change will take effect after restart.");
Core::RestartDialog restartDialog(Core::ICore::dialogParent(), restartText); Core::RestartDialog restartDialog(Core::ICore::dialogParent(), restartText);
restartDialog.exec(); restartDialog.exec();
@@ -162,7 +275,7 @@ public:
}); });
updateClearCrashWidgets(); updateClearCrashWidgets();
connect(m_ui.clearCrashReportsButton, &QPushButton::clicked, this, [&] { connect(m_clearCrashReportsButton, &QPushButton::clicked, this, [&] {
QDir crashReportsDir = ICore::crashReportsPath().toDir(); QDir crashReportsDir = ICore::crashReportsPath().toDir();
crashReportsDir.setFilter(QDir::Files); crashReportsDir.setFilter(QDir::Files);
const QStringList crashFiles = crashReportsDir.entryList(); const QStringList crashFiles = crashReportsDir.entryList();
@@ -170,24 +283,26 @@ public:
crashReportsDir.remove(file); crashReportsDir.remove(file);
updateClearCrashWidgets(); updateClearCrashWidgets();
}); });
#else
m_ui.enableCrashReportingCheckBox->setVisible(false);
m_ui.helpCrashReportingButton->setVisible(false);
m_ui.clearCrashReportsButton->setVisible(false);
m_ui.crashReportsSizeText->setVisible(false);
#endif #endif
m_ui.askBeforeExitCheckBox->setChecked( m_askBeforeExitCheckBox->setChecked(
static_cast<Core::Internal::MainWindow *>(ICore::mainWindow())->askConfirmationBeforeExit()); static_cast<Core::Internal::MainWindow *>(ICore::mainWindow())
->askConfirmationBeforeExit());
if (HostOsInfo::isAnyUnixHost()) { if (HostOsInfo::isAnyUnixHost()) {
connect(m_ui.resetTerminalButton, &QAbstractButton::clicked, connect(resetTerminalButton,
this, &SystemSettingsWidget::resetTerminal); &QAbstractButton::clicked,
this,
&SystemSettingsWidget::resetTerminal);
if (!HostOsInfo::isMacHost()) { if (!HostOsInfo::isMacHost()) {
connect(m_ui.resetFileBrowserButton, &QAbstractButton::clicked, connect(resetFileBrowserButton,
this, &SystemSettingsWidget::resetFileBrowser); &QAbstractButton::clicked,
connect(m_ui.helpExternalFileBrowserButton, &QAbstractButton::clicked, this,
this, &SystemSettingsWidget::showHelpForFileBrowser); &SystemSettingsWidget::resetFileBrowser);
connect(helpExternalFileBrowserButton,
&QAbstractButton::clicked,
this,
&SystemSettingsWidget::showHelpForFileBrowser);
} }
} }
@@ -195,38 +310,34 @@ public:
Qt::CaseSensitivity defaultSensitivity Qt::CaseSensitivity defaultSensitivity
= OsSpecificAspects::fileNameCaseSensitivity(HostOsInfo::hostOs()); = OsSpecificAspects::fileNameCaseSensitivity(HostOsInfo::hostOs());
if (defaultSensitivity == Qt::CaseSensitive) { if (defaultSensitivity == Qt::CaseSensitive) {
m_ui.fileSystemCaseSensitivityChooser->addItem(tr("Case Sensitive (Default)"), m_fileSystemCaseSensitivityChooser->addItem(tr("Case Sensitive (Default)"),
Qt::CaseSensitive); Qt::CaseSensitive);
} else { } else {
m_ui.fileSystemCaseSensitivityChooser->addItem(tr("Case Sensitive"), m_fileSystemCaseSensitivityChooser->addItem(tr("Case Sensitive"), Qt::CaseSensitive);
Qt::CaseSensitive);
} }
if (defaultSensitivity == Qt::CaseInsensitive) { if (defaultSensitivity == Qt::CaseInsensitive) {
m_ui.fileSystemCaseSensitivityChooser->addItem(tr("Case Insensitive (Default)"), m_fileSystemCaseSensitivityChooser->addItem(tr("Case Insensitive (Default)"),
Qt::CaseInsensitive); Qt::CaseInsensitive);
} else { } else {
m_ui.fileSystemCaseSensitivityChooser->addItem(tr("Case Insensitive"), m_fileSystemCaseSensitivityChooser->addItem(tr("Case Insensitive"),
Qt::CaseInsensitive); Qt::CaseInsensitive);
} }
const Qt::CaseSensitivity sensitivity = EditorManagerPrivate::readFileSystemSensitivity( const Qt::CaseSensitivity sensitivity = EditorManagerPrivate::readFileSystemSensitivity(
ICore::settings()); ICore::settings());
if (sensitivity == Qt::CaseSensitive) if (sensitivity == Qt::CaseSensitive)
m_ui.fileSystemCaseSensitivityChooser->setCurrentIndex(0); m_fileSystemCaseSensitivityChooser->setCurrentIndex(0);
else else
m_ui.fileSystemCaseSensitivityChooser->setCurrentIndex(1); m_fileSystemCaseSensitivityChooser->setCurrentIndex(1);
} else {
m_ui.fileSystemCaseSensitivityLabel->hide();
m_ui.fileSystemCaseSensitivityWidget->hide();
} }
updatePath(); updatePath();
m_ui.environmentChangesLabel->setElideMode(Qt::ElideRight); m_environmentChangesLabel->setElideMode(Qt::ElideRight);
m_environmentChanges = CorePlugin::environmentChanges(); m_environmentChanges = CorePlugin::environmentChanges();
updateEnvironmentChangesLabel(); updateEnvironmentChangesLabel();
connect(m_ui.environmentButton, &QPushButton::clicked, [this] { connect(environmentButton, &QPushButton::clicked, this, [this, environmentButton] {
Utils::optional<EnvironmentItems> changes Utils::optional<EnvironmentItems> changes
= Utils::EnvironmentDialog::getEnvironmentItems(m_ui.environmentButton, = Utils::EnvironmentDialog::getEnvironmentItems(environmentButton,
m_environmentChanges); m_environmentChanges);
if (!changes) if (!changes)
return; return;
@@ -251,7 +362,27 @@ private:
void updateClearCrashWidgets(); void updateClearCrashWidgets();
void showHelpDialog(const QString &title, const QString &helpText); 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; QPointer<QMessageBox> m_dialog;
EnvironmentItems m_environmentChanges; EnvironmentItems m_environmentChanges;
}; };
@@ -259,39 +390,38 @@ private:
void SystemSettingsWidget::apply() void SystemSettingsWidget::apply()
{ {
QtcSettings *settings = ICore::settings(); QtcSettings *settings = ICore::settings();
EditorManager::setReloadSetting(IDocument::ReloadSetting(m_ui.reloadBehavior->currentIndex())); EditorManager::setReloadSetting(IDocument::ReloadSetting(m_reloadBehavior->currentIndex()));
if (HostOsInfo::isAnyUnixHost()) { if (HostOsInfo::isAnyUnixHost()) {
TerminalCommand::setTerminalEmulator({m_ui.terminalComboBox->lineEdit()->text(), TerminalCommand::setTerminalEmulator({m_terminalComboBox->lineEdit()->text(),
m_ui.terminalOpenArgs->text(), m_terminalOpenArgs->text(),
m_ui.terminalExecuteArgs->text()}); m_terminalExecuteArgs->text()});
if (!HostOsInfo::isMacHost()) { if (!HostOsInfo::isMacHost()) {
UnixUtils::setFileBrowser(settings, m_ui.externalFileBrowserEdit->text()); UnixUtils::setFileBrowser(settings, m_externalFileBrowserEdit->text());
} }
} }
PatchTool::setPatchCommand(m_ui.patchChooser->filePath()); PatchTool::setPatchCommand(m_patchChooser->filePath());
EditorManagerPrivate::setAutoSaveEnabled(m_ui.autoSaveCheckBox->isChecked()); EditorManagerPrivate::setAutoSaveEnabled(m_autoSaveCheckBox->isChecked());
EditorManagerPrivate::setAutoSaveInterval(m_ui.autoSaveInterval->value()); EditorManagerPrivate::setAutoSaveInterval(m_autoSaveInterval->value());
EditorManagerPrivate::setAutoSaveAfterRefactoring( EditorManagerPrivate::setAutoSaveAfterRefactoring(m_autoSaveRefactoringCheckBox->isChecked());
m_ui.autoSaveRefactoringCheckBox->isChecked()); EditorManagerPrivate::setAutoSuspendEnabled(m_autoSuspendCheckBox->isChecked());
EditorManagerPrivate::setAutoSuspendEnabled(m_ui.autoSuspendCheckBox->isChecked()); EditorManagerPrivate::setAutoSuspendMinDocumentCount(m_autoSuspendMinDocumentCount->value());
EditorManagerPrivate::setAutoSuspendMinDocumentCount(m_ui.autoSuspendMinDocumentCount->value());
EditorManagerPrivate::setWarnBeforeOpeningBigFilesEnabled( EditorManagerPrivate::setWarnBeforeOpeningBigFilesEnabled(
m_ui.warnBeforeOpeningBigFiles->isChecked()); m_warnBeforeOpeningBigFiles->isChecked());
EditorManagerPrivate::setBigFileSizeLimit(m_ui.bigFilesLimitSpinBox->value()); EditorManagerPrivate::setBigFileSizeLimit(m_bigFilesLimitSpinBox->value());
EditorManagerPrivate::setMaxRecentFiles(m_ui.maxRecentFilesSpinBox->value()); EditorManagerPrivate::setMaxRecentFiles(m_maxRecentFilesSpinBox->value());
#ifdef ENABLE_CRASHPAD #ifdef ENABLE_CRASHPAD
ICore::settings()->setValue(crashReportingEnabledKey, ICore::settings()->setValue(crashReportingEnabledKey,
m_ui.enableCrashReportingCheckBox->isChecked()); m_enableCrashReportingCheckBox->isChecked());
#endif #endif
static_cast<Core::Internal::MainWindow *>(ICore::mainWindow())->setAskConfirmationBeforeExit( static_cast<Core::Internal::MainWindow *>(ICore::mainWindow())
m_ui.askBeforeExitCheckBox->isChecked()); ->setAskConfirmationBeforeExit(m_askBeforeExitCheckBox->isChecked());
if (HostOsInfo::isMacHost()) { if (HostOsInfo::isMacHost()) {
const Qt::CaseSensitivity sensitivity = EditorManagerPrivate::readFileSystemSensitivity( const Qt::CaseSensitivity sensitivity = EditorManagerPrivate::readFileSystemSensitivity(
settings); settings);
const Qt::CaseSensitivity selectedSensitivity = Qt::CaseSensitivity( const Qt::CaseSensitivity selectedSensitivity = Qt::CaseSensitivity(
m_ui.fileSystemCaseSensitivityChooser->currentData().toInt()); m_fileSystemCaseSensitivityChooser->currentData().toInt());
if (selectedSensitivity != sensitivity) { if (selectedSensitivity != sensitivity) {
EditorManagerPrivate::writeFileSystemSensitivity(settings, selectedSensitivity); EditorManagerPrivate::writeFileSystemSensitivity(settings, selectedSensitivity);
RestartDialog dialog( RestartDialog dialog(
@@ -307,35 +437,35 @@ void SystemSettingsWidget::apply()
void SystemSettingsWidget::resetTerminal() void SystemSettingsWidget::resetTerminal()
{ {
if (HostOsInfo::isAnyUnixHost()) if (HostOsInfo::isAnyUnixHost())
m_ui.terminalComboBox->setCurrentIndex(0); m_terminalComboBox->setCurrentIndex(0);
} }
void SystemSettingsWidget::updateTerminalUi(const TerminalCommand &term) void SystemSettingsWidget::updateTerminalUi(const TerminalCommand &term)
{ {
m_ui.terminalComboBox->lineEdit()->setText(term.command); m_terminalComboBox->lineEdit()->setText(term.command);
m_ui.terminalOpenArgs->setText(term.openArgs); m_terminalOpenArgs->setText(term.openArgs);
m_ui.terminalExecuteArgs->setText(term.executeArgs); m_terminalExecuteArgs->setText(term.executeArgs);
} }
void SystemSettingsWidget::resetFileBrowser() void SystemSettingsWidget::resetFileBrowser()
{ {
if (HostOsInfo::isAnyUnixHost() && !HostOsInfo::isMacHost()) if (HostOsInfo::isAnyUnixHost() && !HostOsInfo::isMacHost())
m_ui.externalFileBrowserEdit->setText(UnixUtils::defaultFileBrowser()); m_externalFileBrowserEdit->setText(UnixUtils::defaultFileBrowser());
} }
void SystemSettingsWidget::updatePath() void SystemSettingsWidget::updatePath()
{ {
EnvironmentChange change; EnvironmentChange change;
change.addAppendToPath(VcsManager::additionalToolsPath()); change.addAppendToPath(VcsManager::additionalToolsPath());
m_ui.patchChooser->setEnvironmentChange(change); m_patchChooser->setEnvironmentChange(change);
} }
void SystemSettingsWidget::updateEnvironmentChangesLabel() void SystemSettingsWidget::updateEnvironmentChangesLabel()
{ {
const QString shortSummary = Utils::EnvironmentItem::toStringList(m_environmentChanges) const QString shortSummary = Utils::EnvironmentItem::toStringList(m_environmentChanges)
.join("; "); .join("; ");
m_ui.environmentChangesLabel->setText(shortSummary.isEmpty() ? tr("No changes to apply.") m_environmentChangesLabel->setText(shortSummary.isEmpty() ? tr("No changes to apply.")
: shortSummary); : shortSummary);
} }
void SystemSettingsWidget::showHelpDialog(const QString &title, const QString &helpText) void SystemSettingsWidget::showHelpDialog(const QString &title, const QString &helpText)
@@ -367,8 +497,8 @@ void SystemSettingsWidget::updateClearCrashWidgets()
for (QString file : crashFiles) for (QString file : crashFiles)
size += QFileInfo(crashReportsDir, file).size(); size += QFileInfo(crashReportsDir, file).size();
m_ui.clearCrashReportsButton->setEnabled(!crashFiles.isEmpty()); m_clearCrashReportsButton->setEnabled(!crashFiles.isEmpty());
m_ui.crashReportsSizeText->setText(formatSize(size)); m_crashReportsSizeText->setText(formatSize(size));
} }
#endif #endif

View File

@@ -1,567 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Core::Internal::SystemSettings</class>
<widget class="QWidget" name="Core::Internal::SystemSettings">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>628</width>
<height>545</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="systemBox">
<property name="title">
<string>System</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="0">
<widget class="QLabel" name="terminalLabel">
<property name="text">
<string>Terminal:</string>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<widget class="QWidget" name="fileSystemCaseSensitivityWidget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QComboBox" name="fileSystemCaseSensitivityChooser"/>
</item>
<item>
<spacer name="fileSystemCaseSensitivitySpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>202</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="fileSystemCaseSensitivityLabel">
<property name="toolTip">
<string>Influences how file names are matched to decide if they are the same.</string>
</property>
<property name="text">
<string>File system case sensitivity:</string>
</property>
</widget>
</item>
<item row="8" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="autoSuspendLabel">
<property name="toolTip">
<string>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.</string>
</property>
<property name="text">
<string>Files to keep open:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="autoSuspendMinDocumentCount">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>500</number>
</property>
<property name="value">
<number>30</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="1" colspan="2">
<widget class="QWidget" name="externalFileBrowserWidget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_9">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLineEdit" name="externalFileBrowserEdit"/>
</item>
<item>
<widget class="QPushButton" name="resetFileBrowserButton">
<property name="toolTip">
<string comment="File Browser">Reset to default.</string>
</property>
<property name="text">
<string>Reset</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="helpExternalFileBrowserButton">
<property name="text">
<string>?</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="10" column="0" colspan="2">
<widget class="QLabel" name="maxRecentFilesLabel">
<property name="text">
<string>Maximum number of entries in &quot;Recent Files&quot;:</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QCheckBox" name="autoSuspendCheckBox">
<property name="toolTip">
<string>Automatically free resources of old documents that are not visible and not modified. They stay visible in the list of open documents.</string>
</property>
<property name="text">
<string>Auto-suspend unmodified files</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="10" column="2">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QSpinBox" name="maxRecentFilesSpinBox"/>
</item>
<item>
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QLabel" name="environmentLabel">
<property name="text">
<string>Environment:</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="modifiedLabel">
<property name="text">
<string>When files are externally modified:</string>
</property>
</widget>
</item>
<item row="12" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>
<widget class="QCheckBox" name="enableCrashReportingCheckBox">
<property name="toolTip">
<string>Allow crashes to be automatically reported. Collected reports are used for the sole purpose of fixing bugs.</string>
</property>
<property name="text">
<string>Enable crash reporting</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="helpCrashReportingButton">
<property name="text">
<string>?</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="9" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QCheckBox" name="warnBeforeOpeningBigFiles">
<property name="text">
<string>Warn before opening text files greater than</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="bigFilesLimitSpinBox">
<property name="suffix">
<string>MB</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>500</number>
</property>
<property name="value">
<number>5</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="1" colspan="2">
<widget class="QWidget" name="terminalWidget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_8">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QComboBox" name="terminalComboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Fixed">
<horstretch>3</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="terminalOpenArgs"/>
</item>
<item>
<widget class="QLineEdit" name="terminalExecuteArgs">
<property name="toolTip">
<string>Command line arguments used for &quot;Run in terminal&quot;.</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="resetTerminalButton">
<property name="toolTip">
<string comment="Terminal">Reset to default.</string>
</property>
<property name="text">
<string>Reset</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="patchCommandLabel">
<property name="text">
<string>Patch command:</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="Utils::PathChooser" name="patchChooser" native="true"/>
</item>
<item row="0" column="1" colspan="2">
<widget class="QWidget" name="environmentWidget" native="true">
<layout class="QHBoxLayout" name="environmentLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="Utils::ElidingLabel" name="environmentChangesLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>5</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="environmentButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Change...</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="11" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QCheckBox" name="askBeforeExitCheckBox">
<property name="text">
<string>Ask for confirmation before exiting</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="5" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QComboBox" name="reloadBehavior">
<property name="currentIndex">
<number>0</number>
</property>
<item>
<property name="text">
<string>Always Ask</string>
</property>
</item>
<item>
<property name="text">
<string>Reload All Unchanged Editors</string>
</property>
</item>
<item>
<property name="text">
<string>Ignore Modifications</string>
</property>
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QLabel" name="externalFileBrowserLabel">
<property name="text">
<string>External file browser:</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="autoSaveCheckBox">
<property name="text">
<string>Auto-save modified files</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="13" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_11">
<item>
<widget class="QPushButton" name="clearCrashReportsButton">
<property name="text">
<string>Clear Local Crash Reports</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="crashReportsSizeText">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item row="6" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="autoSaveIntervalLabel">
<property name="text">
<string>Interval:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="autoSaveInterval">
<property name="suffix">
<string extracomment="unit for minutes">min</string>
</property>
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="7" column="0">
<widget class="QCheckBox" name="autoSaveRefactoringCheckBox">
<property name="text">
<string>Auto-save files after refactoring</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>30</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Utils::PathChooser</class>
<extends>QWidget</extends>
<header location="global">utils/pathchooser.h</header>
<container>1</container>
<slots>
<signal>editingFinished()</signal>
<signal>browsingFinished()</signal>
</slots>
</customwidget>
<customwidget>
<class>Utils::ElidingLabel</class>
<extends>QLabel</extends>
<header location="global">utils/elidinglabel.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>resetTerminalButton</tabstop>
<tabstop>externalFileBrowserEdit</tabstop>
<tabstop>resetFileBrowserButton</tabstop>
<tabstop>helpExternalFileBrowserButton</tabstop>
<tabstop>reloadBehavior</tabstop>
<tabstop>autoSaveCheckBox</tabstop>
<tabstop>autoSaveInterval</tabstop>
<tabstop>autoSuspendCheckBox</tabstop>
<tabstop>autoSuspendMinDocumentCount</tabstop>
<tabstop>warnBeforeOpeningBigFiles</tabstop>
<tabstop>bigFilesLimitSpinBox</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>