File: technical-reference.docbook

package info (click to toggle)
ktuberling 4%3A25.12.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 103,256 kB
  • sloc: cpp: 1,569; xml: 232; python: 78; makefile: 8; sh: 2
file content (221 lines) | stat: -rw-r--r-- 8,998 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<chapter id="technical-reference">
<chapterinfo>

<authorgroup>
<author>
<firstname>Éric</firstname>
<surname>Bischoff</surname>
</author>
<!-- TRANS:ROLES_OF_TRANSLATORS -->
</authorgroup>

<date>2021-10-04</date>
<releaseinfo>KDE Gear 21.08</releaseinfo>

<keywordset>
<keyword>KDE</keyword>
<keyword>KTuberling</keyword>
<keyword>technical reference</keyword>
</keywordset>
</chapterinfo>

<title>Technical References</title>

<para>
&ktuberling; offers a gentle and rewarding introduction to &kde; customization
and programming.  The application can be extended.  For example, without any
coding, new playgrounds can be added by changing the graphics files. By
adding appropriate sound files, translators can change the sounds to their
native tongue!
</para>

<para><!--FIXME email alex ok?-->
If you extend or add to the game please consider sending your additions to the
maintainer <ulink url="mailto:alex@eyeos.org">Alex Fiestas</ulink> for
inclusion in future releases.
</para>

<sect1 id="for-artists">
<title>For Artists</title>

<para>
To create a new &ktuberling; playground you have to:
</para>

<itemizedlist>
  <listitem>
    <para>Draw the playground in a &SVG; file, there you have to:
      <itemizedlist>
        <listitem><para>Name the place where items can dragged <quote>background</quote>.</para></listitem>
        <listitem><para>Name each of the draggable items with an unique name.</para></listitem>
      </itemizedlist>
    </para>
  </listitem>

  <listitem>
    <para>Create a <literal role="extension">.theme</literal> file, it has to follow this schema:</para>
<programlisting>
&lt;playground gameboard="<replaceable>yourSVGFile</replaceable>" name="<replaceable>theDesktopFile</replaceable>"&gt;
&lt;object name="<replaceable>itemName</replaceable>" sound="<replaceable>soundName</replaceable>" scale="<replaceable>someValue</replaceable>" /&gt;
...
...
...
&lt;/playground&gt;
</programlisting>
    <itemizedlist>
      <listitem><para><replaceable>yourSVGFile</replaceable> is the name of the &SVG; file that has the drawing.</para></listitem>
      <listitem><para><replaceable>theDesktopFile</replaceable> is the name of the desktop file that has the
      name of the theme.</para></listitem>
      <listitem><para>For each object you need a <literal>&lt;object&gt;</literal> entry.
      <replaceable>itemName</replaceable> is the unique name you used on the &SVG; file,
      <replaceable>soundName</replaceable> is the sound name that will be played when dragging it, see the
      <filename>sounds/soundthemes.HOWTO</filename> file from source code for more information.</para></listitem>
      <listitem><para><literal>scale</literal> is optional and <replaceable>someValue</replaceable> is the scale
      factor that will be used when drawing this object outside the warehouse, if not specified is 1.</para></listitem>
    </itemizedlist>
  </listitem>

  <listitem>
    <para>Create a <literal role="extension">.desktop</literal> file, it has to follow this schema:</para>
<programlisting>
[KTuberlingTheme]
Name=<replaceable>themeName</replaceable>
</programlisting>
    <itemizedlist>
      <listitem><para><replaceable>themeName</replaceable> is the name that identifies the theme, will be shown in the
      Playground menu.</para></listitem>
    </itemizedlist>
  </listitem>

  <listitem>
    <para>If you are adding the theme to &ktuberling; repository, add <literal role="extension">.svg</literal>,
        <literal role="extension">.theme</literal>, and <literal role="extension">.desktop</literal> files to
        <literal>FILES</literal> section of the <filename>CMakeLists.txt</filename> into the
        <filename class="directory">pics/</filename> folder.
    </para>
  </listitem>

  <listitem>
    <para>If you want to install it for yourself, place <literal role="extension">.svg</literal>,
    <literal role="extension">.theme</literal>, and <literal role="extension">.desktop</literal> files into
    the <filename class="directory">ktuberling/pics</filename> folder in
    <userinput><command>qtpaths</command> <option>--paths GenericDataLocation</option></userinput>
    </para>
  </listitem>
</itemizedlist>

</sect1>

<sect1 id="for-translators">
<title>For Translators</title>

<para>
Besides the usual <literal role="extension">.po</literal> files mechanism for
translating program labels and prompts, the sounds can be localized too.
</para>

