tageditor.h 3 KB
Newer Older
1 2
/***************************************************************************
    begin                : Sat Sep 7 2002
3
    copyright            : (C) 2002 - 2004 by Scott Wheeler
4
    email                : wheeler@kde.org
5 6 7 8 9 10 11 12 13 14 15 16 17 18
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 TAGEDITOR_H
#define TAGEDITOR_H

19
#include <qwidget.h>
20

21 22 23 24
class KComboBox;
class KLineEdit;
class KIntSpinBox;
class KEdit;
25
class KPushButton;
26
class KConfig;
27

28 29 30
class QCheckBox;
class QBoxLayout;

31
class Playlist;
Scott Wheeler's avatar
Scott Wheeler committed
32 33 34
class PlaylistItem;
typedef QValueList<PlaylistItem *> PlaylistItemList;

35 36 37 38 39 40 41
class TagEditor : public QWidget
{
    Q_OBJECT

public: 
    TagEditor(QWidget *parent = 0, const char *name = 0);
    virtual ~TagEditor();
42
    PlaylistItemList items() const { return m_items; }
43 44

public slots:
45
    void slotSave() { save(m_items); }
46 47 48 49
    void slotSetItems(const PlaylistItemList &list);
    void slotRefresh();
    void slotClear();
    void slotUpdateCollection();
50
   
51
private:
52
    void setupActions();
53 54
    void setupLayout();
    void readConfig();
55
    void readCompletionMode(KConfig *config, KComboBox *box, const QString &key);
56
    void saveConfig();
57
    void save(const PlaylistItemList &list);
58
    void saveChangesPrompt();
59 60 61 62
    /**
     * Adds an item to JuK's tagging layout.  This handles the creation and
     * placement of the "enable" box as well.
     */
63
    void addItem(const QString &text, QWidget *item, QBoxLayout *layout, const QString &iconName = QString::null);
64

65 66 67 68 69
    /**
     * Adds a widget to m_hideList and returns that widget.
     */
    QWidget *addHidden(QWidget *w) { m_hideList.append(w); return w; }

70
    virtual void showEvent(QShowEvent *e);
71 72
    virtual bool eventFilter(QObject *watched, QEvent *e);

73
private slots:
74
    void slotDataChanged(bool c = true);
75
    void slotItemRemoved(PlaylistItem *item);
76
    void slotPlaylistRemoved() { m_currentPlaylist = 0; }
77 78

private:
79
    typedef QMap<QWidget *, QCheckBox *> BoxMap;
80 81
    BoxMap m_enableBoxes;

82
    QStringList m_genreList;
83 84 85 86 87 88 89 90 91 92 93 94

    KComboBox *m_artistNameBox;
    KLineEdit *m_trackNameBox;
    KComboBox *m_albumNameBox;
    KComboBox *m_genreBox;
    KLineEdit *m_fileNameBox;
    KIntSpinBox *m_trackSpin;
    KIntSpinBox *m_yearSpin;
    KLineEdit *m_lengthBox;
    KLineEdit *m_bitrateBox;
    KEdit *m_commentBox;

95 96
    QValueList<QWidget *> m_hideList;

97
    PlaylistItemList m_items;
98
    Playlist *m_currentPlaylist;
99
    
100
    bool m_dataChanged;
101 102 103
};

#endif