Commit e1e7c542 authored by Eike Ziller's avatar Eike Ziller
Browse files

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"; ...@@ -110,6 +110,7 @@ static const char autoSaveEnabledKey[] = "EditorManager/AutoSaveEnabled";
static const char autoSaveIntervalKey[] = "EditorManager/AutoSaveInterval"; static const char autoSaveIntervalKey[] = "EditorManager/AutoSaveInterval";
static const char warnBeforeOpeningBigTextFilesKey[] = "EditorManager/WarnBeforeOpeningBigTextFiles"; static const char warnBeforeOpeningBigTextFilesKey[] = "EditorManager/WarnBeforeOpeningBigTextFiles";
static const char bigTextFileSizeLimitKey[] = "EditorManager/BigTextFileSizeLimitInMB"; static const char bigTextFileSizeLimitKey[] = "EditorManager/BigTextFileSizeLimitInMB";
static const char fileSystemCaseSensitivityKey[] = "Core/FileSystemCaseSensitivity";
static const char scratchBufferKey[] = "_q_emScratchBuffer"; static const char scratchBufferKey[] = "_q_emScratchBuffer";
...@@ -1014,6 +1015,14 @@ void EditorManagerPrivate::saveSettings() ...@@ -1014,6 +1015,14 @@ void EditorManagerPrivate::saveSettings()
qsettings->setValue(QLatin1String(warnBeforeOpeningBigTextFilesKey), qsettings->setValue(QLatin1String(warnBeforeOpeningBigTextFilesKey),
d->m_warnBeforeOpeningBigFilesEnabled); d->m_warnBeforeOpeningBigFilesEnabled);
qsettings->setValue(QLatin1String(bigTextFileSizeLimitKey), d->m_bigFileSizeLimitInMB); 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() void EditorManagerPrivate::readSettings()
...@@ -1033,6 +1042,27 @@ void EditorManagerPrivate::readSettings() ...@@ -1033,6 +1042,27 @@ void EditorManagerPrivate::readSettings()
d->m_bigFileSizeLimitInMB = qs->value(QLatin1String(bigTextFileSizeLimitKey)).toInt(); 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(); SettingsDatabase *settings = ICore::settingsDatabase();
if (settings->contains(QLatin1String(documentStatesKey))) if (settings->contains(QLatin1String(documentStatesKey)))
d->m_editorStates = settings->value(QLatin1String(documentStatesKey)) d->m_editorStates = settings->value(QLatin1String(documentStatesKey))
......
...@@ -112,6 +112,31 @@ QWidget *SystemSettings::widget() ...@@ -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(); updatePath();
connect(VcsManager::instance(), SIGNAL(configurationChanged(const IVersionControl*)), connect(VcsManager::instance(), SIGNAL(configurationChanged(const IVersionControl*)),
...@@ -139,6 +164,17 @@ void SystemSettings::apply() ...@@ -139,6 +164,17 @@ void SystemSettings::apply()
EditorManagerPrivate::setWarnBeforeOpeningBigFilesEnabled( EditorManagerPrivate::setWarnBeforeOpeningBigFilesEnabled(
m_page->warnBeforeOpeningBigFiles->isChecked()); m_page->warnBeforeOpeningBigFiles->isChecked());
EditorManagerPrivate::setBigFileSizeLimit(m_page->bigFilesLimitSpinBox->value()); 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() void SystemSettings::finish()
......
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
<string>System</string> <string>System</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <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"> <item row="0" column="0">
<widget class="QLabel" name="terminalLabel"> <widget class="QLabel" name="terminalLabel">
<property name="text"> <property name="text">
...@@ -24,97 +27,36 @@ ...@@ -24,97 +27,36 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="6" column="0" colspan="4">
<widget class="QComboBox" name="terminalComboBox"> <layout class="QHBoxLayout" name="horizontalLayout_4">
<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> <item>
<widget class="QLabel" name="modifiedLabel"> <widget class="QCheckBox" name="warnBeforeOpeningBigFiles">
<property name="text"> <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> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="reloadBehavior"> <widget class="QSpinBox" name="bigFilesLimitSpinBox">
<property name="currentIndex"> <property name="suffix">
<number>0</number> <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> </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> </widget>
</item> </item>
<item> <item>
<spacer name="horizontalSpacer_3"> <spacer name="horizontalSpacer_4">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
...@@ -128,7 +70,7 @@ ...@@ -128,7 +70,7 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="4" column="0" colspan="4"> <item row="5" column="0" colspan="4">
<layout class="QHBoxLayout" name="horizontalLayout_5"> <layout class="QHBoxLayout" name="horizontalLayout_5">
<item> <item>
<widget class="QCheckBox" name="autoSaveCheckBox"> <widget class="QCheckBox" name="autoSaveCheckBox">
...@@ -191,36 +133,39 @@ ...@@ -191,36 +133,39 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="5" column="0" colspan="4"> <item row="4" column="0" colspan="4">
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<widget class="QCheckBox" name="warnBeforeOpeningBigFiles"> <widget class="QLabel" name="modifiedLabel">
<property name="text"> <property name="text">
<string>Warn before opening text files greater than</string> <string>When files are externally modified:</string>
</property>
<property name="checked">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QSpinBox" name="bigFilesLimitSpinBox"> <widget class="QComboBox" name="reloadBehavior">
<property name="suffix"> <property name="currentIndex">
<string>MB</string> <number>0</number>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>500</number>
</property>
<property name="value">
<number>5</number>
</property> </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> </widget>
</item> </item>
<item> <item>
<spacer name="horizontalSpacer_4"> <spacer name="horizontalSpacer_3">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
...@@ -234,6 +179,105 @@ ...@@ -234,6 +179,105 @@
</item> </item>
</layout> </layout>
</item> </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> </layout>
</widget> </widget>
</item> </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