| 1 |
/****************************************************************************** |
| 2 |
* Copyright (c) 2005 Jeff Mitchell <kde-dev@emailgoeshere.com> * |
| 3 |
* * |
| 4 |
* This program is free software; you can redistribute it and/or * |
| 5 |
* modify it under the terms of the GNU General Public License as * |
| 6 |
* published by the Free Software Foundation; either version 2 of * |
| 7 |
* the License, or (at your option) any later version. * |
| 8 |
* * |
| 9 |
* This program is distributed in the hope that it will be useful, * |
| 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 12 |
* GNU General Public License for more details. * |
| 13 |
* * |
| 14 |
* You should have received a copy of the GNU General Public License * |
| 15 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. * |
| 16 |
******************************************************************************/ |
| 17 |
|
| 18 |
#ifndef MEDIADEVICEPLUGINMANAGER_H |
| 19 |
#define MEDIADEVICEPLUGINMANAGER_H |
| 20 |
|
| 21 |
#include "Amarok.h" |
| 22 |
#include "hintlineedit.h" |
| 23 |
#include "plugin/pluginconfig.h" |
| 24 |
|
| 25 |
|
| 26 |
#include <KHBox> |
| 27 |
#include <KComboBox> |
| 28 |
#include <KLocale> |
| 29 |
#include <KDialog> |
| 30 |
|
| 31 |
#include <QLayout> |
| 32 |
#include <QMap> |
| 33 |
#include <QLabel> |
| 34 |
|
| 35 |
class QAbstractButton; |
| 36 |
class QGroupBox; |
| 37 |
class QLabel; |
| 38 |
class QTableWidget; |
| 39 |
class KVBox; |
| 40 |
class MediaDevice; |
| 41 |
|
| 42 |
/** |
| 43 |
@author Jeff Mitchell <kde-dev@emailgoeshere.com> |
| 44 |
@author Martin Aumueller <aumuell@reserv.at> |
| 45 |
*/ |
| 46 |
|
| 47 |
class MediaDeviceConfig : public KHBox |
| 48 |
{ |
| 49 |
Q_OBJECT |
| 50 |
|
| 51 |
public: |
| 52 |
explicit MediaDeviceConfig( QString id, QWidget *parent=0, const char *name=0 ); |
| 53 |
~MediaDeviceConfig(); |
| 54 |
QString oldPlugin() { return m_oldPlugin; } |
| 55 |
void setOldPlugin( const QString &oldPlugin ) { m_oldPlugin = oldPlugin; } |
| 56 |
QString plugin(); |
| 57 |
KComboBox* pluginCombo() { return m_pluginCombo; } |
| 58 |
QAbstractButton *removeButton() { return m_removeButton; } |
| 59 |
QString udi() { return m_udi; } |
| 60 |
bool isNew() { return m_new; } |
| 61 |
|
| 62 |
public slots: |
| 63 |
void slotConfigureDevice(); |
| 64 |
void slotDeleteDevice(); |
| 65 |
void slotDetailsActivated( const QString & link ); |
| 66 |
|
| 67 |
signals: |
| 68 |
void changed(); |
| 69 |
void deleteDevice( const QString & ); |
| 70 |
|
| 71 |
protected: |
| 72 |
QString m_udi; |
| 73 |
QString m_name; |
| 74 |
QString m_oldPlugin; |
| 75 |
QString m_details; |
| 76 |
KComboBox* m_pluginCombo; |
| 77 |
QAbstractButton *m_removeButton; |
| 78 |
QLabel* m_label_details; |
| 79 |
bool m_new; |
| 80 |
}; |
| 81 |
|
| 82 |
class MediaDevicePluginManager : public QObject |
| 83 |
{ |
| 84 |
Q_OBJECT |
| 85 |
|
| 86 |
public: |
| 87 |
explicit MediaDevicePluginManager( QWidget *widget ); |
| 88 |
~MediaDevicePluginManager(); |
| 89 |
void finished(); |
| 90 |
|
| 91 |
signals: |
| 92 |
void selectedPlugin( const QString &, const QString & ); |
| 93 |
|
| 94 |
public slots: |
| 95 |
void slotAddDevice( const QString &udi ); |
| 96 |
void slotDeleteDevice( const QString &udi ); |
| 97 |
void slotGenericVolumes(); |
| 98 |
void slotNewDevice(); |
| 99 |
void slotSolidDeviceAdded( const QString &udi ); |
| 100 |
void slotSolidDeviceRemoved( const QString &udi ); |
| 101 |
|
| 102 |
private: |
| 103 |
bool detectDevices(); |
| 104 |
QStringList m_deletedList; |
| 105 |
QList<MediaDeviceConfig*> m_deviceList; |
| 106 |
QWidget *m_widget; |
| 107 |
|
| 108 |
}; |
| 109 |
|
| 110 |
class MediaDevicePluginManagerDialog : public KDialog |
| 111 |
{ |
| 112 |
Q_OBJECT |
| 113 |
|
| 114 |
public: |
| 115 |
MediaDevicePluginManagerDialog(); |
| 116 |
~MediaDevicePluginManagerDialog(); |
| 117 |
|
| 118 |
private slots: |
| 119 |
void slotOk(); |
| 120 |
|
| 121 |
private: |
| 122 |
KPushButton* m_genericDevices; |
| 123 |
KPushButton* m_addButton; |
| 124 |
KVBox *m_devicesBox; |
| 125 |
QGroupBox *m_location; |
| 126 |
MediaDevicePluginManager *m_manager; |
| 127 |
}; |
| 128 |
|
| 129 |
class ManualDeviceAdder : public KDialog |
| 130 |
{ |
| 131 |
Q_OBJECT |
| 132 |
|
| 133 |
public: |
| 134 |
ManualDeviceAdder(); |
| 135 |
~ManualDeviceAdder(); |
| 136 |
bool successful() const { return m_successful; } |
| 137 |
QString getId( bool recreate = false ); |
| 138 |
QString getPlugin() const { return m_selectedPlugin; } |
| 139 |
|
| 140 |
private slots: |
| 141 |
void slotButtonClicked( int button ); |
| 142 |
void slotComboChanged( const QString & ); |
| 143 |
|
| 144 |
private: |
| 145 |
bool m_successful; |
| 146 |
QString m_mountPointOldText; |
| 147 |
QString m_selectedPlugin; |
| 148 |
QString m_newId; |
| 149 |
|
| 150 |
KComboBox* m_mdaCombo; |
| 151 |
HintLineEdit* m_mdaName; |
| 152 |
HintLineEdit* m_mdaMountPoint; |
| 153 |
}; |
| 154 |
|
| 155 |
class MediaDeviceVolumeMarkerDialog : public KDialog |
| 156 |
{ |
| 157 |
Q_OBJECT |
| 158 |
|
| 159 |
public: |
| 160 |
MediaDeviceVolumeMarkerDialog(); |
| 161 |
~MediaDeviceVolumeMarkerDialog(); |
| 162 |
const QStringList getAddedList() const { return m_addedList; } |
| 163 |
const QStringList getRemovedList() const { return m_removedList; } |
| 164 |
|
| 165 |
private slots: |
| 166 |
void slotOk(); |
| 167 |
|
| 168 |
private: |
| 169 |
KVBox *m_mountPointBox; |
| 170 |
QStringList m_addedList; |
| 171 |
QStringList m_removedList; |
| 172 |
QTableWidget *m_table; |
| 173 |
}; |
| 174 |
|
| 175 |
#endif |