/* ============================================================ * File : gpiface.cpp * Author: Renchi Raju * Date : 2003-02-19 * Description : * * Copyright 2003 by Renchi Raju * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; * either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * ============================================================ */ // GPhoto2 extern "C" { #include } // TQt #include #include // Local #include "gpiface.h" #include "config.h" namespace KIPIKameraKlientPlugin { int GPIface::autoDetect(TQString& model, TQString& port) { CameraList *pCamList; CameraAbilitiesList *abilList; GPPortInfoList *infoList; const char *camModel_, *camPort_; GPContext *context; context = gp_context_new (); gp_list_new(&pCamList); gp_abilities_list_new (&abilList); gp_abilities_list_load (abilList, context); gp_port_info_list_new (&infoList); gp_port_info_list_load (infoList); gp_abilities_list_detect (abilList, infoList, pCamList, context); gp_abilities_list_free (abilList); gp_port_info_list_free (infoList); gp_context_unref( context ); int count = gp_list_count (pCamList); if (count<=0) { gp_list_free(pCamList); return -1; } for (int i = 0; i < count; i++) { gp_list_get_name (pCamList, i, &camModel_); gp_list_get_value (pCamList, i, &camPort_); } model = camModel_; port = camPort_; gp_list_free(pCamList); return 0; } void GPIface::getSupportedCameras(int& count, TQStringList& clist) { clist.clear(); count = 0; CameraAbilitiesList *abilList; CameraAbilities abil; GPContext *context; context = gp_context_new (); gp_abilities_list_new( &abilList ); gp_abilities_list_load( abilList, context ); count = gp_abilities_list_count( abilList ); if ( count < 0) { gp_context_unref( context ); tqWarning("failed to get list of cameras"); return; } else { for (int i=0; i