mirror of
https://github.com/redstrate/Novus.git
synced 2025-04-21 03:57:44 +00:00
sagasu: Use splitter, improve margins everywhere
This commit is contained in:
parent
9f48b89c2e
commit
2bd232f40e
2 changed files with 19 additions and 14 deletions
|
@ -16,29 +16,32 @@ FileTreeWindow::FileTreeWindow(HashDatabase &database, const QString &gamePath,
|
|||
{
|
||||
auto layout = new QVBoxLayout();
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->setSpacing(0);
|
||||
setLayout(layout);
|
||||
|
||||
m_searchModel = new QSortFilterProxyModel();
|
||||
m_searchModel->setRecursiveFilteringEnabled(true);
|
||||
m_searchModel->setFilterCaseSensitivity(Qt::CaseSensitivity::CaseInsensitive);
|
||||
|
||||
auto searchLayout = new QHBoxLayout();
|
||||
layout->addLayout(searchLayout);
|
||||
/*auto searchLayout = new QHBoxLayout();
|
||||
layout->addLayout(searchLayout);*/
|
||||
|
||||
auto searchEdit = new QLineEdit();
|
||||
searchEdit->setPlaceholderText(QStringLiteral("Search..."));
|
||||
searchEdit->setClearButtonEnabled(true);
|
||||
searchEdit->setProperty("_breeze_borders_sides", QVariant::fromValue(QFlags{Qt::BottomEdge}));
|
||||
connect(searchEdit, &QLineEdit::textChanged, this, [this](const QString &text) {
|
||||
m_searchModel->setFilterRegularExpression(text);
|
||||
});
|
||||
searchLayout->addWidget(searchEdit);
|
||||
layout->addWidget(searchEdit);
|
||||
|
||||
m_unknownCheckbox = new QCheckBox();
|
||||
// TODO Restore as an action, later. it's currently pretty useless as-is as it's a "please slow down and crash" checkbox
|
||||
/*m_unknownCheckbox = new QCheckBox();
|
||||
m_unknownCheckbox->setToolTip(QStringLiteral("Show unknown files and folders."));
|
||||
connect(m_unknownCheckbox, &QCheckBox::clicked, this, [this] {
|
||||
refreshModel();
|
||||
});
|
||||
searchLayout->addWidget(m_unknownCheckbox);
|
||||
searchLayout->addWidget(m_unknownCheckbox);*/
|
||||
|
||||
auto treeWidget = new QTreeView();
|
||||
treeWidget->setModel(m_searchModel);
|
||||
|
@ -76,7 +79,7 @@ FileTreeWindow::FileTreeWindow(HashDatabase &database, const QString &gamePath,
|
|||
void FileTreeWindow::refreshModel()
|
||||
{
|
||||
// TODO: this should really be handled by the proxy
|
||||
m_fileModel = new FileTreeModel(m_database, m_unknownCheckbox->isChecked(), m_gamePath, data);
|
||||
m_fileModel = new FileTreeModel(m_database, false, m_gamePath, data);
|
||||
m_searchModel->setSourceModel(m_fileModel);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <QMenuBar>
|
||||
#include <QMessageBox>
|
||||
#include <QNetworkReply>
|
||||
#include <QSplitter>
|
||||
#include <QTemporaryDir>
|
||||
|
||||
#include "cmppart.h"
|
||||
|
@ -30,15 +31,14 @@ MainWindow::MainWindow(const QString &gamePath, GameData *data)
|
|||
, fileCache(*data)
|
||||
{
|
||||
setupMenubar();
|
||||
setMinimumSize(1280, 720);
|
||||
|
||||
m_mgr = new QNetworkAccessManager(this);
|
||||
|
||||
auto dummyWidget = new QWidget();
|
||||
auto dummyWidget = new QSplitter();
|
||||
dummyWidget->setChildrenCollapsible(false);
|
||||
setCentralWidget(dummyWidget);
|
||||
|
||||
auto layout = new QHBoxLayout();
|
||||
dummyWidget->setLayout(layout);
|
||||
|
||||
m_tree = new FileTreeWindow(m_database, gamePath, data);
|
||||
connect(m_tree, &FileTreeWindow::extractFile, this, [this, data](const QString &path) {
|
||||
const QFileInfo info(path);
|
||||
|
@ -58,13 +58,13 @@ MainWindow::MainWindow(const QString &gamePath, GameData *data)
|
|||
connect(m_tree, &FileTreeWindow::pathSelected, this, [this](const QString &path) {
|
||||
refreshParts(path);
|
||||
});
|
||||
m_tree->setMaximumWidth(200);
|
||||
layout->addWidget(m_tree);
|
||||
m_tree->setMaximumWidth(300);
|
||||
dummyWidget->addWidget(m_tree);
|
||||
|
||||
partHolder = new QTabWidget();
|
||||
partHolder->setMinimumWidth(800);
|
||||
partHolder->setDocumentMode(true); // hide borders
|
||||
partHolder->setMinimumHeight(720);
|
||||
layout->addWidget(partHolder);
|
||||
dummyWidget->addWidget(partHolder);
|
||||
|
||||
refreshParts({});
|
||||
}
|
||||
|
@ -120,6 +120,8 @@ void MainWindow::refreshParts(const QString &path)
|
|||
|
||||
auto propertiesWidget = new FilePropertiesWindow(path, file);
|
||||
partHolder->addTab(propertiesWidget, QStringLiteral("Properties"));
|
||||
|
||||
partHolder->tabBar()->setExpanding(true);
|
||||
}
|
||||
|
||||
void MainWindow::setupFileMenu(QMenu *menu)
|
||||
|
|
Loading…
Add table
Reference in a new issue