Zandronum Chat on our Discord Server Get the latest version: 3.2
Source Code

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0003523Doomseeker[All Projects] Suggestionpublic2018-09-26 00:242018-10-27 22:54
ReporterWubTheCaptain 
Assigned ToPol M 
PriorityhighSeverityfeatureReproducibilityN/A
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version1.1 
Target Version1.2Fixed in Version1.2 
Summary0003523: Add support for textboxes in "about" dialogs of plugins
DescriptionWe need to reproduce a BSD license for an engine plugin (Turok 2 Remaster), but Doomseeker's API doesn't support this yet in the ideal place (the plugin).
Additional Information0003511:

Quote from Zalewa
I agree with you that going with the textbox is the correct approach. Add it to the plugins tab in the About dialog and you should be able to populate it with any text the plugin provides.

The text itself, however, is another thing altogether. There's currently no API to provide such text. You could see how the name and version are inserted. The text that appears there is set in the init() call (example: chocolatedoomengineplugin.cpp, look for init() call in the constructor). However, any data that is generated there in this init() is generated only once and also before the translations are loaded and then it is never generated again. This means that if you add an extra "QString aboutText" field to EnginePlugin::Data, it will never get translated.

Solutions to this can be:

1) Around-the-bush and boiler-platey, but doesn't break ABI:

1.1) Create a "class MAIN_EXPORT TextProvider : public QObject { Q_OBJECT; public: virtual QString provide() = 0; }". Place this somewhere in the serverapi in a textprovider.h file.
1.2) In plugins, create [PluginName]AboutProvider : TextProvider classes, override the 'provide()' method and return the tr()'d about text from there.
1.3) In EnginePlugin::Data create a "QSharedPointer<TextProvider> aboutProvider" field.
1.4) In init() in each plugin, assign "new [PluginName]AboutProvider" to the "Data::aboutProvider" field.

2) More straight-to-the-point, but will break ABI. Note that while this is unprofessional, it has also been very common through the course of the development of this program and also all plugins will require update for the next release anyway.

2.1) Add a "virtual QString aboutText();" method to EnginePlugin with default implementation returning an empty "QString()" object.
2.2) Somewhere in Turok 2 Ex plugin create a localized class that inherits from QObject and utilizes Q_OBJECT macro so that tr() can work. You can call this macro "Turok2ExText". This class should work just fine even when declared in the turok2exengineplugin.cpp file.
2.3) In this class add "public static QString about()" method from which you will return the plugin's about text.
2.4) In Turok2ExEnginePlugin override the method "QString aboutText()" method and make it return the value produced by "Turok2ExText::about()".
Attached Files

- Relationships
child of 0003511closedPol M Turok's CRC code: Missing BSD license 

-  Notes
User avatar (0019796)
Pol M (developer)
2018-09-28 19:51
edited on: 2018-09-28 20:07

Ok! As stated, I've gone with option A, and it works as expected. I've made a commit in my personal repo: which you can find here.
I won't make a pull request because it is technically unfinished work and the descriptions only have a simple text as a replacement right now.

About the texts that should go in, I think that either you (as the team, not only Zalewa) tell me what to put in or I actually make the pull request and let that to the hands of someone else. Since this is out of the scope of this ticket, It will be discussed in 0003511

