Biggie: introduce core/meta/forward_declarations.h and use it
We try to include only what is absolutely necessary in header files to keep compilation times low. This is especially useful not during the first compilation, but when you touch one (header) file -> the less this header is (transitively) included, the less files you need to recompile. Normally, forward declarations of all-but-direct members of the class help with this immensely. However, all our meta types use KSharedPtrs instead of plain pointers (for good reasons); forward-declaring these is well possible, but tedious to do in each header file that uses them. Introduce core/meta/forward_declarations.h that contains forward declarations of all KSharedPtr-managed classes in core/meta/* (and KSharedPtr include for convenience) Use the new file where appropriate. Now all header files should include core/meta/forward_declarations.h instead of Meta.h (and include Meta.h just in the .cpp file), unless they actually subclass one of those classes. Note that forward_declarations.h suffices even when you have Meta::[Something]Ptr as class attribute; with a small hiccup: your destructor needs to be implemented (even if empty) in a file that includes the full class declaration (the compiler catches this fortunately) of the meta class. That's why this patch add some seemingly redundant empty destructor implementations. Another hiccup is when you use Meta::[Something]Ptrs inside Qt signals/slots - the code that ends up in the .moc (or *_automoc.cpp) file and will usually need the full class declaration; simple trick is to add the old-style #include "FooClass.moc" at the end of the file. This is not that important per-se, but it paves the way for more Meta changes that we sketched in Randa. CCMAIL: amarok-devel@kde.org
Showing
- playground/src/context/applets/coverbling/CoverBling.h 1 addition, 1 deletionplayground/src/context/applets/coverbling/CoverBling.h
- playground/src/context/applets/coverbling/ImageLoader.cpp 4 additions, 1 deletionplayground/src/context/applets/coverbling/ImageLoader.cpp
- playground/src/context/applets/coverbling/ImageLoader.h 3 additions, 1 deletionplayground/src/context/applets/coverbling/ImageLoader.h
- playground/src/context/applets/coverbling/PhotoBrowser.h 13 additions, 12 deletionsplayground/src/context/applets/coverbling/PhotoBrowser.h
- playground/src/context/applets/coverbling/pictureflow.cpp 4 additions, 0 deletionsplayground/src/context/applets/coverbling/pictureflow.cpp
- playground/src/context/applets/coverbling/pictureflow.h 2 additions, 1 deletionplayground/src/context/applets/coverbling/pictureflow.h
- playground/src/context/applets/covergrid/AlbumItem.cpp 8 additions, 3 deletionsplayground/src/context/applets/covergrid/AlbumItem.cpp
- playground/src/context/applets/covergrid/AlbumItem.h 6 additions, 4 deletionsplayground/src/context/applets/covergrid/AlbumItem.h
- playground/src/context/applets/covergrid/CoverGridApplet.h 3 additions, 3 deletionsplayground/src/context/applets/covergrid/CoverGridApplet.h
- src/AmarokMimeData.h 1 addition, 1 deletionsrc/AmarokMimeData.h
- src/DirectoryLoader.h 1 addition, 1 deletionsrc/DirectoryLoader.h
- src/GlobalCollectionActions.h 1 addition, 1 deletionsrc/GlobalCollectionActions.h
- src/GlobalCurrentTrackActions.h 1 addition, 1 deletionsrc/GlobalCurrentTrackActions.h
- src/KNotificationBackend.h 1 addition, 1 deletionsrc/KNotificationBackend.h
- src/LastfmReadLabelCapability.h 1 addition, 1 deletionsrc/LastfmReadLabelCapability.h
- src/MainWindow.h 1 addition, 1 deletionsrc/MainWindow.h
- src/SvgHandler.h 3 additions, 3 deletionssrc/SvgHandler.h
- src/TrayIcon.h 1 addition, 1 deletionsrc/TrayIcon.h
- src/amarokurls/AmarokUrlHandler.h 1 addition, 1 deletionsrc/amarokurls/AmarokUrlHandler.h
- src/amarokurls/BookmarkMetaActions.h 1 addition, 1 deletionsrc/amarokurls/BookmarkMetaActions.h
Loading
Please register or sign in to comment