File indexing completed on 2024-05-19 04:49:32
0001 /**************************************************************************************** 0002 * Copyright (c) 2010 Maximilian Kossick <maximilian.kossick@googlemail.com> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify it under * 0005 * the terms of the GNU General Public License as published by the Free Software * 0006 * Foundation; either version 2 of the License, or (at your option) any later * 0007 * version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0010 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0011 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0012 * * 0013 * You should have received a copy of the GNU General Public License along with * 0014 * this program. If not, see <http://www.gnu.org/licenses/>. * 0015 ****************************************************************************************/ 0016 0017 #include "core/support/Components.h" 0018 #include <QObject> 0019 0020 class ComponentsPrivate 0021 { 0022 public: 0023 ComponentsPrivate() 0024 : collectionManager( nullptr ) 0025 , engineController( nullptr ) 0026 , sqlStorage( nullptr ) 0027 , applicationController( nullptr ) 0028 , collectionLocationDelegate( nullptr ) 0029 , transcodingController( nullptr ) 0030 , statSyncingController( nullptr ) 0031 {} 0032 0033 CollectionManager *collectionManager; 0034 EngineController *engineController; 0035 SqlStorage *sqlStorage; 0036 Amarok::ApplicationController *applicationController; 0037 Collections::CollectionLocationDelegate *collectionLocationDelegate; 0038 Transcoding::Controller *transcodingController; 0039 StatSyncing::Controller *statSyncingController; 0040 }; 0041 0042 //using a static variable is ok in this case as ComponentsPrivate does nothing on destruction 0043 //in particular it does not delete any objects 0044 Q_GLOBAL_STATIC( ComponentsPrivate, d ) 0045 0046 //a define might be helpful for these getter/setters 0047 0048 #define COMPONENT_ACCESSORS( Type, getter, setter ) \ 0049 Type \ 0050 Amarok::Components::getter() \ 0051 { \ 0052 return d->getter ; \ 0053 } \ 0054 Type \ 0055 Amarok::Components::setter( Type type ) \ 0056 { \ 0057 Type old = d->getter; \ 0058 d->getter = type; \ 0059 return old; \ 0060 } 0061 0062 COMPONENT_ACCESSORS( CollectionManager*, collectionManager, setCollectionManager ) 0063 0064 COMPONENT_ACCESSORS( EngineController*, engineController, setEngineController ) 0065 0066 COMPONENT_ACCESSORS( SqlStorage*, sqlStorage, setSqlStorage ) 0067 0068 COMPONENT_ACCESSORS( Amarok::ApplicationController*, applicationController, setApplicationController ) 0069 0070 COMPONENT_ACCESSORS( Collections::CollectionLocationDelegate*, collectionLocationDelegate, setCollectionLocationDelegate ) 0071 0072 COMPONENT_ACCESSORS( Transcoding::Controller*, transcodingController, setTranscodingController ) 0073 0074 COMPONENT_ACCESSORS( StatSyncing::Controller*, statSyncingController, setStatSyncingController )