mirror of
https://github.com/redstrate/Novus.git
synced 2025-04-26 13:47:46 +00:00
Now the hashes are collected in a central database (location to be improved) similar to FFXIV Explorer. This database needs to be generated once and doesn't have to be regen every time Sagasu is opened like before. This indexer currently is a separate program. Also adds a feature to extract files from the file tree window.
49 lines
No EOL
1.4 KiB
C++
49 lines
No EOL
1.4 KiB
C++
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#include "filetreewindow.h"
|
|
|
|
#include <QHBoxLayout>
|
|
#include <QMenu>
|
|
#include <QTreeWidget>
|
|
|
|
FileTreeWindow::FileTreeWindow(GameData *data, QWidget *parent)
|
|
: QWidget(parent)
|
|
, data(data)
|
|
{
|
|
setWindowTitle(QStringLiteral("File Tree"));
|
|
|
|
auto layout = new QHBoxLayout();
|
|
setLayout(layout);
|
|
|
|
m_fileModel = new FileTreeModel(data);
|
|
|
|
auto treeWidget = new QTreeView();
|
|
treeWidget->setModel(m_fileModel);
|
|
layout->addWidget(treeWidget);
|
|
|
|
treeWidget->setContextMenuPolicy(Qt::CustomContextMenu);
|
|
connect(treeWidget, &QTreeWidget::customContextMenuRequested, this, [this, treeWidget](const QPoint &pos) {
|
|
auto index = treeWidget->indexAt(pos);
|
|
|
|
if (index.isValid()) {
|
|
auto path = m_fileModel->data(index, Qt::UserRole).toString();
|
|
|
|
auto menu = new QMenu();
|
|
|
|
auto propertiesAction = menu->addAction(QStringLiteral("Properties"));
|
|
connect(propertiesAction, &QAction::triggered, this, [=] {
|
|
Q_EMIT openFileProperties(path);
|
|
});
|
|
|
|
auto extractAction = menu->addAction(QStringLiteral("Extract.."));
|
|
connect(extractAction, &QAction::triggered, this, [=] {
|
|
Q_EMIT extractFile(path);
|
|
});
|
|
|
|
menu->exec(treeWidget->mapToGlobal(pos));
|
|
}
|
|
});
|
|
}
|
|
|
|
#include "moc_filetreewindow.cpp" |