28 |
29 | #include "../global.h"
30 | #include "searchsignaturesoptionswidget.h"
31 | #include "dieoptionswidget.h"
32 | #include "xbinary.h"
33 | #include "xdisasmviewoptionswidget.h"
34 | #include "xhexviewoptionswidget.h"
35 | #include "xinfodboptionswidget.h"
36 | #include "xonlinetoolsoptionswidget.h"
37 | #include "xoptions.h"
38 | #include "xshortcutsdialog.h"
39 |
40 | namespace Ui {
41 | class DialogOptions;
42 | }
43 |
44 | class DialogOptions : public XShortcutsDialog {
45 | Q_OBJECT
46 |
47 | public:
48 | explicit DialogOptions(QWidget *pParent, XOptions *pOptions, XOptions::GROUPID groupId);
49 | ~DialogOptions();
50 |
51 | virtual void adjustView();
52 | virtual void setGlobal(XShortcuts *pShortcuts, XOptions *pXOptions);
53 |
54 | protected:
55 | virtual void registerShortcuts(bool bState)
56 | {
57 | Q_UNUSED(bState)
58 | }
59 |
60 | private:
61 | Ui::DialogOptions *ui;
62 | DIEOptionsWidget *g_pDIEOptionsWidget;
63 | SearchSignaturesOptionsWidget *g_pSearchSignaturesOptionsWidget;
64 | XHexViewOptionsWidget *g_pXHexViewOptionsWidget;
65 | XDisasmViewOptionsWidget *g_pXDisasmViewOptionsWidget;
66 | XOnlineToolsOptionsWidget *g_pXOnlineToolsOptionsWidget;
67 | XInfoDBOptionsWidget *g_pXInfoDBOptionsWidget;
68 | };
69 |
70 | #endif // DIALOGOPTIONS_H
71 |
--------------------------------------------------------------------------------
/src/gui/main_gui.cpp:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2019-2025 hors
2 | *
3 | * Permission is hereby granted, free of charge, to any person obtaining a copy
4 | * of this software and associated documentation files (the "Software"), to deal
5 | * in the Software without restriction, including without limitation the rights
6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | * copies of the Software, and to permit persons to whom the Software is
8 | * furnished to do so, subject to the following conditions:
9 | *
10 | * The above copyright notice and this permission notice shall be included in all
11 | * copies or substantial portions of the Software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | * SOFTWARE.
20 | */
21 | #include
22 | #include
23 |
24 | #include "guimainwindow.h"
25 |
26 | int main(int argc, char *argv[])
27 | {
28 | #if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
29 | #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
30 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
31 | #endif
32 | #endif
33 | #ifdef Q_OS_MAC
34 | #ifndef QT_DEBUG
35 | QCoreApplication::setLibraryPaths(QStringList(QString(argv[0]).remove("MacOS/XBinaryViewer") + "PlugIns"));
36 | #endif
37 | #endif
38 | QCoreApplication::setOrganizationName(X_ORGANIZATIONNAME);
39 | QCoreApplication::setOrganizationDomain(X_ORGANIZATIONDOMAIN);
40 | QCoreApplication::setApplicationName(X_APPLICATIONNAME);
41 | QCoreApplication::setApplicationVersion(X_APPLICATIONVERSION);
42 |
43 | if ((argc == 2) && ((QString(argv[1]) == "--version") || (QString(argv[1]) == "-v"))) {
44 | QString sInfo = QString("%1 v%2").arg(X_APPLICATIONDISPLAYNAME, X_APPLICATIONVERSION);
45 | printf("%s\n", sInfo.toUtf8().data());
46 |
47 | return 0;
48 | }
49 |
50 | #ifndef QT_DEBUG
51 | qputenv("QT_LOGGING_RULES", "qt.*=false");
52 | #endif
53 |
54 | QApplication a(argc, argv);
55 | // TODO set main image
56 |
57 | XOptions xOptions;
58 |
59 | xOptions.setName(X_OPTIONSFILE);
60 |
61 | xOptions.addID(XOptions::ID_VIEW_LANG, "System");
62 | xOptions.addID(XOptions::ID_VIEW_QSS);
63 | xOptions.addID(XOptions::ID_VIEW_STYLE, "Fusion");
64 |
65 | xOptions.load();
66 |
67 | XOptions::adjustApplicationView(X_APPLICATIONNAME, &xOptions);
68 |
69 | GuiMainWindow w;
70 | w.show();
71 |
72 | return a.exec();
73 | }
74 |
--------------------------------------------------------------------------------
/src/gui/guimainwindow.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | GuiMainWindow
4 |
5 |
6 |
7 | 0
8 | 0
9 | 835
10 | 583
11 |
12 |
13 |
14 | MainWindow
15 |
16 |
17 |
18 |
19 | 0
20 |
21 |
22 | 0
23 |
24 |
25 | 0
26 |
27 |
28 | 0
29 |
30 | -
31 |
32 |
33 |
34 |
-
35 |
36 |
37 |
38 | 0
39 | 0
40 |
41 |
42 |
43 |
44 |
45 |
46 | :/pics/logo.png
47 |
48 |
49 | Qt::AlignmentFlag::AlignCenter
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | 0
59 |
60 |
61 | 0
62 |
63 |
64 | 0
65 |
66 |
67 | 0
68 |
69 | -
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
88 |
89 |
90 |
91 | XMainWidget
92 | QWidget
93 |
94 | 1
95 |
96 |
97 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/src/gui/dialogoptions.cpp:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2019-2025 hors
2 | *
3 | * Permission is hereby granted, free of charge, to any person obtaining a copy
4 | * of this software and associated documentation files (the "Software"), to deal
5 | * in the Software without restriction, including without limitation the rights
6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | * copies of the Software, and to permit persons to whom the Software is
8 | * furnished to do so, subject to the following conditions:
9 | *
10 | * The above copyright notice and this permission notice shall be included in all
11 | * copies or substantial portions of the Software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | * SOFTWARE.
20 | */
21 | #include "dialogoptions.h"
22 |
23 | #include "ui_dialogoptions.h"
24 |
25 | DialogOptions::DialogOptions(QWidget *pParent, XOptions *pOptions, XOptions::GROUPID groupId) : XShortcutsDialog(pParent), ui(new Ui::DialogOptions)
26 | {
27 | ui->setupUi(this);
28 |
29 | g_pDIEOptionsWidget = new DIEOptionsWidget(this);
30 | g_pSearchSignaturesOptionsWidget = new SearchSignaturesOptionsWidget(this);
31 | g_pXHexViewOptionsWidget = new XHexViewOptionsWidget(this);
32 | g_pXDisasmViewOptionsWidget = new XDisasmViewOptionsWidget(this);
33 | g_pXOnlineToolsOptionsWidget = new XOnlineToolsOptionsWidget(this);
34 | g_pXInfoDBOptionsWidget = new XInfoDBOptionsWidget(this);
35 |
36 | ui->widgetOptions->setOptions(pOptions, X_APPLICATIONDISPLAYNAME);
37 |
38 | ui->widgetOptions->addPage(g_pDIEOptionsWidget, tr("Scan"));
39 | g_pDIEOptionsWidget->setOptions(pOptions);
40 |
41 | ui->widgetOptions->addPage(g_pSearchSignaturesOptionsWidget, tr("Signatures"));
42 | g_pSearchSignaturesOptionsWidget->setOptions(pOptions);
43 |
44 | ui->widgetOptions->addPage(g_pXHexViewOptionsWidget, tr("Hex"));
45 | g_pXHexViewOptionsWidget->setOptions(pOptions);
46 |
47 | ui->widgetOptions->addPage(g_pXDisasmViewOptionsWidget, tr("Disasm"));
48 | g_pXDisasmViewOptionsWidget->setOptions(pOptions);
49 |
50 | ui->widgetOptions->addPage(g_pXOnlineToolsOptionsWidget, tr("Online tools"));
51 | g_pXOnlineToolsOptionsWidget->setOptions(pOptions);
52 |
53 | ui->widgetOptions->addPage(g_pXInfoDBOptionsWidget, tr("Info"));
54 | g_pXInfoDBOptionsWidget->setOptions(pOptions);
55 |
56 | ui->widgetOptions->setCurrentPage(groupId);
57 | }
58 |
59 | DialogOptions::~DialogOptions()
60 | {
61 | delete ui;
62 | }
63 |
64 | void DialogOptions::adjustView()
65 | {
66 | ui->widgetOptions->adjustView();
67 | }
68 |
69 | void DialogOptions::setGlobal(XShortcuts *pShortcuts, XOptions *pXOptions)
70 | {
71 | XShortcutsDialog::setGlobal(pShortcuts, pXOptions);
72 | ui->widgetOptions->setGlobal(pShortcuts, pXOptions);
73 | }
74 |
--------------------------------------------------------------------------------
/.github/workflows/builder.yml:
--------------------------------------------------------------------------------
1 | name: builder
2 | on:
3 | workflow_dispatch:
4 | release:
5 | types: [created]
6 | schedule:
7 | - cron: '0 0 * * MON'
8 |
9 | env:
10 | SRC_PATH: ${{ github.workspace }}/src
11 |
12 | jobs:
13 | build-ubuntu:
14 | runs-on: ubuntu-latest
15 | steps:
16 | - uses: actions/checkout@v4
17 | with:
18 | submodules: recursive
19 | path: ${{ env.SRC_PATH }}
20 |
21 | - name: Install Qt (Ubuntu)
22 | run: |
23 | sudo apt-get update
24 | sudo apt-get install cmake qtbase5-dev qtscript5-dev qttools5-dev qttools5-dev-tools libqt5svg5-dev qtchooser qt5-qmake build-essential -y
25 |
26 | - name: Build
27 | working-directory: ${{ env.SRC_PATH }}
28 | run: |
29 | mkdir tmp_build
30 | cd tmp_build
31 | cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_PREFIX_PATH="/usr/lib/x86_64-linux-gnu/cmake/Qt5" ..
32 | make
33 | cpack -G DEB
34 |
35 | - name: Upload Release as Download
36 | uses: softprops/action-gh-release@v2
37 | env:
38 | RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
39 | with:
40 | tag_name: Beta
41 | draft: false
42 | prerelease: true
43 | files: |
44 | ${{ env.SRC_PATH }}/tmp_build/packages/*.deb
45 |
46 | build-windows-32:
47 | runs-on: windows-2022
48 | steps:
49 | - uses: actions/checkout@v4
50 | with:
51 | submodules: 'recursive'
52 | path: ${{ env.SRC_PATH }}
53 |
54 | - name: Setup MSVC
55 | uses: ilammy/msvc-dev-cmd@v1
56 | with:
57 | arch: x86
58 |
59 | - name: Install Qt
60 | uses: jurplel/install-qt-action@v4
61 | with:
62 | version: '5.15.2'
63 | host: 'windows'
64 | target: 'desktop'
65 | arch: 'win32_msvc2019'
66 | dir: ${{ github.workspace }}
67 | modules: qtscript
68 |
69 | - name: Build
70 | shell: cmd
71 | working-directory: ${{ env.SRC_PATH }}
72 | run: |
73 | call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
74 | mkdir tmp_build
75 | cd tmp_build
76 | cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_PREFIX_PATH="${{ github.workspace }}\Qt\5.15.2\msvc2019" -G "NMake Makefiles" ..
77 | nmake
78 | cpack -G ZIP
79 | - name: Upload Release as Download
80 | uses: softprops/action-gh-release@v2
81 | env:
82 | RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
83 | with:
84 | tag_name: Beta
85 | draft: false
86 | prerelease: true
87 | files: |
88 | ${{ env.SRC_PATH }}/tmp_build/packages/*.zip
89 |
90 | build-windows-64:
91 | runs-on: windows-2022
92 | steps:
93 | - uses: actions/checkout@v4
94 | with:
95 | submodules: 'recursive'
96 | path: ${{ env.SRC_PATH }}
97 |
98 | - name: Setup MSVC
99 | uses: ilammy/msvc-dev-cmd@v1
100 | with:
101 | arch: x64
102 |
103 | - name: Install Qt
104 | uses: jurplel/install-qt-action@v4
105 | with:
106 | version: '5.15.2'
107 | host: 'windows'
108 | target: 'desktop'
109 | arch: 'win64_msvc2019_64'
110 | dir: ${{ github.workspace }}
111 | modules: qtscript
112 |
113 | - name: Build
114 | shell: cmd
115 | working-directory: ${{ env.SRC_PATH }}
116 | run: |
117 | call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
118 | mkdir tmp_build
119 | cd tmp_build
120 | cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_PREFIX_PATH="${{ github.workspace }}\Qt\5.15.2\msvc2019_64" -G "NMake Makefiles" ..
121 | nmake
122 | cpack -G ZIP
123 | - name: Upload Release as Download
124 | uses: softprops/action-gh-release@v2
125 | env:
126 | RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
127 | with:
128 | tag_name: Beta
129 | draft: false
130 | prerelease: true
131 | files: |
132 | ${{ env.SRC_PATH }}/tmp_build/packages/*.zip
133 |
--------------------------------------------------------------------------------
/src/gui/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.16)
2 |
3 | project(XBinaryViewer VERSION ${X_PROJECT_VERSION} LANGUAGES CXX)
4 |
5 | include(../../dep/build_tools/cmake/cpp_standart_setup.cmake)
6 |
7 | add_definitions(-DUSE_DEX)
8 | add_definitions(-DUSE_PDF)
9 | add_definitions(-DUSE_ARCHIVE)
10 | add_definitions(-DUSE_YARA)
11 | add_definitions(-DUSE_XSIMD)
12 |
13 | if(WIN32)
14 | add_definitions(-DNOMINMAX)
15 | endif()
16 |
17 | if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
18 | include(../../dep/build_tools/cmake/init_translation.cmake)
19 | endif()
20 |
21 | include(${CMAKE_CURRENT_LIST_DIR}/../../dep/FormatWidgets/XAbstractWidgets/xformatwidget.cmake)
22 | include(${CMAKE_CURRENT_LIST_DIR}/../../dep/XAboutWidget/xaboutwidget.cmake)
23 | include(${CMAKE_CURRENT_LIST_DIR}/../../dep/XStyles/xstyles.cmake)
24 |
25 | set(PROJECT_SOURCES
26 | ${XFORMATWIDGET_SOURCES}
27 | ${XABOUTWIDGET_SOURCES}
28 | ${XSTYLES_SOURCES}
29 | dialogabout.cpp
30 | dialogabout.h
31 | dialogabout.ui
32 | dialogoptions.cpp
33 | dialogoptions.h
34 | dialogoptions.ui
35 | main_gui.cpp
36 | guimainwindow.cpp
37 | guimainwindow.h
38 | guimainwindow.ui
39 | rsrc.qrc
40 | )
41 |
42 | if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
43 | include(../../dep/build_tools/cmake/create_translation.cmake)
44 | endif()
45 |
46 | if(WIN32)
47 | add_executable(XBinaryViewer
48 | WIN32
49 | ${PROJECT_SOURCES}
50 | ${QM_FILES}
51 | ../../res/resource_icon.rc
52 | )
53 | elseif(APPLE)
54 | add_executable(XBinaryViewer
55 | MACOSX_BUNDLE
56 | ${PROJECT_SOURCES}
57 | ${QM_FILES}
58 | )
59 |
60 | set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/../../res/main.icns PROPERTIES
61 | MACOSX_PACKAGE_LOCATION "Resources")
62 | target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../res/main.icns)
63 |
64 | else()
65 | add_executable(XBinaryViewer
66 | ${PROJECT_SOURCES}
67 | ${QM_FILES}
68 | )
69 | endif()
70 |
71 | if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
72 | if(APPLE)
73 | include(../../dep/build_tools/cmake/macdeployqt.cmake)
74 | endif()
75 | endif()
76 |
77 | target_link_libraries(XBinaryViewer PRIVATE bzip2)
78 | target_link_libraries(XBinaryViewer PRIVATE lzma)
79 | target_link_libraries(XBinaryViewer PRIVATE zlib)
80 | target_link_libraries(XBinaryViewer PRIVATE ppmd)
81 | target_link_libraries(XBinaryViewer PRIVATE capstone)
82 | target_link_libraries(XBinaryViewer PRIVATE cppfilt)
83 | target_link_libraries(XBinaryViewer PRIVATE yara)
84 | target_link_libraries(XBinaryViewer PRIVATE xsimd)
85 |
86 | target_link_libraries(XBinaryViewer PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
87 | target_link_libraries(XBinaryViewer PRIVATE Qt${QT_VERSION_MAJOR}::Concurrent)
88 | target_link_libraries(XBinaryViewer PRIVATE Qt${QT_VERSION_MAJOR}::Network)
89 | target_link_libraries(XBinaryViewer PRIVATE Qt${QT_VERSION_MAJOR}::PrintSupport)
90 | target_link_libraries(XBinaryViewer PRIVATE Qt${QT_VERSION_MAJOR}::OpenGL)
91 | target_link_libraries(XBinaryViewer PRIVATE Qt${QT_VERSION_MAJOR}::Svg)
92 | target_link_libraries(XBinaryViewer PRIVATE Qt${QT_VERSION_MAJOR}::Sql)
93 |
94 | if(${QT_VERSION_MAJOR} EQUAL 5)
95 | target_link_libraries(XBinaryViewer PRIVATE Qt${QT_VERSION_MAJOR}::Script)
96 | target_link_libraries(XBinaryViewer PRIVATE Qt${QT_VERSION_MAJOR}::ScriptTools)
97 | endif()
98 |
99 | if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
100 | target_link_libraries(XBinaryViewer PRIVATE Qt${QT_VERSION_MAJOR}::Qml)
101 | endif()
102 |
103 | if(WIN32)
104 | target_link_libraries(XBinaryViewer PRIVATE Wintrust)
105 | target_link_libraries(XBinaryViewer PRIVATE Crypt32)
106 | endif()
107 |
108 | find_package(Threads REQUIRED)
109 | target_link_libraries(XBinaryViewer PRIVATE Threads::Threads)
110 |
111 | if(WIN32)
112 | install (TARGETS XBinaryViewer DESTINATION "./")
113 | include(../../dep/build_tools/cmake/deploy_qt_windows.cmake)
114 | include(../../dep/build_tools/cmake/deploy_msvc.cmake)
115 | include(../../dep/build_tools/cmake/deploy_openssl.cmake)
116 | elseif(APPLE)
117 | install(TARGETS XBinaryViewer
118 | BUNDLE DESTINATION .
119 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
120 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
121 | )
122 | else()
123 | install (TARGETS XBinaryViewer DESTINATION ${CMAKE_INSTALL_BINDIR})
124 | endif()
125 |
--------------------------------------------------------------------------------
/src/gui/dialogabout.cpp:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2019-2025 hors
2 | *
3 | * Permission is hereby granted, free of charge, to any person obtaining a copy
4 | * of this software and associated documentation files (the "Software"), to deal
5 | * in the Software without restriction, including without limitation the rights
6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | * copies of the Software, and to permit persons to whom the Software is
8 | * furnished to do so, subject to the following conditions:
9 | *
10 | * The above copyright notice and this permission notice shall be included in all
11 | * copies or substantial portions of the Software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | * SOFTWARE.
20 | */
21 | #include "dialogabout.h"
22 |
23 | #include "ui_dialogabout.h"
24 |
25 | DialogAbout::DialogAbout(QWidget *pParent) : XShortcutsDialog(pParent), ui(new Ui::DialogAbout)
26 | {
27 | ui->setupUi(this);
28 |
29 | setWindowFlags(Qt::Window);
30 |
31 | ui->labelVersion->setText(QString("%1").arg(XOptions::getTitle(X_APPLICATIONDISPLAYNAME, X_APPLICATIONVERSION)));
32 |
33 | ui->labelBugreports->setText(
34 | QString("%1: horsicq@gmail.com
")
36 | .arg(tr("Bugreports")));
37 | ui->labelWebsite->setText(
38 | QString("%1: http://ntinfo.biz
")
40 | .arg(tr("Website")));
41 | ui->labelDonate->setText(QString("%1(Paypal): ntinfo.re@gmail.com
")
43 | .arg(tr("Donate")));
44 | ui->labelSourceCode->setText(
45 | QString("%1: https://github.com/horsicq/XELFViewer
")
47 | .arg(tr("Source code")));
48 | ui->labelThanks->setText(
49 | QString(""
50 | "%1:
"
51 | ""
52 | "Fernando Mercês, "
53 | "David Zimmer, "
54 | "misonothx, "
55 | "
"
56 | ""
57 | "FrenchYeti, "
58 | "fr0zenbag, "
59 | "Anderson Leite, "
60 | "
"
61 | ""
62 | "Filip Navara, "
63 | "Ali Hadi, "
64 | "Duncan Ogilvie, "
65 | "
"
66 | ""
67 | "Leandro Fróes, "
68 | "phithon, "
69 | "Christopher Layne, "
70 | "
"
71 | ""
72 | "Adric Net, "
73 | "Gilad Reich"
74 | "
"
75 | "")
76 | .arg(tr("Thanks")));
77 | }
78 |
79 | DialogAbout::~DialogAbout()
80 | {
81 | delete ui;
82 | }
83 |
84 | void DialogAbout::adjustView()
85 | {
86 | // TODO
87 | }
88 |
89 | void DialogAbout::on_pushButtonOK_clicked()
90 | {
91 | this->close();
92 | }
93 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "dep/Detect-It-Easy"]
2 | path = dep/Detect-It-Easy
3 | url = https://github.com/horsicq/Detect-It-Easy
4 | [submodule "dep/archive_widget"]
5 | path = dep/archive_widget
6 | url = https://github.com/horsicq/archive_widget
7 | [submodule "dep/build_tools"]
8 | path = dep/build_tools
9 | url = https://github.com/horsicq/build_tools
10 | [submodule "dep/Controls"]
11 | path = dep/Controls
12 | url = https://github.com/horsicq/Controls
13 | [submodule "dep/die_script"]
14 | path = dep/die_script
15 | url = https://github.com/horsicq/die_script
16 | [submodule "dep/die_widget"]
17 | path = dep/die_widget
18 | url = https://github.com/horsicq/die_widget
19 | [submodule "dep/FormatDialogs"]
20 | path = dep/FormatDialogs
21 | url = https://github.com/horsicq/FormatDialogs
22 | [submodule "dep/Formats"]
23 | path = dep/Formats
24 | url = https://github.com/horsicq/Formats
25 | [submodule "dep/FormatWidgets"]
26 | path = dep/FormatWidgets
27 | url = https://github.com/horsicq/FormatWidgets
28 | [submodule "dep/hex_templates"]
29 | path = dep/hex_templates
30 | url = https://github.com/horsicq/hex_templates
31 | [submodule "dep/nfd_widget"]
32 | path = dep/nfd_widget
33 | url = https://github.com/horsicq/nfd_widget
34 | [submodule "dep/signatures"]
35 | path = dep/signatures
36 | url = https://github.com/horsicq/signatures
37 | [submodule "dep/SpecAbstract"]
38 | path = dep/SpecAbstract
39 | url = https://github.com/horsicq/SpecAbstract
40 | [submodule "dep/StaticScan"]
41 | path = dep/StaticScan
42 | url = https://github.com/horsicq/StaticScan
43 | [submodule "dep/XAboutWidget"]
44 | path = dep/XAboutWidget
45 | url = https://github.com/horsicq/XAboutWidget
46 | [submodule "dep/XArchive"]
47 | path = dep/XArchive
48 | url = https://github.com/horsicq/XArchive
49 | [submodule "dep/XCapstone"]
50 | path = dep/XCapstone
51 | url = https://github.com/horsicq/XCapstone
52 | [submodule "dep/XCppfilt"]
53 | path = dep/XCppfilt
54 | url = https://github.com/horsicq/XCppfilt
55 | [submodule "dep/XDecompiler"]
56 | path = dep/XDecompiler
57 | url = https://github.com/horsicq/XDecompiler
58 | [submodule "dep/XDemangle"]
59 | path = dep/XDemangle
60 | url = https://github.com/horsicq/XDemangle
61 | [submodule "dep/XDemangleWidget"]
62 | path = dep/XDemangleWidget
63 | url = https://github.com/horsicq/XDemangleWidget
64 | [submodule "dep/XDEX"]
65 | path = dep/XDEX
66 | url = https://github.com/horsicq/XDEX
67 | [submodule "dep/XDisasmView"]
68 | path = dep/XDisasmView
69 | url = https://github.com/horsicq/XDisasmView
70 | [submodule "dep/XDynStructs"]
71 | path = dep/XDynStructs
72 | url = https://github.com/horsicq/XDynStructs
73 | [submodule "dep/XDynStructsEngine"]
74 | path = dep/XDynStructsEngine
75 | url = https://github.com/horsicq/XDynStructsEngine
76 | [submodule "dep/XDynStructsWidget"]
77 | path = dep/XDynStructsWidget
78 | url = https://github.com/horsicq/XDynStructsWidget
79 | [submodule "dep/XEntropyWidget"]
80 | path = dep/XEntropyWidget
81 | url = https://github.com/horsicq/XEntropyWidget
82 | [submodule "dep/XExtractor"]
83 | path = dep/XExtractor
84 | url = https://github.com/horsicq/XExtractor
85 | [submodule "dep/XExtractorWidget"]
86 | path = dep/XExtractorWidget
87 | url = https://github.com/horsicq/XExtractorWidget
88 | [submodule "dep/XFileInfo"]
89 | path = dep/XFileInfo
90 | url = https://github.com/horsicq/XFileInfo
91 | [submodule "dep/XGithub"]
92 | path = dep/XGithub
93 | url = https://github.com/horsicq/XGithub
94 | [submodule "dep/XHandlesWidget"]
95 | path = dep/XHandlesWidget
96 | url = https://github.com/horsicq/XHandlesWidget
97 | [submodule "dep/XHashWidget"]
98 | path = dep/XHashWidget
99 | url = https://github.com/horsicq/XHashWidget
100 | [submodule "dep/XHexEdit"]
101 | path = dep/XHexEdit
102 | url = https://github.com/horsicq/XHexEdit
103 | [submodule "dep/XHexView"]
104 | path = dep/XHexView
105 | url = https://github.com/horsicq/XHexView
106 | [submodule "dep/XInfoDB"]
107 | path = dep/XInfoDB
108 | url = https://github.com/horsicq/XInfoDB
109 | [submodule "dep/XLLVMDemangler"]
110 | path = dep/XLLVMDemangler
111 | url = https://github.com/horsicq/XLLVMDemangler
112 | [submodule "dep/XLog"]
113 | path = dep/XLog
114 | url = https://github.com/horsicq/XLog
115 | [submodule "dep/XMemoryMapWidget"]
116 | path = dep/XMemoryMapWidget
117 | url = https://github.com/horsicq/XMemoryMapWidget
118 | [submodule "dep/XOnlineTools"]
119 | path = dep/XOnlineTools
120 | url = https://github.com/horsicq/XOnlineTools
121 | [submodule "dep/XOptions"]
122 | path = dep/XOptions
123 | url = https://github.com/horsicq/XOptions
124 | [submodule "dep/XPDF"]
125 | path = dep/XPDF
126 | url = https://github.com/horsicq/XPDF
127 | [submodule "dep/XQwt"]
128 | path = dep/XQwt
129 | url = https://github.com/horsicq/XQwt
130 | [submodule "dep/XShortcuts"]
131 | path = dep/XShortcuts
132 | url = https://github.com/horsicq/XShortcuts
133 | [submodule "dep/XStyles"]
134 | path = dep/XStyles
135 | url = https://github.com/horsicq/XStyles
136 | [submodule "dep/XSymbolsWidget"]
137 | path = dep/XSymbolsWidget
138 | url = https://github.com/horsicq/XSymbolsWidget
139 | [submodule "dep/XTranslation"]
140 | path = dep/XTranslation
141 | url = https://github.com/horsicq/XTranslation
142 | [submodule "dep/XUpdate"]
143 | path = dep/XUpdate
144 | url = https://github.com/horsicq/XUpdate
145 | [submodule "dep/XVisualizationWidget"]
146 | path = dep/XVisualizationWidget
147 | url = https://github.com/horsicq/XVisualizationWidget
148 | [submodule "dep/XYara"]
149 | path = dep/XYara
150 | url = https://github.com/horsicq/XYara
151 | [submodule "dep/yara_widget"]
152 | path = dep/yara_widget
153 | url = https://github.com/horsicq/yara_widget
154 | [submodule "dep/XDataConvertorWidget"]
155 | path = dep/XDataConvertorWidget
156 | url = https://github.com/horsicq/XDataConvertorWidget
157 | [submodule "dep/XScanEngine"]
158 | path = dep/XScanEngine
159 | url = https://github.com/horsicq/XScanEngine
160 | [submodule "dep/XDisasmCore"]
161 | path = dep/XDisasmCore
162 | url = https://github.com/horsicq/XDisasmCore.git
163 | [submodule "dep/XRegionsWidget"]
164 | path = dep/XRegionsWidget
165 | url = https://github.com/horsicq/XRegionsWidget.git
166 | [submodule "dep/XStaticUnpacker"]
167 | path = dep/XStaticUnpacker
168 | url = https://github.com/horsicq/XStaticUnpacker
169 |
--------------------------------------------------------------------------------
/src/gui/dialogabout.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | DialogAbout
4 |
5 |
6 | Qt::WindowModality::ApplicationModal
7 |
8 |
9 |
10 | 0
11 | 0
12 | 883
13 | 585
14 |
15 |
16 |
17 | About
18 |
19 |
20 | true
21 |
22 |
23 | -
24 |
25 |
-
26 |
27 |
28 |
29 | 308
30 | 235
31 |
32 |
33 |
34 |
35 |
36 |
37 | :/pics/logo.png
38 |
39 |
40 | Qt::AlignmentFlag::AlignCenter
41 |
42 |
43 |
44 | -
45 |
46 |
-
47 |
48 |
49 | XELFViewer
50 |
51 |
52 | Qt::AlignmentFlag::AlignCenter
53 |
54 |
55 |
56 | -
57 |
58 |
59 | <html><head/><body><p><span style=" font-weight:700;">Copyright(C) 2019-2025 hors</span></p></body></html>
60 |
61 |
62 | Qt::AlignmentFlag::AlignCenter
63 |
64 |
65 |
66 | -
67 |
68 |
69 | <html><head/><body><p><span style=" font-weight:600;">Bugreports</span>: <a href="mailto:horsicq@gmail.com"><span style=" text-decoration: underline; color:#ff0000;">horsicq@gmail.com</span></a></p></body></html>
70 |
71 |
72 | Qt::AlignmentFlag::AlignCenter
73 |
74 |
75 | true
76 |
77 |
78 |
79 | -
80 |
81 |
82 | <html><head/><body><p><span style=" font-weight:600;">Website</span>: <a href="http://ntinfo.biz"><span style=" text-decoration: underline; color:#ff0000;">http://ntinfo.biz</span></a></p></body></html>
83 |
84 |
85 | Qt::AlignmentFlag::AlignCenter
86 |
87 |
88 | true
89 |
90 |
91 |
92 | -
93 |
94 |
95 | <html><head/><body><p><span style=" font-weight:600;">Donate(Paypal): </span><a href="mailto:ntinfo.re@gmail.com"><span style=" text-decoration: underline; color:#ff0000;">ntinfo.re@gmail.com</span></a></p></body></html>
96 |
97 |
98 | Qt::AlignmentFlag::AlignCenter
99 |
100 |
101 | true
102 |
103 |
104 |
105 | -
106 |
107 |
108 | <html><head/><body><p><span style=" font-weight:600;">Source code: </span><a href="https://github.com/horsicq/XELFViewer"><span style=" text-decoration: underline; color:#ff0000;">https://github.com/horsicq/XELFViewer</span></a></p></body></html>
109 |
110 |
111 | Qt::AlignmentFlag::AlignCenter
112 |
113 |
114 | true
115 |
116 |
117 |
118 | -
119 |
120 |
121 | Thanks
122 |
123 |
124 | Qt::TextFormat::AutoText
125 |
126 |
127 | true
128 |
129 |
130 |
131 | -
132 |
133 |
134 | Qt::Orientation::Vertical
135 |
136 |
137 |
138 | 20
139 | 40
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 | -
149 |
150 |
-
151 |
152 |
153 | Qt::Orientation::Horizontal
154 |
155 |
156 |
157 | 40
158 | 20
159 |
160 |
161 |
162 |
163 | -
164 |
165 |
166 | OK
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
--------------------------------------------------------------------------------
/src/gui/guimainwindow.cpp:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2019-2025 hors
2 | *
3 | * Permission is hereby granted, free of charge, to any person obtaining a copy
4 | * of this software and associated documentation files (the "Software"), to deal
5 | * in the Software without restriction, including without limitation the rights
6 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | * copies of the Software, and to permit persons to whom the Software is
8 | * furnished to do so, subject to the following conditions:
9 | *
10 | * The above copyright notice and this permission notice shall be included in all
11 | * copies or substantial portions of the Software.
12 | *
13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 | * SOFTWARE.
20 | */
21 | #include "guimainwindow.h"
22 |
23 | #include "ui_guimainwindow.h"
24 |
25 | GuiMainWindow::GuiMainWindow(QWidget *pParent) : QMainWindow(pParent), ui(new Ui::GuiMainWindow)
26 | {
27 | ui->setupUi(this);
28 |
29 | #ifdef USE_XSIMD
30 | xsimd_init();
31 | #endif
32 |
33 | XYara::initialize();
34 |
35 | g_pFile = nullptr;
36 | g_pXInfo = nullptr;
37 |
38 | ui->stackedWidget->setCurrentIndex(0);
39 |
40 | setWindowTitle(XOptions::getTitle(X_APPLICATIONDISPLAYNAME, X_APPLICATIONVERSION));
41 |
42 | setAcceptDrops(true);
43 |
44 | g_xOptions.setName(X_OPTIONSFILE);
45 |
46 | g_xOptions.addID(XOptions::ID_VIEW_STYLE, "Fusion");
47 | g_xOptions.addID(XOptions::ID_VIEW_QSS, "");
48 | g_xOptions.addID(XOptions::ID_VIEW_LANG, "System");
49 | g_xOptions.addID(XOptions::ID_VIEW_FONT_CONTROLS, XOptions::getDefaultFont().toString());
50 | g_xOptions.addID(XOptions::ID_VIEW_FONT_TABLEVIEWS, XOptions::getMonoFont().toString());
51 | g_xOptions.addID(XOptions::ID_VIEW_FONT_TREEVIEWS, XOptions::getDefaultFont().toString());
52 | g_xOptions.addID(XOptions::ID_VIEW_FONT_TEXTEDITS, XOptions::getMonoFont().toString());
53 | g_xOptions.addID(XOptions::ID_VIEW_STAYONTOP, false);
54 | g_xOptions.addID(XOptions::ID_VIEW_SHOWLOGO, false);
55 | g_xOptions.addID(XOptions::ID_FILE_SAVELASTDIRECTORY, true);
56 | g_xOptions.addID(XOptions::ID_FILE_SAVEBACKUP, true);
57 | g_xOptions.addID(XOptions::ID_FILE_SAVERECENTFILES, true);
58 |
59 | g_xOptions.addID(XOptions::ID_FEATURE_READBUFFERSIZE, 8 * 1024);
60 | g_xOptions.addID(XOptions::ID_FEATURE_FILEBUFFERSIZE, 2 * 1024 * 1024);
61 |
62 | #ifdef USE_XSIMD
63 | #ifdef Q_PROCESSOR_X86
64 | g_xOptions.addID(XOptions::ID_FEATURE_SSE2, true);
65 | g_xOptions.addID(XOptions::ID_FEATURE_AVX, true);
66 | g_xOptions.addID(XOptions::ID_FEATURE_AVX2, true);
67 | #endif
68 | #endif
69 |
70 | #ifdef Q_OS_WIN
71 | g_xOptions.addID(XOptions::ID_FILE_CONTEXT, "*");
72 | #endif
73 |
74 | DIEOptionsWidget::setDefaultValues(&g_xOptions);
75 | SearchSignaturesOptionsWidget::setDefaultValues(&g_xOptions);
76 | XHexViewOptionsWidget::setDefaultValues(&g_xOptions);
77 | XDisasmViewOptionsWidget::setDefaultValues(&g_xOptions);
78 | XOnlineToolsOptionsWidget::setDefaultValues(&g_xOptions);
79 | XInfoDBOptionsWidget::setDefaultValues(&g_xOptions);
80 |
81 | g_xOptions.addID(XOptions::ID_SCAN_YARARULESPATH, "$data/yara_rules");
82 |
83 | g_xOptions.load();
84 |
85 | g_xShortcuts.setName(X_SHORTCUTSFILE);
86 | g_xShortcuts.setNative(g_xOptions.isNative());
87 |
88 | g_xShortcuts.addGroup(XShortcuts::GROUPID_HEX);
89 | g_xShortcuts.addGroup(XShortcuts::GROUPID_DISASM);
90 | g_xShortcuts.addGroup(XShortcuts::GROUPID_TABLE);
91 |
92 | g_xShortcuts.load();
93 |
94 | g_pInfoMenu = new XInfoMenu(&g_xShortcuts, &g_xOptions);
95 |
96 | ui->widgetViewer->setGlobal(&g_xShortcuts, &g_xOptions);
97 |
98 | connect(&g_xOptions, SIGNAL(openFile(QString)), this, SLOT(processFile(QString)));
99 |
100 | createMenus();
101 |
102 | adjustView();
103 |
104 | if (QCoreApplication::arguments().count() > 1) {
105 | QString sFileName = QCoreApplication::arguments().at(1);
106 |
107 | processFile(sFileName);
108 | }
109 | }
110 |
111 | GuiMainWindow::~GuiMainWindow()
112 | {
113 | closeCurrentFile();
114 | g_xOptions.save();
115 | g_xShortcuts.save();
116 |
117 | delete g_pInfoMenu;
118 | delete ui;
119 |
120 | XYara::finalize();
121 |
122 | #ifdef USE_XSIMD
123 | xsimd_cleanup();
124 | #endif
125 | }
126 |
127 | void GuiMainWindow::createMenus()
128 | {
129 | QMenu *pMenuFile = new QMenu(tr("File"), ui->menubar);
130 | QMenu *pMenuTools = new QMenu(tr("Tools"), ui->menubar);
131 | QMenu *pMenuHelp = new QMenu(tr("Help"), ui->menubar);
132 |
133 | ui->menubar->addAction(pMenuFile->menuAction());
134 | ui->menubar->addAction(pMenuTools->menuAction());
135 | ui->menubar->addAction(pMenuHelp->menuAction());
136 |
137 | QAction *pActionOpen = new QAction(tr("Open"), this);
138 | QAction *pActionClose = new QAction(tr("Close"), this);
139 | QAction *pActionExit = new QAction(tr("Exit"), this);
140 | QAction *pActionOptions = new QAction(tr("Options"), this);
141 | QAction *pActionAbout = new QAction(tr("About"), this);
142 | QAction *pActionShortcuts = new QAction(tr("Shortcuts"), this);
143 | QAction *pActionDemangle = new QAction(tr("Demangle"), this);
144 |
145 | pMenuFile->addAction(pActionOpen);
146 | pMenuFile->addMenu(g_xOptions.createRecentFilesMenu(this));
147 | pMenuFile->addMenu(g_pInfoMenu->createMenu(this));
148 | pMenuFile->addAction(pActionClose);
149 | pMenuFile->addAction(pActionExit);
150 | pMenuTools->addAction(pActionDemangle);
151 | pMenuTools->addAction(pActionShortcuts);
152 | pMenuTools->addAction(pActionOptions);
153 | pMenuHelp->addAction(pActionAbout);
154 |
155 | connect(pActionOpen, SIGNAL(triggered()), this, SLOT(actionOpenSlot()));
156 | connect(pActionClose, SIGNAL(triggered()), this, SLOT(actionCloseSlot()));
157 | connect(pActionExit, SIGNAL(triggered()), this, SLOT(actionExitSlot()));
158 | connect(pActionOptions, SIGNAL(triggered()), this, SLOT(actionOptionsSlot()));
159 | connect(pActionAbout, SIGNAL(triggered()), this, SLOT(actionAboutSlot()));
160 | connect(pActionShortcuts, SIGNAL(triggered()), this, SLOT(actionShortcutsSlot()));
161 | connect(pActionDemangle, SIGNAL(triggered()), this, SLOT(actionDemangleSlot()));
162 | }
163 |
164 | void GuiMainWindow::actionOpenSlot()
165 | {
166 | QString sDirectory = g_xOptions.getLastDirectory();
167 |
168 | QString sFileName = QFileDialog::getOpenFileName(this, tr("Open file") + QString("..."), sDirectory, tr("All files") + QString(" (*)"));
169 |
170 | if (!sFileName.isEmpty()) {
171 | processFile(sFileName);
172 | }
173 | }
174 |
175 | void GuiMainWindow::actionCloseSlot()
176 | {
177 | closeCurrentFile();
178 | }
179 |
180 | void GuiMainWindow::actionExitSlot()
181 | {
182 | this->close();
183 | }
184 |
185 | void GuiMainWindow::actionOptionsSlot()
186 | {
187 | DialogOptions dialogOptions(this, &g_xOptions, XOptions::GROUPID_FILE);
188 | dialogOptions.setGlobal(&g_xShortcuts, &g_xOptions);
189 | dialogOptions.exec();
190 |
191 | adjustView();
192 | }
193 |
194 | void GuiMainWindow::actionAboutSlot()
195 | {
196 | DialogAbout dialogAbout(this);
197 | dialogAbout.setGlobal(&g_xShortcuts, &g_xOptions);
198 | dialogAbout.exec();
199 | }
200 |
201 | void GuiMainWindow::adjustView()
202 | {
203 | ui->widgetViewer->adjustView();
204 |
205 | g_xOptions.adjustStayOnTop(this);
206 | g_xOptions.adjustWidget(this, XOptions::ID_VIEW_FONT_CONTROLS);
207 |
208 | if (g_xOptions.isShowLogo()) {
209 | ui->labelLogo->show();
210 | } else {
211 | ui->labelLogo->hide();
212 | }
213 | }
214 |
215 | void GuiMainWindow::processFile(const QString &sFileName)
216 | {
217 | if ((sFileName != "") && (QFileInfo(sFileName).isFile())) {
218 | g_xOptions.setLastFileName(sFileName);
219 |
220 | closeCurrentFile();
221 |
222 | g_pFile = new QFile;
223 | g_pXInfo = new XInfoDB;
224 |
225 | g_pFile->setFileName(sFileName);
226 |
227 | if (!g_pFile->open(QIODevice::ReadWrite)) {
228 | if (!g_pFile->open(QIODevice::ReadOnly)) {
229 | closeCurrentFile();
230 | }
231 | }
232 |
233 | // if (!g_pFile->open(QIODevice::ReadOnly)) {
234 | // closeCurrentFile();
235 | // }
236 |
237 | if (g_pFile) {
238 | XBinary xbinary(g_pFile);
239 | if (xbinary.isValid()) {
240 | g_pInfoMenu->setData(g_pXInfo, g_pFile, sFileName + ".db");
241 | g_pInfoMenu->tryToLoad();
242 |
243 | // XFW_DEF::OPTIONS formatOptions = {};
244 |
245 | // formatOptions.bIsImage = false;
246 | // formatOptions.nImageBase = -1;
247 | // formatOptions.vmode = XFW_DEF::VMODE_FILETYPE;
248 | // // formatOptions.nStartType = SBINARY::TYPE_INFO;
249 | XMainWidget::OPTIONS formatOptions = {};
250 | formatOptions.bIsImage = false;
251 | formatOptions.nImageBase = -1;
252 | formatOptions.bGlobalHexEnable = true;
253 |
254 | ui->widgetViewer->setData(g_pFile, g_pXInfo, formatOptions);
255 |
256 | ui->widgetViewer->reload();
257 |
258 | adjustView();
259 |
260 | setWindowTitle(sFileName);
261 | ui->stackedWidget->setCurrentIndex(1);
262 | } else {
263 | QMessageBox::critical(this, tr("Error"), tr("It is not a valid file"));
264 | }
265 | } else {
266 | QMessageBox::critical(this, tr("Error"), tr("Cannot open file"));
267 | }
268 | } else {
269 | QMessageBox::critical(this, tr("Error"), tr("Cannot open file"));
270 | }
271 | }
272 |
273 | void GuiMainWindow::closeCurrentFile()
274 | {
275 | if (g_pXInfo) {
276 | g_pInfoMenu->tryToSave();
277 |
278 | delete g_pXInfo;
279 | g_pXInfo = nullptr;
280 | g_pInfoMenu->reset();
281 | }
282 |
283 | if (g_pFile) {
284 | g_pFile->close();
285 | delete g_pFile;
286 | g_pFile = nullptr;
287 | }
288 |
289 | ui->stackedWidget->setCurrentIndex(0);
290 | ui->widgetViewer->cleanup();
291 |
292 | setWindowTitle(XOptions::getTitle(X_APPLICATIONDISPLAYNAME, X_APPLICATIONVERSION));
293 | }
294 |
295 | void GuiMainWindow::dragEnterEvent(QDragEnterEvent *pEvent)
296 | {
297 | pEvent->acceptProposedAction();
298 | }
299 |
300 | void GuiMainWindow::dragMoveEvent(QDragMoveEvent *pEvent)
301 | {
302 | pEvent->acceptProposedAction();
303 | }
304 |
305 | void GuiMainWindow::dropEvent(QDropEvent *pEvent)
306 | {
307 | const QMimeData *mimeData = pEvent->mimeData();
308 |
309 | if (mimeData->hasUrls()) {
310 | QList urlList = mimeData->urls();
311 |
312 | if (urlList.count()) {
313 | QString sFileName = urlList.at(0).toLocalFile();
314 |
315 | sFileName = XBinary::convertFileName(sFileName);
316 |
317 | processFile(sFileName);
318 | }
319 | }
320 | }
321 |
322 | void GuiMainWindow::actionShortcutsSlot()
323 | {
324 | DialogShortcuts dialogShortcuts(this);
325 | dialogShortcuts.setGlobal(&g_xShortcuts, &g_xOptions);
326 | dialogShortcuts.setData(&g_xShortcuts);
327 |
328 | dialogShortcuts.exec();
329 |
330 | adjustView();
331 | }
332 |
333 | void GuiMainWindow::actionDemangleSlot()
334 | {
335 | DialogDemangle dialogDemangle(this);
336 | dialogDemangle.setGlobal(&g_xShortcuts, &g_xOptions);
337 |
338 | dialogDemangle.exec();
339 | }
340 |
--------------------------------------------------------------------------------