summaryrefslogtreecommitdiffstats
path: root/kipi-plugins/ipodexport/ipodexportdialog.h
blob: 9e5e3d76f44197f3015331f682f7891df1bc9d32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/***************************************************************************
 * copyright            : (C) 2006 Seb Ruiz <me@sebruiz.net>               *
 **************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef IPOD_EXPORTDIALOG_H
#define IPOD_EXPORTDIALOG_H

extern "C" {
#include <gpod/itdb.h>
}

#define KIPI_PLUGIN 1

#include <kdialogbase.h>

#if KIPI_PLUGIN
#include <libkipi/interface.h>
#endif

class TQCheckBox;
class TQHGroupBox;
class TQLabel;
class TQPushButton;
class KComboBox;
class KFileItem;
class KLineEdit;
class TDEListView;
class TDEListViewItem;
class KURL;

namespace IpodExport
{

class ImageList;
class IpodAlbumItem;
class IpodPhotoItem;
class IpodHeader;

class UploadDialog : public KDialogBase
{
    Q_OBJECT
  

    public:
        UploadDialog(
                        #if KIPI_PLUGIN
                        KIPI::Interface* interface,
                        #endif
                        TQString caption, TQWidget *parent=0 );

        ~UploadDialog()
        {
            if( m_itdb )
                itdb_photodb_free( m_itdb );
        }

        static UploadDialog *instance() { return s_instance; }

        TQString ipodModel() const;
        TQString mountPoint() { return m_mountPoint; }
        TQString deviceNode() { return m_deviceNode; }

    private slots:
        void startTransfer();

        void addDropItems( TQStringList filesPath );

        void imageSelected( TQListViewItem *item );
        void gotImagePreview( const KFileItem* , const TQPixmap &pixmap );

        void ipodItemSelected( TQListViewItem *item );
        void ipodShowContextMenu( TQListViewItem * ) { }

        void imagesFilesButtonAdd();
        void imagesFilesButtonRem();

        void createIpodAlbum();
        void deleteIpodAlbum();
        void renameIpodAlbum();

        void refreshDevices();
        void updateSysInfo();

    private:
        void addUrlToList( TQString file );
        bool deleteIpodAlbum( IpodAlbumItem *album );
        bool deleteIpodPhoto( IpodPhotoItem *photo );
        void enableButtons();
        void getIpodAlbums();
        void getIpodAlbumPhotos( IpodAlbumItem *item, Itdb_PhotoAlbum *album );
        Itdb_Artwork *photoFromId( const uint id );
        void reloadIpodAlbum( IpodAlbumItem *item, Itdb_PhotoAlbum *album );

        bool openDevice(); // connect to the ipod

#if KIPI_PLUGIN
        KIPI::Interface *m_interface;
#endif
        Itdb_PhotoDB    *m_itdb;
        Itdb_IpodInfo   *m_ipodInfo;
        IpodHeader      *m_ipodHeader;
        bool             m_transferring;

        TQListViewItem   *m_destinationAlbum;

        TQPushButton     *m_createAlbumButton;
        TQPushButton     *m_removeAlbumButton;
        TQPushButton     *m_renameAlbumButton;
        TQPushButton     *m_addImagesButton;
        TQPushButton     *m_remImagesButton;
        TQPushButton     *m_transferImagesButton;
        ImageList       *m_uploadList;
        TDEListView       *m_ipodAlbumList;
        TQLabel          *m_imagePreview;
        TQLabel          *m_ipodPreview;

        TQHGroupBox      *m_destinationBox;
        TQHGroupBox      *m_urlListBox;

        TQString          m_mountPoint;
        TQString          m_deviceNode;

        static UploadDialog *s_instance;
};

}

#endif // IPOD_EXPORTDIALOG_H