Remove the majority of the Gtk related code

- rip all Gtk code from qt-gui.cpp
- don't compile Gtk specific files
- don't link against Gtk libraries
- don't compile modules we don't use at all (yet)
- use #if USE_GTK_UI on the remaining files to disable Gtk related parts
- disable the non-functional Cochran support while I'm at it

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2013-05-03 11:04:51 -07:00
parent a6b89b3254
commit 8677721e85
21 changed files with 2684 additions and 2445 deletions

View file

@ -42,33 +42,21 @@ HEADERS = \
SOURCES = \ SOURCES = \
cochran.c \
deco.c \ deco.c \
device.c \ device.c \
dive.c \ dive.c \
divelist.c \ divelist.c \
divelist-gtk.c \
download-dialog.c \ download-dialog.c \
equipment.c \ equipment.c \
file.c \ file.c \
info.c \ info.c \
info-gtk.c \
libdivecomputer.c \
main.c \ main.c \
parse-xml.c \ parse-xml.c \
planner.c \
planner-gtk.c \
prefs.c \ prefs.c \
print.c \
profile.c \ profile.c \
save-xml.c \ save-xml.c \
sha1.c \ sha1.c \
statistics.c \
statistics-gtk.c \
time.c \ time.c \
uemis.c \
uemis-downloader.c \
webservice.c \
qt-gui.cpp \ qt-gui.cpp \
qt-ui/addcylinderdialog.cpp \ qt-ui/addcylinderdialog.cpp \
qt-ui/addweightsystemdialog.cpp \ qt-ui/addweightsystemdialog.cpp \
@ -93,10 +81,12 @@ endif
ifneq ($(strip $(LIBXSLT)),) ifneq ($(strip $(LIBXSLT)),)
EXTRA_FLAGS += -DXSLT='"$(XSLTDIR)"' $(XSLCFLAGS) EXTRA_FLAGS += -DXSLT='"$(XSLTDIR)"' $(XSLCFLAGS)
endif endif
ifeq ($(USE_GTK_UI),1)
ifneq ($(strip $(LIBOSMGPSMAP)),) ifneq ($(strip $(LIBOSMGPSMAP)),)
SOURCES += gps.c SOURCES += gps.c
EXTRA_FLAGS += -DHAVE_OSM_GPS_MAP $(OSMGPSMAPFLAGS) EXTRA_FLAGS += -DHAVE_OSM_GPS_MAP $(OSMGPSMAPFLAGS)
endif endif
endif
ifneq (,$(filter $(UNAME),linux kfreebsd gnu)) ifneq (,$(filter $(UNAME),linux kfreebsd gnu))
SOURCES += linux.c SOURCES += linux.c
@ -118,7 +108,7 @@ else
XSLTDIR = .\\xslt XSLTDIR = .\\xslt
endif endif
LIBS = $(LIBQT) $(LIBXML2) $(LIBXSLT) $(LIBSQLITE3) $(LIBGTK) $(LIBGCONF2) $(LIBDIVECOMPUTER) \ LIBS = $(LIBQT) $(LIBXML2) $(LIBXSLT) $(LIBSQLITE3) $(LIBGCONF2) $(LIBDIVECOMPUTER) \
$(EXTRALIBS) $(LIBZIP) -lpthread -lm $(LIBOSMGPSMAP) $(LIBSOUP) $(LIBWINSOCK) $(EXTRALIBS) $(LIBZIP) -lpthread -lm $(LIBOSMGPSMAP) $(LIBSOUP) $(LIBWINSOCK)
MSGLANGS=$(notdir $(wildcard po/*.po)) MSGLANGS=$(notdir $(wildcard po/*.po))

View file

@ -39,15 +39,11 @@ extern void set_divelist_font(const char *);
extern void update_screen(void); extern void update_screen(void);
extern void download_dialog(GtkWidget *, gpointer); extern void download_dialog(GtkWidget *, gpointer);
extern int is_default_dive_computer_device(const char *);
extern int is_default_dive_computer(const char *, const char *);
extern void add_dive_cb(GtkWidget *, gpointer); extern void add_dive_cb(GtkWidget *, gpointer);
extern void update_progressbar(progressbar_t *progress, double value); extern void update_progressbar(progressbar_t *progress, double value);
extern void update_progressbar_text(progressbar_t *progress, const char *text); extern void update_progressbar_text(progressbar_t *progress, const char *text);
extern const char *default_dive_computer_vendor;
extern const char *default_dive_computer_product;
extern const char *default_dive_computer_device;
// info.c // info.c
enum { enum {

View file

@ -69,6 +69,12 @@ extern char zoomed_plot, dc_number;
extern unsigned int amount_selected; extern unsigned int amount_selected;
extern int is_default_dive_computer_device(const char *);
extern int is_default_dive_computer(const char *, const char *);
extern const char *default_dive_computer_vendor;
extern const char *default_dive_computer_product;
extern const char *default_dive_computer_device;
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View file

@ -59,7 +59,6 @@ static struct DiveList dive_list;
#define TREESTORE(_dl) GTK_TREE_STORE((_dl).treemodel) #define TREESTORE(_dl) GTK_TREE_STORE((_dl).treemodel)
#define LISTSTORE(_dl) GTK_TREE_STORE((_dl).listmodel) #define LISTSTORE(_dl) GTK_TREE_STORE((_dl).listmodel)
short autogroup = FALSE;
static gboolean in_set_cursor = FALSE; static gboolean in_set_cursor = FALSE;
static gboolean set_selected(GtkTreeModel *model, GtkTreePath *path, static gboolean set_selected(GtkTreeModel *model, GtkTreePath *path,
GtkTreeIter *iter, gpointer data); GtkTreeIter *iter, gpointer data);

View file

@ -54,6 +54,8 @@
static short dive_list_changed = FALSE; static short dive_list_changed = FALSE;
short autogroup = FALSE;
dive_trip_t *dive_trip_list; dive_trip_t *dive_trip_list;
unsigned int amount_selected; unsigned int amount_selected;
@ -73,6 +75,13 @@ void dump_selection(void)
} }
#endif #endif
void set_autogroup(gboolean value)
{
/* if we keep the UI paradigm, this needs to toggle
* the checkbox on the autogroup menu item */
autogroup = value;
}
dive_trip_t *find_trip_by_idx(int idx) dive_trip_t *find_trip_by_idx(int idx)
{ {
dive_trip_t *trip = dive_trip_list; dive_trip_t *trip = dive_trip_list;
@ -906,8 +915,9 @@ void merge_dive_index(int i, struct dive *a)
add_single_dive(i, res); add_single_dive(i, res);
delete_single_dive(i+1); delete_single_dive(i+1);
delete_single_dive(i+1); delete_single_dive(i+1);
#if USE_GTK_UI
dive_list_update_dives(); dive_list_update_dives();
#endif
mark_divelist_changed(TRUE); mark_divelist_changed(TRUE);
} }

View file

@ -3,19 +3,23 @@
#include "dive.h" #include "dive.h"
#include "divelist.h" #include "divelist.h"
#include "display.h" #include "display.h"
#if USE_GTK_UI
#include "display-gtk.h" #include "display-gtk.h"
#include "callbacks-gtk.h" #include "callbacks-gtk.h"
#endif
#include "libdivecomputer.h" #include "libdivecomputer.h"
const char *default_dive_computer_vendor; const char *default_dive_computer_vendor;
const char *default_dive_computer_product; const char *default_dive_computer_product;
const char *default_dive_computer_device; const char *default_dive_computer_device;
#if USE_GTK_UI
static gboolean force_download; static gboolean force_download;
static gboolean prefer_downloaded; static gboolean prefer_downloaded;
OPTIONCALLBACK(force_toggle, force_download) OPTIONCALLBACK(force_toggle, force_download)
OPTIONCALLBACK(prefer_dl_toggle, prefer_downloaded) OPTIONCALLBACK(prefer_dl_toggle, prefer_downloaded)
#endif
struct product { struct product {
const char *product; const char *product;
@ -38,6 +42,7 @@ struct mydescriptor {
struct vendor *dc_list; struct vendor *dc_list;
#if USE_GTK_UI
static void render_dc_vendor(GtkCellLayout *cell, static void render_dc_vendor(GtkCellLayout *cell,
GtkCellRenderer *renderer, GtkCellRenderer *renderer,
GtkTreeModel *model, GtkTreeModel *model,
@ -63,6 +68,7 @@ static void render_dc_product(GtkCellLayout *cell,
product = dc_descriptor_get_product(descriptor); product = dc_descriptor_get_product(descriptor);
g_object_set(renderer, "text", product, NULL); g_object_set(renderer, "text", product, NULL);
} }
#endif
int is_default_dive_computer(const char *vendor, const char *product) int is_default_dive_computer(const char *vendor, const char *product)
{ {
@ -105,6 +111,7 @@ static void set_default_dive_computer_device(const char *name)
subsurface_set_conf("dive_computer_device", name); subsurface_set_conf("dive_computer_device", name);
} }
#if USE_GTK_UI
static void dive_computer_selector_changed(GtkWidget *combo, gpointer data) static void dive_computer_selector_changed(GtkWidget *combo, gpointer data)
{ {
GtkWidget *import, *button; GtkWidget *import, *button;
@ -149,7 +156,7 @@ static GtkWidget *import_dive_computer(device_data_t *data, GtkDialog *dialog)
gtk_box_pack_start(GTK_BOX(vbox), info, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), info, FALSE, FALSE, 0);
return info; return info;
} }
#endif
/* create a list of lists and keep the elements sorted */ /* create a list of lists and keep the elements sorted */
static void add_dc(const char *vendor, const char *product, dc_descriptor_t *descriptor) static void add_dc(const char *vendor, const char *product, dc_descriptor_t *descriptor)
@ -195,6 +202,7 @@ static void add_dc(const char *vendor, const char *product, dc_descriptor_t *des
pl->descriptor = descriptor; pl->descriptor = descriptor;
} }
#if USE_GTK_UI
/* fill the vendors and create and fill the respective product stores; return the longest product name /* fill the vendors and create and fill the respective product stores; return the longest product name
* and also the indices of the default vendor / product */ * and also the indices of the default vendor / product */
static int fill_computer_list(GtkListStore *vendorstore, GtkListStore ***productstore, int *vendor_index, int *product_index) static int fill_computer_list(GtkListStore *vendorstore, GtkListStore ***productstore, int *vendor_index, int *product_index)
@ -469,3 +477,4 @@ void update_progressbar_text(progressbar_t *progress, const char *text)
{ {
gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progress->bar), text); gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progress->bar), text);
} }
#endif

