forked from qt-creator/qt-creator
Beautifier: Move a few strings closer to their use
Change-Id: I11c49976eca820b7083d143dbce6603085f9aa9d Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -4,18 +4,15 @@ add_qtc_plugin(Beautifier
|
|||||||
SOURCES
|
SOURCES
|
||||||
abstractsettings.cpp abstractsettings.h
|
abstractsettings.cpp abstractsettings.h
|
||||||
artisticstyle/artisticstyle.cpp artisticstyle/artisticstyle.h
|
artisticstyle/artisticstyle.cpp artisticstyle/artisticstyle.h
|
||||||
artisticstyle/artisticstyleconstants.h
|
|
||||||
beautifier.qrc
|
beautifier.qrc
|
||||||
beautifierabstracttool.h
|
beautifierabstracttool.h
|
||||||
beautifierconstants.h
|
beautifierconstants.h
|
||||||
beautifierplugin.cpp beautifierplugin.h
|
beautifierplugin.cpp beautifierplugin.h
|
||||||
beautifiertr.h
|
beautifiertr.h
|
||||||
clangformat/clangformat.cpp clangformat/clangformat.h
|
clangformat/clangformat.cpp clangformat/clangformat.h
|
||||||
clangformat/clangformatconstants.h
|
|
||||||
configurationdialog.cpp configurationdialog.h
|
configurationdialog.cpp configurationdialog.h
|
||||||
configurationeditor.cpp configurationeditor.h
|
configurationeditor.cpp configurationeditor.h
|
||||||
configurationpanel.cpp configurationpanel.h
|
configurationpanel.cpp configurationpanel.h
|
||||||
generalsettings.cpp generalsettings.h
|
generalsettings.cpp generalsettings.h
|
||||||
uncrustify/uncrustify.cpp uncrustify/uncrustify.h
|
uncrustify/uncrustify.cpp uncrustify/uncrustify.h
|
||||||
uncrustify/uncrustifyconstants.h
|
|
||||||
)
|
)
|
||||||
|
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include "artisticstyle.h"
|
#include "artisticstyle.h"
|
||||||
|
|
||||||
#include "artisticstyleconstants.h"
|
|
||||||
#include "../abstractsettings.h"
|
#include "../abstractsettings.h"
|
||||||
#include "../beautifierconstants.h"
|
#include "../beautifierconstants.h"
|
||||||
#include "../beautifierplugin.h"
|
#include "../beautifierplugin.h"
|
||||||
@@ -52,6 +51,8 @@ namespace Beautifier::Internal {
|
|||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
|
|
||||||
|
static QString displayName() { return Tr::tr("Artistic Style"); }
|
||||||
|
|
||||||
const char SETTINGS_NAME[] = "artisticstyle";
|
const char SETTINGS_NAME[] = "artisticstyle";
|
||||||
|
|
||||||
class ArtisticStyleSettings : public AbstractSettings
|
class ArtisticStyleSettings : public AbstractSettings
|
||||||
@@ -63,8 +64,7 @@ public:
|
|||||||
setVersionRegExp(QRegularExpression("([2-9]{1})\\.([0-9]{1,2})(\\.[1-9]{1})?$"));
|
setVersionRegExp(QRegularExpression("([2-9]{1})\\.([0-9]{1,2})(\\.[1-9]{1})?$"));
|
||||||
command.setLabelText(Tr::tr("Artistic Style command:"));
|
command.setLabelText(Tr::tr("Artistic Style command:"));
|
||||||
command.setDefaultValue("astyle");
|
command.setDefaultValue("astyle");
|
||||||
command.setPromptDialogTitle(BeautifierPlugin::msgCommandPromptDialogTitle(
|
command.setPromptDialogTitle(BeautifierPlugin::msgCommandPromptDialogTitle(displayName()));
|
||||||
Tr::tr(Constants::ARTISTICSTYLE_DISPLAY_NAME)));
|
|
||||||
|
|
||||||
useOtherFiles.setSettingsKey("useOtherFiles");
|
useOtherFiles.setSettingsKey("useOtherFiles");
|
||||||
useOtherFiles.setLabelText(Tr::tr("Use file *.astylerc defined in project files"));
|
useOtherFiles.setLabelText(Tr::tr("Use file *.astylerc defined in project files"));
|
||||||
@@ -239,7 +239,7 @@ public:
|
|||||||
ArtisticStyleOptionsPage()
|
ArtisticStyleOptionsPage()
|
||||||
{
|
{
|
||||||
setId("ArtisticStyle");
|
setId("ArtisticStyle");
|
||||||
setDisplayName(Tr::tr("Artistic Style"));
|
setDisplayName(displayName());
|
||||||
setCategory(Constants::OPTION_CATEGORY);
|
setCategory(Constants::OPTION_CATEGORY);
|
||||||
setWidgetCreator([] { return new ArtisticStyleOptionsPageWidget; });
|
setWidgetCreator([] { return new ArtisticStyleOptionsPageWidget; });
|
||||||
}
|
}
|
||||||
@@ -267,7 +267,7 @@ ArtisticStyle::ArtisticStyle()
|
|||||||
|
|
||||||
QString ArtisticStyle::id() const
|
QString ArtisticStyle::id() const
|
||||||
{
|
{
|
||||||
return QLatin1String(Constants::ARTISTICSTYLE_DISPLAY_NAME);
|
return "Artistic Style";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArtisticStyle::updateActions(Core::IEditor *editor)
|
void ArtisticStyle::updateActions(Core::IEditor *editor)
|
||||||
@@ -278,12 +278,10 @@ void ArtisticStyle::updateActions(Core::IEditor *editor)
|
|||||||
void ArtisticStyle::formatFile()
|
void ArtisticStyle::formatFile()
|
||||||
{
|
{
|
||||||
const QString cfgFileName = configurationFile();
|
const QString cfgFileName = configurationFile();
|
||||||
if (cfgFileName.isEmpty()) {
|
if (cfgFileName.isEmpty())
|
||||||
BeautifierPlugin::showError(BeautifierPlugin::msgCannotGetConfigurationFile(
|
BeautifierPlugin::showError(BeautifierPlugin::msgCannotGetConfigurationFile(displayName()));
|
||||||
Tr::tr(Constants::ARTISTICSTYLE_DISPLAY_NAME)));
|
else
|
||||||
} else {
|
|
||||||
formatCurrentFile(command(cfgFileName));
|
formatCurrentFile(command(cfgFileName));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ArtisticStyle::configurationFile() const
|
QString ArtisticStyle::configurationFile() const
|
||||||
|
@@ -1,12 +0,0 @@
|
|||||||
// Copyright (C) 2016 Lorenz Haas
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QtGlobal>
|
|
||||||
|
|
||||||
namespace Beautifier::Constants {
|
|
||||||
|
|
||||||
const char ARTISTICSTYLE_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("QtC::Beautifier", "Artistic Style");
|
|
||||||
|
|
||||||
} // Beautifier::Constants
|
|
@@ -35,7 +35,6 @@ QtcPlugin {
|
|||||||
files: [
|
files: [
|
||||||
"artisticstyle.cpp",
|
"artisticstyle.cpp",
|
||||||
"artisticstyle.h",
|
"artisticstyle.h",
|
||||||
"artisticstyleconstants.h",
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,7 +44,6 @@ QtcPlugin {
|
|||||||
files: [
|
files: [
|
||||||
"clangformat.cpp",
|
"clangformat.cpp",
|
||||||
"clangformat.h",
|
"clangformat.h",
|
||||||
"clangformatconstants.h",
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,7 +53,6 @@ QtcPlugin {
|
|||||||
files: [
|
files: [
|
||||||
"uncrustify.cpp",
|
"uncrustify.cpp",
|
||||||
"uncrustify.h",
|
"uncrustify.h",
|
||||||
"uncrustifyconstants.h",
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -5,8 +5,6 @@
|
|||||||
|
|
||||||
#include "clangformat.h"
|
#include "clangformat.h"
|
||||||
|
|
||||||
#include "clangformatconstants.h"
|
|
||||||
|
|
||||||
#include "../abstractsettings.h"
|
#include "../abstractsettings.h"
|
||||||
#include "../beautifierconstants.h"
|
#include "../beautifierconstants.h"
|
||||||
#include "../beautifierplugin.h"
|
#include "../beautifierplugin.h"
|
||||||
@@ -367,7 +365,7 @@ ClangFormat::ClangFormat()
|
|||||||
|
|
||||||
QString ClangFormat::id() const
|
QString ClangFormat::id() const
|
||||||
{
|
{
|
||||||
return QLatin1String(Constants::CLANGFORMAT_DISPLAY_NAME);
|
return "ClangFormat";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangFormat::updateActions(Core::IEditor *editor)
|
void ClangFormat::updateActions(Core::IEditor *editor)
|
||||||
|
@@ -1,12 +0,0 @@
|
|||||||
// Copyright (C) 2016 Lorenz Haas
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QtGlobal>
|
|
||||||
|
|
||||||
namespace Beautifier::Constants {
|
|
||||||
|
|
||||||
const char CLANGFORMAT_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("QtC::Beautifier", "ClangFormat");
|
|
||||||
|
|
||||||
} // Beautifier::Constants
|
|
@@ -5,8 +5,6 @@
|
|||||||
|
|
||||||
#include "uncrustify.h"
|
#include "uncrustify.h"
|
||||||
|
|
||||||
#include "uncrustifyconstants.h"
|
|
||||||
|
|
||||||
#include "../abstractsettings.h"
|
#include "../abstractsettings.h"
|
||||||
#include "../beautifierconstants.h"
|
#include "../beautifierconstants.h"
|
||||||
#include "../beautifierplugin.h"
|
#include "../beautifierplugin.h"
|
||||||
@@ -54,6 +52,8 @@ namespace Beautifier::Internal {
|
|||||||
|
|
||||||
const char SETTINGS_NAME[] = "uncrustify";
|
const char SETTINGS_NAME[] = "uncrustify";
|
||||||
|
|
||||||
|
static QString displayName() { return Tr::tr("Uncrustify"); }
|
||||||
|
|
||||||
class UncrustifySettings : public AbstractSettings
|
class UncrustifySettings : public AbstractSettings
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -64,8 +64,7 @@ public:
|
|||||||
|
|
||||||
command.setDefaultValue("uncrustify");
|
command.setDefaultValue("uncrustify");
|
||||||
command.setLabelText(Tr::tr("Uncrustify command:"));
|
command.setLabelText(Tr::tr("Uncrustify command:"));
|
||||||
command.setPromptDialogTitle(BeautifierPlugin::msgCommandPromptDialogTitle(
|
command.setPromptDialogTitle(BeautifierPlugin::msgCommandPromptDialogTitle(displayName()));
|
||||||
Tr::tr(Constants::UNCRUSTIFY_DISPLAY_NAME)));
|
|
||||||
|
|
||||||
useOtherFiles.setSettingsKey("useOtherFiles");
|
useOtherFiles.setSettingsKey("useOtherFiles");
|
||||||
useOtherFiles.setDefaultValue(true);
|
useOtherFiles.setDefaultValue(true);
|
||||||
@@ -270,7 +269,7 @@ Uncrustify::Uncrustify()
|
|||||||
|
|
||||||
QString Uncrustify::id() const
|
QString Uncrustify::id() const
|
||||||
{
|
{
|
||||||
return QLatin1String(Constants::UNCRUSTIFY_DISPLAY_NAME);
|
return "Uncrustify";
|
||||||
}
|
}
|
||||||
|
|
||||||
void Uncrustify::updateActions(Core::IEditor *editor)
|
void Uncrustify::updateActions(Core::IEditor *editor)
|
||||||
@@ -283,20 +282,17 @@ void Uncrustify::updateActions(Core::IEditor *editor)
|
|||||||
void Uncrustify::formatFile()
|
void Uncrustify::formatFile()
|
||||||
{
|
{
|
||||||
const FilePath cfgFileName = configurationFile();
|
const FilePath cfgFileName = configurationFile();
|
||||||
if (cfgFileName.isEmpty()) {
|
if (cfgFileName.isEmpty())
|
||||||
BeautifierPlugin::showError(BeautifierPlugin::msgCannotGetConfigurationFile(
|
BeautifierPlugin::showError(BeautifierPlugin::msgCannotGetConfigurationFile(displayName()));
|
||||||
Tr::tr(Constants::UNCRUSTIFY_DISPLAY_NAME)));
|
else
|
||||||
} else {
|
|
||||||
formatCurrentFile(command(cfgFileName));
|
formatCurrentFile(command(cfgFileName));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Uncrustify::formatSelectedText()
|
void Uncrustify::formatSelectedText()
|
||||||
{
|
{
|
||||||
const FilePath cfgFileName = configurationFile();
|
const FilePath cfgFileName = configurationFile();
|
||||||
if (cfgFileName.isEmpty()) {
|
if (cfgFileName.isEmpty()) {
|
||||||
BeautifierPlugin::showError(BeautifierPlugin::msgCannotGetConfigurationFile(
|
BeautifierPlugin::showError(BeautifierPlugin::msgCannotGetConfigurationFile(displayName()));
|
||||||
Tr::tr(Constants::UNCRUSTIFY_DISPLAY_NAME)));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,12 +0,0 @@
|
|||||||
// Copyright (C) 2016 Lorenz Haas
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QtGlobal>
|
|
||||||
|
|
||||||
namespace Beautifier::Constants {
|
|
||||||
|
|
||||||
const char UNCRUSTIFY_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("QtC::Beautifier", "Uncrustify");
|
|
||||||
|
|
||||||
} // Beautifier::Constants
|
|
Reference in New Issue
Block a user