40 lines
843 B
C++
40 lines
843 B
C++
#include "common.h"
|
|
#include "quam/main_window.h"
|
|
#include "quam/pak.h"
|
|
|
|
MainWindow::MainWindow(QWidget *parent) :
|
|
QMainWindow{parent},
|
|
Ui::MainWindow{},
|
|
m_errors{}
|
|
{
|
|
setupUi(this);
|
|
|
|
actionOpen->setShortcut(QKeySequence{QKeySequence::Open});
|
|
actionQuit->setShortcut(QKeySequence{QKeySequence::Quit});
|
|
|
|
tableWidget->sortByColumn(Pak::ColumnId, Qt::AscendingOrder);
|
|
}
|
|
|
|
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);
|
|
setTableToPakDir(*tableWidget, pak);
|
|
} catch(std::exception const &exc) {
|
|
m_errors.showMessage(tr(exc.what()));
|
|
}
|
|
}
|
|
}
|
|
|
|
// EOF
|