summaryrefslogtreecommitdiffstats
path: root/archivetreeview.cpp
blob: d59d7234716be9c75b8416564a17900644495676 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
  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 <QTreeView>
#include <QSplitter>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QItemSelectionModel>
#include <QAbstractItemModel>

#include "archivetreeview.h"
#include "smmodelsingleton.h"
#include "smtreemodel.h"
#include "seriestreewidget.h"
#include "filestreewidget.h"
#include "filestreemodel.h"

ArchiveTreeView::ArchiveTreeView(QWidget *parent) : QWidget(parent){
	// series view
	mSeriesWidget = new SeriesTreeWidget;
	QItemSelectionModel *selModel = mSeriesWidget->seriesTree()->selectionModel();
	connect(selModel, SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, SLOT(currentChanged()));

	// files view
	mFilesWidget = new FilesTreeWidget;
	QAbstractItemModel *filesModel = SmModelSingleton::instance()->model("FilesTreeModel");
	mFilesModel = static_cast<FilesTreeModel*>(filesModel);


	// layout
	QHBoxLayout *mainLayout = new QHBoxLayout;
	QSplitter *splitter = new QSplitter;
	splitter->addWidget(mSeriesWidget);
	splitter->addWidget(mFilesWidget);
	mainLayout->addWidget(splitter);
	setLayout(mainLayout);
}

void ArchiveTreeView::currentChanged(){
	QModelIndexList sel = mSeriesWidget->seriesTree()->selectionModel()->selectedRows();
	if(sel.isEmpty()){
		return;
	}
	mSelectedPartIds.clear();
	foreach(QModelIndex i, sel){

	}
}