#include "tycho.h"
#include "mapprops.h"
#include "menu.h"
#include "../ui/ui_menu.h"
#include "../ui/ui_about.h"

#include <QFileDialog>
#include <iostream>

extern "C" void Ma_test_fn(char const *fname);

Menu::Menu(QWidget *parent) :
   QMainWindow(parent),
   ui(new Ui::Menu)
{
   ui->setupUi(this);
}

Menu::~Menu()
{
   dbgPrintFunc();
}

void Menu::mapNew()
{
   // TODO
}

void Menu::mapOpen()
{
   auto fname =
      QFileDialog::getOpenFileName(
         this,
         tr("Open Map File"),
         QString(),
         tr("Marathon Map files (*.scen *.sceA Map)"));

   Ma_test_fn(qUtf8Printable(fname));
}

void Menu::openAbout()
{
   QDialog   dlg{this};
   Ui::About about{};

   about.setupUi(&dlg);

   dlg.exec();
}

void Menu::openMapProperties()
{
   MapProps props{this};

   props.exec();
}

// EOF
