Difference between revisions of "Porting to TDE"

From Trinity Desktop Project Wiki
Jump to navigation Jump to search
(→‎Widget styles: Added notes about important changes)
(Fix typo, move TODO into Widget styles section)
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{TODO}}
 
 
 
This page is intended to provide generic instructions for porting old KDE3 software to the Trinity libraries.
 
This page is intended to provide generic instructions for porting old KDE3 software to the Trinity libraries.
   
 
== Build system ==
 
== Build system ==
   
  +
Trinity software uses CMake with [https://mirror.git.trinitydesktop.org/gitea/TDE/tde-common-cmake custom macros]. Since R14.0.11 these macros are automatically installed as part of Trinity, so you don't need to worry about including them as a submodule anymore.
  +
  +
The best way to get a hang of how it all works is to take a look at how CMake is used in an existing project. For simplicity take a standalone app package as an example (e.g. [https://mirror.git.trinitydesktop.org/gitea/TDE/mathemagics/ Mathemagics]). Note the files named <tt>CMakeLists.txt</tt>, <tt>CMakeL10n.txt</tt>, <tt>ConfigureChecks.cmake</tt> and <tt>config.h.cmake</tt> and how they configure, build and link the software.
  +
  +
More specific notes can be found in other Wiki articles, depending on what you are trying to port.
  +
  +
=== Autoconf ===
  +
  +
While porting you might want to keep the existing build system (until you figure out how everything works). To do this, remove the bundled <tt>admin</tt> directory and then clone the <tt>tde-common-admin</tt> submodule in the place of the removed directory:
  +
  +
<syntaxhighlight lang="shell-session">
  +
$ git rm -r admin
  +
$ git submodule add https://mirror.git.trinitydesktop.org/gitea/TDE/tde-common-admin admin
  +
</syntaxhighlight>
  +
  +
If you do this before actually porting the software, make sure the porting scripts do not overwrite anything in the <tt>admin</tt> directory where the submodule resides: you might get strange errors like <tt>configure</tt> being unable to locate TQt.
  +
  +
When you've got things building you '''should''' port the software to CMake.
   
 
== Software ==
 
== Software ==
   
  +
Porting Qt3 and KDE3 software to Trinity has mostly been automated with [https://mirror.git.trinitydesktop.org/gitea/TDE/scripts/ scripts]. Before porting your first application/style/... do obtain these scripts from TGW:
  +
  +
<syntaxhighlight lang="shell-session">
  +
$ git clone https://mirror.git.trinitydesktop.org/gitea/TDE/scripts/
  +
</syntaxhighlight>
  +
  +
Then, to port a KDE3 application you would follow the following steps:
  +
  +
1. Switch into the directory containing the source code.
  +
  +
2. Create an initial commit with the original form of the source code.
  +
  +
3. Run the Qt3→TQt conversion script.
  +
<syntaxhighlight lang="shell-session">
  +
$ ../scripts/conversions/qt3-tqt3/convert_existing_qt3_app_to_tqt3
  +
</syntaxhighlight>
  +
  +
4. Replace all <code><ntq*.h></code> headers with <code><tq*.h></code> ones in order to use the TQt-TDE interface (simply remove the <tt>n</tt> letter from the front of the header's filename). This can be automated with a small script:
  +
  +
<syntaxhighlight lang="shell">
  +
#!/bin/bash
  +
for f in $(grep -Rl "<ntq[[:alnum:]]*.h>" * --include=\*.{h,c,cpp,ui});
  +
do
  +
sed -Ei 's!<n(tq[[:alnum:]]*.h)>!<\1>!g' $f
  +
done
  +
</syntaxhighlight>
  +
  +
5. Commit your changes labeled "Qt3→TQt conversion" or similarly.
  +
  +
6. Run the KDE3→TDE conversion script.
  +
<syntaxhighlight lang="shell-session">
  +
$ ../scripts/conversions/kde-tde/convert_existing_kde3_app_to_tde
  +
</syntaxhighlight>
  +
  +
7. Commit your changes labeled "KDE3→TDE conversion" or similarly.
  +
  +
8. Try to build. If this fails take note of the errors and fix them. Don't forget to commit your changes describing what you fixed.
  +
  +
For Qt3-only apps follow steps 1 to 5.
   
 
== Widget styles ==
 
== Widget styles ==
 
{{TODO}}
 
{{WarningBox|text=The '''TQt API docs''' do not currently seem to reflect the API changes described here.}}
   
 
The TQt Style API has [https://mirror.git.trinitydesktop.org/gitea/TDE/tqt3/src/branch/master/changes-3.5 undergone] [https://mirror.git.trinitydesktop.org/cgit/qt3/commit/?id=0008bc5bcd95694b38b0d0322aac2ea6fdb21298 some important changes], so porting a widget style to TDE will entail a little more than just running scripts.
 
The TQt Style API has [https://mirror.git.trinitydesktop.org/gitea/TDE/tqt3/src/branch/master/changes-3.5 undergone] [https://mirror.git.trinitydesktop.org/cgit/qt3/commit/?id=0008bc5bcd95694b38b0d0322aac2ea6fdb21298 some important changes], so porting a widget style to TDE will entail a little more than just running scripts.
Line 18: Line 75:
 
* <tt>SH_UnderlineAccelerator</tt> has been extended with a new style hint, <tt>SH_HideUnderlineAcceleratorWhenAltUp</tt>.
 
* <tt>SH_UnderlineAccelerator</tt> has been extended with a new style hint, <tt>SH_HideUnderlineAcceleratorWhenAltUp</tt>.
   
Porting an existing style to the new API is relatively straightforward; simply update the function definitions in the existing style with the new definition prototypes and cast the passed pointer to TQWidget or TQObject where appropriate.
+
Porting an existing style to the new API is relatively straightforward; simply update the function definitions in the existing style with the new definition prototypes and cast the passed pointer to TQWidget or TQObject where appropriate. You can see this in practice if you look into the relevant commits of already ported widget styles. See [https://mirror.git.trinitydesktop.org/gitea/TDE/tde-style-ia-ora/commit/d4a24866b531801cace227c1d09fda763cbca8ac this commit of tde-style-ia-ora] for example.
 
{{WarningBox|text=The '''TQt API docs''' do not currently seem to reflect these changes.}}
 
 
== Window decorations ==
 
 
   
 
[[Category:Developers]]
 
[[Category:Developers]]

Latest revision as of 09:08, 1 May 2023

This page is intended to provide generic instructions for porting old KDE3 software to the Trinity libraries.

Build system

Trinity software uses CMake with custom macros. Since R14.0.11 these macros are automatically installed as part of Trinity, so you don't need to worry about including them as a submodule anymore.

The best way to get a hang of how it all works is to take a look at how CMake is used in an existing project. For simplicity take a standalone app package as an example (e.g. Mathemagics). Note the files named CMakeLists.txt, CMakeL10n.txt, ConfigureChecks.cmake and config.h.cmake and how they configure, build and link the software.

More specific notes can be found in other Wiki articles, depending on what you are trying to port.

Autoconf

While porting you might want to keep the existing build system (until you figure out how everything works). To do this, remove the bundled admin directory and then clone the tde-common-admin submodule in the place of the removed directory:

$ git rm -r admin
$ git submodule add https://mirror.git.trinitydesktop.org/gitea/TDE/tde-common-admin admin

If you do this before actually porting the software, make sure the porting scripts do not overwrite anything in the admin directory where the submodule resides: you might get strange errors like configure being unable to locate TQt.

When you've got things building you should port the software to CMake.

Software

Porting Qt3 and KDE3 software to Trinity has mostly been automated with scripts. Before porting your first application/style/... do obtain these scripts from TGW:

$ git clone https://mirror.git.trinitydesktop.org/gitea/TDE/scripts/

Then, to port a KDE3 application you would follow the following steps:

1. Switch into the directory containing the source code.

2. Create an initial commit with the original form of the source code.

3. Run the Qt3→TQt conversion script.

$ ../scripts/conversions/qt3-tqt3/convert_existing_qt3_app_to_tqt3

4. Replace all <ntq*.h> headers with <tq*.h> ones in order to use the TQt-TDE interface (simply remove the n letter from the front of the header's filename). This can be automated with a small script:

#!/bin/bash
for f in $(grep -Rl "<ntq[[:alnum:]]*.h>" * --include=\*.{h,c,cpp,ui});
do
    sed -Ei 's!<n(tq[[:alnum:]]*.h)>!<\1>!g' $f
done

5. Commit your changes labeled "Qt3→TQt conversion" or similarly.

6. Run the KDE3→TDE conversion script.

$ ../scripts/conversions/kde-tde/convert_existing_kde3_app_to_tde

7. Commit your changes labeled "KDE3→TDE conversion" or similarly.

8. Try to build. If this fails take note of the errors and fix them. Don't forget to commit your changes describing what you fixed.

For Qt3-only apps follow steps 1 to 5.

Widget styles

Konqi.png
To-do
This section has not been written/completed yet. You can contribute to Trinity by writing or finalizing this section.
Messagebox warning.png
Warning!
The TQt API docs do not currently seem to reflect the API changes described here.

The TQt Style API has undergone some important changes, so porting a widget style to TDE will entail a little more than just running scripts.

Keep the following changes in mind:

  • Most functions' definitions have changed;
  • The usage of the widget argument is deprecated in favor of specifying widget parameters via ceData and elementFlags;
  • SH_UnderlineAccelerator has been extended with a new style hint, SH_HideUnderlineAcceleratorWhenAltUp.

Porting an existing style to the new API is relatively straightforward; simply update the function definitions in the existing style with the new definition prototypes and cast the passed pointer to TQWidget or TQObject where appropriate. You can see this in practice if you look into the relevant commits of already ported widget styles. See this commit of tde-style-ia-ora for example.