Put wiimotedev sources in OTHER_SOURCES, small code cleanups

This commit is contained in:
Bartłomiej Burdukiewicz 2010-08-29 16:24:19 +00:00
parent 5873fe80a6
commit 3e658288af
5 changed files with 19 additions and 16 deletions

View File

@ -310,6 +310,8 @@ set(UI
ui/organisedialog.ui
ui/organiseerrordialog.ui
ui/settingsdialog.ui
ui/wiimotedevshortcutsconfig.ui
ui/wiimotedevshortcutgrabber.ui
widgets/equalizerslider.ui
widgets/errordialog.ui
@ -491,11 +493,11 @@ if(NOT APPLE AND NOT WIN32)
list(APPEND SOURCES ui/wiimotedevshortcutgrabber.cpp)
list(APPEND HEADERS ui/wiimotedevshortcutgrabber.h)
list(APPEND UI ui/wiimotedevshortcutgrabber.ui)
list(APPEND SOURCES ui/wiimotedevshortcutsconfig.cpp)
list(APPEND HEADERS ui/wiimotedevshortcutsconfig.h)
list(APPEND UI ui/wiimotedevshortcutsconfig.ui)
endif(ENABLE_WIIMOTEDEV)
# DeviceKit lister source
@ -607,7 +609,12 @@ list(APPEND OTHER_SOURCES
devices/wmdmloader.cpp
ui/macsystemtrayicon.h
ui/macsystemtrayicon.mm
ui/wiimotedevshortcutsconfig.cpp
ui/wiimotedevshortcutsconfig.h
ui/wiimotedevshortcutgrabber.cpp
ui/wiimotedevshortcutgrabber.h
${CMAKE_CURRENT_BINARY_DIR}/ui_wiimotedevshortcutsconfig.h
${CMAKE_CURRENT_BINARY_DIR}/ui_wiimotedevshortcutgrabber.h
widgets/osd_mac.mm
widgets/osd_win.cpp
widgets/osd_x11.cpp

View File

@ -20,10 +20,10 @@
#include "ui/wiimotedevshortcutsconfig.h"
WiimotedevShortcutGrabber::WiimotedevShortcutGrabber(WiimotedevShortcutsConfig* config, QWidget *parent)
WiimotedevShortcutGrabber::WiimotedevShortcutGrabber(QWidget *parent)
: QDialog(parent),
ui_(new Ui_WiimotedevShortcutGrabber),
config(config),
config_(qobject_cast<WiimotedevShortcutsConfig*>(parent)),
wiimotedev_device_(1),
wiimotedev_buttons_(0)
{
@ -37,11 +37,9 @@ WiimotedevShortcutGrabber::WiimotedevShortcutGrabber(WiimotedevShortcutsConfig*
connect(wiimotedev_iface_, SIGNAL(dbusWiimoteGeneralButtons(quint32,quint64)),
this, SLOT(DbusWiimoteGeneralButtons(quint32, quint64)));
QMapIterator <quint32, QString> iter(config->text_actions_);
while (iter.hasNext()) {
iter.next();
ui_->comboBox->addItem(iter.value());
}
foreach (const QString& name, config_->text_actions_.values())
ui_->comboBox->addItem(name);
}
WiimotedevShortcutGrabber::~WiimotedevShortcutGrabber() {
@ -54,7 +52,7 @@ void WiimotedevShortcutGrabber::DbusWiimoteGeneralButtons(quint32 id, quint64 va
quint64 buttons = value & ~(WIIMOTE_TILT_MASK | NUNCHUK_TILT_MASK);
if (wiimotedev_buttons_ == buttons) return;
ui_->combo->setText(config->GetReadableWiiremoteSequence(buttons));
ui_->combo->setText(config_->GetReadableWiiremoteSequence(buttons));
wiimotedev_buttons_ = buttons;
}

View File

@ -27,7 +27,7 @@ class WiimotedevShortcutGrabber : public QDialog {
Q_OBJECT
public:
WiimotedevShortcutGrabber(WiimotedevShortcutsConfig* config = 0, QWidget* parent = 0);
WiimotedevShortcutGrabber(QWidget* parent = 0);
~WiimotedevShortcutGrabber();
private slots:
@ -35,7 +35,7 @@ class WiimotedevShortcutGrabber : public QDialog {
private:
Ui_WiimotedevShortcutGrabber* ui_;
WiimotedevShortcutsConfig* config;
WiimotedevShortcutsConfig* config_;
DBusDeviceEventsInterface* wiimotedev_iface_;
quint32 wiimotedev_device_;
quint64 wiimotedev_buttons_;

View File

@ -196,9 +196,8 @@ QString WiimotedevShortcutsConfig::GetReadableWiiremoteSequence(quint64 value) {
}
void WiimotedevShortcutsConfig::AddAction() {
grabber = new WiimotedevShortcutGrabber(this, this);
grabber->exec();
delete grabber;
WiimotedevShortcutGrabber grabber(this);
grabber.exec();
}
void WiimotedevShortcutsConfig::DeleteAction() {

View File

@ -43,7 +43,6 @@ public:
QString GetReadableWiiremoteSequence(quint64 value);
private:
WiimotedevShortcutGrabber *grabber;
QSettings settings_;
QString current_id_;