mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-25 11:52:40 +01:00
27 lines
790 B
C++
27 lines
790 B
C++
#include "ArchiveContentsWidget.hpp"
|
|
|
|
ArchiveContentsWidget::ArchiveContentsWidget(QWidget* parent, Qt::WindowFlags flags)
|
|
: QDockWidget(parent, flags), model(nullptr)
|
|
{
|
|
setWindowTitle("Archive");
|
|
table = new QListView();
|
|
setWidget(table);
|
|
}
|
|
|
|
void ArchiveContentsWidget::setArchive(const LoaderIMG& archive)
|
|
{
|
|
auto m = table->model();
|
|
model = new IMGArchiveModel(archive);
|
|
table->setModel(model);
|
|
delete m;
|
|
connect(table->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)), SLOT(selectedIndexChanged(QModelIndex)));
|
|
}
|
|
|
|
void ArchiveContentsWidget::selectedIndexChanged(const QModelIndex& current)
|
|
{
|
|
if(current.row() < model->getArchive().getAssetCount()) {
|
|
auto& f = model->getArchive().getAssetInfoByIndex(current.row());
|
|
emit selectedFileChanged(f.name);
|
|
}
|
|
}
|