From bd6a6a7c42dabe2d0d86e309a6dc6b04de7c0a10 Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 6 Jul 2013 08:06:52 +0200 Subject: 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. --- archivecontroller.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 archivecontroller.h (limited to 'archivecontroller.h') 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 +#include + +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 -- cgit v1.2.3-70-g09d2