straight copy of qt4 branch over to trunk, merge refused to work

git-svn-id: svn://svn.code.sf.net/p/qjoypad/code/trunk@95 c05e91a0-76c8-4ec0-b377-ef19ce7cc080
This commit is contained in:
John Toman
2009-08-03 01:01:45 +00:00
committed by virtuoussin13
parent c1ef3fa0b7
commit 345bb5748e
36 changed files with 1152 additions and 1506 deletions

View File

@ -1,60 +1,66 @@
#include "button_edit.h"
ButtonEdit::ButtonEdit(Button* butt)
:QDialog(0,0,true) {
//build the dialog!
button = butt;
setCaption("Set " + button->getName());
setIcon(QPixmap(ICON24));
QVBoxLayout* v = new QVBoxLayout(this, 5, 5);
#include <QHBoxLayout>
#include <QVBoxLayout>
BKKey = new KeyButton( button->getName(), button->useMouse?button->mousecode:button->keycode, this, true, button->useMouse);
v->addWidget(BKKey);
QHBoxLayout* h = new QHBoxLayout();
CSticky = new QCheckBox("Sticky", this);
CSticky->setChecked(button->sticky);
h->addWidget(CSticky);
CRapid = new QCheckBox("Rapid Fire", this);
CRapid->setChecked(button->rapidfire);
h->addWidget(CRapid);
v->addLayout(h);
h = new QHBoxLayout();
BOkay = new QPushButton("Okay", this);
connect(BOkay, SIGNAL( clicked() ), this, SLOT( accept()));
h->addWidget(BOkay);
BCancel = new QPushButton("Cancel", this);
connect(BCancel, SIGNAL( clicked() ), this, SLOT( reject()));
h->addWidget(BCancel);
v->addLayout(h);
ButtonEdit::ButtonEdit(Button* butt)
:QDialog(0) {
setModal(true);
//build the dialog!
button = butt;
setWindowTitle("Set " + button->getName());
setWindowIcon(QPixmap(ICON24));
QVBoxLayout* v = new QVBoxLayout(this);
v->setMargin(5);
v->setSpacing(5);
BKKey = new KeyButton( button->getName(), button->useMouse?button->mousecode:button->keycode, this, true, button->useMouse);
v->addWidget(BKKey);
QHBoxLayout* h = new QHBoxLayout();
CSticky = new QCheckBox("Sticky", this);
CSticky->setChecked(button->sticky);
h->addWidget(CSticky);
CRapid = new QCheckBox("Rapid Fire", this);
CRapid->setChecked(button->rapidfire);
h->addWidget(CRapid);
v->addLayout(h);
h = new QHBoxLayout();
BOkay = new QPushButton("Okay", this);
connect(BOkay, SIGNAL( clicked() ), this, SLOT( accept()));
h->addWidget(BOkay);
BCancel = new QPushButton("Cancel", this);
connect(BCancel, SIGNAL( clicked() ), this, SLOT( reject()));
h->addWidget(BCancel);
v->addLayout(h);
}
void ButtonEdit::show() {
QDialog::show();
setFixedSize(size());
QDialog::show();
setFixedSize(size());
}
void ButtonEdit::accept() {
//if the rapidfire status has changed, either request a timer or turn it down.
if (button->rapidfire) {
if (!CRapid->isChecked()) tossTimer(button);
}
else {
if (CRapid->isChecked()) takeTimer(button);
}
button->rapidfire = CRapid->isChecked();
button->sticky = (CSticky->isChecked());
//if the user chose a mouse button...
if (BKKey->choseMouse()) {
button->useMouse = true;
button->mousecode = BKKey->getValue();
}
else {
button->useMouse = false;
button->keycode = BKKey->getValue();
}
/*if (button->rapidfire) {
if (!CRapid->isChecked()) tossTimer(button);
}
else {
if (CRapid->isChecked()) takeTimer(button);
}*/
button->rapidfire = CRapid->isChecked();
button->sticky = (CSticky->isChecked());
//if the user chose a mouse button...
if (BKKey->choseMouse()) {
button->useMouse = true;
button->mousecode = BKKey->getValue();
}
else {
button->useMouse = false;
button->keycode = BKKey->getValue();
}
QDialog::accept();
QDialog::accept();
}