#include "common.h" #include "quam/main_window.h" #include "quam/project.h" #include #include MainWindow::MainWindow(QWidget *parent) : QMainWindow{parent}, Ui::MainWindow{}, m_errors{new QErrorMessage{this}} { setupUi(this); actionClose->setShortcut(QKeySequence{QKeySequence::Close}); actionOpen->setShortcut(QKeySequence{QKeySequence::Open}); actionQuit->setShortcut(QKeySequence{QKeySequence::Quit}); } MainWindow::~MainWindow() { } void MainWindow::fileOpen() { auto fileName = QFileDialog::getOpenFileName( this, tr("Open Archive"), QString{}, tr("Quake PACK file (*.pak);;" "Quake WAD2 file (*.wad);;" "All files (*)")); if(!fileName.isEmpty()) { try { auto st = openReadBin(fileName.toStdString()); auto pak = readPak(st); new Project{std::move(pak), m_errors, mdiArea}; } catch(std::exception const &exc) { m_errors->showMessage(tr(exc.what())); } } } void MainWindow::fileClose() { if(auto win = mdiArea->activeSubWindow()) { mdiArea->removeSubWindow(win); } } // EOF