[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: kconfig_compiler question: reusing the enum of a previous config entry
From:       Tomaz Canabrava <tcanabrava () kde ! org>
Date:       2021-03-25 7:48:02
Message-ID: CACk01_w3E8zNhyLXMvyGLQD5aUm4B-ek13mmpJsv5T99Ga=NTg () mail ! gmail ! com
[Download RAW message or body]

The enums are always saved as int on the config, this is not a bug, but per
design.


On Sun, 21 Mar 2021 at 11:37 Albert Astals Cid <aacid@kde.org> wrote:

> El dissabte, 20 de març de 2021, a les 17:02:19 CET, David Hurka va
> escriure:
> > Hi all,
> >
> > I am working on
> https://invent.kde.org/graphics/okular/-/merge_requests/366,
> > where I am trying to get two config entries that use the same enum.
> >
> > The entry EnumColorMode defines an enum with values like "Normal" = 0
> and
> > "InvertLuma" = 6.
> >
> > I can reuse the enum in these two ways:
> >
> > 1. Write <choices name="Okular::SettingsCore::EnumRenderMode" />.
> > This is documented as "It is also possible to [use] enums external to
> the
> > generated class", just that the enum is not actually external.
> >
> > 2. Write <choices name="EnumRenderMode" /> in all entries, and the first
> time
> > define it as usual.
> > This creates a global enum and then treats it as external enum.
> >
> > Both ways work, but don't use the KConfigSkeleton::ItemEnum as I defined
> it.
> > This means, instead of "InvertLuma", it will write "6" to the config
> file.
> >
> > Is there a proper way to reuse the enum of a previous config entry?
>
> Looking at KConfigXmlParser::readChoicesFromEntry and
> KConfigXmlParser::readGroupElements I don't think it's currently possible
> to reuse the choices from one entry to the other.
>
> Cheers,
>   Albert
>
> >
> > Cheers, David
> >
> >
> >
>
>
>
>
>

[Attachment #3 (text/html)]

<div dir="auto">The enums are always saved as int on the config, this is not a bug, \
but per design.  </div><div dir="auto"><br></div><div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, 21 Mar 2021 at 11:37 \
Albert Astals Cid &lt;<a href="mailto:aacid@kde.org">aacid@kde.org</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)">El \
dissabte, 20 de març de 2021, a les 17:02:19 CET, David Hurka va escriure:<br> &gt; \
Hi all,<br> &gt; <br>
&gt; I am working on <a \
href="https://invent.kde.org/graphics/okular/-/merge_requests/366" rel="noreferrer" \
target="_blank">https://invent.kde.org/graphics/okular/-/merge_requests/366</a>, <br> \
&gt; where I am trying to get two config entries that use the same enum.<br> &gt; \
<br> &gt; The entry EnumColorMode defines an enum with values like "Normal" = 0 and \
<br> &gt; "InvertLuma" = 6.<br>
&gt; <br>
&gt; I can reuse the enum in these two ways:<br>
&gt; <br>
&gt; 1. Write &lt;choices name=&quot;Okular::SettingsCore::EnumRenderMode&quot; \
/&gt;.<br> &gt; This is documented as "It is also possible to [use] enums external to \
the <br> &gt; generated class", just that the enum is not actually external.<br>
&gt; <br>
&gt; 2. Write &lt;choices name=&quot;EnumRenderMode&quot; /&gt; in all entries, and \
the first time <br> &gt; define it as usual.<br>
&gt; This creates a global enum and then treats it as external enum.<br>
&gt; <br>
&gt; Both ways work, but don't use the KConfigSkeleton::ItemEnum as I defined it. \
<br> &gt; This means, instead of "InvertLuma", it will write "6" to the config \
file.<br> &gt; <br>
&gt; Is there a proper way to reuse the enum of a previous config entry?<br>
<br>
Looking at KConfigXmlParser::readChoicesFromEntry and \
KConfigXmlParser::readGroupElements I don&#39;t think it&#39;s currently possible to \
reuse the choices from one entry to the other.<br> <br>
Cheers,<br>
   Albert<br>
<br>
&gt; <br>
&gt; Cheers, David<br>
&gt; <br>
&gt; <br>
&gt; <br>
<br>
<br>
<br>
<br>
</blockquote></div></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic