diff options
-rw-r--r-- | qt-ui/divelogexportdialog.cpp | 5 | ||||
-rw-r--r-- | qt-ui/divelogexportdialog.ui | 4 | ||||
-rw-r--r-- | save-html.c | 33 | ||||
-rw-r--r-- | save-html.h | 2 | ||||
-rw-r--r-- | theme/list_lib.js | 9 |
5 files changed, 30 insertions, 23 deletions
diff --git a/qt-ui/divelogexportdialog.cpp b/qt-ui/divelogexportdialog.cpp index 829765424..82e3aaf74 100644 --- a/qt-ui/divelogexportdialog.cpp +++ b/qt-ui/divelogexportdialog.cpp @@ -79,7 +79,7 @@ void DiveLogExportDialog::exportHtmlInit(const QString &filename) QString json_settings = exportFiles + QDir::separator() + "settings.json"; exportHTMLsettings(json_settings); - export_HTML(json_dive_data.toUtf8().data(), ui->exportSelectedDives->isChecked()); + export_HTML(json_dive_data.toUtf8().data(), ui->exportSelectedDives->isChecked(), ui->exportListOnly->isChecked()); QString searchPath = getSubsurfaceDataPath("theme"); if (searchPath.isEmpty()) @@ -114,7 +114,8 @@ void DiveLogExportDialog::exportHTMLsettings(const QString &filename) QFile file(filename); file.open(QIODevice::WriteOnly | QIODevice::Text); QTextStream out(&file); - out << "settings = {\"fontSize\":\"" << fontSize << "\",\"fontFamily\":\"" << fontFamily << "\",}"; + out << "settings = {\"fontSize\":\"" << fontSize << "\",\"fontFamily\":\"" << fontFamily << "\",\"listOnly\":\""<< + ui->exportListOnly->isChecked() << "\",}"; file.close(); } diff --git a/qt-ui/divelogexportdialog.ui b/qt-ui/divelogexportdialog.ui index d2036bda4..610ee53e9 100644 --- a/qt-ui/divelogexportdialog.ui +++ b/qt-ui/divelogexportdialog.ui @@ -234,9 +234,9 @@ </widget> </item> <item row="2" column="0"> - <widget class="QCheckBox" name="checkBox_3"> + <widget class="QCheckBox" name="exportListOnly"> <property name="text"> - <string>Dive List only</string> + <string>Export List only</string> </property> </widget> </item> diff --git a/save-html.c b/save-html.c index ab1302e3f..6ce0f3ab7 100644 --- a/save-html.c +++ b/save-html.c @@ -132,7 +132,8 @@ void put_HTML_tags(struct membuffer *b, struct dive *dive, const char *pre, cons put_string(b, post); } -void write_one_dive(struct membuffer *b, struct dive *dive, int *dive_no) +/* if exporting list_only mode, we neglect exporting the samples, bookmarks and cylinders */ +void write_one_dive(struct membuffer *b, struct dive *dive, int *dive_no, const bool list_only) { put_string(b, "{"); put_format(b, "\"number\":%d,", *dive_no); @@ -151,13 +152,15 @@ void write_one_dive(struct membuffer *b, struct dive *dive, int *dive_no) write_attribute(b, "suit", dive->suit); put_HTML_tags(b, dive, "\"tags\":", ","); put_HTML_notes(b, dive, "\"notes\":\"", "\","); - put_cylinder_HTML(b, dive); - put_HTML_samples(b, dive); + if (!list_only) { + put_cylinder_HTML(b, dive); + put_HTML_samples(b, dive); + } put_string(b, "},\n"); (*dive_no)++; } -void write_no_trip(struct membuffer *b, int *dive_no) +void write_no_trip(struct membuffer *b, int *dive_no, const bool list_only) { int i; struct dive *dive; @@ -168,12 +171,12 @@ void write_no_trip(struct membuffer *b, int *dive_no) for_each_dive (i, dive) { if (!dive->divetrip) - write_one_dive(b, dive, dive_no); + write_one_dive(b, dive, dive_no, list_only); } put_format(b, "]},\n\n"); } -void write_trip(struct membuffer *b, dive_trip_t *trip, int *dive_no) +void write_trip(struct membuffer *b, dive_trip_t *trip, int *dive_no, const bool list_only) { struct dive *dive; @@ -182,13 +185,13 @@ void write_trip(struct membuffer *b, dive_trip_t *trip, int *dive_no) put_format(b, "\"dives\":["); for (dive = trip->dives; dive != NULL; dive = dive->next) { - write_one_dive(b, dive, dive_no); + write_one_dive(b, dive, dive_no, list_only); } put_format(b, "]},\n\n"); } -void write_trips(struct membuffer *b, bool selected_only) +void write_trips(struct membuffer *b, bool selected_only, const bool list_only) { int i, dive_no = 0; struct dive *dive; @@ -205,7 +208,7 @@ void write_trips(struct membuffer *b, bool selected_only) for_each_dive (i, dive) { if (!dive->selected) continue; - write_one_dive(b, dive, &dive_no); + write_one_dive(b, dive, &dive_no, list_only); } put_format(b, "]},\n\n"); } else { @@ -219,27 +222,27 @@ void write_trips(struct membuffer *b, bool selected_only) /* We haven't seen this trip before - save it and all dives */ trip->index = 1; - write_trip(b, trip, &dive_no); + write_trip(b, trip, &dive_no, list_only); } /*Save all remaining trips into Others*/ - write_no_trip(b, &dive_no); + write_no_trip(b, &dive_no, list_only); } } -void export_list(struct membuffer *b, bool selected_only) +void export_list(struct membuffer *b, bool selected_only, const bool list_only) { put_string(b, "trips=["); - write_trips(b, selected_only); + write_trips(b, selected_only, list_only); put_string(b, "]"); } -void export_HTML(const char *file_name, const bool selected_only) +void export_HTML(const char *file_name, const bool selected_only, const bool list_only) { FILE *f; struct membuffer buf = { 0 }; - export_list(&buf, selected_only); + export_list(&buf, selected_only, list_only); f = subsurface_fopen(file_name, "w+"); if (!f) diff --git a/save-html.h b/save-html.h index 96813f39b..432231de5 100644 --- a/save-html.h +++ b/save-html.h @@ -15,7 +15,7 @@ void put_HTML_time(struct membuffer *b, struct dive *dive, const char *pre, cons void put_HTML_notes(struct membuffer *b, struct dive *dive, const char *pre, const char *post); void put_HTML_quoted(struct membuffer *b, const char *text); -void export_HTML(const char *file_name, const bool selected_only); +void export_HTML(const char *file_name, const bool selected_only, const bool list_only); #ifdef __cplusplus } diff --git a/theme/list_lib.js b/theme/list_lib.js index b19c2eafe..a6f1fcb71 100644 --- a/theme/list_lib.js +++ b/theme/list_lib.js @@ -179,7 +179,7 @@ function getlimited (dive) { }; function getExpanded (dive) { - return '<table><tr><td class="words">Date: </td><td>'+dive.date+ + var res = '<table><tr><td class="words">Date: </td><td>'+dive.date+ '</td><td class="words">     Time: </td><td>'+dive.time + '</td><td class="words">     Location: </td><td>'+'<a onclick=\"Search_list_Modules(\''+dive.location+'\')\">'+ dive.location +'</a>'+ @@ -192,8 +192,11 @@ function getExpanded (dive) { '</td></tr><tr><td class="words"><p>Buddy: </p></td><td>'+dive.buddy + '</td></tr><tr><td class="words">Suit: </td><td>'+dive.suit + '</td></tr><tr><td class="words">Tags: </td><td>'+putTags(dive.tags)+ - '</td></tr></table><div style="margin:10px;"><p class="words">Notes: </p>' + dive.notes +'</div>'+ - '<center><a onclick="showDiveDetails('+dive.number+')">show more details</a></center>'; + '</td></tr></table><div style="margin:10px;"><p class="words">Notes: </p>' + dive.notes +'</div>'; + if(settings.listOnly==='0'){ + res += '<center><a onclick="showDiveDetails('+dive.number+')">show more details</a></center>'; + } + return res; }; function putTags(tags){ |