kioslave: import camera KIO slave from kde-playground

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2021-07-14 22:05:06 +03:00
parent f238774f26
commit 47dfaaa40f
7 changed files with 1145 additions and 15 deletions

View file

@ -81,19 +81,19 @@ if(Q_WS_X11)
add_feature_info("libxf86vmode" X11_xf86vmode_FOUND "The X video mode extension library used by powerdevil")
if(NOT X11_Xdamage_FOUND)
message(FATAL_ERROR "The X11 damaged region extension library was not found. Required for compositing support in KWin.")
message(FATAL_ERROR "The X11 damaged region extension library was not found. Required for compositing support in KWin")
endif()
if(NOT X11_Xrender_FOUND)
message(FATAL_ERROR " The X Rendering Extension client library was not found. Required for XRender Compositing backend in KWin.")
message(FATAL_ERROR " The X Rendering Extension client library was not found. Required for XRender Compositing backend in KWin")
endif()
if(NOT X11_Xfixes_FOUND)
message(FATAL_ERROR "The X11 miscellaneous 'fixes' extension library was not found. Required for XRender Compositing backend in KWin.")
message(FATAL_ERROR "The X11 miscellaneous 'fixes' extension library was not found. Required for XRender Compositing backend in KWin")
endif()
if(NOT X11_Xrandr_FOUND)
message(FATAL_ERROR "The X11 RandR extension library was not found. Required for Multi Screen Support.")
message(FATAL_ERROR "The X11 RandR extension library was not found. Required for Multi Screen Support")
endif()
if(NOT X11_Xcursor_FOUND)
message(FATAL_ERROR "The X11 cursor management library was not found. Required for desktop effects support in KWin.")
message(FATAL_ERROR "The X11 cursor management library was not found. Required for desktop effects support in KWin")
endif()
endif(Q_WS_X11)
@ -181,7 +181,7 @@ set_package_properties(LibUSB PROPERTIES
DESCRIPTION "User level access to USB devices"
URL "http://libusb.sourceforge.net"
TYPE OPTIONAL
PURPOSE "Provides Logitech mouse support in KControl."
PURPOSE "Provides Logitech mouse support in KControl"
)
macro_optional_find_package(PCIUTILS)
@ -189,7 +189,7 @@ set_package_properties(PCIUTILS PROPERTIES
DESCRIPTION "PciUtils is a library for direct access to PCI slots"
URL "http://atrey.karlin.mff.cuni.cz/~mj/pciutils.shtml"
TYPE OPTIONAL
PURPOSE "View PCI details in kinfocenter."
PURPOSE "View PCI details in kinfocenter"
)
macro_optional_find_package(RAW1394)
@ -197,7 +197,7 @@ set_package_properties(RAW1394 PROPERTIES
DESCRIPTION "library for direct access to IEEE 1394 bus"
URL "http://www.linux1394.org/"
TYPE OPTIONAL
PURPOSE "View FireWire devices in kinfocenter."
PURPOSE "View FireWire devices in kinfocenter"
)
# we need a version of samba which has already smbc_set_context(), Alex
@ -227,12 +227,20 @@ set_package_properties(Mtp PROPERTIES
PURPOSE "Needed to build the MTP kioslave"
)
macro_optional_find_package(Gphoto2 2.5)
set_package_properties(Gphoto2 PROPERTIES
DESCRIPTION "Free, redistributable, ready to use set of digital camera software applications"
URL "http://www.gphoto.org/"
TYPE OPTIONAL
PURPOSE "Needed to build camera kioslave"
)
macro_optional_find_package(BZip2)
set_package_properties(BZip2 PROPERTIES
DESCRIPTION "A high-quality data compressor"
URL "http://www.bzip.org"
TYPE OPTIONAL
PURPOSE "Provides the ability to read and write bzip2 compressed data files in the filter kioslave."
PURPOSE "Provides the ability to read and write bzip2 compressed data files in the filter kioslaves"
)
macro_optional_find_package(LibLZMA)
@ -240,7 +248,7 @@ set_package_properties(LibLZMA PROPERTIES
DESCRIPTION "A very high compression ratio data compressor"
URL "http://tukaani.org/xz/"
TYPE OPTIONAL
PURPOSE "Provides the ability to read and write xz compressed data files."
PURPOSE "Provides the ability to read and write xz compressed data files"
)
macro_optional_find_package(OpenEXR)

