import git checkouts of juk and kamera

This commit is contained in:
Ivailo Monev 2014-12-27 17:28:38 +00:00
parent 98d11983ca
commit c48298a798
29 changed files with 4084 additions and 41 deletions

View file

@ -30,6 +30,8 @@ macro_optional_add_subdirectory (dragon)
macro_optional_add_subdirectory (ffmpegthumbs)
macro_optional_add_subdirectory (filelight)
macro_optional_add_subdirectory (gwenview)
# macro_optional_add_subdirectory (juk)
# macro_optional_add_subdirectory (kamera)
macro_optional_add_subdirectory (kcalc)
macro_optional_add_subdirectory (kcron)
macro_optional_add_subdirectory (kdenetwork-filesharing)

View file

@ -19,7 +19,6 @@
#include <QHash>
#include <QVector>
#include <QListView>
#include "playlist.h"
#include "playlistitem.h"
@ -114,7 +113,7 @@ public:
CollectionListItem *lookup(const QString &file) const;
virtual CollectionListItem *createItem(const FileHandle &file,
QListView * = 0,
Q3ListViewItem * = 0,
bool = false);
void emitVisibleColumnsChanged() { emit signalVisibleColumnsChanged(); }

View file

@ -8,6 +8,7 @@
<name xml:lang="cs">JuK</name>
<name xml:lang="da">JuK</name>
<name xml:lang="de">JuK</name>
<name xml:lang="el">JuK</name>
<name xml:lang="en-GB">JuK</name>
<name xml:lang="es">JuK</name>
<name xml:lang="et">JuK</name>
@ -30,18 +31,18 @@
<name xml:lang="sv">Juk</name>
<name xml:lang="uk">JuK</name>
<name xml:lang="x-test">xxJuKxx</name>
<name xml:lang="zh-TW">音樂播放_JuK</name>
<name xml:lang="zh-TW">音樂播放_Juk</name>
<summary>Music Player</summary>
<summary xml:lang="ca">Reproductor musical</summary>
<summary xml:lang="cs">Přehrávač hudby</summary>
<summary xml:lang="da">Musikafspiller</summary>
<summary xml:lang="de">Audio-Wiedergabe</summary>
<summary xml:lang="el">Αναπαραγωγέας μουσικής</summary>
<summary xml:lang="en-GB">Music Player</summary>
<summary xml:lang="es">Music Player</summary>
<summary xml:lang="et">Muusikamängija</summary>
<summary xml:lang="fi">Musiikkisoitin</summary>
<summary xml:lang="hu">Zenelejátszó</summary>
<summary xml:lang="ia">Executor de musica</summary>
<summary xml:lang="it">Lettore musicale</summary>
<summary xml:lang="ko">음악 재생기</summary>
<summary xml:lang="nds">Musikafspeler</summary>
@ -63,6 +64,7 @@
<p>JuK is an audio jukebox application, supporting collections of MP3, Ogg Vorbis, and FLAC audio files. It allows you to edit the "tags" of your audio files, and manage your collection and playlists. It's main focus, in fact, is on music management.</p>
<p xml:lang="ca">El JuK és una aplicació de màquina de discos musicals, que accepta col·leccions de fitxers d'àudio MP3, Ogg Vorbis, i FLAC. Permet editar les "etiquetes" dels fitxers d'àudio, i gestionar les col·leccions i les llistes de reproducció. De fet, els seu focus principal és en la gestió de la música.</p>
<p xml:lang="da">JuK er et lydjukebox-program, som understøtter samlinger af MP3-, Ogg Vorbis- og FLAC-lydfiler. Den lader dig redigere "mærkerne" i dine lydfiler og håndtere din samling og spillelister. Dens hovedfokus er faktisk på musikhåndtering.</p>
<p xml:lang="el">Το JuK είναι μια εφαρμογή μουσικού κουτιού, που υποστηρίζει συλλογές MP3, Ogg Vorbis, και FLAC αρχεία ήχου. Σας επιτρέπει να επεξεργαστείτε τις "ετικέτες" των αρχείων ήχου σας, και να διαχειριστείτε τις συλλογές και τις λίστες αναπαραγωγής. Εστιάζει κυρίως στη διαχείριση μουσικής.</p>
<p xml:lang="en-GB">JuK is an audio jukebox application, supporting collections of MP3, Ogg Vorbis, and FLAC audio files. It allows you to edit the "tags" of your audio files, and manage your collection and playlists. It's main focus, in fact, is on music management.</p>
<p xml:lang="es">JuK es una aplicación jukebox de audio, que soporta colecciones de archivos MP3, Ogg Vorbis y FLAC. Le permite editar los "tags" de sus archivos de audio, y administrar sus colecciones y listas de reproducción. Su principal cometido, de hecho, es administrar la música.</p>
<p xml:lang="et">JuK on helifailide muusikamängija, mis toetab MP3, Ogg Vorbise ja FLAC-i vormingut. See võimaldab muuta helifailide "silte" ning hallata muusikakogusid ja esitusnimekirju. Õigupoolest ongi rakenduse rõhk eelkõige muusika haldamisel.</p>
@ -89,12 +91,12 @@
<p xml:lang="cs">Vlastnosti:</p>
<p xml:lang="da">Funktioner:</p>
<p xml:lang="de">Funktionen:</p>
<p xml:lang="el">Χαρακτηριστικά:</p>
<p xml:lang="en-GB">Features:</p>
<p xml:lang="es">Características:</p>
<p xml:lang="et">Omadused:</p>
<p xml:lang="fi">Ominaisuudet:</p>
<p xml:lang="hu">Szolgáltatások:</p>
<p xml:lang="ia">Characteristicas:</p>
<p xml:lang="it">Funzionalità:</p>
<p xml:lang="ko">기능:</p>
<p xml:lang="nds">Markmalen:</p>
@ -111,12 +113,13 @@
<p xml:lang="sv">Funktioner:</p>
<p xml:lang="uk">Можливості:</p>
<p xml:lang="x-test">xxFeatures:xx</p>
<p xml:lang="zh-TW">特色</p>
<p xml:lang="zh-TW">功能</p>
<ul>
<li>Collection list and multiple user defined playlists</li>
<li xml:lang="ca">Llista de col·leccions i múltiples llistes de reproducció definides per usuari</li>
<li xml:lang="da">Samlingsliste og flere brugerdefinerede spillelister</li>
<li xml:lang="de">Sammlungslisten und mehrere benutzerdefinierte Wiedergabelisten</li>
<li xml:lang="el">Λίστα συλλογών και λίστες αναπαραγωγής πολλών χρηστών</li>
<li xml:lang="en-GB">Collection list and multiple user defined playlists</li>
<li xml:lang="es">Listas de colecciones y listas de reproducción definidas por múltiples usuarios</li>
<li xml:lang="et">Muusikakogu nimekiri ja paljud kasutaja loodud esitusnimekirjad</li>
@ -142,6 +145,7 @@
<li xml:lang="ca">Capacitat d'explorar directoris per importar automàticament llistes de reproducció i fitxers de música en iniciar-se</li>
<li xml:lang="da">Kan scanne mapper for automatisk at importere spillelister og musikfiler ved opstart</li>
<li xml:lang="de">Ordner können durchsucht werden, um beim Start automatisch Wiedergabelisten und Musikdateien zu importieren</li>
<li xml:lang="el">Ικανότητα σάρωσης καταλόγων για την αυτόματη εισαγωγή λιστών αναπαραγωγής και μουσικών αρχείων κατά την εκκίνηση</li>
<li xml:lang="en-GB">Ability to scan directories to automatically import playlists and music files on start up</li>
<li xml:lang="es">Capacidad de escanear directorios para importar listas de reproducción y archivos de música automáticamente al iniciar el programa</li>
<li xml:lang="et">Oskus uurida kohe käivitamisel läbi katalooge ja importida sealt esitusnimekirju ja muusikafaile</li>
@ -164,11 +168,13 @@
<li xml:lang="x-test">xxAbility to scan directories to automatically import playlists and music files on start upxx</li>
<li xml:lang="zh-TW">可以掃描目錄並於啟動時自動匯入播放清單與音樂檔</li>
<li>Dynamic Search Playlists that are automatically updated as fields in the collection change</li>
<li xml:lang="ca">Llistes de cerca dinàmica que s'actualitzen automàticament a mesura que canvien els camps a les col·leccions.</li>
<li xml:lang="ca">Llistes de cerques dinàmiques que s'actualitzen automàticament a mesura que canvien els camps a la col·lecció.</li>
<li xml:lang="da">Dynamisk søgning-spillelister som automatisk opdateres efterhånden som samlingen ændres</li>
<li xml:lang="el">Λίστες αναπαραγωγής δυναμικής αναζήτησης που ενημερώνονται αυτόματα ως πεδία στην αλλαγή της συλλογής</li>
<li xml:lang="en-GB">Dynamic Search Playlists that are automatically updated as fields in the collection change</li>
<li xml:lang="es">Búsqueda dinámica de listas de reproducción que se actualiza automáticamente con los cambios de los campos de su colección</li>
<li xml:lang="et">Dünaamilised esitusnimekirjad, mis uuenevad automaatselt kogu väljade muutumisel</li>
<li xml:lang="hu">Lejátszólisták dinamikus keresése, amelyek automatikusan frissítésre kerülnek mezőkként a gyűjtemény módosításban</li>
<li xml:lang="it">Scalette a ricerca dinamica, aggiornate automaticamente al cambiare dei campi nella raccolta</li>
<li xml:lang="ko">모음집 필드 변경 사항에 따라 자동으로 업데이트되는 동적 재생 목록</li>
<li xml:lang="nds">Dünaamsch Söök na Afspeellisten, de automaatsch topasst warrt, wenn sik Feller binnen de Sammeln ännern doot</li>
@ -187,11 +193,13 @@
<li xml:lang="x-test">xxDynamic Search Playlists that are automatically updated as fields in the collection changexx</li>
<li xml:lang="zh-TW">動態搜尋播放清單,收藏有變更時自動更新</li>
<li>A Tree View mode where playlists are automatically generated for sets of albums, artists and genres</li>
<li xml:lang="ca">Un mode de vista en arbre quan les llistes de reproducció es generen automàticament per a conjunts d'àlbums, artistes i gèneres.</li>
<li xml:lang="ca">Un mode de vista en arbre quan es generen automàticament llistes de reproducció per a conjunts d'àlbums, artistes i gèneres.</li>
<li xml:lang="da">En trævisningstilstand hvor spillelister automatisk genereres for sæt af albummer, kunstnere og genrer</li>
<li xml:lang="el">Δενδρική άποψη όπου οι λίστες αναπαραγωγής παράγονται αυτόματα για σύνολα άλμπουμ, καλλιτεχνών και μουσικών ειδών</li>
<li xml:lang="en-GB">A Tree View mode where playlists are automatically generated for sets of albums, artists and genres</li>
<li xml:lang="es">Una vista de árbol donde las listas de reproducción se generan automáticamente por conjuntos de álbumes, artistas y géneros</li>
<li xml:lang="et">Puuvaade, kus albumitele, esitajatele ja žanritele luuakse automaatselt esitusnimekirjad</li>
<li xml:lang="hu">Egy fanézet mód, ahol a lejátszólisták automatikusan kerülnek előállításra albumok, előadók és műfajok halmazához</li>
<li xml:lang="it">Modalità di vista ad albero in cui le scalette sono automaticamente generate per insiemi di album, artisti o generi</li>
<li xml:lang="ko">음악가, 앨범, 장르별 자동 생성 트리 보기 모드</li>
<li xml:lang="nds">En Boomansicht, över de sik Afspeellisten automaatsch för Setten vun Albums, Künstlers un Musikoorden opstellen laat</li>
@ -210,11 +218,13 @@
<li xml:lang="x-test">xxA Tree View mode where playlists are automatically generated for sets of albums, artists and genresxx</li>
<li xml:lang="zh-TW">播放清單自動產生樹狀檢視模式,顯示專輯、演出者與風格</li>
<li>Playlist history to indicate which files have been played and when</li>
<li xml:lang="ca">Historial de llistes de reproducció per indicar quins fitxers s'han reproduït i quan.</li>
<li xml:lang="ca">Historial de les llistes de reproducció per indicar quins fitxers s'han reproduït i quan.</li>
<li xml:lang="da">Spillelistehistorik som indikerer hvilke filer der er blevet afspillet og hvornår</li>
<li xml:lang="el">Ιστορικό λιστών αναπαραγωγής με ένδειξη για το ποια αρχεία έχουν προηγηθεί και πότε</li>
<li xml:lang="en-GB">Playlist history to indicate which files have been played and when</li>
<li xml:lang="es">Un historial de reproducción que le indica qué archivos han sido reproducidos y cuándo</li>
<li xml:lang="et">Esitusnimekirja ajalugu, mis näitab, milliseid faile ja millal on esitatud</li>
<li xml:lang="hu">Lejátszólista előzmények annak jelölésére, hogy mely fájlok lettek már lejátszva és mikor</li>
<li xml:lang="it">Cronologia delle scalette per indicare quali file sono stati letti e quando</li>
<li xml:lang="ko">재생 목록 내 파일의 재생 이력 관리</li>
<li xml:lang="nds">Afspeellist-Vörgeschicht, över de sik wiesen lett, welk Dateien Du wannehr afspeelt hest</li>
@ -233,11 +243,13 @@
<li xml:lang="x-test">xxPlaylist history to indicate which files have been played and whenxx</li>
<li xml:lang="zh-TW">播放清單歷史,可以指示哪些檔案於何時被播放過</li>
<li>Inline search for filtering the list of visible items</li>
<li xml:lang="ca">Cerca inclosa per filtrar la llista d'elements visibles.</li>
<li xml:lang="ca">Cerca inclosa per filtrar la llista dels elements visibles.</li>
<li xml:lang="da">Indlejret søgning til filtrering af synlige elementer i listen</li>
<li xml:lang="el">Αναζήτηση για φιλτράρισμα της λίστας με τα ορατά αντικείμενα</li>
<li xml:lang="en-GB">Inline search for filtering the list of visible items</li>
<li xml:lang="es">Búsqueda bajo control para filtrar la lista de los elementos visibles</li>
<li xml:lang="et">Reasisene otsing nähtavate elementide nimekirja filtreerimiseks</li>
<li xml:lang="hu">Beágyazott keresés a látható elemek listájának szűréséhez</li>
<li xml:lang="it">Ricerca in linea per filtrare l'elenco di elementi visibili</li>
<li xml:lang="ko">재생 목록 내 빠른 검색</li>
<li xml:lang="nds">Binnenreegs-Söök, mit de sik de List vun sichtbor Indrääg filtern lett</li>
@ -258,9 +270,11 @@
<li>The ability to guess tag information based on the track's file name</li>
<li xml:lang="ca">La capacitat d'estimar la informació de les etiquetes basada en el nom de fitxer de la peça.</li>
<li xml:lang="da">Mulighed for at gætte mærkeinformation baseret på sporets filnavn</li>
<li xml:lang="el">Η ικανότητα πρόγνωσης της ετικέτας πληροφοριών με βάση το όνομα του μουσικού αρχείου</li>
<li xml:lang="en-GB">The ability to guess tag information based on the track's file name</li>
<li xml:lang="es">La habilidad de adivinar metadatos basada en los nombres de los archivos</li>
<li xml:lang="et">Oskus oletada silditeavet pala failinime põhjal</li>
<li xml:lang="hu">Címkeinformációk kitalálásának képessége a szám fájlneve alapján</li>
<li xml:lang="it">Capacità di indovinare informazioni per le etichette in base al nome del file audio</li>
<li xml:lang="ko">파일 이름을 기반으로 한 태그 내용 추측</li>
<li xml:lang="nds">Kann Slötelwöör ut dat Stück sien Dateinaam raden</li>
@ -279,11 +293,13 @@
<li xml:lang="x-test">xxThe ability to guess tag information based on the track's file namexx</li>
<li xml:lang="zh-TW">根據曲目名稱猜測標籤的功能</li>
<li>File renamer that can rename files based on the tag content</li>
<li xml:lang="ca">Reanomenador de fitxers que pot reanomenar fitxers basant-se en el contingut de l'etiqueta.</li>
<li xml:lang="ca">Reanomenador de fitxers que pot reanomenar els fitxers basant-se en el contingut de l'etiqueta.</li>
<li xml:lang="da">Filomdøber som kan omdøbe filer baseret på mærkeindholdet</li>
<li xml:lang="el">Πρόγραμμα μετονομασίας που λειτουργεί με βάση το περιεχόμενο της ετικέτας</li>
<li xml:lang="en-GB">File renamer that can rename files based on the tag content</li>
<li xml:lang="es">Un cambiador de nombres de archivo que puede renombrar archivos basándose en el contenido de sus metadatos</li>
<li xml:lang="et">Failide nime muutmise tööriist, mis võib failinimesid muuta sildi sisu põhjal</li>
<li xml:lang="hu">Fájlátnevező, amely képes a címketartalom alapján átnevezni fájlokat</li>
<li xml:lang="it">Rinominatore di file per cambiare il nome ai file in base alle etichette</li>
<li xml:lang="ko">태그 내용을 기반으로 한 파일 이름 변경</li>
<li xml:lang="nds">Ümnömer, de Dateien na ehr Slötelwöör ümnömen kann</li>
@ -300,13 +316,15 @@
<li xml:lang="sv">Byte av filnamn som kan byta namn på filer baserat på tagginnehåll</li>
<li xml:lang="uk">Засіб перейменування файлів, який може перейменувати файли на основі даних міток.</li>
<li xml:lang="x-test">xxFile renamer that can rename files based on the tag contentxx</li>
<li xml:lang="zh-TW">根據標籤內容重新命名檔案</li>
<li xml:lang="zh-TW">根據標籤內容重新命名檔案</li>
<li>Tag reading and editing support for many formats including ID3v1, ID3v2 and Ogg Vorbis</li>
<li xml:lang="ca">Implementa la lectura i edició d'etiquetes per a molts formats, incloent ID3v1, ID3v2 i Ogg Vorbis.</li>
<li xml:lang="ca">Implementa la lectura i edició de les etiquetes per a molts formats incloent ID3v1, ID3v2 i Ogg Vorbis.</li>
<li xml:lang="da">Understøttelse af mærkelæsning og -redigering af mange formater inklusiv ID3v1, ID3v2 og Ogg Vorbis</li>
<li xml:lang="el">Ανάγνωση και εγγραφή ετικέτας με υποστήριξη για πολλούς τύπους αποθήκευσης, για παράδειγμα ID3v1, ID3v2 και Ogg Vorbis</li>
<li xml:lang="en-GB">Tag reading and editing support for many formats including ID3v1, ID3v2 and Ogg Vorbis</li>
<li xml:lang="es">Leer y editar metadatos en varios formatos incluyendo ID3v1, ID3v2 y Ogg Vorbis</li>
<li xml:lang="et">Siltide lugemise ja muutmise toetus paljude vormingute jaoks, sealhulgas ID3v1, ID3v2 ja Ogg Vorbis</li>
<li xml:lang="hu">Címkeolvasás és szerkesztés támogatás számos formátumhoz, beleértve az ID3v1, az ID3v2 és az Ogg Vorbis formátumokat</li>
<li xml:lang="it">Supporto per lettura e modifica delle etichette per molti formati, tra cui ID3v1, ID3v2 e Ogg Vorbis</li>
<li xml:lang="ko">ID3v1, ID3v2, Ogg Vorbis 태그 읽기 및 쓰기 지원</li>
<li xml:lang="nds">Kann Slötelwöör mit vele Formaten lesen un bewerken, so as ID3v1, ID3v2 un Ogg-Vorbis</li>

