diff options
author | Arno <am@disconnect.de> | 2013-07-06 08:06:52 +0200 |
---|---|---|
committer | Arno <am@disconnect.de> | 2013-07-06 08:06:52 +0200 |
commit | bd6a6a7c42dabe2d0d86e309a6dc6b04de7c0a10 (patch) | |
tree | b4a3cf4db50c84c08419562484e9016b7d4af5f6 /archivecontroller.h | |
parent | 04d9dcbe2139109e00d07488f6e45d0353a676e2 (diff) | |
download | SheMov-bd6a6a7c42dabe2d0d86e309a6dc6b04de7c0a10.tar.gz SheMov-bd6a6a7c42dabe2d0d86e309a6dc6b04de7c0a10.tar.bz2 SheMov-bd6a6a7c42dabe2d0d86e309a6dc6b04de7c0a10.zip |
Basic ArchiveFilesModel and ArchiveController
Implement a new file model for the archive. It's quite basic at this
stage, but finally something happens when clicking the archive tree.
Also, implement the interaction (signal -> slot) between the views and
models in an explicit controller to prevent the mess from the old
archive.
Diffstat (limited to 'archivecontroller.h')
-rw-r--r-- | archivecontroller.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/archivecontroller.h b/archivecontroller.h new file mode 100644 index 0000000..e956d37 --- /dev/null +++ b/archivecontroller.h @@ -0,0 +1,46 @@ +/* + 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 ARCHIVECONTROLLER_H +#define ARCHIVECONTROLLER_H + +#include <QObject> +#include <QItemSelection> + +class ArchiveTree; +class ArchiveProxy; +class ArchiveFiles; +class ArchiveFilesProxy; +class ArchiveModel; +class ArchiveFilesModel; +class QItemSelectionModel; +class QSortFilterProxyModel; + +class ArchiveController : public QObject { + Q_OBJECT + public: + explicit ArchiveController(QObject *parent = 0); + void setArchiveView(ArchiveTree *atree, ArchiveProxy *aproxy); + void setArchiveFiles(ArchiveFiles *afiles, ArchiveFilesProxy *afilesproxy); + void setModels(ArchiveModel *amodel, ArchiveFilesModel *afilesmodel); + void init(); + + private slots: + void treeSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected); + + private: + QModelIndexList mapToSource(const QSortFilterProxyModel *proxy, const QModelIndexList idxs) const; + ArchiveTree *mArchiveTree; + ArchiveProxy *mArchiveProxy; + QItemSelectionModel *mArchiveSelection; + ArchiveFiles *mArchiveFiles; + ArchiveFilesProxy *mArchiveFilesProxy; + ArchiveModel *mArchiveModel; + ArchiveFilesModel *mArchiveFilesModel; +}; + +#endif // ARCHIVECONTROLLER_H |