Skip to content

Commit 90285a7

Browse files
author
black-sliver
committed
add scriptparser
1 parent 53a7b13 commit 90285a7

14 files changed

+688
-29
lines changed

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
[submodule "zlib-min-q"]
55
path = zlib-min-q
66
url = https://github.com/black-sliver/zlib-min-q.git
7+
[submodule "SoEScriptDumper"]
8+
path = SoEScriptDumper
9+
url = ../SoEScriptDumper.git

SoEScriptDumper

Submodule SoEScriptDumper added at 5d5bdf7

SoETilesViewer.pro

+5
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,26 @@ DEFINES += QT_DEPRECATED_WARNINGS
1717
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
1818

1919
SOURCES += \
20+
finddialog.cpp \
2021
frameview.cpp \
2122
main.cpp \
2223
mainwindow.cpp \
24+
scriptparser.cpp \
2325
tileview.cpp
2426

2527
HEADERS += \
2628
colormap.h \
29+
finddialog.h \
2730
frameview.h \
2831
mainwindow.h \
2932
rom.h \
33+
scriptparser.h \
3034
spriteblock.h \
3135
spriteinfo.h \
3236
tileview.h
3337

3438
FORMS += \
39+
finddialog.ui \
3540
mainwindow.ui
3641

3742
RC_ICONS = icon.ico

find.png

2.02 KB
Loading

finddialog.cpp

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#include "finddialog.h"
2+
#include "ui_finddialog.h"
3+
#include <QPushButton>
4+
5+
FindDialog::FindDialog(QWidget *parent, const QString& text, QTextDocument::FindFlags flags, bool regex) :
6+
QDialog(parent),
7+
ui(new Ui::FindDialog)
8+
{
9+
ui->setupUi(this);
10+
ui->buttonBox->button(QDialogButtonBox::Ok)->setText("Find");
11+
ui->lineEdit->setText(text);
12+
ui->lineEdit->setSelection(0, ui->lineEdit->text().length());
13+
ui->chkRegex->setChecked(regex);
14+
this->_flags = flags;
15+
ui->chkCaseSensitive->setChecked(flags & QTextDocument::FindCaseSensitively);
16+
setWindowFlag(Qt::Tool);
17+
}
18+
19+
FindDialog::~FindDialog()
20+
{
21+
delete ui;
22+
}
23+
24+
QString FindDialog::text() const
25+
{
26+
return ui->lineEdit->text();
27+
}
28+
29+
QTextDocument::FindFlags FindDialog::flags() const
30+
{
31+
if (ui->chkCaseSensitive->isChecked())
32+
return _flags|QTextDocument::FindCaseSensitively;
33+
else
34+
return _flags&(~QTextDocument::FindCaseSensitively);
35+
}
36+
37+
bool FindDialog::regex() const
38+
{
39+
return ui->chkRegex->isChecked();
40+
}

finddialog.h

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#ifndef FINDDIALOG_H
2+
#define FINDDIALOG_H
3+
4+
#include <QDialog>
5+
#include <QTextDocument>
6+
7+
namespace Ui {
8+
class FindDialog;
9+
}
10+
11+
class FindDialog : public QDialog
12+
{
13+
Q_OBJECT
14+
15+
public:
16+
explicit FindDialog(QWidget *parent = nullptr, const QString& text="", QTextDocument::FindFlags flags=QTextDocument::FindFlags(), bool regex=false);
17+
~FindDialog();
18+
19+
QString text() const;
20+
QTextDocument::FindFlags flags() const;
21+
bool regex() const;
22+
23+
private:
24+
Ui::FindDialog *ui;
25+
QTextDocument::FindFlags _flags;
26+
};
27+
28+
#endif // FINDDIALOG_H

finddialog.ui

+107
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>FindDialog</class>
4+
<widget class="QDialog" name="FindDialog">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>181</width>
10+
<height>92</height>
11+
</rect>
12+
</property>
13+
<property name="windowTitle">
14+
<string>Find</string>
15+
</property>
16+
<property name="windowIcon">
17+
<iconset resource="mainwindow.qrc">
18+
<normaloff>:/find.png</normaloff>:/find.png</iconset>
19+
</property>
20+
<layout class="QVBoxLayout" name="verticalLayout">
21+
<item>
22+
<widget class="QLineEdit" name="lineEdit"/>
23+
</item>
24+
<item>
25+
<layout class="QHBoxLayout" name="hboxOptions">
26+
<property name="spacing">
27+
<number>0</number>
28+
</property>
29+
<item>
30+
<widget class="QCheckBox" name="chkRegex">
31+
<property name="text">
32+
<string>Regex</string>
33+
</property>
34+
</widget>
35+
</item>
36+
<item>
37+
<widget class="QCheckBox" name="chkCaseSensitive">
38+
<property name="text">
39+
<string>Case sensitive</string>
40+
</property>
41+
</widget>
42+
</item>
43+
<item>
44+
<spacer name="horizontalSpacer">
45+
<property name="orientation">
46+
<enum>Qt::Horizontal</enum>
47+
</property>
48+
<property name="sizeHint" stdset="0">
49+
<size>
50+
<width>40</width>
51+
<height>20</height>
52+
</size>
53+
</property>
54+
</spacer>
55+
</item>
56+
</layout>
57+
</item>
58+
<item>
59+
<widget class="QDialogButtonBox" name="buttonBox">
60+
<property name="orientation">
61+
<enum>Qt::Horizontal</enum>
62+
</property>
63+
<property name="standardButtons">
64+
<set>QDialogButtonBox::Close|QDialogButtonBox::Ok</set>
65+
</property>
66+
</widget>
67+
</item>
68+
</layout>
69+
</widget>
70+
<resources>
71+
<include location="mainwindow.qrc"/>
72+
</resources>
73+
<connections>
74+
<connection>
75+
<sender>buttonBox</sender>
76+
<signal>accepted()</signal>
77+
<receiver>FindDialog</receiver>
78+
<slot>accept()</slot>
79+
<hints>
80+
<hint type="sourcelabel">
81+
<x>248</x>
82+
<y>254</y>
83+
</hint>
84+
<hint type="destinationlabel">
85+
<x>157</x>
86+
<y>274</y>
87+
</hint>
88+
</hints>
89+
</connection>
90+
<connection>
91+
<sender>buttonBox</sender>
92+
<signal>rejected()</signal>
93+
<receiver>FindDialog</receiver>
94+
<slot>reject()</slot>
95+
<hints>
96+
<hint type="sourcelabel">
97+
<x>316</x>
98+
<y>260</y>
99+
</hint>
100+
<hint type="destinationlabel">
101+
<x>286</x>
102+
<y>274</y>
103+
</hint>
104+
</hints>
105+
</connection>
106+
</connections>
107+
</ui>

0 commit comments

Comments
 (0)