D22381: Add previous-/nextActivity methods
Ivan Čukić
noreply at phabricator.kde.org
Thu Jul 11 13:14:05 BST 2019
ivan requested changes to this revision.
ivan added a comment.
This revision now requires changes to proceed.
Inserting/Removing/Updating a sorted list does not need to resort every time - removing is easy, adding a new item is std::lower_bound (a binary search), and updating is a combination of the two.
INLINE COMMENTS
> Activities.cpp:54
>
> +static
> +bool infoLessThan(const ActivityInfo &info, const ActivityInfo &other)
You can use anonymous namespace for this (instead of `static`) or just make it a non-static function.
It can be marked as `inline`, although the compiler will probably do that regardless of you saying so.
You can rename it to something like `nameBasedOrdering` - better communicates what it does.
> Activities.cpp:349
> }
> + updateSortedActivityList();
>
You can just find the activity in the list, and remove it - the order for the rest will not change.
> Activities_p.h:76
> QHash<QString, Activities::State> activities;
> + QList<ActivityInfo> sortedActivities;
> QReadWriteLock activitiesLock;
`QList` -> `QVector`.
`QList` is an evil and slow class :)
REPOSITORY
R161 KActivity Manager Service
REVISION DETAIL
https://phabricator.kde.org/D22381
To: muesli, ivan
Cc: ivan, plasma-devel, LeGast00n, jraleigh, fbampaloukas, GB_2, ragreen, Pitel, ZrenBot, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20190711/78ebe07a/attachment.html>
More information about the Plasma-devel
mailing list