View file

@ -16,10 +16,14 @@
#include "dive.h" #include "dive.h"
#include "display.h" #include "display.h"
#if USE_GTK_UI
#include "display-gtk.h" #include "display-gtk.h"
#endif
#include "divelist.h" #include "divelist.h"
#include "conversions.h" #include "conversions.h"
#if USE_GTK_UI
#include "display-gtk.h"
static GtkListStore *cylinder_model, *weightsystem_model; static GtkListStore *cylinder_model, *weightsystem_model;
enum { enum {
@ -69,6 +73,7 @@ struct ws_widget {
GtkSpinButton *weight; GtkSpinButton *weight;
int w_idx; int w_idx;
}; };
#endif /* USE_GTK_UI */
/* we want bar - so let's not use our unit functions */ /* we want bar - so let's not use our unit functions */
int convert_pressure(int mbar, double *p) int convert_pressure(int mbar, double *p)
@ -120,6 +125,7 @@ static int convert_weight(int grams, double *m)
return decimals; return decimals;
} }
#if USE_GTK_UI
static void set_cylinder_description(struct cylinder_widget *cylinder, const char *desc) static void set_cylinder_description(struct cylinder_widget *cylinder, const char *desc)
{ {
set_active_text(cylinder->description, desc); set_active_text(cylinder->description, desc);
@ -451,6 +457,28 @@ static void show_weightsystem(weightsystem_t *ws, struct ws_widget *weightsystem
set_weight_description(weightsystem_widget, desc); set_weight_description(weightsystem_widget, desc);
set_weight_weight_spinbutton(weightsystem_widget, ws->weight.grams); set_weight_weight_spinbutton(weightsystem_widget, ws->weight.grams);
} }
#else
/* placeholders for a few functions that we need to redesign for the Qt UI */
void add_cylinder_description(cylinder_type_t *type)
{
const char *desc;
desc = type->description;
if (!desc)
return;
/* now do something with it... */
}
void add_weightsystem_description(weightsystem_t *weightsystem)
{
const char *desc;
desc = weightsystem->description;
if (!desc)
return;
/* now do something with it... */
}
#endif /* USE_GTK_UI */
gboolean cylinder_nodata(cylinder_t *cyl) gboolean cylinder_nodata(cylinder_t *cyl)
{ {
@ -515,6 +543,7 @@ gboolean weightsystems_equal(weightsystem_t *ws1, weightsystem_t *ws2)
return TRUE; return TRUE;
} }
#if USE_GTK_UI
static void set_one_cylinder(void *_data, GtkListStore *model, GtkTreeIter *iter) static void set_one_cylinder(void *_data, GtkListStore *model, GtkTreeIter *iter)
{ {
cylinder_t *cyl = _data; cylinder_t *cyl = _data;
@ -784,7 +813,7 @@ static void record_weightsystem_changes(weightsystem_t *ws, struct ws_widget *we
ws->description = desc; ws->description = desc;
add_weightsystem_type(desc, grams, &iter); add_weightsystem_type(desc, grams, &iter);
} }
#endif /* USE_GTK_UI */
/* /*
* We hardcode the most common standard cylinders, * We hardcode the most common standard cylinders,
* we should pick up any other names from the dive * we should pick up any other names from the dive
@ -833,6 +862,7 @@ struct tank_info tank_info[100] = {
{ NULL, } { NULL, }
}; };
#if USE_GTK_UI
static void fill_tank_list(GtkListStore *store) static void fill_tank_list(GtkListStore *store)
{ {
GtkTreeIter iter; GtkTreeIter iter;
@ -1679,3 +1709,4 @@ void clear_equipment_widgets()
gtk_list_store_clear(cylinder_list[W_IDX_PRIMARY].model); gtk_list_store_clear(cylinder_list[W_IDX_PRIMARY].model);
gtk_list_store_clear(weightsystem_list[W_IDX_PRIMARY].model); gtk_list_store_clear(weightsystem_list[W_IDX_PRIMARY].model);
} }
#endif /* USE_GTK_UI */

2
file.c
View file

@ -239,9 +239,11 @@ static int open_by_filename(const char *filename, const char *fmt, struct memblo
if (!strcasecmp(fmt, "DLD")) if (!strcasecmp(fmt, "DLD"))
return try_to_open_zip(filename, mem, error); return try_to_open_zip(filename, mem, error);
#if ONCE_COCHRAN_IS_SUPPORTED
/* Truly nasty intentionally obfuscated Cochran Anal software */ /* Truly nasty intentionally obfuscated Cochran Anal software */
if (!strcasecmp(fmt, "CAN")) if (!strcasecmp(fmt, "CAN"))
return try_to_open_cochran(filename, mem, error); return try_to_open_cochran(filename, mem, error);
#endif
/* Cochran export comma-separated-value files */ /* Cochran export comma-separated-value files */
if (!strcasecmp(fmt, "DPT")) if (!strcasecmp(fmt, "DPT"))

2550
gtk-gui.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -736,6 +736,14 @@ int edit_multi_dive_info(struct dive *single_dive)
return success; return success;
} }
int edit_dive_info(struct dive *dive, gboolean newdive)
{
if (!dive || (!newdive && !amount_selected))
return 0;
return edit_multi_dive_info(dive);
}
static GtkWidget *frame_box(GtkWidget *vbox, const char *fmt, ...) static GtkWidget *frame_box(GtkWidget *vbox, const char *fmt, ...)
{ {
va_list ap; va_list ap;

15
info.c
View file

@ -448,10 +448,15 @@ void update_time_depth(struct dive *dive, struct dive *edited)
dive->dc.meandepth.mm = edited->dc.meandepth.mm; dive->dc.meandepth.mm = edited->dc.meandepth.mm;
} }
int edit_dive_info(struct dive *dive, gboolean newdive) void add_people(const char *string)
{ {
if (!dive || (!newdive && !amount_selected)) /* add names to the completion list for people */
return 0; }
void add_location(const char *string)
return edit_multi_dive_info(dive); {
/* add names to the completion list for locations */
}
void add_suit(const char *string)
{
/* add names to the completion list for suits */
} }

View file

@ -26,6 +26,7 @@ static double progress_bar_fraction = 0.0;
static int stoptime, stopdepth, ndl, po2, cns; static int stoptime, stopdepth, ndl, po2, cns;
static gboolean in_deco, first_temp_is_air; static gboolean in_deco, first_temp_is_air;
#if USE_GTK_UI
static GError *error(const char *fmt, ...) static GError *error(const char *fmt, ...)
{ {
va_list args; va_list args;
@ -38,6 +39,7 @@ static GError *error(const char *fmt, ...)
va_end(args); va_end(args);
return error; return error;
} }
#endif
static dc_status_t create_parser(device_data_t *devdata, dc_parser_t **parser) static dc_status_t create_parser(device_data_t *devdata, dc_parser_t **parser)
{ {
@ -708,6 +710,7 @@ static const char *do_libdivecomputer_import(device_data_t *data)
return err; return err;
} }
#if USE_GTK_UI
static void *pthread_wrapper(void *_data) static void *pthread_wrapper(void *_data)
{ {
device_data_t *data = _data; device_data_t *data = _data;
@ -772,3 +775,4 @@ GError *do_import(device_data_t *data)
return error(retval, data->vendor, data->product, data->devname); return error(retval, data->vendor, data->product, data->devname);
return NULL; return NULL;
} }
#endif

View file

@ -17,10 +17,12 @@ typedef struct device_data_t {
unsigned int deviceid, diveid; unsigned int deviceid, diveid;
dc_device_t *device; dc_device_t *device;
dc_context_t *context; dc_context_t *context;
progressbar_t progress;
int preexisting; int preexisting;
gboolean force_download; gboolean force_download;
#if USE_GTK_UI
progressbar_t progress;
GtkDialog *dialog; GtkDialog *dialog;
#endif
} device_data_t; } device_data_t;
extern GError *do_import(device_data_t *data); extern GError *do_import(device_data_t *data);

