forked from qt-creator/qt-creator
Beautifier: Make all tools MIME restrict-able
The newly introduced auto save option is restricted to user definable MIME types. The underlaying tool's restriction, however, is only if the current editor is a cpp editor. This patch makes the tools also MIME types restrict-able. In addition the auto save functionality is now only applicable if the file matches the auto save MIME types as well as the MIME types of the chosen tool. Change-Id: Ic430b4a07341647e6c8e95d2b802a17db1637a36 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
This commit is contained in:
@@ -62,6 +62,7 @@ ClangFormatOptionsPageWidget::~ClangFormatOptionsPageWidget()
|
||||
void ClangFormatOptionsPageWidget::restore()
|
||||
{
|
||||
ui->command->setPath(m_settings->command());
|
||||
ui->mime->setText(m_settings->supportedMimeTypesAsString());
|
||||
const int textIndex = ui->predefinedStyle->findText(m_settings->predefinedStyle());
|
||||
if (textIndex != -1)
|
||||
ui->predefinedStyle->setCurrentIndex(textIndex);
|
||||
@@ -78,11 +79,15 @@ void ClangFormatOptionsPageWidget::restore()
|
||||
void ClangFormatOptionsPageWidget::apply()
|
||||
{
|
||||
m_settings->setCommand(ui->command->path());
|
||||
m_settings->setSupportedMimeTypes(ui->mime->text());
|
||||
m_settings->setUsePredefinedStyle(ui->usePredefinedStyle->isChecked());
|
||||
m_settings->setPredefinedStyle(ui->predefinedStyle->currentText());
|
||||
m_settings->setCustomStyle(ui->configurations->currentConfiguration());
|
||||
m_settings->setFormatEntireFileFallback(ui->formatEntireFileFallback->isChecked());
|
||||
m_settings->save();
|
||||
|
||||
// update since not all MIME types are accepted (invalids or duplicates)
|
||||
ui->mime->setText(m_settings->supportedMimeTypesAsString());
|
||||
}
|
||||
|
||||
ClangFormatOptionsPage::ClangFormatOptionsPage(ClangFormatSettings *settings, QObject *parent) :
|
||||
|
||||
Reference in New Issue
Block a user