├── README.md ├── LICENSE ├── nfd_widget.pri ├── dialognfdscan.h ├── dialognfdscan.cpp ├── nfdoptionswidget.h ├── dialognfdscan.ui ├── dialognfdwidgetadvanced.ui ├── dialognfdwidgetadvanced.h ├── dialognfdwidgetadvanced.cpp ├── nfdwidgetadvanced.h ├── dialognfdscandirectory.h ├── nfd_widget.cmake ├── nfd_widget.h ├── nfdoptionswidget.cpp ├── nfdwidgetadvanced.ui ├── dialognfdscandirectory.ui ├── nfdoptionswidget.ui ├── dialognfdscandirectory.cpp ├── nfdwidgetadvanced.cpp ├── nfd_widget.cpp └── nfd_widget.ui /README.md: -------------------------------------------------------------------------------- 1 | # nfd_widget 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020-2025 hors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /nfd_widget.pri: -------------------------------------------------------------------------------- 1 | QT += concurrent 2 | 3 | INCLUDEPATH += $$PWD 4 | DEPENDPATH += $$PWD 5 | 6 | HEADERS += \ 7 | $$PWD/dialognfdscan.h \ 8 | $$PWD/dialognfdscandirectory.h \ 9 | $$PWD/dialognfdwidgetadvanced.h \ 10 | $$PWD/nfd_widget.h \ 11 | $$PWD/nfdoptionswidget.h \ 12 | $$PWD/nfdwidgetadvanced.h 13 | 14 | SOURCES += \ 15 | $$PWD/dialognfdscan.cpp \ 16 | $$PWD/dialognfdscandirectory.cpp \ 17 | $$PWD/dialognfdwidgetadvanced.cpp \ 18 | $$PWD/nfd_widget.cpp \ 19 | $$PWD/nfdoptionswidget.cpp \ 20 | $$PWD/nfdwidgetadvanced.cpp 21 | 22 | FORMS += \ 23 | $$PWD/dialognfdscan.ui \ 24 | $$PWD/dialognfdscandirectory.ui \ 25 | $$PWD/dialognfdwidgetadvanced.ui \ 26 | $$PWD/nfd_widget.ui \ 27 | $$PWD/nfdoptionswidget.ui \ 28 | $$PWD/nfdwidgetadvanced.ui 29 | 30 | !contains(XCONFIG, specabstract) { 31 | XCONFIG += specabstract 32 | include($$PWD/../SpecAbstract/specabstract.pri) 33 | } 34 | 35 | !contains(XCONFIG, xshortcuts) { 36 | XCONFIG += xshortcuts 37 | include($$PWD/../XShortcuts/xshortcuts.pri) 38 | } 39 | 40 | !contains(XCONFIG, dialogtextinfo) { 41 | XCONFIG += dialogtextinfo 42 | include($$PWD/../FormatDialogs/dialogtextinfo.pri) 43 | } 44 | 45 | !contains(XCONFIG, xdialogprocess) { 46 | XCONFIG += xdialogprocess 47 | include($$PWD/../FormatDialogs/xdialogprocess.pri) 48 | } 49 | 50 | !contains(XCONFIG, xcomboboxex) { 51 | XCONFIG += xcomboboxex 52 | include($$PWD/../Controls/xcomboboxex.pri) 53 | } 54 | 55 | !contains(XCONFIG, xtableview) { 56 | XCONFIG += xtableview 57 | include($$PWD/../Controls/xtableview.pri) 58 | } 59 | 60 | DISTFILES += \ 61 | $$PWD/LICENSE \ 62 | $$PWD/README.md \ 63 | $$PWD/nfd_widget.cmake 64 | -------------------------------------------------------------------------------- /dialognfdscan.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-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 | #ifndef DIALOGNFDSCAN_H 22 | #define DIALOGNFDSCAN_H 23 | 24 | #include "xshortcutsdialog.h" 25 | #include "xbinary.h" 26 | #include "xoptions.h" 27 | 28 | namespace Ui { 29 | class DialogNFDScan; 30 | } 31 | 32 | class DialogNFDScan : public XShortcutsDialog { 33 | Q_OBJECT 34 | 35 | public: 36 | explicit DialogNFDScan(QWidget *pParent); 37 | ~DialogNFDScan(); 38 | 39 | virtual void adjustView(); 40 | 41 | void setData(QIODevice *pDevice, bool bScan, XBinary::FT fileType); 42 | 43 | private slots: 44 | void on_pushButtonClose_clicked(); 45 | 46 | protected: 47 | virtual void registerShortcuts(bool bState); 48 | 49 | private: 50 | Ui::DialogNFDScan *ui; 51 | }; 52 | 53 | #endif // DIALOGNFDSCAN_H 54 | -------------------------------------------------------------------------------- /dialognfdscan.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-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 "dialognfdscan.h" 22 | 23 | #include "ui_dialognfdscan.h" 24 | 25 | DialogNFDScan::DialogNFDScan(QWidget *pParent) : XShortcutsDialog(pParent, false), ui(new Ui::DialogNFDScan) 26 | { 27 | ui->setupUi(this); 28 | } 29 | 30 | DialogNFDScan::~DialogNFDScan() 31 | { 32 | delete ui; 33 | } 34 | 35 | void DialogNFDScan::adjustView() 36 | { 37 | } 38 | 39 | void DialogNFDScan::setData(QIODevice *pDevice, bool bScan, XBinary::FT fileType) 40 | { 41 | ui->widgetResult->setData(pDevice, bScan, fileType); 42 | } 43 | 44 | void DialogNFDScan::on_pushButtonClose_clicked() 45 | { 46 | this->close(); 47 | } 48 | 49 | void DialogNFDScan::registerShortcuts(bool bState) 50 | { 51 | Q_UNUSED(bState) 52 | } 53 | -------------------------------------------------------------------------------- /nfdoptionswidget.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-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 | #ifndef NFDOPTIONSWIDGET_H 22 | #define NFDOPTIONSWIDGET_H 23 | 24 | #include "xshortcutswidget.h" 25 | 26 | namespace Ui { 27 | class NFDOptionsWidget; 28 | } 29 | 30 | // TOIDO remove, use ScanOptionsWidget 31 | class NFDOptionsWidget : public XShortcutsWidget { 32 | Q_OBJECT 33 | 34 | public: 35 | explicit NFDOptionsWidget(QWidget *pParent = nullptr); 36 | ~NFDOptionsWidget(); 37 | 38 | virtual void adjustView(); 39 | 40 | void setOptions(XOptions *pOptions); 41 | static void setDefaultValues(XOptions *pOptions); 42 | 43 | public slots: 44 | void save(); 45 | void reload(); 46 | 47 | protected: 48 | virtual void registerShortcuts(bool bState); 49 | 50 | private: 51 | Ui::NFDOptionsWidget *ui; 52 | XOptions *m_pOptions; 53 | }; 54 | 55 | #endif // NFDOPTIONSWIDGET_H 56 | -------------------------------------------------------------------------------- /dialognfdscan.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | DialogNFDScan 4 | 5 | 6 | Qt::ApplicationModal 7 | 8 | 9 | 10 | 0 11 | 0 12 | 557 13 | 315 14 | 15 | 16 | 17 | Scan 18 | 19 | 20 | true 21 | 22 | 23 | 24 | 25 | 26 | 27 | 0 28 | 0 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | Qt::Horizontal 39 | 40 | 41 | 42 | 40 43 | 20 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | Close 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | NFDWidgetAdvanced 62 | QWidget 63 |
nfdwidgetadvanced.h
64 | 1 65 |
66 |
67 | 68 | 69 |
70 | -------------------------------------------------------------------------------- /dialognfdwidgetadvanced.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | DialogNFDWidgetAdvanced 4 | 5 | 6 | Qt::ApplicationModal 7 | 8 | 9 | 10 | 0 11 | 0 12 | 429 13 | 309 14 | 15 | 16 | 17 | Nauz File Detector 18 | 19 | 20 | true 21 | 22 | 23 | 24 | 25 | 26 | 27 | 0 28 | 0 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | Qt::Horizontal 39 | 40 | 41 | 42 | 40 43 | 20 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | Close 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | NFDWidgetAdvanced 62 | QWidget 63 |
nfdwidgetadvanced.h
64 | 1 65 |
66 |
67 | 68 | 69 |
70 | -------------------------------------------------------------------------------- /dialognfdwidgetadvanced.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-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 | #ifndef DIALOGNFDWIDGETADVANCED_H 22 | #define DIALOGNFDWIDGETADVANCED_H 23 | 24 | #include "xshortcutsdialog.h" 25 | #include "nfdwidgetadvanced.h" 26 | 27 | namespace Ui { 28 | class DialogNFDWidgetAdvanced; 29 | } 30 | 31 | class DialogNFDWidgetAdvanced : public XShortcutsDialog { 32 | Q_OBJECT 33 | 34 | public: 35 | explicit DialogNFDWidgetAdvanced(QWidget *pParent = nullptr); 36 | ~DialogNFDWidgetAdvanced(); 37 | 38 | void setGlobal(XShortcuts *pShortcuts, XOptions *pXOptions); 39 | 40 | virtual void adjustView(); 41 | 42 | void setData(const QString &sFileName, const XScanEngine::SCAN_OPTIONS &scanOptions, bool bScan); 43 | 44 | private slots: 45 | void on_pushButtonClose_clicked(); 46 | 47 | protected: 48 | virtual void registerShortcuts(bool bState); 49 | 50 | private: 51 | Ui::DialogNFDWidgetAdvanced *ui; 52 | }; 53 | 54 | #endif // DIALOGNFDWIDGETADVANCED_H 55 | -------------------------------------------------------------------------------- /dialognfdwidgetadvanced.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-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 "dialognfdwidgetadvanced.h" 22 | #include "ui_dialognfdwidgetadvanced.h" 23 | 24 | DialogNFDWidgetAdvanced::DialogNFDWidgetAdvanced(QWidget *pParent) : XShortcutsDialog(pParent, true), ui(new Ui::DialogNFDWidgetAdvanced) 25 | { 26 | ui->setupUi(this); 27 | } 28 | 29 | DialogNFDWidgetAdvanced::~DialogNFDWidgetAdvanced() 30 | { 31 | delete ui; 32 | } 33 | 34 | void DialogNFDWidgetAdvanced::setGlobal(XShortcuts *pShortcuts, XOptions *pXOptions) 35 | { 36 | XShortcutsDialog::setGlobal(pShortcuts, pXOptions); 37 | ui->widgetScan->setGlobal(pShortcuts, pXOptions); 38 | } 39 | 40 | void DialogNFDWidgetAdvanced::adjustView() 41 | { 42 | getGlobalOptions()->adjustWidget(this, XOptions::ID_VIEW_FONT_CONTROLS); 43 | ui->widgetScan->adjustView(); 44 | } 45 | 46 | void DialogNFDWidgetAdvanced::setData(const QString &sFileName, const XScanEngine::SCAN_OPTIONS &scanOptions, bool bScan) 47 | { 48 | ui->widgetScan->setData(sFileName, scanOptions, bScan); 49 | } 50 | 51 | void DialogNFDWidgetAdvanced::on_pushButtonClose_clicked() 52 | { 53 | this->close(); 54 | } 55 | 56 | void DialogNFDWidgetAdvanced::registerShortcuts(bool bState) 57 | { 58 | Q_UNUSED(bState) 59 | } 60 | -------------------------------------------------------------------------------- /nfdwidgetadvanced.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020-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 | #ifndef NFDWIDGETADVANCED_H 22 | #define NFDWIDGETADVANCED_H 23 | 24 | #include "specabstract.h" 25 | #include "xdialogprocess.h" 26 | #include "xshortcutswidget.h" 27 | #include "scanitemmodel.h" 28 | 29 | namespace Ui { 30 | class NFDWidgetAdvanced; 31 | } 32 | 33 | class NFDWidgetAdvanced : public XShortcutsWidget { 34 | Q_OBJECT 35 | 36 | public: 37 | explicit NFDWidgetAdvanced(QWidget *pParent = nullptr); 38 | ~NFDWidgetAdvanced(); 39 | 40 | void setData(QIODevice *pDevice, bool bScan, XBinary::FT fileType); 41 | void setData(const QString &sFileName, const XScanEngine::SCAN_OPTIONS &scanOptions, bool bScan); 42 | // TODO Memory scan 43 | 44 | virtual void adjustView(); 45 | void setGlobal(XShortcuts *pShortcuts, XOptions *pXOptions); 46 | void reloadData(bool bSaveSelection); 47 | 48 | private slots: 49 | void on_toolButtonScan_clicked(); 50 | void on_toolButtonSave_clicked(); 51 | void on_comboBoxType_currentIndexChanged(int nIndex); 52 | void process(); 53 | void on_tableViewHeur_customContextMenuRequested(const QPoint &pos); 54 | 55 | protected: 56 | virtual void registerShortcuts(bool bState); 57 | 58 | private: 59 | Ui::NFDWidgetAdvanced *ui; 60 | QIODevice *m_pDevice; 61 | QString m_sFileName; 62 | XBinary::FT m_fileType; 63 | }; 64 | 65 | #endif // NFDWIDGETADVANCED_H 66 | -------------------------------------------------------------------------------- /dialognfdscandirectory.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2018-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 | #ifndef DIALOGNFDSCANDIRECTORY_H 22 | #define DIALOGNFDSCANDIRECTORY_H 23 | 24 | #include 25 | #include 26 | 27 | #include "specabstract.h" 28 | #include "xdialogprocess.h" 29 | #include "xoptions.h" 30 | #include "xshortcutsdialog.h" 31 | #include "dialogtextinfo.h" 32 | #include "scanitemmodel.h" 33 | 34 | namespace Ui { 35 | class DialogNFDScanDirectory; 36 | } 37 | 38 | class DialogNFDScanDirectory : public XShortcutsDialog { 39 | Q_OBJECT 40 | 41 | public: 42 | explicit DialogNFDScanDirectory(QWidget *pParent, const QString &sDirName); 43 | ~DialogNFDScanDirectory(); 44 | 45 | virtual void adjustView(); 46 | 47 | private slots: 48 | void on_pushButtonOpenDirectory_clicked(); 49 | void on_pushButtonScan_clicked(); 50 | void scanDirectory(const QString &sDirectoryName); 51 | void scanResult(const XScanEngine::SCAN_RESULT &scanResult); 52 | void appendResult(const QString &sResult); 53 | void on_pushButtonOK_clicked(); 54 | void on_pushButtonClear_clicked(); 55 | void on_pushButtonSave_clicked(); 56 | 57 | signals: 58 | void resultSignal(const QString &sText); 59 | 60 | protected: 61 | virtual void registerShortcuts(bool bState); 62 | 63 | private: 64 | Ui::DialogNFDScanDirectory *ui; 65 | XScanEngine::SCAN_OPTIONS m_scanOptions; 66 | }; 67 | 68 | #endif // DIALOGNFDSCANDIRECTORY_H 69 | -------------------------------------------------------------------------------- /nfd_widget.cmake: -------------------------------------------------------------------------------- 1 | include_directories(${CMAKE_CURRENT_LIST_DIR}) 2 | 3 | if (NOT DEFINED XDIALOGPROCESS_SOURCES) 4 | include(${CMAKE_CURRENT_LIST_DIR}/../FormatDialogs/xdialogprocess.cmake) 5 | set(NFD_WIDGET_SOURCES ${NFD_WIDGET_SOURCES} ${XDIALOGPROCESS_SOURCES}) 6 | endif() 7 | if (NOT DEFINED DIALOGTEXTINFO_SOURCES) 8 | include(${CMAKE_CURRENT_LIST_DIR}/../FormatDialogs/dialogtextinfo.cmake) 9 | set(NFD_WIDGET_SOURCES ${NFD_WIDGET_SOURCES} ${DIALOGTEXTINFO_SOURCES}) 10 | endif() 11 | if (NOT DEFINED XDIALOGPROCESS_SOURCES) 12 | include(${CMAKE_CURRENT_LIST_DIR}/../FormatDialogs/xdialogprocess.cmake) 13 | set(NFD_WIDGET_SOURCES ${NFD_WIDGET_SOURCES} ${XDIALOGPROCESS_SOURCES}) 14 | endif() 15 | if (NOT DEFINED XSHORTCUTS_SOURCES) 16 | include(${CMAKE_CURRENT_LIST_DIR}/../XShortcuts/xshortcuts.cmake) 17 | set(NFD_WIDGET_SOURCES ${NFD_WIDGET_SOURCES} ${XSHORTCUTS_SOURCES}) 18 | endif() 19 | if (NOT DEFINED SPECABSTRACT_SOURCES) 20 | include(${CMAKE_CURRENT_LIST_DIR}/../SpecAbstract/specabstract.cmake) 21 | set(NFD_WIDGET_SOURCES ${NFD_WIDGET_SOURCES} ${SPECABSTRACT_SOURCES}) 22 | endif() 23 | if (NOT DEFINED XCOMBOBOXEX_SOURCES) 24 | include(${CMAKE_CURRENT_LIST_DIR}/../Controls/xcomboboxex.cmake) 25 | set(NFD_WIDGET_SOURCES ${NFD_WIDGET_SOURCES} ${XCOMBOBOXEX_SOURCES}) 26 | endif() 27 | if (NOT DEFINED XTABLEVIEW_SOURCES) 28 | include(${CMAKE_CURRENT_LIST_DIR}/../Controls/xtableview.cmake) 29 | set(NFD_WIDGET_SOURCES ${NFD_WIDGET_SOURCES} ${XTABLEVIEW_SOURCES}) 30 | endif() 31 | 32 | set(NFD_WIDGET_SOURCES 33 | ${NFD_WIDGET_SOURCES} 34 | ${CMAKE_CURRENT_LIST_DIR}/dialognfdscan.cpp 35 | ${CMAKE_CURRENT_LIST_DIR}/dialognfdscan.h 36 | ${CMAKE_CURRENT_LIST_DIR}/dialognfdscan.ui 37 | ${CMAKE_CURRENT_LIST_DIR}/dialognfdscandirectory.cpp 38 | ${CMAKE_CURRENT_LIST_DIR}/dialognfdscandirectory.h 39 | ${CMAKE_CURRENT_LIST_DIR}/dialognfdscandirectory.ui 40 | ${CMAKE_CURRENT_LIST_DIR}/dialognfdwidgetadvanced.cpp 41 | ${CMAKE_CURRENT_LIST_DIR}/dialognfdwidgetadvanced.h 42 | ${CMAKE_CURRENT_LIST_DIR}/dialognfdwidgetadvanced.ui 43 | ${CMAKE_CURRENT_LIST_DIR}/nfd_widget.cpp 44 | ${CMAKE_CURRENT_LIST_DIR}/nfd_widget.h 45 | ${CMAKE_CURRENT_LIST_DIR}/nfd_widget.ui 46 | ${CMAKE_CURRENT_LIST_DIR}/nfdoptionswidget.cpp 47 | ${CMAKE_CURRENT_LIST_DIR}/nfdoptionswidget.h 48 | ${CMAKE_CURRENT_LIST_DIR}/nfdoptionswidget.ui 49 | ${CMAKE_CURRENT_LIST_DIR}/nfdwidgetadvanced.cpp 50 | ${CMAKE_CURRENT_LIST_DIR}/nfdwidgetadvanced.h 51 | ${CMAKE_CURRENT_LIST_DIR}/nfdwidgetadvanced.ui 52 | ) 53 | -------------------------------------------------------------------------------- /nfd_widget.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020-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 | #ifndef NFD_WIDGET_H 22 | #define NFD_WIDGET_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | #include "dialognfdscandirectory.h" 29 | #include "dialogtextinfo.h" 30 | #include "scanitemmodel.h" 31 | #include "xshortcutswidget.h" 32 | #include "dialognfdwidgetadvanced.h" 33 | 34 | namespace Ui { 35 | class NFD_Widget; 36 | } 37 | 38 | class NFD_Widget : public XShortcutsWidget { 39 | Q_OBJECT 40 | 41 | public: 42 | enum ST { 43 | ST_UNKNOWN = 0, 44 | ST_FILE 45 | }; 46 | 47 | // struct OPTIONS 48 | // { 49 | // bool bRecursiveScan; 50 | // bool bDeepScan; 51 | // bool bHeuristicScan; 52 | // bool bAllTypesScan; 53 | // }; 54 | 55 | enum COLUMN { 56 | COLUMN_TYPE = 0, 57 | COLUMN_STRING, 58 | COLUMN_SIGNATURE, 59 | COLUMN_INFO 60 | }; 61 | 62 | explicit NFD_Widget(QWidget *pParent = nullptr); 63 | ~NFD_Widget(); 64 | 65 | void setData(const QString &sFileName, bool bScan = false, XBinary::FT fileType = XBinary::FT_UNKNOWN); 66 | void setGlobal(XShortcuts *pShortcuts, XOptions *pXOptions); 67 | virtual void adjustView(); 68 | virtual void reloadData(bool bSaveSelection); 69 | 70 | private slots: 71 | void clear(); 72 | void process(); 73 | void scan(); 74 | void stop(); 75 | void on_scanFinished(); 76 | void on_pushButtonNfdExtraInformation_clicked(); 77 | void enableControls(bool bState); 78 | void on_pushButtonNfdDirectoryScan_clicked(); 79 | void on_pushButtonNfdInfo_clicked(); 80 | void on_pushButtonNfdScanStart_clicked(); 81 | void on_pushButtonNfdScanStop_clicked(); 82 | void timerSlot(); 83 | 84 | protected: 85 | virtual void registerShortcuts(bool bState); 86 | 87 | signals: 88 | void scanStarted(); 89 | void scanFinished(); 90 | void currentFileType(qint32 nFT); 91 | void showInfo(); 92 | 93 | private: 94 | Ui::NFD_Widget *ui; 95 | ST m_scanType; 96 | SpecAbstract m_pSpecAbstract; 97 | XScanEngine::SCAN_OPTIONS m_scanOptions; 98 | XScanEngine::SCAN_RESULT m_scanResult; 99 | QFutureWatcher m_watcher; 100 | QString m_sFileName; 101 | XBinary::FT m_fileType; 102 | XBinary::PDSTRUCT m_pdStruct; 103 | QTimer *m_pTimer; 104 | bool m_bProcess; 105 | }; 106 | 107 | #endif // NFD_WIDGET_H 108 | -------------------------------------------------------------------------------- /nfdoptionswidget.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017-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 "nfdoptionswidget.h" 22 | 23 | #include "ui_nfdoptionswidget.h" 24 | 25 | NFDOptionsWidget::NFDOptionsWidget(QWidget *pParent) : XShortcutsWidget(pParent), ui(new Ui::NFDOptionsWidget) 26 | { 27 | ui->setupUi(this); 28 | 29 | m_pOptions = nullptr; 30 | 31 | setProperty("GROUPID", XOptions::GROUPID_SCAN); 32 | } 33 | 34 | NFDOptionsWidget::~NFDOptionsWidget() 35 | { 36 | delete ui; 37 | } 38 | 39 | void NFDOptionsWidget::adjustView() 40 | { 41 | // TODO 42 | } 43 | 44 | void NFDOptionsWidget::setOptions(XOptions *pOptions) 45 | { 46 | m_pOptions = pOptions; 47 | 48 | reload(); 49 | } 50 | 51 | void NFDOptionsWidget::save() 52 | { 53 | m_pOptions->setCheckBox(ui->checkBoxScanAfterOpen, XOptions::ID_SCAN_SCANAFTEROPEN); 54 | m_pOptions->setCheckBox(ui->checkBoxRecursiveScan, XOptions::ID_SCAN_FLAG_RECURSIVE); 55 | m_pOptions->setCheckBox(ui->checkBoxDeepScan, XOptions::ID_SCAN_FLAG_DEEP); 56 | m_pOptions->setCheckBox(ui->checkBoxHeuristicScan, XOptions::ID_SCAN_FLAG_HEURISTIC); 57 | m_pOptions->setCheckBox(ui->checkBoxVerbose, XOptions::ID_SCAN_FLAG_VERBOSE); 58 | m_pOptions->setCheckBox(ui->checkBoxAllTypesScan, XOptions::ID_SCAN_FLAG_ALLTYPES); 59 | m_pOptions->setCheckBox(ui->checkBoxFormatResult, XOptions::ID_SCAN_FORMATRESULT); 60 | m_pOptions->setCheckBox(ui->checkBoxHighlight, XOptions::ID_SCAN_HIGHLIGHT); 61 | m_pOptions->setComboBox(ui->comboBoxBufferSize, XOptions::ID_ENGINE_BUFFERSIZE); 62 | } 63 | 64 | void NFDOptionsWidget::setDefaultValues(XOptions *pOptions) 65 | { 66 | pOptions->addID(XOptions::ID_SCAN_SCANAFTEROPEN, true); 67 | pOptions->addID(XOptions::ID_SCAN_FLAG_RECURSIVE, true); 68 | pOptions->addID(XOptions::ID_SCAN_FLAG_DEEP, true); 69 | pOptions->addID(XOptions::ID_SCAN_FLAG_HEURISTIC, false); 70 | pOptions->addID(XOptions::ID_SCAN_FLAG_VERBOSE, false); 71 | pOptions->addID(XOptions::ID_SCAN_FLAG_ALLTYPES, false); 72 | pOptions->addID(XOptions::ID_SCAN_FORMATRESULT, true); 73 | pOptions->addID(XOptions::ID_SCAN_HIGHLIGHT, true); 74 | pOptions->addID(XOptions::ID_SCAN_SORT, true); 75 | pOptions->addID(XOptions::ID_ENGINE_BUFFERSIZE, 2 * 1024 * 1024); 76 | } 77 | 78 | void NFDOptionsWidget::reload() 79 | { 80 | m_pOptions->setCheckBox(ui->checkBoxScanAfterOpen, XOptions::ID_SCAN_SCANAFTEROPEN); 81 | m_pOptions->setCheckBox(ui->checkBoxRecursiveScan, XOptions::ID_SCAN_FLAG_RECURSIVE); 82 | m_pOptions->setCheckBox(ui->checkBoxDeepScan, XOptions::ID_SCAN_FLAG_DEEP); 83 | m_pOptions->setCheckBox(ui->checkBoxHeuristicScan, XOptions::ID_SCAN_FLAG_HEURISTIC); 84 | m_pOptions->setCheckBox(ui->checkBoxVerbose, XOptions::ID_SCAN_FLAG_VERBOSE); 85 | m_pOptions->setCheckBox(ui->checkBoxAllTypesScan, XOptions::ID_SCAN_FLAG_ALLTYPES); 86 | m_pOptions->setCheckBox(ui->checkBoxFormatResult, XOptions::ID_SCAN_FORMATRESULT); 87 | m_pOptions->setCheckBox(ui->checkBoxHighlight, XOptions::ID_SCAN_HIGHLIGHT); 88 | m_pOptions->setComboBox(ui->comboBoxBufferSize, XOptions::ID_ENGINE_BUFFERSIZE); 89 | } 90 | 91 | void NFDOptionsWidget::registerShortcuts(bool bState) 92 | { 93 | Q_UNUSED(bState) 94 | } 95 | -------------------------------------------------------------------------------- /nfdwidgetadvanced.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | NFDWidgetAdvanced 4 | 5 | 6 | 7 | 0 8 | 0 9 | 858 10 | 479 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 0 19 | 20 | 21 | 0 22 | 23 | 24 | 0 25 | 26 | 27 | 0 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 120 36 | 0 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 150 46 | 0 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | Qt::Orientation::Horizontal 55 | 56 | 57 | 58 | 40 59 | 20 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 0 69 | 0 70 | 71 | 72 | 73 | Save 74 | 75 | 76 | Qt::ToolButtonStyle::ToolButtonTextBesideIcon 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 0 85 | 0 86 | 87 | 88 | 89 | Scan 90 | 91 | 92 | Qt::ToolButtonStyle::ToolButtonTextBesideIcon 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | false 102 | 103 | 104 | 105 | 106 | 107 | 108 | Heuristic 109 | 110 | 111 | 112 | 0 113 | 114 | 115 | 0 116 | 117 | 118 | 0 119 | 120 | 121 | 0 122 | 123 | 124 | 125 | 126 | Qt::ContextMenuPolicy::CustomContextMenu 127 | 128 | 129 | QAbstractItemView::EditTrigger::NoEditTriggers 130 | 131 | 132 | QAbstractItemView::SelectionMode::SingleSelection 133 | 134 | 135 | QAbstractItemView::SelectionBehavior::SelectRows 136 | 137 | 138 | false 139 | 140 | 141 | 20 142 | 143 | 144 | 20 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | XTableView 156 | QTableView 157 |
xtableview.h
158 |
159 | 160 | XComboBoxEx 161 | QComboBox 162 |
xcomboboxex.h
163 |
164 |
165 | 166 | 167 |
168 | -------------------------------------------------------------------------------- /dialognfdscandirectory.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | DialogNFDScanDirectory 4 | 5 | 6 | Qt::ApplicationModal 7 | 8 | 9 | 10 | 0 11 | 0 12 | 785 13 | 478 14 | 15 | 16 | 17 | Directory scan 18 | 19 | 20 | true 21 | 22 | 23 | 24 | 25 | 26 | Directory 27 | 28 | 29 | Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter 30 | 31 | 32 | 33 | 2 34 | 35 | 36 | 2 37 | 38 | 39 | 2 40 | 41 | 42 | 2 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | Subdirectories 55 | 56 | 57 | true 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 150 66 | 0 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | Qt::Horizontal 75 | 76 | 77 | 78 | 158 79 | 20 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | true 95 | 96 | 97 | 98 | ... 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | true 107 | 108 | 109 | 110 | Scan 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | false 123 | 124 | 125 | true 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | Clear 135 | 136 | 137 | 138 | 139 | 140 | 141 | Save 142 | 143 | 144 | 145 | 146 | 147 | 148 | Qt::Horizontal 149 | 150 | 151 | 152 | 40 153 | 20 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | OK 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | XComboBoxEx 172 | QComboBox 173 |
xcomboboxex.h
174 |
175 |
176 | 177 | 178 |
179 | -------------------------------------------------------------------------------- /nfdoptionswidget.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | NFDOptionsWidget 4 | 5 | 6 | 7 | 0 8 | 0 9 | 565 10 | 518 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 0 19 | 20 | 21 | 0 22 | 23 | 24 | 0 25 | 26 | 27 | 0 28 | 29 | 30 | 31 | 32 | QFrame::Shape::NoFrame 33 | 34 | 35 | QFrame::Shadow::Plain 36 | 37 | 38 | true 39 | 40 | 41 | 42 | 43 | 0 44 | 0 45 | 565 46 | 518 47 | 48 | 49 | 50 | 51 | 0 52 | 53 | 54 | 0 55 | 56 | 57 | 0 58 | 59 | 60 | 0 61 | 62 | 63 | 64 | 65 | Scan after open 66 | 67 | 68 | 69 | 70 | 71 | 72 | Recursive scan 73 | 74 | 75 | 76 | 77 | 78 | 79 | Deep scan 80 | 81 | 82 | 83 | 84 | 85 | 86 | Heuristic scan 87 | 88 | 89 | 90 | 91 | 92 | 93 | Verbose 94 | 95 | 96 | 97 | 98 | 99 | 100 | All types 101 | 102 | 103 | 104 | 105 | 106 | 107 | Format result 108 | 109 | 110 | 111 | 112 | 113 | 114 | Highlight 115 | 116 | 117 | 118 | 119 | 120 | 121 | Buffer size 122 | 123 | 124 | Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignVCenter 125 | 126 | 127 | 128 | 2 129 | 130 | 131 | 2 132 | 133 | 134 | 2 135 | 136 | 137 | 2 138 | 139 | 140 | 141 | 142 | 143 | 200 144 | 0 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | Qt::Orientation::Vertical 156 | 157 | 158 | 159 | 0 160 | 0 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | -------------------------------------------------------------------------------- /dialognfdscandirectory.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2018-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 "dialognfdscandirectory.h" 22 | 23 | #include "ui_dialognfdscandirectory.h" 24 | 25 | DialogNFDScanDirectory::DialogNFDScanDirectory(QWidget *pParent, const QString &sDirName) : XShortcutsDialog(pParent, true), ui(new Ui::DialogNFDScanDirectory) 26 | { 27 | ui->setupUi(this); 28 | 29 | connect(this, SIGNAL(resultSignal(QString)), this, SLOT(appendResult(QString))); 30 | 31 | ui->checkBoxScanSubdirectories->setChecked(true); 32 | 33 | if (sDirName != "") { 34 | ui->lineEditDirectoryName->setText(sDirName); 35 | } 36 | 37 | m_scanOptions = {}; 38 | 39 | ui->comboBoxFlags->setData(XScanEngine::getScanFlags(), XComboBoxEx::CBTYPE_FLAGS, 0, tr("Flags")); 40 | } 41 | 42 | DialogNFDScanDirectory::~DialogNFDScanDirectory() 43 | { 44 | delete ui; 45 | } 46 | 47 | void DialogNFDScanDirectory::adjustView() 48 | { 49 | quint64 nFlags = XScanEngine::getScanFlagsFromGlobalOptions(getGlobalOptions()); 50 | ui->comboBoxFlags->setValue(nFlags); 51 | } 52 | 53 | void DialogNFDScanDirectory::on_pushButtonOpenDirectory_clicked() 54 | { 55 | QString sInitDirectory = ui->lineEditDirectoryName->text(); 56 | 57 | QString sDirectoryName = QFileDialog::getExistingDirectory(this, tr("Open directory") + QString("..."), sInitDirectory, QFileDialog::ShowDirsOnly); 58 | 59 | if (!sDirectoryName.isEmpty()) { 60 | ui->lineEditDirectoryName->setText(QDir().toNativeSeparators(sDirectoryName)); 61 | } 62 | } 63 | 64 | void DialogNFDScanDirectory::on_pushButtonScan_clicked() 65 | { 66 | QString sDirectoryName = ui->lineEditDirectoryName->text().trimmed(); 67 | 68 | scanDirectory(sDirectoryName); 69 | 70 | getGlobalOptions()->setLastDirectory(sDirectoryName); 71 | } 72 | 73 | void DialogNFDScanDirectory::scanDirectory(const QString &sDirectoryName) 74 | { 75 | if (sDirectoryName != "") { 76 | ui->textBrowserResult->clear(); 77 | 78 | m_scanOptions.bShowType = true; 79 | m_scanOptions.bShowVersion = true; 80 | m_scanOptions.bShowInfo = true; 81 | m_scanOptions.bSubdirectories = ui->checkBoxScanSubdirectories->isChecked(); 82 | m_scanOptions.nBufferSize = getGlobalOptions()->getValue(XOptions::ID_ENGINE_BUFFERSIZE).toULongLong(); 83 | 84 | quint64 nFlags = ui->comboBoxFlags->getValue().toULongLong(); 85 | XScanEngine::setScanFlags(&m_scanOptions, nFlags); 86 | 87 | XScanEngine::setScanFlagsToGlobalOptions(getGlobalOptions(), nFlags); 88 | // TODO Filter options 89 | // |flags|x all| 90 | 91 | SpecAbstract specAbstract; 92 | connect(&specAbstract, SIGNAL(scanResult(const XScanEngine::SCAN_RESULT &)), this, SLOT(scanResult(const XScanEngine::SCAN_RESULT &)), Qt::DirectConnection); 93 | 94 | XDialogProcess ds(this, &specAbstract); 95 | ds.setGlobal(getShortcuts(), getGlobalOptions()); 96 | specAbstract.setData(sDirectoryName, &m_scanOptions, ds.getPdStruct()); 97 | ds.start(); 98 | ds.showDialogDelay(); 99 | } 100 | } 101 | 102 | void DialogNFDScanDirectory::scanResult(const XScanEngine::SCAN_RESULT &scanResult) 103 | { 104 | QString sResult = QString("%1 %2 %3").arg(QDir().toNativeSeparators(scanResult.sFileName), QString::number(scanResult.nScanTime), tr("msec")); 105 | sResult += "\r\n"; // TODO Linux 106 | 107 | ScanItemModel model(&m_scanOptions, &(scanResult.listRecords), 1); 108 | 109 | QString sScanResult = model.toString(XBinary::FORMATTYPE_PLAINTEXT).toUtf8().data(); 110 | 111 | sResult += sScanResult; 112 | 113 | emit resultSignal(sResult); 114 | } 115 | 116 | void DialogNFDScanDirectory::appendResult(const QString &sResult) 117 | { 118 | ui->textBrowserResult->append(sResult); 119 | } 120 | 121 | void DialogNFDScanDirectory::on_pushButtonOK_clicked() 122 | { 123 | this->close(); 124 | } 125 | 126 | void DialogNFDScanDirectory::on_pushButtonClear_clicked() 127 | { 128 | ui->textBrowserResult->clear(); 129 | } 130 | 131 | void DialogNFDScanDirectory::on_pushButtonSave_clicked() 132 | { 133 | QString sFilter = QString("%1 (*.txt)").arg(tr("Text documents")); 134 | QString sSaveFileName = ui->lineEditDirectoryName->text() + QDir::separator() + "result"; 135 | QString sFileName = QFileDialog::getSaveFileName(this, tr("Save result"), sSaveFileName, sFilter); 136 | 137 | if (!sFileName.isEmpty()) { 138 | QFile file; 139 | file.setFileName(sFileName); 140 | 141 | if (file.open(QIODevice::ReadWrite)) { 142 | QString sText = ui->textBrowserResult->toPlainText(); 143 | file.write(sText.toUtf8().data()); 144 | file.close(); 145 | } 146 | } 147 | } 148 | 149 | void DialogNFDScanDirectory::registerShortcuts(bool bState) 150 | { 151 | Q_UNUSED(bState) 152 | } 153 | -------------------------------------------------------------------------------- /nfdwidgetadvanced.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020-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 "nfdwidgetadvanced.h" 22 | 23 | #include "ui_nfdwidgetadvanced.h" 24 | 25 | NFDWidgetAdvanced::NFDWidgetAdvanced(QWidget *pParent) : XShortcutsWidget(pParent), ui(new Ui::NFDWidgetAdvanced) 26 | { 27 | ui->setupUi(this); 28 | 29 | XOptions::adjustToolButton(ui->toolButtonScan, XOptions::ICONTYPE_SCAN); 30 | XOptions::adjustToolButton(ui->toolButtonSave, XOptions::ICONTYPE_SAVE); 31 | 32 | ui->comboBoxType->setToolTip(tr("Type")); 33 | ui->comboBoxFlags->setToolTip(tr("Flags")); 34 | ui->treeViewScan->setToolTip(tr("Scan")); 35 | ui->tableViewHeur->setToolTip(tr("Heuristics")); 36 | ui->toolButtonSave->setToolTip(tr("Save")); 37 | ui->toolButtonScan->setToolTip(tr("Scan")); 38 | 39 | this->m_pDevice = nullptr; 40 | this->m_fileType = XBinary::FT_UNKNOWN; 41 | 42 | ui->comboBoxFlags->setData(XScanEngine::getScanFlags(), XComboBoxEx::CBTYPE_FLAGS, 0, tr("Flags")); 43 | } 44 | 45 | NFDWidgetAdvanced::~NFDWidgetAdvanced() 46 | { 47 | delete ui; 48 | } 49 | 50 | void NFDWidgetAdvanced::setData(QIODevice *pDevice, bool bScan, XBinary::FT fileType) 51 | { 52 | this->m_pDevice = pDevice; 53 | this->m_fileType = fileType; 54 | 55 | XFormats::setFileTypeComboBox(fileType, pDevice, ui->comboBoxType, XBinary::TL_OPTION_ALL); 56 | 57 | if (bScan) { 58 | process(); 59 | } 60 | } 61 | 62 | void NFDWidgetAdvanced::setData(const QString &sFileName, const XScanEngine::SCAN_OPTIONS &scanOptions, bool bScan) 63 | { 64 | this->m_sFileName = sFileName; 65 | this->m_fileType = scanOptions.fileType; 66 | 67 | XFormats::setFileTypeComboBox(scanOptions.fileType, sFileName, ui->comboBoxType, XBinary::TL_OPTION_ALL); 68 | 69 | if (bScan) { 70 | process(); 71 | } 72 | } 73 | 74 | void NFDWidgetAdvanced::adjustView() 75 | { 76 | getGlobalOptions()->adjustWidget(this, XOptions::ID_VIEW_FONT_CONTROLS); 77 | getGlobalOptions()->adjustTreeView(ui->treeViewScan, XOptions::ID_VIEW_FONT_TREEVIEWS); 78 | getGlobalOptions()->adjustTableView(ui->tableViewHeur, XOptions::ID_VIEW_FONT_TABLEVIEWS); 79 | ui->tableViewHeur->adjust(); 80 | 81 | quint64 nFlags = XScanEngine::getScanFlagsFromGlobalOptions(getGlobalOptions()); 82 | ui->comboBoxFlags->setValue(nFlags); 83 | } 84 | 85 | void NFDWidgetAdvanced::setGlobal(XShortcuts *pShortcuts, XOptions *pXOptions) 86 | { 87 | XShortcutsWidget::setGlobal(pShortcuts, pXOptions); 88 | } 89 | 90 | void NFDWidgetAdvanced::reloadData(bool bSaveSelection) 91 | { 92 | Q_UNUSED(bSaveSelection) 93 | 94 | process(); 95 | } 96 | 97 | void NFDWidgetAdvanced::on_toolButtonScan_clicked() 98 | { 99 | process(); 100 | } 101 | 102 | void NFDWidgetAdvanced::registerShortcuts(bool bState) 103 | { 104 | Q_UNUSED(bState) 105 | } 106 | 107 | void NFDWidgetAdvanced::on_toolButtonSave_clicked() 108 | { 109 | QString sSaveFileName = XBinary::getResultFileName(m_pDevice, QString("%1.txt").arg(QString("NFD"))); 110 | 111 | QString _sFileName = QFileDialog::getSaveFileName(this, tr("Save"), sSaveFileName, QString("%1 (*.txt);;%2 (*)").arg(tr("Text files"), tr("All files"))); 112 | 113 | if (!_sFileName.isEmpty()) { 114 | if (!XOptions::saveTreeView(ui->treeViewScan, sSaveFileName)) { 115 | QMessageBox::critical(XOptions::getMainWidget(this), tr("Error"), QString("%1: %2").arg(tr("Cannot save file"), _sFileName)); 116 | } 117 | } 118 | } 119 | 120 | void NFDWidgetAdvanced::on_comboBoxType_currentIndexChanged(int nIndex) 121 | { 122 | Q_UNUSED(nIndex) 123 | 124 | process(); 125 | } 126 | 127 | void NFDWidgetAdvanced::process() 128 | { 129 | XScanEngine::SCAN_RESULT scanResult = {}; 130 | XScanEngine::SCAN_OPTIONS scanOptions = {}; 131 | 132 | scanOptions.bShowType = true; 133 | scanOptions.bShowVersion = true; 134 | scanOptions.bShowInfo = true; 135 | scanOptions.bShowInternalDetects = true; 136 | scanOptions.fileType = (XBinary::FT)(ui->comboBoxType->currentData().toInt()); 137 | scanOptions.nBufferSize = getGlobalOptions()->getValue(XOptions::ID_ENGINE_BUFFERSIZE).toULongLong(); 138 | scanOptions.bIsHighlight = getGlobalOptions()->getValue(XOptions::ID_SCAN_HIGHLIGHT).toBool(); 139 | scanOptions.bHideUnknown = getGlobalOptions()->getValue(XOptions::ID_SCAN_HIDEUNKNOWN).toBool(); 140 | scanOptions.bIsSort = getGlobalOptions()->getValue(XOptions::ID_SCAN_SORT).toBool(); 141 | 142 | quint64 nFlags = ui->comboBoxFlags->getValue().toULongLong(); 143 | XScanEngine::setScanFlags(&scanOptions, nFlags); 144 | 145 | SpecAbstract specAbstract; 146 | XDialogProcess ds(this, &specAbstract); 147 | ds.setGlobal(getShortcuts(), getGlobalOptions()); 148 | 149 | if (m_pDevice) { 150 | specAbstract.setData(m_pDevice, &scanOptions, &scanResult, ds.getPdStruct()); 151 | } else { 152 | specAbstract.setData(m_sFileName, &scanOptions, &scanResult, ds.getPdStruct()); 153 | } 154 | 155 | ds.start(); 156 | ds.showDialogDelay(); 157 | 158 | QAbstractItemModel *pOldTreeModel = ui->treeViewScan->model(); 159 | 160 | ScanItemModel *pModel = new ScanItemModel(&scanOptions, &(scanResult.listRecords), 1); 161 | ui->treeViewScan->setModel(pModel); 162 | ui->treeViewScan->expandAll(); 163 | 164 | deleteOldAbstractModel(&pOldTreeModel); 165 | 166 | qint32 nNumberOfHeurs = scanResult.listDebugRecords.count(); 167 | 168 | QStandardItemModel *pHeurModel = new QStandardItemModel(nNumberOfHeurs, 3, this); 169 | 170 | pHeurModel->setHeaderData(0, Qt::Horizontal, tr("Type")); 171 | pHeurModel->setHeaderData(1, Qt::Horizontal, tr("Name")); 172 | pHeurModel->setHeaderData(2, Qt::Horizontal, tr("Value")); 173 | 174 | for (qint32 i = 0; i < nNumberOfHeurs; i++) { 175 | QStandardItem *pItemHeurType = new QStandardItem; 176 | pItemHeurType->setText(scanResult.listDebugRecords.at(i).sType); 177 | pHeurModel->setItem(i, 0, pItemHeurType); 178 | 179 | QStandardItem *pItemName = new QStandardItem; 180 | pItemName->setText(scanResult.listDebugRecords.at(i).sName); 181 | pHeurModel->setItem(i, 1, pItemName); 182 | 183 | QStandardItem *pItemValue = new QStandardItem; 184 | pItemValue->setText(scanResult.listDebugRecords.at(i).sValue); 185 | pHeurModel->setItem(i, 2, pItemValue); 186 | } 187 | 188 | ui->tableViewHeur->setCustomModel(pHeurModel, true); 189 | 190 | ui->tableViewHeur->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Interactive); 191 | ui->tableViewHeur->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Interactive); 192 | ui->tableViewHeur->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Stretch); 193 | } 194 | 195 | void NFDWidgetAdvanced::on_tableViewHeur_customContextMenuRequested(const QPoint &pos) 196 | { 197 | QMenu contextMenu(this); // TODO 198 | QMenu menuCopy(this); 199 | 200 | getShortcuts()->adjustRowCopyMenu(&contextMenu, &menuCopy, ui->tableViewHeur); 201 | 202 | contextMenu.exec(ui->tableViewHeur->viewport()->mapToGlobal(pos)); 203 | } 204 | -------------------------------------------------------------------------------- /nfd_widget.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2020-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 "nfd_widget.h" 22 | 23 | #include "ui_nfd_widget.h" 24 | 25 | NFD_Widget::NFD_Widget(QWidget *pParent) : XShortcutsWidget(pParent), ui(new Ui::NFD_Widget) 26 | { 27 | ui->setupUi(this); 28 | 29 | m_pdStruct = XBinary::createPdStruct(); 30 | 31 | connect(&m_watcher, SIGNAL(finished()), this, SLOT(on_scanFinished())); 32 | 33 | m_pTimer = new QTimer(this); 34 | connect(m_pTimer, SIGNAL(timeout()), this, SLOT(timerSlot())); 35 | 36 | ui->comboBoxFlags->setData(XScanEngine::getScanFlags(), XComboBoxEx::CBTYPE_FLAGS, 0, tr("Flags")); 37 | 38 | clear(); 39 | 40 | ui->lineEditElapsedTime->setText(QString("%1 %2").arg(0).arg(tr("msec"))); // TODO Function 41 | } 42 | 43 | NFD_Widget::~NFD_Widget() 44 | { 45 | if (m_bProcess) { 46 | stop(); 47 | m_watcher.waitForFinished(); 48 | } 49 | 50 | delete ui; 51 | } 52 | 53 | void NFD_Widget::setData(const QString &sFileName, bool bScan, XBinary::FT fileType) 54 | { 55 | clear(); 56 | 57 | this->m_sFileName = sFileName; 58 | this->m_fileType = fileType; 59 | m_scanType = ST_FILE; 60 | 61 | if (bScan) { 62 | process(); 63 | } 64 | } 65 | 66 | void NFD_Widget::setGlobal(XShortcuts *pShortcuts, XOptions *pXOptions) 67 | { 68 | XShortcutsWidget::setGlobal(pShortcuts, pXOptions); 69 | } 70 | 71 | void NFD_Widget::adjustView() 72 | { 73 | quint64 nFlags = XScanEngine::getScanFlagsFromGlobalOptions(getGlobalOptions()); 74 | ui->comboBoxFlags->setValue(nFlags); 75 | } 76 | 77 | void NFD_Widget::reloadData(bool bSaveSelection) 78 | { 79 | Q_UNUSED(bSaveSelection) 80 | process(); 81 | } 82 | 83 | void NFD_Widget::clear() 84 | { 85 | m_scanType = ST_UNKNOWN; 86 | m_bProcess = false; 87 | m_scanOptions = {}; 88 | m_scanResult = {}; 89 | } 90 | 91 | void NFD_Widget::process() 92 | { 93 | if (!m_bProcess) { 94 | m_bProcess = true; 95 | enableControls(false); 96 | 97 | ui->pushButtonNfdScanStart->setText(tr("Stop")); 98 | 99 | m_scanOptions.bShowType = true; 100 | m_scanOptions.bShowVersion = true; 101 | m_scanOptions.bShowInfo = true; 102 | m_scanOptions.fileType = m_fileType; 103 | m_scanOptions.nBufferSize = getGlobalOptions()->getValue(XOptions::ID_ENGINE_BUFFERSIZE).toULongLong(); 104 | m_scanOptions.bIsHighlight = getGlobalOptions()->getValue(XOptions::ID_SCAN_HIGHLIGHT).toBool(); 105 | m_scanOptions.bHideUnknown = getGlobalOptions()->getValue(XOptions::ID_SCAN_HIDEUNKNOWN).toBool(); 106 | m_scanOptions.bIsSort = getGlobalOptions()->getValue(XOptions::ID_SCAN_SORT).toBool(); 107 | // scanOptions.bDebug=true; 108 | 109 | quint64 nFlags = ui->comboBoxFlags->getValue().toULongLong(); 110 | XScanEngine::setScanFlags(&m_scanOptions, nFlags); 111 | 112 | XScanEngine::setScanFlagsToGlobalOptions(getGlobalOptions(), nFlags); 113 | 114 | m_pTimer->start(200); // TODO const 115 | 116 | ui->progressBar0->hide(); 117 | ui->progressBar1->hide(); 118 | ui->progressBar2->hide(); 119 | ui->progressBar3->hide(); 120 | ui->progressBar4->hide(); 121 | 122 | #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) 123 | QFuture future = QtConcurrent::run(&NFD_Widget::scan, this); 124 | #else 125 | QFuture future = QtConcurrent::run(this, &NFD_Widget::scan); 126 | #endif 127 | 128 | m_watcher.setFuture(future); 129 | } else { 130 | ui->pushButtonNfdScanStart->setEnabled(false); 131 | stop(); 132 | m_watcher.waitForFinished(); 133 | ui->pushButtonNfdScanStart->setText(tr("Scan")); 134 | enableControls(true); 135 | } 136 | } 137 | 138 | void NFD_Widget::scan() 139 | { 140 | if (m_scanType != ST_UNKNOWN) { 141 | if (m_scanType == ST_FILE) { 142 | emit scanStarted(); 143 | 144 | m_pdStruct = XBinary::createPdStruct(); 145 | 146 | m_pSpecAbstract.setData(m_sFileName, &m_scanOptions, &m_scanResult, &m_pdStruct); 147 | m_pSpecAbstract.process(); 148 | 149 | if (m_scanResult.ftInit == XBinary::FT_COM) { 150 | emit currentFileType(m_scanResult.ftInit); 151 | } 152 | 153 | emit scanFinished(); 154 | } 155 | } 156 | } 157 | 158 | void NFD_Widget::stop() 159 | { 160 | m_pdStruct.bIsStop = true; 161 | } 162 | 163 | void NFD_Widget::on_scanFinished() 164 | { 165 | enableControls(true); 166 | 167 | m_pTimer->stop(); 168 | 169 | QAbstractItemModel *pOldModel = ui->treeViewResult->model(); 170 | 171 | ScanItemModel *pModel = new ScanItemModel(&m_scanOptions, &(m_scanResult.listRecords), 1); 172 | ui->treeViewResult->setModel(pModel); 173 | ui->treeViewResult->expandAll(); 174 | 175 | deleteOldAbstractModel(&pOldModel); 176 | 177 | ui->lineEditElapsedTime->setText(QString("%1 %2").arg(QString::number(m_scanResult.nScanTime), tr("msec"))); 178 | 179 | m_bProcess = false; 180 | 181 | ui->pushButtonNfdScanStart->setEnabled(true); 182 | ui->pushButtonNfdScanStart->setText(tr("Scan")); 183 | } 184 | 185 | void NFD_Widget::on_pushButtonNfdExtraInformation_clicked() 186 | { 187 | ScanItemModel *pModel = static_cast(ui->treeViewResult->model()); 188 | 189 | if (pModel) { 190 | DialogTextInfo dialogInfo(this); 191 | dialogInfo.setGlobal(getShortcuts(), getGlobalOptions()); 192 | dialogInfo.setText(pModel->toString(XBinary::FORMATTYPE_TEXT)); 193 | 194 | dialogInfo.exec(); 195 | } 196 | } 197 | 198 | void NFD_Widget::enableControls(bool bState) 199 | { 200 | if (!bState) { 201 | QAbstractItemModel *pOldModel = ui->treeViewResult->model(); 202 | ui->treeViewResult->setModel(0); 203 | 204 | deleteOldAbstractModel(&pOldModel); 205 | } 206 | 207 | ui->treeViewResult->setEnabled(bState); 208 | ui->comboBoxFlags->setEnabled(bState); 209 | ui->pushButtonNfdDirectoryScan->setEnabled(bState); 210 | ui->pushButtonNfdExtraInformation->setEnabled(bState); 211 | ui->pushButtonNfdInfo->setEnabled(bState); 212 | ui->lineEditElapsedTime->setEnabled(bState); 213 | 214 | if (bState) { 215 | ui->stackedWidgetNfdScan->setCurrentIndex(0); 216 | } else { 217 | ui->stackedWidgetNfdScan->setCurrentIndex(1); 218 | } 219 | } 220 | 221 | void NFD_Widget::on_pushButtonNfdDirectoryScan_clicked() 222 | { 223 | DialogNFDScanDirectory dds(this, QFileInfo(m_sFileName).absolutePath()); 224 | dds.setGlobal(getShortcuts(), getGlobalOptions()); 225 | dds.exec(); 226 | } 227 | 228 | void NFD_Widget::registerShortcuts(bool bState) 229 | { 230 | Q_UNUSED(bState) 231 | } 232 | 233 | void NFD_Widget::on_pushButtonNfdInfo_clicked() 234 | { 235 | if (!m_scanOptions.bHandleInfo) { 236 | DialogNFDWidgetAdvanced dnwa(this); 237 | dnwa.setGlobal(getShortcuts(), getGlobalOptions()); 238 | dnwa.setData(m_sFileName, m_scanOptions, true); 239 | 240 | dnwa.exec(); 241 | } else { 242 | emit showInfo(); 243 | } 244 | } 245 | 246 | void NFD_Widget::on_pushButtonNfdScanStart_clicked() 247 | { 248 | ui->pushButtonNfdScanStart->setEnabled(false); 249 | process(); 250 | ui->pushButtonNfdScanStart->setEnabled(true); 251 | } 252 | 253 | void NFD_Widget::on_pushButtonNfdScanStop_clicked() 254 | { 255 | ui->pushButtonNfdScanStop->setEnabled(false); 256 | process(); 257 | ui->pushButtonNfdScanStop->setEnabled(true); 258 | } 259 | 260 | void NFD_Widget::timerSlot() 261 | { 262 | XFormats::setProgressBar(ui->progressBar0, m_pdStruct._pdRecord[0]); 263 | XFormats::setProgressBar(ui->progressBar1, m_pdStruct._pdRecord[1]); 264 | XFormats::setProgressBar(ui->progressBar2, m_pdStruct._pdRecord[2]); 265 | XFormats::setProgressBar(ui->progressBar3, m_pdStruct._pdRecord[3]); 266 | XFormats::setProgressBar(ui->progressBar4, m_pdStruct._pdRecord[4]); 267 | } 268 | -------------------------------------------------------------------------------- /nfd_widget.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | NFD_Widget 4 | 5 | 6 | 7 | 0 8 | 0 9 | 674 10 | 277 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 0 19 | 20 | 21 | 0 22 | 23 | 24 | 0 25 | 26 | 27 | 0 28 | 29 | 30 | 31 | 32 | QAbstractItemView::NoEditTriggers 33 | 34 | 35 | QAbstractItemView::SingleSelection 36 | 37 | 38 | QAbstractItemView::SelectItems 39 | 40 | 41 | false 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 16777215 50 | 60 51 | 52 | 53 | 54 | 0 55 | 56 | 57 | 58 | 59 | 0 60 | 61 | 62 | 0 63 | 64 | 65 | 0 66 | 67 | 68 | 0 69 | 70 | 71 | 72 | 73 | 6 74 | 75 | 76 | 77 | 78 | 79 | 80 | Info 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 150 89 | 0 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | Qt::Horizontal 98 | 99 | 100 | 101 | 40 102 | 20 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | Directory 115 | 116 | 117 | 118 | 119 | 120 | 121 | Qt::Horizontal 122 | 123 | 124 | 125 | 40 126 | 20 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 0 136 | 0 137 | 138 | 139 | 140 | 141 | 23 142 | 16777215 143 | 144 | 145 | 146 | > 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 0 155 | 0 156 | 157 | 158 | 159 | 160 | 80 161 | 16777215 162 | 163 | 164 | 165 | Qt::AlignCenter 166 | 167 | 168 | true 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 0 181 | 0 182 | 183 | 184 | 185 | 186 | 100 187 | 0 188 | 189 | 190 | 191 | Scan 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 0 201 | 202 | 203 | 0 204 | 205 | 206 | 0 207 | 208 | 209 | 0 210 | 211 | 212 | 213 | 214 | 0 215 | 216 | 217 | 218 | 219 | 0 220 | 221 | 222 | 0 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 0 233 | 234 | 235 | 0 236 | 237 | 238 | true 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 0 249 | 250 | 251 | 0 252 | 253 | 254 | true 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 0 265 | 266 | 267 | 0 268 | 269 | 270 | true 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 0 281 | 282 | 283 | 0 284 | 285 | 286 | true 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | Qt::Horizontal 297 | 298 | 299 | 300 | 40 301 | 2 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 0 313 | 0 314 | 315 | 316 | 317 | 318 | 100 319 | 0 320 | 321 | 322 | 323 | Stop 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | XComboBoxEx 336 | QComboBox 337 |
xcomboboxex.h
338 |
339 |
340 | 341 | 342 |
343 | --------------------------------------------------------------------------------