summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--shemov.pro6
-rw-r--r--smubermodelsingleton.cpp18
-rw-r--r--smubermodelsingleton.h24
3 files changed, 46 insertions, 2 deletions
diff --git a/shemov.pro b/shemov.pro
index 937117b..dfb9014 100644
--- a/shemov.pro
+++ b/shemov.pro
@@ -48,7 +48,8 @@ SOURCES = main.cpp \
archiveitemeditdialog.cpp \
smtreeitem.cpp \
smtreemodel.cpp \
- smubermodel.cpp
+ smubermodel.cpp \
+ smubermodelsingleton.cpp
HEADERS = listitem.h \
listmodel.h \
movieitem.h \
@@ -92,6 +93,7 @@ HEADERS = listitem.h \
archiveitemeditdialog.h \
smtreeitem.h \
smtreemodel.h \
- smubermodel.h
+ smubermodel.h \
+ smubermodelsingleton.h
LIBS += -lmagic
RESOURCES = shemov.qrc
diff --git a/smubermodelsingleton.cpp b/smubermodelsingleton.cpp
new file mode 100644
index 0000000..ef3d1e3
--- /dev/null
+++ b/smubermodelsingleton.cpp
@@ -0,0 +1,18 @@
+/*
+ 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.
+*/
+
+#include "smubermodelsingleton.h"
+#include "smubermodel.h"
+
+SmUberModel *SmUberModelSingleton::mInstance = 0;
+
+SmUberModel *SmUberModelSingleton::instance(){
+ if(!mInstance){
+ mInstance = new SmUberModel;
+ }
+ return mInstance;
+}
diff --git a/smubermodelsingleton.h b/smubermodelsingleton.h
new file mode 100644
index 0000000..80b2313
--- /dev/null
+++ b/smubermodelsingleton.h
@@ -0,0 +1,24 @@
+/*
+ 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
+
+class SmUberModel;
+
+class SmUberModelSingleton {
+ public:
+ static SmUberModel *instance();
+
+ private:
+ SmUberModelSingleton() {}
+ SmUberModelSingleton(const SmUberModelSingleton &other);
+ SmUberModelSingleton &operator=(const SmUberModelSingleton &other);
+ static SmUberModel *mInstance;
+};
+
+#endif