mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 10:22:49 +00:00
generic: adjust to solid changes
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
e61b0b20f7
commit
ff715bee6b
12 changed files with 0 additions and 162 deletions
|
@ -28,7 +28,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include <kpluginloader.h>
|
||||
#include <ktoolinvocation.h>
|
||||
#include <solid/powermanagement.h>
|
||||
#include <solid/button.h>
|
||||
#include <solid/device.h>
|
||||
|
||||
#include <qprocess.h>
|
||||
|
|
|
@ -90,8 +90,6 @@ QTreeWidgetItem *DeviceListing::createListItems(const Solid::DeviceInterface::Ty
|
|||
return new SolCameraDevice(type);
|
||||
case Solid::DeviceInterface::PortableMediaPlayer:
|
||||
return new SolMediaPlayerDevice(type);
|
||||
case Solid::DeviceInterface::Button:
|
||||
return new SolButtonDevice(type);
|
||||
case Solid::DeviceInterface::Battery:
|
||||
return new SolBatteryDevice(type);
|
||||
case Solid::DeviceInterface::AcAdapter:
|
||||
|
@ -115,7 +113,6 @@ void DeviceListing::populateListing(const show showStatus)
|
|||
Solid::DeviceInterface::NetworkInterface,
|
||||
Solid::DeviceInterface::AudioInterface,
|
||||
Solid::DeviceInterface::Video,
|
||||
Solid::DeviceInterface::Button,
|
||||
Solid::DeviceInterface::Battery,
|
||||
Solid::DeviceInterface::AcAdapter,
|
||||
Solid::DeviceInterface::PortableMediaPlayer,
|
||||
|
@ -188,8 +185,6 @@ void DeviceListing::deviceAddedSlot(const QString udi)
|
|||
new SolCameraDevice(deviceMap[deviceType],dev); break;
|
||||
case Solid::DeviceInterface::PortableMediaPlayer:
|
||||
new SolMediaPlayerDevice(deviceMap[deviceType],dev); break;
|
||||
case Solid::DeviceInterface::Button:
|
||||
new SolButtonDevice(deviceMap[deviceType],dev); break;
|
||||
case Solid::DeviceInterface::Battery:
|
||||
new SolBatteryDevice(deviceMap[deviceType],dev); break;
|
||||
case Solid::DeviceInterface::AcAdapter:
|
||||
|
|
|
@ -76,12 +76,6 @@ void SolDevice::setDefaultDeviceText()
|
|||
if (!label.isEmpty()) {
|
||||
ddtString = label;
|
||||
}
|
||||
} else if(tiedDevice.isDeviceInterface(Solid::DeviceInterface::Button) && ddtString.isEmpty()) {
|
||||
// button that is not on keyboard for example does not have product/vendor
|
||||
QString label = SolDevice::udi().section("/", -1, -1);
|
||||
if (!label.isEmpty()) {
|
||||
ddtString = label;
|
||||
}
|
||||
}
|
||||
}
|
||||
setText(0,ddtString);
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include <solid/storagevolume.h>
|
||||
#include <solid/storageaccess.h>
|
||||
#include <solid/audiointerface.h>
|
||||
#include <solid/button.h>
|
||||
#include <solid/portablemediaplayer.h>
|
||||
#include <solid/camera.h>
|
||||
#include <solid/battery.h>
|
||||
|
|
|
@ -487,68 +487,6 @@ QVListLayout *SolAudioDevice::infoPanelLayout()
|
|||
return deviceInfoLayout;
|
||||
}
|
||||
|
||||
// Button
|
||||
|
||||
SolButtonDevice::SolButtonDevice(QTreeWidgetItem *parent, const Solid::Device &device) :
|
||||
SolDevice(parent, device)
|
||||
{
|
||||
deviceTypeHolder = Solid::DeviceInterface::Button;
|
||||
|
||||
setDefaultDeviceIcon();
|
||||
}
|
||||
|
||||
SolButtonDevice::SolButtonDevice(const Solid::DeviceInterface::Type &type) :
|
||||
SolDevice(type)
|
||||
{
|
||||
deviceTypeHolder = Solid::DeviceInterface::Button;
|
||||
|
||||
setDeviceIcon(KIcon("insert-button"));
|
||||
setDeviceText(i18n("Device Buttons"));
|
||||
setDefaultListing(type);
|
||||
}
|
||||
|
||||
void SolButtonDevice::setDefaultListing(const Solid::DeviceInterface::Type &type)
|
||||
{
|
||||
createDeviceChildren<SolButtonDevice>(this,QString(),type);
|
||||
}
|
||||
|
||||
void SolButtonDevice::setDefaultDeviceIcon()
|
||||
{
|
||||
setDeviceIcon(KIcon("insert-button"));
|
||||
}
|
||||
|
||||
QVListLayout *SolButtonDevice::infoPanelLayout()
|
||||
{
|
||||
QStringList labels;
|
||||
const Solid::Button *butdev = interface<const Solid::Button>();
|
||||
|
||||
if(!butdev) return NULL;
|
||||
deviceInfoLayout = new QVListLayout();
|
||||
|
||||
QString type;
|
||||
switch(butdev->type())
|
||||
{
|
||||
case Solid::Button::LidButton:
|
||||
type = i18n("Lid Button"); break;
|
||||
case Solid::Button::PowerButton:
|
||||
type = i18n("Power Button"); break;
|
||||
case Solid::Button::SleepButton:
|
||||
type = i18n("Sleep Button"); break;
|
||||
case Solid::Button::TabletButton:
|
||||
type = i18n("Tablet Button"); break;
|
||||
default:
|
||||
type = i18n("Unknown Button");
|
||||
}
|
||||
|
||||
labels << i18n("Button type: ")
|
||||
<< type
|
||||
<< i18n("Has State?")
|
||||
<< InfoPanel::convertTf(butdev->hasState());
|
||||
|
||||
deviceInfoLayout->applyQListToLayout(labels);
|
||||
return deviceInfoLayout;
|
||||
}
|
||||
|
||||
// Media Player
|
||||
|
||||
SolMediaPlayerDevice::SolMediaPlayerDevice(QTreeWidgetItem *parent, const Solid::Device &device) :
|
||||
|
|
|
@ -100,18 +100,6 @@ class SolAudioDevice : public SolDevice
|
|||
SolDevice *ossSubItem;
|
||||
};
|
||||
|
||||
class SolButtonDevice : public SolDevice
|
||||
{
|
||||
public:
|
||||
SolButtonDevice(const Solid::DeviceInterface::Type &);
|
||||
SolButtonDevice(QTreeWidgetItem *, const Solid::Device &);
|
||||
QVListLayout *infoPanelLayout();
|
||||
|
||||
private:
|
||||
void setDefaultDeviceIcon();
|
||||
void setDefaultListing(const Solid::DeviceInterface::Type &);
|
||||
};
|
||||
|
||||
class SolMediaPlayerDevice : public SolDevice
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -30,7 +30,6 @@ Solid::DeviceInterface::Type SolidHelper::deviceType(const Solid::Device *dev)
|
|||
Solid::DeviceInterface::NetworkInterface,
|
||||
Solid::DeviceInterface::AudioInterface,
|
||||
Solid::DeviceInterface::Video,
|
||||
Solid::DeviceInterface::Button,
|
||||
Solid::DeviceInterface::Battery,
|
||||
Solid::DeviceInterface::AcAdapter,
|
||||
Solid::DeviceInterface::PortableMediaPlayer,
|
||||
|
|
|
@ -42,21 +42,6 @@ void DeviceSignalMapManager::mapDevice(Solid::AcAdapter *ac, const QString &udi)
|
|||
map->setMapping(ac, udi);
|
||||
}
|
||||
|
||||
void DeviceSignalMapManager::mapDevice(Solid::Button *button, const QString &udi)
|
||||
{
|
||||
ButtonSignalMapper *map=0;
|
||||
if (!signalmap.contains(Solid::DeviceInterface::Button)) {
|
||||
map = new ButtonSignalMapper(this);
|
||||
signalmap[Solid::DeviceInterface::Button] = map;
|
||||
connect(map, SIGNAL(deviceChanged(QString,QString,QVariant)), user, SLOT(deviceChanged(QString,QString,QVariant)));
|
||||
} else {
|
||||
map = (ButtonSignalMapper*)signalmap[Solid::DeviceInterface::Button];
|
||||
}
|
||||
|
||||
connect(button, SIGNAL(pressed(Solid::Button::ButtonType,QString)), map, SLOT(pressed(Solid::Button::ButtonType)));
|
||||
map->setMapping(button, udi);
|
||||
}
|
||||
|
||||
void DeviceSignalMapManager::mapDevice(Solid::Battery *battery, const QString &udi)
|
||||
{
|
||||
BatterySignalMapper *map=0;
|
||||
|
@ -102,16 +87,6 @@ void DeviceSignalMapManager::unmapDevice(Solid::AcAdapter *ac)
|
|||
disconnect(map, SIGNAL(deviceChanged(QString,QString,QVariant)), user, SLOT(deviceChanged(QString,QString,QVariant)));
|
||||
}
|
||||
|
||||
void DeviceSignalMapManager::unmapDevice(Solid::Button *button)
|
||||
{
|
||||
ButtonSignalMapper *map = (ButtonSignalMapper*)signalmap.value(Solid::DeviceInterface::Button);
|
||||
if (!map) {
|
||||
return;
|
||||
}
|
||||
|
||||
disconnect(button, SIGNAL(pressed(Solid::Button::ButtonType,QString)), map, SLOT(pressed(Solid::Button::ButtonType)));
|
||||
}
|
||||
|
||||
void DeviceSignalMapManager::unmapDevice(Solid::Battery *battery)
|
||||
{
|
||||
BatterySignalMapper *map = (BatterySignalMapper*)signalmap.value(Solid::DeviceInterface::Battery);
|
||||
|
|
|
@ -32,12 +32,10 @@ class DeviceSignalMapManager : public QObject
|
|||
~DeviceSignalMapManager();
|
||||
|
||||
void mapDevice(Solid::AcAdapter *ac, const QString &udi);
|
||||
void mapDevice(Solid::Button *button, const QString &udi);
|
||||
void mapDevice(Solid::Battery *battery, const QString &udi);
|
||||
void mapDevice(Solid::StorageAccess *storageaccess, const QString &udi);
|
||||
|
||||
void unmapDevice(Solid::AcAdapter *ac);
|
||||
void unmapDevice(Solid::Button *button);
|
||||
void unmapDevice(Solid::Battery *battery);
|
||||
void unmapDevice(Solid::StorageAccess *storageaccess);
|
||||
|
||||
|
|
|
@ -44,21 +44,6 @@ void AcAdapterSignalMapper::plugStateChanged(bool newState)
|
|||
emit deviceChanged(signalmap[sender()], "Plugged In", newState);
|
||||
}
|
||||
|
||||
|
||||
ButtonSignalMapper::ButtonSignalMapper(QObject *parent) : DeviceSignalMapper(parent)
|
||||
{
|
||||
}
|
||||
|
||||
ButtonSignalMapper::~ButtonSignalMapper()
|
||||
{
|
||||
}
|
||||
|
||||
void ButtonSignalMapper::pressed(Solid::Button::ButtonType type)
|
||||
{
|
||||
Q_UNUSED(type)
|
||||
emit deviceChanged(signalmap[sender()], "Pressed", true);
|
||||
}
|
||||
|
||||
BatterySignalMapper::BatterySignalMapper(QObject *parent) : DeviceSignalMapper(parent)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#include <solid/networkinterface.h>
|
||||
#include <solid/acadapter.h>
|
||||
#include <solid/battery.h>
|
||||
#include <solid/button.h>
|
||||
#include <solid/audiointerface.h>
|
||||
#include <solid/video.h>
|
||||
#include <solid/graphic.h>
|
||||
|
@ -74,18 +73,6 @@ class AcAdapterSignalMapper : public DeviceSignalMapper
|
|||
void plugStateChanged(bool newState);
|
||||
};
|
||||
|
||||
class ButtonSignalMapper : public DeviceSignalMapper
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ButtonSignalMapper(QObject *parent=0);
|
||||
~ButtonSignalMapper();
|
||||
|
||||
public Q_SLOTS:
|
||||
void pressed(Solid::Button::ButtonType type);
|
||||
};
|
||||
|
||||
class BatterySignalMapper : public DeviceSignalMapper
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
|
@ -437,25 +437,6 @@ bool SolidDeviceEngine::populateDeviceData(const QString &name)
|
|||
|
||||
m_signalmanager->mapDevice(battery, device.udi());
|
||||
}
|
||||
if (device.is<Solid::Button>()) {
|
||||
Solid::Button *button = device.as<Solid::Button>();
|
||||
if (!button) {
|
||||
return false;
|
||||
}
|
||||
|
||||
devicetypes << I18N_NOOP("Button");
|
||||
|
||||
QStringList buttontype;
|
||||
buttontype << I18N_NOOP("Lid Button") << I18N_NOOP("Power Button") << I18N_NOOP("Sleep Button")
|
||||
<< I18N_NOOP("Unknown Button Type") << I18N_NOOP("Tablet Button");
|
||||
|
||||
setData(name, I18N_NOOP("Type"), buttontype.at((int)button->type()));
|
||||
setData(name, I18N_NOOP("Has State"), button->hasState());
|
||||
setData(name, I18N_NOOP("State Value"), button->stateValue());
|
||||
setData(name, I18N_NOOP("Pressed"), false); //this is an extra value that is tracked by the button signals
|
||||
|
||||
m_signalmanager->mapDevice(button, device.udi());
|
||||
}
|
||||
if (device.is<Solid::AudioInterface>()) {
|
||||
Solid::AudioInterface *audiointerface = device.as<Solid::AudioInterface>();
|
||||
if (!audiointerface) {
|
||||
|
|
Loading…
Add table
Reference in a new issue