Add restore fallback functionality, make better tr()

Task-number: QTCREATORBUG-5025
Change-Id: Ia3f6fa2380dd1a93f120873f584662a267ca4d50
Reviewed-on: http://codereview.qt.nokia.com/360
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Christian Kamm <christian.d.kamm@nokia.com>
This commit is contained in:
Jarek Kobus
2011-06-08 10:45:26 +02:00
committed by Jarek Kobus
parent e436768127
commit 2fad22c030
13 changed files with 114 additions and 81 deletions

View File

@@ -234,6 +234,7 @@ CppCodeStylePreferencesWidget::CppCodeStylePreferencesWidget(QWidget *parent)
m_ui->categoryTab->setCurrentIndex(0);
m_ui->tabPreferencesWidget->setFlat(true);
m_ui->fallbackWidget->setLabelText(tr("Code style settings:"));
}
CppCodeStylePreferencesWidget::~CppCodeStylePreferencesWidget()
@@ -321,15 +322,11 @@ void CppCodeStylePreferencesWidget::setCppCodeStyleSettings(const CppCodeStyleSe
void CppCodeStylePreferencesWidget::slotCurrentFallbackChanged(TextEditor::IFallbackPreferences *fallback)
{
m_ui->tabPreferencesWidget->setEnabled(!fallback);
m_ui->contentGroupBox->setEnabled(!fallback);
m_ui->bracesGroupBox->setEnabled(!fallback);
m_ui->switchGroupBox->setEnabled(!fallback);
m_ui->alignmentGroupBox->setEnabled(!fallback);
// if C++ global is used for style, use it for tab settings as well
if (fallback && m_tabPreferences && m_cppCodeStylePreferences->currentFallback())
m_tabPreferences->setCurrentFallback(m_cppCodeStylePreferences->currentFallback()->id());
updatePreview();
}

View File

@@ -17,7 +17,7 @@
<item>
<widget class="QWidget" name="fallbackContainer" native="true">
<layout class="QHBoxLayout" name="fallbackLayout">
<property name="leftMargin">
<property name="margin">
<number>0</number>
</property>
<item>

View File

@@ -42,14 +42,14 @@ CppToolsSettings::CppToolsSettings(QObject *parent)
<< textEditorSettings->tabPreferences(), this);
m_d->m_tabPreferences->setCurrentFallback(textEditorSettings->tabPreferences());
m_d->m_tabPreferences->fromSettings(CppTools::Constants::CPP_SETTINGS_ID, s);
m_d->m_tabPreferences->setDisplayName(tr("global C++"));
m_d->m_tabPreferences->setDisplayName(tr("Global C++", "Settings"));
m_d->m_tabPreferences->setId(idKey);
textEditorSettings->registerLanguageTabPreferences(CppTools::Constants::CPP_SETTINGS_ID, m_d->m_tabPreferences);
m_d->m_cppCodeStylePreferences
= new CppCodeStylePreferences(QList<TextEditor::IFallbackPreferences *>(), this);
m_d->m_cppCodeStylePreferences->fromSettings(CppTools::Constants::CPP_SETTINGS_ID, s);
m_d->m_cppCodeStylePreferences->setDisplayName(tr("global C++"));
m_d->m_cppCodeStylePreferences->setDisplayName(tr("Global C++", "Settings"));
m_d->m_cppCodeStylePreferences->setId(idKey);
textEditorSettings->registerLanguageCodeStylePreferences(CppTools::Constants::CPP_SETTINGS_ID, m_d->m_cppCodeStylePreferences);
}