Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

tageditor.h 3.45 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>
Laurent Montel's avatar
Laurent Montel committed
20 21 22 23 24
//Added by qt3to4:
#include <QShowEvent>
#include <Q3ValueList>
#include <QEvent>
#include <QBoxLayout>
25

26 27 28
class KComboBox;
class KLineEdit;
class KIntSpinBox;
29
class KTextEdit;
30
class KPushButton;
Stephan Kulow's avatar
compile  
Stephan Kulow committed
31
class KConfigGroup;
32

33 34 35
class QCheckBox;
class QBoxLayout;

36
class Playlist;
Scott Wheeler's avatar
Scott Wheeler committed
37
class PlaylistItem;
Laurent Montel's avatar
Laurent Montel committed
38
typedef Q3ValueList<PlaylistItem *> PlaylistItemList;
Scott Wheeler's avatar
Scott Wheeler committed
39

40 41
class CollectionObserver;

42 43 44 45
class TagEditor : public QWidget
{
    Q_OBJECT

46
public:
Dirk Mueller's avatar
Dirk Mueller committed
47
    TagEditor(QWidget *parent = 0);
48
    virtual ~TagEditor();
49
    PlaylistItemList items() const { return m_items; }
50
    void setupObservers();
51 52

public slots:
53
    void slotSave() { save(m_items); }
54 55 56
    void slotSetItems(const PlaylistItemList &list);
    void slotRefresh();
    void slotClear();
57
    void slotPlaylistDestroyed(Playlist *p);
Scott Wheeler's avatar
Scott Wheeler committed
58 59 60 61
    /**
     * Update collection if we're visible, or defer otherwise
     */
    void slotUpdateCollection();
62

63
private:
Scott Wheeler's avatar
Scott Wheeler committed
64
    void updateCollection();
65

66
    void setupActions();
67 68
    void setupLayout();
    void readConfig();
Stephan Kulow's avatar
compile  
Stephan Kulow committed
69
    void readCompletionMode(const KConfigGroup &config, KComboBox *box, const QString &key);
70
    void saveConfig();
71
    void save(const PlaylistItemList &list);
72
    void saveChangesPrompt();
73 74 75 76
    /**
     * Adds an item to JuK's tagging layout.  This handles the creation and
     * placement of the "enable" box as well.
     */
77
    void addItem(const QString &text, QWidget *item, QBoxLayout *layout, const QString &iconName = QString());
78

79 80 81 82 83
    /**
     * Adds a widget to m_hideList and returns that widget.
     */
    QWidget *addHidden(QWidget *w) { m_hideList.append(w); return w; }

84
    virtual void showEvent(QShowEvent *e);
85 86
    virtual bool eventFilter(QObject *watched, QEvent *e);

87
private slots:
88
    void slotDataChanged(bool c = true);
89
    void slotItemRemoved(PlaylistItem *item);
90
    void slotPlaylistRemoved() { m_currentPlaylist = 0; }
91 92

private:
93
    typedef QMap<QWidget *, QCheckBox *> BoxMap;
94 95
    BoxMap m_enableBoxes;

96
    QStringList m_genreList;
97 98 99 100 101 102 103 104 105 106

    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;
107
    KTextEdit *m_commentBox;
108

Laurent Montel's avatar
Laurent Montel committed
109
    Q3ValueList<QWidget *> m_hideList;
110

111
    PlaylistItemList m_items;
112
    Playlist *m_currentPlaylist;
113

114 115
    CollectionObserver *m_observer;

116
    bool m_dataChanged;
117
    bool m_collectionChanged;
118
    bool m_performingSave;
119 120

    friend class CollectionObserver;
121 122 123
};

#endif
124 125

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