On Tuesday 11 August 2009, Ryan P. Bitanga wrote: > - I'd prefer to use a QHash<int, QString> commands private variable to > having so many string variables as well as an enum to specify the > command (something like enum Command { PlayCommand, NextCommand, > ...};) but that's just my preference
the code isn't any shorter, but now there's a bunch of hash insertions and lookups? hm. i don't think this wins anything but (negligibly) slower code and (negligibly) increased memory usage. it's not so bad as to revert it or anything, but it's not really an improvement to the code and isn't a pattern that should extend into other krunner code imho. one thing that should be improved, however, is the reading/writing of values from/to the config object. right now the string "com_quit" appears in two different files, once to read it and once to write it. that's an approach just asking for annoying errors :) instead, i'd recommend: static const char * CONFIG_QUIT "com_quit"; (or whatever you prefer to call it) in a header somewhere and then use CONFIG_QUIT (or whatever) in the code. that limits the "magic" string to just one location and lets the compiler complain when you misspell it one of the two files ;) speaking of misspellings, it's "increase" and "decrease" not "incrase" and "decrase" :) -- Aaron J. Seigo humru othro a kohnu se GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA EE75 D6B7 2EB1 A7F1 DB43 KDE core developer sponsored by Qt Software
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel