/* 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 #include #include "archivebrowser.h" #include "archivebrowsermodel.h" #include "smtreeview.h" #include "smglobals.h" #include "delegates.h" ArchiveBrowser::ArchiveBrowser(QWidget *parent) : QWidget(parent){ //prep mModel = static_cast(SmGlobals::instance()->model("BrowserModel")); mProxy = new QSortFilterProxyModel; mProxy->setSourceModel(mModel); mTree = new SmTreeView; mTree->setModel(mProxy); mTree->setColumnHidden(ArchiveBrowserModel::GenericId, true); mTree->setColumnHidden(ArchiveBrowserModel::NodeType, true); mTree->setSortingEnabled(true); mTree->setItemDelegateForColumn(ArchiveBrowserModel::TotalSize, new SizeDelegate(this)); mTree->setItemDelegateForColumn(ArchiveBrowserModel::FileType, new FileTypeDelegate(this)); mTree->setSelectionMode(QAbstractItemView::ExtendedSelection); //make widget QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(mTree); setLayout(mainLayout); }