[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice-devel
Subject: Re: Review Request: KoGenStyle(s) cleanup
From: "Jaroslaw Staniek" <staniek () kde ! org>
Date: 2010-03-08 23:23:11
Message-ID: 20100308232311.30212.7788 () localhost
[Download RAW message or body]
> On 2010-03-08 13:11:47, Thomas Zander wrote:
> > On Monday 8. March 2010 13.13.32 Jos van den Oever wrote:
> > > On Monday 08 March 2010 13:02:45 Thomas Zander wrote:
> > > > enum values all currently are consistently starting with 'Style' Or
> > > > StyleAuto, your change makes this inconsistent AFAICT. Starting and
> > > > ending with consistent wording is nowhere near as logical as only
> > > > starting with a consistent wording.
> > >
> > > No, the changes makes them consistently end with Auto.
> >
> > The point was that in Qt and KDE APIs we *either* start or end with a common
> > word. Not both.
> > Plenty of examples here; http://doc.trolltech.com/latest/qt.html
> >
> > > It's debatable if
> > > AutoStyle* would be better than Style*Auto, but the current change
> > > improves consistency.
> >
> > But it makes things inconsistent with the rest of KOffice and other APIs in our \
> > stack. The goal of consistent and easy to use APIs then would be best reached by \
> > changing the other enums you found that use Style*Auto to instead follow the \
> > StyleAuto* setup. Could you please coordinate with Jaroslaw to find those enums \
> > that use Style*Auto, Jos?
> > > > I don't think this change makes things easier to guess mostly because
> > > > its inconsistent with Qt and KOffice practices.
> > >
> > > Can you provide a link to these practices, or better, quote them with a
> > > link?
> >
> > Loads of enums that are doing a good job in following this pattern can easily be \
> > found in the Qt namespace; http://doc.trolltech.com/latest/qt.html
You know that I know the rules...
To say there's clear pattern followed by the Qt4 redesign, one should say it is not \
violated (except for accidents). 15 seconds of research shows:
enum AspectRatioMode { IgnoreAspectRatio, KeepAspectRatio, KeepAspectRatioByExpanding \
} It shows that good composition is also important - the rule is somewhat more like a \
guideline - values need to be memorizable...
However I propose something that may satisfy most of us:
enum Type {
PageLayoutStyle, ///< style:page-layout as in odf 14.3 Page \
Layout
TextStyle, ///< style:style from family "text" as in odf \
14.8.1 Text Styles (office:styles)
TextAutoStyle, ///< style:style from family "text" as in odf \
14.8.1 Text Styles (office:automatic-styles)
ParagraphStyle, ///< style:style from family "paragraph" as in \
odf 14.1 Style Element (office:styles) //...
- Jaroslaw
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/3090/#review4414
-----------------------------------------------------------
On 2010-03-03 13:22:46, Jaroslaw Staniek wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/3090/
> -----------------------------------------------------------
>
> (Updated 2010-03-03 13:22:46)
>
>
> Review request for KOffice.
>
>
> Summary
> -------
>
> NOTE: the patch only contains changes to KoGenStyle*.* files. Required updates for \
> other KOffice code shall be provided after this patch is approved.
> * KoGenStyle::Type cleanup:
> - renamed StyleUser to StyleParagraph
> - renamed StyleAuto to StyleParagraphAuto
> - move the 'Auto' to the end for the table style families
>
> * KoGenStyles::Flags made QFlags
>
> * KoGenStyles::lookup() -> KoGenStyles::insert()
>
> * move KoGenStyle::isEmpty() code to .cpp
>
> * use constFind(), constBegin(), constEnd() for iterators if possible
>
> * made some methods const
>
> * introduced KoGenStyles::StylesPlacement for saving odf and inserting raw styles.
>
> * insertRawStyles() replaces 4 methods. saveOdfStyles() replaces 4 other methods.
>
> * KoGenStyle::N_NumTypes -> KoGenStyle::N_NumPropertyTypes
>
> * added KoGenStyle::N_NumTypes
>
> * KoGenStyles: StyleArray -> QList<KoGenStyles::NamedStyle>
>
> * KoGenStyles: NameMap typedef removed, using just QSet<QString> is clear
>
> * To minimize size of the patch, I am noting down remaining possible TODOs:
>
> TODO 1: make KoGenStyle implicitly shared: optimizes and fixes risk of BIC changes \
> because of m_properties
> TODO 2: add QList<KoGenStyles::NamedStyle> \
> KoGenStyles::Private::stylesForTypes[KoGenStyle::N_NumTypes] for optimizing static \
> QList<KoGenStyles::NamedStyle> styles(const QSet<QString>& names, KoGenStyle::Type \
> type)
> TODO 3: replace QSet<QString> KoGenStyles::Private::styleNames with QMap<QString, \
> KoGenStyle*> KoGenStyles::Private::styles for optimizing const KoGenStyle* \
> KoGenStyles::style(const QString& name) const
> TODO 4: implement qDebug() for KoGenStyles instead of dump()
>
> TODO 5: implement qDebug() for KoGenStyle instead of printDebug()
>
> TODO 6: rename to KoOdfStyle(s)
>
>
> Diffs
> -----
>
> trunk/koffice/libs/odf/KoGenStyle.h 1097689
> trunk/koffice/libs/odf/KoGenStyle.cpp 1097689
> trunk/koffice/libs/odf/KoGenStyles.h 1097689
> trunk/koffice/libs/odf/KoGenStyles.cpp 1097689
>
> Diff: http://reviewboard.kde.org/r/3090/diff
>
>
> Testing
> -------
>
> builds, checked if there's no change in semantics
>
>
> Thanks,
>
> Jaroslaw
>
>
_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic