all repos — mgba @ ac2097f0b69965835397aa8d10be2525d3a34c00

mGBA Game Boy Advance Emulator

src/platform/qt/ArchiveInspector.cpp (view raw)

 1/* Copyright (c) 2013-2016 Jeffrey Pfau
 2 *
 3 * This Source Code Form is subject to the terms of the Mozilla Public
 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 6#include "ArchiveInspector.h"
 7
 8#include <mgba-util/vfs.h>
 9
10#include "ConfigController.h"
11
12using namespace QGBA;
13
14ArchiveInspector::ArchiveInspector(const QString& filename, QWidget* parent)
15	: QDialog(parent)
16	, m_model(ConfigController::configDir() + "/library.sqlite3")
17{
18	m_ui.setupUi(this);
19	m_model.loadDirectory(filename);
20	m_model.constrainBase(filename);
21	m_ui.archiveListing->setModel(&m_model);
22}
23
24VFile* ArchiveInspector::selectedVFile() const {
25	QModelIndex index = m_ui.archiveListing->selectionModel()->currentIndex();
26	if (!index.isValid()) {
27		return nullptr;
28	}
29	return m_model.openVFile(index);
30}