~ubuntu-branches/ubuntu/natty/kdemultimedia/natty-proposed

« back to all changes in this revision

Viewing changes to kmix/dialogviewconfiguration.h

  • Committer: Bazaar Package Importer
  • Author(s): Debian Qt/KDE Maintainers
  • Date: 2011-05-26 02:41:36 UTC
  • mfrom: (0.2.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 108.
  • Revision ID: james.westby@ubuntu.com-20110526024136-jjwsigfy402jhupm
Tags: upstream-4.6.3
ImportĀ upstreamĀ versionĀ 4.6.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//-*-C++-*-
2
 
/*
3
 
 * KMix -- KDE's full featured mini mixer
4
 
 *
5
 
 * Copyright Christian Esken <esken@kde.org>
6
 
 *
7
 
 * This program is free software; you can redistribute it and/or
8
 
 * modify it under the terms of the GNU Library General Public
9
 
 * License as published by the Free Software Foundation; either
10
 
 * version 2 of the License, or (at your option) any later version.
11
 
 *
12
 
 * This program is distributed in the hope that it will be useful,
13
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 
 * Library General Public License for more details.
16
 
 *
17
 
 * You should have received a copy of the GNU Library General Public
18
 
 * License along with this program; if not, write to the Free
19
 
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20
 
 */
21
 
#ifndef DIALOGVIEWCONFIGURATION_H
22
 
#define DIALOGVIEWCONFIGURATION_H
23
 
 
24
 
// QT
25
 
#include <QCheckBox>
26
 
class QLabel;
27
 
#include <QGridLayout>
28
 
class QHBoxLayout;
29
 
#include <qlist.h>
30
 
#include <QListWidget>
31
 
class QScrollArea;
32
 
class QVBoxLayout;
33
 
 
34
 
// QT DND
35
 
#include <QDragEnterEvent>
36
 
#include <QMimeData>
37
 
 
38
 
// KDE
39
 
#include <kdebug.h>
40
 
#include <kdialog.h>
41
 
 
42
 
// KMix
43
 
#include "guiprofile.h"
44
 
#include "viewbase.h"
45
 
 
46
 
class DialogViewConfigurationItem : public QListWidgetItem
47
 
{
48
 
 friend class QDataStream;
49
 
 
50
 
 
51
 
 public:
52
 
    DialogViewConfigurationItem( QListWidget *parent);
53
 
    DialogViewConfigurationItem( QListWidget *parent, QString id, bool shown, QString name, int splitted, const QString& iconName );
54
 
 
55
 
    void refreshItem();
56
 
 public:
57
 
    QString _id;
58
 
    bool _shown;
59
 
    QString _name;
60
 
    int _splitted;
61
 
    QString _iconName;
62
 
};
63
 
 
64
 
class DialogViewConfigurationWidget : public QListWidget
65
 
{
66
 
    Q_OBJECT
67
 
public:
68
 
    DialogViewConfigurationWidget(QWidget *parent=0);
69
 
 
70
 
    void setActiveList(bool isActiveList) {
71
 
        m_activeList = isActiveList;
72
 
    }
73
 
    bool isActiveList() const { return m_activeList; };
74
 
 
75
 
 Q_SIGNALS:
76
 
   void dropped(DialogViewConfigurationWidget* list, int index, DialogViewConfigurationItem* item, bool sourceIsActiveList);
77
 
 
78
 
protected:
79
 
    virtual QMimeData* mimeData(const QList<QListWidgetItem*> items) const;
80
 
    virtual bool dropMimeData(int index, const QMimeData * mimeData, Qt::DropAction action);
81
 
 
82
 
    virtual Qt::DropActions supportedDropActions() const
83
 
    {
84
 
        //kDebug() << "supportedDropActions!";
85
 
        return Qt::MoveAction;
86
 
    }
87
 
    virtual QStringList mimeTypes() const
88
 
    {
89
 
        //kDebug() << "mimeTypes!";
90
 
        return QStringList() << "application/x-kde-action-list";
91
 
    }
92
 
 
93
 
    // Skip internal dnd handling in QListWidget ---- how is one supposed to figure this out
94
 
    // without reading the QListWidget code !?
95
 
    virtual void dropEvent(QDropEvent* ev) {
96
 
        QAbstractItemView::dropEvent(ev);
97
 
    }
98
 
 
99
 
private:
100
 
    bool m_activeList;
101
 
};
102
 
 
103
 
 
104
 
class DialogViewConfiguration : public KDialog
105
 
{
106
 
    Q_OBJECT
107
 
 public:
108
 
    DialogViewConfiguration(QWidget* parent, ViewBase& view);
109
 
    ~DialogViewConfiguration();
110
 
 
111
 
 
112
 
  //  QSize sizeHint() const;
113
 
 public slots:
114
 
    void apply();
115
 
 
116
 
 private slots:
117
 
   void slotDropped(DialogViewConfigurationWidget* list, int index, DialogViewConfigurationItem* item, bool sourceIsActiveList );
118
 
 
119
 
 private:
120
 
    //void dragEnterEvent(QDragEnterEvent *event);
121
 
    void prepareControls(QAbstractItemModel* model, bool isActiveView, GUIProfile::ControlSet& oldCtlSet, GUIProfile::ControlSet& newCtlSet);
122
 
    void createPage();
123
 
    QVBoxLayout* _layout;
124
 
    ViewBase&    _view;
125
 
    //QWidget* vboxForScrollView;
126
 
    //QGridLayout* grid;
127
 
    QWidget * frame;
128
 
    //QHBoxLayout *_hlayout;
129
 
    QGridLayout *_glayout;
130
 
 
131
 
    //QScrollArea* scrollArea;
132
 
    QLabel* qlb;
133
 
//     QList<QCheckBox *>  _qEnabledCB;
134
 
//     QList<QCheckBox *>  _qSplitCB;
135
 
//     QList<QCheckBox *>  _qLimitCB;
136
 
    DialogViewConfigurationWidget *_qlw;
137
 
    DialogViewConfigurationWidget *_qlwInactive;
138
 
};
139
 
 
140
 
 
141
 
 
142
 
#endif