/*
Copyright (C) 2006 Evan Teran
                   eteran@alum.rit.edu

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

#ifndef DIALOGOPCODES_20061101_H_
#define DIALOGOPCODES_20061101_H_

#include "ui_dialogopcodes.h"
#include "EDBTypes.h"

class QSortFilterProxyModel;

class DialogOpcodes : public QDialog {
	Q_OBJECT
	
public:
	DialogOpcodes(QWidget *parent = 0);

public slots:
	void on_btnFind_clicked();
	void on_listWidget_itemDoubleClicked(QListWidgetItem *);
	
private:
	union OpcodeData {
		uint8_t byte;
		uint16_t word;
		uint32_t dword;
		uint8_t data[sizeof(uint32_t)];
	};

	void testEax(const OpcodeData &data, edb::address_t start_address);
	void testEbx(const OpcodeData &data, edb::address_t start_address);
	void testEcx(const OpcodeData &data, edb::address_t start_address);
	void testEdx(const OpcodeData &data, edb::address_t start_address);
	void testEbp(const OpcodeData &data, edb::address_t start_address);
	void testEsp(const OpcodeData &data, edb::address_t start_address);
	void testEsi(const OpcodeData &data, edb::address_t start_address);
	void testEdi(const OpcodeData &data, edb::address_t start_address);
	void testESP_ADD_0(const OpcodeData &data, edb::address_t start_address);
	void testESP_ADD_4(const OpcodeData &data, edb::address_t start_address);
	void testESP_ADD_8(const OpcodeData &data, edb::address_t start_address);
	void testESP_SUB_4(const OpcodeData &data, edb::address_t start_address);
	
private:
	virtual void showEvent(QShowEvent *event);

public:
	Ui::DialogOpcodes ui;
	QSortFilterProxyModel *m_FilterModel;
};

#endif
