Code cleanups

This commit is contained in:
Bartłomiej Burdukiewicz 2010-08-31 23:17:38 +00:00
parent 0914c22b0f
commit 7dc36761e9
4 changed files with 9 additions and 17 deletions

View File

@ -20,7 +20,6 @@
WiimotedevShortcutGrabber::WiimotedevShortcutGrabber(quint32 action, QWidget *parent)
:QDialog(parent),
accepted_(false),
pref_action_(action),
ui_(new Ui_WiimotedevShortcutGrabber),
config_(qobject_cast<WiimotedevShortcutsConfig*>(parent)),
@ -63,8 +62,7 @@ WiimotedevShortcutGrabber::~WiimotedevShortcutGrabber() {
void WiimotedevShortcutGrabber::Timeout(int secs) {
if (secs == 0) {
pref_action_ = ui_->comboBox->currentIndex();
accepted_ = true;
emit AddShortcut(wiimotedev_buttons_, ui_->comboBox->currentIndex());
close();
}

View File

@ -32,18 +32,12 @@ public:
WiimotedevShortcutGrabber(quint32 action = 0, QWidget* parent = 0);
~WiimotedevShortcutGrabber();
bool IsAccepted() { return accepted_; }
quint32 GetActionValue() { return pref_action_; }
quint64 GetButtonsValue() { return wiimotedev_buttons_; }
private slots:
void DbusWiimoteGeneralButtons(uint id, qulonglong value);
void RememberSwingChecked(bool checked);
void Timeout(int);
private:
bool accepted_;
QTimeLine line_;
quint32 pref_action_;
@ -56,6 +50,9 @@ private:
quint64 remember_wiimote_shifts_;
quint64 remember_nunchuk_shifts_;
signals:
void AddShortcut(quint64 buttons, quint32 action);
};
#endif // WIIMOTEDEVSHORTCUTGRABBER_H

View File

@ -206,9 +206,8 @@ QString WiimotedevShortcutsConfig::GetReadableWiiremoteSequence(quint64 value) {
void WiimotedevShortcutsConfig::AddAction() {
emit SetWiimotedevInterfaceActived(false);
WiimotedevShortcutGrabber grabber(0, this);
connect(&grabber, SIGNAL(AddShortcut(quint64,quint32)), this, SLOT(AddShortcut(quint64,quint32)));
grabber.exec();
if (grabber.IsAccepted())
AddShortcut(grabber.GetButtonsValue(), grabber.GetActionValue());
emit SetWiimotedevInterfaceActived(true);
}

View File

@ -42,9 +42,6 @@ public:
QString GetReadableWiiremoteSequence(quint64 value);
private:
void AddShortcut(quint64 button, quint32 action);
private:
QSettings settings_;
QString current_id_;
@ -53,12 +50,13 @@ private:
private slots:
void AddAction();
void AddShortcut(quint64 button, quint32 action);
void DefaultSettings();
void DeleteAction();
void LoadSettings();
void WiimotedevEnabledChecked(bool checked);
void ItemClicked(QTreeWidgetItem*);
void LoadSettings();
void WiimotedevEnabledChecked(bool checked);
signals:
void SetWiimotedevInterfaceActived(bool);