View file

@ -51,8 +51,8 @@ static const char sho[] = I18N_NOOP("MPRIS2 Interface implementation.");
int main(int argc, char *argv[])
{
KAboutData aboutData("juk", 0, ki18n("JuK"),
"3.11.1", ki18n(description), KAboutData::License_GPL,
ki18n("© 20022013, Scott Wheeler, Michael Pyne, and others"),
"3.12", ki18n(description), KAboutData::License_GPL,
ki18n("© 20022014, Scott Wheeler, Michael Pyne, and others"),
KLocalizedString(),
"http://www.kde.org/applications/multimedia/juk/");

View file

@ -18,14 +18,13 @@
#ifndef PLAYLIST_H
#define PLAYLIST_H
#include <k3listview.h>
#include <kglobalsettings.h>
#include <kdebug.h>
#include <QVector>
#include <QEvent>
#include <QList>
#include <QMimeData>
#include <QTableWidget>
#include "covermanager.h"
#include "stringhash.h"
@ -50,7 +49,7 @@ class CollectionListItem;
typedef QList<PlaylistItem *> PlaylistItemList;
class Playlist : public QTableWidget, public PlaylistInterface
class Playlist : public K3ListView, public PlaylistInterface
{
Q_OBJECT
@ -171,7 +170,7 @@ public:
* both PlaylistItems and CollectionListItems.
*/
virtual PlaylistItem *createItem(const FileHandle &file,
QListView *after = 0,
Q3ListViewItem *after = 0,
bool emitChanged = true);
/**
@ -180,7 +179,7 @@ public:
*/
template <class ItemType>
ItemType *createItem(const FileHandle &file,
QListView *after = 0,
Q3ListViewItem *after = 0,
bool emitChanged = true);
virtual void createItems(const PlaylistItemList &siblings, PlaylistItem *after = 0);
@ -358,7 +357,7 @@ public slots:
* @see clearItems()
*/
virtual void clear();
virtual void selectAll() { QTableWidget::selectAll(true); }
virtual void selectAll() { K3ListView::selectAll(true); }
/**
* Refreshes the tags of the selection from disk, or all of the files in the
@ -425,8 +424,8 @@ protected:
virtual bool eventFilter(QObject *watched, QEvent *e);
virtual void keyPressEvent(QKeyEvent *e);
virtual QDrag *dragObject(QWidget *parent);
virtual QDrag *dragObject() { return dragObject(this); }
virtual Q3DragObject *dragObject(QWidget *parent);
virtual Q3DragObject *dragObject() { return dragObject(this); }
virtual void decode(const QMimeData *s, PlaylistItem *item = 0);
virtual void contentsDropEvent(QDropEvent *e);
virtual void contentsMouseDoubleClickEvent(QMouseEvent *e);
@ -436,13 +435,13 @@ protected:
virtual void viewportPaintEvent(QPaintEvent *pe);
virtual void viewportResizeEvent(QResizeEvent *re);
virtual void insertItem(QListView *item);
virtual void takeItem(QListView *item);
virtual void insertItem(Q3ListViewItem *item);
virtual void takeItem(Q3ListViewItem *item);
virtual bool hasItem(const QString &file) const { return m_members.contains(file); }
virtual int insertColumn(const QString &label, int width = -1);
using QTableWidget::insertColumn;
virtual int addColumn(const QString &label, int width = -1);
using K3ListView::addColumn;
/**
* Do some finial initialization of created items. Notably ensure that they
@ -530,7 +529,7 @@ private:
* \see visibleItems()
* \see selectedItems()
*/
PlaylistItemList items(QListViewIterator::IteratorFlag flags);
PlaylistItemList items(Q3ListViewItemIterator::IteratorFlag flags);
/**
* Build the column "weights" for the weighted width mode.
@ -574,7 +573,7 @@ private:
*/
class SharedSettings;
using QTableWidget::selectAll; // Avoid warning about hiding this function.
using K3ListView::selectAll; // Avoid warning about hiding this function.
private slots:
@ -583,7 +582,7 @@ private slots:
* don't need to happen in the ctor, such as setting up the columns,
* initializing the RMB menu, and setting up signal/slot connections.
*
* Used to be a subclass of QListView::polish() but the timing of the
* Used to be a subclass of K3ListView::polish() but the timing of the
* call is not consistent and therefore lead to crashes.
*/
void slotInitialize();
@ -596,7 +595,7 @@ private slots:
* Show the RMB menu. Matches the signature for the signal
* QListView::contextMenuRequested().
*/
void slotShowRMBMenu(QListView *item, const QPoint &point, int column);
void slotShowRMBMenu(Q3ListViewItem *item, const QPoint &point, int column);
/**
* This slot is called when the inline tag editor has completed its editing
@ -604,7 +603,7 @@ private slots:
*
* \see editTag()
*/
void slotInlineEditDone(QListView *, const QString &, int column);
void slotInlineEditDone(Q3ListViewItem *, const QString &, int column);
/**
* This starts the renaming process by displaying a line edit if the mouse is in
@ -741,7 +740,7 @@ QDataStream &operator>>(QDataStream &s, Playlist &p);
// template method implementations
template <class ItemType>
ItemType *Playlist::createItem(const FileHandle &file, QListView *after,
ItemType *Playlist::createItem(const FileHandle &file, Q3ListViewItem *after,
bool emitChanged)
{
CollectionListItem *item = collectionListItem(file);

View file

@ -17,6 +17,7 @@
#ifndef PLAYLISTITEM_H
#define PLAYLISTITEM_H
#include <k3listview.h>
#include <ksharedptr.h>
#include <kdebug.h>
@ -42,7 +43,7 @@ typedef QList<PlaylistItem *> PlaylistItemList;
* Playlist::clearItem().
*/
class PlaylistItem : public QListView
class PlaylistItem : public K3ListViewItem
{
friend class Playlist;
friend class SearchPlaylist;
@ -144,12 +145,12 @@ public:
/**
* Returns properly casted item below this one.
*/
PlaylistItem *itemBelow() { return static_cast<PlaylistItem *>(QListView::itemBelow()); }
PlaylistItem *itemBelow() { return static_cast<PlaylistItem *>(K3ListViewItem::itemBelow()); }
/**
* Returns properly casted item above this one.
*/
PlaylistItem *itemAbove() { return static_cast<PlaylistItem *>(QListView::itemAbove()); }
PlaylistItem *itemAbove() { return static_cast<PlaylistItem *>(K3ListViewItem::itemAbove()); }
/**
* Returns a reference to the list of the currnetly playing items, with the
@ -164,7 +165,7 @@ protected:
* subclass or friend class.
*/
PlaylistItem(CollectionListItem *item, Playlist *parent);
PlaylistItem(CollectionListItem *item, Playlist *parent, QListView *after);
PlaylistItem(CollectionListItem *item, Playlist *parent, Q3ListViewItem *after);
/**
* This is the constructor that shold be used by subclasses.
@ -177,10 +178,10 @@ protected:
*/
virtual ~PlaylistItem();
virtual void paintCell(QPainter *p, const QPalette &cg, int column, int width, int align);
virtual void paintFocus(QPainter *, const QPalette &, const QRect &) {}
virtual void paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int align);
virtual void paintFocus(QPainter *, const QColorGroup &, const QRect &) {}
virtual int compare(QListView *item, int column, bool ascending) const;
virtual int compare(Q3ListViewItem *item, int column, bool ascending) const;
int compare(const PlaylistItem *firstItem, const PlaylistItem *secondItem, int column, bool ascending) const;
bool isValid() const;
@ -208,7 +209,7 @@ private:
KSharedPtr<Data> d;
void setup(CollectionListItem *item);
using QListView::setup; // Avoid warning about hidden function.
using Q3ListViewItem::setup; // Avoid warning about hidden function.
CollectionListItem *m_collectionItem;
quint32 m_trackId;

4
kamera/AUTHORS Normal file
View file

@ -0,0 +1,4 @@
Copyright (C) 2001 The Kompany
2001-2003 Ilya Konstantinov <kde-devel@future.shiny.co.il>
2001-2007 Marcus Meissner <marcus@jet.franken.de>
2003 Nadeem Hasan <nhasan@nadmm.com>

41
kamera/CMakeLists.txt Normal file
View file

@ -0,0 +1,41 @@
project(kamera)
find_package(KDE4 REQUIRED)
include(CMakePushCheckState)
include(CheckSymbolExists)
include(KDE4Defaults)
include(MacroLibrary)
include(MacroOptionalAddSubdirectory)
find_package(Gphoto2)
macro_log_feature(GPHOTO2_FOUND "gphoto2" "Required to build kamera" "http://heanet.dl.sourceforge.net/sourceforge/gphoto" TRUE "" "")
cmake_push_check_state()
set(CMAKE_REQUIRED_INCLUDES "${GPHOTO2_INCLUDE_DIR}")
set(CMAKE_REQUIRED_LIBRARIES "${GPHOTO2_LIBRARIES}")
check_symbol_exists(gp_port_info_get_name "gphoto2.h" HAVE_GPHOTO2_5)
cmake_pop_check_state()
if(HAVE_GPHOTO2_5)
message(STATUS "Detected libgphoto2 2.5.0 or newer")
else()
message(STATUS "Detected libgphoto2 2.4 or older")
endif()
include(ConfigureChecks.cmake)
configure_file(config-kamera.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-kamera.h)
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
add_definitions (-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
include_directories (${CMAKE_CURRENT_BINARY_DIR} ${KDE4_INCLUDES} ${GPHOTO2_INCLUDE_DIRS})
add_subdirectory( kcontrol )
add_subdirectory( kioslave )
add_subdirectory( doc )
install(FILES
solid_camera.desktop
DESTINATION ${DATA_INSTALL_DIR}/solid/actions)
macro_display_feature_log()

339
kamera/COPYING Normal file
View file

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

397
kamera/COPYING.DOC Normal file
View file

@ -0,0 +1,397 @@
GNU Free Documentation License
Version 1.2, November 2002
Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
0. PREAMBLE
The purpose of this License is to make a manual, textbook, or other
functional and useful document "free" in the sense of freedom: to
assure everyone the effective freedom to copy and redistribute it,
with or without modifying it, either commercially or noncommercially.
Secondarily, this License preserves for the author and publisher a way
to get credit for their work, while not being considered responsible
for modifications made by others.
This License is a kind of "copyleft", which means that derivative
works of the document must themselves be free in the same sense. It
complements the GNU General Public License, which is a copyleft
license designed for free software.
We have designed this License in order to use it for manuals for free
software, because free software needs free documentation: a free
program should come with manuals providing the same freedoms that the
software does. But this License is not limited to software manuals;
it can be used for any textual work, regardless of subject matter or
whether it is published as a printed book. We recommend this License
principally for works whose purpose is instruction or reference.
1. APPLICABILITY AND DEFINITIONS
This License applies to any manual or other work, in any medium, that
contains a notice placed by the copyright holder saying it can be
distributed under the terms of this License. Such a notice grants a
world-wide, royalty-free license, unlimited in duration, to use that
work under the conditions stated herein. The "Document", below,
refers to any such manual or work. Any member of the public is a
licensee, and is addressed as "you". You accept the license if you
copy, modify or distribute the work in a way requiring permission
under copyright law.
A "Modified Version" of the Document means any work containing the
Document or a portion of it, either copied verbatim, or with
modifications and/or translated into another language.
A "Secondary Section" is a named appendix or a front-matter section of
the Document that deals exclusively with the relationship of the
publishers or authors of the Document to the Document's overall subject
(or to related matters) and contains nothing that could fall directly
within that overall subject. (Thus, if the Document is in part a
textbook of mathematics, a Secondary Section may not explain any
mathematics.) The relationship could be a matter of historical
connection with the subject or with related matters, or of legal,
commercial, philosophical, ethical or political position regarding
them.
The "Invariant Sections" are certain Secondary Sections whose titles
are designated, as being those of Invariant Sections, in the notice
that says that the Document is released under this License. If a
section does not fit the above definition of Secondary then it is not
allowed to be designated as Invariant. The Document may contain zero
Invariant Sections. If the Document does not identify any Invariant
Sections then there are none.
The "Cover Texts" are certain short passages of text that are listed,
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
the Document is released under this License. A Front-Cover Text may
be at most 5 words, and a Back-Cover Text may be at most 25 words.
A "Transparent" copy of the Document means a machine-readable copy,
represented in a format whose specification is available to the
general public, that is suitable for revising the document
straightforwardly with generic text editors or (for images composed of
pixels) generic paint programs or (for drawings) some widely available
drawing editor, and that is suitable for input to text formatters or
for automatic translation to a variety of formats suitable for input
to text formatters. A copy made in an otherwise Transparent file
format whose markup, or absence of markup, has been arranged to thwart
or discourage subsequent modification by readers is not Transparent.
An image format is not Transparent if used for any substantial amount
of text. A copy that is not "Transparent" is called "Opaque".
Examples of suitable formats for Transparent copies include plain
ASCII without markup, Texinfo input format, LaTeX input format, SGML
or XML using a publicly available DTD, and standard-conforming simple
HTML, PostScript or PDF designed for human modification. Examples of
transparent image formats include PNG, XCF and JPG. Opaque formats
include proprietary formats that can be read and edited only by
proprietary word processors, SGML or XML for which the DTD and/or
processing tools are not generally available, and the
machine-generated HTML, PostScript or PDF produced by some word
processors for output purposes only.
The "Title Page" means, for a printed book, the title page itself,
plus such following pages as are needed to hold, legibly, the material
this License requires to appear in the title page. For works in
formats which do not have any title page as such, "Title Page" means
the text near the most prominent appearance of the work's title,
preceding the beginning of the body of the text.
A section "Entitled XYZ" means a named subunit of the Document whose
title either is precisely XYZ or contains XYZ in parentheses following
text that translates XYZ in another language. (Here XYZ stands for a
specific section name mentioned below, such as "Acknowledgements",
"Dedications", "Endorsements", or "History".) To "Preserve the Title"
of such a section when you modify the Document means that it remains a
section "Entitled XYZ" according to this definition.
The Document may include Warranty Disclaimers next to the notice which
states that this License applies to the Document. These Warranty
Disclaimers are considered to be included by reference in this
License, but only as regards disclaiming warranties: any other
implication that these Warranty Disclaimers may have is void and has
no effect on the meaning of this License.
2. VERBATIM COPYING
You may copy and distribute the Document in any medium, either
commercially or noncommercially, provided that this License, the
copyright notices, and the license notice saying this License applies
to the Document are reproduced in all copies, and that you add no other
conditions whatsoever to those of this License. You may not use
technical measures to obstruct or control the reading or further
copying of the copies you make or distribute. However, you may accept
compensation in exchange for copies. If you distribute a large enough
number of copies you must also follow the conditions in section 3.
You may also lend copies, under the same conditions stated above, and
you may publicly display copies.
3. COPYING IN QUANTITY
If you publish printed copies (or copies in media that commonly have
printed covers) of the Document, numbering more than 100, and the
Document's license notice requires Cover Texts, you must enclose the
copies in covers that carry, clearly and legibly, all these Cover
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
the back cover. Both covers must also clearly and legibly identify
you as the publisher of these copies. The front cover must present
the full title with all words of the title equally prominent and
visible. You may add other material on the covers in addition.
Copying with changes limited to the covers, as long as they preserve
the title of the Document and satisfy these conditions, can be treated
as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit
legibly, you should put the first ones listed (as many as fit
reasonably) on the actual cover, and continue the rest onto adjacent
pages.
If you publish or distribute Opaque copies of the Document numbering
more than 100, you must either include a machine-readable Transparent
copy along with each Opaque copy, or state in or with each Opaque copy
a computer-network location from which the general network-using
public has access to download using public-standard network protocols
a complete Transparent copy of the Document, free of added material.
If you use the latter option, you must take reasonably prudent steps,
when you begin distribution of Opaque copies in quantity, to ensure
that this Transparent copy will remain thus accessible at the stated
location until at least one year after the last time you distribute an
Opaque copy (directly or through your agents or retailers) of that
edition to the public.
It is requested, but not required, that you contact the authors of the
Document well before redistributing any large number of copies, to give
them a chance to provide you with an updated version of the Document.
4. MODIFICATIONS
You may copy and distribute a Modified Version of the Document under
the conditions of sections 2 and 3 above, provided that you release
the Modified Version under precisely this License, with the Modified
Version filling the role of the Document, thus licensing distribution
and modification of the Modified Version to whoever possesses a copy
of it. In addition, you must do these things in the Modified Version:
A. Use in the Title Page (and on the covers, if any) a title distinct
from that of the Document, and from those of previous versions
(which should, if there were any, be listed in the History section
of the Document). You may use the same title as a previous version
if the original publisher of that version gives permission.
B. List on the Title Page, as authors, one or more persons or entities
responsible for authorship of the modifications in the Modified
Version, together with at least five of the principal authors of the
Document (all of its principal authors, if it has fewer than five),
unless they release you from this requirement.
C. State on the Title page the name of the publisher of the
Modified Version, as the publisher.
D. Preserve all the copyright notices of the Document.
E. Add an appropriate copyright notice for your modifications
adjacent to the other copyright notices.
F. Include, immediately after the copyright notices, a license notice
giving the public permission to use the Modified Version under the
terms of this License, in the form shown in the Addendum below.
G. Preserve in that license notice the full lists of Invariant Sections
and required Cover Texts given in the Document's license notice.
H. Include an unaltered copy of this License.
I. Preserve the section Entitled "History", Preserve its Title, and add
to it an item stating at least the title, year, new authors, and
publisher of the Modified Version as given on the Title Page. If
there is no section Entitled "History" in the Document, create one
stating the title, year, authors, and publisher of the Document as
given on its Title Page, then add an item describing the Modified
Version as stated in the previous sentence.
J. Preserve the network location, if any, given in the Document for
public access to a Transparent copy of the Document, and likewise
the network locations given in the Document for previous versions
it was based on. These may be placed in the "History" section.
You may omit a network location for a work that was published at
least four years before the Document itself, or if the original
publisher of the version it refers to gives permission.
K. For any section Entitled "Acknowledgements" or "Dedications",
Preserve the Title of the section, and preserve in the section all
the substance and tone of each of the contributor acknowledgements
and/or dedications given therein.
L. Preserve all the Invariant Sections of the Document,
unaltered in their text and in their titles. Section numbers
or the equivalent are not considered part of the section titles.
M. Delete any section Entitled "Endorsements". Such a section
may not be included in the Modified Version.
N. Do not retitle any existing section to be Entitled "Endorsements"
or to conflict in title with any Invariant Section.
O. Preserve any Warranty Disclaimers.
If the Modified Version includes new front-matter sections or
appendices that qualify as Secondary Sections and contain no material
copied from the Document, you may at your option designate some or all
of these sections as invariant. To do this, add their titles to the
list of Invariant Sections in the Modified Version's license notice.
These titles must be distinct from any other section titles.
You may add a section Entitled "Endorsements", provided it contains
nothing but endorsements of your Modified Version by various
parties--for example, statements of peer review or that the text has
been approved by an organization as the authoritative definition of a
standard.
You may add a passage of up to five words as a Front-Cover Text, and a
passage of up to 25 words as a Back-Cover Text, to the end of the list
of Cover Texts in the Modified Version. Only one passage of
Front-Cover Text and one of Back-Cover Text may be added by (or
through arrangements made by) any one entity. If the Document already
includes a cover text for the same cover, previously added by you or
by arrangement made by the same entity you are acting on behalf of,
you may not add another; but you may replace the old one, on explicit
permission from the previous publisher that added the old one.
The author(s) and publisher(s) of the Document do not by this License
give permission to use their names for publicity for or to assert or
imply endorsement of any Modified Version.
5. COMBINING DOCUMENTS
You may combine the Document with other documents released under this
License, under the terms defined in section 4 above for modified
versions, provided that you include in the combination all of the
Invariant Sections of all of the original documents, unmodified, and
list them all as Invariant Sections of your combined work in its
license notice, and that you preserve all their Warranty Disclaimers.
The combined work need only contain one copy of this License, and
multiple identical Invariant Sections may be replaced with a single
copy. If there are multiple Invariant Sections with the same name but
different contents, make the title of each such section unique by
adding at the end of it, in parentheses, the name of the original
author or publisher of that section if known, or else a unique number.
Make the same adjustment to the section titles in the list of
Invariant Sections in the license notice of the combined work.
In the combination, you must combine any sections Entitled "History"
in the various original documents, forming one section Entitled
"History"; likewise combine any sections Entitled "Acknowledgements",
and any sections Entitled "Dedications". You must delete all sections
Entitled "Endorsements".
6. COLLECTIONS OF DOCUMENTS
You may make a collection consisting of the Document and other documents
released under this License, and replace the individual copies of this
License in the various documents with a single copy that is included in
the collection, provided that you follow the rules of this License for
verbatim copying of each of the documents in all other respects.
You may extract a single document from such a collection, and distribute
it individually under this License, provided you insert a copy of this
License into the extracted document, and follow this License in all
other respects regarding verbatim copying of that document.
7. AGGREGATION WITH INDEPENDENT WORKS
A compilation of the Document or its derivatives with other separate
and independent documents or works, in or on a volume of a storage or
distribution medium, is called an "aggregate" if the copyright
resulting from the compilation is not used to limit the legal rights
of the compilation's users beyond what the individual works permit.
When the Document is included in an aggregate, this License does not
apply to the other works in the aggregate which are not themselves
derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these
copies of the Document, then if the Document is less than one half of
the entire aggregate, the Document's Cover Texts may be placed on
covers that bracket the Document within the aggregate, or the
electronic equivalent of covers if the Document is in electronic form.
Otherwise they must appear on printed covers that bracket the whole
aggregate.
8. TRANSLATION
Translation is considered a kind of modification, so you may
distribute translations of the Document under the terms of section 4.
Replacing Invariant Sections with translations requires special
permission from their copyright holders, but you may include
translations of some or all Invariant Sections in addition to the
original versions of these Invariant Sections. You may include a
translation of this License, and all the license notices in the
Document, and any Warranty Disclaimers, provided that you also include
the original English version of this License and the original versions
of those notices and disclaimers. In case of a disagreement between
the translation and the original version of this License or a notice
or disclaimer, the original version will prevail.
If a section in the Document is Entitled "Acknowledgements",
"Dedications", or "History", the requirement (section 4) to Preserve
its Title (section 1) will typically require changing the actual
title.
9. TERMINATION
You may not copy, modify, sublicense, or distribute the Document except
as expressly provided for under this License. Any other attempt to
copy, modify, sublicense or distribute the Document is void, and will
automatically terminate your rights under this License. However,
parties who have received copies, or rights, from you under this
License will not have their licenses terminated so long as such
parties remain in full compliance.
10. FUTURE REVISIONS OF THIS LICENSE
The Free Software Foundation may publish new, revised versions
of the GNU Free Documentation License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns. See
http://www.gnu.org/copyleft/.
Each version of the License is given a distinguishing version number.
If the Document specifies that a particular numbered version of this
License "or any later version" applies to it, you have the option of
following the terms and conditions either of that specified version or
of any later version that has been published (not as a draft) by the
Free Software Foundation. If the Document does not specify a version
number of this License, you may choose any version ever published (not
as a draft) by the Free Software Foundation.
ADDENDUM: How to use this License for your documents
To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and
license notices just after the title page:
Copyright (c) YEAR YOUR NAME.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
replace the "with...Texts." line with this:
with the Invariant Sections being LIST THEIR TITLES, with the
Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
If you have Invariant Sections without Cover Texts, or some other
combination of the three, merge those two alternatives to suit the
situation.
If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of
free software license, such as the GNU General Public License,
to permit their use in free software.

View file

@ -0,0 +1,49 @@
include(CheckCXXSourceCompiles)
set(VA_COPY_TEST_SOURCE
"
#include <stdarg.h>
#include <stdlib.h>
void f (int i, ...) {
va_list args1, args2;
va_start (args1, i);
va_copy (args2, args1);
if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
exit (1);
va_end (args1); va_end (args2);
}
int main() {
f (0, 42);
return 0;
}
")
set(__VA_COPY_TEST_SOURCE
"
#include <stdarg.h>
#include <stdlib.h>
void f (int i, ...) {
va_list args1, args2;
va_start (args1, i);
__va_copy (args2, args1);
if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
exit (1);
va_end (args1); va_end (args2);
}
int main() {
f (0, 42);
return 0;
}
")
check_cxx_source_compiles("${VA_COPY_TEST_SOURCE}" HAVE_VA_COPY)
if(HAVE_VA_COPY)
set(VA_COPY va_copy CACHE STRING "va_copy function")
else(HAVE_VA_COPY)
check_cxx_source_compiles("${__VA_COPY_TEST_SOURCE}" HAVE___VA_COPY)
if(HAVE___VA_COPY)
set(VA_COPY __va_copy CACHE STRING "__va_copy function")
else(HAVE___VA_COPY)
message(FATAL_ERROR "Either va_copy or __va_copy must be present. Please check your libc.")
endif(HAVE___VA_COPY)
endif(HAVE_VA_COPY)

7
kamera/README Normal file
View file

@ -0,0 +1,7 @@
Dependencies:
libgphoto2 which you currently need to get from gphoto's CVS using
cvs -d:pserver:anonymous@cvs.gphoto.sourceforge.net:/cvsroot/gphoto login
cvs -d:pserver:anonymous@cvs.gphoto.sourceforge.net:/cvsroot/gphoto co libgphoto2
You need libgphoto 2.0 final (or later).

View file

@ -0,0 +1,8 @@
/* Define if we have va_copy */
#cmakedefine HAVE_VA_COPY 1
/* Define if we have __va_copy */
#cmakedefine HAVE___VA_COPY 1
/* Define if we have gp_port_info_get_name (trigger for 2.5) */
#cmakedefine HAVE_GPHOTO2_5 1

View file

@ -0,0 +1 @@
kde4_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR kcontrol/kamera)

101
kamera/doc/index.docbook Normal file
View file

@ -0,0 +1,101 @@
<?xml version="1.0" ?>
<!DOCTYPE article PUBLIC "-//KDE//DTD DocBook XML V4.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [
<!ENTITY % addindex "IGNORE">
<!ENTITY % English "INCLUDE">
]>
<article id="kamera" lang="&language;">
<title>Digital Camera</title>
<articleinfo>
<authorgroup>
<author>
<firstname>Burkhard</firstname>
<surname>Lück</surname>
<affiliation>
<address><email>lueck@hube-lueck.de</email></address>
</affiliation>
</author>
<!-- TRANS:ROLES_OF_TRANSLATORS -->
</authorgroup>
<date>2013-12-05</date>
<releaseinfo>&kde; 4.12</releaseinfo>
<keywordset>
<keyword>KDE</keyword>
<keyword>camera</keyword>
<keyword>photo</keyword>
</keywordset>
</articleinfo>
<para>
This module allows you to configure support for your digital camera.
</para>
<variablelist>
<varlistentry><term><guibutton>Add</guibutton></term>
<listitem>
<para>
Click this button to select the camera's model and the port it is connected
to on your computer (&eg; USB, Serial). If your camera does not
appear in the list of <guilabel>Supported Cameras</guilabel>, go to the
<ulink url="http://www.gphoto.org">GPhoto web site</ulink> for a possible update.
</para>
</listitem>
</varlistentry>
<varlistentry><term><guibutton>Test</guibutton></term>
<listitem>
<para>Click this button to test the connection to the selected camera.</para>
</listitem>
</varlistentry>
<varlistentry><term><guibutton>Remove</guibutton></term>
<listitem>
<para>Removes the selected camera from the list.
</para>
</listitem>
</varlistentry>
<varlistentry><term><guibutton>Configure</guibutton></term>
<listitem>
<para>Click this button to change the configuration of the selected camera.
The availability of this feature and the contents of the Configuration dialog
depend on the camera model.</para>
</listitem>
</varlistentry>
<varlistentry><term><guibutton>Information</guibutton></term>
<listitem>
<para>Click this button to view a summary of the current status of the selected
camera. The availability of this feature and the contents of the Information
dialog depend on the camera model.</para>
</listitem>
</varlistentry>
<varlistentry><term><guibutton>Cancel</guibutton></term>
<listitem>
<para>Click this button to cancel the current camera operation.</para>
</listitem>
</varlistentry>
</variablelist>
<para>To view and download images from the digital camera, enter
<userinput>camera:/</userinput> in &konqueror;&apos;s location bar.
</para>
</article>
<!--
Local Variables:
mode: sgml
sgml-minimize-attributes:nil
sgml-general-insert-case:lower
sgml-indent-step:0
sgml-indent-data:nil
End:
// vim:ts=2:sw=2:tw=78:noet
-->

View file

@ -0,0 +1,18 @@
########### next target ###############
set(kcm_kamera_PART_SRCS kamera.cpp kameradevice.cpp kameraconfigdialog.cpp )
kde4_add_plugin(kcm_kamera ${kcm_kamera_PART_SRCS})
target_link_libraries(kcm_kamera ${KDE4_KDEUI_LIBS} ${QT_QT3SUPPORT_LIBRARY} ${GPHOTO2_LIBRARIES})
install(TARGETS kcm_kamera DESTINATION ${PLUGIN_INSTALL_DIR} )
########### install files ###############
install( FILES kamera.desktop DESTINATION ${SERVICES_INSTALL_DIR} )

View file

@ -0,0 +1,2 @@
#! /bin/sh
$XGETTEXT *.cpp -o $podir/kcmkamera.pot

448
kamera/kcontrol/kamera.cpp Normal file
View file

@ -0,0 +1,448 @@
/*
Copyright (C) 2001 The Kompany
2002-2003 Ilya Konstantinov <kde-devel@future.shiny.co.il>
2002-2003 Marcus Meissner <marcus@jet.franken.de>
2003 Nadeem Hasan <nhasan@nadmm.com>
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.
*/
#include "kamera.h"
#include <QtGui/QLabel>
#include <QtGui/QListView>
#include <QtGui/QVBoxLayout>
#include <QApplication>
#include <QStandardItemModel>
#include <KGenericFactory>
#include <KConfig>
#include <KAction>
#include <KIcon>
#include <KMessageBox>
#include <KDialog>
#include <KLocale>
#include <KToolBar>
#include <KMenu>
#include <KProtocolInfo>
#include <KDebug>
#include <KActionCollection>
#include "kameraconfigdialog.h"
#include "kameradevice.h"
K_PLUGIN_FACTORY(KKameraConfigFactory, registerPlugin<KKameraConfig>();)
K_EXPORT_PLUGIN(KKameraConfigFactory("kcmkamera"))
// --------------- Camera control center module widget ---
KKameraConfig::KKameraConfig(QWidget *parent, const QVariantList &)
: KCModule(KKameraConfigFactory::componentData(), parent/*, name*/)
{
m_devicePopup = new KMenu(this);
m_actions = new KActionCollection(this);
m_config = new KConfig(KProtocolInfo::config("camera"), KConfig::SimpleConfig);
m_context = gp_context_new();
if (m_context) {
// Register the callback functions
gp_context_set_cancel_func(m_context, cbGPCancel, this);
gp_context_set_idle_func(m_context, cbGPIdle, this);
displayGPSuccessDialogue();
} else {
displayGPFailureDialogue();
}
}
KKameraConfig::~KKameraConfig()
{
delete m_config;
}
void KKameraConfig::defaults()
{
}
void KKameraConfig::displayGPFailureDialogue(void)
{
QVBoxLayout *topLayout = new QVBoxLayout(this);
topLayout->setSpacing(0);
topLayout->setMargin(0);
QLabel *label = new QLabel(i18n("Unable to initialize the gPhoto2 libraries."), this);
topLayout->addWidget(label);
}
void KKameraConfig::displayGPSuccessDialogue(void)
{
// set the kcontrol module buttons
setButtons(Help | Apply );
// create a layout with two vertical boxes
QVBoxLayout *topLayout = new QVBoxLayout(this);
topLayout->setSpacing(0);
topLayout->setMargin(0);
m_toolbar = new KToolBar(this, "ToolBar");
topLayout->addWidget(m_toolbar);
m_toolbar->setMovable(false);
// create list of devices
m_deviceSel = new QListView(this);
topLayout->addWidget(m_deviceSel);
m_deviceModel = new QStandardItemModel(this);
m_deviceSel->setModel(m_deviceModel);
connect(m_deviceSel, SIGNAL(customContextMenuRequested(const QPoint &)),
SLOT(slot_deviceMenu(const QPoint &)));
connect(m_deviceSel, SIGNAL(doubleClicked(const QModelIndex &)),
SLOT(slot_configureCamera()));
connect(m_deviceSel, SIGNAL(activated(const QModelIndex &)),
SLOT(slot_deviceSelected(const QModelIndex &)));
m_deviceSel->setViewMode(QListView::IconMode);
m_deviceSel->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
m_deviceSel->setContextMenuPolicy(Qt::CustomContextMenu);
// create actions
QAction *act;
act = m_actions->addAction("camera_add");
act->setIcon(KIcon("camera-photo"));
act->setText(i18n("Add"));
connect(act, SIGNAL(triggered(bool)), this, SLOT(slot_addCamera()));
act->setWhatsThis(i18n("Click this button to add a new camera."));
m_toolbar->addAction(act);
m_toolbar->addSeparator();
act = m_actions->addAction("camera_test");
act->setIcon(KIcon("dialog-ok"));
act->setText(i18n("Test"));
connect(act, SIGNAL(triggered(bool)), this, SLOT(slot_testCamera()));
act->setWhatsThis(i18n("Click this button to test the connection to the selected camera."));
m_toolbar->addAction(act);
act = m_actions->addAction("camera_remove");
act->setIcon(KIcon("user-trash"));
act->setText(i18n("Remove"));
connect(act, SIGNAL(triggered(bool)), this, SLOT(slot_removeCamera()));
act->setWhatsThis(i18n("Click this button to remove the selected camera from the list."));
m_toolbar->addAction(act);
act = m_actions->addAction("camera_configure");
act->setIcon(KIcon("configure"));
act->setText(i18n("Configure..."));
connect(act, SIGNAL(triggered(bool)), this, SLOT(slot_configureCamera()));
act->setWhatsThis(i18n("Click this button to change the configuration of the selected camera.<br><br>The availability of this feature and the contents of the Configuration dialog depend on the camera model."));
m_toolbar->addAction(act);
act = m_actions->addAction("camera_summary");
act->setIcon(KIcon("hwinfo"));
act->setText(i18n("Information"));
connect(act, SIGNAL(triggered(bool)), this, SLOT(slot_cameraSummary()));
act->setWhatsThis(i18n("Click this button to view a summary of the current status of the selected camera.<br><br>The availability of this feature and the contents of the Information dialog depend on the camera model."));
m_toolbar->addAction(act);
m_toolbar->addSeparator();
act = m_actions->addAction("camera_cancel");
act->setIcon(KIcon("process-stop"));
act->setText(i18n("Cancel"));
connect(act, SIGNAL(triggered(bool)), this, SLOT(slot_cancelOperation()));
act->setWhatsThis(i18n("Click this button to cancel the current camera operation."));
act->setEnabled(false);
m_toolbar->addAction(act);
load();
}
void KKameraConfig::populateDeviceListView(void)
{
m_deviceModel->clear();
CameraDevicesMap::ConstIterator it;
for (it = m_devices.constBegin(); it != m_devices.constEnd(); ++it) {
if (it.value()) {
QStandardItem *deviceItem = new QStandardItem;
deviceItem->setEditable(false);
deviceItem->setText(it.key());
deviceItem->setIcon(KIcon("camera-photo"));
m_deviceModel->appendRow(deviceItem);
}
}
slot_deviceSelected(m_deviceSel->currentIndex());
}
void KKameraConfig::save(void)
{
CameraDevicesMap::Iterator it;
for (it = m_devices.begin(); it != m_devices.end(); it++)
{
it.value()->save(m_config);
}
m_config->sync();
}
void KKameraConfig::load(void)
{
QStringList groupList = m_config->groupList();
QStringList::Iterator it;
int i, count;
CameraList *list;
CameraAbilitiesList *al;
GPPortInfoList *il;
const char *model, *value;
KCamera *kcamera;
for (it = groupList.begin(); it != groupList.end(); it++) {
if (*it != "<default>") {
KConfigGroup cg(m_config, *it);
if (cg.readEntry("Path").contains("usb:"))
continue;
kcamera = new KCamera(*it, cg.readEntry("Path"));
connect(kcamera, SIGNAL(error(const QString &)), SLOT(slot_error(const QString &)));
connect(kcamera, SIGNAL(error(const QString &, const QString &)), SLOT(slot_error(const QString &, const QString &)));
kcamera->load(m_config);
m_devices[*it] = kcamera;
}
}
m_cancelPending = false;
gp_list_new (&list);
gp_abilities_list_new (&al);
gp_abilities_list_load (al, m_context);
gp_port_info_list_new (&il);
gp_port_info_list_load (il);
gp_abilities_list_detect (al, il, list, m_context);
gp_abilities_list_free (al);
gp_port_info_list_free (il);
count = gp_list_count (list);
QMap<QString,QString> ports, names;
for (i = 0 ; i<count ; i++) {
gp_list_get_name (list, i, &model);
gp_list_get_value (list, i, &value);
ports[value] = model;
if (!strcmp(value,"usb:"))
names[model] = value;
}
if (ports.contains("usb:") && names[ports["usb:"]]!="usb:")
ports.remove("usb:");
QMap<QString,QString>::iterator portit;
for (portit = ports.begin() ; portit != ports.end(); portit++) {
/* kDebug() << "Adding USB camera: " << portit.data() << " at " << portit.key(); */
kcamera = new KCamera(portit.value(), portit.key());
connect(kcamera, SIGNAL(error(const QString &)), SLOT(slot_error(const QString &)));
connect(kcamera, SIGNAL(error(const QString &, const QString &)), SLOT(slot_error(const QString &, const QString &)));
m_devices[portit.value()] = kcamera;
}
populateDeviceListView();
gp_list_free (list);
}
void KKameraConfig::beforeCameraOperation(void)
{
m_cancelPending = false;
m_actions->action("camera_test")->setEnabled(false);
m_actions->action("camera_remove")->setEnabled(false);
m_actions->action("camera_configure")->setEnabled(false);
m_actions->action("camera_summary")->setEnabled(false);
m_actions->action("camera_cancel")->setEnabled(true);
}
void KKameraConfig::afterCameraOperation(void)
{
m_actions->action("camera_cancel")->setEnabled(false);
// if we're regaining control after a Cancel...
if (m_cancelPending) {
qApp->restoreOverrideCursor();
m_cancelPending = false;
}
// if any item was selected before the operation was run
// it makes sense for the relevant toolbar buttons to be enabled
slot_deviceSelected(m_deviceSel->currentIndex());
}
QString KKameraConfig::suggestName(const QString &name)
{
QString new_name = name;
new_name.remove('/'); // we cannot have a slash in a URI's host
if (!m_devices.contains(new_name)) return new_name;
// try new names with a number appended until we find a free one
int i = 1;
while (i++ < 0xffff) {
new_name = name + " (" + QString::number(i) + ')';
if (!m_devices.contains(new_name)) return new_name;
}
return QString();
}
void KKameraConfig::slot_addCamera()
{
KCamera *m_device = new KCamera(QString::null, QString()); //krazy:exclusion=nullstrassign for old broken gcc
connect(m_device, SIGNAL(error(const QString &)), SLOT(slot_error(const QString &)));
connect(m_device, SIGNAL(error(const QString &, const QString &)), SLOT(slot_error(const QString &, const QString &)));
KameraDeviceSelectDialog dialog(this, m_device);
if (dialog.exec() == QDialog::Accepted) {
dialog.save();
m_device->setName(suggestName(m_device->model()));
m_devices.insert(m_device->name(), m_device);
populateDeviceListView();
emit changed(true);
} else {
delete m_device;
}
}
void KKameraConfig::slot_removeCamera()
{
const QString name = m_deviceSel->currentIndex().data(Qt::DisplayRole).toString();
if (m_devices.contains(name)) {
KCamera *m_device = m_devices.value(name);
m_devices.remove(name);
delete m_device;
m_config->deleteGroup(name);
populateDeviceListView();
emit changed(true);
}
}
void KKameraConfig::slot_testCamera()
{
beforeCameraOperation();
const QString name = m_deviceSel->currentIndex().data(Qt::DisplayRole).toString();
if (m_devices.contains(name)) {
KCamera *m_device = m_devices.value(name);
if (m_device->test())
KMessageBox::information(this, i18n("Camera test was successful."));
}
afterCameraOperation();
}
void KKameraConfig::slot_configureCamera()
{
const QString name = m_deviceSel->currentIndex().data(Qt::DisplayRole).toString();
if (m_devices.contains(name)) {
KCamera *m_device = m_devices[name];
m_device->configure();
}
}
void KKameraConfig::slot_cameraSummary()
{
const QString name = m_deviceSel->currentIndex().data(Qt::DisplayRole).toString();
if (m_devices.contains(name)) {
KCamera *m_device = m_devices[name];
QString summary = m_device->summary();
if (!summary.isNull()) {
KMessageBox::information(this, summary);
}
}
}
void KKameraConfig::slot_cancelOperation()
{
m_cancelPending = true;
// Prevent the user from keeping clicking Cancel
m_actions->action("camera_cancel")->setEnabled(false);
// and indicate that the click on Cancel did have some effect
qApp->setOverrideCursor(Qt::WaitCursor);
}
void KKameraConfig::slot_deviceMenu(const QPoint &point)
{
QModelIndex index = m_deviceSel->indexAt(point);
if (index.isValid()) {
m_devicePopup->clear();
m_devicePopup->addAction(m_actions->action("camera_test"));
m_devicePopup->addAction(m_actions->action("camera_remove"));
m_devicePopup->addAction(m_actions->action("camera_configure"));
m_devicePopup->addAction(m_actions->action("camera_summary"));
m_devicePopup->exec(m_deviceSel->viewport()->mapToGlobal(point));
}
}
void KKameraConfig::slot_deviceSelected(const QModelIndex &index)
{
bool isValid = index.isValid();
m_actions->action("camera_test")->setEnabled(isValid);
m_actions->action("camera_remove")->setEnabled(isValid);
m_actions->action("camera_configure")->setEnabled(isValid);
m_actions->action("camera_summary")->setEnabled(isValid);
}
void KKameraConfig::cbGPIdle(GPContext * /*context*/, void * /*data*/)
{
/*KKameraConfig *self( reinterpret_cast<KKameraConfig*>(data) );*/
qApp->processEvents();
}
GPContextFeedback KKameraConfig::cbGPCancel(GPContext * /*context*/, void *data)
{
KKameraConfig *self( reinterpret_cast<KKameraConfig*>(data) );
// Since in practice no camera driver supports idle callbacks yet,
// we'll use the cancel callback as opportunity to process events
qApp->processEvents();
// If a cancel request is pending, ask gphoto to cancel
if (self->m_cancelPending)
return GP_CONTEXT_FEEDBACK_CANCEL;
else
return GP_CONTEXT_FEEDBACK_OK;
}
QString KKameraConfig::quickHelp() const
{
return i18n("<h1>Digital Camera</h1>\n"
"This module allows you to configure support for your digital camera.\n"
"You need to select the camera's model and the port it is connected\n"
"to on your computer (e.g. USB, Serial, Firewire). If your camera does not\n"
"appear on the list of <i>Supported Cameras</i>, go to the\n"
"<a href=\"http://www.gphoto.org\">GPhoto web site</a> for a possible update.<br><br>\n"
"To view and download images from the digital camera, go to the address\n"
"<a href=\"camera:/\">camera:/</a> in Konqueror and other KDE applications.");
}
void KKameraConfig::slot_error(const QString &message)
{
KMessageBox::error(this, message);
}
void KKameraConfig::slot_error(const QString &message, const QString &details)
{
KMessageBox::detailedError(this, message, details);
}
#include "kamera.moc"

View file

@ -0,0 +1,214 @@
[Desktop Entry]
Comment=Configure Kamera
Comment[af]=Konfigureer Kamera
Comment[ar]=إعداد Kamera
Comment[ast]=Configurar Kamera
Comment[bg]=Настройки на фотоапарат
Comment[br]=Kefluniañ Kamera
Comment[bs]=Podešavanje Kamere
Comment[ca]=Configura el Kamera
Comment[ca@valencia]=Configura el Kamera
Comment[cs]=Nastavení fotoaparátu
Comment[cy]=Ffurfweddu Kamera
Comment[da]=Indstil kamera
Comment[de]=Kamera einrichten
Comment[el]=Διαμόρφωση Kamera
Comment[en_GB]=Configure Kamera
Comment[eo]=Agordi Kamera
Comment[es]=Configurar Kamera
Comment[et]=Kaamera seadistamine
Comment[eu]=Konfiguratu kamera
Comment[fa]=پیکربندی Kamera
Comment[fi]=Kameran asetukset
Comment[fr]=Configuration de Kamera
Comment[ga]=Cumraigh Kamera
Comment[gl]=Configurar Kamera
Comment[he]=שינוי הגדרות Kamera
Comment[hi]= ि
Comment[hne]= ि
Comment[hr]=Podešavanje kamere
Comment[hu]=A fényképezőgépek beállításai
Comment[ia]=Configura Kamera
Comment[is]=Stilla samskiptaforrit stafrænna myndavéla (Kamera)
Comment[it]=Configura Kamera
Comment[ja]=
Comment[kk]=Kamera баптауы
Comment[km]= Kamera
Comment[ko]=Kamera
Comment[ku]=Kamera Veava Bike
Comment[lt]=Konfigūruoti fotoaparatą
Comment[lv]=Konfigurēt fotoaparātu
Comment[mk]=Конфигурирајте ја Kamera
Comment[mr]=
Comment[ms]=Konfigurasi Kamera
Comment[nb]=Sett opp Kamera
Comment[nds]=Kamera instellen
Comment[ne]= ि
Comment[nl]=Camera instellen
Comment[nn]=Set opp Kamera
Comment[pa]=
Comment[pl]=Ustawienia aparatu cyfrowego
Comment[pt]=Configurar o Kamera
Comment[pt_BR]=Configura o Kamera
Comment[ro]=Configurează aparatul foto digital
Comment[ru]=Настройка камеры
Comment[se]=Heivet govvenapperáhta
Comment[si]=Kamera
Comment[sk]=Nastavenie fotoaparátu
Comment[sl]=Nastavi Kamero
Comment[sr]=Подешавање Камере
Comment[sr@ijekavian]=Подешавање Камере
Comment[sr@ijekavianlatin]=Podešavanje Kamere
Comment[sr@latin]=Podešavanje Kamere
Comment[sv]=Anpassa kamera
Comment[ta]=ி
Comment[tg]=Танзимоти камера
Comment[th]= '-K'
Comment[tr]=Kamerayı Yapılandır
Comment[ug]=كامېرانى سەپلەش
Comment[uk]=Налаштування Kamera
Comment[uz]=Fotoaparatni moslash
Comment[uz@cyrillic]=Фотоапаратни мослаш
Comment[vi]=Cu hình Kamera
Comment[xh]=Qwalasela Umfoti
Comment[x-test]=xxConfigure Kameraxx
Comment[zh_CN]= Kamera
Comment[zh_HK]= Kamera
Comment[zh_TW]=
X-KDE-Keywords=gphoto,camera,digicam,webcam,kamera
X-KDE-Keywords[ar]=كاميرا,ويبكام,gphoto,camera,digicam,webcam,kamera
X-KDE-Keywords[bg]=фото, фотоапарат,камера,уебкамера,цифров,gphoto,camera,digicam,webcam,kamera
X-KDE-Keywords[bs]=gphoto,camera,digicam,webcam,kamera
X-KDE-Keywords[ca]=gphoto,càmera,digicam,webcam,kamera
X-KDE-Keywords[ca@valencia]=gphoto,càmera,digicam,webcam,kamera
X-KDE-Keywords[cs]=gphoto,fotoaparát,digikam,webkamera,kamera
X-KDE-Keywords[da]=gphoto,kamera,digicam,webcam,digitalkamera
X-KDE-Keywords[de]=gphoto,Kamera,Digicam,Webcam,Digitalkamera
X-KDE-Keywords[el]=gphoto,camera,digicam,webcam,kamera
X-KDE-Keywords[en_GB]=gphoto,camera,digicam,webcam,kamera
X-KDE-Keywords[es]=gphoto,cámara,digicam,webcam,kamera
X-KDE-Keywords[et]=gphoto,kaamera,digitaalkaamera,veebikaamera,kamera
X-KDE-Keywords[fi]=gphoto,kamera,digikamera,webkamera
X-KDE-Keywords[fr]=GPhoto, appareil photo, appareil numérique, webcam, Kamera
X-KDE-Keywords[ga]=gphoto,ceamara,digicam,ceamara Gréasáin,kamera
X-KDE-Keywords[gl]=gphoto,cámara,digicam,cámara dixital,cámara web,kamera
X-KDE-Keywords[hu]=gphoto,fényképezőgép,digitális fényképezőgép,webkamera,kamera
X-KDE-Keywords[ia]=gphoto,camera,digicam,webcam,kamera
X-KDE-Keywords[is]=gphoto,myndavél,digikam,vefmynd,kamera
X-KDE-Keywords[it]=gphoto,camera,digikam,webcam,kamera
X-KDE-Keywords[kk]=gphoto,camera,digicam,webcam,kamera
X-KDE-Keywords[km]=gphoto,camera,digicam,webcam,kamera
X-KDE-Keywords[ko]=gphoto,camera,digicam,webcam,kamera,, ,
X-KDE-Keywords[lt]=gphoto,camera,digicam,webcam,kamera
X-KDE-Keywords[lv]=gphoto, fotoaparāts,digitālais fotoaparāts,tīmekļa kamera
X-KDE-Keywords[mr]=, , िि, ,
X-KDE-Keywords[nb]=gphoto,camera,digicam,webcam,kamera
X-KDE-Keywords[nds]=gphoto,camera,digicam,webcam,nettkamera,kamera
X-KDE-Keywords[nl]=gphoto,camera,digicam,webcam,kamera
X-KDE-Keywords[pa]=gphoto,camera,digicam,webcam,kamera,,,
X-KDE-Keywords[pl]=gphoto,kamera,digicam,internetowa,camera
X-KDE-Keywords[pt]=gphoto,câmara,máquina,webcam,kamera
X-KDE-Keywords[pt_BR]=gphoto,câmera,digikam,webcam,kamera
X-KDE-Keywords[ro]=gphoto,aparat,foto,digicam,webcam,camera,kamera
X-KDE-Keywords[ru]=gphoto,camera,digicam,webcam,kamera,камера,фото
X-KDE-Keywords[sk]=gphoto,camera,digicam,webcam,kamera
X-KDE-Keywords[sl]=gphoto,camera,digicam,webcam,kamera
X-KDE-Keywords[sr]=gphoto,camera,digicam,webcam,kamera,Гфото,апарат,фотоапарат,Дигикам,веб камера,камера
X-KDE-Keywords[sr@ijekavian]=gphoto,camera,digicam,webcam,kamera,Гфото,апарат,фотоапарат,Дигикам,веб камера,камера
X-KDE-Keywords[sr@ijekavianlatin]=gphoto,camera,digicam,webcam,kamera,GPhoto,aparat,fotoaparat,Digikam,veb kamera,kamera
X-KDE-Keywords[sr@latin]=gphoto,camera,digicam,webcam,kamera,GPhoto,aparat,fotoaparat,Digikam,veb kamera,kamera
X-KDE-Keywords[sv]=gphoto,kamera,digicam,webbkamera,kamera
X-KDE-Keywords[tr]=gphoto,kamera,dijital fotoğraf makinesi,web kamerası,kamera,fotoğraf makinesi
X-KDE-Keywords[uk]=gphoto,camera,digicam,webcam,kamera,фотоапарат,камера
X-KDE-Keywords[x-test]=xxgphoto,camera,digicam,webcam,kameraxx
X-KDE-Keywords[zh_CN]=gphoto,camera,digicam,webcam,kamera,,,,,,
X-KDE-Keywords[zh_TW]=gphoto,camera,digicam,webcam,kamera
Name=Digital Camera
Name[af]=Digitaal Kamera
Name[ar]=كاميرا رقمية
Name[ast]=Cámara dixital
Name[be]=Камера
Name[bg]=Цифров фотоапарат
Name[br]=Kamera niverel
Name[bs]=Digitalna kamera
Name[ca]=Càmera digital
Name[ca@valencia]=Càmera digital
Name[cs]=Digitální fotoaparát
Name[cy]=Camera Digidol
Name[da]=Digitalt kamera
Name[de]=Digitalkamera
Name[el]=Ψηφιακή κάμερα
Name[en_GB]=Digital Camera
Name[eo]=Cifereca fotilo
Name[es]=Cámara digital
Name[et]=Digikaamera
Name[eu]=Kamera digitala
Name[fa]=دوربین رقمی
Name[fi]=Digitaalikamera
Name[fr]=Appareil photo numérique
Name[ga]=Ceamara Digiteach
Name[gl]=Cámara dixital
Name[he]=מצלמה דיגיטלית
Name[hi]=िि
Name[hne]=िि
Name[hr]=Digitalna kamera
Name[hu]=Fényképezőgép
Name[ia]=Camera digital
Name[is]=Stafræn myndavél
Name[it]=Macchina fotografica digitale
Name[ja]=
Name[kk]=Цифрлық камера
Name[km]=
Name[ko]=
Name[ku]=Kameraya Dîjîtal
Name[lt]=Skaitmeninis fotoaparatas
Name[lv]=Digitālais fotoaparāts
Name[mk]=Дигитална камера
Name[mr]=िि
Name[ms]=Kamera Digital
Name[nb]=Digitalkamera
Name[nds]=Digitaalkamera
Name[ne]=िि
Name[nl]=Digitale camera
Name[nn]=Digitalkamera
Name[pa]=ਿ
Name[pl]=Aparat cyfrowy
Name[pt]=Máquina Fotográfica Digital
Name[pt_BR]=Câmera digital
Name[ro]=Aparat foto digital
Name[ru]=Цифровая камера
Name[se]=Digitalalaš govvenapperáhtta
Name[si]=
Name[sk]=Digitálny fotoaparát
Name[sl]=Digitalni fotoaparat
Name[sr]=Дигитални фотоапарат
Name[sr@ijekavian]=Дигитални фотоапарат
Name[sr@ijekavianlatin]=Digitalni fotoaparat
Name[sr@latin]=Digitalni fotoaparat
Name[sv]=Digitalkamera
Name[ta]= Digital Camera
Name[tg]=Камераи digital
Name[th]=
Name[tr]=Dijital Kamera
Name[ug]=رەقەملىك كامېرا
Name[uk]=Цифровий фотоапарат
Name[uz]=Fotoaparat
Name[uz@cyrillic]=Фотоапарат
Name[vi]=Máy nh s
Name[xh]=Ikhamera Yesuntswana
Name[x-test]=xxDigital Cameraxx
Name[zh_CN]=
Name[zh_HK]=
Name[zh_TW]=
Terminal=false
Type=Service
X-KDE-ServiceTypes=KCModule
X-KDE-Library=kcm_kamera
X-KDE-ParentApp=kcontrol
X-KDE-System-Settings-Parent-Category=hardware
X-KDE-ModuleType=Library
Icon=camera-photo
Exec=kcmshell4 kamera
X-DocPath=kcontrol/kamera/index.html
Categories=Qt;KDE;X-KDE-settings-hardware;

109
kamera/kcontrol/kamera.h Normal file
View file

@ -0,0 +1,109 @@
/*
Copyright (C) 2001 The Kompany
2002-2003 Ilya Konstantinov <kde-devel@future.shiny.co.il>
2002-2003 Marcus Meissner <marcus@jet.franken.de>
2003 Nadeem Hasan <nhasan@nadmm.com>
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 __kamera_h__
#define __kamera_h__
#include <kcmodule.h>
#include <gphoto2.h>
#include <KPluginFactory>
class QWidget;
class QPushButton;
class QListView;
class QStandardItemModel;
class QModelIndex;
class KCamera;
class KameraDeviceSelectDialog;
class KConfig;
class KActionCollection;
class KToolBar;
class KMenu;
class KKameraConfig : public KCModule
{
Q_OBJECT
friend class KameraDeviceSelectDialog;
public:
KKameraConfig(QWidget *parent, const QVariantList &);
virtual ~KKameraConfig();
// KCModule interface methods
void load();
void save();
void defaults();
int buttons();
QString quickHelp() const;
protected:
QString suggestName(const QString &name);
protected slots:
void slot_deviceMenu(const QPoint &point);
void slot_deviceSelected(const QModelIndex &index);
void slot_addCamera();
void slot_removeCamera();
void slot_configureCamera();
void slot_cameraSummary();
void slot_testCamera();
void slot_cancelOperation();
void slot_error(const QString &message);
void slot_error(const QString &message, const QString &details);
private:
void displayGPFailureDialogue(void);
void displayGPSuccessDialogue(void);
void displayCameraAbilities(const CameraAbilities &abilities);
void populateDeviceListView(void);
void beforeCameraOperation(void);
void afterCameraOperation(void);
// gphoto callbacks
static void cbGPIdle(GPContext *context, void *data);
static GPContextFeedback cbGPCancel(GPContext *context, void *data);
private:
typedef QMap<QString, KCamera *> CameraDevicesMap;
KConfig *m_config;
CameraDevicesMap m_devices;
bool m_cancelPending;
// gphoto members
GPContext *m_context;
// widgets for the cameras listview
QListView *m_deviceSel;
QStandardItemModel *m_deviceModel;
KActionCollection *m_actions;
QPushButton *m_addCamera, *m_removeCamera, *m_testCamera, *m_configureCamera;
KToolBar *m_toolbar;
KMenu *m_devicePopup;
// true if libgphoto2 was initialised successfully in
// the constructor
bool m_gpInitialised;
};
#endif

View file

@ -0,0 +1,333 @@
/*
Copyright (C) 2001 The Kompany
2002-2003 Ilya Konstantinov <kde-devel@future.shiny.co.il>
2002-2003 Marcus Meissner <marcus@jet.franken.de>
2003 Nadeem Hasan <nhasan@nadmm.com>
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.
*/
#include <qlayout.h>
#include <qlabel.h>
#include <Q3GroupBox>
#include <qcheckbox.h>
#include <qradiobutton.h>
#include <qlineedit.h>
#include <qcombobox.h>
#include <qslider.h>
#include <Q3ButtonGroup>
#include <kvbox.h>
#include <qtabwidget.h>
//Added by qt3to4:
#include <QFrame>
#include <QVBoxLayout>
#include <klocale.h>
#include "kameraconfigdialog.h"
#include "kameraconfigdialog.moc"
KameraConfigDialog::KameraConfigDialog(Camera */*camera*/,
CameraWidget *widget,
QWidget *parent) :
KDialog(parent),
m_widgetRoot(widget)
{
setButtons( Ok|Cancel );
setDefaultButton( Ok );
setModal( true );
QFrame *main = new QFrame( this );
setMainWidget( main );
QVBoxLayout *topLayout = new QVBoxLayout(main);
topLayout->setMargin(0);
m_tabWidget = 0;
appendWidget(main, widget);
connect(this,SIGNAL(okClicked()),this,SLOT(slotOk()));
}
void KameraConfigDialog::appendWidget(QWidget *parent, CameraWidget *widget)
{
QWidget *newParent = parent;
CameraWidgetType widget_type;
const char *widget_name;
const char *widget_info;
const char *widget_label;
float widget_value_float;
int widget_value_int;
const char *widget_value_string = NULL;
gp_widget_get_type(widget, &widget_type);
gp_widget_get_label(widget, &widget_label);
gp_widget_get_info(widget, &widget_info);
gp_widget_get_name(widget, &widget_name);
QString whats_this = QString::fromLocal8Bit(widget_info); // gphoto2 doesn't seem to have any standard for i18n
// Add this widget to parent
switch(widget_type) {
case GP_WIDGET_WINDOW:
{
setCaption(QString::fromLocal8Bit(widget_label));
break;
}
case GP_WIDGET_SECTION:
{
if (!m_tabWidget) {
m_tabWidget = new QTabWidget(parent);
parent->layout()->addWidget(m_tabWidget);
}
QWidget *tab = new QWidget(m_tabWidget);
// widgets are to be aligned vertically in the tab
QVBoxLayout *tabLayout = new QVBoxLayout(tab);
m_tabWidget->addTab(tab, QString::fromLocal8Bit(widget_label));
KVBox *tabContainer = new KVBox(tab);
tabLayout->addWidget(tabContainer);
newParent = tabContainer;
tabLayout->addStretch();
break;
}
case GP_WIDGET_TEXT:
{
gp_widget_get_value(widget, &widget_value_string);
QWidget *grid = new QWidget(parent);
QGridLayout *gridLayout = new QGridLayout(grid);
grid->setLayout(gridLayout);
parent->layout()->addWidget(grid);
QLabel *label = new QLabel(QString::fromLocal8Bit( widget_label )+':', grid);
QLineEdit *lineEdit = new QLineEdit(widget_value_string, grid);
gridLayout->addWidget(label, 0, 0, Qt::AlignLeft);
gridLayout->addWidget(label, 0, 1, Qt::AlignRight);
m_wmap.insert(widget, lineEdit);
if (!whats_this.isEmpty())
grid->setWhatsThis( whats_this);
break;
}
case GP_WIDGET_RANGE:
{
float widget_low;
float widget_high;
float widget_increment;
gp_widget_get_range(widget, &widget_low, &widget_high, &widget_increment);
gp_widget_get_value(widget, &widget_value_float);
Q3GroupBox *groupBox = new Q3GroupBox(1, Qt::Horizontal,QString::fromLocal8Bit(widget_label), parent);
parent->layout()->addWidget(groupBox);
QSlider *slider = new QSlider(Qt::Horizontal, groupBox);
slider->setMinimum((int)widget_low);
slider->setMaximum((int)widget_high);
slider->setPageStep((int)widget_increment);
slider->setValue((int)widget_value_float);
m_wmap.insert(widget, slider);
if (!whats_this.isEmpty())
groupBox->setWhatsThis( whats_this);
break;
}
case GP_WIDGET_TOGGLE:
{
gp_widget_get_value(widget, &widget_value_int);
QCheckBox *checkBox = new QCheckBox(QString::fromLocal8Bit(widget_label), parent);
parent->layout()->addWidget(checkBox);
checkBox->setChecked(widget_value_int);
m_wmap.insert(widget, checkBox);
if (!whats_this.isEmpty())
checkBox->setWhatsThis( whats_this);
break;
}
case GP_WIDGET_RADIO:
{
gp_widget_get_value(widget, &widget_value_string);
int count = gp_widget_count_choices(widget);
// for less than 5 options, align them horizontally
Q3ButtonGroup *buttonGroup;
if (count > 4)
buttonGroup = new Q3VButtonGroup(QString::fromLocal8Bit(widget_label), parent);
else
buttonGroup = new Q3HButtonGroup(QString::fromLocal8Bit(widget_label), parent);
parent->layout()->addWidget(buttonGroup);
for(int i = 0; i < count; ++i) {
const char *widget_choice;
gp_widget_get_choice(widget, i, &widget_choice);
new QRadioButton(widget_choice, buttonGroup);
if(widget_value_string && !strcmp(widget_value_string, widget_choice))
buttonGroup->setButton(i);
}
m_wmap.insert(widget, buttonGroup);
if (!whats_this.isEmpty())
buttonGroup->setWhatsThis( whats_this);
break;
}
case GP_WIDGET_MENU:
{
gp_widget_get_value(widget, &widget_value_string);
QComboBox *comboBox = new QComboBox(parent);
parent->layout()->addWidget(comboBox);
comboBox->clear();
for(int i = 0; i < gp_widget_count_choices(widget); ++i) {
const char *widget_choice;
gp_widget_get_choice(widget, i, &widget_choice);
comboBox->addItem(widget_choice);
if(widget_value_string && !strcmp(widget_value_string, widget_choice))
comboBox->setCurrentIndex(i);
}
m_wmap.insert(widget, comboBox);
if (!whats_this.isEmpty())
comboBox->setWhatsThis( whats_this);
break;
}
case GP_WIDGET_BUTTON:
{
// TODO
// I can't see a way of implementing this. Since there is
// no way of telling which button sent you a signal, we
// can't map to the appropriate widget->callback
QLabel *label = new QLabel(i18n("Button (not supported by KControl)"), parent);
parent->layout()->addWidget(label);
break;
}
case GP_WIDGET_DATE:
{
// TODO
QLabel * label = new QLabel(i18n("Date (not supported by KControl)"), parent);
parent->layout()->addWidget(label);
break;
}
default:
return;
}
// Append all this widgets children
for(int i = 0; i < gp_widget_count_children(widget); ++i) {
CameraWidget *widget_child;
gp_widget_get_child(widget, i, &widget_child);
appendWidget(newParent, widget_child);
}
// Things that must be done after all children were added
/*
switch (widget_type) {
case GP_WIDGET_SECTION:
{
tabLayout->addItem( new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding) );
break;
}
}
*/
}
void KameraConfigDialog::updateWidgetValue(CameraWidget *widget)
{
CameraWidgetType widget_type;
gp_widget_get_type(widget, &widget_type);
switch(widget_type) {
case GP_WIDGET_WINDOW:
// nothing to do
break;
case GP_WIDGET_SECTION:
// nothing to do
break;
case GP_WIDGET_TEXT:
{
QLineEdit *lineEdit = static_cast<QLineEdit *>(m_wmap[widget]);
gp_widget_set_value(widget, (void *)lineEdit->text().toLocal8Bit().data());
break;
}
case GP_WIDGET_RANGE:
{
QSlider *slider = static_cast<QSlider *>(m_wmap[widget]);
float value_float = slider->value();
gp_widget_set_value(widget, (void *)&value_float);
break;
}
case GP_WIDGET_TOGGLE:
{
QCheckBox *checkBox = static_cast<QCheckBox *>(m_wmap[widget]);
int value_int = checkBox->isChecked() ? 1 : 0;
gp_widget_set_value(widget, (void *)&value_int);
break;
}
case GP_WIDGET_RADIO:
{
Q3ButtonGroup *buttonGroup = static_cast<Q3VButtonGroup *>(m_wmap[widget]);
gp_widget_set_value(widget, (void *)buttonGroup->selected()->text().toLocal8Bit().data());
break;
}
case GP_WIDGET_MENU:
{
QComboBox *comboBox = static_cast<QComboBox *>(m_wmap[widget]);
gp_widget_set_value(widget, (void *)comboBox->currentText().toLocal8Bit().data());
break;
}
case GP_WIDGET_BUTTON:
// nothing to do
break;
case GP_WIDGET_DATE:
{
// not implemented
break;
}
}
// Copy child widget values
for(int i = 0; i < gp_widget_count_children(widget); ++i) {
CameraWidget *widget_child;
gp_widget_get_child(widget, i, &widget_child);
updateWidgetValue(widget_child);
}
}
void KameraConfigDialog::slotOk()
{
// Copy Qt widget values into CameraWidget hierarchy
updateWidgetValue(m_widgetRoot);
// 'ok' dialog
accept();
}

View file

@ -0,0 +1,53 @@
/*
Copyright (C) 2001 The Kompany
2002-2003 Ilya Konstantinov <kde-devel@future.shiny.co.il>
2002-2003 Marcus Meissner <marcus@jet.franken.de>
2003 Nadeem Hasan <nhasan@nadmm.com>
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 __kameraconfigdialog_h__
#define __kameraconfigdialog_h__
#include <qmap.h>
#include <kdialog.h>
#include <qtabwidget.h>
extern "C" {
#include <gphoto2.h>
}
class KameraConfigDialog : public KDialog
{
Q_OBJECT
public:
KameraConfigDialog(Camera *camera, CameraWidget *widget,
QWidget *parent = 0);
private slots:
void slotOk();
private:
void appendWidget(QWidget *parent, CameraWidget *widget);
void updateWidgetValue(CameraWidget *widget);
QMap<CameraWidget *, QWidget *> m_wmap;
CameraWidget *m_widgetRoot;
QTabWidget *m_tabWidget;
};
#endif

View file

@ -0,0 +1,517 @@
/*
Copyright (C) 2001 The Kompany
2002-2003 Ilya Konstantinov <kde-devel@future.shiny.co.il>
2002-2003 Marcus Meissner <marcus@jet.franken.de>
2003 Nadeem Hasan <nhasan@nadmm.com>
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.
*/
#include <QtGui/QComboBox>
#include <QtGui/QGroupBox>
#include <QtGui/QHBoxLayout>
#include <QtGui/QLabel>
#include <QtGui/QListView>
#include <QtGui/QRadioButton>
#include <QtGui/QStackedWidget>
#include <QtGui/QVBoxLayout>
#include <QStandardItemModel>
#include <KLocale>
#include <KConfig>
#include <KMessageBox>
#include "config-kamera.h"
extern "C" {
#include <gphoto2.h>
}
#include "kamera.h"
#include "kameraconfigdialog.h"
#include "kameradevice.moc"
// Define some parts of the old API
#define GP_PROMPT_OK 0
#define GP_PROMPT_CANCEL -1
static const int INDEX_NONE= 0;
static const int INDEX_SERIAL = 1;
static const int INDEX_USB= 2;
static GPContext *glob_context = 0;
KCamera::KCamera(const QString &name, const QString &path)
{
m_name = name;
m_model = name;
m_path = path;
m_camera = NULL;
m_abilitylist = NULL;
}
KCamera::~KCamera()
{
if(m_camera)
gp_camera_free(m_camera);
if(m_abilitylist)
gp_abilities_list_free(m_abilitylist);
}
bool KCamera::initInformation()
{
if (m_model.isNull())
return false;
if(gp_abilities_list_new(&m_abilitylist) != GP_OK) {
emit error(i18n("Could not allocate memory for the abilities list."));
return false;
}
if(gp_abilities_list_load(m_abilitylist, glob_context) != GP_OK) {
emit error(i18n("Could not load ability list."));
return false;
}
int index = gp_abilities_list_lookup_model(m_abilitylist, m_model.toLocal8Bit().data());
if(index < 0) {
emit error(i18n("Description of abilities for camera %1 is not available."
" Configuration options may be incorrect.", m_model));
return false;
}
gp_abilities_list_get_abilities(m_abilitylist, index, &m_abilities);
return true;
}
bool KCamera::initCamera()
{
if (m_camera)
return m_camera;
else {
int result;
initInformation();
if (m_model.isNull() || m_path.isNull())
return false;
result = gp_camera_new(&m_camera);
if (result != GP_OK) {
// m_camera is not initialized, so we cannot get result as string
emit error(i18n("Could not access driver. Check your gPhoto2 installation."));
return false;
}
// set the camera's model
GPPortInfo info;
GPPortInfoList *il;
gp_port_info_list_new(&il);
gp_port_info_list_load(il);
gp_port_info_list_get_info(il, gp_port_info_list_lookup_path(il, m_path.toLocal8Bit().data()), &info);
gp_camera_set_abilities(m_camera, m_abilities);
gp_camera_set_port_info(m_camera, info);
gp_port_info_list_free(il);
// this might take some time (esp. for non-existent camera) - better be done asynchronously
result = gp_camera_init(m_camera, glob_context);
if (result != GP_OK) {
gp_camera_free(m_camera);
m_camera = NULL;
emit error(
i18n("Unable to initialize camera. Check your port settings and camera connectivity and try again."),
QString::fromLocal8Bit(gp_result_as_string(result)));
return false;
}
return m_camera;
}
}
Camera* KCamera::camera()
{
initCamera();
return m_camera;
}
QString KCamera::summary()
{
int result;
CameraText summary;
initCamera();
result = gp_camera_get_summary(m_camera, &summary, glob_context);
if (result != GP_OK)
return i18n("No camera summary information is available.\n");
return QString::fromLocal8Bit(summary.text);
}
bool KCamera::configure()
{
CameraWidget *window;
int result;
initCamera();
result = gp_camera_get_config(m_camera, &window, glob_context);
if (result != GP_OK) {
emit error(i18n("Camera configuration failed."), QString::fromLocal8Bit(gp_result_as_string(result)));
return false;
}
KameraConfigDialog kcd(m_camera, window);
result = kcd.exec() ? GP_PROMPT_OK : GP_PROMPT_CANCEL;
if (result == GP_PROMPT_OK) {
result = gp_camera_set_config(m_camera, window, glob_context);
if (result != GP_OK) {
emit error(i18n("Camera configuration failed."), QString::fromLocal8Bit(gp_result_as_string(result)));
return false;
}
}
return true;
}
bool KCamera::test()
{
// TODO: Make testing non-blocking (maybe via KIO?)
// Currently, a failed serial test times out at about 30 sec.
return camera() != 0;
}
void KCamera::load(KConfig *config)
{
KConfigGroup group = config->group(m_name);
if (m_model.isNull())
m_model = group.readEntry("Model");
if (m_path.isNull())
m_path = group.readEntry("Path");
invalidateCamera();
}
void KCamera::save(KConfig *config)
{
KConfigGroup group = config->group(m_name);
group.writeEntry("Model", m_model);
group.writeEntry("Path", m_path);
}
QString KCamera::portName()
{
QString port = m_path.left(m_path.indexOf(":")).toLower();
if (port == "serial") return i18n("Serial");
if (port == "usb") return i18n("USB");
return i18n("Unknown port");
}
void KCamera::setName(const QString &name)
{
m_name = name;
}
void KCamera::setModel(const QString &model)
{
m_model = model;
invalidateCamera();
initInformation();
}
void KCamera::setPath(const QString &path)
{
m_path = path;
invalidateCamera();
}
void KCamera::invalidateCamera()
{
if (m_camera) {
gp_camera_free(m_camera);
m_camera = NULL;
}
}
bool KCamera::isTestable() const
{
return true;
}
bool KCamera::isConfigurable()
{
initInformation();
return m_abilities.operations & GP_OPERATION_CONFIG;
}
QStringList KCamera::supportedPorts()
{
initInformation();
QStringList ports;
if (m_abilities.port & GP_PORT_SERIAL)
ports.append("serial");
if (m_abilities.port & GP_PORT_USB)
ports.append("usb");
return ports;
}
CameraAbilities KCamera::abilities()
{
return m_abilities;
}
// ---------- KameraSelectCamera ------------
KameraDeviceSelectDialog::KameraDeviceSelectDialog(QWidget *parent, KCamera *device)
: KDialog(parent)
{
setCaption( i18n("Select Camera Device") );
setButtons( Ok | Cancel );
setDefaultButton( Ok );
setModal( true );
showButtonSeparator( true );
m_device = device;
connect(m_device, SIGNAL(error(const QString &)),
SLOT(slot_error(const QString &)));
connect(m_device, SIGNAL(error(const QString &, const QString &)),
SLOT(slot_error(const QString &, const QString &)));
QWidget *page = new QWidget( this );
setMainWidget(page);
// a layout with vertical boxes
QHBoxLayout *topLayout = new QHBoxLayout(page);
topLayout->setSpacing(KDialog::spacingHint());
topLayout->setMargin(0);
// the models list
m_modelSel = new QListView(page);
m_model = new QStandardItemModel(this);
m_model->setColumnCount(1);
m_model->setHeaderData(0, Qt::Horizontal, i18nc("@title:column", "Supported Cameras"));
m_modelSel->setModel(m_model);
topLayout->addWidget( m_modelSel );
connect(m_modelSel, SIGNAL(activated(const QModelIndex &)),
SLOT(slot_setModel(const QModelIndex &)));
// make sure listview only as wide as it needs to be
m_modelSel->setSizePolicy(QSizePolicy(QSizePolicy::Maximum,
QSizePolicy::Preferred));
QVBoxLayout *rightLayout = new QVBoxLayout();
rightLayout->setSpacing(KDialog::spacingHint());
rightLayout->setMargin(0);
topLayout->addLayout( rightLayout );
m_portSelectGroup = new QGroupBox(i18n("Port"), page);
QVBoxLayout *vertLayout = new QVBoxLayout;
m_portSelectGroup->setLayout( vertLayout );
rightLayout->addWidget(m_portSelectGroup);
m_portSettingsGroup = new QGroupBox(i18n("Port Settings"), page);
QVBoxLayout *lay = new QVBoxLayout;
m_portSettingsGroup->setLayout( lay );
rightLayout->addWidget(m_portSettingsGroup);
// Create port type selection radiobuttons.
m_serialRB = new QRadioButton(i18n("Serial"));
vertLayout->addWidget(m_serialRB );
m_serialRB->setWhatsThis( i18n("If this option is checked, the camera has to be connected to one of the computer's serial ports (known as COM ports in Microsoft Windows.)"));
m_USBRB = new QRadioButton(i18n("USB"));
vertLayout->addWidget(m_USBRB );
m_USBRB->setWhatsThis( i18n("If this option is checked, the camera has to be connected to one of the computer's USB ports, or to a USB hub."));
// Create port settings widget stack
m_settingsStack = new QStackedWidget;
QWidget *grid2 = new QWidget(m_settingsStack);
QGridLayout *gridLayout2 = new QGridLayout(grid2);
gridLayout2->setSpacing(KDialog::spacingHint());
grid2->setLayout(gridLayout2);
QLabel *label2 = new QLabel(i18n("Port"), grid2);
gridLayout2->addWidget(label2, 0, 0, Qt::AlignLeft);
lay->addWidget(grid2);
lay->addWidget( m_settingsStack );
connect(m_serialRB, SIGNAL( toggled(bool) ),
this, SLOT( changeCurrentIndex() ) );
connect(m_USBRB, SIGNAL( toggled(bool) ),
this, SLOT( changeCurrentIndex() ) );
// none tab
m_settingsStack->insertWidget(INDEX_NONE, new QLabel(i18n("No port type selected."),
m_settingsStack));
// serial tab
QWidget *grid = new QWidget(m_settingsStack);
QGridLayout *gridLayout = new QGridLayout(grid);
gridLayout->setSpacing(KDialog::spacingHint());
grid->setLayout(gridLayout);
QLabel *label = new QLabel(i18n("Port:"), grid);
m_serialPortCombo = new QComboBox(grid);
m_serialPortCombo->setEditable(true);
m_serialPortCombo->setWhatsThis( i18n("Specify here the serial port to which you connect the camera."));
gridLayout->addWidget(label, 1, 0, Qt::AlignLeft);
gridLayout->addWidget(m_serialPortCombo, 1, 1, Qt::AlignRight);
m_settingsStack->insertWidget(INDEX_SERIAL, grid);
m_settingsStack->insertWidget(INDEX_USB, new
QLabel(i18n("No further configuration is required for USB cameras."),
m_settingsStack));
// query gphoto2 for existing serial ports
GPPortInfoList *list;
GPPortInfo info;
int gphoto_ports=0;
gp_port_info_list_new(&list);
if(gp_port_info_list_load(list) >= 0) {
gphoto_ports = gp_port_info_list_count(list);
}
for (int i = 0; i < gphoto_ports; i++) {
if (gp_port_info_list_get_info(list, i, &info) >= 0) {
#ifdef HAVE_GPHOTO2_5
char *xpath;
gp_port_info_get_path (info, &xpath);
if (strncmp(xpath, "serial:", 7) == 0)
m_serialPortCombo->addItem(QString::fromLocal8Bit(xpath).mid(7));
#else
if (strncmp(info.path, "serial:", 7) == 0)
m_serialPortCombo->addItem(QString::fromLocal8Bit(info.path).mid(7));
#endif
}
}
gp_port_info_list_free(list);
// add a spacer
rightLayout->addStretch();
populateCameraListView();
load();
enableButtonOk(false );
m_portSelectGroup->setEnabled( false );
m_portSettingsGroup->setEnabled( false );
}
void KameraDeviceSelectDialog::changeCurrentIndex()
{
QRadioButton *send = dynamic_cast<QRadioButton*>( sender() );
if ( send )
{
if ( send == m_serialRB )
{
m_settingsStack->setCurrentIndex( INDEX_SERIAL );
}
else if ( send == m_USBRB )
{
m_settingsStack->setCurrentIndex( INDEX_USB );
}
}
}
bool KameraDeviceSelectDialog::populateCameraListView()
{
gp_abilities_list_new (&m_device->m_abilitylist);
gp_abilities_list_load(m_device->m_abilitylist, glob_context);
int numCams = gp_abilities_list_count(m_device->m_abilitylist);
CameraAbilities a;
if(numCams < 0) {
// XXX libgphoto2 failed to get te camera list
return false;
} else {
for(int x = 0; x < numCams; ++x) {
if(gp_abilities_list_get_abilities(m_device->m_abilitylist, x, &a) == GP_OK) {
QStandardItem *cameraItem = new QStandardItem;
cameraItem->setEditable(false);
cameraItem->setText(a.model);
m_model->appendRow(cameraItem);
}
}
return true;
}
}
void KameraDeviceSelectDialog::save()
{
m_device->setModel(m_modelSel->currentIndex().data(Qt::DisplayRole).toString());
if (m_serialRB->isChecked())
m_device->setPath("serial:" + m_serialPortCombo->currentText());
else if ( m_USBRB->isChecked() )
m_device->setPath("usb:");
}
void KameraDeviceSelectDialog::load()
{
QString path = m_device->path();
QString port = path.left(path.indexOf(':')).toLower();
if (port == "serial") setPortType(INDEX_SERIAL);
if (port == "usb") setPortType(INDEX_USB);
QList<QStandardItem *> items = m_model->findItems(m_device->model());
foreach (QStandardItem *item, items) {
const QModelIndex index = m_model->indexFromItem(item);
m_modelSel->selectionModel()->select(index, QItemSelectionModel::Select);
}
}
void KameraDeviceSelectDialog::slot_setModel(const QModelIndex &modelIndex)
{
enableButtonOk(true);
m_portSelectGroup->setEnabled(true);
m_portSettingsGroup->setEnabled(true);
QString model = modelIndex.data(Qt::DisplayRole).toString();
CameraAbilities abilities;
int index = gp_abilities_list_lookup_model(m_device->m_abilitylist, model.toLocal8Bit().data());
if(index < 0) {
slot_error(i18n("Description of abilities for camera %1 is not available."
" Configuration options may be incorrect.", model));
}
int result = gp_abilities_list_get_abilities(m_device->m_abilitylist, index, &abilities);
if (result == GP_OK) {
// enable radiobuttons for supported port types
m_serialRB->setEnabled(abilities.port & GP_PORT_SERIAL);
m_USBRB->setEnabled(abilities.port & GP_PORT_USB);
// if there's only one available port type, make sure it's selected
if (abilities.port == GP_PORT_SERIAL)
setPortType(INDEX_SERIAL);
if (abilities.port == GP_PORT_USB)
setPortType(INDEX_USB);
} else {
slot_error(i18n("Description of abilities for camera %1 is not available."
" Configuration options may be incorrect.", model));
}
}
void KameraDeviceSelectDialog::setPortType(int type)
{
// Enable the correct button
if ( type == INDEX_USB )
m_USBRB->setChecked( true );
else if ( type == INDEX_SERIAL )
m_serialRB->setChecked( true );
// Bring the right tab to the front
m_settingsStack->setCurrentIndex(type);
}
void KameraDeviceSelectDialog::slot_error(const QString &message)
{
KMessageBox::error(this, message);
}
void KameraDeviceSelectDialog::slot_error(const QString &message, const QString &details)
{
KMessageBox::detailedError(this, message, details);
}

View file

@ -0,0 +1,119 @@
/*
Copyright (C) 2001 The Kompany
2002-2003 Ilya Konstantinov <kde-devel@future.shiny.co.il>
2002-2003 Marcus Meissner <marcus@jet.franken.de>
2003 Nadeem Hasan <nhasan@nadmm.com>
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 __kameradevice_h__
#define __kameradevice_h__
#include <qmap.h>
#include <kdialog.h>
class KConfig;
class QString;
class QListView;
class QStackedWidget;
class QComboBox;
class QLineEdit;
class QRadioButton;
class QGroupBox;
class QStandardItemModel;
class QModelIndex;
class KCamera : public QObject {
friend class KameraDeviceSelectDialog;
Q_OBJECT
public:
KCamera(const QString &name, const QString &path);
~KCamera();
void invalidateCamera();
bool configure();
void load(KConfig *m_config);
void save(KConfig *m_config);
bool test();
QStringList supportedPorts();
Camera* camera();
QString name() const { return m_name ; }
QString model() const { return m_model; }
QString path() const { return m_path; }
QString portName();
QString summary();
CameraAbilities abilities();
void setName(const QString &name);
void setModel(const QString &model);
void setPath(const QString &path);
bool isTestable() const;
bool isConfigurable();
signals:
void error(const QString &message);
void error(const QString &message, const QString &details);
protected:
bool initInformation();
bool initCamera();
// void doConfigureCamera(Camera *camera, CameraWidget *widgets);
// int frontend_prompt(Camera *camera, CameraWidget *widgets);
Camera *m_camera;
// KConfig *m_config;
QString m_name; // the camera's real name
QString m_model;
QString m_path;
CameraAbilities m_abilities;
CameraAbilitiesList *m_abilitylist;
};
class KameraDeviceSelectDialog : public KDialog
{
Q_OBJECT
public:
KameraDeviceSelectDialog(QWidget *parent, KCamera *device);
void save();
void load();
protected slots:
void slot_setModel(const QModelIndex &index);
void slot_error(const QString &message);
void slot_error(const QString &message, const QString &details);
void changeCurrentIndex();
protected:
KCamera *m_device;
bool populateCameraListView(void);
void setPortType(int type);
// port settings widgets
QListView *m_modelSel;
QStandardItemModel *m_model;
QLineEdit *m_nameEdit;
QStackedWidget *m_settingsStack;
QGroupBox *m_portSelectGroup;
QGroupBox *m_portSettingsGroup;
QComboBox *m_serialPortCombo;
// port selection radio buttons
QRadioButton *m_serialRB;
QRadioButton *m_USBRB;
};
#endif

View file

@ -0,0 +1,17 @@
########### next target ###############
set(kio_kamera_PART_SRCS kamera.cpp )
kde4_add_plugin(kio_kamera ${kio_kamera_PART_SRCS})
target_link_libraries(kio_kamera ${KDE4_KIO_LIBS} ${GPHOTO2_LIBRARIES} )
install(TARGETS kio_kamera DESTINATION ${PLUGIN_INSTALL_DIR} )
########### install files ###############
install( FILES camera.protocol DESTINATION ${SERVICES_INSTALL_DIR} )

View file

@ -0,0 +1,16 @@
[Protocol]
exec=kio_kamera
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

1085
kamera/kioslave/kamera.cpp Normal file

File diff suppressed because it is too large Load diff

82
kamera/kioslave/kamera.h Normal file
View file

@ -0,0 +1,82 @@
/*
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 __kamera_h__
#define __kamera_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

View file

@ -0,0 +1,64 @@
[Desktop Entry]
X-KDE-Solid-Predicate=Camera.supportedDrivers == 'gphoto'
Type=Service
Actions=open;
[Desktop Action open]
Exec=kioclient exec camera:/
Icon=system-file-manager
Name=Open with File Manager
Name[ar]=افتح بمدير الملفات
Name[ast]=Abrir con Xestor de Ficheros
Name[bg]=Отваряне в файлов браузър
Name[bs]=Otvori menadžerom datoteka
Name[ca]=Obre amb el gestor de fitxers
Name[ca@valencia]=Obri amb el gestor de fitxers
Name[cs]=Otevřít ve správci souborů
Name[da]=Åbn med filhåndtering
Name[de]=Mit Dateimanager öffnen
Name[el]=Άνοιγμα με τον διαχειριστή αρχείων
Name[en_GB]=Open with File Manager
Name[es]=Abrir con el gestor de archivos
Name[et]=Avamine failihalduriga
Name[eu]=Ireki fitxategi kudeatzailearekin
Name[fi]=Avaa tiedostonhallinnassa
Name[fr]=Ouvrir dans le gestionnaire de fichiers
Name[ga]=Oscail i mBainisteoir Comhad
Name[gl]=Abrir co xestor de ficheiros
Name[hr]=Otvori s preglednikom datoteka
Name[hu]=Megnyitás fájlkezelővel
Name[ia]=Aperi file con le gerente de file
Name[is]=Opna með skráastjóra
Name[it]=Apri con il gestore dei file
Name[ja]=
Name[kk]=Файл менеджерінде ашу
Name[km]=
Name[ko]=
Name[lt]=Atverti su failų tvarkykle
Name[lv]=Atvērt failu pārvaldniekā
Name[mr]=
Name[nb]=Åpne med filbehandler
Name[nds]=Mit Dateipleger opmaken
Name[nl]=Openen met bestandsbeheerder
Name[nn]=Opna med filhandsamaren
Name[pa]=
Name[pl]=Otwórz w przeglądarce plików
Name[pt]=Abrir com o Gestor de Ficheiros
Name[pt_BR]=Abrir com o gerenciador de arquivos
Name[ro]=Deschide cu gestionarul de fișiere
Name[ru]=Открыть в диспетчере файлов
Name[si]=
Name[sk]=Otvoriť v správcovi súborov
Name[sl]=Odpri v upravljalniku datotek
Name[sr]=Отвори менаџером фајлова
Name[sr@ijekavian]=Отвори менаџером фајлова
Name[sr@ijekavianlatin]=Otvori menadžerom fajlova
Name[sr@latin]=Otvori menadžerom fajlova
Name[sv]=Öppna med filhanterare
Name[th]=
Name[tr]=Dosya Yöneticisi ile Aç
Name[ug]=ھۆججەت باشقۇرغۇدا ئاچ
Name[uk]=Відкрити за допомогою менеджера файлів
Name[x-test]=xxOpen with File Managerxx
Name[zh_CN]=
Name[zh_TW]=使