Insert QDBusConnection::systemBus().isConnected() checks

This commit is contained in:
Bartłomiej Burdukiewicz 2010-08-29 17:19:59 +00:00
parent 2881b6b6b2
commit eae74f6ad8
2 changed files with 17 additions and 12 deletions

View File

@ -28,14 +28,16 @@ WiimotedevShortcutGrabber::WiimotedevShortcutGrabber(QWidget *parent)
wiimotedev_buttons_(0)
{
ui_->setupUi(this);
wiimotedev_iface_ = new DBusDeviceEventsInterface(WIIMOTEDEV_DBUS_SERVICE_NAME,
WIIMOTEDEV_DBUS_EVENTS_OBJECT,
QDBusConnection::systemBus(),
this);
if (QDBusConnection::systemBus().isConnected()) {
wiimotedev_iface_ = new DBusDeviceEventsInterface(WIIMOTEDEV_DBUS_SERVICE_NAME,
WIIMOTEDEV_DBUS_EVENTS_OBJECT,
QDBusConnection::systemBus(),
this);
connect(wiimotedev_iface_, SIGNAL(dbusWiimoteGeneralButtons(quint32,quint64)),
this, SLOT(DbusWiimoteGeneralButtons(quint32, quint64)));
connect(wiimotedev_iface_, SIGNAL(dbusWiimoteGeneralButtons(quint32,quint64)),
this, SLOT(DbusWiimoteGeneralButtons(quint32, quint64)));
}
foreach (const QString& name, config_->text_actions_.values())
ui_->comboBox->addItem(name);

View File

@ -34,13 +34,16 @@ WiimotedevShortcuts::WiimotedevShortcuts(Player* player, QObject* parent)
wiimotedev_notification_(true)
{
ReloadSettings();
wiimotedev_iface_ = new DBusDeviceEventsInterface(WIIMOTEDEV_DBUS_SERVICE_NAME,
WIIMOTEDEV_DBUS_EVENTS_OBJECT,
QDBusConnection::systemBus(),
this);
connect(wiimotedev_iface_, SIGNAL(dbusWiimoteGeneralButtons(quint32,quint64)),
this, SLOT(DbusWiimoteGeneralButtons(quint32, quint64)));
if (QDBusConnection::systemBus().isConnected()) {
wiimotedev_iface_ = new DBusDeviceEventsInterface(WIIMOTEDEV_DBUS_SERVICE_NAME,
WIIMOTEDEV_DBUS_EVENTS_OBJECT,
QDBusConnection::systemBus(),
this);
connect(wiimotedev_iface_, SIGNAL(dbusWiimoteGeneralButtons(quint32,quint64)),
this, SLOT(DbusWiimoteGeneralButtons(quint32, quint64)));
}
}
void WiimotedevShortcuts::ReloadSettings() {