Doc: Turn "Pasting and Fetching Code Snippets" into a how-to

Task-number: QTCREATORBUG-29361
Change-Id: I0b2fe3cd2b3d3e3ec2c589ebcbd196832765c4ac
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
Leena Miettinen
2024-03-12 09:35:30 +01:00
parent fc4067a118
commit d0e240fd52
6 changed files with 63 additions and 60 deletions

View File

@@ -1992,7 +1992,7 @@
the right hand side to find out what went wrong. Always attach the the right hand side to find out what went wrong. Always attach the
contents of the pane to debugger-related questions to the \QC contents of the pane to debugger-related questions to the \QC
mailing list (qt-creator@qt-project.org) or paste them to a mailing list (qt-creator@qt-project.org) or paste them to a
\l{Pasting and Fetching Code Snippets}{code pasting service} before \l{Paste and fetch code snippets}{code pasting service} before
asking questions in the IRC (on the #qt-creator channel at Libera.Chat). asking questions in the IRC (on the #qt-creator channel at Libera.Chat).
\note Error 135 usually means that a dependent DLL cannot be found. \note Error 135 usually means that a dependent DLL cannot be found.

View File

@@ -57,15 +57,6 @@
few people can visualize the color \c {#18793f}. To easily edit few people can visualize the color \c {#18793f}. To easily edit
these properties, you can use the Qt Quick Toolbars. these properties, you can use the Qt Quick Toolbars.
\if defined(qtcreator)
\li \l{Pasting and Fetching Code Snippets}
You can cooperate with others by pasting and fetching
snippets of code from a server. For example, you might ask
colleagues to review a change that you plan to submit to a
version control system.
\endif
\endlist \endlist
\if defined(qtcreator) \if defined(qtcreator)

View File

@@ -1,16 +1,16 @@
// Copyright (C) 2019 The Qt Company Ltd. // Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
/*! /*!
\previouspage qt-quick-toolbars.html
\page creator-editor-codepasting.html \page creator-editor-codepasting.html
\nextpage creator-macros.html \previouspage creator-how-tos.html
\title Pasting and Fetching Code Snippets \ingroup creator-how-to-edit
In \QC, you can paste snippets of code to a server or fetch snippets of \title Paste and fetch code snippets
code from the server. To paste and fetch snippets of code, \QC uses the
following: To paste snippets of code to a server or fetch snippets of code from the
server, use one of the following code pasting services:
\list \list
\li \uicontrol {Pastebin.Com} \li \uicontrol {Pastebin.Com}
@@ -18,59 +18,72 @@
\li \uicontrol {Shared network drives} \li \uicontrol {Shared network drives}
\endlist \endlist
\section1 Specifying Settings for Code Pasting For example, you might ask colleagues to review a change that you plan to
submit to a version control system. If you use the Git version control
system, create a \e{diff} view by going to \uicontrol Tools >
\uicontrol Git > \uicontrol {Local Repository} > \uicontrol Diff.
Then, upload its contents to the server by going to \uicontrol Tools >
\uicontrol {Code Pasting} > \uicontrol {Paste Snippet}.
To specify settings for the code pasting service: The reviewers can retrieve the code snippet by selecting \uicontrol Tools >
\uicontrol {Code Pasting} > \uicontrol {Fetch Snippet}. If they have the
project currently opened in \QC, they can apply and test the change by
going to \uicontrol Tools > \uicontrol Git > \uicontrol {Local Repository}
> \uicontrol Patch > \uicontrol {Apply from Editor}.
\list 1 \section1 Paste snippets
\li Select \preferences > \uicontrol {Code Pasting}.
\image qtcreator-code-pasting-options.png "Code Pasting preferences"
\li In the \uicontrol {Default protocol} field, select a code pasting
service to use by default.
\li In the \uicontrol Username field, enter your username.
\li In the \uicontrol {Expires after} field, specify the time to keep
the pasted snippet on the server.
\li Select the \uicontrol {Copy-paste URL to clipboard} check box to
copy the URL of the post on the code pasting service to the
clipboard when you paste a post.
\li Select the \uicontrol {Display General Messages after sending a post}
check box to display the URL in \l{View output}{General Messages}
when you paste a post.
\endlist
Select \uicontrol Fileshare to specify the path to a shared network drive. To paste a snippet of code onto the server, go to \uicontrol Tools >
The code snippets are copied to the drive as simple files. You have to
delete obsolete files from the drive manually.
\section1 Using Code Pasting Services
To paste a snippet of code onto the server, select \uicontrol Tools >
\uicontrol {Code Pasting} > \uicontrol {Paste Snippet} or press \uicontrol {Code Pasting} > \uicontrol {Paste Snippet} or press
\key {Alt+C,Alt+P}. By default, \QC copies the URL of the snippet to the \key {Alt+C,Alt+P}. By default, \QC copies the URL of the snippet to the
clipboard and displays the URL in \uicontrol {General Messages}. clipboard and displays the URL in \uicontrol {General Messages}.
To paste any content that you copied to the clipboard, select To paste any content that you copied to the clipboard, go to
\uicontrol Tools > \uicontrol {Code Pasting} > \uicontrol {Paste Snippet}. \uicontrol Tools > \uicontrol {Code Pasting} > \uicontrol {Paste Snippet}.
To paste content from the \l{Compare files}{diff editor}, right-click a To paste content from the \l{Compare files}{diff editor}, right-click a
chunk and select \uicontrol {Send Chunk to CodePaster} in the context menu. chunk and select \uicontrol {Send Chunk to CodePaster} in the context menu.
To fetch a snippet of code from the server, select \uicontrol Tools > \section1 Fetch snippets
\uicontrol {Code Pasting} > \uicontrol {Fetch Snippet} or press
\key {Alt+C,Alt+F}. Select the snippet to fetch from the list.
To fetch the content stored at an URL, select \uicontrol Tools > To fetch a snippet of code from the server:
\list 1
\li Go to \uicontrol Tools > \uicontrol {Code Pasting} >
\uicontrol {Fetch Snippet} or press \key {Alt+C,Alt+F}.
\li Select the snippet to fetch from the list.
\endlist
To fetch the content stored at a URL, select \uicontrol Tools >
\uicontrol {Code Pasting} > \uicontrol {Fetch from URL}. \uicontrol {Code Pasting} > \uicontrol {Fetch from URL}.
For example, you might ask colleagues to review a change that you plan to \section1 Set code pasting preferences
submit to a version control system. If you use the Git version control
system, you can create a \e{diff} view by selecting \uicontrol Tools > To set preferences for a code pasting service:
\uicontrol Git > \uicontrol {Local Repository} > \uicontrol Diff. You can
then upload its contents to the server by selecting \uicontrol Tools > \list 1
\uicontrol {Code Pasting} > \uicontrol {Paste Snippet}. The reviewers can \li Go to \preferences > \uicontrol {Code Pasting} > \uicontrol General.
retrieve the code snippet by selecting \uicontrol Tools > \image qtcreator-code-pasting-options.png {Code Pasting preferences}
\uicontrol {Code Pasting} > \uicontrol {Fetch Snippet}. If they have the \li In \uicontrol {Default protocol}, select a code pasting service to
project currently opened in \QC, they can apply and test the change by use by default.
choosing \uicontrol Tools > \uicontrol Git > \uicontrol {Local Repository} \li In \uicontrol Username, enter your username.
> \uicontrol Patch > \uicontrol {Apply from Editor}. \li In \uicontrol {Expires after}, specify the time to keep
the pasted snippet on the server.
\li Select \uicontrol {Copy-paste URL to clipboard} to copy the URL of
the post on the code pasting service to the clipboard when you paste
a post.
\li Select \uicontrol {Display General Messages after sending a post}
to display the URL in \l{View output}{General Messages}
when you paste a post.
\endlist
\section2 Set a shared network drive for code pasting
Go to \preferences > \uicontrol {Code Pasting} > \uicontrol Fileshare to
specify the path to a shared network drive.
The code snippets are copied to the drive as simple files. You have to
delete obsolete files from the drive manually.
\sa {Git}
*/ */

View File

@@ -101,7 +101,7 @@
\if defined(qtcreator) \if defined(qtcreator)
\section1 Paste changes for review \section1 Paste changes for review
To send a chunk of changes to a \l{Pasting and Fetching Code Snippets} To send a chunk of changes to a \l{Paste and fetch code snippets}
{code pasting service}, select \uicontrol {Send Chunk to CodePaster} in the {code pasting service}, select \uicontrol {Send Chunk to CodePaster} in the
context menu. context menu.
\endif \endif

View File

@@ -45,5 +45,5 @@
{#qt-creator} channel on Libera.Chat IRC, go to \uicontrol Help > {#qt-creator} channel on Libera.Chat IRC, go to \uicontrol Help >
\uicontrol Contact. \uicontrol Contact.
\sa {Pasting and Fetching Code Snippets}, {Technical Support} \sa {Paste and fetch code snippets}, {Technical Support}
*/ */

View File

@@ -32,7 +32,6 @@
\li \l{Semantic Highlighting} \li \l{Semantic Highlighting}
\li \l{Checking Code Syntax} \li \l{Checking Code Syntax}
\li \l{Using Qt Quick Toolbars} \li \l{Using Qt Quick Toolbars}
\li \l{Pasting and Fetching Code Snippets}
\endlist \endlist
\li \l{Configuring the Editor} \li \l{Configuring the Editor}
\endlist \endlist