Commit e1e7c542 authored by Eike Ziller's avatar Eike Ziller

OS X: Provide a setting for file system case sensitivity in preferences

Change-Id: Idaafb55ab4cf1fb1b525f3f911ecff291e035bb2
Task-number: QTCREATORBUG-13507
Reviewed-by: default avatarDaniel Teske <daniel.teske@theqtcompany.com>
Reviewed-by: default avatarLeena Miettinen <riitta-leena.miettinen@theqtcompany.com>
parent 2db21dc2
......@@ -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))
......
......@@ -112,6 +112,31 @@ QWidget *SystemSettings::widget()
}
}
if (HostOsInfo::isMacHost()) {
Qt::CaseSensitivity defaultSensitivity
= OsSpecificAspects(HostOsInfo::hostOs()).fileNameCaseSensitivity();
if (defaultSensitivity == Qt::CaseSensitive) {
m_page->fileSystemCaseSensitivityChooser->addItem(tr("Case Sensitive (Default)"),
Qt::CaseSensitive);
} else {
m_page->fileSystemCaseSensitivityChooser->addItem(tr("Case Sensitive"),
Qt::CaseSensitive);
}
if (defaultSensitivity == Qt::CaseInsensitive) {
m_page->fileSystemCaseSensitivityChooser->addItem(tr("Case Insensitive (Default)"),
Qt::CaseInsensitive);
} else {
m_page->fileSystemCaseSensitivityChooser->addItem(tr("Case Insensitive"),
Qt::CaseInsensitive);
}
if (HostOsInfo::fileNameCaseSensitivity() == Qt::CaseSensitive)
m_page->fileSystemCaseSensitivityChooser->setCurrentIndex(0);
else
m_page->fileSystemCaseSensitivityChooser->setCurrentIndex(1);
} else {
m_page->fileSystemCaseSensitivityWidget->hide();
}
updatePath();
connect(VcsManager::instance(), SIGNAL(configurationChanged(const IVersionControl*)),
......@@ -139,6 +164,17 @@ void SystemSettings::apply()
EditorManagerPrivate::setWarnBeforeOpeningBigFilesEnabled(
m_page->warnBeforeOpeningBigFiles->isChecked());
EditorManagerPrivate::setBigFileSizeLimit(m_page->bigFilesLimitSpinBox->value());
if (HostOsInfo::isMacHost()) {
Qt::CaseSensitivity defaultSensitivity
= OsSpecificAspects(HostOsInfo::hostOs()).fileNameCaseSensitivity();
Qt::CaseSensitivity selectedSensitivity = Qt::CaseSensitivity(
m_page->fileSystemCaseSensitivityChooser->currentData().toInt());
if (defaultSensitivity == selectedSensitivity)
HostOsInfo::unsetOverrideFileNameCaseSensitivity();
else
HostOsInfo::setOverrideFileNameCaseSensitivity(selectedSensitivity);
}
}
void SystemSettings::finish()
......
......@@ -17,6 +17,9 @@
<string>System</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="1" colspan="2">
<widget class="Utils::PathChooser" name="patchChooser" native="true"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="terminalLabel">
<property name="text">
......@@ -24,97 +27,36 @@
</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 row="6" column="0" colspan="4">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="modifiedLabel">
<widget class="QCheckBox" name="warnBeforeOpeningBigFiles">
<property name="text">
<string>When files are externally modified:</string>
<string>Warn before opening text files greater than</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="reloadBehavior">
<property name="currentIndex">
<number>0</number>
<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>
<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">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
......@@ -128,7 +70,7 @@
</item>
</layout>
</item>
<item row="4" column="0" colspan="4">
<item row="5" column="0" colspan="4">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QCheckBox" name="autoSaveCheckBox">
......@@ -191,36 +133,39 @@
</item>
</layout>
</item>
<item row="5" column="0" colspan="4">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item row="4" column="0" colspan="4">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QCheckBox" name="warnBeforeOpeningBigFiles">
<widget class="QLabel" name="modifiedLabel">
<property name="text">
<string>Warn before opening text files greater than</string>
</property>
<property name="checked">
<bool>true</bool>
<string>When files are externally modified:</string>
</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>
<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_4">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
......@@ -234,6 +179,105 @@
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QLabel" name="patchCommandLabel">
<property name="text">
<string>Patch command:</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="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="1">
<widget class="QLineEdit" name="externalFileBrowserEdit"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="externalFileBrowserLabel">
<property name="text">
<string>External file browser:</string>
</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="0" column="1">
<widget class="QComboBox" name="terminalComboBox">
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="0" colspan="4">
<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="QLabel" name="label">
<property name="toolTip">
<string>&lt;html&gt;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>
<widget class="QComboBox" name="fileSystemCaseSensitivityChooser"/>
</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>
</widget>
</item>
</layout>
</widget>
</item>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment