[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 <<a href="mailto:aacid@kde.org">aacid@kde.org</a>> \
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> > \
Hi all,<br> > <br>
> 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> \
> where I am trying to get two config entries that use the same enum.<br> > \
<br> > The entry EnumColorMode defines an enum with values like "Normal" = 0 and \
<br> > "InvertLuma" = 6.<br>
> <br>
> I can reuse the enum in these two ways:<br>
> <br>
> 1. Write <choices name="Okular::SettingsCore::EnumRenderMode" \
/>.<br> > This is documented as "It is also possible to [use] enums external to \
the <br> > generated class", just that the enum is not actually external.<br>
> <br>
> 2. Write <choices name="EnumRenderMode" /> in all entries, and \
the first time <br> > define it as usual.<br>
> This creates a global enum and then treats it as external enum.<br>
> <br>
> Both ways work, but don't use the KConfigSkeleton::ItemEnum as I defined it. \
<br> > This means, instead of "InvertLuma", it will write "6" to the config \
file.<br> > <br>
> 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't think it's currently possible to \
reuse the choices from one entry to the other.<br> <br>
Cheers,<br>
Albert<br>
<br>
> <br>
> Cheers, David<br>
> <br>
> <br>
> <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