2014-05-20 16:33:32 +00:00
|
|
|
#include <QFileDialog>
|
|
|
|
#include <QString>
|
2014-05-21 12:41:46 +00:00
|
|
|
#include <QShortcut>
|
2014-05-20 16:33:32 +00:00
|
|
|
|
|
|
|
#include "mainwindow.h"
|
|
|
|
#include "divelogexportdialog.h"
|
|
|
|
#include "ui_divelogexportdialog.h"
|
|
|
|
#include "subsurfacewebservices.h"
|
|
|
|
#include "worldmap-save.h"
|
|
|
|
|
2014-05-22 18:40:22 +00:00
|
|
|
DiveLogExportDialog::DiveLogExportDialog(QWidget *parent) : QDialog(parent),
|
2014-05-20 16:33:32 +00:00
|
|
|
ui(new Ui::DiveLogExportDialog)
|
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
2014-05-21 12:41:46 +00:00
|
|
|
QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this);
|
|
|
|
connect(quit, SIGNAL(activated()), parent, SLOT(close()));
|
|
|
|
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this);
|
|
|
|
connect(close, SIGNAL(activated()), this, SLOT(close()));
|
2014-05-20 16:33:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
DiveLogExportDialog::~DiveLogExportDialog()
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DiveLogExportDialog::on_buttonBox_accepted()
|
|
|
|
{
|
|
|
|
QFileInfo fi(system_default_filename());
|
|
|
|
QString filename;
|
|
|
|
QString stylesheet;
|
|
|
|
|
|
|
|
if (ui->exportUDDF->isChecked()) {
|
|
|
|
stylesheet = "uddf-export.xslt";
|
|
|
|
filename = QFileDialog::getSaveFileName(this, tr("Export UDDF File as"), fi.absolutePath(),
|
|
|
|
tr("UDDF files (*.uddf *.UDDF)"));
|
|
|
|
} else if (ui->exportCSV->isChecked()) {
|
|
|
|
stylesheet = "xml2csv.xslt";
|
|
|
|
filename = QFileDialog::getSaveFileName(this, tr("Export CSV File as"), fi.absolutePath(),
|
|
|
|
tr("CSV files (*.csv *.CSV)"));
|
|
|
|
} else if (ui->exportDivelogs->isChecked()) {
|
|
|
|
DivelogsDeWebServices::instance()->prepareDivesForUpload(ui->exportSelected->isChecked());
|
|
|
|
return;
|
|
|
|
} else if (ui->exportWorldMap->isChecked()) {
|
|
|
|
filename = QFileDialog::getSaveFileName(this, tr("Export World Map"), fi.absolutePath(),
|
2014-05-22 18:40:22 +00:00
|
|
|
tr("HTML files (*.html)"));
|
2014-05-20 16:33:32 +00:00
|
|
|
if (!filename.isNull() && !filename.isEmpty())
|
2014-05-21 12:23:05 +00:00
|
|
|
export_worldmap_HTML(filename.toUtf8().data(), ui->exportSelected->isChecked());
|
2014-05-20 16:33:32 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!filename.isNull() && !filename.isEmpty())
|
|
|
|
export_dives_xslt(filename.toUtf8(), ui->exportSelected->isChecked(), stylesheet.toStdString().c_str());
|
|
|
|
}
|