Commit 5b28c52e authored by Eike Ziller's avatar Eike Ziller
Browse files

Merge branch 'master' of git://code.qt.io/qt-creator/qt-creator

Change-Id: I6a443be7541d1f79ab8dabc1b5c4f1d88368fc87
parents 3b1a966c e1e7c542
......@@ -232,10 +232,11 @@ const char WIZARD_KIND_FILE[] = "file";
const char SETTINGS_CATEGORY_CORE[] = "A.Core";
const char SETTINGS_CATEGORY_CORE_ICON[] = ":/core/images/category_core.png";
const char SETTINGS_TR_CATEGORY_CORE[] = QT_TRANSLATE_NOOP("Core", "Environment");
const char SETTINGS_ID_ENVIRONMENT[] = "A.General";
const char SETTINGS_ID_SHORTCUTS[] = "B.Keyboard";
const char SETTINGS_ID_TOOLS[] = "C.ExternalTools";
const char SETTINGS_ID_MIMETYPES[] = "D.MimeTypes";
const char SETTINGS_ID_INTERFACE[] = "A.Interface";
const char SETTINGS_ID_SYSTEM[] = "B.Core.System";
const char SETTINGS_ID_SHORTCUTS[] = "C.Keyboard";
const char SETTINGS_ID_TOOLS[] = "D.ExternalTools";
const char SETTINGS_ID_MIMETYPES[] = "E.MimeTypes";
const char SETTINGS_DEFAULTTEXTENCODING[] = "General/DefaultFileEncoding";
......
......@@ -116,7 +116,8 @@ SOURCES += corejsextensions.cpp \
themeeditor/themesettingsitemdelegate.cpp \
messagebox.cpp \
iwelcomepage.cpp \
externaltoolmanager.cpp
externaltoolmanager.cpp \
systemsettings.cpp
HEADERS += corejsextensions.h \
mainwindow.h \
......@@ -232,7 +233,8 @@ HEADERS += corejsextensions.h \
themeeditor/sectionedtablemodel.h \
themeeditor/themesettingsitemdelegate.h \
messagebox.h \
iwelcomepage.h
iwelcomepage.h \
systemsettings.h
FORMS += dialogs/newdialog.ui \
dialogs/saveitemsdialog.ui \
......@@ -245,7 +247,8 @@ FORMS += dialogs/newdialog.ui \
mimetypemagicdialog.ui \
removefiledialog.ui \
dialogs/addtovcsdialog.ui \
themeeditor/themeeditorwidget.ui
themeeditor/themeeditorwidget.ui \
systemsettings.ui
RESOURCES += core.qrc \
fancyactionbar.qrc
......
......@@ -97,6 +97,7 @@ QtcPlugin {
"statusbarmanager.cpp", "statusbarmanager.h",
"statusbarwidget.cpp", "statusbarwidget.h",
"styleanimator.cpp", "styleanimator.h",
"systemsettings.cpp", "systemsettings.h", "systemsettings.ui",
"textdocument.cpp", "textdocument.h",
"themesettings.cpp", "themesettings.h", "themesettings.ui",
"themesettingswidget.cpp", "themesettingswidget.h",
......
......@@ -110,6 +110,7 @@ static const char autoSaveEnabledKey[] = "EditorManager/AutoSaveEnabled";
static const char autoSaveIntervalKey[] = "EditorManager/AutoSaveInterval";
static const char warnBeforeOpeningBigTextFilesKey[] = "EditorManager/WarnBeforeOpeningBigTextFiles";
static const char bigTextFileSizeLimitKey[] = "EditorManager/BigTextFileSizeLimitInMB";
static const char fileSystemCaseSensitivityKey[] = "Core/FileSystemCaseSensitivity";
static const char scratchBufferKey[] = "_q_emScratchBuffer";
......@@ -1014,6 +1015,14 @@ void EditorManagerPrivate::saveSettings()
qsettings->setValue(QLatin1String(warnBeforeOpeningBigTextFilesKey),
d->m_warnBeforeOpeningBigFilesEnabled);
qsettings->setValue(QLatin1String(bigTextFileSizeLimitKey), d->m_bigFileSizeLimitInMB);
Qt::CaseSensitivity defaultSensitivity
= OsSpecificAspects(HostOsInfo::hostOs()).fileNameCaseSensitivity();
Qt::CaseSensitivity sensitivity = HostOsInfo::fileNameCaseSensitivity();
if (defaultSensitivity == sensitivity)
qsettings->remove(QLatin1String(fileSystemCaseSensitivityKey));
else
qsettings->setValue(QLatin1String(fileSystemCaseSensitivityKey), sensitivity);
}
void EditorManagerPrivate::readSettings()
......@@ -1033,6 +1042,27 @@ void EditorManagerPrivate::readSettings()
d->m_bigFileSizeLimitInMB = qs->value(QLatin1String(bigTextFileSizeLimitKey)).toInt();
}
if (qs->contains(QLatin1String(fileSystemCaseSensitivityKey))) {
Qt::CaseSensitivity defaultSensitivity
= OsSpecificAspects(HostOsInfo::hostOs()).fileNameCaseSensitivity();
bool ok = false;
Qt::CaseSensitivity sensitivity = defaultSensitivity;
int sensitivitySetting = qs->value(QLatin1String(fileSystemCaseSensitivityKey)).toInt(&ok);
if (ok) {
switch (Qt::CaseSensitivity(sensitivitySetting)) {
case Qt::CaseSensitive:
sensitivity = Qt::CaseSensitive;
break;
case Qt::CaseInsensitive:
sensitivity = Qt::CaseInsensitive;
}
}
if (sensitivity == defaultSensitivity)
HostOsInfo::unsetOverrideFileNameCaseSensitivity();
else
HostOsInfo::setOverrideFileNameCaseSensitivity(sensitivity);
}
SettingsDatabase *settings = ICore::settingsDatabase();
if (settings->contains(QLatin1String(documentStatesKey)))
d->m_editorStates = settings->value(QLatin1String(documentStatesKey))
......
......@@ -67,7 +67,7 @@ static void showGraphicalShellError(QWidget *parent, const QString &app, const Q
QMessageBox::ActionRole);
mbox.exec();
if (mbox.clickedButton() == settingsButton)
ICore::showOptionsDialog(Constants::SETTINGS_ID_ENVIRONMENT, parent);
ICore::showOptionsDialog(Constants::SETTINGS_ID_INTERFACE, parent);
}
void FileUtils::showInGraphicalShell(QWidget *parent, const QString &pathIn)
......
......@@ -32,23 +32,15 @@
#include "coreconstants.h"
#include "icore.h"
#include "infobar.h"
#include "patchtool.h"
#include "vcsmanager.h"
#include "editormanager/editormanager_p.h"
#include <utils/checkablemessagebox.h>
#include <utils/consoleprocess.h>
#include <utils/environment.h>
#include <utils/hostosinfo.h>
#include <utils/stylehelper.h>
#include <utils/unixutils.h>
#include <QCoreApplication>
#include <QDir>
#include <QLibraryInfo>
#include <QMessageBox>
#include <QSettings>
#include <QTextStream>
#include "ui_generalsettings.h"
......@@ -60,8 +52,8 @@ namespace Internal {
GeneralSettings::GeneralSettings()
: m_page(0), m_dialog(0)
{
setId(Constants::SETTINGS_ID_ENVIRONMENT);
setDisplayName(tr("General"));
setId(Constants::SETTINGS_ID_INTERFACE);
setDisplayName(tr("Interface"));
setCategory(Constants::SETTINGS_CATEGORY_CORE);
setDisplayCategory(QCoreApplication::translate("Core", Constants::SETTINGS_TR_CATEGORY_CORE));
setCategoryIcon(QLatin1String(Constants::SETTINGS_CATEGORY_CORE_ICON));
......@@ -114,58 +106,12 @@ QWidget *GeneralSettings::widget()
fillLanguageBox();
m_page->colorButton->setColor(StyleHelper::requestedBaseColor());
m_page->reloadBehavior->setCurrentIndex(EditorManager::reloadSetting());
if (HostOsInfo::isAnyUnixHost()) {
const QStringList availableTerminals = ConsoleProcess::availableTerminalEmulators();
const QString currentTerminal = ConsoleProcess::terminalEmulator(ICore::settings(), false);
m_page->terminalComboBox->addItems(availableTerminals);
m_page->terminalComboBox->lineEdit()->setText(currentTerminal);
m_page->terminalComboBox->lineEdit()->setPlaceholderText(ConsoleProcess::defaultTerminalEmulator());
} else {
m_page->terminalLabel->hide();
m_page->terminalComboBox->hide();
m_page->resetTerminalButton->hide();
}
if (HostOsInfo::isAnyUnixHost() && !HostOsInfo::isMacHost()) {
m_page->externalFileBrowserEdit->setText(UnixUtils::fileBrowser(ICore::settings()));
} else {
m_page->externalFileBrowserLabel->hide();
m_page->externalFileBrowserEdit->hide();
m_page->resetFileBrowserButton->hide();
m_page->helpExternalFileBrowserButton->hide();
}
const QString patchToolTip = tr("Command used for reverting diff chunks.");
m_page->patchCommandLabel->setToolTip(patchToolTip);
m_page->patchChooser->setToolTip(patchToolTip);
m_page->patchChooser->setExpectedKind(PathChooser::ExistingCommand);
m_page->patchChooser->setHistoryCompleter(QLatin1String("General.PatchCommand.History"));
m_page->patchChooser->setPath(PatchTool::patchCommand());
m_page->autoSaveCheckBox->setChecked(EditorManagerPrivate::autoSaveEnabled());
m_page->autoSaveInterval->setValue(EditorManagerPrivate::autoSaveInterval());
m_page->warnBeforeOpeningBigFiles->setChecked(
EditorManagerPrivate::warnBeforeOpeningBigFilesEnabled());
m_page->bigFilesLimitSpinBox->setValue(EditorManagerPrivate::bigFileSizeLimit());
m_page->resetWarningsButton->setEnabled(canResetWarnings());
connect(m_page->resetColorButton, SIGNAL(clicked()),
this, SLOT(resetInterfaceColor()));
connect(m_page->resetWarningsButton, SIGNAL(clicked()),
this, SLOT(resetWarnings()));
if (HostOsInfo::isAnyUnixHost()) {
connect(m_page->resetTerminalButton, SIGNAL(clicked()), this, SLOT(resetTerminal()));
if (!HostOsInfo::isMacHost()) {
connect(m_page->resetFileBrowserButton, SIGNAL(clicked()), this, SLOT(resetFileBrowser()));
connect(m_page->helpExternalFileBrowserButton, SIGNAL(clicked()),
this, SLOT(showHelpForFileBrowser()));
}
}
updatePath();
connect(VcsManager::instance(), SIGNAL(configurationChanged(const IVersionControl*)),
this, SLOT(updatePath()));
}
return m_widget;
}
......@@ -178,21 +124,6 @@ void GeneralSettings::apply()
setLanguage(m_page->languageBox->itemData(currentIndex, Qt::UserRole).toString());
// Apply the new base color if accepted
StyleHelper::setBaseColor(m_page->colorButton->color());
EditorManager::setReloadSetting(IDocument::ReloadSetting(m_page->reloadBehavior->currentIndex()));
if (HostOsInfo::isAnyUnixHost()) {
ConsoleProcess::setTerminalEmulator(ICore::settings(),
m_page->terminalComboBox->lineEdit()->text());
if (!HostOsInfo::isMacHost()) {
UnixUtils::setFileBrowser(ICore::settings(),
m_page->externalFileBrowserEdit->text());
}
}
PatchTool::setPatchCommand(m_page->patchChooser->path());
EditorManagerPrivate::setAutoSaveEnabled(m_page->autoSaveCheckBox->isChecked());
EditorManagerPrivate::setAutoSaveInterval(m_page->autoSaveInterval->value());
EditorManagerPrivate::setWarnBeforeOpeningBigFilesEnabled(
m_page->warnBeforeOpeningBigFiles->isChecked());
EditorManagerPrivate::setBigFileSizeLimit(m_page->bigFilesLimitSpinBox->value());
m_page->themeWidget->apply();
}
......@@ -212,62 +143,13 @@ void GeneralSettings::resetWarnings()
{
InfoBar::clearGloballySuppressed();
CheckableMessageBox::resetAllDoNotAskAgainQuestions(ICore::settings());
m_page->warnBeforeOpeningBigFiles->setChecked(true);
m_page->resetWarningsButton->setEnabled(false);
}
void GeneralSettings::resetTerminal()
{
if (HostOsInfo::isAnyUnixHost())
m_page->terminalComboBox->lineEdit()->clear();
}
void GeneralSettings::resetFileBrowser()
{
if (HostOsInfo::isAnyUnixHost() && !HostOsInfo::isMacHost())
m_page->externalFileBrowserEdit->setText(UnixUtils::defaultFileBrowser());
}
void GeneralSettings::updatePath()
{
Environment env = Environment::systemEnvironment();
QStringList toAdd = VcsManager::additionalToolsPath();
env.appendOrSetPath(toAdd.join(HostOsInfo::pathListSeparator()));
m_page->patchChooser->setEnvironment(env);
}
bool GeneralSettings::canResetWarnings() const
{
return InfoBar::anyGloballySuppressed()
|| CheckableMessageBox::hasSuppressedQuestions(ICore::settings())
|| !EditorManagerPrivate::warnBeforeOpeningBigFilesEnabled();
}
void GeneralSettings::variableHelpDialogCreator(const QString &helpText)
{
if (m_dialog) {
if (m_dialog->text() != helpText)
m_dialog->setText(helpText);
m_dialog->show();
ICore::raiseWindow(m_dialog);
return;
}
QMessageBox *mb = new QMessageBox(QMessageBox::Information,
tr("Variables"),
helpText,
QMessageBox::Close,
m_widget);
mb->setWindowModality(Qt::NonModal);
m_dialog = mb;
mb->show();
}
void GeneralSettings::showHelpForFileBrowser()
{
if (HostOsInfo::isAnyUnixHost() && !HostOsInfo::isMacHost())
variableHelpDialogCreator(UnixUtils::fileBrowserHelpText());
|| CheckableMessageBox::hasSuppressedQuestions(ICore::settings());
}
void GeneralSettings::resetLanguage()
......
......@@ -58,14 +58,9 @@ private slots:
void resetInterfaceColor();
void resetWarnings();
void resetLanguage();
void showHelpForFileBrowser();
void resetFileBrowser();
void resetTerminal();
void updatePath();
private:
bool canResetWarnings() const;
void variableHelpDialogCreator(const QString &helpText);
void fillLanguageBox() const;
QString language() const;
void setLanguage(const QString&);
......
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>527</width>
<height>366</height>
<height>469</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
......@@ -22,9 +22,6 @@
<property name="text">
<string>Color:</string>
</property>
<property name="buddy">
<cstring>colorButton</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
......@@ -130,232 +127,6 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="systemBox">
<property name="title">
<string>System</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="terminalLabel">
<property name="text">
<string>Terminal:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="terminalComboBox">
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<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>
<item row="1" column="0">
<widget class="QLabel" name="externalFileBrowserLabel">
<property name="text">
<string>External file browser:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="externalFileBrowserEdit"/>
</item>
<item row="1" column="2">
<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 row="1" column="3">
<widget class="QToolButton" name="helpExternalFileBrowserButton">
<property name="text">
<string>?</string>
</property>
<property name="icon">
<iconset resource="core.qrc">
<normaloff>:/core/images/help.png</normaloff>:/core/images/help.png</iconset>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="patchCommandLabel">
<property name="text">
<string>Patch command:</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="Utils::PathChooser" name="patchChooser" native="true"/>
</item>
<item row="3" column="0" colspan="4">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="modifiedLabel">
<property name="text">
<string>When files are externally modified:</string>
</property>
</widget>
</item>
<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="4" column="0" colspan="4">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QCheckBox" name="autoSaveCheckBox">
<property name="toolTip">
<string>Automatically creates temporary copies of modified files. If Qt Creator is restarted after a crash or power failure, it asks whether to recover the auto-saved content.</string>
</property>
<property name="text">
<string>Auto-save modified files</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<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="5" column="0" colspan="4">
<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>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
......@@ -377,16 +148,6 @@
<extends>QToolButton</extends>
<header location="global">utils/qtcolorbutton.h</header>
</customwidget>
<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>Core::Internal::ThemeSettingsWidget</class>
<extends>QWidget</extends>
......@@ -394,41 +155,6 @@
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="core.qrc"/>
</resources>
<connections>
<connection>
<sender>autoSaveCheckBox</sender>
<signal>toggled(bool)</signal>
<receiver>autoSaveInterval</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>181</x>
<y>310</y>
</hint>
<hint type="destinationlabel">
<x>340</x>
<y>311</y>
</hint>
</hints>
</connection>