View file

@ -1,6 +1,7 @@
/* linux.c */ /* linux.c */
/* implements Linux specific functions */ /* implements Linux specific functions */
#include "dive.h" #include "dive.h"
#include "display.h"
#include "display-gtk.h" #include "display-gtk.h"
#include <gconf/gconf-client.h> #include <gconf/gconf-client.h>
#include <string.h> #include <string.h>

14
main.c
View file

@ -99,7 +99,11 @@ static void parse_argument(const char *arg)
if (strcmp(arg,"--import") == 0) { if (strcmp(arg,"--import") == 0) {
/* mark the dives so far as the base, /* mark the dives so far as the base,
* everything after is imported */ * everything after is imported */
#if USE_GTK_UI
report_dives(FALSE, FALSE); report_dives(FALSE, FALSE);
#else
process_dives(FALSE, FALSE);
#endif
imported = TRUE; imported = TRUE;
return; return;
} }
@ -119,6 +123,7 @@ static void parse_argument(const char *arg)
void update_dive(struct dive *new_dive) void update_dive(struct dive *new_dive)
{ {
#if USE_GTK_UI
static struct dive *buffered_dive; static struct dive *buffered_dive;
struct dive *old_dive = buffered_dive; struct dive *old_dive = buffered_dive;
@ -129,6 +134,7 @@ void update_dive(struct dive *new_dive)
show_dive_equipment(new_dive, W_IDX_PRIMARY); show_dive_equipment(new_dive, W_IDX_PRIMARY);
show_dive_stats(new_dive); show_dive_stats(new_dive);
buffered_dive = new_dive; buffered_dive = new_dive;
#endif
} }
void renumber_dives(int nr) void renumber_dives(int nr)
@ -138,7 +144,9 @@ void renumber_dives(int nr)
for (i = 0; i < dive_table.nr; i++) { for (i = 0; i < dive_table.nr; i++) {
struct dive *dive = dive_table.dives[i]; struct dive *dive = dive_table.dives[i];
dive->number = nr + i; dive->number = nr + i;
#if USE_GTK_UI
flush_divelist(dive); flush_divelist(dive);
#endif
} }
mark_divelist_changed(TRUE); mark_divelist_changed(TRUE);
} }
@ -229,7 +237,9 @@ int main(int argc, char **argv)
} }
if (error != NULL) if (error != NULL)
{ {
#if USE_GTK_UI
report_error(error); report_error(error);
#endif
g_error_free(error); g_error_free(error);
error = NULL; error = NULL;
} }
@ -242,9 +252,13 @@ int main(int argc, char **argv)
sure we remember this as the filename in use */ sure we remember this as the filename in use */
set_filename(filename, FALSE); set_filename(filename, FALSE);
} }
#if USE_GTK_UI
report_dives(imported, FALSE); report_dives(imported, FALSE);
if (dive_table.nr == 0) if (dive_table.nr == 0)
show_dive_info(NULL); show_dive_info(NULL);
#else
process_dives(imported, FALSE);
#endif
parse_xml_exit(); parse_xml_exit();
subsurface_command_line_exit(&argc, &argv); subsurface_command_line_exit(&argc, &argv);

