|
Lines 55-65
extern "C"
Link Here
|
| 55 |
{ |
55 |
{ |
| 56 |
KDE_EXPORT int kdemain(int argc, char **argv); |
56 |
KDE_EXPORT int kdemain(int argc, char **argv); |
| 57 |
|
57 |
|
|
|
58 |
#ifdef HAVE_GPHOTO2_5 |
| 59 |
static void frontendCameraStatus(GPContext *context, const char *status, void *data); |
| 60 |
static unsigned int frontendProgressStart( |
| 61 |
GPContext *context, float totalsize, const char *status, |
| 62 |
void *data |
| 63 |
); |
| 64 |
#else |
| 58 |
static void frontendCameraStatus(GPContext *context, const char *format, va_list args, void *data); |
65 |
static void frontendCameraStatus(GPContext *context, const char *format, va_list args, void *data); |
| 59 |
static unsigned int frontendProgressStart( |
66 |
static unsigned int frontendProgressStart( |
| 60 |
GPContext *context, float totalsize, const char *format, |
67 |
GPContext *context, float totalsize, const char *format, |
| 61 |
va_list args, void *data |
68 |
va_list args, void *data |
| 62 |
); |
69 |
); |
|
|
70 |
#endif |
| 63 |
static void frontendProgressUpdate( |
71 |
static void frontendProgressUpdate( |
| 64 |
GPContext *context, unsigned int id, float current, void *data |
72 |
GPContext *context, unsigned int id, float current, void *data |
| 65 |
); |
73 |
); |
|
Lines 791-801
void KameraProtocol::setHost(const TQString& host, int port, const TQString& use
Link Here
|
| 791 |
return; |
799 |
return; |
| 792 |
} |
800 |
} |
| 793 |
gp_port_info_list_get_info(port_info_list, idx, &port_info); |
801 |
gp_port_info_list_get_info(port_info_list, idx, &port_info); |
| 794 |
gp_port_info_list_free(port_info_list); |
|
|
| 795 |
|
802 |
|
| 796 |
// create a new camera object |
803 |
// create a new camera object |
| 797 |
gpr = gp_camera_new(&m_camera); |
804 |
gpr = gp_camera_new(&m_camera); |
| 798 |
if(gpr != GP_OK) { |
805 |
if(gpr != GP_OK) { |
|
|
806 |
gp_port_info_list_free(port_info_list); |
| 799 |
error(TDEIO::ERR_UNKNOWN, gp_result_as_string(gpr)); |
807 |
error(TDEIO::ERR_UNKNOWN, gp_result_as_string(gpr)); |
| 800 |
return; |
808 |
return; |
| 801 |
} |
809 |
} |
|
Lines 813-818
void KameraProtocol::setHost(const TQString& host, int port, const TQString& use
Link Here
|
| 813 |
gp_camera_set_port_speed(m_camera, 0); // TODO: the value needs to be configurable |
821 |
gp_camera_set_port_speed(m_camera, 0); // TODO: the value needs to be configurable |
| 814 |
kdDebug(7123) << "Opening camera model " << user << " at " << host << endl; |
822 |
kdDebug(7123) << "Opening camera model " << user << " at " << host << endl; |
| 815 |
|
823 |
|
|
|
824 |
gp_port_info_list_free(port_info_list); |
| 825 |
|
| 816 |
TQString errstr; |
826 |
TQString errstr; |
| 817 |
if (!openCamera(errstr)) { |
827 |
if (!openCamera(errstr)) { |
| 818 |
kdDebug(7123) << "Unable to init camera: " << gp_result_as_string(gpr) << endl; |
828 |
kdDebug(7123) << "Unable to init camera: " << gp_result_as_string(gpr) << endl; |
|
Lines 994-1003
void frontendProgressUpdate(
Link Here
|
| 994 |
} |
1004 |
} |
| 995 |
|
1005 |
|
| 996 |
unsigned int frontendProgressStart( |
1006 |
unsigned int frontendProgressStart( |
| 997 |
GPContext * /*context*/, float totalsize, const char *format, va_list args, |
1007 |
GPContext * /*context*/, float totalsize, |
|
|
1008 |
#ifdef HAVE_GPHOTO2_5 |
| 1009 |
const char *status, |
| 1010 |
#else |
| 1011 |
const char *format, va_list args, |
| 1012 |
#endif |
| 998 |
void *data |
1013 |
void *data |
| 999 |
) { |
1014 |
) { |
| 1000 |
KameraProtocol *object = (KameraProtocol*)data; |
1015 |
KameraProtocol *object = (KameraProtocol*)data; |
|
|
1016 |
#ifndef HAVE_GPHOTO2_5 |
| 1001 |
char *status; |
1017 |
char *status; |
| 1002 |
|
1018 |
|
| 1003 |
/* We must copy the va_list to walk it twice, or all hell |
1019 |
/* We must copy the va_list to walk it twice, or all hell |
|
Lines 1031-1044
unsigned int frontendProgressStart(
Link Here
|
| 1031 |
|
1047 |
|
| 1032 |
object->infoMessage(TQString::fromLocal8Bit(status)); |
1048 |
object->infoMessage(TQString::fromLocal8Bit(status)); |
| 1033 |
delete [] status; |
1049 |
delete [] status; |
|
|
1050 |
#else |
| 1051 |
/* libgphoto2 2.5 has resolved this already, no need for print */ |
| 1052 |
object->infoMessage(TQString::fromLocal8Bit(status)); |
| 1053 |
#endif |
| 1034 |
object->totalSize((int)totalsize); // hack: call slot directly |
1054 |
object->totalSize((int)totalsize); // hack: call slot directly |
| 1035 |
return GP_OK; |
1055 |
return GP_OK; |
| 1036 |
} |
1056 |
} |
| 1037 |
|
1057 |
|
| 1038 |
// this callback function is activated on every status message from gphoto2 |
1058 |
// this callback function is activated on every status message from gphoto2 |
| 1039 |
static void frontendCameraStatus(GPContext * /*context*/, const char *format, va_list args, void *data) |
1059 |
static void frontendCameraStatus( |
| 1040 |
{ |
1060 |
GPContext * /*context*/, |
|
|
1061 |
#ifdef HAVE_GPHOTO2_5 |
| 1062 |
const char *status, |
| 1063 |
#else |
| 1064 |
const char *format, va_list args, |
| 1065 |
#endif |
| 1066 |
void *data |
| 1067 |
) { |
| 1041 |
KameraProtocol *object = (KameraProtocol*)data; |
1068 |
KameraProtocol *object = (KameraProtocol*)data; |
|
|
1069 |
#ifndef HAVE_GPHOTO2_5 |
| 1042 |
char *status; |
1070 |
char *status; |
| 1043 |
|
1071 |
|
| 1044 |
/* We must copy the va_list to walk it twice, or all hell |
1072 |
/* We must copy the va_list to walk it twice, or all hell |
|
Lines 1071-1074
static void frontendCameraStatus(GPContext * /*context*/, const char *format, va
Link Here
|
| 1071 |
#endif |
1099 |
#endif |
| 1072 |
object->infoMessage(TQString::fromLocal8Bit(status)); |
1100 |
object->infoMessage(TQString::fromLocal8Bit(status)); |
| 1073 |
delete [] status; |
1101 |
delete [] status; |
|
|
1102 |
#else |
| 1103 |
object->infoMessage(TQString::fromLocal8Bit(status)); |
| 1104 |
#endif |
| 1074 |
} |
1105 |
} |