View file

@ -28,7 +28,7 @@ build_script:
libgps-dev libusb-1.0-0-dev libssh-dev libsmbclient-dev perl-base \
libdrm-dev libraw1394-dev libsensors4-dev libgles2-mesa-dev libpam0g-dev \
libpci-dev libopenexr-dev liblzma-dev libbz2-dev libjpeg-dev \
libdbusmenu-katie ccache
libgphoto2-dev libdbusmenu-katie ccache
export PATH="/usr/lib/ccache/:$PATH"

View file

@ -9,11 +9,14 @@ add_subdirectory( remote )
add_subdirectory( desktop )
add_subdirectory( recentdocuments )
add_subdirectory( thumbnail )
if (LIBSSH_FOUND)
add_subdirectory(sftp)
if(LIBSSH_FOUND)
add_subdirectory(sftp)
endif()
if (MTP_FOUND)
add_subdirectory(mtp)
if(MTP_FOUND)
add_subdirectory(mtp)
endif()
if(GPHOTO2_FOUND)
add_subdirectory(camera)
endif()
add_subdirectory( floppy )

View file

@ -0,0 +1,20 @@
include_directories(
${GPHOTO2_INCLUDE_DIR}
)
kde4_add_plugin(kio_camera kio_camera.cpp)
target_link_libraries(kio_camera
${KDE4_KIO_LIBS}
${GPHOTO2_LIBRARIES}
)
install(
TARGETS kio_camera
DESTINATION ${KDE4_PLUGIN_INSTALL_DIR}
)
install(
FILES camera.protocol
DESTINATION ${KDE4_SERVICES_INSTALL_DIR}
)

View file

@ -0,0 +1,16 @@
[Protocol]
exec=kio_camera
protocol=camera
input=none
output=filesystem
listing=Name,Type
reading=true
writing=false
deleting=true
source=true
makedir=false
linking=false
moving=false
Icon=camera-photo
maxInstances=1
Class=:local

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,80 @@
/*
Copyright (C) 2001 The Kompany
2001-2003 Ilya Konstantinov <kde-devel@future.shiny.co.il>
2001-2008 Marcus Meissner <marcus@jet.franken.de>
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 of the License, 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.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIO_CAMERA_H
#define KIO_CAMERA_H
#include <kio/slavebase.h>
#include <gphoto2.h>
class KConfig;
class KameraProtocol : public KIO::SlaveBase
{
public:
KameraProtocol(const QByteArray &pool, const QByteArray &app);
virtual ~KameraProtocol();
virtual void get(const KUrl &url);
virtual void stat(const KUrl &url);
virtual void del(const KUrl &url, bool isFile);
virtual void listDir(const KUrl &url);
virtual void special(const QByteArray &data);
CameraFile *getFile() { return m_file; }
KIO::filesize_t getFileSize() { return m_fileSize; }
void setFileSize(KIO::filesize_t newfs) { m_fileSize = newfs; }
private:
Camera *m_camera;
QString current_camera, current_port;
CameraAbilities m_abilities;
KConfig *m_config;
GPContext *m_context;
void split_url2camerapath(QString url, QString &directory, QString &file);
void setCamera(const QString &cam, const QString &port);
void reparseConfiguration(void);
bool openCamera(QString& str);
bool openCamera(void ) { QString errstr; return openCamera(errstr); }
void closeCamera(void);
void statRoot(void);
void statRegular(const KUrl &url);
void translateTextToUDS(KIO::UDSEntry &udsEntry, const QString &info, const char *txt);
void translateFileToUDS(KIO::UDSEntry &udsEntry, const CameraFileInfo &info, QString name);
void translateDirectoryToUDS(KIO::UDSEntry &udsEntry, const QString &dirname);
bool cameraSupportsPreview(void);
bool cameraSupportsDel(void);
bool cameraSupportsPut(void);
int readCameraFolder(const QString &folder, CameraList *dirList, CameraList *fileList);
QString m_lockfile;
int idletime;
KIO::filesize_t m_fileSize;
CameraFile *m_file;
bool actiondone, cameraopen;
};
#endif // KIO_CAMERA_H