View file

@ -685,9 +685,11 @@ void plan(struct diveplan *diveplan, char **cached_datap, struct dive **divep, c
stopidx--; stopidx--;
} }
add_plan_to_notes(diveplan, dive); add_plan_to_notes(diveplan, dive);
#if USE_GTK_UI
/* now make the dive visible in the dive list */ /* now make the dive visible in the dive list */
report_dives(FALSE, FALSE); report_dives(FALSE, FALSE);
show_and_select_dive(dive); show_and_select_dive(dive);
#endif
error_exit: error_exit:
free(stoplevels); free(stoplevels);
free(gaschanges); free(gaschanges);

View file

@ -136,6 +136,8 @@ static const color_t profile_color[] = {
}; };
#if USE_GTK_UI
/* Scale to 0,0 -> maxx,maxy */ /* Scale to 0,0 -> maxx,maxy */
#define SCALEX(gc,x) (((x)-gc->leftx)/(gc->rightx-gc->leftx)*gc->maxx) #define SCALEX(gc,x) (((x)-gc->leftx)/(gc->rightx-gc->leftx)*gc->maxx)
#define SCALEY(gc,y) (((y)-gc->topy)/(gc->bottomy-gc->topy)*gc->maxy) #define SCALEY(gc,y) (((y)-gc->topy)/(gc->bottomy-gc->topy)*gc->maxy)
@ -189,8 +191,7 @@ static void pattern_add_color_stop_rgba(struct graphics_context *gc, cairo_patte
struct rgba rgb = col->media[gc->printer]; struct rgba rgb = col->media[gc->printer];
cairo_pattern_add_color_stop_rgba(pat, o, rgb.r, rgb.g, rgb.b, rgb.a); cairo_pattern_add_color_stop_rgba(pat, o, rgb.r, rgb.g, rgb.b, rgb.a);
} }
#endif /* USE_GTK_UI */
#define ROUND_UP(x,y) ((((x)+(y)-1)/(y))*(y))
/* debugging tool - not normally used */ /* debugging tool - not normally used */
static void dump_pi (struct plot_info *pi) static void dump_pi (struct plot_info *pi)
@ -215,6 +216,8 @@ static void dump_pi (struct plot_info *pi)
printf(" }\n"); printf(" }\n");
} }
#define ROUND_UP(x,y) ((((x)+(y)-1)/(y))*(y))
/* /*
* When showing dive profiles, we scale things to the * When showing dive profiles, we scale things to the
* current dive. However, we don't scale past less than * current dive. However, we don't scale past less than
@ -276,6 +279,7 @@ typedef struct {
#define MIDDLE (0) #define MIDDLE (0)
#define BOTTOM (-1) #define BOTTOM (-1)
#if USE_GTK_UI
static void plot_text(struct graphics_context *gc, const text_render_options_t *tro, static void plot_text(struct graphics_context *gc, const text_render_options_t *tro,
double x, double y, const char *fmt, ...) double x, double y, const char *fmt, ...)
{ {
@ -308,6 +312,7 @@ static void plot_text(struct graphics_context *gc, const text_render_options_t *
set_source_rgba(gc, tro->color); set_source_rgba(gc, tro->color);
cairo_show_text(cr, buffer); cairo_show_text(cr, buffer);
} }
#endif /* USE_GTK_UI */
/* collect all event names and whether we display them */ /* collect all event names and whether we display them */
struct ev_select { struct ev_select {
@ -357,6 +362,7 @@ void remember_event(const char *eventname)
evn_used++; evn_used++;
} }
#if USE_GTK_UI
static void plot_one_event(struct graphics_context *gc, struct plot_info *pi, struct event *event) static void plot_one_event(struct graphics_context *gc, struct plot_info *pi, struct event *event)
{ {
int i, depth = 0; int i, depth = 0;
@ -1027,6 +1033,7 @@ static void set_sac_color(struct graphics_context *gc, int sac, int avg_sac)
set_source_rgba(gc, SAC_DEFAULT); set_source_rgba(gc, SAC_DEFAULT);
} }
} }
#endif /* USE_GTK_UI */
/* Get local sac-rate (in ml/min) between entry1 and entry2 */ /* Get local sac-rate (in ml/min) between entry1 and entry2 */
static int get_local_sac(struct plot_data *entry1, struct plot_data *entry2, struct dive *dive) static int get_local_sac(struct plot_data *entry1, struct plot_data *entry2, struct dive *dive)
@ -1065,6 +1072,7 @@ static int get_local_sac(struct plot_data *entry1, struct plot_data *entry2, str
#define SAC_WINDOW 45 /* sliding window in seconds for current SAC calculation */ #define SAC_WINDOW 45 /* sliding window in seconds for current SAC calculation */
#if USE_GTK_UI
static void plot_cylinder_pressure(struct graphics_context *gc, struct plot_info *pi, static void plot_cylinder_pressure(struct graphics_context *gc, struct plot_info *pi,
struct dive *dive, struct divecomputer *dc) struct dive *dive, struct divecomputer *dc)
{ {
@ -1189,6 +1197,7 @@ static void plot_deco_text(struct graphics_context *gc, struct plot_info *pi)
plot_text(gc, &tro, x, y, "GF %.0f/%.0f", prefs.gflow * 100, prefs.gfhigh * 100); plot_text(gc, &tro, x, y, "GF %.0f/%.0f", prefs.gflow * 100, prefs.gfhigh * 100);
} }
} }
#endif /* USE_GTK_UI */
static void analyze_plot_info_minmax_minute(struct plot_data *entry, struct plot_data *first, struct plot_data *last, int index) static void analyze_plot_info_minmax_minute(struct plot_data *entry, struct plot_data *first, struct plot_data *last, int index)
{ {
@ -1259,6 +1268,7 @@ static velocity_t velocity(int speed)
return v; return v;
} }
static struct plot_info *analyze_plot_info(struct plot_info *pi) static struct plot_info *analyze_plot_info(struct plot_info *pi)
{ {
int i; int i;
@ -1974,6 +1984,7 @@ static struct plot_info *create_plot_info(struct dive *dive, struct divecomputer
return analyze_plot_info(pi); return analyze_plot_info(pi);
} }
#if USE_GTK_UI
static void plot_set_scale(scale_mode_t scale) static void plot_set_scale(scale_mode_t scale)
{ {
switch (scale) { switch (scale) {
@ -1986,6 +1997,7 @@ static void plot_set_scale(scale_mode_t scale)
break; break;
} }
} }
#endif
/* make sure you pass this the FIRST dc - it just walks the list */ /* make sure you pass this the FIRST dc - it just walks the list */
static int nr_dcs(struct divecomputer *main) static int nr_dcs(struct divecomputer *main)
@ -2015,6 +2027,7 @@ struct divecomputer *select_dc(struct divecomputer *main)
return main; return main;
} }
#if USE_GTK_UI
void plot(struct graphics_context *gc, struct dive *dive, scale_mode_t scale) void plot(struct graphics_context *gc, struct dive *dive, scale_mode_t scale)
{ {
struct plot_info *pi; struct plot_info *pi;
@ -2132,6 +2145,7 @@ void plot(struct graphics_context *gc, struct dive *dive, scale_mode_t scale)
pi->nr = 0; pi->nr = 0;
} }
} }
#endif /* USE_GTK_UI */
static void plot_string(struct plot_data *entry, char *buf, size_t bufsize, static void plot_string(struct plot_data *entry, char *buf, size_t bufsize,
int depth, int pressure, int temp, gboolean has_ndl) int depth, int pressure, int temp, gboolean has_ndl)

