mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Implementing export dialog
As our menus are getting many export entries, it is better to create a single export dialog where user is able to select the export type and whether to export selected dives or all of them. This should also be more intuitive than the current way when export from file menu export all dives and right click menu on divelist exports only selected dives. Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
0b6cbe0f79
commit
7dc642860d
11 changed files with 322 additions and 91 deletions
55
qt-ui/divelogexportdialog.cpp
Normal file
55
qt-ui/divelogexportdialog.cpp
Normal file
|
@ -0,0 +1,55 @@
|
|||
#include <QFileDialog>
|
||||
#include <QString>
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "divelogexportdialog.h"
|
||||
#include "ui_divelogexportdialog.h"
|
||||
#include "subsurfacewebservices.h"
|
||||
#include "worldmap-save.h"
|
||||
|
||||
DiveLogExportDialog::DiveLogExportDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::DiveLogExportDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
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(),
|
||||
tr("HTML files (*.html)"));
|
||||
if (!filename.isNull() && !filename.isEmpty())
|
||||
export_worldmap_HTML(filename.toUtf8().data());
|
||||
return;
|
||||
} else if (ui->exportWorldMap->isChecked()) {
|
||||
filename = QFileDialog::getSaveFileName(this, tr("Export World Map"), fi.absolutePath(),
|
||||
tr("HTML files (*.html)"));
|
||||
if (!filename.isNull() && !filename.isEmpty())
|
||||
export_worldmap_HTML(filename.toUtf8().data());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!filename.isNull() && !filename.isEmpty())
|
||||
export_dives_xslt(filename.toUtf8(), ui->exportSelected->isChecked(), stylesheet.toStdString().c_str());
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue