summaryrefslogtreecommitdiffstats
path: root/archiveview.cpp
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2013-07-06 08:06:52 +0200
committerArno <am@disconnect.de>2013-07-06 08:06:52 +0200
commitbd6a6a7c42dabe2d0d86e309a6dc6b04de7c0a10 (patch)
treeb4a3cf4db50c84c08419562484e9016b7d4af5f6 /archiveview.cpp
parent04d9dcbe2139109e00d07488f6e45d0353a676e2 (diff)
downloadSheMov-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 'archiveview.cpp')
-rw-r--r--archiveview.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/archiveview.cpp b/archiveview.cpp
index 34fd169..f570751 100644
--- a/archiveview.cpp
+++ b/archiveview.cpp
@@ -18,9 +18,10 @@
#include <QVBoxLayout>
#include "archiveview.h"
+#include "archivecontroller.h"
#include "smglobals.h"
-ArchiveView::ArchiveView(QWidget *parent) : QWidget(parent), mConstructing(true) {
+ArchiveView::ArchiveView(QWidget *parent) : QWidget(parent) {
QSettings s;
mArchiveModel = static_cast<ArchiveModel*>(SmGlobals::instance()->model("ArchiveModel"));
connect(mArchiveModel, SIGNAL(needRefresh()), this, SLOT(refreshArchive()));
@@ -74,7 +75,13 @@ ArchiveView::ArchiveView(QWidget *parent) : QWidget(parent), mConstructing(true)
treeLayout->addWidget(mTree);
QWidget *treeWidget = new QWidget;
treeWidget->setLayout(treeLayout);
+
mFiles = new ArchiveFiles;
+ mFilesModel = new ArchiveFilesModel(QStringList() << tr("Seriespartid") << tr("Filename") << tr("Md5Sum") << tr("Size") << tr("Dvd") << tr("Type") << tr("No") << tr("Quality") << tr("Fileid") << tr("Pic size") << tr("Duration") << tr("Full Path"), this);
+ mFilesProxy = new ArchiveFilesProxy;
+ mFilesProxy->setSourceModel(mFilesModel);
+ mFiles->setModel(mFilesProxy);
+
QSplitter *treeSplitter = new QSplitter(Qt::Horizontal);
treeSplitter->addWidget(treeWidget);
treeSplitter->addWidget(mFiles);
@@ -83,6 +90,7 @@ ArchiveView::ArchiveView(QWidget *parent) : QWidget(parent), mConstructing(true)
QHBoxLayout *mainLayout = new QHBoxLayout;
mainLayout->addWidget(treeSplitter);
setLayout(mainLayout);
+ initController();
}
int ArchiveView::currentSortOrder() const {
@@ -165,6 +173,14 @@ void ArchiveView::collapseItem(const QModelIndex &idx){
}
}
+void ArchiveView::initController(){
+ mController = new ArchiveController(this);
+ mController->setArchiveView(mTree, mProxy);
+ mController->setArchiveFiles(mFiles, mFilesProxy);
+ mController->setModels(mArchiveModel, mFilesModel);
+ mController->init();
+}
+
ArchiveTree::ArchiveTree(QWidget *parent) : SmTreeView(parent) {}
void ArchiveTree::setModel(ArchiveProxy *model){
@@ -224,3 +240,5 @@ bool ArchiveProxy::filterAcceptsRow(int sourceRow, const QModelIndex &sourcePare
ArchiveModel *model = qobject_cast<ArchiveModel*>(sourceModel());
return model->matchRecursive(nameIdx, mFilter);
}
+
+ArchiveFilesProxy::ArchiveFilesProxy(QObject *parent) : QSortFilterProxyModel(parent) {}