From e8f4f398c60060d4edd09065000d977cf38a9bcc Mon Sep 17 00:00:00 2001 From: Arno Date: Wed, 23 Jun 2010 20:27:32 +0200 Subject: Singleton cleanup The SmUberModel class wasn't needed at all, so I removed it. Instead I renamed SmUmberModelSingleton into a real singleton for all QAbstractItemModel*, though right now it only supports the SeriesTreeModel and FileTreeModel. But it should eventually evolve into a singleton for all QAbstractItemModel *. For this I renamed the class SmUberModelSingleton to SmModelSingleton. --- smmodelsingleton.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 smmodelsingleton.h (limited to 'smmodelsingleton.h') diff --git a/smmodelsingleton.h b/smmodelsingleton.h new file mode 100644 index 0000000..e8a3eaf --- /dev/null +++ b/smmodelsingleton.h @@ -0,0 +1,30 @@ +/* + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version + 2 of the License, or (at your option) any later version. +*/ + +#ifndef SMUBERMODELSINGLETON_H +#define SMUBERMODELSINGLETON_H + +#include + +class QAbstractItemModel; + +class SmModelSingleton : public QObject { + Q_OBJECT + public: + ~SmModelSingleton(); + static SmModelSingleton *instance(); + QAbstractItemModel *model(const QString &which); + + private: + SmModelSingleton() {} + SmModelSingleton(const SmModelSingleton &other); + SmModelSingleton &operator=(const SmModelSingleton &other); + static SmModelSingleton *mInstance; + QHash mModels; +}; + +#endif -- cgit v1.2.3-70-g09d2