diff options
author | Lorenz Haas <lykurg@gmail.com> | 2014-05-11 19:59:46 +0200 |
---|---|---|
committer | David Schulz <david.schulz@digia.com> | 2014-05-28 13:34:07 +0200 |
commit | ca433d9b2f20ad565ceecbae5357b4c81e580d9e (patch) | |
tree | ad5e7828784c45a7c08e66a21f2391fa626e72ce /src/plugins/beautifier/uncrustify/uncrustify.cpp | |
parent | af5b3246cf080afdc0fa75fe7808d569fb5d6302 (diff) | |
download | qt-creator-ca433d9b2f20ad565ceecbae5357b4c81e580d9e.tar.gz |
Beautifier: Add new class Command and option to format text via piping
The tool's formatting command is now enclosed in Command. For the
formatting itself it can be defined whether to use a temporary file or
the pipe.
Additionally, settings can return the current tool's version - if
needed.
Change-Id: I0e242c3e8016ed77cad92cc97a19fe3384dda858
Reviewed-by: David Schulz <david.schulz@digia.com>
Diffstat (limited to 'src/plugins/beautifier/uncrustify/uncrustify.cpp')
-rw-r--r-- | src/plugins/beautifier/uncrustify/uncrustify.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/plugins/beautifier/uncrustify/uncrustify.cpp b/src/plugins/beautifier/uncrustify/uncrustify.cpp index d4f5fa3d78..1db39853b2 100644 --- a/src/plugins/beautifier/uncrustify/uncrustify.cpp +++ b/src/plugins/beautifier/uncrustify/uncrustify.cpp @@ -27,6 +27,8 @@ ** ****************************************************************************/ +// Tested with version 0.59 and 0.60 + #include "uncrustify.h" #include "uncrustifyconstants.h" @@ -35,6 +37,7 @@ #include "../beautifierconstants.h" #include "../beautifierplugin.h" +#include "../command.h" #include <coreplugin/actionmanager/actioncontainer.h> #include <coreplugin/actionmanager/actionmanager.h> @@ -130,16 +133,16 @@ void Uncrustify::formatFile() BeautifierPlugin::showError(BeautifierPlugin::msgCannotGetConfigurationFile( QLatin1String(Constants::Uncrustify::DISPLAY_NAME))); } else { - BeautifierPlugin::formatCurrentFile(QStringList() - << m_settings->command() - << QLatin1String("-l") - << QLatin1String("cpp") - << QLatin1String("-L") - << QLatin1String("1-2") - << QLatin1String("--no-backup") - << QLatin1String("-c") - << cfgFileName - << QLatin1String("%file")); + Command command; + command.setExecutable(m_settings->command()); + command.setProcessing(Command::PipeProcessing); + command.addOption(QLatin1String("-l")); + command.addOption(QLatin1String("cpp")); + command.addOption(QLatin1String("-L")); + command.addOption(QLatin1String("1-2")); + command.addOption(QLatin1String("-c")); + command.addOption(cfgFileName); + BeautifierPlugin::formatCurrentFile(command); } } |