<para>
To create a new &ktuberling; sound theme you have to:
</para>

<itemizedlist>
  <listitem><para>Record the sounds in OGG Vorbis rc3 file format.</para></listitem>
  <listitem><para>Create a <filename><replaceable>yourLanguageTwoLetterCode</replaceable>.soundtheme</filename>
  file, it has to follow this schema:</para>
<programlisting>
&lt;language code="<replaceable>yourLanguageTwoLetterCode</replaceable>"&gt;
&lt;sound name="<replaceable>soundName</replaceable>" file="<replaceable>relativePath</replaceable>" /&gt;
...
...
...
&lt;/language&gt;
</programlisting>
    <itemizedlist>
      <listitem><para><replaceable>yourLanguageTwoLetterCode</replaceable> is your language two
      letter code, for example gl for Galician.</para></listitem>
      <listitem><para>For each sound a <literal>&lt;sound&gt;</literal> entry. <replaceable>soundName</replaceable>
      should match with the soundName specified in the playground theme (see the <filename>pics/themes.HOWTO</filename>
      from source code). <replaceable>relativePath</replaceable> should be the relative path you are going
      to install the file with this sound to, typically it will be
      <filename><replaceable>someUniquePath</replaceable>/<replaceable>soundName</replaceable>.<replaceable>format</replaceable></filename>
      (<replaceable>someUniquePath</replaceable> can be your language two letter code for example).</para></listitem>
    </itemizedlist>
  </listitem>

  <listitem><para>If you are adding the sound theme to &ktuberling; in your language folder:</para>
    <itemizedlist>
      <listitem><para>Add the sound files and the <literal role="extension">.soundtheme</literal>
      files into the <filename class="directory">data/kdegames/ktuberling</filename> folder of your
      language translations.</para></listitem>
      <listitem><para>On that very same dir you need a <filename>CMakeLists.txt</filename> file
      describing how to install the files, typically it will be.</para>
<!--FIXME l10n-kf5/*/data/kdegames/ktuberling/CMakeLists.txt has DATA_INSTALL_DIR, has this to be changed?-->
<programlisting>
FILE( GLOB oggfiles *.ogg )
INSTALL( FILES ${oggfiles} DESTINATION ${KDE_INSTALL_DATADIR}/ktuberling/sounds/<replaceable>yourLanguageTwoLetterCode</replaceable> )
INSTALL( FILES <replaceable>yourLanguageTwoLetterCode</replaceable>.soundtheme DESTINATION ${KDE_INSTALL_DATADIR}/ktuberling/sounds/ )
</programlisting>
      </listitem>
    </itemizedlist>
  </listitem>

  <listitem><para>If you want to install it for yourself:</para>
    <itemizedlist>
      <listitem><para>Place <filename><replaceable>yourLanguageTwoLetterCode</replaceable>.soundtheme</filename>
      file into the <filename class="directory">ktuberling/sounds</filename> folder in
      <userinput><command>qtpaths</command> <option>--paths GenericDataLocation</option></userinput></para></listitem>
      <listitem><para>Place your sound files into the
      <filename class="directory">ktuberling/sounds/<replaceable>someUniquePath</replaceable></filename> folder in
      <userinput><command>qtpaths</command> <option>--paths GenericDataLocation</option></userinput></para></listitem>
    </itemizedlist>
  </listitem>
</itemizedlist>

<para>
Information on how to work with the translation mechanisms in &kde; is available
in <ulink url="https://l10n.kde.org/docs/translation-howto/index.html">The
&kde; Translation HOWTO</ulink>.
</para>

</sect1>

<sect1 id="for-programmers">

<title>For Programmers</title>
<para>&ktuberling; isn't really difficult to extend for programmers.</para>

<sect2 id="classes">
<title>C++ classes</title>

<variablelist>
  <varlistentry>
    <term><classname>TopLevel</classname></term>
    <listitem><para>Top-level window and basic program management.</para></listitem>
  </varlistentry>

  <varlistentry>
    <term><classname>PlayGround</classname></term>
    <listitem><para>Description of one of the game levels.</para></listitem>
  </varlistentry>

  <varlistentry>
    <term><classname>ToDraw</classname></term>
    <listitem><para>Description of one of the graphical <quote>objects</quote> to be
    drawn.</para></listitem>
  </varlistentry>

  <varlistentry>
    <term><classname>SoundFactory</classname></term>
    <listitem><para>Description of one of the languages and its sounds.</para></listitem>
  </varlistentry>

  <varlistentry>
    <term><classname>Action</classname></term>
    <listitem><para>One of the user's manipulation in the undo/redo stack.</para></listitem>
  </varlistentry>
</variablelist>

</sect2>

</sect1>
</chapter>