summaryrefslogtreecommitdiffstats
path: root/smglobals.h
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2010-07-24 17:15:00 +0200
committerArno <am@disconnect.de>2010-07-24 17:15:00 +0200
commitad322157891cec53a7b660629d7c244e75df81d5 (patch)
tree0ffbc54d683f6e8c4925b669bb1732ac52cae0de /smglobals.h
parentb465c59cce7418968f268b9888a8236be281fda5 (diff)
downloadSheMov-ad322157891cec53a7b660629d7c244e75df81d5.tar.gz
SheMov-ad322157891cec53a7b660629d7c244e75df81d5.tar.bz2
SheMov-ad322157891cec53a7b660629d7c244e75df81d5.zip
Act on doubleClick in FileTreeWidget
When doubleclicking a picture in FileTreeWidget the pictureViewer is shown. Doubleclicking a movie file launches the default movie player. Since PictureViewer is now used in FileSystemWidget and ArchiveTreeView a global instance is needed. The appropriate place for this is a singleton. Since we already had a singleton for QAbstractItemModels I renamed it to SmGlobals and added a function to return a PictureViewer object. Renaming it was quite easy thanks to QtCreator's ability to rename variable names.
Diffstat (limited to 'smglobals.h')
-rw-r--r--smglobals.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/smglobals.h b/smglobals.h
new file mode 100644
index 0000000..50db16a
--- /dev/null
+++ b/smglobals.h
@@ -0,0 +1,33 @@
+/*
+ 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 <QHash>
+
+class QAbstractItemModel;
+class PictureViewer;
+
+class SmGlobals : public QObject {
+ Q_OBJECT
+ public:
+ ~SmGlobals();
+ static SmGlobals *instance();
+ QAbstractItemModel *model(const QString &which);
+ PictureViewer *pictureViewer();
+
+ private:
+ SmGlobals();
+ SmGlobals(const SmGlobals &other);
+ SmGlobals &operator=(const SmGlobals &other);
+ static SmGlobals *mInstance;
+ QHash<QString, QAbstractItemModel*> mModels;
+ PictureViewer *mPictureViewer;
+};
+
+#endif