// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only

// **********************************************************************
// 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.
// **********************************************************************

/*!
    \page creator-sharing-project-settings.html
    \previouspage creator-how-tos.html

    \ingroup creator-how-to-projects-configure

    \title Share project settings

    \QC stores user-specific project settings in a \c {.user} file located
    in a directory \e .qtcreator/ under the project directory. You can
    share these settings between several projects as a \c {.shared} file
    (such as, \c {CMakeLists.txt.shared}, \c {qtcreator.pro.shared}, or
    \c {qtcreator.qbs.shared}). It has the same XML structure as a \c {.user}
    file, but only has the settings to share.

    To share CMake project settings, use \l{CMake Presets} or a
    \c {CMakeLists.txt.shared} file.

    \section1 Create a shared settings file

    The easiest way to create a \c {.shared} file is to copy settings from the
    \c {.user} file. Typically, you would share some of the values in the
    \c ProjectExplorer.Project.EditorSettings section.

    \note You must always specify the
    \c ProjectExplorer.Project.Updater.FileVersion variable and use the same
    value for it as in the \c {.user} file.

    You can then deliver the \c {.shared} file to other developers or copy it to
    other development PCs.

    The following is an example of a \c {.shared} file:

    \code
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE QtCreatorProject>
    <qtcreator>
        <data>
            <variable>ProjectExplorer.Project.EditorSettings</variable>
            <valuemap type="QVariantMap">
                <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
                <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
                <value type="int" key="EditorConfiguration.TabSize">14</value>
                <value type="int" key="EditorConfiguration.IndentSize">4</value>
            </valuemap>
        </data>
        <data>
            <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
            <value type="int">10</value>
        </data>
    </qtcreator>
    \endcode

    \section1 Update shared settings

    The first time \QC loads the project after you add shared settings,
    it overwrites the user settings with them. If you open the project for
    the first time and \QC has not created a \c {.user} file, the settings
    in the \c {.shared} file take effect immediately.

    If you receive a \c {.shared} file and do not want to use a particular
    setting in it, you can change it. \QC marks it a \e sticky setting. The next
    time you open a project, the setting is not updated. \QC tracks sticky
    settings in the \c {.user} file and removes the mark if the values in the
    user and shared files eventually become identical. This is to avoid
    a permanent sticky setting that was created just because you wanted to try
    something out.

    \section1 Share CMake project settings

    The following is an example of a \c {CMakeLists.txt.shared} file:

    \badcode
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE QtCreatorProject>
    <qtcreator>
     <data>
      <variable>ProjectExplorer.Project.PluginSettings</variable>
       <valuemap type="QVariantMap">
        <valuemap type="QVariantMap" key="CMakeSpecificSettings">
          <value type="bool" key="AskBeforePresetsReload">false</value>
          <value type="bool" key="AskReConfigureInitialParams">false</value>
          <value type="bool" key="AutorunCMake">false</value>
          <value type="bool" key="PackageManagerAutoSetup">false</value>
          <value type="bool" key="ShowAdvancedOptionsByDefault">true</value>
          <value type="bool" key="ShowSourceSubFolders">false</value>
          <value type="bool" key="UseGlobalSettings">false</value>
          <value type="bool" key="UseJunctionsForSourceAndBuildDirectories">true</value>
        </valuemap>
      </valuemap>
     </data>
     <data>
      <variable>Version</variable>
      <value type="int">22</value>
     </data>
    </qtcreator>
    \endcode

    For more information about the settings, see
    \l {Override CMake settings for a project}.

    \sa {Building and running projects}, {CMake Presets}
*/
