File: k3bexporter.h

package info (click to toggle)
juk 4%3A4.14.2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,828 kB
  • ctags: 2,269
  • sloc: cpp: 18,306; xml: 469; sh: 11; makefile: 2
file content (114 lines) | stat: -rw-r--r-- 2,830 bytes parent folder | download | duplicates (2)
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
/**
 * Copyright (C) 2004 Michael Pyne <mpyne@kde.org>
 *
 * 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, see <http://www.gnu.org/licenses/>.
 */

#ifndef K3BEXPORTER_H
#define K3BEXPORTER_H

#include <kaction.h>

#include "playlistexporter.h"
#include "playlistitem.h"

class PlaylistBox;

class PlaylistAction : public KAction
{
    Q_OBJECT
    
public:
    PlaylistAction(const QString &userText, const QIcon &pix, const char *slot, const KShortcut &cut = KShortcut());

    typedef QMap<const Playlist *, QObject *> PlaylistRecipientMap;

    /**
     * Defines a QObject to call (using the m_slot SLOT) when an action is
     * emitted from a Playlist.
     */
    void addCallMapping(const Playlist *p, QObject *obj);

    protected slots:
    void slotActivated();

    private:
    QByteArray m_slot;
    PlaylistRecipientMap m_playlistRecipient;
};

/**
 * Class that will export the selected items of a playlist to K3b.
 */
class K3bExporter : public PlaylistExporter
{
    Q_OBJECT

public:
    K3bExporter(Playlist *parent = 0);

    /**
     * Returns a KAction that can be used to invoke the export.
     *
     * @return action used to start the export.
     */
    virtual KAction *action();

    Playlist *playlist() const { return m_parent; }
    void setPlaylist(Playlist *playlist) { m_parent = playlist; }

protected:
    void exportPlaylistItems(const PlaylistItemList &items);

private slots:
    void slotExport();

private:
    enum K3bOpenMode { AudioCD, DataCD, Abort };

    // Private method declarations
    void exportViaCmdLine(const PlaylistItemList &items);
    K3bOpenMode openMode();

    // Private member variable declarations
    Playlist *m_parent;

    // Static member used to avoid adding more than one action to KDE's
    // action list.
    static PlaylistAction *m_action;
};

/**
 * Class to export EVERY item in a playlist to K3b.  Used with the PlaylistBox
 * class to implement context-menus there.
 *
 * @see PlaylistBox
 */
class K3bPlaylistExporter : public K3bExporter
{
    Q_OBJECT
public:
    K3bPlaylistExporter(PlaylistBox *parent = 0);

    virtual KAction *action();

private slots:
    void slotExport();

private:
    PlaylistBox *m_playlistBox;
};

#endif /* K3BEXPORTER_H */

// vim: set et sw=4 tw=0 sta: