mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
downloader: small improvements
Provide supported dive computer list on the command line and actually call the cli download. Still not functional. Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
parent
31f0741ecc
commit
b39e77071e
5 changed files with 18 additions and 3 deletions
|
@ -200,7 +200,11 @@ elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
|
||||||
message(STATUS "Building Subsurface-mobile requires BT support")
|
message(STATUS "Building Subsurface-mobile requires BT support")
|
||||||
set(BTSUPPORT ON)
|
set(BTSUPPORT ON)
|
||||||
elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable")
|
elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable")
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
|
set(SUBSURFACE_TARGET Subsurface-downloader)
|
||||||
|
else()
|
||||||
set(SUBSURFACE_TARGET subsurface-downloader)
|
set(SUBSURFACE_TARGET subsurface-downloader)
|
||||||
|
endif()
|
||||||
set(BTSUPPORT ON)
|
set(BTSUPPORT ON)
|
||||||
add_definitions(-DSUBSURFACE_DOWNLOADER)
|
add_definitions(-DSUBSURFACE_DOWNLOADER)
|
||||||
message(STATUS "building the embedded Subsurface-downloader app")
|
message(STATUS "building the embedded Subsurface-downloader app")
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QUndoStack>
|
#include <QUndoStack>
|
||||||
|
|
||||||
extern "C"
|
|
||||||
void cliDownloader(const char *vendor, const char *product, const char *device)
|
void cliDownloader(const char *vendor, const char *product, const char *device)
|
||||||
{
|
{
|
||||||
DiveImportedModel *diveImportedModel = new DiveImportedModel();
|
DiveImportedModel *diveImportedModel = new DiveImportedModel();
|
||||||
|
|
|
@ -98,7 +98,9 @@ struct mydescriptor {
|
||||||
* stay like this for now.
|
* stay like this for now.
|
||||||
*/
|
*/
|
||||||
void fill_computer_list();
|
void fill_computer_list();
|
||||||
|
extern "C" {
|
||||||
void show_computer_list();
|
void show_computer_list();
|
||||||
|
}
|
||||||
extern QStringList vendorList;
|
extern QStringList vendorList;
|
||||||
extern QHash<QString, QStringList> productList;
|
extern QHash<QString, QStringList> productList;
|
||||||
extern QMap<QString, dc_descriptor_t *> descriptorLookup;
|
extern QMap<QString, dc_descriptor_t *> descriptorLookup;
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
#include "git-access.h"
|
#include "git-access.h"
|
||||||
#include "libdivecomputer/version.h"
|
#include "libdivecomputer/version.h"
|
||||||
|
|
||||||
|
extern void show_computer_list();
|
||||||
|
|
||||||
struct preferences prefs, git_prefs;
|
struct preferences prefs, git_prefs;
|
||||||
struct preferences default_prefs = {
|
struct preferences default_prefs = {
|
||||||
.cloud_base_url = "https://cloud.subsurface-divelog.org/",
|
.cloud_base_url = "https://cloud.subsurface-divelog.org/",
|
||||||
|
@ -152,6 +154,7 @@ void print_files()
|
||||||
const char *filename, *local_git;
|
const char *filename, *local_git;
|
||||||
|
|
||||||
printf("\nFile locations:\n\n");
|
printf("\nFile locations:\n\n");
|
||||||
|
printf("Cloud email:%s\n", prefs.cloud_storage_email);
|
||||||
if (!empty_string(prefs.cloud_storage_email) && !empty_string(prefs.cloud_storage_password)) {
|
if (!empty_string(prefs.cloud_storage_email) && !empty_string(prefs.cloud_storage_password)) {
|
||||||
filename = cloud_url();
|
filename = cloud_url();
|
||||||
|
|
||||||
|
@ -265,6 +268,10 @@ void parse_argument(const char *arg)
|
||||||
prefs.dive_computer.device = strdup(arg + sizeof("--device=") - 1);
|
prefs.dive_computer.device = strdup(arg + sizeof("--device=") - 1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (strncmp(arg, "--list-dc", sizeof("--list-dc") - 1) == 0) {
|
||||||
|
show_computer_list();
|
||||||
|
return;
|
||||||
|
}
|
||||||
#elif SUBSURFACE_MOBILE_DESKTOP
|
#elif SUBSURFACE_MOBILE_DESKTOP
|
||||||
if (strncmp(arg, "--testqml=", sizeof("--testqml=") - 1) == 0) {
|
if (strncmp(arg, "--testqml=", sizeof("--testqml=") - 1) == 0) {
|
||||||
testqml = malloc(strlen(arg) - sizeof("--testqml=") + 1);
|
testqml = malloc(strlen(arg) - sizeof("--testqml=") + 1);
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
static bool filesOnCommandLine = false;
|
static bool filesOnCommandLine = false;
|
||||||
static void messageHandler(QtMsgType type, const QMessageLogContext &ctx, const QString &msg);
|
static void messageHandler(QtMsgType type, const QMessageLogContext &ctx, const QString &msg);
|
||||||
|
extern void cliDownloader(const char *vendor, const char *product, const char *device);
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
@ -51,6 +52,7 @@ int main(int argc, char **argv)
|
||||||
copy_prefs(&default_prefs, &prefs);
|
copy_prefs(&default_prefs, &prefs);
|
||||||
|
|
||||||
// now handle the arguments
|
// now handle the arguments
|
||||||
|
fill_computer_list();
|
||||||
for (i = 1; i < arguments.length(); i++) {
|
for (i = 1; i < arguments.length(); i++) {
|
||||||
QString a = arguments.at(i);
|
QString a = arguments.at(i);
|
||||||
if (a.isEmpty())
|
if (a.isEmpty())
|
||||||
|
@ -66,7 +68,6 @@ int main(int argc, char **argv)
|
||||||
files.push_back(a);
|
files.push_back(a);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fill_computer_list();
|
|
||||||
parse_xml_init();
|
parse_xml_init();
|
||||||
taglist_init_global();
|
taglist_init_global();
|
||||||
|
|
||||||
|
@ -89,6 +90,7 @@ int main(int argc, char **argv)
|
||||||
if (!empty_string(prefs.dive_computer.vendor) && !empty_string(prefs.dive_computer.product) && !empty_string(prefs.dive_computer.device)) {
|
if (!empty_string(prefs.dive_computer.vendor) && !empty_string(prefs.dive_computer.product) && !empty_string(prefs.dive_computer.device)) {
|
||||||
// download from that dive computer
|
// download from that dive computer
|
||||||
printf("Downloading dives from %s %s (via %s)\n", prefs.dive_computer.vendor, prefs.dive_computer.product, prefs.dive_computer.device);
|
printf("Downloading dives from %s %s (via %s)\n", prefs.dive_computer.vendor, prefs.dive_computer.product, prefs.dive_computer.device);
|
||||||
|
cliDownloader(prefs.dive_computer.vendor, prefs.dive_computer.product, prefs.dive_computer.device);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
taglist_free(g_tag_list);
|
taglist_free(g_tag_list);
|
||||||
|
|
Loading…
Reference in a new issue