I've added a licence in the top of the "serverapi/textprovider.h" file. It is the same as the one of another file, but I've changed the "Copyright (C)" to my data: (// Copyright (C) 2018 "Pol Marcet Sardà" <polmarcetsarda@gmail.com>)

I don't know if at the end I've broken the ABI. I tried not to, but it's the first time I even have to think about its existence.

Anecdotical P.D:
I had to debug for a few hours because I am stupid and put the "EP_AboutProvider" after "EP_Done". I know, I should have read the engineplugin.cpp in more detail, and for a few minutes, I was considering if I had forgotten how to even make if statements.
That's a new record debugging stupid mistakes.

User avatar (0019806)
Zalewa (developer)
2018-09-29 08:36

Review done at the provided commit link.

Quote from Pol M
Anecdotical P.D:
I had to debug for a few hours because I am stupid and put the "EP_AboutProvider" after "EP_Done". I know, I should have read the engineplugin.cpp in more detail, and for a few minutes, I was considering if I had forgotten how to even make if statements.
That's a new record debugging stupid mistakes.

Long, long time ago I was working on some project. I don't remember what it was right now, but I remember I already had lots of done on it and the program was working and I was happily working on further improvements. All of a sudden, the whole thing stopped compiling, throwing out hundreds of horrendous errors. None of the errors wre helpful in locating the problem. Nowadays in such situation it's a good idea to look at the diff of the code and try to see what you've changed. However, it happened back in the times when SVN was the king of version control systems and homebrewed developers barely knew of it, let alone knew how to actually use it beyond the "code backup" utility. I started cutting large portions of code furiously hoping to cut out the problem that caused all those errors in hope to narrow down its location. Eventually, I noticed that the problem is gone only after I remove the contents of the whole .cpp file. I couldn't figure out how is it possible that the whole file is suddenly broken, until I saw it.

Right on the first line, on the first column, right before the header comment, before the two '//' characters, there was a letter 'k', sitting there. This one small letter caused the compiler to go nuts, spewing errors left and right. How it got there? Probably when I was switching between editor tabs, I mistakenly pressed this key on the keyboard. I don't remember how much time I spent on trying to find this, but I remember it tore me apart.
User avatar (0019808)
Pol M (developer)
2018-09-29 09:02

Quote from Zalewa

Review done at the provided commit link.

Since this is now reviewed, I'll now set this to "needs testing" and I'll change it to "resolved" once the parent ticket is done.

Quote from Zalewa
before the two '//' characters, there was a letter 'k', sitting there

With keystrokes like those, who needs enemies 🤣
I feel you, more than once I've hit the "l" or "ñ" key after a ";" and made the compiler go crazy. Fortunately, this situation is a lot easier to narrow down, Since everything works okay until it reaches the line.
User avatar (0019817)
Pol M (developer)
2018-09-29 13:25

address all mentioned. (except for the removal of the #include in engineplugin.h, which is necessary for QScopedPointer).

For today I'm done, more tomorrow :)

Issue Community Support
This issue is already marked as resolved.
If you feel that is not the case, please reopen it and explain why.
Supporters: No one explicitly supports this issue yet.
Opponents: No one explicitly opposes this issue yet.

- Issue History
Date Modified Username Field Change
2018-09-26 00:24 WubTheCaptain New Issue
2018-09-26 00:24 WubTheCaptain Relationship added child of 0003511
2018-09-26 01:50 WubTheCaptain Status new => acknowledged
2018-09-26 05:54 Pol M Assigned To => Pol M
2018-09-26 05:54 Pol M Status acknowledged => assigned
2018-09-28 19:51 Pol M Note Added: 0019796
2018-09-28 19:52 Pol M Status assigned => needs review
2018-09-28 20:07 Pol M Note Edited: 0019796 View Revisions
2018-09-29 08:36 Zalewa Note Added: 0019806
2018-09-29 09:02 Pol M Note Added: 0019808
2018-09-29 09:14 Pol M Status needs review => needs testing
2018-09-29 13:25 Pol M Note Added: 0019817
2018-09-29 13:25 Pol M Status needs testing => needs review
2018-10-01 18:42 Pol M Status needs review => needs testing
2018-10-02 05:39 WubTheCaptain Status needs testing => resolved
2018-10-02 05:39 WubTheCaptain Resolution open => fixed
2018-10-02 05:39 WubTheCaptain Fixed in Version => 1.2
2018-10-02 05:39 WubTheCaptain Target Version => 1.2
2018-10-27 22:54 WubTheCaptain Status resolved => closed






Questions or other issues? Contact Us.

Links


Copyright © 2000 - 2025 MantisBT Team
Powered by Mantis Bugtracker