|
|
@ -55,11 +55,19 @@ extern "C"
|
|
|
|
{
|
|
|
|
{
|
|
|
|
KDE_EXPORT int kdemain(int argc, char **argv);
|
|
|
|
KDE_EXPORT int kdemain(int argc, char **argv);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_GPHOTO2_5
|
|
|
|
|
|
|
|
static void frontendCameraStatus(GPContext *context, const char *status, void *data);
|
|
|
|
|
|
|
|
static unsigned int frontendProgressStart(
|
|
|
|
|
|
|
|
GPContext *context, float totalsize, const char *status,
|
|
|
|
|
|
|
|
void *data
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
#else
|
|
|
|
static void frontendCameraStatus(GPContext *context, const char *format, va_list args, void *data);
|
|
|
|
static void frontendCameraStatus(GPContext *context, const char *format, va_list args, void *data);
|
|
|
|
static unsigned int frontendProgressStart(
|
|
|
|
static unsigned int frontendProgressStart(
|
|
|
|
GPContext *context, float totalsize, const char *format,
|
|
|
|
GPContext *context, float totalsize, const char *format,
|
|
|
|
va_list args, void *data
|
|
|
|
va_list args, void *data
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
static void frontendProgressUpdate(
|
|
|
|
static void frontendProgressUpdate(
|
|
|
|
GPContext *context, unsigned int id, float current, void *data
|
|
|
|
GPContext *context, unsigned int id, float current, void *data
|
|
|
|
);
|
|
|
|
);
|
|
|
@ -791,11 +799,11 @@ void KameraProtocol::setHost(const TQString& host, int port, const TQString& use
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gp_port_info_list_get_info(port_info_list, idx, &port_info);
|
|
|
|
gp_port_info_list_get_info(port_info_list, idx, &port_info);
|
|
|
|
gp_port_info_list_free(port_info_list);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// create a new camera object
|
|
|
|
// create a new camera object
|
|
|
|
gpr = gp_camera_new(&m_camera);
|
|
|
|
gpr = gp_camera_new(&m_camera);
|
|
|
|
if(gpr != GP_OK) {
|
|
|
|
if(gpr != GP_OK) {
|
|
|
|
|
|
|
|
gp_port_info_list_free(port_info_list);
|
|
|
|
error(TDEIO::ERR_UNKNOWN, gp_result_as_string(gpr));
|
|
|
|
error(TDEIO::ERR_UNKNOWN, gp_result_as_string(gpr));
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -813,6 +821,8 @@ void KameraProtocol::setHost(const TQString& host, int port, const TQString& use
|
|
|
|
gp_camera_set_port_speed(m_camera, 0); // TODO: the value needs to be configurable
|
|
|
|
gp_camera_set_port_speed(m_camera, 0); // TODO: the value needs to be configurable
|
|
|
|
kdDebug(7123) << "Opening camera model " << user << " at " << host << endl;
|
|
|
|
kdDebug(7123) << "Opening camera model " << user << " at " << host << endl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gp_port_info_list_free(port_info_list);
|
|
|
|
|
|
|
|
|
|
|
|
TQString errstr;
|
|
|
|
TQString errstr;
|
|
|
|
if (!openCamera(errstr)) {
|
|
|
|
if (!openCamera(errstr)) {
|
|
|
|
kdDebug(7123) << "Unable to init camera: " << gp_result_as_string(gpr) << endl;
|
|
|
|
kdDebug(7123) << "Unable to init camera: " << gp_result_as_string(gpr) << endl;
|
|
|
@ -865,9 +875,6 @@ void KameraProtocol::translateFileToUDS(UDSEntry &udsEntry, const CameraFileInfo
|
|
|
|
udsEntry.append(atom);
|
|
|
|
udsEntry.append(atom);
|
|
|
|
|
|
|
|
|
|
|
|
atom.m_uds = UDS_NAME;
|
|
|
|
atom.m_uds = UDS_NAME;
|
|
|
|
if (info.file.fields & GP_FILE_INFO_NAME)
|
|
|
|
|
|
|
|
atom.m_str = TQString::fromLocal8Bit(info.file.name);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
atom.m_str = name;
|
|
|
|
atom.m_str = name;
|
|
|
|
udsEntry.append(atom);
|
|
|
|
udsEntry.append(atom);
|
|
|
|
|
|
|
|
|
|
|
@ -994,10 +1001,16 @@ void frontendProgressUpdate(
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
unsigned int frontendProgressStart(
|
|
|
|
unsigned int frontendProgressStart(
|
|
|
|
GPContext * /*context*/, float totalsize, const char *format, va_list args,
|
|
|
|
GPContext * /*context*/, float totalsize,
|
|
|
|
|
|
|
|
#ifdef HAVE_GPHOTO2_5
|
|
|
|
|
|
|
|
const char *status,
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
const char *format, va_list args,
|
|
|
|
|
|
|
|
#endif
|
|
|
|
void *data
|
|
|
|
void *data
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
KameraProtocol *object = (KameraProtocol*)data;
|
|
|
|
KameraProtocol *object = (KameraProtocol*)data;
|
|
|
|
|
|
|
|
#ifndef HAVE_GPHOTO2_5
|
|
|
|
char *status;
|
|
|
|
char *status;
|
|
|
|
|
|
|
|
|
|
|
|
/* We must copy the va_list to walk it twice, or all hell
|
|
|
|
/* We must copy the va_list to walk it twice, or all hell
|
|
|
@ -1031,14 +1044,26 @@ unsigned int frontendProgressStart(
|
|
|
|
|
|
|
|
|
|
|
|
object->infoMessage(TQString::fromLocal8Bit(status));
|
|
|
|
object->infoMessage(TQString::fromLocal8Bit(status));
|
|
|
|
delete [] status;
|
|
|
|
delete [] status;
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
/* libgphoto2 2.5 has resolved this already, no need for print */
|
|
|
|
|
|
|
|
object->infoMessage(TQString::fromLocal8Bit(status));
|
|
|
|
|
|
|
|
#endif
|
|
|
|
object->totalSize((int)totalsize); // hack: call slot directly
|
|
|
|
object->totalSize((int)totalsize); // hack: call slot directly
|
|
|
|
return GP_OK;
|
|
|
|
return GP_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// this callback function is activated on every status message from gphoto2
|
|
|
|
// this callback function is activated on every status message from gphoto2
|
|
|
|
static void frontendCameraStatus(GPContext * /*context*/, const char *format, va_list args, void *data)
|
|
|
|
static void frontendCameraStatus(
|
|
|
|
{
|
|
|
|
GPContext * /*context*/,
|
|
|
|
|
|
|
|
#ifdef HAVE_GPHOTO2_5
|
|
|
|
|
|
|
|
const char *status,
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
const char *format, va_list args,
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void *data
|
|
|
|
|
|
|
|
) {
|
|
|
|
KameraProtocol *object = (KameraProtocol*)data;
|
|
|
|
KameraProtocol *object = (KameraProtocol*)data;
|
|
|
|
|
|
|
|
#ifndef HAVE_GPHOTO2_5
|
|
|
|
char *status;
|
|
|
|
char *status;
|
|
|
|
|
|
|
|
|
|
|
|
/* We must copy the va_list to walk it twice, or all hell
|
|
|
|
/* We must copy the va_list to walk it twice, or all hell
|
|
|
@ -1071,4 +1096,7 @@ static void frontendCameraStatus(GPContext * /*context*/, const char *format, va
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
object->infoMessage(TQString::fromLocal8Bit(status));
|
|
|
|
object->infoMessage(TQString::fromLocal8Bit(status));
|
|
|
|
delete [] status;
|
|
|
|
delete [] status;
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
object->infoMessage(TQString::fromLocal8Bit(status));
|
|
|
|
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|