2022-04-14 08:24:06 -04:00
|
|
|
#include "mainwindow.h"
|
|
|
|
|
2023-07-08 10:33:12 -04:00
|
|
|
#include <QDesktopServices>
|
|
|
|
#include <QAction>
|
|
|
|
#include <QMenuBar>
|
|
|
|
#include <QUrl>
|
|
|
|
#include <QApplication>
|
2022-04-14 08:24:06 -04:00
|
|
|
#include <QHBoxLayout>
|
|
|
|
#include <QTableWidget>
|
|
|
|
#include <QTreeWidget>
|
|
|
|
#include <QDebug>
|
|
|
|
|
2023-07-08 10:33:12 -04:00
|
|
|
#include "filetreewindow.h"
|
|
|
|
#include "filepropertieswindow.h"
|
|
|
|
#include "aboutwindow.h"
|
|
|
|
|
2023-04-09 15:32:09 -04:00
|
|
|
MainWindow::MainWindow(GameData* data) : data(data) {
|
2022-04-14 08:24:06 -04:00
|
|
|
setWindowTitle("explorer");
|
|
|
|
|
2023-07-08 10:33:12 -04:00
|
|
|
auto helpMenu = menuBar()->addMenu("Help");
|
|
|
|
|
|
|
|
auto donateAction = helpMenu->addAction("Donate");
|
|
|
|
connect(donateAction, &QAction::triggered, this, [] {
|
|
|
|
QDesktopServices::openUrl(QUrl("https://redstrate.com/fund"));
|
|
|
|
});
|
|
|
|
donateAction->setIcon(QIcon::fromTheme("help-donate"));
|
|
|
|
|
|
|
|
helpMenu->addSeparator();
|
|
|
|
|
|
|
|
auto aboutNovusAction = helpMenu->addAction("About explorer");
|
|
|
|
aboutNovusAction->setIcon(QIcon::fromTheme("help-about"));
|
|
|
|
connect(aboutNovusAction, &QAction::triggered, this, [this] {
|
|
|
|
auto window = new AboutWindow(this);
|
|
|
|
window->show();
|
|
|
|
});
|
|
|
|
|
|
|
|
auto aboutQtAction = helpMenu->addAction("About Qt");
|
|
|
|
aboutQtAction->setIcon(QIcon(":/qt-project.org/qmessagebox/images/qtlogo-64.png"));
|
|
|
|
connect(aboutQtAction, &QAction::triggered, QApplication::instance(), &QApplication::aboutQt);
|
|
|
|
|
2023-04-09 15:32:09 -04:00
|
|
|
mdiArea = new QMdiArea();
|
|
|
|
setCentralWidget(mdiArea);
|
2022-04-14 08:24:06 -04:00
|
|
|
|
2023-04-09 15:32:09 -04:00
|
|
|
auto tree = new FileTreeWindow(data);
|
|
|
|
connect(tree, &FileTreeWindow::openFileProperties, this, [=](QString path) {
|
|
|
|
qInfo() << "opening properties window for " << path;
|
|
|
|
auto window = mdiArea->addSubWindow(new FilePropertiesWindow(data, path));
|
|
|
|
window->show();
|
|
|
|
});
|
2022-04-14 08:24:06 -04:00
|
|
|
|
2023-04-09 15:32:09 -04:00
|
|
|
mdiArea->addSubWindow(tree);
|
2022-04-14 08:24:06 -04:00
|
|
|
}
|
|
|
|
|