Added main() entry and mainwindow files.
This commit is contained in:
parent
2de2f7b1b6
commit
ddc0c23de3
11
main.cpp
Normal file
11
main.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
MainWindow w;
|
||||
w.show();
|
||||
return a.exec();
|
||||
}
|
||||
43
mainwindow.cpp
Normal file
43
mainwindow.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
#include <QMetaType>
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
, ui(new Ui::MainWindow) {
|
||||
ui->setupUi(this);
|
||||
|
||||
pViewer = new HexViewer(this);
|
||||
setCentralWidget(pViewer);
|
||||
pViewer->SetFileName("C:/Ext/Projects/Qt/Hexes/nazi_zombie_factory_patch.zone");
|
||||
|
||||
//ui->statusbar->showMessage(QString("File Size: %1 bytes").arg(data.size()));
|
||||
|
||||
pRuleDialog = new RuleDialog(this);
|
||||
pRuleDialog->SetRuleNames(pViewer->RuleNames());
|
||||
connect(ui->actionAdd_Rule, &QAction::triggered, pRuleDialog, &RuleDialog::exec);
|
||||
connect(pRuleDialog, &RuleDialog::RuleChanged, pViewer, &HexViewer::AddRule);
|
||||
connect(pRuleDialog, &RuleDialog::RulesChanged, pViewer, &HexViewer::AddRules);
|
||||
connect(pViewer, &HexViewer::RuleNamesChanged, pRuleDialog, &RuleDialog::SetRuleNames);
|
||||
connect(pViewer, &HexViewer::VarsChanged, pRuleDialog, &RuleDialog::SetVars);
|
||||
|
||||
pDelRuleDialog = new DeleteRuleDialog(this);
|
||||
pDelRuleDialog->SetRuleNames(pViewer->RuleNames());
|
||||
connect(pViewer, &HexViewer::RuleNamesChanged, pDelRuleDialog, &DeleteRuleDialog::SetRuleNames);
|
||||
connect(ui->actionDelete_Rule, &QAction::triggered, pDelRuleDialog, &RuleDialog::exec);
|
||||
connect(pDelRuleDialog, &DeleteRuleDialog::RuleDeleted, pViewer, &HexViewer::DeleteRuleByName);
|
||||
|
||||
connect(ui->actionClear_Rules, &QAction::triggered, pViewer, &HexViewer::ClearRules);
|
||||
connect(ui->actionPop_Rule, &QAction::triggered, pViewer, &HexViewer::PopRule);
|
||||
connect(ui->actionRun_Rules, &QAction::triggered, pViewer, &HexViewer::RunRules);
|
||||
connect(ui->actionSave, &QAction::triggered, pViewer, &HexViewer::SaveRules);
|
||||
connect(ui->actionOpen, &QAction::triggered, pViewer, &HexViewer::OpenRules);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow() {
|
||||
delete ui;
|
||||
delete pViewer;
|
||||
delete pRuleDialog;
|
||||
}
|
||||
|
||||
32
mainwindow.h
Normal file
32
mainwindow.h
Normal file
@ -0,0 +1,32 @@
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include "hexviewer.h"
|
||||
#include "ruledialog.h"
|
||||
#include "deleteruledialog.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
#include <QHBoxLayout>
|
||||
#include <QDockWidget>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui { class MainWindow; }
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow(QWidget *parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
HexViewer *pViewer;
|
||||
RuleDialog *pRuleDialog;
|
||||
DeleteRuleDialog *pDelRuleDialog;
|
||||
};
|
||||
#endif // MAINWINDOW_H
|
||||
221
mainwindow.ui
Normal file
221
mainwindow.ui
Normal file
@ -0,0 +1,221 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>600</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Hexes</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget"/>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>800</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>CommitMono</family>
|
||||
<pointsize>10</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
<property name="title">
|
||||
<string>File</string>
|
||||
</property>
|
||||
<addaction name="actionNew"/>
|
||||
<addaction name="actionOpen"/>
|
||||
<addaction name="actionClose"/>
|
||||
<addaction name="actionSave"/>
|
||||
<addaction name="actionSave_As"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionSave_all"/>
|
||||
<addaction name="actionClose_all"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionExit"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuRule">
|
||||
<property name="title">
|
||||
<string>Rule</string>
|
||||
</property>
|
||||
<addaction name="actionAdd_Rule"/>
|
||||
<addaction name="actionEdit_Rule"/>
|
||||
<addaction name="actionPop_Rule"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionDelete_Rule"/>
|
||||
<addaction name="actionClear_Rules"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionRun_Rules"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
<addaction name="menuRule"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
<action name="actionAdd_Rule">
|
||||
<property name="text">
|
||||
<string>Add Rule</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>CommitMono</family>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEdit_Rule">
|
||||
<property name="text">
|
||||
<string>Edit Rule</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>CommitMono</family>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDelete_Rule">
|
||||
<property name="text">
|
||||
<string>Delete Rule</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>CommitMono</family>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPop_Rule">
|
||||
<property name="text">
|
||||
<string>Pop Rule</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>CommitMono</family>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRun_Rules">
|
||||
<property name="text">
|
||||
<string>Run Rules</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>CommitMono</family>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionNew">
|
||||
<property name="text">
|
||||
<string>New</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>CommitMono</family>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpen">
|
||||
<property name="text">
|
||||
<string>Open</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>CommitMono</family>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionClose">
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>CommitMono</family>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSave">
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>CommitMono</family>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSave_As">
|
||||
<property name="text">
|
||||
<string>Save as...</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>CommitMono</family>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSave_all">
|
||||
<property name="text">
|
||||
<string>Save all</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>CommitMono</family>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionClose_all">
|
||||
<property name="text">
|
||||
<string>Close all</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>CommitMono</family>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionExit">
|
||||
<property name="text">
|
||||
<string>Exit</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>CommitMono</family>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionClear_Rules">
|
||||
<property name="text">
|
||||
<string>Clear Rules</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>CommitMono</family>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Loading…
x
Reference in New Issue
Block a user