HexOffsets/mainwindow.hpp

72 lines
1.8 KiB
C++

/*
Copyright (C) 2017 Grégory Soutadé
This file is part of Hex offsets.
Hex offsets 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 3 of the License, or
(at your option) any later version.
Hex offsets 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 Hex offsets. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MAINWINDOW_HPP
#define MAINWINDOW_HPP
#include <QMainWindow>
#include <QPushButton>
#include <QLineEdit>
#include <QCheckBox>
#include <uientry.hpp>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0, int entriesNumber = 4);
~MainWindow();
private slots:
void on_lineBase_textChanged(const QString &arg1);
void on_buttonCopyClipboard_clicked();
void on_lineDec_textChanged(const QString &arg1);
void on_lineHex_textChanged(const QString &arg1);
void on_buttonClearBase_clicked();
void on_buttonClearAll_clicked();
void on_spinUIEntries_valueChanged(int arg1);
private:
Ui::MainWindow *ui;
QFont normalFont, errorFont;
QPalette blackPalette, redPalette;
void addValue(QLineEdit* line, UIEntry* entry, long* result, int base=16);
void setTextValue(QLineEdit* line, long value, int base=16);
bool editConversion;
std::vector<UIEntry*> entries;
int entriesNumber;
public:
void computeResult(void);
void getValue(QLineEdit* line, long* result, int base);
};
#endif // MAINWINDOW_HPP