mirror of
https://github.com/rizinorg/cutter.git
synced 2025-02-23 06:54:49 +00:00
Add symbol exports. (#2345)
* Add symbol exports required for external native plugins to work on Windows * Make Linux build behave more like Windows so that missing export annotations can be more easily detected.
This commit is contained in:
parent
e3aeb770ee
commit
7c9c7e6fe4
@ -172,6 +172,7 @@ endif()
|
|||||||
add_executable(Cutter MACOSX_BUNDLE ${UI_FILES} ${QRC_FILES} ${SOURCE_FILES} ${HEADER_FILES} ${BINDINGS_SOURCE})
|
add_executable(Cutter MACOSX_BUNDLE ${UI_FILES} ${QRC_FILES} ${SOURCE_FILES} ${HEADER_FILES} ${BINDINGS_SOURCE})
|
||||||
set_target_properties(Cutter PROPERTIES
|
set_target_properties(Cutter PROPERTIES
|
||||||
ENABLE_EXPORTS ON
|
ENABLE_EXPORTS ON
|
||||||
|
CXX_VISIBILITY_PRESET hidden
|
||||||
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/macos/Info.plist")
|
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/macos/Info.plist")
|
||||||
target_compile_definitions(Cutter PRIVATE CUTTER_SOURCE_BUILD)
|
target_compile_definitions(Cutter PRIVATE CUTTER_SOURCE_BUILD)
|
||||||
|
|
||||||
|
@ -60,6 +60,8 @@ equals(CUTTER_APPVEYOR_R2DEC, true) CONFIG += CUTTER_APPVEYOR_R2DEC
|
|||||||
!defined(CUTTER_R2GHIDRA_STATIC, var) CUTTER_R2GHIDRA_STATIC=false
|
!defined(CUTTER_R2GHIDRA_STATIC, var) CUTTER_R2GHIDRA_STATIC=false
|
||||||
equals(CUTTER_R2GHIDRA_STATIC, true) CONFIG += CUTTER_R2GHIDRA_STATIC
|
equals(CUTTER_R2GHIDRA_STATIC, true) CONFIG += CUTTER_R2GHIDRA_STATIC
|
||||||
|
|
||||||
|
DEFINES += CUTTER_SOURCE_BUILD
|
||||||
|
|
||||||
CUTTER_ENABLE_CRASH_REPORTS {
|
CUTTER_ENABLE_CRASH_REPORTS {
|
||||||
message("Crash report support enabled.")
|
message("Crash report support enabled.")
|
||||||
DEFINES += CUTTER_ENABLE_CRASH_REPORTS
|
DEFINES += CUTTER_ENABLE_CRASH_REPORTS
|
||||||
@ -310,8 +312,6 @@ SOURCES += \
|
|||||||
dialogs/XrefsDialog.cpp \
|
dialogs/XrefsDialog.cpp \
|
||||||
core/MainWindow.cpp \
|
core/MainWindow.cpp \
|
||||||
common/Helpers.cpp \
|
common/Helpers.cpp \
|
||||||
common/HexAsciiHighlighter.cpp \
|
|
||||||
common/HexHighlighter.cpp \
|
|
||||||
common/Highlighter.cpp \
|
common/Highlighter.cpp \
|
||||||
common/MdHighlighter.cpp \
|
common/MdHighlighter.cpp \
|
||||||
common/DirectionalComboBox.cpp \
|
common/DirectionalComboBox.cpp \
|
||||||
@ -459,8 +459,6 @@ HEADERS += \
|
|||||||
dialogs/NativeDebugDialog.h \
|
dialogs/NativeDebugDialog.h \
|
||||||
dialogs/XrefsDialog.h \
|
dialogs/XrefsDialog.h \
|
||||||
common/Helpers.h \
|
common/Helpers.h \
|
||||||
common/HexAsciiHighlighter.h \
|
|
||||||
common/HexHighlighter.h \
|
|
||||||
core/MainWindow.h \
|
core/MainWindow.h \
|
||||||
common/Highlighter.h \
|
common/Highlighter.h \
|
||||||
common/MdHighlighter.h \
|
common/MdHighlighter.h \
|
||||||
|
@ -26,7 +26,7 @@ endif()
|
|||||||
|
|
||||||
ExternalProject_Add(Radare2-Bundled
|
ExternalProject_Add(Radare2-Bundled
|
||||||
SOURCE_DIR "${RADARE2_SOURCE_DIR}"
|
SOURCE_DIR "${RADARE2_SOURCE_DIR}"
|
||||||
CONFIGURE_COMMAND "${MESON}" "<SOURCE_DIR>" ${MESON_OPTIONS} && "${MESON}" configure ${MESON_OPTIONS}
|
CONFIGURE_COMMAND "${MESON}" "<SOURCE_DIR>" ${MESON_OPTIONS} && "${MESON}" configure ${MESON_OPTIONS} --buildtype "$<$<CONFIG:Debug>:debug>$<$<NOT:$<CONFIG:Debug>>:release>"
|
||||||
BUILD_COMMAND "${NINJA}"
|
BUILD_COMMAND "${NINJA}"
|
||||||
INSTALL_COMMAND "${NINJA}" install)
|
INSTALL_COMMAND "${NINJA}" install)
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include "AddressableItemModel.h"
|
#include "AddressableItemModel.h"
|
||||||
|
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
AddressableFilterProxyModel::AddressableFilterProxyModel(AddressableItemModelI *sourceModel,
|
AddressableFilterProxyModel::AddressableFilterProxyModel(AddressableItemModelI *sourceModel,
|
||||||
QObject *parent) :
|
QObject *parent) :
|
||||||
AddressableItemModel<QSortFilterProxyModel>(parent)
|
AddressableItemModel<QSortFilterProxyModel>(parent)
|
||||||
|
@ -6,9 +6,9 @@
|
|||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
#include <QAbstractItemModel>
|
#include <QAbstractItemModel>
|
||||||
|
|
||||||
#include <core/CutterCommon.h>
|
#include "core/CutterCommon.h"
|
||||||
|
|
||||||
class AddressableItemModelI
|
class CUTTER_EXPORT AddressableItemModelI
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual RVA address(const QModelIndex &index) const = 0;
|
virtual RVA address(const QModelIndex &index) const = 0;
|
||||||
@ -22,7 +22,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <class ParentModel = QAbstractItemModel>
|
template <class ParentModel = QAbstractItemModel>
|
||||||
class AddressableItemModel : public ParentModel, public AddressableItemModelI
|
class CUTTER_EXPORT AddressableItemModel : public ParentModel, public AddressableItemModelI
|
||||||
{
|
{
|
||||||
static_assert (std::is_base_of<QAbstractItemModel, ParentModel>::value,
|
static_assert (std::is_base_of<QAbstractItemModel, ParentModel>::value,
|
||||||
"ParentModel needs to inherit from QAbstractItemModel");
|
"ParentModel needs to inherit from QAbstractItemModel");
|
||||||
@ -32,7 +32,7 @@ public:
|
|||||||
QAbstractItemModel *asItemModel() { return this; }
|
QAbstractItemModel *asItemModel() { return this; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class AddressableFilterProxyModel : public AddressableItemModel<QSortFilterProxyModel>
|
class CUTTER_EXPORT AddressableFilterProxyModel : public AddressableItemModel<QSortFilterProxyModel>
|
||||||
{
|
{
|
||||||
using ParentClass = AddressableItemModel<QSortFilterProxyModel>;
|
using ParentClass = AddressableItemModel<QSortFilterProxyModel>;
|
||||||
public:
|
public:
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
#ifndef ASYNCTASK_H
|
#ifndef ASYNCTASK_H
|
||||||
#define ASYNCTASK_H
|
#define ASYNCTASK_H
|
||||||
|
|
||||||
|
#include "core/CutterCommon.h"
|
||||||
|
|
||||||
#include <QRunnable>
|
#include <QRunnable>
|
||||||
#include <QThreadPool>
|
#include <QThreadPool>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
@ -11,7 +13,7 @@
|
|||||||
|
|
||||||
class AsyncTaskManager;
|
class AsyncTaskManager;
|
||||||
|
|
||||||
class AsyncTask : public QObject, public QRunnable
|
class CUTTER_EXPORT AsyncTask : public QObject, public QRunnable
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include "common/AsyncTask.h"
|
#include "common/AsyncTask.h"
|
||||||
#include "core/Cutter.h"
|
#include "core/Cutter.h"
|
||||||
|
|
||||||
class CommandTask : public AsyncTask
|
class CUTTER_EXPORT CommandTask : public AsyncTask
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ struct CutterInterfaceTheme {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class Configuration : public QObject
|
class CUTTER_EXPORT Configuration : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
|
|
||||||
class CutterSeekable : public QObject
|
class CUTTER_EXPORT CutterSeekable : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
/**
|
/**
|
||||||
* Implements a decompiler that can be registered using CutterCore::registerDecompiler()
|
* Implements a decompiler that can be registered using CutterCore::registerDecompiler()
|
||||||
*/
|
*/
|
||||||
class Decompiler: public QObject
|
class CUTTER_EXPORT Decompiler: public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#ifndef QHELPERS_H
|
#ifndef QHELPERS_H
|
||||||
#define QHELPERS_H
|
#define QHELPERS_H
|
||||||
|
|
||||||
|
#include "core/CutterCommon.h"
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QSizePolicy>
|
#include <QSizePolicy>
|
||||||
@ -28,19 +30,19 @@ class QComboBox;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace qhelpers {
|
namespace qhelpers {
|
||||||
QString formatBytecount(const uint64_t bytecount);
|
CUTTER_EXPORT QString formatBytecount(const uint64_t bytecount);
|
||||||
void adjustColumns(QTreeView *tv, int columnCount, int padding);
|
CUTTER_EXPORT void adjustColumns(QTreeView *tv, int columnCount, int padding);
|
||||||
void adjustColumns(QTreeWidget *tw, int padding);
|
CUTTER_EXPORT void adjustColumns(QTreeWidget *tw, int padding);
|
||||||
bool selectFirstItem(QAbstractItemView *itemView);
|
CUTTER_EXPORT bool selectFirstItem(QAbstractItemView *itemView);
|
||||||
QTreeWidgetItem *appendRow(QTreeWidget *tw, const QString &str, const QString &str2 = QString(),
|
CUTTER_EXPORT QTreeWidgetItem *appendRow(QTreeWidget *tw, const QString &str, const QString &str2 = QString(),
|
||||||
const QString &str3 = QString(), const QString &str4 = QString(), const QString &str5 = QString());
|
const QString &str3 = QString(), const QString &str4 = QString(), const QString &str5 = QString());
|
||||||
|
|
||||||
void setVerticalScrollMode(QAbstractItemView *tw);
|
CUTTER_EXPORT void setVerticalScrollMode(QAbstractItemView *tw);
|
||||||
|
|
||||||
void setCheckedWithoutSignals(QAbstractButton *button, bool checked);
|
CUTTER_EXPORT void setCheckedWithoutSignals(QAbstractButton *button, bool checked);
|
||||||
|
|
||||||
|
|
||||||
struct SizePolicyMinMax {
|
struct CUTTER_EXPORT SizePolicyMinMax {
|
||||||
QSizePolicy sizePolicy;
|
QSizePolicy sizePolicy;
|
||||||
int min;
|
int min;
|
||||||
int max;
|
int max;
|
||||||
@ -49,26 +51,26 @@ struct SizePolicyMinMax {
|
|||||||
void restoreHeight(QWidget *widget);
|
void restoreHeight(QWidget *widget);
|
||||||
};
|
};
|
||||||
|
|
||||||
SizePolicyMinMax forceWidth(QWidget *widget, int width);
|
CUTTER_EXPORT SizePolicyMinMax forceWidth(QWidget *widget, int width);
|
||||||
SizePolicyMinMax forceHeight(QWidget *widget, int height);
|
CUTTER_EXPORT SizePolicyMinMax forceHeight(QWidget *widget, int height);
|
||||||
|
|
||||||
int getMaxFullyDisplayedLines(QTextEdit *textEdit);
|
CUTTER_EXPORT int getMaxFullyDisplayedLines(QTextEdit *textEdit);
|
||||||
int getMaxFullyDisplayedLines(QPlainTextEdit *plainTextEdit);
|
CUTTER_EXPORT int getMaxFullyDisplayedLines(QPlainTextEdit *plainTextEdit);
|
||||||
|
|
||||||
QByteArray applyColorToSvg(const QByteArray &data, QColor color);
|
CUTTER_EXPORT QByteArray applyColorToSvg(const QByteArray &data, QColor color);
|
||||||
QByteArray applyColorToSvg(const QString &filename, QColor color);
|
CUTTER_EXPORT QByteArray applyColorToSvg(const QString &filename, QColor color);
|
||||||
|
|
||||||
void setThemeIcons(QList<QPair<void*, QString>> supportedIconsNames, std::function<void(void *, const QIcon &)> setter);
|
CUTTER_EXPORT void setThemeIcons(QList<QPair<void*, QString>> supportedIconsNames, std::function<void(void *, const QIcon &)> setter);
|
||||||
|
|
||||||
void prependQAction(QAction *action, QMenu *menu);
|
CUTTER_EXPORT void prependQAction(QAction *action, QMenu *menu);
|
||||||
qreal devicePixelRatio(const QPaintDevice *p);
|
CUTTER_EXPORT qreal devicePixelRatio(const QPaintDevice *p);
|
||||||
/**
|
/**
|
||||||
* @brief Select comboBox item by value in Qt::UserRole.
|
* @brief Select comboBox item by value in Qt::UserRole.
|
||||||
* @param comboBox
|
* @param comboBox
|
||||||
* @param data - value to search in combobox item data
|
* @param data - value to search in combobox item data
|
||||||
* @param defaultIndex - item to select in case no match
|
* @param defaultIndex - item to select in case no match
|
||||||
*/
|
*/
|
||||||
void selectIndexByData(QComboBox *comboBox, QVariant data, int defaultIndex = -1);
|
CUTTER_EXPORT void selectIndexByData(QComboBox *comboBox, QVariant data, int defaultIndex = -1);
|
||||||
|
|
||||||
} // qhelpers
|
} // qhelpers
|
||||||
|
|
||||||
|
@ -1,50 +0,0 @@
|
|||||||
#include <QtGui>
|
|
||||||
|
|
||||||
#include "common/HexAsciiHighlighter.h"
|
|
||||||
|
|
||||||
AsciiHighlighter::AsciiHighlighter(QTextDocument *parent)
|
|
||||||
: QSyntaxHighlighter(parent)
|
|
||||||
{
|
|
||||||
HighlightingRule rule;
|
|
||||||
|
|
||||||
asciiFormat.setForeground(QColor(65, 131, 215));
|
|
||||||
rule.pattern.setPattern("\\b[A-Za-z0-9]+\\b");
|
|
||||||
rule.format = asciiFormat;
|
|
||||||
highlightingRules.append(rule);
|
|
||||||
|
|
||||||
commentStartRegularExpression.setPattern("/\\*");
|
|
||||||
commentEndRegularExpression.setPattern("\\*/");
|
|
||||||
}
|
|
||||||
|
|
||||||
void AsciiHighlighter::highlightBlock(const QString &text)
|
|
||||||
{
|
|
||||||
for (const HighlightingRule &rule : highlightingRules) {
|
|
||||||
QRegularExpression expression(rule.pattern);
|
|
||||||
int index = expression.match(text).capturedStart();
|
|
||||||
while (index >= 0) {
|
|
||||||
int length = expression.match(text).capturedLength();
|
|
||||||
setFormat(index, length, rule.format);
|
|
||||||
index = expression.match(text.mid(index + length)).capturedStart();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setCurrentBlockState(0);
|
|
||||||
|
|
||||||
int startIndex = 0;
|
|
||||||
if (previousBlockState() != 1)
|
|
||||||
startIndex = QRegularExpression(commentStartRegularExpression).match(text).capturedStart();
|
|
||||||
|
|
||||||
while (startIndex >= 0) {
|
|
||||||
QRegularExpressionMatch commentEndMatch = QRegularExpression(commentEndRegularExpression).match(text.mid(startIndex));
|
|
||||||
int endIndex = commentEndMatch.capturedStart();
|
|
||||||
int commentLength;
|
|
||||||
if (endIndex == -1) {
|
|
||||||
setCurrentBlockState(1);
|
|
||||||
commentLength = text.length() - startIndex;
|
|
||||||
} else {
|
|
||||||
commentLength = endIndex - startIndex
|
|
||||||
+ commentEndMatch.capturedLength();
|
|
||||||
}
|
|
||||||
setFormat(startIndex, commentLength, multiLineCommentFormat);
|
|
||||||
startIndex = QRegularExpression(commentStartRegularExpression).match(text.mid(startIndex + commentLength)).capturedStart();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
#ifndef ASCIIHIGHLIGHTER_H
|
|
||||||
#define ASCIIHIGHLIGHTER_H
|
|
||||||
|
|
||||||
#include <QSyntaxHighlighter>
|
|
||||||
|
|
||||||
#include <QHash>
|
|
||||||
#include <QTextCharFormat>
|
|
||||||
#include <QRegularExpression>
|
|
||||||
|
|
||||||
class QTextDocument;
|
|
||||||
|
|
||||||
class AsciiHighlighter : public QSyntaxHighlighter
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit AsciiHighlighter(QTextDocument *parent = nullptr);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void highlightBlock(const QString &text);
|
|
||||||
|
|
||||||
private:
|
|
||||||
struct HighlightingRule {
|
|
||||||
QRegularExpression pattern;
|
|
||||||
QTextCharFormat format;
|
|
||||||
};
|
|
||||||
QVector<HighlightingRule> highlightingRules;
|
|
||||||
|
|
||||||
QRegularExpression commentStartRegularExpression;
|
|
||||||
QRegularExpression commentEndRegularExpression;
|
|
||||||
|
|
||||||
QTextCharFormat keywordFormat;
|
|
||||||
QTextCharFormat classFormat;
|
|
||||||
QTextCharFormat singleLineCommentFormat;
|
|
||||||
QTextCharFormat multiLineCommentFormat;
|
|
||||||
QTextCharFormat quotationFormat;
|
|
||||||
QTextCharFormat asciiFormat;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // ASCIIHIGHLIGHTER_H
|
|
@ -1,77 +0,0 @@
|
|||||||
#include <QtGui>
|
|
||||||
|
|
||||||
#include "common/HexHighlighter.h"
|
|
||||||
|
|
||||||
HexHighlighter::HexHighlighter(QTextDocument *parent)
|
|
||||||
: QSyntaxHighlighter(parent)
|
|
||||||
{
|
|
||||||
HighlightingRule rule;
|
|
||||||
|
|
||||||
keywordFormat.setForeground(QColor(65, 131, 215));
|
|
||||||
keywordFormat.setFontWeight(QFont::Bold);
|
|
||||||
QStringList keywordPatterns;
|
|
||||||
// I know, your eyes are bleeding, mine too
|
|
||||||
keywordPatterns << "\\b20\\b" << "\\b21\\b" << "\\b22\\b" << "\\b23\\b" << "\\b24\\b" << "\\b25\\b"
|
|
||||||
<< "\\b26\\b"
|
|
||||||
<< "\\b27\\b" << "\\b28\\b" << "\\b29\\b" << "\\b2a\\b" << "\\b2b\\b" << "\\b2c\\b" << "\\b2d\\b"
|
|
||||||
<< "\\b2e\\b" << "\\b2f\\b" << "\\b30\\b" << "\\b31\\b" << "\\b32\\b" << "\\b33\\b" << "\\b34\\b"
|
|
||||||
<< "\\b35\\b" << "\\b36\\b" << "\\b37\\b" << "\\b38\\b" << "\\b39\\b" << "\\b3a\\b" << "\\b3b\\b"
|
|
||||||
<< "\\b3c\\b" << "\\b3d\\b" << "\\b3e\\b" << "\\b3f\\b" << "\\b41\\b" << "\\b42\\b" << "\\b43\\b"
|
|
||||||
<< "\\b44\\b" << "\\b45\\b" << "\\b46\\b" << "\\b47\\b" << "\\b48\\b" << "\\b49\\b" << "\\b4a\\b"
|
|
||||||
<< "\\b4b\\b" << "\\b4c\\b" << "\\b4d\\b" << "\\b4e\\b" << "\\b4f\\b" << "\\b50\\b" << "\\b51\\b"
|
|
||||||
<< "\\b52\\b" << "\\b53\\b" << "\\b54\\b" << "\\b55\\b" << "\\b56\\b" << "\\b57\\b" << "\\b58\\b"
|
|
||||||
<< "\\b59\\b" << "\\b5a\\b" << "\\b5b\\b" << "\\b5c\\b" << "\\b5d\\b" << "\\b5e\\b" << "\\b5f\\b"
|
|
||||||
<< "\\b60\\b" << "\\b61\\b" << "\\b62\\b" << "\\b63\\b" << "\\b64\\b" << "\\b65\\b" << "\\b66\\b"
|
|
||||||
<< "\\b67\\b" << "\\b68\\b" << "\\b69\\b" << "\\b6a\\b" << "\\b6b\\b" << "\\b6c\\b" << "\\b6d\\b"
|
|
||||||
<< "\\b6e\\b" << "\\b6f\\b" << "\\b70\\b" << "\\b71\\b" << "\\b72\\b" << "\\b73\\b" << "\\b74\\b"
|
|
||||||
<< "\\b75\\b" << "\\b76\\b" << "\\b77\\b" << "\\b78\\b" << "\\b79\\b" << "\\b7a\\b" << "\\b7b\\b"
|
|
||||||
<< "\\b7c\\b" << "\\b7d\\b" << "\\b7e\\b" << "\\b7f\\b";
|
|
||||||
for (const QString &pattern : keywordPatterns) {
|
|
||||||
rule.pattern.setPattern(pattern);
|
|
||||||
rule.pattern.setPatternOptions(QRegularExpression::CaseInsensitiveOption);
|
|
||||||
rule.format = keywordFormat;
|
|
||||||
highlightingRules.append(rule);
|
|
||||||
}
|
|
||||||
|
|
||||||
singleLineCommentFormat.setFontWeight(QFont::Bold);
|
|
||||||
singleLineCommentFormat.setForeground(Qt::darkGreen);
|
|
||||||
rule.pattern.setPattern(";[^\n]*");
|
|
||||||
rule.format = singleLineCommentFormat;
|
|
||||||
highlightingRules.append(rule);
|
|
||||||
|
|
||||||
commentStartRegularExpression.setPattern("/\\*");
|
|
||||||
commentEndRegularExpression.setPattern("\\*/");
|
|
||||||
}
|
|
||||||
|
|
||||||
void HexHighlighter::highlightBlock(const QString &text)
|
|
||||||
{
|
|
||||||
for (const HighlightingRule &rule : highlightingRules) {
|
|
||||||
QRegularExpression expression(rule.pattern);
|
|
||||||
int index = expression.match(text).capturedStart();
|
|
||||||
while (index >= 0) {
|
|
||||||
int length = expression.match(text).capturedLength();
|
|
||||||
setFormat(index, length, rule.format);
|
|
||||||
index = expression.match(text.mid(index + length)).capturedStart();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setCurrentBlockState(0);
|
|
||||||
|
|
||||||
int startIndex = 0;
|
|
||||||
if (previousBlockState() != 1)
|
|
||||||
startIndex = QRegularExpression(commentStartRegularExpression).match(text).capturedStart();
|
|
||||||
|
|
||||||
while (startIndex >= 0) {
|
|
||||||
QRegularExpressionMatch commentEndMatch = QRegularExpression(commentEndRegularExpression).match(text.mid(startIndex));
|
|
||||||
int endIndex = commentEndMatch.capturedStart();
|
|
||||||
int commentLength;
|
|
||||||
if (endIndex == -1) {
|
|
||||||
setCurrentBlockState(1);
|
|
||||||
commentLength = text.length() - startIndex;
|
|
||||||
} else {
|
|
||||||
commentLength = endIndex - startIndex
|
|
||||||
+ commentEndMatch.capturedLength();
|
|
||||||
}
|
|
||||||
setFormat(startIndex, commentLength, multiLineCommentFormat);
|
|
||||||
startIndex = QRegularExpression(commentStartRegularExpression).match(text.mid(startIndex + commentLength)).capturedStart();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,40 +0,0 @@
|
|||||||
#ifndef HEXHIGHLIGHTER_H
|
|
||||||
#define HEXHIGHLIGHTER_H
|
|
||||||
|
|
||||||
#include <QSyntaxHighlighter>
|
|
||||||
|
|
||||||
#include <QHash>
|
|
||||||
#include <QTextCharFormat>
|
|
||||||
#include <QRegularExpression>
|
|
||||||
|
|
||||||
class QTextDocument;
|
|
||||||
|
|
||||||
class HexHighlighter : public QSyntaxHighlighter
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit HexHighlighter(QTextDocument *parent = nullptr);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void highlightBlock(const QString &text);
|
|
||||||
|
|
||||||
private:
|
|
||||||
struct HighlightingRule {
|
|
||||||
QRegularExpression pattern;
|
|
||||||
QTextCharFormat format;
|
|
||||||
};
|
|
||||||
QVector<HighlightingRule> highlightingRules;
|
|
||||||
|
|
||||||
QRegularExpression commentStartRegularExpression;
|
|
||||||
QRegularExpression commentEndRegularExpression;
|
|
||||||
|
|
||||||
QTextCharFormat keywordFormat;
|
|
||||||
QTextCharFormat classFormat;
|
|
||||||
QTextCharFormat singleLineCommentFormat;
|
|
||||||
QTextCharFormat multiLineCommentFormat;
|
|
||||||
QTextCharFormat quotationFormat;
|
|
||||||
QTextCharFormat functionFormat;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // HEXHIGHLIGHTER_H
|
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef SYNTAXHIGHLIGHTER_H
|
#ifndef SYNTAXHIGHLIGHTER_H
|
||||||
#define SYNTAXHIGHLIGHTER_H
|
#define SYNTAXHIGHLIGHTER_H
|
||||||
|
|
||||||
|
#include "CutterCommon.h"
|
||||||
#include <QSyntaxHighlighter>
|
#include <QSyntaxHighlighter>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QTextDocument>
|
#include <QTextDocument>
|
||||||
@ -27,7 +28,7 @@ private slots:
|
|||||||
/**
|
/**
|
||||||
* SyntaxHighlighter to be used when KSyntaxHighlighting is not available
|
* SyntaxHighlighter to be used when KSyntaxHighlighting is not available
|
||||||
*/
|
*/
|
||||||
class FallbackSyntaxHighlighter : public QSyntaxHighlighter
|
class CUTTER_EXPORT FallbackSyntaxHighlighter : public QSyntaxHighlighter
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
#ifndef TEMPCONFIG_H
|
#ifndef TEMPCONFIG_H
|
||||||
#define TEMPCONFIG_H
|
#define TEMPCONFIG_H
|
||||||
|
|
||||||
|
#include "core/CutterCommon.h"
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
@ -22,7 +24,7 @@
|
|||||||
* }
|
* }
|
||||||
* \endcode
|
* \endcode
|
||||||
*/
|
*/
|
||||||
class TempConfig
|
class CUTTER_EXPORT TempConfig
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TempConfig() = default;
|
TempConfig() = default;
|
||||||
|
@ -33,7 +33,7 @@ class R2TaskDialog;
|
|||||||
|
|
||||||
class RCoreLocked;
|
class RCoreLocked;
|
||||||
|
|
||||||
class CutterCore: public QObject
|
class CUTTER_EXPORT CutterCore: public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -730,7 +730,7 @@ private:
|
|||||||
QVector<QString> getCutterRCFilePaths() const;
|
QVector<QString> getCutterRCFilePaths() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RCoreLocked
|
class CUTTER_EXPORT RCoreLocked
|
||||||
{
|
{
|
||||||
CutterCore * const core;
|
CutterCore * const core;
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
// Common Headers
|
// Common Headers
|
||||||
#include "common/BugReporting.h"
|
#include "common/BugReporting.h"
|
||||||
#include "common/Highlighter.h"
|
#include "common/Highlighter.h"
|
||||||
#include "common/HexAsciiHighlighter.h"
|
|
||||||
#include "common/Helpers.h"
|
#include "common/Helpers.h"
|
||||||
#include "common/SvgIconEngine.h"
|
#include "common/SvgIconEngine.h"
|
||||||
#include "common/ProgressIndicator.h"
|
#include "common/ProgressIndicator.h"
|
||||||
|
@ -225,7 +225,6 @@ private:
|
|||||||
QString filename;
|
QString filename;
|
||||||
std::unique_ptr<Ui::MainWindow> ui;
|
std::unique_ptr<Ui::MainWindow> ui;
|
||||||
Highlighter *highlighter;
|
Highlighter *highlighter;
|
||||||
AsciiHighlighter *hex_highlighter;
|
|
||||||
VisualNavbar *visualNavbar;
|
VisualNavbar *visualNavbar;
|
||||||
Omnibar *omnibar;
|
Omnibar *omnibar;
|
||||||
ProgressIndicator *tasksProgressIndicator;
|
ProgressIndicator *tasksProgressIndicator;
|
||||||
|
@ -8,13 +8,14 @@
|
|||||||
#include <QElapsedTimer>
|
#include <QElapsedTimer>
|
||||||
|
|
||||||
#include "common/R2Task.h"
|
#include "common/R2Task.h"
|
||||||
|
#include "core/CutterCommon.h"
|
||||||
|
|
||||||
class R2Task;
|
class R2Task;
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class R2TaskDialog;
|
class R2TaskDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
class R2TaskDialog : public QDialog
|
class CUTTER_EXPORT R2TaskDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QKeySequence>
|
#include <QKeySequence>
|
||||||
|
|
||||||
class AddressableItemContextMenu : public QMenu
|
class CUTTER_EXPORT AddressableItemContextMenu : public QMenu
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QKeySequence>
|
#include <QKeySequence>
|
||||||
|
|
||||||
class DisassemblyContextMenu : public QMenu
|
class CUTTER_EXPORT DisassemblyContextMenu : public QMenu
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ if get_option('enable_python')
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
add_project_arguments(feature_define_args, language: 'cpp')
|
add_project_arguments(feature_define_args, language: 'cpp')
|
||||||
|
add_project_arguments('-DCUTTER_SOURCE_BUILD', language: 'cpp')
|
||||||
|
|
||||||
parse_cmd = [py3_exe, join_paths(meson.current_source_dir(), '../scripts/meson_parse_qmake.py')]
|
parse_cmd = [py3_exe, join_paths(meson.current_source_dir(), '../scripts/meson_parse_qmake.py')]
|
||||||
configure_qmake_cmd = [py3_exe, join_paths(meson.current_source_dir(), '../scripts/meson_configure_qmake_in.py')]
|
configure_qmake_cmd = [py3_exe, join_paths(meson.current_source_dir(), '../scripts/meson_configure_qmake_in.py')]
|
||||||
|
@ -7,7 +7,7 @@ class MainWindow;
|
|||||||
#include "core/Cutter.h"
|
#include "core/Cutter.h"
|
||||||
#include "widgets/CutterDockWidget.h"
|
#include "widgets/CutterDockWidget.h"
|
||||||
|
|
||||||
class CutterPlugin
|
class CUTTER_EXPORT CutterPlugin
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~CutterPlugin() = default;
|
virtual ~CutterPlugin() = default;
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
#ifndef BOOLTOGGGLEDELEGATE_H
|
#ifndef BOOLTOGGGLEDELEGATE_H
|
||||||
#define BOOLTOGGGLEDELEGATE_H
|
#define BOOLTOGGGLEDELEGATE_H
|
||||||
|
|
||||||
|
#include "core/CutterCommon.h"
|
||||||
|
|
||||||
#include <QStyledItemDelegate>
|
#include <QStyledItemDelegate>
|
||||||
|
|
||||||
class BoolTogggleDelegate : public QStyledItemDelegate
|
class CUTTER_EXPORT BoolTogggleDelegate : public QStyledItemDelegate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BoolTogggleDelegate(QObject *parent = nullptr);
|
BoolTogggleDelegate(QObject *parent = nullptr);
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#ifndef COMBOQUICKFILTERVIEW_H
|
#ifndef COMBOQUICKFILTERVIEW_H
|
||||||
#define COMBOQUICKFILTERVIEW_H
|
#define COMBOQUICKFILTERVIEW_H
|
||||||
|
|
||||||
|
#include "core/CutterCommon.h"
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
|
||||||
@ -8,7 +10,7 @@ namespace Ui {
|
|||||||
class ComboQuickFilterView;
|
class ComboQuickFilterView;
|
||||||
}
|
}
|
||||||
|
|
||||||
class ComboQuickFilterView : public QWidget
|
class CUTTER_EXPORT ComboQuickFilterView : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
#ifndef CUTTERWIDGET_H
|
#ifndef CUTTERWIDGET_H
|
||||||
#define CUTTERWIDGET_H
|
#define CUTTERWIDGET_H
|
||||||
|
|
||||||
#include "CutterCommon.h"
|
#include "core/CutterCommon.h"
|
||||||
#include "common/RefreshDeferrer.h"
|
#include "common/RefreshDeferrer.h"
|
||||||
|
|
||||||
#include <QDockWidget>
|
#include <QDockWidget>
|
||||||
|
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
|
|
||||||
class CutterDockWidget : public QDockWidget
|
class CUTTER_EXPORT CutterDockWidget : public QDockWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#ifndef CUTTERTREEVIEW_H
|
#ifndef CUTTERTREEVIEW_H
|
||||||
#define CUTTERTREEVIEW_H
|
#define CUTTERTREEVIEW_H
|
||||||
|
|
||||||
|
#include "core/CutterCommon.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <QAbstractItemView>
|
#include <QAbstractItemView>
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
@ -9,7 +11,7 @@ namespace Ui {
|
|||||||
class CutterTreeView;
|
class CutterTreeView;
|
||||||
}
|
}
|
||||||
|
|
||||||
class CutterTreeView : public QTreeView
|
class CUTTER_EXPORT CutterTreeView : public QTreeView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -1,12 +1,14 @@
|
|||||||
#ifndef CUTTERTREEWIDGET_H
|
#ifndef CUTTERTREEWIDGET_H
|
||||||
#define CUTTERTREEWIDGET_H
|
#define CUTTERTREEWIDGET_H
|
||||||
|
|
||||||
|
#include "core/CutterCommon.h"
|
||||||
|
|
||||||
#include <QStatusBar>
|
#include <QStatusBar>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
|
|
||||||
class CutterTreeWidget : public QObject
|
class CUTTER_EXPORT CutterTreeWidget : public QObject
|
||||||
{
|
{
|
||||||
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -13,8 +13,6 @@
|
|||||||
#include "MemoryDockWidget.h"
|
#include "MemoryDockWidget.h"
|
||||||
#include "common/CutterSeekable.h"
|
#include "common/CutterSeekable.h"
|
||||||
#include "common/Highlighter.h"
|
#include "common/Highlighter.h"
|
||||||
#include "common/HexAsciiHighlighter.h"
|
|
||||||
#include "common/HexHighlighter.h"
|
|
||||||
#include "common/SvgIconEngine.h"
|
#include "common/SvgIconEngine.h"
|
||||||
#include "HexWidget.h"
|
#include "HexWidget.h"
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ class ListDockWidget;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class ListDockWidget : public CutterDockWidget
|
class CUTTER_EXPORT ListDockWidget : public CutterDockWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
/* Disassembly/Graph/Hexdump/Decompiler view priority */
|
/* Disassembly/Graph/Hexdump/Decompiler view priority */
|
||||||
enum class MemoryWidgetType { Disassembly, Graph, Hexdump, Decompiler };
|
enum class MemoryWidgetType { Disassembly, Graph, Hexdump, Decompiler };
|
||||||
|
|
||||||
class MemoryDockWidget : public AddressableDockWidget
|
class CUTTER_EXPORT MemoryDockWidget : public AddressableDockWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
#ifndef QUICKFILTERVIEW_H
|
#ifndef QUICKFILTERVIEW_H
|
||||||
#define QUICKFILTERVIEW_H
|
#define QUICKFILTERVIEW_H
|
||||||
|
|
||||||
|
#include "core/CutterCommon.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
@ -10,7 +12,7 @@ namespace Ui {
|
|||||||
class QuickFilterView;
|
class QuickFilterView;
|
||||||
}
|
}
|
||||||
|
|
||||||
class QuickFilterView : public QWidget
|
class CUTTER_EXPORT QuickFilterView : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user