|
Lines 55-65
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 785-795
Link Here
|
| 785 |
return; |
793 |
return; |
| 786 |
} |
794 |
} |
| 787 |
gp_port_info_list_get_info(port_info_list, idx, &port_info); |
795 |
gp_port_info_list_get_info(port_info_list, idx, &port_info); |
| 788 |
gp_port_info_list_free(port_info_list); |
|
|
| 789 |
|
796 |
|
| 790 |
// create a new camera object |
797 |
// create a new camera object |
| 791 |
gpr = gp_camera_new(&m_camera); |
798 |
gpr = gp_camera_new(&m_camera); |
| 792 |
if(gpr != GP_OK) { |
799 |
if(gpr != GP_OK) { |
|
|
800 |
gp_port_info_list_free(port_info_list); |
| 793 |
error(KIO::ERR_UNKNOWN, gp_result_as_string(gpr)); |
801 |
error(KIO::ERR_UNKNOWN, gp_result_as_string(gpr)); |
| 794 |
return; |
802 |
return; |
| 795 |
} |
803 |
} |
|
Lines 805-810
Link Here
|
| 805 |
gp_camera_set_port_speed(m_camera, 0); // TODO: the value needs to be configurable |
813 |
gp_camera_set_port_speed(m_camera, 0); // TODO: the value needs to be configurable |
| 806 |
kdDebug(7123) << "Opening camera model " << user << " at " << host << endl; |
814 |
kdDebug(7123) << "Opening camera model " << user << " at " << host << endl; |
| 807 |
|
815 |
|
|
|
816 |
gp_port_info_list_free(port_info_list); |
| 817 |
|
| 808 |
TQString errstr; |
818 |
TQString errstr; |
| 809 |
if (!openCamera(errstr)) { |
819 |
if (!openCamera(errstr)) { |
| 810 |
kdDebug(7123) << "Unable to init camera: " << gp_result_as_string(gpr) << endl; |
820 |
kdDebug(7123) << "Unable to init camera: " << gp_result_as_string(gpr) << endl; |
|
Lines 857-866
Link Here
|
| 857 |
udsEntry.append(atom); |
867 |
udsEntry.append(atom); |
| 858 |
|
868 |
|
| 859 |
atom.m_uds = UDS_NAME; |
869 |
atom.m_uds = UDS_NAME; |
| 860 |
if (info.file.fields & GP_FILE_INFO_NAME) |
870 |
atom.m_str = name; |
| 861 |
atom.m_str = TQString::fromLocal8Bit(info.file.name); |
|
|
| 862 |
else |
| 863 |
atom.m_str = name; |
| 864 |
udsEntry.append(atom); |
871 |
udsEntry.append(atom); |
| 865 |
|
872 |
|
| 866 |
if (info.file.fields & GP_FILE_INFO_SIZE) { |
873 |
if (info.file.fields & GP_FILE_INFO_SIZE) { |
|
Lines 986-995
Link Here
|
| 986 |
} |
993 |
} |
| 987 |
|
994 |
|
| 988 |
unsigned int frontendProgressStart( |
995 |
unsigned int frontendProgressStart( |
| 989 |
GPContext * /*context*/, float totalsize, const char *format, va_list args, |
996 |
GPContext * /*context*/, float totalsize, |
|
|
997 |
#ifdef HAVE_GPHOTO2_5 |
| 998 |
const char *status, |
| 999 |
#else |
| 1000 |
const char *format, va_list args, |
| 1001 |
#endif |
| 990 |
void *data |
1002 |
void *data |
| 991 |
) { |
1003 |
) { |
| 992 |
KameraProtocol *object = (KameraProtocol*)data; |
1004 |
KameraProtocol *object = (KameraProtocol*)data; |
|
|
1005 |
#ifndef HAVE_GPHOTO2_5 |
| 993 |
char *status; |
1006 |
char *status; |
| 994 |
|
1007 |
|
| 995 |
/* We must copy the va_list to walk it twice, or all hell |
1008 |
/* We must copy the va_list to walk it twice, or all hell |
|
Lines 1023-1036
Link Here
|
| 1023 |
|
1036 |
|
| 1024 |
object->infoMessage(TQString::fromLocal8Bit(status)); |
1037 |
object->infoMessage(TQString::fromLocal8Bit(status)); |
| 1025 |
delete [] status; |
1038 |
delete [] status; |
|
|
1039 |
#else |
| 1040 |
/* libgphoto2 2.5 has resolved this already, no need for print */ |
| 1041 |
object->infoMessage(TQString::fromLocal8Bit(status)); |
| 1042 |
#endif |
| 1026 |
object->totalSize((int)totalsize); // hack: call slot directly |
1043 |
object->totalSize((int)totalsize); // hack: call slot directly |
| 1027 |
return GP_OK; |
1044 |
return GP_OK; |
| 1028 |
} |
1045 |
} |
| 1029 |
|
1046 |
|
| 1030 |
// this callback function is activated on every status message from gphoto2 |
1047 |
// this callback function is activated on every status message from gphoto2 |
| 1031 |
static void frontendCameraStatus(GPContext * /*context*/, const char *format, va_list args, void *data) |
1048 |
static void frontendCameraStatus( |
| 1032 |
{ |
1049 |
GPContext * /*context*/, |
|
|
1050 |
#ifdef HAVE_GPHOTO2_5 |
| 1051 |
const char *status, |
| 1052 |
#else |
| 1053 |
const char *format, va_list args, |
| 1054 |
#endif |
| 1055 |
void *data |
| 1056 |
) { |
| 1033 |
KameraProtocol *object = (KameraProtocol*)data; |
1057 |
KameraProtocol *object = (KameraProtocol*)data; |
|
|
1058 |
#ifndef HAVE_GPHOTO2_5 |
| 1034 |
char *status; |
1059 |
char *status; |
| 1035 |
|
1060 |
|
| 1036 |
/* We must copy the va_list to walk it twice, or all hell |
1061 |
/* We must copy the va_list to walk it twice, or all hell |
|
Lines 1063-1066
Link Here
|
| 1063 |
#endif |
1088 |
#endif |
| 1064 |
object->infoMessage(TQString::fromLocal8Bit(status)); |
1089 |
object->infoMessage(TQString::fromLocal8Bit(status)); |
| 1065 |
delete [] status; |
1090 |
delete [] status; |
|
|
1091 |
#else |
| 1092 |
object->infoMessage(TQString::fromLocal8Bit(status)); |
| 1093 |
#endif |
| 1066 |
} |
1094 |
} |