2418
qt-gui.cpp

File diff suppressed because it is too large Load diff

View file

@ -116,6 +116,7 @@ void MainWindow::on_actionClose_triggered()
ui->InfoWidget->clearEquipment(); ui->InfoWidget->clearEquipment();
clear_events(); clear_events();
#if USE_GTK_UI
show_dive_stats(NULL); show_dive_stats(NULL);
/* redraw the screen */ /* redraw the screen */
@ -124,6 +125,7 @@ void MainWindow::on_actionClose_triggered()
// WARNING? Port this to Qt. // WARNING? Port this to Qt.
show_dive_info(NULL); show_dive_info(NULL);
#endif /* USE_GTK_UI */
} }
void MainWindow::on_actionImport_triggered() void MainWindow::on_actionImport_triggered()

View file

@ -922,14 +922,18 @@ GError *uemis_download(const char *mountpath, progressbar_t *progress,
if (!import_thread_cancelled) { if (!import_thread_cancelled) {
int result; int result;
g_timeout_add(100, timeout_func, dialog); g_timeout_add(100, timeout_func, dialog);
#if USE_GTK_UI
update_progressbar(args.progress, progress_bar_fraction); update_progressbar(args.progress, progress_bar_fraction);
update_progressbar_text(args.progress, progress_bar_text); update_progressbar_text(args.progress, progress_bar_text);
#endif
result = gtk_dialog_run(dialog); result = gtk_dialog_run(dialog);
if (result == GTK_RESPONSE_CANCEL) if (result == GTK_RESPONSE_CANCEL)
import_thread_cancelled = TRUE; import_thread_cancelled = TRUE;
} else { } else {
#if USE_GTK_UI
update_progressbar(args.progress, progress_bar_fraction); update_progressbar(args.progress, progress_bar_fraction);
update_progressbar_text(args.progress, _("Cancelled, exiting cleanly...")); update_progressbar_text(args.progress, _("Cancelled, exiting cleanly..."));
#endif
usleep(100000); usleep(100000);
} }
} }

View file

@ -164,7 +164,9 @@ static void download_dialog_response_cb(GtkDialog *d, gint response, gpointer da
/* now merge the data in the gps_location table into the dive_table */ /* now merge the data in the gps_location table into the dive_table */
if (merge_locations_into_dives()) { if (merge_locations_into_dives()) {
mark_divelist_changed(TRUE); mark_divelist_changed(TRUE);
#if USE_GTK_UI
dive_list_update_dives(); dive_list_update_dives();
#endif
} }
/* store last entered uid in config */ /* store last entered uid in config */
subsurface_set_conf("webservice_uid", gtk_entry_get_text(GTK_ENTRY(state->uid))); subsurface_set_conf("webservice_uid", gtk_entry_get_text(GTK_ENTRY(state->uid)));