summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar bunnei2017-01-22 22:35:13 -0500
committerGravatar GitHub2017-01-22 22:35:13 -0500
commit291ded52ac4ab8234fc30468e941c1800adffe8c (patch)
tree18cc6dce3434ecf7e363a52590bd9484394898b0
parentMerge pull request #2458 from wwylele/reset-accel-gyro (diff)
parentRemoved unused and outdated external qhexedit (diff)
downloadyuzu-291ded52ac4ab8234fc30468e941c1800adffe8c.tar.gz
yuzu-291ded52ac4ab8234fc30468e941c1800adffe8c.tar.xz
yuzu-291ded52ac4ab8234fc30468e941c1800adffe8c.zip
Merge pull request #2466 from Kloen/we-dont-need-this
Removed unused and outdated external qhexedit
Diffstat (limited to '')
-rw-r--r--CMakeLists.txt5
-rw-r--r--externals/qhexedit/CMakeLists.txt21
-rw-r--r--externals/qhexedit/commands.cpp115
-rw-r--r--externals/qhexedit/commands.h70
-rw-r--r--externals/qhexedit/license.txt502
-rw-r--r--externals/qhexedit/qhexedit.cpp180
-rw-r--r--externals/qhexedit/qhexedit.h240
-rw-r--r--externals/qhexedit/qhexedit_p.cpp857
-rw-r--r--externals/qhexedit/qhexedit_p.h128
-rw-r--r--externals/qhexedit/xbytearray.cpp167
-rw-r--r--externals/qhexedit/xbytearray.h66
-rw-r--r--src/citra_qt/CMakeLists.txt4
-rw-r--r--src/citra_qt/debugger/ramview.cpp12
-rw-r--r--src/citra_qt/debugger/ramview.h17
-rw-r--r--src/citra_qt/main.cpp3
15 files changed, 2 insertions, 2385 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 52a1fd492..ce9a29032 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -271,11 +271,6 @@ if (MSVC)
271endif() 271endif()
272 272
273# process subdirectories 273# process subdirectories
274if(ENABLE_QT)
275 include_directories(externals/qhexedit)
276 add_subdirectory(externals/qhexedit)
277endif()
278
279add_subdirectory(externals/soundtouch) 274add_subdirectory(externals/soundtouch)
280 275
281enable_testing() 276enable_testing()
diff --git a/externals/qhexedit/CMakeLists.txt b/externals/qhexedit/CMakeLists.txt
deleted file mode 100644
index e7470dfe4..000000000
--- a/externals/qhexedit/CMakeLists.txt
+++ /dev/null
@@ -1,21 +0,0 @@
1set(CMAKE_AUTOMOC ON)
2set(CMAKE_INCLUDE_CURRENT_DIR ON)
3
4set(SRCS
5 commands.cpp
6 qhexedit.cpp
7 qhexedit_p.cpp
8 xbytearray.cpp
9 )
10
11set(HEADERS
12 commands.h
13 qhexedit.h
14 qhexedit_p.h
15 xbytearray.h
16 )
17
18create_directory_groups(${SRCS} ${HEADERS})
19
20add_library(qhexedit STATIC ${SRCS} ${HEADERS})
21target_link_libraries(qhexedit ${CITRA_QT_LIBS})
diff --git a/externals/qhexedit/commands.cpp b/externals/qhexedit/commands.cpp
deleted file mode 100644
index 303091d1d..000000000
--- a/externals/qhexedit/commands.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
1#include "commands.h"
2
3CharCommand::CharCommand(XByteArray * xData, Cmd cmd, int charPos, char newChar, QUndoCommand *parent)
4 : QUndoCommand(parent)
5{
6 _xData = xData;
7 _charPos = charPos;
8 _newChar = newChar;
9 _cmd = cmd;
10}
11
12bool CharCommand::mergeWith(const QUndoCommand *command)
13{
14 const CharCommand *nextCommand = static_cast<const CharCommand *>(command);
15 bool result = false;
16
17 if (_cmd != remove)
18 {
19 if (nextCommand->_cmd == replace)
20 if (nextCommand->_charPos == _charPos)
21 {
22 _newChar = nextCommand->_newChar;
23 result = true;
24 }
25 }
26 return result;
27}
28
29void CharCommand::undo()
30{
31 switch (_cmd)
32 {
33 case insert:
34 _xData->remove(_charPos, 1);
35 break;
36 case replace:
37 _xData->replace(_charPos, _oldChar);
38 _xData->setDataChanged(_charPos, _wasChanged);
39 break;
40 case remove:
41 _xData->insert(_charPos, _oldChar);
42 _xData->setDataChanged(_charPos, _wasChanged);
43 break;
44 }
45}
46
47void CharCommand::redo()
48{
49 switch (_cmd)
50 {
51 case insert:
52 _xData->insert(_charPos, _newChar);
53 break;
54 case replace:
55 _oldChar = _xData->data()[_charPos];
56 _wasChanged = _xData->dataChanged(_charPos);
57 _xData->replace(_charPos, _newChar);
58 break;
59 case remove:
60 _oldChar = _xData->data()[_charPos];
61 _wasChanged = _xData->dataChanged(_charPos);
62 _xData->remove(_charPos, 1);
63 break;
64 }
65}
66
67
68
69ArrayCommand::ArrayCommand(XByteArray * xData, Cmd cmd, int baPos, QByteArray newBa, int len, QUndoCommand *parent)
70 : QUndoCommand(parent)
71{
72 _cmd = cmd;
73 _xData = xData;
74 _baPos = baPos;
75 _newBa = newBa;
76 _len = len;
77}
78
79void ArrayCommand::undo()
80{
81 switch (_cmd)
82 {
83 case insert:
84 _xData->remove(_baPos, _newBa.length());
85 break;
86 case replace:
87 _xData->replace(_baPos, _oldBa);
88 _xData->setDataChanged(_baPos, _wasChanged);
89 break;
90 case remove:
91 _xData->insert(_baPos, _oldBa);
92 _xData->setDataChanged(_baPos, _wasChanged);
93 break;
94 }
95}
96
97void ArrayCommand::redo()
98{
99 switch (_cmd)
100 {
101 case insert:
102 _xData->insert(_baPos, _newBa);
103 break;
104 case replace:
105 _oldBa = _xData->data().mid(_baPos, _len);
106 _wasChanged = _xData->dataChanged(_baPos, _len);
107 _xData->replace(_baPos, _newBa);
108 break;
109 case remove:
110 _oldBa = _xData->data().mid(_baPos, _len);
111 _wasChanged = _xData->dataChanged(_baPos, _len);
112 _xData->remove(_baPos, _len);
113 break;
114 }
115}
diff --git a/externals/qhexedit/commands.h b/externals/qhexedit/commands.h
deleted file mode 100644
index 9931b3fb5..000000000
--- a/externals/qhexedit/commands.h
+++ /dev/null
@@ -1,70 +0,0 @@
1#ifndef COMMANDS_H
2#define COMMANDS_H
3
4/** \cond docNever */
5
6#include <QUndoCommand>
7
8#include "xbytearray.h"
9
10/*! CharCommand is a class to prived undo/redo functionality in QHexEdit.
11A QUndoCommand represents a single editing action on a document. CharCommand
12is responsable for manipulations on single chars. It can insert. replace and
13remove characters. A manipulation stores allways to actions
141. redo (or do) action
152. undo action.
16
17CharCommand also supports command compression via mergeWidht(). This allows
18the user to execute a undo command contation e.g. 3 steps in a single command.
19If you for example insert a new byt "34" this means for the editor doing 3
20steps: insert a "00", replace it with "03" and the replace it with "34". These
213 steps are combined into a single step, insert a "34".
22*/
23class CharCommand : public QUndoCommand
24{
25public:
26 enum { Id = 1234 };
27 enum Cmd {insert, remove, replace};
28
29 CharCommand(XByteArray * xData, Cmd cmd, int charPos, char newChar,
30 QUndoCommand *parent=0);
31
32 void undo();
33 void redo();
34 bool mergeWith(const QUndoCommand *command);
35 int id() const { return Id; }
36
37private:
38 XByteArray * _xData;
39 int _charPos;
40 bool _wasChanged;
41 char _newChar;
42 char _oldChar;
43 Cmd _cmd;
44};
45
46/*! ArrayCommand provides undo/redo functionality for handling binary strings. It
47can undo/redo insert, replace and remove binary strins (QByteArrays).
48*/
49class ArrayCommand : public QUndoCommand
50{
51public:
52 enum Cmd {insert, remove, replace};
53 ArrayCommand(XByteArray * xData, Cmd cmd, int baPos, QByteArray newBa=QByteArray(), int len=0,
54 QUndoCommand *parent=0);
55 void undo();
56 void redo();
57
58private:
59 Cmd _cmd;
60 XByteArray * _xData;
61 int _baPos;
62 int _len;
63 QByteArray _wasChanged;
64 QByteArray _newBa;
65 QByteArray _oldBa;
66};
67
68/** \endcond docNever */
69
70#endif // COMMANDS_H
diff --git a/externals/qhexedit/license.txt b/externals/qhexedit/license.txt
deleted file mode 100644
index f166cc57b..000000000
--- a/externals/qhexedit/license.txt
+++ /dev/null
@@ -1,502 +0,0 @@
1 GNU LESSER GENERAL PUBLIC LICENSE
2 Version 2.1, February 1999
3
4 Copyright (C) 1991, 1999 Free Software Foundation, Inc.
5 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 Everyone is permitted to copy and distribute verbatim copies
7 of this license document, but changing it is not allowed.
8
9[This is the first released version of the Lesser GPL. It also counts
10 as the successor of the GNU Library Public License, version 2, hence
11 the version number 2.1.]
12
13 Preamble
14
15 The licenses for most software are designed to take away your
16freedom to share and change it. By contrast, the GNU General Public
17Licenses are intended to guarantee your freedom to share and change
18free software--to make sure the software is free for all its users.
19
20 This license, the Lesser General Public License, applies to some
21specially designated software packages--typically libraries--of the
22Free Software Foundation and other authors who decide to use it. You
23can use it too, but we suggest you first think carefully about whether
24this license or the ordinary General Public License is the better
25strategy to use in any particular case, based on the explanations below.
26
27 When we speak of free software, we are referring to freedom of use,
28not price. Our General Public Licenses are designed to make sure that
29you have the freedom to distribute copies of free software (and charge
30for this service if you wish); that you receive source code or can get
31it if you want it; that you can change the software and use pieces of
32it in new free programs; and that you are informed that you can do
33these things.
34
35 To protect your rights, we need to make restrictions that forbid
36distributors to deny you these rights or to ask you to surrender these
37rights. These restrictions translate to certain responsibilities for
38you if you distribute copies of the library or if you modify it.
39
40 For example, if you distribute copies of the library, whether gratis
41or for a fee, you must give the recipients all the rights that we gave
42you. You must make sure that they, too, receive or can get the source
43code. If you link other code with the library, you must provide
44complete object files to the recipients, so that they can relink them
45with the library after making changes to the library and recompiling
46it. And you must show them these terms so they know their rights.
47
48 We protect your rights with a two-step method: (1) we copyright the
49library, and (2) we offer you this license, which gives you legal
50permission to copy, distribute and/or modify the library.
51
52 To protect each distributor, we want to make it very clear that
53there is no warranty for the free library. Also, if the library is
54modified by someone else and passed on, the recipients should know
55that what they have is not the original version, so that the original
56author's reputation will not be affected by problems that might be
57introduced by others.
58
59 Finally, software patents pose a constant threat to the existence of
60any free program. We wish to make sure that a company cannot
61effectively restrict the users of a free program by obtaining a
62restrictive license from a patent holder. Therefore, we insist that
63any patent license obtained for a version of the library must be
64consistent with the full freedom of use specified in this license.
65
66 Most GNU software, including some libraries, is covered by the
67ordinary GNU General Public License. This license, the GNU Lesser
68General Public License, applies to certain designated libraries, and
69is quite different from the ordinary General Public License. We use
70this license for certain libraries in order to permit linking those
71libraries into non-free programs.
72
73 When a program is linked with a library, whether statically or using
74a shared library, the combination of the two is legally speaking a
75combined work, a derivative of the original library. The ordinary
76General Public License therefore permits such linking only if the
77entire combination fits its criteria of freedom. The Lesser General
78Public License permits more lax criteria for linking other code with
79the library.
80
81 We call this license the "Lesser" General Public License because it
82does Less to protect the user's freedom than the ordinary General
83Public License. It also provides other free software developers Less
84of an advantage over competing non-free programs. These disadvantages
85are the reason we use the ordinary General Public License for many
86libraries. However, the Lesser license provides advantages in certain
87special circumstances.
88
89 For example, on rare occasions, there may be a special need to
90encourage the widest possible use of a certain library, so that it becomes
91a de-facto standard. To achieve this, non-free programs must be
92allowed to use the library. A more frequent case is that a free
93library does the same job as widely used non-free libraries. In this
94case, there is little to gain by limiting the free library to free
95software only, so we use the Lesser General Public License.
96
97 In other cases, permission to use a particular library in non-free
98programs enables a greater number of people to use a large body of
99free software. For example, permission to use the GNU C Library in
100non-free programs enables many more people to use the whole GNU
101operating system, as well as its variant, the GNU/Linux operating
102system.
103
104 Although the Lesser General Public License is Less protective of the
105users' freedom, it does ensure that the user of a program that is
106linked with the Library has the freedom and the wherewithal to run
107that program using a modified version of the Library.
108
109 The precise terms and conditions for copying, distribution and
110modification follow. Pay close attention to the difference between a
111"work based on the library" and a "work that uses the library". The
112former contains code derived from the library, whereas the latter must
113be combined with the library in order to run.
114
115 GNU LESSER GENERAL PUBLIC LICENSE
116 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
117
118 0. This License Agreement applies to any software library or other
119program which contains a notice placed by the copyright holder or
120other authorized party saying it may be distributed under the terms of
121this Lesser General Public License (also called "this License").
122Each licensee is addressed as "you".
123
124 A "library" means a collection of software functions and/or data
125prepared so as to be conveniently linked with application programs
126(which use some of those functions and data) to form executables.
127
128 The "Library", below, refers to any such software library or work
129which has been distributed under these terms. A "work based on the
130Library" means either the Library or any derivative work under
131copyright law: that is to say, a work containing the Library or a
132portion of it, either verbatim or with modifications and/or translated
133straightforwardly into another language. (Hereinafter, translation is
134included without limitation in the term "modification".)
135
136 "Source code" for a work means the preferred form of the work for
137making modifications to it. For a library, complete source code means
138all the source code for all modules it contains, plus any associated
139interface definition files, plus the scripts used to control compilation
140and installation of the library.
141
142 Activities other than copying, distribution and modification are not
143covered by this License; they are outside its scope. The act of
144running a program using the Library is not restricted, and output from
145such a program is covered only if its contents constitute a work based
146on the Library (independent of the use of the Library in a tool for
147writing it). Whether that is true depends on what the Library does
148and what the program that uses the Library does.
149
150 1. You may copy and distribute verbatim copies of the Library's
151complete source code as you receive it, in any medium, provided that
152you conspicuously and appropriately publish on each copy an
153appropriate copyright notice and disclaimer of warranty; keep intact
154all the notices that refer to this License and to the absence of any
155warranty; and distribute a copy of this License along with the
156Library.
157
158 You may charge a fee for the physical act of transferring a copy,
159and you may at your option offer warranty protection in exchange for a
160fee.
161
162 2. You may modify your copy or copies of the Library or any portion
163of it, thus forming a work based on the Library, and copy and
164distribute such modifications or work under the terms of Section 1
165above, provided that you also meet all of these conditions:
166
167 a) The modified work must itself be a software library.
168
169 b) You must cause the files modified to carry prominent notices
170 stating that you changed the files and the date of any change.
171
172 c) You must cause the whole of the work to be licensed at no
173 charge to all third parties under the terms of this License.
174
175 d) If a facility in the modified Library refers to a function or a
176 table of data to be supplied by an application program that uses
177 the facility, other than as an argument passed when the facility
178 is invoked, then you must make a good faith effort to ensure that,
179 in the event an application does not supply such function or
180 table, the facility still operates, and performs whatever part of
181 its purpose remains meaningful.
182
183 (For example, a function in a library to compute square roots has
184 a purpose that is entirely well-defined independent of the
185 application. Therefore, Subsection 2d requires that any
186 application-supplied function or table used by this function must
187 be optional: if the application does not supply it, the square
188 root function must still compute square roots.)
189
190These requirements apply to the modified work as a whole. If
191identifiable sections of that work are not derived from the Library,
192and can be reasonably considered independent and separate works in
193themselves, then this License, and its terms, do not apply to those
194sections when you distribute them as separate works. But when you
195distribute the same sections as part of a whole which is a work based
196on the Library, the distribution of the whole must be on the terms of
197this License, whose permissions for other licensees extend to the
198entire whole, and thus to each and every part regardless of who wrote
199it.
200
201Thus, it is not the intent of this section to claim rights or contest
202your rights to work written entirely by you; rather, the intent is to
203exercise the right to control the distribution of derivative or
204collective works based on the Library.
205
206In addition, mere aggregation of another work not based on the Library
207with the Library (or with a work based on the Library) on a volume of
208a storage or distribution medium does not bring the other work under
209the scope of this License.
210
211 3. You may opt to apply the terms of the ordinary GNU General Public
212License instead of this License to a given copy of the Library. To do
213this, you must alter all the notices that refer to this License, so
214that they refer to the ordinary GNU General Public License, version 2,
215instead of to this License. (If a newer version than version 2 of the
216ordinary GNU General Public License has appeared, then you can specify
217that version instead if you wish.) Do not make any other change in
218these notices.
219
220 Once this change is made in a given copy, it is irreversible for
221that copy, so the ordinary GNU General Public License applies to all
222subsequent copies and derivative works made from that copy.
223
224 This option is useful when you wish to copy part of the code of
225the Library into a program that is not a library.
226
227 4. You may copy and distribute the Library (or a portion or
228derivative of it, under Section 2) in object code or executable form
229under the terms of Sections 1 and 2 above provided that you accompany
230it with the complete corresponding machine-readable source code, which
231must be distributed under the terms of Sections 1 and 2 above on a
232medium customarily used for software interchange.
233
234 If distribution of object code is made by offering access to copy
235from a designated place, then offering equivalent access to copy the
236source code from the same place satisfies the requirement to
237distribute the source code, even though third parties are not
238compelled to copy the source along with the object code.
239
240 5. A program that contains no derivative of any portion of the
241Library, but is designed to work with the Library by being compiled or
242linked with it, is called a "work that uses the Library". Such a
243work, in isolation, is not a derivative work of the Library, and
244therefore falls outside the scope of this License.
245
246 However, linking a "work that uses the Library" with the Library
247creates an executable that is a derivative of the Library (because it
248contains portions of the Library), rather than a "work that uses the
249library". The executable is therefore covered by this License.
250Section 6 states terms for distribution of such executables.
251
252 When a "work that uses the Library" uses material from a header file
253that is part of the Library, the object code for the work may be a
254derivative work of the Library even though the source code is not.
255Whether this is true is especially significant if the work can be
256linked without the Library, or if the work is itself a library. The
257threshold for this to be true is not precisely defined by law.
258
259 If such an object file uses only numerical parameters, data
260structure layouts and accessors, and small macros and small inline
261functions (ten lines or less in length), then the use of the object
262file is unrestricted, regardless of whether it is legally a derivative
263work. (Executables containing this object code plus portions of the
264Library will still fall under Section 6.)
265
266 Otherwise, if the work is a derivative of the Library, you may
267distribute the object code for the work under the terms of Section 6.
268Any executables containing that work also fall under Section 6,
269whether or not they are linked directly with the Library itself.
270
271 6. As an exception to the Sections above, you may also combine or
272link a "work that uses the Library" with the Library to produce a
273work containing portions of the Library, and distribute that work
274under terms of your choice, provided that the terms permit
275modification of the work for the customer's own use and reverse
276engineering for debugging such modifications.
277
278 You must give prominent notice with each copy of the work that the
279Library is used in it and that the Library and its use are covered by
280this License. You must supply a copy of this License. If the work
281during execution displays copyright notices, you must include the
282copyright notice for the Library among them, as well as a reference
283directing the user to the copy of this License. Also, you must do one
284of these things:
285
286 a) Accompany the work with the complete corresponding
287 machine-readable source code for the Library including whatever
288 changes were used in the work (which must be distributed under
289 Sections 1 and 2 above); and, if the work is an executable linked
290 with the Library, with the complete machine-readable "work that
291 uses the Library", as object code and/or source code, so that the
292 user can modify the Library and then relink to produce a modified
293 executable containing the modified Library. (It is understood
294 that the user who changes the contents of definitions files in the
295 Library will not necessarily be able to recompile the application
296 to use the modified definitions.)
297
298 b) Use a suitable shared library mechanism for linking with the
299 Library. A suitable mechanism is one that (1) uses at run time a
300 copy of the library already present on the user's computer system,
301 rather than copying library functions into the executable, and (2)
302 will operate properly with a modified version of the library, if
303 the user installs one, as long as the modified version is
304 interface-compatible with the version that the work was made with.
305
306 c) Accompany the work with a written offer, valid for at
307 least three years, to give the same user the materials
308 specified in Subsection 6a, above, for a charge no more
309 than the cost of performing this distribution.
310
311 d) If distribution of the work is made by offering access to copy
312 from a designated place, offer equivalent access to copy the above
313 specified materials from the same place.
314
315 e) Verify that the user has already received a copy of these
316 materials or that you have already sent this user a copy.
317
318 For an executable, the required form of the "work that uses the
319Library" must include any data and utility programs needed for
320reproducing the executable from it. However, as a special exception,
321the materials to be distributed need not include anything that is
322normally distributed (in either source or binary form) with the major
323components (compiler, kernel, and so on) of the operating system on
324which the executable runs, unless that component itself accompanies
325the executable.
326
327 It may happen that this requirement contradicts the license
328restrictions of other proprietary libraries that do not normally
329accompany the operating system. Such a contradiction means you cannot
330use both them and the Library together in an executable that you
331distribute.
332
333 7. You may place library facilities that are a work based on the
334Library side-by-side in a single library together with other library
335facilities not covered by this License, and distribute such a combined
336library, provided that the separate distribution of the work based on
337the Library and of the other library facilities is otherwise
338permitted, and provided that you do these two things:
339
340 a) Accompany the combined library with a copy of the same work
341 based on the Library, uncombined with any other library
342 facilities. This must be distributed under the terms of the
343 Sections above.
344
345 b) Give prominent notice with the combined library of the fact
346 that part of it is a work based on the Library, and explaining
347 where to find the accompanying uncombined form of the same work.
348
349 8. You may not copy, modify, sublicense, link with, or distribute
350the Library except as expressly provided under this License. Any
351attempt otherwise to copy, modify, sublicense, link with, or
352distribute the Library is void, and will automatically terminate your
353rights under this License. However, parties who have received copies,
354or rights, from you under this License will not have their licenses
355terminated so long as such parties remain in full compliance.
356
357 9. You are not required to accept this License, since you have not
358signed it. However, nothing else grants you permission to modify or
359distribute the Library or its derivative works. These actions are
360prohibited by law if you do not accept this License. Therefore, by
361modifying or distributing the Library (or any work based on the
362Library), you indicate your acceptance of this License to do so, and
363all its terms and conditions for copying, distributing or modifying
364the Library or works based on it.
365
366 10. Each time you redistribute the Library (or any work based on the
367Library), the recipient automatically receives a license from the
368original licensor to copy, distribute, link with or modify the Library
369subject to these terms and conditions. You may not impose any further
370restrictions on the recipients' exercise of the rights granted herein.
371You are not responsible for enforcing compliance by third parties with
372this License.
373
374 11. If, as a consequence of a court judgment or allegation of patent
375infringement or for any other reason (not limited to patent issues),
376conditions are imposed on you (whether by court order, agreement or
377otherwise) that contradict the conditions of this License, they do not
378excuse you from the conditions of this License. If you cannot
379distribute so as to satisfy simultaneously your obligations under this
380License and any other pertinent obligations, then as a consequence you
381may not distribute the Library at all. For example, if a patent
382license would not permit royalty-free redistribution of the Library by
383all those who receive copies directly or indirectly through you, then
384the only way you could satisfy both it and this License would be to
385refrain entirely from distribution of the Library.
386
387If any portion of this section is held invalid or unenforceable under any
388particular circumstance, the balance of the section is intended to apply,
389and the section as a whole is intended to apply in other circumstances.
390
391It is not the purpose of this section to induce you to infringe any
392patents or other property right claims or to contest validity of any
393such claims; this section has the sole purpose of protecting the
394integrity of the free software distribution system which is
395implemented by public license practices. Many people have made
396generous contributions to the wide range of software distributed
397through that system in reliance on consistent application of that
398system; it is up to the author/donor to decide if he or she is willing
399to distribute software through any other system and a licensee cannot
400impose that choice.
401
402This section is intended to make thoroughly clear what is believed to
403be a consequence of the rest of this License.
404
405 12. If the distribution and/or use of the Library is restricted in
406certain countries either by patents or by copyrighted interfaces, the
407original copyright holder who places the Library under this License may add
408an explicit geographical distribution limitation excluding those countries,
409so that distribution is permitted only in or among countries not thus
410excluded. In such case, this License incorporates the limitation as if
411written in the body of this License.
412
413 13. The Free Software Foundation may publish revised and/or new
414versions of the Lesser General Public License from time to time.
415Such new versions will be similar in spirit to the present version,
416but may differ in detail to address new problems or concerns.
417
418Each version is given a distinguishing version number. If the Library
419specifies a version number of this License which applies to it and
420"any later version", you have the option of following the terms and
421conditions either of that version or of any later version published by
422the Free Software Foundation. If the Library does not specify a
423license version number, you may choose any version ever published by
424the Free Software Foundation.
425
426 14. If you wish to incorporate parts of the Library into other free
427programs whose distribution conditions are incompatible with these,
428write to the author to ask for permission. For software which is
429copyrighted by the Free Software Foundation, write to the Free
430Software Foundation; we sometimes make exceptions for this. Our
431decision will be guided by the two goals of preserving the free status
432of all derivatives of our free software and of promoting the sharing
433and reuse of software generally.
434
435 NO WARRANTY
436
437 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
438WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
439EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
440OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
441KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
442IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
443PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
444LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
445THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
446
447 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
448WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
449AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
450FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
451CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
452LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
453RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
454FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
455SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
456DAMAGES.
457
458 END OF TERMS AND CONDITIONS
459
460 How to Apply These Terms to Your New Libraries
461
462 If you develop a new library, and you want it to be of the greatest
463possible use to the public, we recommend making it free software that
464everyone can redistribute and change. You can do so by permitting
465redistribution under these terms (or, alternatively, under the terms of the
466ordinary General Public License).
467
468 To apply these terms, attach the following notices to the library. It is
469safest to attach them to the start of each source file to most effectively
470convey the exclusion of warranty; and each file should have at least the
471"copyright" line and a pointer to where the full notice is found.
472
473 <one line to give the library's name and a brief idea of what it does.>
474 Copyright (C) <year> <name of author>
475
476 This library is free software; you can redistribute it and/or
477 modify it under the terms of the GNU Lesser General Public
478 License as published by the Free Software Foundation; either
479 version 2.1 of the License, or (at your option) any later version.
480
481 This library is distributed in the hope that it will be useful,
482 but WITHOUT ANY WARRANTY; without even the implied warranty of
483 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
484 Lesser General Public License for more details.
485
486 You should have received a copy of the GNU Lesser General Public
487 License along with this library; if not, write to the Free Software
488 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
489
490Also add information on how to contact you by electronic and paper mail.
491
492You should also get your employer (if you work as a programmer) or your
493school, if any, to sign a "copyright disclaimer" for the library, if
494necessary. Here is a sample; alter the names:
495
496 Yoyodyne, Inc., hereby disclaims all copyright interest in the
497 library `Frob' (a library for tweaking knobs) written by James Random Hacker.
498
499 <signature of Ty Coon>, 1 April 1990
500 Ty Coon, President of Vice
501
502That's all there is to it! \ No newline at end of file
diff --git a/externals/qhexedit/qhexedit.cpp b/externals/qhexedit/qhexedit.cpp
deleted file mode 100644
index b12624e08..000000000
--- a/externals/qhexedit/qhexedit.cpp
+++ /dev/null
@@ -1,180 +0,0 @@
1#include <QtGui>
2
3#include "qhexedit.h"
4
5
6QHexEdit::QHexEdit(QWidget *parent) : QScrollArea(parent)
7{
8 qHexEdit_p = new QHexEditPrivate(this);
9 setWidget(qHexEdit_p);
10 setWidgetResizable(true);
11
12 connect(qHexEdit_p, SIGNAL(currentAddressChanged(int)), this, SIGNAL(currentAddressChanged(int)));
13 connect(qHexEdit_p, SIGNAL(currentSizeChanged(int)), this, SIGNAL(currentSizeChanged(int)));
14 connect(qHexEdit_p, SIGNAL(dataChanged()), this, SIGNAL(dataChanged()));
15 connect(qHexEdit_p, SIGNAL(overwriteModeChanged(bool)), this, SIGNAL(overwriteModeChanged(bool)));
16 setFocusPolicy(Qt::NoFocus);
17}
18
19int QHexEdit::indexOf(const QByteArray & ba, int from) const
20{
21 return qHexEdit_p->indexOf(ba, from);
22}
23
24void QHexEdit::insert(int i, const QByteArray & ba)
25{
26 qHexEdit_p->insert(i, ba);
27}
28
29void QHexEdit::insert(int i, char ch)
30{
31 qHexEdit_p->insert(i, ch);
32}
33
34int QHexEdit::lastIndexOf(const QByteArray & ba, int from) const
35{
36 return qHexEdit_p->lastIndexOf(ba, from);
37}
38
39void QHexEdit::remove(int pos, int len)
40{
41 qHexEdit_p->remove(pos, len);
42}
43
44void QHexEdit::replace( int pos, int len, const QByteArray & after)
45{
46 qHexEdit_p->replace(pos, len, after);
47}
48
49QString QHexEdit::toReadableString()
50{
51 return qHexEdit_p->toRedableString();
52}
53
54QString QHexEdit::selectionToReadableString()
55{
56 return qHexEdit_p->selectionToReadableString();
57}
58
59void QHexEdit::setAddressArea(bool addressArea)
60{
61 qHexEdit_p->setAddressArea(addressArea);
62}
63
64void QHexEdit::redo()
65{
66 qHexEdit_p->redo();
67}
68
69void QHexEdit::undo()
70{
71 qHexEdit_p->undo();
72}
73
74void QHexEdit::setAddressWidth(int addressWidth)
75{
76 qHexEdit_p->setAddressWidth(addressWidth);
77}
78
79void QHexEdit::setAsciiArea(bool asciiArea)
80{
81 qHexEdit_p->setAsciiArea(asciiArea);
82}
83
84void QHexEdit::setHighlighting(bool mode)
85{
86 qHexEdit_p->setHighlighting(mode);
87}
88
89void QHexEdit::setAddressOffset(int offset)
90{
91 qHexEdit_p->setAddressOffset(offset);
92}
93
94int QHexEdit::addressOffset()
95{
96 return qHexEdit_p->addressOffset();
97}
98
99void QHexEdit::setCursorPosition(int cursorPos)
100{
101 // cursorPos in QHexEditPrivate is the position of the textcoursor without
102 // blanks, means bytePos*2
103 qHexEdit_p->setCursorPos(cursorPos*2);
104}
105
106int QHexEdit::cursorPosition()
107{
108 return qHexEdit_p->cursorPos() / 2;
109}
110
111
112void QHexEdit::setData(const QByteArray &data)
113{
114 qHexEdit_p->setData(data);
115}
116
117QByteArray QHexEdit::data()
118{
119 return qHexEdit_p->data();
120}
121
122void QHexEdit::setAddressAreaColor(const QColor &color)
123{
124 qHexEdit_p->setAddressAreaColor(color);
125}
126
127QColor QHexEdit::addressAreaColor()
128{
129 return qHexEdit_p->addressAreaColor();
130}
131
132void QHexEdit::setHighlightingColor(const QColor &color)
133{
134 qHexEdit_p->setHighlightingColor(color);
135}
136
137QColor QHexEdit::highlightingColor()
138{
139 return qHexEdit_p->highlightingColor();
140}
141
142void QHexEdit::setSelectionColor(const QColor &color)
143{
144 qHexEdit_p->setSelectionColor(color);
145}
146
147QColor QHexEdit::selectionColor()
148{
149 return qHexEdit_p->selectionColor();
150}
151
152void QHexEdit::setOverwriteMode(bool overwriteMode)
153{
154 qHexEdit_p->setOverwriteMode(overwriteMode);
155}
156
157bool QHexEdit::overwriteMode()
158{
159 return qHexEdit_p->overwriteMode();
160}
161
162void QHexEdit::setReadOnly(bool readOnly)
163{
164 qHexEdit_p->setReadOnly(readOnly);
165}
166
167bool QHexEdit::isReadOnly()
168{
169 return qHexEdit_p->isReadOnly();
170}
171
172void QHexEdit::setFont(const QFont &font)
173{
174 qHexEdit_p->setFont(font);
175}
176
177const QFont & QHexEdit::font() const
178{
179 return qHexEdit_p->font();
180}
diff --git a/externals/qhexedit/qhexedit.h b/externals/qhexedit/qhexedit.h
deleted file mode 100644
index 15b6d7603..000000000
--- a/externals/qhexedit/qhexedit.h
+++ /dev/null
@@ -1,240 +0,0 @@
1// Original author: Winfried Simon
2// See http://code.google.com/p/qhexedit2/
3// Huge thanks!
4
5#ifndef QHEXEDIT_H
6#define QHEXEDIT_H
7
8#include <QtGui>
9#include "qhexedit_p.h"
10
11/** \mainpage
12QHexEdit is a binary editor widget for Qt.
13
14\version Version 0.6.3
15\image html hexedit.png
16*/
17
18
19/*! QHexEdit is a hex editor widget written in C++ for the Qt (Qt4) framework.
20It is a simple editor for binary data, just like QPlainTextEdit is for text
21data. There are sip configuration files included, so it is easy to create
22bindings for PyQt and you can use this widget also in python.
23
24QHexEdit takes the data of a QByteArray (setData()) and shows it. You can use
25the mouse or the keyboard to navigate inside the widget. If you hit the keys
26(0..9, a..f) you will change the data. Changed data is highlighted and can be
27accessed via data().
28
29Normaly QHexEdit works in the overwrite Mode. You can set overwriteMode(false)
30and insert data. In this case the size of data() increases. It is also possible
31to delete bytes (del or backspace), here the size of data decreases.
32
33You can select data with keyboard hits or mouse movements. The copy-key will
34copy the selected data into the clipboard. The cut-key copies also but delets
35it afterwards. In overwrite mode, the paste function overwrites the content of
36the (does not change the length) data. In insert mode, clipboard data will be
37inserted. The clipboard content is expected in ASCII Hex notation. Unknown
38characters will be ignored.
39
40QHexEdit comes with undo/redo functionality. All changes can be undone, by
41pressing the undo-key (usually ctr-z). They can also be redone afterwards.
42The undo/redo framework is cleared, when setData() sets up a new
43content for the editor. You can search data inside the content with indexOf()
44and lastIndexOf(). The replace() function is to change located subdata. This
45'replaced' data can also be undone by the undo/redo framework.
46
47This widget can only handle small amounts of data. The size has to be below 10
48megabytes, otherwise the scroll sliders ard not shown and you can't scroll any
49more.
50*/
51 class QHexEdit : public QScrollArea
52{
53 Q_OBJECT
54 /*! Property data holds the content of QHexEdit. Call setData() to set the
55 content of QHexEdit, data() returns the actual content.
56 */
57 Q_PROPERTY(QByteArray data READ data WRITE setData)
58
59 /*! Property addressOffset is added to the Numbers of the Address Area.
60 A offset in the address area (left side) is sometimes usefull, whe you show
61 only a segment of a complete memory picture. With setAddressOffset() you set
62 this property - with addressOffset() you get the actual value.
63 */
64 Q_PROPERTY(int addressOffset READ addressOffset WRITE setAddressOffset)
65
66 /*! Property address area color sets (setAddressAreaColor()) the backgorund
67 color of address areas. You can also read the color (addressaAreaColor()).
68 */
69 Q_PROPERTY(QColor addressAreaColor READ addressAreaColor WRITE setAddressAreaColor)
70
71 /*! Porperty cursorPosition sets or gets the position of the editor cursor
72 in QHexEdit.
73 */
74 Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition)
75
76 /*! Property highlighting color sets (setHighlightingColor()) the backgorund
77 color of highlighted text areas. You can also read the color
78 (highlightingColor()).
79 */
80 Q_PROPERTY(QColor highlightingColor READ highlightingColor WRITE setHighlightingColor)
81
82 /*! Property selection color sets (setSelectionColor()) the backgorund
83 color of selected text areas. You can also read the color
84 (selectionColor()).
85 */
86 Q_PROPERTY(QColor selectionColor READ selectionColor WRITE setSelectionColor)
87
88 /*! Porperty overwrite mode sets (setOverwriteMode()) or gets (overwriteMode()) the mode
89 in which the editor works. In overwrite mode the user will overwrite existing data. The
90 size of data will be constant. In insert mode the size will grow, when inserting
91 new data.
92 */
93 Q_PROPERTY(bool overwriteMode READ overwriteMode WRITE setOverwriteMode)
94
95 /*! Porperty readOnly sets (setReadOnly()) or gets (isReadOnly) the mode
96 in which the editor works. In readonly mode the the user can only navigate
97 through the data and select data; modifying is not possible. This
98 property's default is false.
99 */
100 Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly)
101
102 /*! Set the font of the widget. Please use fixed width fonts like Mono or Courier.*/
103 Q_PROPERTY(QFont font READ font WRITE setFont)
104
105
106public:
107 /*! Creates an instance of QHexEdit.
108 \param parent Parent widget of QHexEdit.
109 */
110 QHexEdit(QWidget *parent = 0);
111
112 /*! Returns the index position of the first occurrence
113 of the byte array ba in this byte array, searching forward from index position
114 from. Returns -1 if ba could not be found. In addition to this functionality
115 of QByteArray the cursorposition is set to the end of found bytearray and
116 it will be selected.
117
118 */
119 int indexOf(const QByteArray & ba, int from = 0) const;
120
121 /*! Inserts a byte array.
122 \param i Index position, where to insert
123 \param ba byte array, which is to insert
124 In overwrite mode, the existing data will be overwritten, in insertmode ba will be
125 inserted and size of data grows.
126 */
127 void insert(int i, const QByteArray & ba);
128
129 /*! Inserts a char.
130 \param i Index position, where to insert
131 \param ch Char, which is to insert
132 In overwrite mode, the existing data will be overwritten, in insertmode ba will be
133 inserted and size of data grows.
134 */
135 void insert(int i, char ch);
136
137 /*! Returns the index position of the last occurrence
138 of the byte array ba in this byte array, searching backwards from index position
139 from. Returns -1 if ba could not be found. In addition to this functionality
140 of QByteArray the cursorposition is set to the beginning of found bytearray and
141 it will be selected.
142
143 */
144 int lastIndexOf(const QByteArray & ba, int from = 0) const;
145
146 /*! Removes len bytes from the content.
147 \param pos Index position, where to remove
148 \param len Amount of bytes to remove
149 In overwrite mode, the existing bytes will be overwriten with 0x00.
150 */
151 void remove(int pos, int len=1);
152
153 /*! Replaces len bytes from index position pos with the byte array after.
154 */
155 void replace( int pos, int len, const QByteArray & after);
156
157 /*! Gives back a formatted image of the content of QHexEdit
158 */
159 QString toReadableString();
160
161 /*! Gives back a formatted image of the selected content of QHexEdit
162 */
163 QString selectionToReadableString();
164
165 /*! \cond docNever */
166 void setAddressOffset(int offset);
167 int addressOffset();
168 void setCursorPosition(int cusorPos);
169 int cursorPosition();
170 void setData(QByteArray const &data);
171 QByteArray data();
172 void setAddressAreaColor(QColor const &color);
173 QColor addressAreaColor();
174 void setHighlightingColor(QColor const &color);
175 QColor highlightingColor();
176 void setSelectionColor(QColor const &color);
177 QColor selectionColor();
178 void setOverwriteMode(bool);
179 bool overwriteMode();
180 void setReadOnly(bool);
181 bool isReadOnly();
182 const QFont &font() const;
183 void setFont(const QFont &);
184 /*! \endcond docNever */
185
186public slots:
187 /*! Redoes the last operation. If there is no operation to redo, i.e.
188 there is no redo step in the undo/redo history, nothing happens.
189 */
190 void redo();
191
192 /*! Set the minimum width of the address area.
193 \param addressWidth Width in characters.
194 */
195 void setAddressWidth(int addressWidth);
196
197 /*! Switch the address area on or off.
198 \param addressArea true (show it), false (hide it).
199 */
200 void setAddressArea(bool addressArea);
201
202 /*! Switch the ascii area on or off.
203 \param asciiArea true (show it), false (hide it).
204 */
205 void setAsciiArea(bool asciiArea);
206
207 /*! Switch the highlighting feature on or of.
208 \param mode true (show it), false (hide it).
209 */
210 void setHighlighting(bool mode);
211
212 /*! Undoes the last operation. If there is no operation to undo, i.e.
213 there is no undo step in the undo/redo history, nothing happens.
214 */
215 void undo();
216
217signals:
218
219 /*! Contains the address, where the cursor is located. */
220 void currentAddressChanged(int address);
221
222 /*! Contains the size of the data to edit. */
223 void currentSizeChanged(int size);
224
225 /*! The signal is emited every time, the data is changed. */
226 void dataChanged();
227
228 /*! The signal is emited every time, the overwrite mode is changed. */
229 void overwriteModeChanged(bool state);
230
231private:
232 /*! \cond docNever */
233 QHexEditPrivate *qHexEdit_p;
234 QHBoxLayout *layout;
235 QScrollArea *scrollArea;
236 /*! \endcond docNever */
237};
238
239#endif
240
diff --git a/externals/qhexedit/qhexedit_p.cpp b/externals/qhexedit/qhexedit_p.cpp
deleted file mode 100644
index 2a6885de8..000000000
--- a/externals/qhexedit/qhexedit_p.cpp
+++ /dev/null
@@ -1,857 +0,0 @@
1#include "qhexedit_p.h"
2#include "commands.h"
3
4const int HEXCHARS_IN_LINE = 47;
5const int GAP_ADR_HEX = 10;
6const int GAP_HEX_ASCII = 16;
7const int BYTES_PER_LINE = 16;
8
9QHexEditPrivate::QHexEditPrivate(QScrollArea *parent) : QWidget(parent)
10{
11 _undoStack = new QUndoStack(this);
12
13 _scrollArea = parent;
14 setAddressWidth(4);
15 setAddressOffset(0);
16 setAddressArea(true);
17 setAsciiArea(true);
18 setHighlighting(true);
19 setOverwriteMode(true);
20 setReadOnly(false);
21 setAddressAreaColor(QColor(0xd4, 0xd4, 0xd4, 0xff));
22 setHighlightingColor(QColor(0xff, 0xff, 0x99, 0xff));
23 setSelectionColor(QColor(0x6d, 0x9e, 0xff, 0xff));
24 setFont(QFont("Courier", 10));
25
26 _size = 0;
27 resetSelection(0);
28
29 setFocusPolicy(Qt::StrongFocus);
30
31 connect(&_cursorTimer, SIGNAL(timeout()), this, SLOT(updateCursor()));
32 _cursorTimer.setInterval(500);
33 _cursorTimer.start();
34}
35
36void QHexEditPrivate::setAddressOffset(int offset)
37{
38 _xData.setAddressOffset(offset);
39 adjust();
40}
41
42int QHexEditPrivate::addressOffset()
43{
44 return _xData.addressOffset();
45}
46
47void QHexEditPrivate::setData(const QByteArray &data)
48{
49 _xData.setData(data);
50 _undoStack->clear();
51 adjust();
52 setCursorPos(0);
53}
54
55QByteArray QHexEditPrivate::data()
56{
57 return _xData.data();
58}
59
60void QHexEditPrivate::setAddressAreaColor(const QColor &color)
61{
62 _addressAreaColor = color;
63 update();
64}
65
66QColor QHexEditPrivate::addressAreaColor()
67{
68 return _addressAreaColor;
69}
70
71void QHexEditPrivate::setHighlightingColor(const QColor &color)
72{
73 _highlightingColor = color;
74 update();
75}
76
77QColor QHexEditPrivate::highlightingColor()
78{
79 return _highlightingColor;
80}
81
82void QHexEditPrivate::setSelectionColor(const QColor &color)
83{
84 _selectionColor = color;
85 update();
86}
87
88QColor QHexEditPrivate::selectionColor()
89{
90 return _selectionColor;
91}
92
93void QHexEditPrivate::setReadOnly(bool readOnly)
94{
95 _readOnly = readOnly;
96}
97
98bool QHexEditPrivate::isReadOnly()
99{
100 return _readOnly;
101}
102
103XByteArray & QHexEditPrivate::xData()
104{
105 return _xData;
106}
107
108int QHexEditPrivate::indexOf(const QByteArray & ba, int from)
109{
110 if (from > (_xData.data().length() - 1))
111 from = _xData.data().length() - 1;
112 int idx = _xData.data().indexOf(ba, from);
113 if (idx > -1)
114 {
115 int curPos = idx*2;
116 setCursorPos(curPos + ba.length()*2);
117 resetSelection(curPos);
118 setSelection(curPos + ba.length()*2);
119 ensureVisible();
120 }
121 return idx;
122}
123
124void QHexEditPrivate::insert(int index, const QByteArray & ba)
125{
126 if (ba.length() > 0)
127 {
128 if (_overwriteMode)
129 {
130 QUndoCommand *arrayCommand= new ArrayCommand(&_xData, ArrayCommand::replace, index, ba, ba.length());
131 _undoStack->push(arrayCommand);
132 emit dataChanged();
133 }
134 else
135 {
136 QUndoCommand *arrayCommand= new ArrayCommand(&_xData, ArrayCommand::insert, index, ba, ba.length());
137 _undoStack->push(arrayCommand);
138 emit dataChanged();
139 }
140 }
141}
142
143void QHexEditPrivate::insert(int index, char ch)
144{
145 QUndoCommand *charCommand = new CharCommand(&_xData, CharCommand::insert, index, ch);
146 _undoStack->push(charCommand);
147 emit dataChanged();
148}
149
150int QHexEditPrivate::lastIndexOf(const QByteArray & ba, int from)
151{
152 from -= ba.length();
153 if (from < 0)
154 from = 0;
155 int idx = _xData.data().lastIndexOf(ba, from);
156 if (idx > -1)
157 {
158 int curPos = idx*2;
159 setCursorPos(curPos);
160 resetSelection(curPos);
161 setSelection(curPos + ba.length()*2);
162 ensureVisible();
163 }
164 return idx;
165}
166
167void QHexEditPrivate::remove(int index, int len)
168{
169 if (len > 0)
170 {
171 if (len == 1)
172 {
173 if (_overwriteMode)
174 {
175 QUndoCommand *charCommand = new CharCommand(&_xData, CharCommand::replace, index, char(0));
176 _undoStack->push(charCommand);
177 emit dataChanged();
178 }
179 else
180 {
181 QUndoCommand *charCommand = new CharCommand(&_xData, CharCommand::remove, index, char(0));
182 _undoStack->push(charCommand);
183 emit dataChanged();
184 }
185 }
186 else
187 {
188 QByteArray ba = QByteArray(len, char(0));
189 if (_overwriteMode)
190 {
191 QUndoCommand *arrayCommand = new ArrayCommand(&_xData, ArrayCommand::replace, index, ba, ba.length());
192 _undoStack->push(arrayCommand);
193 emit dataChanged();
194 }
195 else
196 {
197 QUndoCommand *arrayCommand= new ArrayCommand(&_xData, ArrayCommand::remove, index, ba, len);
198 _undoStack->push(arrayCommand);
199 emit dataChanged();
200 }
201 }
202 }
203}
204
205void QHexEditPrivate::replace(int index, char ch)
206{
207 QUndoCommand *charCommand = new CharCommand(&_xData, CharCommand::replace, index, ch);
208 _undoStack->push(charCommand);
209 resetSelection();
210 emit dataChanged();
211}
212
213void QHexEditPrivate::replace(int index, const QByteArray & ba)
214{
215 QUndoCommand *arrayCommand= new ArrayCommand(&_xData, ArrayCommand::replace, index, ba, ba.length());
216 _undoStack->push(arrayCommand);
217 resetSelection();
218 emit dataChanged();
219}
220
221void QHexEditPrivate::replace(int pos, int len, const QByteArray &after)
222{
223 QUndoCommand *arrayCommand= new ArrayCommand(&_xData, ArrayCommand::replace, pos, after, len);
224 _undoStack->push(arrayCommand);
225 resetSelection();
226 emit dataChanged();
227}
228
229void QHexEditPrivate::setAddressArea(bool addressArea)
230{
231 _addressArea = addressArea;
232 adjust();
233
234 setCursorPos(_cursorPosition);
235}
236
237void QHexEditPrivate::setAddressWidth(int addressWidth)
238{
239 _xData.setAddressWidth(addressWidth);
240
241 setCursorPos(_cursorPosition);
242}
243
244void QHexEditPrivate::setAsciiArea(bool asciiArea)
245{
246 _asciiArea = asciiArea;
247 adjust();
248}
249
250void QHexEditPrivate::setFont(const QFont &font)
251{
252 QWidget::setFont(font);
253 adjust();
254}
255
256void QHexEditPrivate::setHighlighting(bool mode)
257{
258 _highlighting = mode;
259 update();
260}
261
262void QHexEditPrivate::setOverwriteMode(bool overwriteMode)
263{
264 _overwriteMode = overwriteMode;
265}
266
267bool QHexEditPrivate::overwriteMode()
268{
269 return _overwriteMode;
270}
271
272void QHexEditPrivate::redo()
273{
274 _undoStack->redo();
275 emit dataChanged();
276 setCursorPos(_cursorPosition);
277 update();
278}
279
280void QHexEditPrivate::undo()
281{
282 _undoStack->undo();
283 emit dataChanged();
284 setCursorPos(_cursorPosition);
285 update();
286}
287
288QString QHexEditPrivate::toRedableString()
289{
290 return _xData.toRedableString();
291}
292
293
294QString QHexEditPrivate::selectionToReadableString()
295{
296 return _xData.toRedableString(getSelectionBegin(), getSelectionEnd());
297}
298
299void QHexEditPrivate::keyPressEvent(QKeyEvent *event)
300{
301 int charX = (_cursorX - _xPosHex) / _charWidth;
302 int posX = (charX / 3) * 2 + (charX % 3);
303 int posBa = (_cursorY / _charHeight) * BYTES_PER_LINE + posX / 2;
304
305
306/*****************************************************************************/
307/* Cursor movements */
308/*****************************************************************************/
309
310 if (event->matches(QKeySequence::MoveToNextChar))
311 {
312 setCursorPos(_cursorPosition + 1);
313 resetSelection(_cursorPosition);
314 }
315 if (event->matches(QKeySequence::MoveToPreviousChar))
316 {
317 setCursorPos(_cursorPosition - 1);
318 resetSelection(_cursorPosition);
319 }
320 if (event->matches(QKeySequence::MoveToEndOfLine))
321 {
322 setCursorPos(_cursorPosition | (2 * BYTES_PER_LINE -1));
323 resetSelection(_cursorPosition);
324 }
325 if (event->matches(QKeySequence::MoveToStartOfLine))
326 {
327 setCursorPos(_cursorPosition - (_cursorPosition % (2 * BYTES_PER_LINE)));
328 resetSelection(_cursorPosition);
329 }
330 if (event->matches(QKeySequence::MoveToPreviousLine))
331 {
332 setCursorPos(_cursorPosition - (2 * BYTES_PER_LINE));
333 resetSelection(_cursorPosition);
334 }
335 if (event->matches(QKeySequence::MoveToNextLine))
336 {
337 setCursorPos(_cursorPosition + (2 * BYTES_PER_LINE));
338 resetSelection(_cursorPosition);
339 }
340
341 if (event->matches(QKeySequence::MoveToNextPage))
342 {
343 setCursorPos(_cursorPosition + (((_scrollArea->viewport()->height() / _charHeight) - 1) * 2 * BYTES_PER_LINE));
344 resetSelection(_cursorPosition);
345 }
346 if (event->matches(QKeySequence::MoveToPreviousPage))
347 {
348 setCursorPos(_cursorPosition - (((_scrollArea->viewport()->height() / _charHeight) - 1) * 2 * BYTES_PER_LINE));
349 resetSelection(_cursorPosition);
350 }
351 if (event->matches(QKeySequence::MoveToEndOfDocument))
352 {
353 setCursorPos(_xData.size() * 2);
354 resetSelection(_cursorPosition);
355 }
356 if (event->matches(QKeySequence::MoveToStartOfDocument))
357 {
358 setCursorPos(0);
359 resetSelection(_cursorPosition);
360 }
361
362/*****************************************************************************/
363/* Select commands */
364/*****************************************************************************/
365 if (event->matches(QKeySequence::SelectAll))
366 {
367 resetSelection(0);
368 setSelection(2*_xData.size() + 1);
369 }
370 if (event->matches(QKeySequence::SelectNextChar))
371 {
372 int pos = _cursorPosition + 1;
373 setCursorPos(pos);
374 setSelection(pos);
375 }
376 if (event->matches(QKeySequence::SelectPreviousChar))
377 {
378 int pos = _cursorPosition - 1;
379 setSelection(pos);
380 setCursorPos(pos);
381 }
382 if (event->matches(QKeySequence::SelectEndOfLine))
383 {
384 int pos = _cursorPosition - (_cursorPosition % (2 * BYTES_PER_LINE)) + (2 * BYTES_PER_LINE);
385 setCursorPos(pos);
386 setSelection(pos);
387 }
388 if (event->matches(QKeySequence::SelectStartOfLine))
389 {
390 int pos = _cursorPosition - (_cursorPosition % (2 * BYTES_PER_LINE));
391 setCursorPos(pos);
392 setSelection(pos);
393 }
394 if (event->matches(QKeySequence::SelectPreviousLine))
395 {
396 int pos = _cursorPosition - (2 * BYTES_PER_LINE);
397 setCursorPos(pos);
398 setSelection(pos);
399 }
400 if (event->matches(QKeySequence::SelectNextLine))
401 {
402 int pos = _cursorPosition + (2 * BYTES_PER_LINE);
403 setCursorPos(pos);
404 setSelection(pos);
405 }
406
407 if (event->matches(QKeySequence::SelectNextPage))
408 {
409 int pos = _cursorPosition + (((_scrollArea->viewport()->height() / _charHeight) - 1) * 2 * BYTES_PER_LINE);
410 setCursorPos(pos);
411 setSelection(pos);
412 }
413 if (event->matches(QKeySequence::SelectPreviousPage))
414 {
415 int pos = _cursorPosition - (((_scrollArea->viewport()->height() / _charHeight) - 1) * 2 * BYTES_PER_LINE);
416 setCursorPos(pos);
417 setSelection(pos);
418 }
419 if (event->matches(QKeySequence::SelectEndOfDocument))
420 {
421 int pos = _xData.size() * 2;
422 setCursorPos(pos);
423 setSelection(pos);
424 }
425 if (event->matches(QKeySequence::SelectStartOfDocument))
426 {
427 int pos = 0;
428 setCursorPos(pos);
429 setSelection(pos);
430 }
431
432/*****************************************************************************/
433/* Edit Commands */
434/*****************************************************************************/
435if (!_readOnly)
436{
437 /* Hex input */
438 int key = int(event->text()[0].toLatin1());
439 if ((key>='0' && key<='9') || (key>='a' && key <= 'f'))
440 {
441 if (getSelectionBegin() != getSelectionEnd())
442 {
443 posBa = getSelectionBegin();
444 remove(posBa, getSelectionEnd() - posBa);
445 setCursorPos(2*posBa);
446 resetSelection(2*posBa);
447 }
448
449 // If insert mode, then insert a byte
450 if (_overwriteMode == false)
451 if ((charX % 3) == 0)
452 {
453 insert(posBa, char(0));
454 }
455
456 // Change content
457 if (_xData.size() > 0)
458 {
459 QByteArray hexValue = _xData.data().mid(posBa, 1).toHex();
460 if ((charX % 3) == 0)
461 hexValue[0] = key;
462 else
463 hexValue[1] = key;
464
465 replace(posBa, QByteArray().fromHex(hexValue)[0]);
466
467 setCursorPos(_cursorPosition + 1);
468 resetSelection(_cursorPosition);
469 }
470 }
471
472 /* Cut & Paste */
473 if (event->matches(QKeySequence::Cut))
474 {
475 QString result = QString();
476 for (int idx = getSelectionBegin(); idx < getSelectionEnd(); idx++)
477 {
478 result += _xData.data().mid(idx, 1).toHex() + " ";
479 if ((idx % 16) == 15)
480 result.append("\n");
481 }
482 remove(getSelectionBegin(), getSelectionEnd() - getSelectionBegin());
483 QClipboard *clipboard = QApplication::clipboard();
484 clipboard->setText(result);
485 setCursorPos(getSelectionBegin());
486 resetSelection(getSelectionBegin());
487 }
488
489 if (event->matches(QKeySequence::Paste))
490 {
491 QClipboard *clipboard = QApplication::clipboard();
492 QByteArray ba = QByteArray().fromHex(clipboard->text().toLatin1());
493 insert(_cursorPosition / 2, ba);
494 setCursorPos(_cursorPosition + 2 * ba.length());
495 resetSelection(getSelectionBegin());
496 }
497
498
499 /* Delete char */
500 if (event->matches(QKeySequence::Delete))
501 {
502 if (getSelectionBegin() != getSelectionEnd())
503 {
504 posBa = getSelectionBegin();
505 remove(posBa, getSelectionEnd() - posBa);
506 setCursorPos(2*posBa);
507 resetSelection(2*posBa);
508 }
509 else
510 {
511 if (_overwriteMode)
512 replace(posBa, char(0));
513 else
514 remove(posBa, 1);
515 }
516 }
517
518 /* Backspace */
519 if ((event->key() == Qt::Key_Backspace) && (event->modifiers() == Qt::NoModifier))
520 {
521 if (getSelectionBegin() != getSelectionEnd())
522 {
523 posBa = getSelectionBegin();
524 remove(posBa, getSelectionEnd() - posBa);
525 setCursorPos(2*posBa);
526 resetSelection(2*posBa);
527 }
528 else
529 {
530 if (posBa > 0)
531 {
532 if (_overwriteMode)
533 replace(posBa - 1, char(0));
534 else
535 remove(posBa - 1, 1);
536 setCursorPos(_cursorPosition - 2);
537 }
538 }
539 }
540
541 /* undo */
542 if (event->matches(QKeySequence::Undo))
543 {
544 undo();
545 }
546
547 /* redo */
548 if (event->matches(QKeySequence::Redo))
549 {
550 redo();
551 }
552
553 }
554
555 if (event->matches(QKeySequence::Copy))
556 {
557 QString result = QString();
558 for (int idx = getSelectionBegin(); idx < getSelectionEnd(); idx++)
559 {
560 result += _xData.data().mid(idx, 1).toHex() + " ";
561 if ((idx % 16) == 15)
562 result.append('\n');
563 }
564 QClipboard *clipboard = QApplication::clipboard();
565 clipboard->setText(result);
566 }
567
568 // Switch between insert/overwrite mode
569 if ((event->key() == Qt::Key_Insert) && (event->modifiers() == Qt::NoModifier))
570 {
571 _overwriteMode = !_overwriteMode;
572 setCursorPos(_cursorPosition);
573 overwriteModeChanged(_overwriteMode);
574 }
575
576 ensureVisible();
577 update();
578}
579
580void QHexEditPrivate::mouseMoveEvent(QMouseEvent * event)
581{
582 _blink = false;
583 update();
584 int actPos = cursorPos(event->pos());
585 setCursorPos(actPos);
586 setSelection(actPos);
587}
588
589void QHexEditPrivate::mousePressEvent(QMouseEvent * event)
590{
591 _blink = false;
592 update();
593 int cPos = cursorPos(event->pos());
594 resetSelection(cPos);
595 setCursorPos(cPos);
596}
597
598void QHexEditPrivate::paintEvent(QPaintEvent *event)
599{
600 QPainter painter(this);
601
602 // draw some patterns if needed
603 painter.fillRect(event->rect(), this->palette().color(QPalette::Base));
604 if (_addressArea)
605 painter.fillRect(QRect(_xPosAdr, event->rect().top(), _xPosHex - GAP_ADR_HEX + 2, height()), _addressAreaColor);
606 if (_asciiArea)
607 {
608 int linePos = _xPosAscii - (GAP_HEX_ASCII / 2);
609 painter.setPen(Qt::gray);
610 painter.drawLine(linePos, event->rect().top(), linePos, height());
611 }
612
613 painter.setPen(this->palette().color(QPalette::WindowText));
614
615 // calc position
616 int firstLineIdx = ((event->rect().top()/ _charHeight) - _charHeight) * BYTES_PER_LINE;
617 if (firstLineIdx < 0)
618 firstLineIdx = 0;
619 int lastLineIdx = ((event->rect().bottom() / _charHeight) + _charHeight) * BYTES_PER_LINE;
620 if (lastLineIdx > _xData.size())
621 lastLineIdx = _xData.size();
622 int yPosStart = ((firstLineIdx) / BYTES_PER_LINE) * _charHeight + _charHeight;
623
624 // paint address area
625 if (_addressArea)
626 {
627 for (int lineIdx = firstLineIdx, yPos = yPosStart; lineIdx < lastLineIdx; lineIdx += BYTES_PER_LINE, yPos +=_charHeight)
628 {
629 QString address = QString("%1")
630 .arg(lineIdx + _xData.addressOffset(), _xData.realAddressNumbers(), 16, QChar('0'));
631 painter.drawText(_xPosAdr, yPos, address);
632 }
633 }
634
635 // paint hex area
636 QByteArray hexBa(_xData.data().mid(firstLineIdx, lastLineIdx - firstLineIdx + 1).toHex());
637 QBrush highLighted = QBrush(_highlightingColor);
638 QPen colHighlighted = QPen(this->palette().color(QPalette::WindowText));
639 QBrush selected = QBrush(_selectionColor);
640 QPen colSelected = QPen(Qt::white);
641 QPen colStandard = QPen(this->palette().color(QPalette::WindowText));
642
643 painter.setBackgroundMode(Qt::TransparentMode);
644
645 for (int lineIdx = firstLineIdx, yPos = yPosStart; lineIdx < lastLineIdx; lineIdx += BYTES_PER_LINE, yPos +=_charHeight)
646 {
647 QByteArray hex;
648 int xPos = _xPosHex;
649 for (int colIdx = 0; ((lineIdx + colIdx) < _xData.size() && (colIdx < BYTES_PER_LINE)); colIdx++)
650 {
651 int posBa = lineIdx + colIdx;
652 if ((getSelectionBegin() <= posBa) && (getSelectionEnd() > posBa))
653 {
654 painter.setBackground(selected);
655 painter.setBackgroundMode(Qt::OpaqueMode);
656 painter.setPen(colSelected);
657 }
658 else
659 {
660 if (_highlighting)
661 {
662 // hilight diff bytes
663 painter.setBackground(highLighted);
664 if (_xData.dataChanged(posBa))
665 {
666 painter.setPen(colHighlighted);
667 painter.setBackgroundMode(Qt::OpaqueMode);
668 }
669 else
670 {
671 painter.setPen(colStandard);
672 painter.setBackgroundMode(Qt::TransparentMode);
673 }
674 }
675 }
676
677 // render hex value
678 if (colIdx == 0)
679 {
680 hex = hexBa.mid((lineIdx - firstLineIdx) * 2, 2);
681 painter.drawText(xPos, yPos, hex);
682 xPos += 2 * _charWidth;
683 } else {
684 hex = hexBa.mid((lineIdx + colIdx - firstLineIdx) * 2, 2).prepend(" ");
685 painter.drawText(xPos, yPos, hex);
686 xPos += 3 * _charWidth;
687 }
688
689 }
690 }
691 painter.setBackgroundMode(Qt::TransparentMode);
692 painter.setPen(this->palette().color(QPalette::WindowText));
693
694 // paint ascii area
695 if (_asciiArea)
696 {
697 for (int lineIdx = firstLineIdx, yPos = yPosStart; lineIdx < lastLineIdx; lineIdx += BYTES_PER_LINE, yPos +=_charHeight)
698 {
699 int xPosAscii = _xPosAscii;
700 for (int colIdx = 0; ((lineIdx + colIdx) < _xData.size() && (colIdx < BYTES_PER_LINE)); colIdx++)
701 {
702 painter.drawText(xPosAscii, yPos, _xData.asciiChar(lineIdx + colIdx));
703 xPosAscii += _charWidth;
704 }
705 }
706 }
707
708 // paint cursor
709 if (_blink && !_readOnly && hasFocus())
710 {
711 if (_overwriteMode)
712 painter.fillRect(_cursorX, _cursorY + _charHeight - 2, _charWidth, 2, this->palette().color(QPalette::WindowText));
713 else
714 painter.fillRect(_cursorX, _cursorY, 2, _charHeight, this->palette().color(QPalette::WindowText));
715 }
716
717 if (_size != _xData.size())
718 {
719 _size = _xData.size();
720 emit currentSizeChanged(_size);
721 }
722}
723
724void QHexEditPrivate::setCursorPos(int position)
725{
726 // delete cursor
727 _blink = false;
728 update();
729
730 // cursor in range?
731 if (_overwriteMode)
732 {
733 if (position > (_xData.size() * 2 - 1))
734 position = _xData.size() * 2 - 1;
735 } else {
736 if (position > (_xData.size() * 2))
737 position = _xData.size() * 2;
738 }
739
740 if (position < 0)
741 position = 0;
742
743 // calc position
744 _cursorPosition = position;
745 _cursorY = (position / (2 * BYTES_PER_LINE)) * _charHeight + 4;
746 int x = (position % (2 * BYTES_PER_LINE));
747 _cursorX = (((x / 2) * 3) + (x % 2)) * _charWidth + _xPosHex;
748
749 // immiadately draw cursor
750 _blink = true;
751 update();
752 emit currentAddressChanged(_cursorPosition/2);
753}
754
755int QHexEditPrivate::cursorPos(QPoint pos)
756{
757 int result = -1;
758 // find char under cursor
759 if ((pos.x() >= _xPosHex) && (pos.x() < (_xPosHex + HEXCHARS_IN_LINE * _charWidth)))
760 {
761 int x = (pos.x() - _xPosHex) / _charWidth;
762 if ((x % 3) == 0)
763 x = (x / 3) * 2;
764 else
765 x = ((x / 3) * 2) + 1;
766 int y = ((pos.y() - 3) / _charHeight) * 2 * BYTES_PER_LINE;
767 result = x + y;
768 }
769 return result;
770}
771
772int QHexEditPrivate::cursorPos()
773{
774 return _cursorPosition;
775}
776
777void QHexEditPrivate::resetSelection()
778{
779 _selectionBegin = _selectionInit;
780 _selectionEnd = _selectionInit;
781}
782
783void QHexEditPrivate::resetSelection(int pos)
784{
785 if (pos < 0)
786 pos = 0;
787 pos = pos / 2;
788 _selectionInit = pos;
789 _selectionBegin = pos;
790 _selectionEnd = pos;
791}
792
793void QHexEditPrivate::setSelection(int pos)
794{
795 if (pos < 0)
796 pos = 0;
797 pos = pos / 2;
798 if (pos >= _selectionInit)
799 {
800 _selectionEnd = pos;
801 _selectionBegin = _selectionInit;
802 }
803 else
804 {
805 _selectionBegin = pos;
806 _selectionEnd = _selectionInit;
807 }
808}
809
810int QHexEditPrivate::getSelectionBegin()
811{
812 return _selectionBegin;
813}
814
815int QHexEditPrivate::getSelectionEnd()
816{
817 return _selectionEnd;
818}
819
820
821void QHexEditPrivate::updateCursor()
822{
823 if (_blink)
824 _blink = false;
825 else
826 _blink = true;
827 update(_cursorX, _cursorY, _charWidth, _charHeight);
828}
829
830void QHexEditPrivate::adjust()
831{
832 _charWidth = fontMetrics().width(QLatin1Char('9'));
833 _charHeight = fontMetrics().height();
834
835 _xPosAdr = 0;
836 if (_addressArea)
837 _xPosHex = _xData.realAddressNumbers()*_charWidth + GAP_ADR_HEX;
838 else
839 _xPosHex = 0;
840 _xPosAscii = _xPosHex + HEXCHARS_IN_LINE * _charWidth + GAP_HEX_ASCII;
841
842 // tell QAbstractScollbar, how big we are
843 setMinimumHeight(((_xData.size()/16 + 1) * _charHeight) + 5);
844 if(_asciiArea)
845 setMinimumWidth(_xPosAscii + (BYTES_PER_LINE * _charWidth));
846 else
847 setMinimumWidth(_xPosHex + HEXCHARS_IN_LINE * _charWidth);
848
849 update();
850}
851
852void QHexEditPrivate::ensureVisible()
853{
854 // scrolls to cursorx, cusory (which are set by setCursorPos)
855 // x-margin is 3 pixels, y-margin is half of charHeight
856 _scrollArea->ensureVisible(_cursorX, _cursorY + _charHeight/2, 3, _charHeight/2 + 2);
857}
diff --git a/externals/qhexedit/qhexedit_p.h b/externals/qhexedit/qhexedit_p.h
deleted file mode 100644
index 1c2c11cc2..000000000
--- a/externals/qhexedit/qhexedit_p.h
+++ /dev/null
@@ -1,128 +0,0 @@
1#ifndef QHEXEDIT_P_H
2#define QHEXEDIT_P_H
3
4/** \cond docNever */
5
6
7#include <QtGui>
8#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
9#include <QtWidgets>
10#endif
11#include "xbytearray.h"
12
13class QHexEditPrivate : public QWidget
14{
15Q_OBJECT
16
17public:
18 QHexEditPrivate(QScrollArea *parent);
19
20 void setAddressAreaColor(QColor const &color);
21 QColor addressAreaColor();
22
23 void setAddressOffset(int offset);
24 int addressOffset();
25
26 void setCursorPos(int position);
27 int cursorPos();
28
29 void setData(QByteArray const &data);
30 QByteArray data();
31
32 void setHighlightingColor(QColor const &color);
33 QColor highlightingColor();
34
35 void setOverwriteMode(bool overwriteMode);
36 bool overwriteMode();
37
38 void setReadOnly(bool readOnly);
39 bool isReadOnly();
40
41 void setSelectionColor(QColor const &color);
42 QColor selectionColor();
43
44 XByteArray & xData();
45
46 int indexOf(const QByteArray & ba, int from = 0);
47 void insert(int index, const QByteArray & ba);
48 void insert(int index, char ch);
49 int lastIndexOf(const QByteArray & ba, int from = 0);
50 void remove(int index, int len=1);
51 void replace(int index, char ch);
52 void replace(int index, const QByteArray & ba);
53 void replace(int pos, int len, const QByteArray & after);
54
55 void setAddressArea(bool addressArea);
56 void setAddressWidth(int addressWidth);
57 void setAsciiArea(bool asciiArea);
58 void setHighlighting(bool mode);
59 virtual void setFont(const QFont &font);
60
61 void undo();
62 void redo();
63
64 QString toRedableString();
65 QString selectionToReadableString();
66
67signals:
68 void currentAddressChanged(int address);
69 void currentSizeChanged(int size);
70 void dataChanged();
71 void overwriteModeChanged(bool state);
72
73protected:
74 void keyPressEvent(QKeyEvent * event);
75 void mouseMoveEvent(QMouseEvent * event);
76 void mousePressEvent(QMouseEvent * event);
77
78 void paintEvent(QPaintEvent *event);
79
80 int cursorPos(QPoint pos); // calc cursorpos from graphics position. DOES NOT STORE POSITION
81
82 void resetSelection(int pos); // set selectionStart and selectionEnd to pos
83 void resetSelection(); // set selectionEnd to selectionStart
84 void setSelection(int pos); // set min (if below init) or max (if greater init)
85 int getSelectionBegin();
86 int getSelectionEnd();
87
88
89private slots:
90 void updateCursor();
91
92private:
93 void adjust();
94 void ensureVisible();
95
96 QColor _addressAreaColor;
97 QColor _highlightingColor;
98 QColor _selectionColor;
99 QScrollArea *_scrollArea;
100 QTimer _cursorTimer;
101 QUndoStack *_undoStack;
102
103 XByteArray _xData; // Hält den Inhalt des Hex Editors
104
105 bool _blink; // true: then cursor blinks
106 bool _renderingRequired; // Flag to store that rendering is necessary
107 bool _addressArea; // left area of QHexEdit
108 bool _asciiArea; // medium area
109 bool _highlighting; // highlighting of changed bytes
110 bool _overwriteMode;
111 bool _readOnly; // true: the user can only look and navigate
112
113 int _charWidth, _charHeight; // char dimensions (dpendend on font)
114 int _cursorX, _cursorY; // graphics position of the cursor
115 int _cursorPosition; // character positioin in stream (on byte ends in to steps)
116 int _xPosAdr, _xPosHex, _xPosAscii; // graphics x-position of the areas
117
118 int _selectionBegin; // First selected char
119 int _selectionEnd; // Last selected char
120 int _selectionInit; // That's, where we pressed the mouse button
121
122 int _size;
123};
124
125/** \endcond docNever */
126
127#endif
128
diff --git a/externals/qhexedit/xbytearray.cpp b/externals/qhexedit/xbytearray.cpp
deleted file mode 100644
index 09a04cfeb..000000000
--- a/externals/qhexedit/xbytearray.cpp
+++ /dev/null
@@ -1,167 +0,0 @@
1#include "xbytearray.h"
2
3XByteArray::XByteArray()
4{
5 _oldSize = -99;
6 _addressNumbers = 4;
7 _addressOffset = 0;
8
9}
10
11int XByteArray::addressOffset()
12{
13 return _addressOffset;
14}
15
16void XByteArray::setAddressOffset(int offset)
17{
18 _addressOffset = offset;
19}
20
21int XByteArray::addressWidth()
22{
23 return _addressNumbers;
24}
25
26void XByteArray::setAddressWidth(int width)
27{
28 if ((width >= 0) && (width<=6))
29 {
30 _addressNumbers = width;
31 }
32}
33
34QByteArray & XByteArray::data()
35{
36 return _data;
37}
38
39void XByteArray::setData(QByteArray data)
40{
41 _data = data;
42 _changedData = QByteArray(data.length(), char(0));
43}
44
45bool XByteArray::dataChanged(int i)
46{
47 return bool(_changedData[i]);
48}
49
50QByteArray XByteArray::dataChanged(int i, int len)
51{
52 return _changedData.mid(i, len);
53}
54
55void XByteArray::setDataChanged(int i, bool state)
56{
57 _changedData[i] = char(state);
58}
59
60void XByteArray::setDataChanged(int i, const QByteArray & state)
61{
62 int length = state.length();
63 int len;
64 if ((i + length) > _changedData.length())
65 len = _changedData.length() - i;
66 else
67 len = length;
68 _changedData.replace(i, len, state);
69}
70
71int XByteArray::realAddressNumbers()
72{
73 if (_oldSize != _data.size())
74 {
75 // is addressNumbers wide enought?
76 QString test = QString("%1")
77 .arg(_data.size() + _addressOffset, _addressNumbers, 16, QChar('0'));
78 _realAddressNumbers = test.size();
79 }
80 return _realAddressNumbers;
81}
82
83int XByteArray::size()
84{
85 return _data.size();
86}
87
88QByteArray & XByteArray::insert(int i, char ch)
89{
90 _data.insert(i, ch);
91 _changedData.insert(i, char(1));
92 return _data;
93}
94
95QByteArray & XByteArray::insert(int i, const QByteArray & ba)
96{
97 _data.insert(i, ba);
98 _changedData.insert(i, QByteArray(ba.length(), char(1)));
99 return _data;
100}
101
102QByteArray & XByteArray::remove(int i, int len)
103{
104 _data.remove(i, len);
105 _changedData.remove(i, len);
106 return _data;
107}
108
109QByteArray & XByteArray::replace(int index, char ch)
110{
111 _data[index] = ch;
112 _changedData[index] = char(1);
113 return _data;
114}
115
116QByteArray & XByteArray::replace(int index, const QByteArray & ba)
117{
118 int len = ba.length();
119 return replace(index, len, ba);
120}
121
122QByteArray & XByteArray::replace(int index, int length, const QByteArray & ba)
123{
124 int len;
125 if ((index + length) > _data.length())
126 len = _data.length() - index;
127 else
128 len = length;
129 _data.replace(index, len, ba.mid(0, len));
130 _changedData.replace(index, len, QByteArray(len, char(1)));
131 return _data;
132}
133
134QChar XByteArray::asciiChar(int index)
135{
136 char ch = _data[index];
137 if ((ch < 0x20) || (ch > 0x7e))
138 ch = '.';
139 return QChar(ch);
140}
141
142QString XByteArray::toRedableString(int start, int end)
143{
144 int adrWidth = realAddressNumbers();
145 if (_addressNumbers > adrWidth)
146 adrWidth = _addressNumbers;
147 if (end < 0)
148 end = _data.size();
149
150 QString result;
151 for (int i=start; i < end; i += 16)
152 {
153 QString adrStr = QString("%1").arg(_addressOffset + i, adrWidth, 16, QChar('0'));
154 QString hexStr;
155 QString ascStr;
156 for (int j=0; j<16; j++)
157 {
158 if ((i + j) < _data.size())
159 {
160 hexStr.append(" ").append(_data.mid(i+j, 1).toHex());
161 ascStr.append(asciiChar(i+j));
162 }
163 }
164 result += adrStr + " " + QString("%1").arg(hexStr, -48) + " " + QString("%1").arg(ascStr, -17) + "\n";
165 }
166 return result;
167}
diff --git a/externals/qhexedit/xbytearray.h b/externals/qhexedit/xbytearray.h
deleted file mode 100644
index 2b67c61b8..000000000
--- a/externals/qhexedit/xbytearray.h
+++ /dev/null
@@ -1,66 +0,0 @@
1#ifndef XBYTEARRAY_H
2#define XBYTEARRAY_H
3
4/** \cond docNever */
5
6#include <QtCore>
7
8/*! XByteArray represents the content of QHexEcit.
9XByteArray comprehend the data itself and informations to store if it was
10changed. The QHexEdit component uses these informations to perform nice
11rendering of the data
12
13XByteArray also provides some functionality to insert, replace and remove
14single chars and QByteArras. Additionally some functions support rendering
15and converting to readable strings.
16*/
17class XByteArray
18{
19public:
20 explicit XByteArray();
21
22 int addressOffset();
23 void setAddressOffset(int offset);
24
25 int addressWidth();
26 void setAddressWidth(int width);
27
28 QByteArray & data();
29 void setData(QByteArray data);
30
31 bool dataChanged(int i);
32 QByteArray dataChanged(int i, int len);
33 void setDataChanged(int i, bool state);
34 void setDataChanged(int i, const QByteArray & state);
35
36 int realAddressNumbers();
37 int size();
38
39 QByteArray & insert(int i, char ch);
40 QByteArray & insert(int i, const QByteArray & ba);
41
42 QByteArray & remove(int pos, int len);
43
44 QByteArray & replace(int index, char ch);
45 QByteArray & replace(int index, const QByteArray & ba);
46 QByteArray & replace(int index, int length, const QByteArray & ba);
47
48 QChar asciiChar(int index);
49 QString toRedableString(int start=0, int end=-1);
50
51signals:
52
53public slots:
54
55private:
56 QByteArray _data;
57 QByteArray _changedData;
58
59 int _addressNumbers; // wanted width of address area
60 int _addressOffset; // will be added to the real addres inside bytearray
61 int _realAddressNumbers; // real width of address area (can be greater then wanted width)
62 int _oldSize; // size of data
63};
64
65/** \endcond docNever */
66#endif // XBYTEARRAY_H
diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt
index 93f1c339d..d4460bf01 100644
--- a/src/citra_qt/CMakeLists.txt
+++ b/src/citra_qt/CMakeLists.txt
@@ -14,7 +14,6 @@ set(SRCS
14 debugger/graphics/graphics_tracing.cpp 14 debugger/graphics/graphics_tracing.cpp
15 debugger/graphics/graphics_vertex_shader.cpp 15 debugger/graphics/graphics_vertex_shader.cpp
16 debugger/profiler.cpp 16 debugger/profiler.cpp
17 debugger/ramview.cpp
18 debugger/registers.cpp 17 debugger/registers.cpp
19 debugger/wait_tree.cpp 18 debugger/wait_tree.cpp
20 util/spinbox.cpp 19 util/spinbox.cpp
@@ -48,7 +47,6 @@ set(HEADERS
48 debugger/graphics/graphics_tracing.h 47 debugger/graphics/graphics_tracing.h
49 debugger/graphics/graphics_vertex_shader.h 48 debugger/graphics/graphics_vertex_shader.h
50 debugger/profiler.h 49 debugger/profiler.h
51 debugger/ramview.h
52 debugger/registers.h 50 debugger/registers.h
53 debugger/wait_tree.h 51 debugger/wait_tree.h
54 util/spinbox.h 52 util/spinbox.h
@@ -100,7 +98,7 @@ if (APPLE)
100else() 98else()
101 add_executable(citra-qt ${SRCS} ${HEADERS} ${UI_HDRS}) 99 add_executable(citra-qt ${SRCS} ${HEADERS} ${UI_HDRS})
102endif() 100endif()
103target_link_libraries(citra-qt core video_core audio_core common qhexedit) 101target_link_libraries(citra-qt core video_core audio_core common)
104target_link_libraries(citra-qt ${OPENGL_gl_LIBRARY} ${CITRA_QT_LIBS}) 102target_link_libraries(citra-qt ${OPENGL_gl_LIBRARY} ${CITRA_QT_LIBS})
105target_link_libraries(citra-qt ${PLATFORM_LIBRARIES} Threads::Threads) 103target_link_libraries(citra-qt ${PLATFORM_LIBRARIES} Threads::Threads)
106 104
diff --git a/src/citra_qt/debugger/ramview.cpp b/src/citra_qt/debugger/ramview.cpp
deleted file mode 100644
index 10a09dda8..000000000
--- a/src/citra_qt/debugger/ramview.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include "citra_qt/debugger/ramview.h"
6
7GRamView::GRamView(QWidget* parent) : QHexEdit(parent) {}
8
9void GRamView::OnCPUStepped() {
10 // TODO: QHexEdit doesn't show vertical scroll bars for > 10MB data streams...
11 // setData(QByteArray((const char*)Mem_RAM,sizeof(Mem_RAM)/8));
12}
diff --git a/src/citra_qt/debugger/ramview.h b/src/citra_qt/debugger/ramview.h
deleted file mode 100644
index d01cea93b..000000000
--- a/src/citra_qt/debugger/ramview.h
+++ /dev/null
@@ -1,17 +0,0 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include "qhexedit.h"
8
9class GRamView : public QHexEdit {
10 Q_OBJECT
11
12public:
13 explicit GRamView(QWidget* parent = nullptr);
14
15public slots:
16 void OnCPUStepped();
17};
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index 6d59cf640..f765c0147 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -12,6 +12,7 @@
12#include <QFileDialog> 12#include <QFileDialog>
13#include <QMessageBox> 13#include <QMessageBox>
14#include <QtGui> 14#include <QtGui>
15#include <QtWidgets>
15#include "citra_qt/bootmanager.h" 16#include "citra_qt/bootmanager.h"
16#include "citra_qt/config.h" 17#include "citra_qt/config.h"
17#include "citra_qt/configure_dialog.h" 18#include "citra_qt/configure_dialog.h"
@@ -24,7 +25,6 @@
24#include "citra_qt/debugger/graphics/graphics_tracing.h" 25#include "citra_qt/debugger/graphics/graphics_tracing.h"
25#include "citra_qt/debugger/graphics/graphics_vertex_shader.h" 26#include "citra_qt/debugger/graphics/graphics_vertex_shader.h"
26#include "citra_qt/debugger/profiler.h" 27#include "citra_qt/debugger/profiler.h"
27#include "citra_qt/debugger/ramview.h"
28#include "citra_qt/debugger/registers.h" 28#include "citra_qt/debugger/registers.h"
29#include "citra_qt/debugger/wait_tree.h" 29#include "citra_qt/debugger/wait_tree.h"
30#include "citra_qt/game_list.h" 30#include "citra_qt/game_list.h"
@@ -46,7 +46,6 @@
46#include "core/gdbstub/gdbstub.h" 46#include "core/gdbstub/gdbstub.h"
47#include "core/loader/loader.h" 47#include "core/loader/loader.h"
48#include "core/settings.h" 48#include "core/settings.h"
49#include "qhexedit.h"
50#include "video_core/video_core.h" 49#include "video_core/video_core.h"
51 50
52#ifdef QT_STATICPLUGIN 51#ifdef QT_STATICPLUGIN