summaryrefslogtreecommitdiffstats
path: root/amarok/src/mediumpluginmanager.h
blob: a367596f3df78dd67a07400b69aafffabf30cfac (plain)
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
//
// C++ Interface: mediumpluginmanager
//
// Description:
//
//
// Author: Jeff Mitchell <kde-dev@emailgoeshere.com>, (C) 2005
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef MEDIUMPLUGINMANAGER_H
#define MEDIUMPLUGINMANAGER_H

#include "amarok.h"
#include "hintlineedit.h"
#include "plugin/pluginconfig.h"

#include <tqlayout.h>
#include <tqmap.h>
#include <tqhbox.h>

#include <tdeconfig.h>
#include <kdialogbase.h>
#include <tdelocale.h>

class TQButton;
class TQGroupBox;
class TQLabel;
class TQSignalMapper;
class TQVBox;
class KComboBox;
class KLineEdit;
class Medium;
class MediumPluginManager;

typedef TQMap<TQString, Medium*> DeletedMap;

/**
    @author Jeff Mitchell <kde-dev@emailgoeshere.com>
    @author Martin Aumueller <aumuell@reserv.at>
*/

class MediaDeviceConfig : public TQHBox
{
    Q_OBJECT
  

    public:
        MediaDeviceConfig( Medium *medium, MediumPluginManager *mgr, const bool nographics=false, TQWidget *parent=0, const char *name=0 );
        ~MediaDeviceConfig();
        TQString oldPlugin();
        void setOldPlugin( const TQString &oldPlugin );
        TQString plugin();
        KComboBox *pluginCombo();
        TQButton *configButton();
        TQButton *removeButton();
        Medium *medium();
        bool isNew();

    public slots:
        void configureDevice();
        void deleteDevice();

    signals:
        void deleteMedium( Medium *medium );
        void changed();

    protected:
        MediumPluginManager *m_manager;
        Medium *m_medium;
        TQString m_oldPlugin;
        KComboBox * m_pluginCombo;
        TQButton *m_configButton;
        TQButton *m_removeButton;
        bool m_new;
};

typedef TQValueList<MediaDeviceConfig *> DeviceList;

class MediumPluginManager : public TQObject
{
    Q_OBJECT
  

    friend class DeviceManager;

    public:
        //nographics only for the initial run of detectDevices...pass in
        //directly to detectDevices after
        MediumPluginManager( TQWidget *widget, const bool nographics=false );
        ~MediumPluginManager();
        void finished();
        bool hasChanged();

    signals:
        void selectedPlugin( const Medium*, const TQString );
        void changed();

    public slots:
        void redetectDevices();
        void newDevice();
        void deleteMedium( Medium *medium );
        void slotChanged();

    private:
        bool detectDevices( bool redetect=false, bool nographics=false );
        DeletedMap m_deletedMap;
        DeviceList m_deviceList;
        TQWidget *m_widget;
        bool m_hasChanged;

};

class MediumPluginManagerDialog : public KDialogBase
{
    Q_OBJECT
  

    public:
        MediumPluginManagerDialog();
        ~MediumPluginManagerDialog();

    private slots:
        void slotOk();

    private:

        TQVBox *m_devicesBox;
        TQGroupBox *m_location;
        MediumPluginManager *m_manager;
};

class ManualDeviceAdder : public KDialogBase
{
    Q_OBJECT
  

    public:
        ManualDeviceAdder( MediumPluginManager* mdm );
        ~ManualDeviceAdder();
        bool successful() const { return m_successful; }
        Medium* getMedium( bool recreate = false );
        TQString getPlugin() const { return m_selectedPlugin; }

    private slots:
        void slotCancel();
        void slotOk();
        void comboChanged( const TQString & );

    private:
        MediumPluginManager* m_mpm;
        bool m_successful;
        TQString m_comboOldText;
        TQString m_selectedPlugin;
        Medium *m_newMed;

        KComboBox* m_mdaCombo;
        HintLineEdit* m_mdaName;
        HintLineEdit* m_mdaMountPoint;
};

#endif