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

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

21 22
#include <qvaluelist.h>
#include <qwidget.h>
23

24 25 26 27
class KComboBox;
class KLineEdit;
class KIntSpinBox;
class KEdit;
28
class KPushButton;
29
class KConfig;
30

31 32 33
class QCheckBox;
class QBoxLayout;

34
class Playlist;
Scott Wheeler's avatar
Scott Wheeler committed
35 36 37
class PlaylistItem;
typedef QValueList<PlaylistItem *> PlaylistItemList;

38 39 40 41 42 43 44
class TagEditor : public QWidget
{
    Q_OBJECT

public: 
    TagEditor(QWidget *parent = 0, const char *name = 0);
    virtual ~TagEditor();
45
    void save() { save(m_items); }
46
    PlaylistItemList items() const { return m_items; }
47 48

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

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

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

75
private slots:
76
    void slotDataChanged(bool c = true);
77
    void slotItemRemoved(PlaylistItem *item);
78 79

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

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

    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;

96 97
    QValueList<QWidget *> m_hideList;

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

#endif