/****************************************************************************
**
** Copyright (c) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator
**
**
** GNU Free Documentation License
**
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of this
** file.
**
**
****************************************************************************/

// **********************************************************************
// NOTE: the sections are not ordered by their logical order to avoid
// reshuffling the file each time the index order changes (i.e., often).
// Run the fixnavi.pl script to adjust the links to the index order.
// **********************************************************************

/*!
    \contentspage {Qt Creator Manual}
    \previouspage creator-editor-refactoring.html
    \page creator-beautifier.html
    \nextpage creator-editor-options.html

    \title Beautifying Source Code

    You can use the experimental Beautifier plugin to format your source code
    by using the following external tools:

    \list

        \li \l{http://astyle.sourceforge.net}{Artistic Style}

        \li \l{http://clang.llvm.org/docs/ClangFormat.html}{ClangFormat}

        \li \l{http://uncrustify.sourceforge.net}{Uncrustify}

    \endlist

    The Beautifier plugin parses the source code into component structures, such
    as assignment statements, if blocks, loops, and so on, and formats them as
    specified in the Beautifier options. You can use a predefined style or
    define your own style.

    To use the Beautifier plugin:

    \list 1

        \li Download and install the tool to use for formatting source code:

            \list
                \li \l{http://sourceforge.net/projects/astyle/files/astyle}
                    {Artistic Style}
                \li \l{http://llvm.org/releases/download.html}{ClangFormat}
                \li \l{http://sourceforge.net/projects/uncrustify/files/uncrustify}
                    {Uncrustify}
            \endlist

            You might have to build the tools from sources for some platforms.

        \li Select \gui Help > \gui {About Plugins} > \gui {C++} >
            \gui Beautifier to enable the plugin.

        \li Restart \QC to be able to use the plugin.

        \li Select \gui Tools > \gui Options > \gui Beautifier to specify
            settings for the tool you want to use.

            \image beautifier_options.png

        \li In the \gui {Artistic Style command}, \gui {Clang Format command},
            or \gui {Uncrustify command} field, specify the path to the tool
            executable.

        \li In the \gui Options group, select the configuration file that
            defines the style to use in the source files. If you select several
            options, they are applied from top down.

            \list

                \li Select the \gui {Use file defined in project files} option
                    to use the configuration file defined in the qmake
                    OTHER_FILES variable as the configuration file for the
                    selected tool.

                \li Select the \gui {Use $HOME} option to use the specified file
                    in the user's home directory as the configuration file for
                    the selected tool.

                \li Select the \gui {Use self-defined style} option, and then
                    \gui Add to define your own style.

                    Define code formatting in the \gui {Edit Configuration}
                    dialog. It provides syntax highlighting, auto-completion,
                    and context-sensitive help. For these features, you must
                    have the tool installed.

                   \image beautifier_editor.png

            \endlist

        \li Select \gui Tools > \gui Beautifier > \gui {Artistic Style},
            \gui ClangFormat, or \gui Uncrustify > \gui {Format Current File}
            to format the currently open file.

            You can \l{Keyboard Shortcuts}{create keyboard shortcuts} for the
            functions.

    \endlist

    In addition to the \gui {Format Current File} command, ClangFormat provides
    the \gui {Format Selected Text} command. If you select it when no text is
    selected, nothing happens. To format the entire file in this case, select
    the \gui {Format entire file if no text was selected} check box in the
    \gui {Clang Format} options.
*/
