o switch to v46
This commit is contained in:
@@ -75,8 +75,8 @@ void CodeEditorWindow::setup() {
|
||||
void CodeEditorWindow::syncUi() {
|
||||
//only activate add button when code is valid
|
||||
string code = codeValue->text().toUtf8().data();
|
||||
Cheat::cheat_t temp;
|
||||
bool valid = cheat.decode(code, temp);
|
||||
SNES::Cheat::cheat_t temp;
|
||||
bool valid = SNES::cheat.decode(code, temp);
|
||||
codeAdd->setEnabled(valid);
|
||||
|
||||
//only activate delete button when a code is selected
|
||||
@@ -93,8 +93,8 @@ void CodeEditorWindow::codeChanged() { syncUi(); }
|
||||
|
||||
void CodeEditorWindow::addCodeToList() {
|
||||
string code = codeValue->text().toUtf8().data();
|
||||
Cheat::cheat_t temp;
|
||||
if(cheat.decode(code, temp) == true) codeList->addItem(utf8() << code);
|
||||
SNES::Cheat::cheat_t temp;
|
||||
if(SNES::cheat.decode(code, temp) == true) codeList->addItem(utf8() << code);
|
||||
syncUi();
|
||||
}
|
||||
|
||||
@@ -122,15 +122,15 @@ void CodeEditorWindow::accept() {
|
||||
|
||||
if(activeCode == -1) {
|
||||
//adding a new code
|
||||
cheat.add(enabled->isChecked(), code, desc);
|
||||
SNES::cheat.add(enabled->isChecked(), code, desc);
|
||||
winCheatEditor->reloadList();
|
||||
} else if(codeList->count() > 0) {
|
||||
//editing an existing code
|
||||
cheat.edit(activeCode, enabled->isChecked(), code, desc);
|
||||
SNES::cheat.edit(activeCode, enabled->isChecked(), code, desc);
|
||||
winCheatEditor->updateList();
|
||||
} else {
|
||||
//deleting an existing code
|
||||
cheat.remove(activeCode);
|
||||
SNES::cheat.remove(activeCode);
|
||||
winCheatEditor->reloadList();
|
||||
}
|
||||
|
||||
@@ -156,8 +156,8 @@ void CodeEditorWindow::editCode(unsigned code) {
|
||||
codeList->clear();
|
||||
codeValue->setText("");
|
||||
|
||||
Cheat::cheat_t item;
|
||||
cheat.get(activeCode, item);
|
||||
SNES::Cheat::cheat_t item;
|
||||
SNES::cheat.get(activeCode, item);
|
||||
|
||||
description->setPlainText(utf8() << item.desc);
|
||||
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
class CodeEditorWindow : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QWidget *window;
|
||||
QVBoxLayout *layout;
|
||||
QLabel *descLabel;
|
||||
QTextEdit *description;
|
||||
QLabel *codeLabel;
|
||||
QHBoxLayout *codeLayout;
|
||||
QListWidget *codeList;
|
||||
QVBoxLayout *controls;
|
||||
QLineEdit *codeValue;
|
||||
QPushButton *codeAdd;
|
||||
QPushButton *codeDelete;
|
||||
QPushButton *codeDeleteAll;
|
||||
QWidget *spacer;
|
||||
QCheckBox *enabled;
|
||||
QHBoxLayout *finishControls;
|
||||
QPushButton *okButton;
|
||||
QPushButton *cancelButton;
|
||||
|
||||
void setup();
|
||||
void syncUi();
|
||||
void addCode();
|
||||
void editCode(unsigned code);
|
||||
CodeEditorWindow();
|
||||
|
||||
public slots:
|
||||
void listChanged();
|
||||
void codeChanged();
|
||||
void addCodeToList();
|
||||
void deleteCodeFromList();
|
||||
void deleteAllCodesFromList();
|
||||
void accept();
|
||||
void dismiss();
|
||||
|
||||
private:
|
||||
signed activeCode;
|
||||
void showWindow(const char *title);
|
||||
|
||||
friend class CheatEditorWindow;
|
||||
} *winCodeEditor;
|
||||
@@ -37,8 +37,8 @@ void InputCaptureWindow::setup() {
|
||||
connect(mouseAxes, SIGNAL(released()), this, SLOT(assignMouseAxis()));
|
||||
connect(mouseButtons, SIGNAL(released()), this, SLOT(assignMouseButton()));
|
||||
|
||||
winInputMouseCaptureWindow = new InputMouseCaptureWindow;
|
||||
winInputMouseCaptureWindow->setup();
|
||||
winInputMouseCapture = new InputMouseCaptureWindow;
|
||||
winInputMouseCapture->setup();
|
||||
|
||||
winInputCalibration = new InputCalibrationWindow;
|
||||
winInputCalibration->setup();
|
||||
@@ -96,8 +96,8 @@ void InputCaptureWindow::inputEvent(uint16_t code, bool forceAssign /* = false *
|
||||
//input polling is global, need to block mouse actions that may be UI interactions.
|
||||
//custom controls on window allow mouse assignment instead.
|
||||
if(forceAssign == false) {
|
||||
if(winInputMouseCaptureWindow->window->isActiveWindow()) {
|
||||
winInputMouseCaptureWindow->inputEvent(code);
|
||||
if(winInputMouseCapture->window->isActiveWindow()) {
|
||||
winInputMouseCapture->inputEvent(code);
|
||||
return;
|
||||
}
|
||||
if(!window->isActiveWindow()) return;
|
||||
@@ -205,7 +205,7 @@ void InputCaptureWindow::inputEvent(uint16_t code, bool forceAssign /* = false *
|
||||
|
||||
if(!activeGroup) {
|
||||
window->hide();
|
||||
winInputMouseCaptureWindow->window->hide();
|
||||
winInputMouseCapture->window->hide();
|
||||
} else {
|
||||
//try and map the next code in this input group
|
||||
groupIndex++;
|
||||
@@ -214,7 +214,7 @@ void InputCaptureWindow::inputEvent(uint16_t code, bool forceAssign /* = false *
|
||||
} else {
|
||||
//all group codes mapped
|
||||
window->hide();
|
||||
winInputMouseCaptureWindow->window->hide();
|
||||
winInputMouseCapture->window->hide();
|
||||
activeGroup = 0;
|
||||
}
|
||||
}
|
||||
@@ -224,12 +224,12 @@ void InputCaptureWindow::assignMouseAxis() {
|
||||
//refresh input state so that mouse release event (from SIGNAL(released())
|
||||
//is not sent immediately after window is visible.
|
||||
inputManager.refresh();
|
||||
winInputMouseCaptureWindow->activate(InputMouseCaptureWindow::AxisMode);
|
||||
winInputMouseCapture->activate(InputMouseCaptureWindow::AxisMode);
|
||||
}
|
||||
|
||||
void InputCaptureWindow::assignMouseButton() {
|
||||
inputManager.refresh();
|
||||
winInputMouseCaptureWindow->activate(InputMouseCaptureWindow::ButtonMode);
|
||||
winInputMouseCapture->activate(InputMouseCaptureWindow::ButtonMode);
|
||||
}
|
||||
|
||||
InputCaptureWindow::InputCaptureWindow() {
|
||||
@@ -243,6 +243,9 @@ void InputCaptureWindow::Window::closeEvent(QCloseEvent*) {
|
||||
//window closed by user, cancel key assignment
|
||||
winInputCapture->activeObject = 0;
|
||||
winInputCapture->activeGroup = 0;
|
||||
|
||||
winInputMouseCapture->window->hide();
|
||||
winInputCalibration->dismiss();
|
||||
}
|
||||
|
||||
void InputCaptureWindow::ImageWidget::paintEvent(QPaintEvent*) {
|
||||
@@ -452,3 +455,7 @@ void InputCalibrationWindow::dismiss() {
|
||||
void InputCalibrationWindow::Window::closeEvent(QCloseEvent*) {
|
||||
winInputCalibration->dismiss();
|
||||
}
|
||||
|
||||
InputCalibrationWindow::InputCalibrationWindow() {
|
||||
activeJoypad = -1;
|
||||
}
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
class InputCaptureWindow : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
struct Window : public QWidget {
|
||||
void closeEvent(QCloseEvent*);
|
||||
} *window;
|
||||
QVBoxLayout *layout;
|
||||
QHBoxLayout *hlayout;
|
||||
QLabel *title;
|
||||
QPushButton *mouseAxes;
|
||||
QPushButton *mouseButtons;
|
||||
QWidget *imageSpacer;
|
||||
struct ImageWidget : public QWidget {
|
||||
void paintEvent(QPaintEvent*);
|
||||
} *imageWidget;
|
||||
QWidget *spacer;
|
||||
|
||||
void setup();
|
||||
void activate(InputObject *object);
|
||||
void activate(InputGroup *group);
|
||||
void inputEvent(uint16_t code, bool forceAssign = false);
|
||||
InputCaptureWindow();
|
||||
|
||||
public slots:
|
||||
void assignMouseAxis();
|
||||
void assignMouseButton();
|
||||
|
||||
private:
|
||||
InputObject *activeObject;
|
||||
InputGroup *activeGroup;
|
||||
unsigned groupIndex;
|
||||
bool inputLock;
|
||||
|
||||
friend class InputCaptureWindow::Window;
|
||||
} *winInputCapture;
|
||||
|
||||
class InputMouseCaptureWindow : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Mode { AxisMode, ButtonMode };
|
||||
|
||||
QWidget *window;
|
||||
QVBoxLayout *layout;
|
||||
QLabel *info;
|
||||
QLabel *captureBox;
|
||||
QHBoxLayout *buttonLayout;
|
||||
QPushButton *xAxis;
|
||||
QPushButton *yAxis;
|
||||
QWidget *spacer;
|
||||
|
||||
void setup();
|
||||
void activate(Mode);
|
||||
void inputEvent(uint16_t code);
|
||||
|
||||
public slots:
|
||||
void assignAxisX();
|
||||
void assignAxisY();
|
||||
|
||||
private:
|
||||
Mode activeMode;
|
||||
signed activeMouse;
|
||||
} *winInputMouseCaptureWindow;
|
||||
|
||||
class InputCalibrationWindow : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
struct Window : public QWidget {
|
||||
void closeEvent(QCloseEvent*);
|
||||
} *window;
|
||||
QVBoxLayout *layout;
|
||||
QLabel *info;
|
||||
QPushButton *ok;
|
||||
QWidget *spacer;
|
||||
|
||||
void setup();
|
||||
void activate(unsigned joy);
|
||||
|
||||
public slots:
|
||||
void dismiss();
|
||||
|
||||
private:
|
||||
int activeJoypad;
|
||||
|
||||
friend class InputCalibrationWindow::Window;
|
||||
} *winInputCalibration;
|
||||
Reference in New Issue
Block a user