├── .gitattributes
├── common
└── Images
│ ├── 历史.png
│ ├── 清空.png
│ ├── 菜单.png
│ ├── 设置.png
│ ├── 返回.png
│ ├── 键盘.png
│ ├── add.png
│ ├── code.png
│ ├── comn.png
│ ├── copy.png
│ ├── help.png
│ ├── hex.png
│ ├── 垂直标尺.png
│ ├── 水平标尺.png
│ ├── 添加图片.png
│ ├── Refresh.png
│ ├── comment.png
│ ├── copyGRB.png
│ ├── copyHex.png
│ ├── delete.png
│ ├── module.png
│ ├── options.png
│ ├── rename.png
│ ├── return.png
│ ├── save_as.png
│ ├── space.png
│ ├── start.png
│ ├── theme.png
│ ├── tools.png
│ ├── 添加文件夹.png
│ ├── ballicon.png
│ ├── language.png
│ ├── password.png
│ ├── pasteHex.png
│ ├── pasteRgb.png
│ ├── pickColor.png
│ ├── previous.png
│ ├── wallpaper.png
│ ├── ColorPicker.png
│ ├── findWindow.png
│ ├── test_icon5.png
│ └── WindowResizer.png
├── copy_common_files.bat
├── code
├── CCommonTools
│ ├── Config.cpp
│ ├── res
│ │ └── more.png
│ ├── DialogBase.cpp
│ ├── LongTextEdit.cpp
│ ├── Resource.qrc
│ ├── ccommontools_global.h
│ ├── LongTextEdit.h
│ ├── DialogBase.h
│ ├── Config.h
│ ├── TextEditWidget.h
│ ├── PathListDialog.h
│ ├── StringHelper.cpp
│ ├── CommonTools.h
│ ├── StringHelper.h
│ ├── CCommonTools.pro
│ ├── TextEditWidget.cpp
│ ├── DatabaseTool.h
│ ├── treeitemmodel.h
│ ├── PathListDialog.cpp
│ ├── TreeItem.h
│ ├── CommonTools.cpp
│ ├── tableitemmodel.h
│ ├── CCommonTools.vcxproj.filters
│ ├── TreeItem.cpp
│ └── treeitemmodel.cpp
├── DeveloperTools
│ ├── resource.h
│ ├── DeveloperTools.rc
│ ├── res
│ │ └── DeveloperTools.ico
│ ├── DeveloperTools.qrc
│ ├── config.ini
│ ├── MainFrame.h
│ ├── DeveloperTools.pro
│ ├── main.cpp
│ ├── DeveloperTools.vcxproj.filters
│ └── MainFrame.cpp
├── PasswordGeneratorApi
│ ├── app.rc
│ ├── Stdafx.h
│ ├── app.ico
│ ├── Stdafx.cpp
│ ├── resource.h
│ ├── AssemblyInfo.cpp
│ ├── PasswordGenerator.dll
│ ├── PasswordGeneratorImp.h
│ ├── ReadMe.txt
│ ├── PasswordGeneratorApi.vcxproj.filters
│ ├── PasswordGeneratorImp.cpp
│ └── PasswordGeneratorApi.vcxproj
├── WallpaperTool
│ ├── res
│ │ ├── image.png
│ │ ├── save.png
│ │ ├── delete.png
│ │ └── delete1.png
│ ├── WallpaperTool.qrc
│ ├── WallpapaerWidget.h
│ ├── WallpaperHelper.h
│ ├── HistoryWallpaperWidget.h
│ ├── SettingsDlg.h
│ ├── wallpapertool_global.h
│ ├── ImageLabel.h
│ ├── WallpapaerWidget.cpp
│ ├── MainWidget.h
│ ├── HistoryWallpaperMgr.h
│ ├── WallpaperTool.pro
│ ├── ImageLabel.cpp
│ ├── WallpaperTool.h
│ ├── HistoryWallpaperMgr.cpp
│ ├── SettingsDlg.cpp
│ ├── MainWidget.cpp
│ └── WallpaperTool.vcxproj.filters
├── PixelRuler
│ ├── PixelRuler.qrc
│ ├── MainWidget.h
│ ├── pixelruler_global.h
│ ├── res
│ │ └── help.md
│ ├── RulerWidget.h
│ ├── RulerDrawer.h
│ ├── MainWidget.cpp
│ ├── PixelRuler.pro
│ ├── PixelRuler.h
│ ├── PixelRuler.vcxproj.filters
│ ├── RulerWidget.cpp
│ ├── PixelRuler.cpp
│ └── RulerDrawer.cpp
├── KeyboardTester
│ ├── res
│ │ └── index_files
│ │ │ └── white-icon.png
│ ├── keyboardTester.qrc
│ ├── KeyboardTester_global.h
│ ├── KeyboardTester.pro
│ ├── KeyboardTester.h
│ ├── KeyboardTester.cpp
│ ├── KeyboardTester.vcxproj.filters
│ └── KeyboardTester.vcxproj
├── AddCodeHeader
│ ├── Test.h
│ ├── AddFileHeadThread.h
│ ├── CRemoveCommentThread.h
│ ├── FileHeadHelper.h
│ ├── CRemoveCommentThread.cpp
│ ├── CommonData.cpp
│ ├── addcodeheader_global.h
│ ├── Test.cpp
│ ├── CommonData.h
│ ├── AddFileHeadThread.cpp
│ ├── RemoveCommentHelper.h
│ ├── AddCodeHeader.pro
│ ├── AddCodeHeader.h
│ ├── HeadItemTableModel.h
│ ├── AddCodeHeaderEditor.h
│ ├── MainWidget.h
│ ├── AddCodeHeader.vcxproj.filters
│ ├── RemoveCommentHelper.cpp
│ ├── MainWidget.cpp
│ ├── AddCodeHeader.cpp
│ └── FileHeadHelper.cpp
├── FileRename
│ ├── filerename_global.h
│ ├── FileRename.pro
│ ├── MainWidget.h
│ ├── FileRename.h
│ ├── FileRename.vcxproj.filters
│ ├── FileRenameHelper.h
│ ├── FileRename.cpp
│ └── FileRenameHelper.cpp
└── vc15_build_u.props
├── bin
├── x64_vc15_Debug
│ ├── ColorPicker.dll
│ ├── RibbonFrame.dll
│ ├── StylePlugin.dll
│ └── WindowResizer.dll
└── x64_vc15_Release
│ ├── ColorPicker.dll
│ ├── RibbonFrame.dll
│ ├── StylePlugin.dll
│ └── WindowResizer.dll
├── images
├── image-20230210224849338.png
├── image-20230210224931657.png
├── image-20230827192143594.png
├── image-20230827192705226.png
├── image-20230829224657246.png
├── image-20240630155555726.png
├── image-20240630163157961.png
└── image-20240630164324939.png
├── library
├── x64_vc15_Debug
│ └── RibbonFrame.lib
└── x64_vc15_Release
│ └── RibbonFrame.lib
├── copy_common_files.sh
├── include
├── mainframe_global.h
├── define.h
├── moduleinterface.h
└── mainframeinterface.h
├── DeveloperTools.pro
├── LICENSE
└── README.md
/.gitattributes:
--------------------------------------------------------------------------------
1 | code/KeyboardTester/res/* linguist-vendored
--------------------------------------------------------------------------------
/common/Images/历史.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/历史.png
--------------------------------------------------------------------------------
/common/Images/清空.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/清空.png
--------------------------------------------------------------------------------
/common/Images/菜单.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/菜单.png
--------------------------------------------------------------------------------
/common/Images/设置.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/设置.png
--------------------------------------------------------------------------------
/common/Images/返回.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/返回.png
--------------------------------------------------------------------------------
/common/Images/键盘.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/键盘.png
--------------------------------------------------------------------------------
/common/Images/add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/add.png
--------------------------------------------------------------------------------
/common/Images/code.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/code.png
--------------------------------------------------------------------------------
/common/Images/comn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/comn.png
--------------------------------------------------------------------------------
/common/Images/copy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/copy.png
--------------------------------------------------------------------------------
/common/Images/help.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/help.png
--------------------------------------------------------------------------------
/common/Images/hex.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/hex.png
--------------------------------------------------------------------------------
/common/Images/垂直标尺.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/垂直标尺.png
--------------------------------------------------------------------------------
/common/Images/水平标尺.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/水平标尺.png
--------------------------------------------------------------------------------
/common/Images/添加图片.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/添加图片.png
--------------------------------------------------------------------------------
/copy_common_files.bat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/copy_common_files.bat
--------------------------------------------------------------------------------
/common/Images/Refresh.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/Refresh.png
--------------------------------------------------------------------------------
/common/Images/comment.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/comment.png
--------------------------------------------------------------------------------
/common/Images/copyGRB.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/copyGRB.png
--------------------------------------------------------------------------------
/common/Images/copyHex.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/copyHex.png
--------------------------------------------------------------------------------
/common/Images/delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/delete.png
--------------------------------------------------------------------------------
/common/Images/module.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/module.png
--------------------------------------------------------------------------------
/common/Images/options.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/options.png
--------------------------------------------------------------------------------
/common/Images/rename.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/rename.png
--------------------------------------------------------------------------------
/common/Images/return.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/return.png
--------------------------------------------------------------------------------
/common/Images/save_as.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/save_as.png
--------------------------------------------------------------------------------
/common/Images/space.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/space.png
--------------------------------------------------------------------------------
/common/Images/start.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/start.png
--------------------------------------------------------------------------------
/common/Images/theme.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/theme.png
--------------------------------------------------------------------------------
/common/Images/tools.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/tools.png
--------------------------------------------------------------------------------
/common/Images/添加文件夹.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/添加文件夹.png
--------------------------------------------------------------------------------
/common/Images/ballicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/ballicon.png
--------------------------------------------------------------------------------
/common/Images/language.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/language.png
--------------------------------------------------------------------------------
/common/Images/password.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/password.png
--------------------------------------------------------------------------------
/common/Images/pasteHex.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/pasteHex.png
--------------------------------------------------------------------------------
/common/Images/pasteRgb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/pasteRgb.png
--------------------------------------------------------------------------------
/common/Images/pickColor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/pickColor.png
--------------------------------------------------------------------------------
/common/Images/previous.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/previous.png
--------------------------------------------------------------------------------
/common/Images/wallpaper.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/wallpaper.png
--------------------------------------------------------------------------------
/code/CCommonTools/Config.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/code/CCommonTools/Config.cpp
--------------------------------------------------------------------------------
/code/CCommonTools/res/more.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/code/CCommonTools/res/more.png
--------------------------------------------------------------------------------
/code/DeveloperTools/resource.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/code/DeveloperTools/resource.h
--------------------------------------------------------------------------------
/common/Images/ColorPicker.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/ColorPicker.png
--------------------------------------------------------------------------------
/common/Images/findWindow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/findWindow.png
--------------------------------------------------------------------------------
/common/Images/test_icon5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/test_icon5.png
--------------------------------------------------------------------------------
/code/CCommonTools/DialogBase.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/code/CCommonTools/DialogBase.cpp
--------------------------------------------------------------------------------
/code/PasswordGeneratorApi/app.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/code/PasswordGeneratorApi/app.rc
--------------------------------------------------------------------------------
/code/WallpaperTool/res/image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/code/WallpaperTool/res/image.png
--------------------------------------------------------------------------------
/code/WallpaperTool/res/save.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/code/WallpaperTool/res/save.png
--------------------------------------------------------------------------------
/common/Images/WindowResizer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/common/Images/WindowResizer.png
--------------------------------------------------------------------------------
/bin/x64_vc15_Debug/ColorPicker.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/bin/x64_vc15_Debug/ColorPicker.dll
--------------------------------------------------------------------------------
/bin/x64_vc15_Debug/RibbonFrame.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/bin/x64_vc15_Debug/RibbonFrame.dll
--------------------------------------------------------------------------------
/bin/x64_vc15_Debug/StylePlugin.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/bin/x64_vc15_Debug/StylePlugin.dll
--------------------------------------------------------------------------------
/code/CCommonTools/LongTextEdit.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/code/CCommonTools/LongTextEdit.cpp
--------------------------------------------------------------------------------
/code/PasswordGeneratorApi/Stdafx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/code/PasswordGeneratorApi/Stdafx.h
--------------------------------------------------------------------------------
/code/PasswordGeneratorApi/app.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/code/PasswordGeneratorApi/app.ico
--------------------------------------------------------------------------------
/code/WallpaperTool/res/delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/code/WallpaperTool/res/delete.png
--------------------------------------------------------------------------------
/code/WallpaperTool/res/delete1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/code/WallpaperTool/res/delete1.png
--------------------------------------------------------------------------------
/images/image-20230210224849338.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/images/image-20230210224849338.png
--------------------------------------------------------------------------------
/images/image-20230210224931657.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/images/image-20230210224931657.png
--------------------------------------------------------------------------------
/images/image-20230827192143594.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/images/image-20230827192143594.png
--------------------------------------------------------------------------------
/images/image-20230827192705226.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/images/image-20230827192705226.png
--------------------------------------------------------------------------------
/images/image-20230829224657246.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/images/image-20230829224657246.png
--------------------------------------------------------------------------------
/images/image-20240630155555726.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/images/image-20240630155555726.png
--------------------------------------------------------------------------------
/images/image-20240630163157961.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/images/image-20240630163157961.png
--------------------------------------------------------------------------------
/images/image-20240630164324939.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/images/image-20240630164324939.png
--------------------------------------------------------------------------------
/bin/x64_vc15_Debug/WindowResizer.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/bin/x64_vc15_Debug/WindowResizer.dll
--------------------------------------------------------------------------------
/bin/x64_vc15_Release/ColorPicker.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/bin/x64_vc15_Release/ColorPicker.dll
--------------------------------------------------------------------------------
/bin/x64_vc15_Release/RibbonFrame.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/bin/x64_vc15_Release/RibbonFrame.dll
--------------------------------------------------------------------------------
/bin/x64_vc15_Release/StylePlugin.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/bin/x64_vc15_Release/StylePlugin.dll
--------------------------------------------------------------------------------
/code/DeveloperTools/DeveloperTools.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/code/DeveloperTools/DeveloperTools.rc
--------------------------------------------------------------------------------
/code/PasswordGeneratorApi/Stdafx.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/code/PasswordGeneratorApi/Stdafx.cpp
--------------------------------------------------------------------------------
/code/PasswordGeneratorApi/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by app.rc
4 |
--------------------------------------------------------------------------------
/bin/x64_vc15_Release/WindowResizer.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/bin/x64_vc15_Release/WindowResizer.dll
--------------------------------------------------------------------------------
/code/CCommonTools/Resource.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | res/more.png
4 |
5 |
6 |
--------------------------------------------------------------------------------
/code/PixelRuler/PixelRuler.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | res/help.md
4 |
5 |
6 |
--------------------------------------------------------------------------------
/library/x64_vc15_Debug/RibbonFrame.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/library/x64_vc15_Debug/RibbonFrame.lib
--------------------------------------------------------------------------------
/library/x64_vc15_Release/RibbonFrame.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/library/x64_vc15_Release/RibbonFrame.lib
--------------------------------------------------------------------------------
/code/DeveloperTools/res/DeveloperTools.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/code/DeveloperTools/res/DeveloperTools.ico
--------------------------------------------------------------------------------
/code/PasswordGeneratorApi/AssemblyInfo.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/code/PasswordGeneratorApi/AssemblyInfo.cpp
--------------------------------------------------------------------------------
/code/PasswordGeneratorApi/PasswordGenerator.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/code/PasswordGeneratorApi/PasswordGenerator.dll
--------------------------------------------------------------------------------
/code/KeyboardTester/res/index_files/white-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zhongyang219/DeveloperTools/HEAD/code/KeyboardTester/res/index_files/white-icon.png
--------------------------------------------------------------------------------
/copy_common_files.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | mkdir -p ./bin/debug/
3 | mkdir -p ./bin/release/
4 | cp -r ./common/* ./bin/debug/
5 | cp -r ./common/* ./bin/release/
6 |
--------------------------------------------------------------------------------
/code/DeveloperTools/DeveloperTools.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | res/DeveloperTools.ico
4 |
5 |
6 |
--------------------------------------------------------------------------------
/code/DeveloperTools/config.ini:
--------------------------------------------------------------------------------
1 | [AddCodeHeader]
2 | folderPath=D:/temp/yuanma - 副本
3 | fileTypeList="*.c;*.cpp;*.h"
4 | outoputFormat=0
5 | removeSpace=true
6 | removeReturn=true
7 |
--------------------------------------------------------------------------------
/code/AddCodeHeader/Test.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | class CTest
3 | {
4 | public:
5 | CTest();
6 | ~CTest();
7 |
8 | static void Test();
9 |
10 | private:
11 | static void TestRemoveComment();
12 | };
13 |
14 |
--------------------------------------------------------------------------------
/code/WallpaperTool/WallpaperTool.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | res/image.png
4 | res/save.png
5 | res/delete.png
6 | res/delete1.png
7 |
8 |
9 |
--------------------------------------------------------------------------------
/code/FileRename/filerename_global.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #ifndef BUILD_STATIC
6 | # if defined(FILERENAME_LIB)
7 | # define FILERENAME_EXPORT Q_DECL_EXPORT
8 | # else
9 | # define FILERENAME_EXPORT Q_DECL_IMPORT
10 | # endif
11 | #else
12 | # define FILERENAME_EXPORT
13 | #endif
14 |
--------------------------------------------------------------------------------
/code/PixelRuler/MainWidget.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | class CMainWidget : public QWidget
6 | {
7 | Q_OBJECT
8 |
9 | public:
10 | CMainWidget(QWidget* parent = nullptr);
11 | ~CMainWidget();
12 |
13 | private:
14 | virtual void paintEvent(QPaintEvent* event) override;
15 | };
16 |
--------------------------------------------------------------------------------
/code/PixelRuler/pixelruler_global.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #ifndef BUILD_STATIC
6 | # if defined(PIXELRULER_LIB)
7 | # define PIXELRULER_EXPORT Q_DECL_EXPORT
8 | # else
9 | # define PIXELRULER_EXPORT Q_DECL_IMPORT
10 | # endif
11 | #else
12 | # define PIXELRULER_EXPORT
13 | #endif
14 |
--------------------------------------------------------------------------------
/code/KeyboardTester/keyboardTester.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | res/index.html
4 | res/index_files/kb_test-09cf3d8fcd.css
5 | res/index_files/kb_test-695ee2b450.js
6 | res/index_files/white-icon.png
7 |
8 |
9 |
--------------------------------------------------------------------------------
/include/mainframe_global.h:
--------------------------------------------------------------------------------
1 | #ifndef MAINFRAME_GLOBAL_H
2 | #define MAINFRAME_GLOBAL_H
3 |
4 | #include
5 |
6 | #if defined(RIBBONFRAME_LIBRARY)
7 | # define RIBBONFRAME_EXPORT Q_DECL_EXPORT
8 | #else
9 | # define RIBBONFRAME_EXPORT Q_DECL_IMPORT
10 | #endif
11 |
12 | #endif // TMAINFRAME_GLOBAL_H
13 |
--------------------------------------------------------------------------------
/code/CCommonTools/ccommontools_global.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #ifndef BUILD_STATIC
6 | # if defined(CCOMMONTOOLS_LIB)
7 | # define CCOMMONTOOLS_EXPORT Q_DECL_EXPORT
8 | # else
9 | # define CCOMMONTOOLS_EXPORT Q_DECL_IMPORT
10 | # endif
11 | #else
12 | # define CCOMMONTOOLS_EXPORT
13 | #endif
14 |
--------------------------------------------------------------------------------
/code/KeyboardTester/KeyboardTester_global.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #ifndef BUILD_STATIC
6 | # if defined(KEYBOARDTESTER_LIB)
7 | # define KEYBOARDTESTER_EXPORT Q_DECL_EXPORT
8 | # else
9 | # define KEYBOARDTESTER_EXPORT Q_DECL_IMPORT
10 | # endif
11 | #else
12 | # define KEYBOARDTESTER_EXPORT
13 | #endif
14 |
--------------------------------------------------------------------------------
/code/CCommonTools/LongTextEdit.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include "ccommontools_global.h"
5 |
6 | class CCOMMONTOOLS_EXPORT CLongTextEdit : public QLineEdit
7 | {
8 | Q_OBJECT
9 |
10 | public:
11 | CLongTextEdit(QWidget *parent);
12 | ~CLongTextEdit();
13 |
14 | protected slots :
15 | void OnActionTriggerd();
16 | };
17 |
--------------------------------------------------------------------------------
/code/PixelRuler/res/help.md:
--------------------------------------------------------------------------------
1 | ## 像素尺使用说明
2 |
3 | ### 设置缩放比例
4 |
5 | * 勾选Ribbon菜单中的“系统缩放比例”可以使像素尺的刻度按照当前系统DPI设置放大。
6 | * 不勾选“系统缩放比例”时可以在“自定义比例”下拉列表中选择一个缩放比例,默认为100%。
7 |
8 | 如果你希望在不同dpi设置的电脑上测量同一界面元素时得到相同的测量结果,那么你应该勾选“系统缩放比例”,使得像素尺的刻度会跟随系统DPI设置而缩放。
9 |
10 | ### 设置标尺最小刻度
11 |
12 | 点击Ribbon菜单中“标尺最小刻度”组中的单选框可以设置标尺最小刻度。
13 |
14 | ### 显示屏标尺
15 |
16 | 点击Ribbon菜单中的“显示水平标尺”或“显示垂直标尺”可以显示一个屏幕标尺,你可以将屏幕标尺拖动到需要测量的地方。
17 |
18 | 当屏幕标尺处于激活状态时,可以通过键盘上的上下左右方向键以1像素为单位移动屏幕标尺的位置。
--------------------------------------------------------------------------------
/code/CCommonTools/DialogBase.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include "ccommontools_global.h"
5 |
6 | class CCOMMONTOOLS_EXPORT DialogBase : public QDialog
7 | {
8 | public:
9 | DialogBase(QString dialogName = QString(), QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
10 | virtual ~DialogBase();
11 | bool IsDialogSizeLoadSucceed() const;
12 |
13 | private:
14 | QString m_dialogName;
15 | bool m_sizeLoadSucceed{};
16 | };
17 |
--------------------------------------------------------------------------------
/code/CCommonTools/Config.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "ccommontools_global.h"
3 | #include
4 |
5 | class CCOMMONTOOLS_EXPORT CConfig
6 | {
7 | public:
8 | CConfig(const QString& strModuleName = QString());
9 | ~CConfig();
10 |
11 | void WriteValue(const QString& strKeyName, const QVariant& value);
12 | QVariant GetValue(const QString& strKeyName, const QVariant& defaultValue = QVariant()) const;
13 |
14 | private:
15 | QSettings* m_settings{};
16 | };
17 |
18 |
--------------------------------------------------------------------------------
/code/CCommonTools/TextEditWidget.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "ccommontools_global.h"
4 | #include
5 | #include
6 | #include
7 |
8 | class CCOMMONTOOLS_EXPORT CTextEditDialog : public QDialog
9 | {
10 | public:
11 | CTextEditDialog(QWidget* parent = nullptr, bool showButtons = false);
12 | ~CTextEditDialog();
13 | void SetLabelText(const QString& text);
14 | QTextEdit* GetEdit();
15 |
16 | private:
17 | QTextEdit* m_edit;
18 | QLabel* m_label;
19 | };
20 |
--------------------------------------------------------------------------------
/code/WallpaperTool/WallpapaerWidget.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include "ImageLabel.h"
6 |
7 | class CWallpapaerWidget : public QWidget
8 | {
9 | Q_OBJECT
10 |
11 | public:
12 | CWallpapaerWidget(QWidget *parent);
13 | ~CWallpapaerWidget();
14 | void SetWallpaper(const QString& strPath);
15 | CImageLabel& GetImageLabel() { return m_imgLabel; }
16 | QString GetWallpaperPath();
17 |
18 | private:
19 | QLineEdit m_pathEdit;
20 | CImageLabel m_imgLabel;
21 | };
22 |
--------------------------------------------------------------------------------
/code/AddCodeHeader/AddFileHeadThread.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include "FileHeadHelper.h"
5 |
6 | class CAddFileHeadThread : public QThread
7 | {
8 | Q_OBJECT
9 |
10 | public:
11 | CAddFileHeadThread(QObject *parent = nullptr);
12 | ~CAddFileHeadThread();
13 |
14 | void Stop();
15 | bool IsStopped();
16 |
17 | public:
18 | int m_fileCount{};
19 |
20 | private:
21 | bool m_stoped{ false };
22 | CFileHeadHelper m_helper{};
23 |
24 | protected:
25 | virtual void run() override;
26 | };
27 |
--------------------------------------------------------------------------------
/code/KeyboardTester/KeyboardTester.pro:
--------------------------------------------------------------------------------
1 | QT += core gui widgets webenginewidgets
2 | CONFIG += c++11 plugin
3 |
4 | TEMPLATE = lib
5 | TARGET = KeyboardTester
6 | CONFIG(debug, debug|release): {
7 | DESTDIR = $$PWD/../../bin/debug
8 | }
9 | else {
10 | DESTDIR = $$PWD/../../bin/release
11 | }
12 | DEFINES += KEYBOARDTESTER_LIB
13 |
14 | INCLUDEPATH += $$PWD/../../include
15 |
16 | HEADERS += \
17 | KeyboardTester.h \
18 | KeyboardTester_global.h
19 |
20 | SOURCES += \
21 | KeyboardTester.cpp
22 |
23 | RESOURCES += \
24 | keyboardTester.qrc
25 |
--------------------------------------------------------------------------------
/code/AddCodeHeader/CRemoveCommentThread.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include "RemoveCommentHelper.h"
5 |
6 | class CRemoveCommentThread : public QThread
7 | {
8 | Q_OBJECT
9 |
10 | public:
11 | CRemoveCommentThread(QObject *parent = nullptr);
12 | ~CRemoveCommentThread();
13 |
14 | void Stop();
15 | bool IsStopped();
16 |
17 | public:
18 | CRemoveCommentHelper::RemoveResult m_removeResult;
19 | int m_fileCount{};
20 |
21 | private:
22 | bool m_stoped{ false };
23 |
24 | protected:
25 | virtual void run() override;
26 | };
27 |
--------------------------------------------------------------------------------
/code/AddCodeHeader/FileHeadHelper.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "CommonData.h"
3 | class CFileHeadHelper
4 | {
5 | public:
6 | CFileHeadHelper();
7 | ~CFileHeadHelper();
8 |
9 | bool AddFileHead(const QString& filePath, eOutputFormat outputFormat);
10 |
11 | private:
12 | eOutputFormat JudgeCode(const QByteArray& data, bool& hasBom);
13 |
14 | //移除文件原来的文件头
15 | void RemoveFileHead(QString& strContents);
16 |
17 | //生成文件头的内容
18 | QString GenerateFileHeadContents(const QString& filePath) const;
19 |
20 | //处理文件头的字符串,在每个换行符前面添加“* ”
21 | static void ProcessHeadString(QString& str);
22 | };
23 |
24 |
--------------------------------------------------------------------------------
/code/CCommonTools/PathListDialog.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include "ccommontools_global.h"
5 | #include "DialogBase.h"
6 |
7 | class QListWidget;
8 | class CCOMMONTOOLS_EXPORT CPathListDialog : public DialogBase
9 | {
10 | Q_OBJECT
11 | public:
12 | CPathListDialog(const QStringList& pathList, QWidget *parent = nullptr);
13 | ~CPathListDialog();
14 |
15 | QString GetSelectedPath() const;
16 |
17 | protected:
18 | virtual void accept() override;
19 |
20 | private slots:
21 | void OnOpenNewFolder();
22 |
23 | private:
24 | QListWidget* m_pListWidget;
25 | QString m_newfolderPath;
26 | };
27 |
--------------------------------------------------------------------------------
/code/AddCodeHeader/CRemoveCommentThread.cpp:
--------------------------------------------------------------------------------
1 | #include "CRemoveCommentThread.h"
2 | #include "AddCodeHeader.h"
3 |
4 | CRemoveCommentThread::CRemoveCommentThread(QObject *parent)
5 | : QThread(parent)
6 | {
7 | }
8 |
9 | CRemoveCommentThread::~CRemoveCommentThread()
10 | {
11 | }
12 |
13 | void CRemoveCommentThread::Stop()
14 | {
15 | m_stoped = true;
16 | }
17 |
18 | bool CRemoveCommentThread::IsStopped()
19 | {
20 | return m_stoped;
21 | }
22 |
23 | void CRemoveCommentThread::run()
24 | {
25 | m_removeResult = CRemoveCommentHelper::RemoveResult();
26 | m_fileCount = AddCodeHeader::GetInstance()->GetEditor().RemoveComments(m_removeResult);
27 | }
28 |
--------------------------------------------------------------------------------
/code/WallpaperTool/WallpaperHelper.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 |
4 | #ifdef Q_OS_WIN
5 | #include
6 | #include
7 | #endif
8 |
9 | class CWallpaperHelper
10 | {
11 | public:
12 | CWallpaperHelper();
13 | ~CWallpaperHelper();
14 |
15 | //获取当前桌面壁纸的路径
16 | QList GetCurrentWallpaperPath(bool fromRegistry);
17 |
18 | bool PreviousWallPaper();
19 | bool NextWallPaper();
20 |
21 | static bool IsWindowsWallpaperAutoSwitch();
22 |
23 | #ifdef Q_OS_WIN
24 | void ShowResultInfo(HRESULT hr);
25 | #endif
26 |
27 | private:
28 | #ifdef Q_OS_WIN
29 | IDesktopWallpaper* m_pWallpaper{};
30 | #endif
31 |
32 | };
33 |
34 |
--------------------------------------------------------------------------------
/code/PixelRuler/RulerWidget.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | class CRulerWidget : public QWidget
6 | {
7 | public:
8 | CRulerWidget(Qt::Orientation orientation, QWidget *parent = nullptr);
9 | ~CRulerWidget();
10 |
11 | private:
12 | virtual void paintEvent(QPaintEvent* event) override;
13 |
14 | protected:
15 | virtual void mouseMoveEvent(QMouseEvent* event) override;
16 | virtual void mousePressEvent(QMouseEvent* event) override;
17 | virtual void mouseReleaseEvent(QMouseEvent* event) override;
18 | virtual void keyReleaseEvent(QKeyEvent* event) override;
19 |
20 | private:
21 | Qt::Orientation m_orientation;
22 | QPoint m_mousePoint;
23 | bool m_mousePressed{};
24 | };
25 |
--------------------------------------------------------------------------------
/DeveloperTools.pro:
--------------------------------------------------------------------------------
1 | # ----------------------------------------------------
2 | # This file is generated by the Qt Visual Studio Tools.
3 | # ------------------------------------------------------
4 |
5 | # This is a reminder that you are using a generated .pro file.
6 | # Remove it when you are finished editing this file.
7 | # message("You are running qmake on a generated .pro file. This may not work!")
8 |
9 |
10 | TEMPLATE = subdirs
11 | SUBDIRS += code/CCommonTools/CCommonTools.pro \
12 | code/AddCodeHeader/AddCodeHeader.pro \
13 | code/WallpaperTool/WallpaperTool.pro \
14 | code/PixelRuler/PixelRuler.pro \
15 | code/FileRename/FileRename.pro \
16 | code/DeveloperTools/DeveloperTools.pro
17 |
18 | CONFIG += ordered
19 |
--------------------------------------------------------------------------------
/code/WallpaperTool/HistoryWallpaperWidget.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 |
7 | class HistoryWallpaperWidget : public QWidget
8 | {
9 | Q_OBJECT
10 |
11 | public:
12 | HistoryWallpaperWidget(QWidget *parent = nullptr);
13 | ~HistoryWallpaperWidget();
14 |
15 | public slots:
16 | void Refresh();
17 |
18 | private slots:
19 | void OnItemDoubleClicked(QListWidgetItem* item);
20 | void OnContextMenu(const QPoint& pos);
21 | void OnViewWallpaper();
22 | void OnSaveWallpaper();
23 | void OnRemoveRecord();
24 | void OnDeleteWallpaper();
25 |
26 | private:
27 | QListWidget* m_listWidget;
28 | QMenu m_menu;
29 | QListWidgetItem* m_selectedItem{};
30 | };
31 |
--------------------------------------------------------------------------------
/code/AddCodeHeader/CommonData.cpp:
--------------------------------------------------------------------------------
1 | #include "CommonData.h"
2 |
3 | QString HeadItemItem::name() const
4 | {
5 | return GetHeadItemName(item);
6 | }
7 |
8 | QString HeadItemItem::GetHeadItemName(eHeadItem item)
9 | {
10 | switch (item)
11 | {
12 | case HI_COPYRIGHT:
13 | return u8"版权";
14 | case HI_FILE:
15 | return u8"文件名";
16 | case HI_BRIEF:
17 | return u8"文件描述";
18 | case HI_AUTHOR:
19 | return u8"作者";
20 | case HI_EMAL:
21 | return u8"邮箱";
22 | case HI_VERSION:
23 | return u8"版本号";
24 | case HI_DATE:
25 | return u8"日期";
26 | case HI_LICENSE:
27 | return u8"许可证";
28 | case HI_USER_DEFINE:
29 | return u8"自定义";
30 | }
31 | return QString();
32 | }
33 |
--------------------------------------------------------------------------------
/code/PixelRuler/RulerDrawer.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 | class CRulerDrawer
5 | {
6 | public:
7 | //刻度的位置
8 | enum ScaleDirection
9 | {
10 | Top,
11 | Bottom,
12 | Left,
13 | Right,
14 | };
15 |
16 | CRulerDrawer(QPainter& painter, QRect rect, int scalePercent);
17 | void Draw(ScaleDirection direction, bool drawText = true);
18 |
19 | private:
20 | void DrawHorizontalScale(int top, bool drawText);
21 | void DrawVerticalScale(int left, bool drawText);
22 | int DPI(int pixel);
23 |
24 | private:
25 | int m_scalePercent = 100; //尺子缩放百分比
26 | QRect m_rect;
27 | QPainter& m_painter;
28 | QPalette m_palette;
29 | int m_scaleUnitSize = 10;
30 | };
31 |
32 |
--------------------------------------------------------------------------------
/code/WallpaperTool/SettingsDlg.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | class SettingsDlg : public QDialog
7 | {
8 | Q_OBJECT
9 |
10 | public:
11 | SettingsDlg(QWidget *parent = nullptr);
12 | ~SettingsDlg();
13 |
14 | struct Data
15 | {
16 | enum WallpaperAcquireMethod
17 | {
18 | Registry,
19 | WallpaperInterface
20 | };
21 |
22 | WallpaperAcquireMethod wallpaperAcquireMethod{};
23 |
24 | void Save() const;
25 | void Load();
26 | };
27 |
28 | void SetData(const Data& data);
29 | Data GetData() const;
30 |
31 | private:
32 | QRadioButton* m_radioButtonReg;
33 | QRadioButton* m_radioButtonWallPaperInterface;
34 |
35 | };
36 |
--------------------------------------------------------------------------------
/code/WallpaperTool/wallpapertool_global.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #ifndef BUILD_STATIC
6 | # if defined(WALLPAPERTOOL_LIB)
7 | # define WALLPAPERTOOL_EXPORT Q_DECL_EXPORT
8 | # else
9 | # define WALLPAPERTOOL_EXPORT Q_DECL_IMPORT
10 | # endif
11 | #else
12 | # define WALLPAPERTOOL_EXPORT
13 | #endif
14 |
15 | #define CMD_CURRENT_WALLPAPER_SAVE_AS "CurWallpaperSaveAs"
16 | #define CMD_CURRENT_WALLPAPER_DELETE "CurWallpaperDelete"
17 | #define CMD_CURRENT_WALLPAPER_REFRESH "CurWallpaperRefresh"
18 | #define CMD_PreviousWallpaper "PreviousWallpaper"
19 | #define CMD_NextWallpaper "NextWallpaper"
20 | #define CMD_WallpaperToolSettings "WallpaperToolSettings"
21 | #define CMD_WallpaperBack "WallpaperBack"
22 | #define CMD_WallpaperHistory "WallpaperHistory"
23 |
--------------------------------------------------------------------------------
/code/WallpaperTool/ImageLabel.h:
--------------------------------------------------------------------------------
1 | #ifndef VIDEOLABEL_H
2 | #define VIDEOLABEL_H
3 |
4 | #include
5 | #include
6 |
7 | //用于显示图像的窗口,继承于QLabel控件
8 | class CImageLabel : public QLabel
9 | {
10 | Q_OBJECT
11 | public:
12 | CImageLabel(QWidget* pParent = nullptr);
13 | void SetImage(const QPixmap& image);
14 | QRect GetImageViewRect() const; //获取图片显示的大小
15 |
16 | QSize GetImageSize() const;
17 |
18 | signals:
19 | //鼠标左键点击信号
20 | void clicked();
21 |
22 | private:
23 | QPixmap m_image;
24 |
25 | // QObject interface
26 | public:
27 | virtual void paintEvent(QPaintEvent *) override;
28 | protected:
29 | virtual void mouseReleaseEvent(QMouseEvent* event) override;
30 |
31 | private:
32 | QRect m_imageRect;
33 | };
34 |
35 | #endif // VIDEOLABEL_H
36 |
--------------------------------------------------------------------------------
/code/CCommonTools/StringHelper.cpp:
--------------------------------------------------------------------------------
1 | #include "StringHelper.h"
2 |
3 | int StringHelper::QStringFindFirstOf(const QString& str, const QString& findStr, int index)
4 | {
5 | if (index < 0)
6 | index = 0;
7 | for (int i = index; i < str.size(); i++)
8 | {
9 | if (findStr.contains(str[i]))
10 | return i;
11 | }
12 | return -1;
13 | }
14 |
15 | int StringHelper::QStringFindLastOf(const QString& str, const QString& findStr, int index)
16 | {
17 | if (index > str.size() - 1)
18 | index = str.size() - 1;
19 | for (int i = index; i >= 0; i-- )
20 | {
21 | if (findStr.contains(str[i]))
22 | return i;
23 | }
24 | return -1;
25 | }
26 |
27 | bool StringHelper::IsNumber(char ch)
28 | {
29 | return ch >= '0' && ch <= '9';
30 | }
31 |
--------------------------------------------------------------------------------
/code/DeveloperTools/MainFrame.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include "ribbonframewindow.h"
6 |
7 | class MainFrame : public RibbonFrameWindow
8 | {
9 | Q_OBJECT
10 | public:
11 | explicit MainFrame(const QStringList& cmdLine, QWidget* parent = nullptr);
12 | ~MainFrame();
13 | void SetSharedMemory(QSharedMemory* pShared);
14 |
15 | signals:
16 |
17 | private:
18 | int m_timerId; //1秒定时器的ID
19 | QSharedMemory* m_pSharedMemory{}; //保存QSharedMemory对象的指针
20 |
21 | // MainFrameWindow interface
22 | private:
23 | virtual bool OnCommand(const QString& strCmd, bool checked) override;
24 | // QWidget interface
25 | protected:
26 | virtual void closeEvent(QCloseEvent* event) override;
27 | virtual void timerEvent(QTimerEvent*) override;
28 | };
29 |
--------------------------------------------------------------------------------
/code/DeveloperTools/DeveloperTools.pro:
--------------------------------------------------------------------------------
1 | # ----------------------------------------------------
2 | # This file is generated by the Qt Visual Studio Tools.
3 | # ------------------------------------------------------
4 |
5 | QT += core gui widgets xml
6 | CONFIG += c++11
7 | TEMPLATE = app
8 | TARGET = DeveloperTools
9 | CONFIG(debug, debug|release): {
10 | DESTDIR = $$PWD/../../bin/debug
11 | LIBS += -L$$PWD/../../bin/debug \
12 | -lCCommonTools -lRibbonFrame
13 | }
14 | else {
15 | DESTDIR = $$PWD/../../bin/release
16 | LIBS += -L$$PWD/../../bin/release \
17 | -lCCommonTools -lRibbonFrame
18 | }
19 | DEPENDPATH += .
20 | win32:RC_FILE = DeveloperTools.rc
21 | HEADERS += $$PWD/../../include/*.h \
22 | $$PWD/*.h
23 | SOURCES += $$PWD/*.cpp
24 | RESOURCES += $$PWD/*.qrc
25 | INCLUDEPATH += $$PWD/../../include
26 |
--------------------------------------------------------------------------------
/code/AddCodeHeader/addcodeheader_global.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #ifndef BUILD_STATIC
6 | # if defined(ADDCODEHEADER_LIB)
7 | # define ADDCODEHEADER_EXPORT Q_DECL_EXPORT
8 | # else
9 | # define ADDCODEHEADER_EXPORT Q_DECL_IMPORT
10 | # endif
11 | #else
12 | # define ADDCODEHEADER_EXPORT
13 | #endif
14 |
15 |
16 | //菜单命令
17 | #define CMD_SCAN_FILE "AddCodeHeaderScanFile"
18 | #define CMD_REMOVE_COMMENT_EXCUTE "RemoveCommentExcute"
19 | #define CMD_SHOW_ADD_CODE_HEADER "ShowAddCodeHeader"
20 | #define CMD_ADD_CODE_HEADER_EXCUTE "AddCodeHeaderExcute"
21 | #define CMD_USER_GUID "AddCodeHeaderUserGuid"
22 |
23 | #define CMD_RemoveCommentCheck "RemoveCommentCheck"
24 | #define CMD_RemoveSpaceCheck "RemoveSpaceCheck"
25 | #define CMD_RemoveEmptyLineCheck "RemoveEmptyLineCheck"
26 | #define CMD_KeepEmptyLineNum "KeepEmptyLineNum"
27 |
--------------------------------------------------------------------------------
/code/CCommonTools/CommonTools.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "ccommontools_global.h"
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 | class CCOMMONTOOLS_EXPORT CCommonTools
10 | {
11 | public:
12 | CCommonTools();
13 |
14 | static QFileInfoList FindFile(const QString &strFilePath, const QStringList &nameFilters = QStringList());
15 |
16 | static QMainWindow* GetMainWindow();
17 | static void WriteLog(const QString& strLogInfo, const QString& strFilePath = QString());
18 |
19 | static QIcon CreateIcon(const QString& strPath, int size);
20 |
21 | static void DelayNotBlocked(int msec);
22 |
23 | //判断是否为UTF8字符流
24 | static bool IsUtf8Bytes(const QByteArray& data);
25 |
26 | //static int QStringFindFirstOf(const QString& str, const char* findStr, int start);
27 | };
28 |
--------------------------------------------------------------------------------
/code/FileRename/FileRename.pro:
--------------------------------------------------------------------------------
1 | QT += core gui widgets
2 | CONFIG += c++11 plugin
3 |
4 | TEMPLATE = lib
5 | TARGET = FileRename
6 | CONFIG(debug, debug|release): {
7 | DESTDIR = $$PWD/../../bin/debug
8 | LIBS += -L$$PWD/../../bin/debug \
9 | -lCCommonTools
10 | }
11 | else {
12 | DESTDIR = $$PWD/../../bin/release
13 | LIBS += -L$$PWD/../../bin/release \
14 | -lCCommonTools
15 | }
16 | DEFINES += FILERENAME_LIB
17 | #HEADERS += ./*.h
18 | #SOURCES += ./*.cpp
19 | #RESOURCES += ./*.qrc
20 | #FORMS += ./*.ui
21 |
22 | INCLUDEPATH += $$PWD/../../include
23 |
24 | FORMS += \
25 | MainWidget.ui
26 |
27 | HEADERS += \
28 | FileRename.h \
29 | FileRenameHelper.h \
30 | MainWidget.h \
31 | filerename_global.h
32 |
33 | SOURCES += \
34 | FileRename.cpp \
35 | FileRenameHelper.cpp \
36 | MainWidget.cpp
37 |
--------------------------------------------------------------------------------
/code/AddCodeHeader/Test.cpp:
--------------------------------------------------------------------------------
1 | #include "Test.h"
2 | #include "RemoveCommentHelper.h"
3 |
4 |
5 | CTest::CTest()
6 | {
7 | }
8 |
9 |
10 | CTest::~CTest()
11 | {
12 | }
13 |
14 | void CTest::Test()
15 | {
16 | TestRemoveComment();
17 | }
18 |
19 | void CTest::TestRemoveComment()
20 | {
21 | QByteArray strTest(" int a = 0;\r\n //aaaaaaa\r\n printf(\"aaa//bbb\"); //printf\r\n printf(\"ccc//ddd\"); //\"printf\"\r\n printf(\"ccc//ddd\");\r\n printf(\"eeee//ff\"); //i\"444\"//aa\"ccc\r\n/**/\r\n return 0;\r\n");
22 | QByteArray strRemoveComment(" int a = 0;\r\n\r\n printf(\"aaa//bbb\");\r\n printf(\"ccc//ddd\");\r\n printf(\"ccc//ddd\");\r\n printf(\"eeee//ff\");\r\n\r\n return 0;\r\n");
23 | CRemoveCommentHelper::RemoveResult result;
24 | CRemoveCommentHelper::RemoveComment(strTest, true, true, true, 2, result);
25 | Q_ASSERT(strTest == strRemoveComment);
26 | }
27 |
--------------------------------------------------------------------------------
/code/CCommonTools/StringHelper.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "ccommontools_global.h"
3 | #include
4 |
5 | class CCOMMONTOOLS_EXPORT StringHelper
6 | {
7 | public:
8 | /**
9 | @brief 利用QString实现std::string中的find_fisrt_of函数的功能
10 | @param str - 被查找的字符串
11 | @param findStr - 要查找的字符串
12 | @param index - 查找的起始位置
13 | @retval - 查找到的位置
14 | **/
15 | static int QStringFindFirstOf(const QString& str, const QString& findStr, int index);
16 |
17 | /**
18 | @brief 利用QString实现std::string中的find_last_of函数的功能
19 | @param str - 被查找的字符串
20 | @param findStr - 要查找的字符串
21 | @param index - 查找的起始位置
22 | @retval - 查找到的位置
23 | **/
24 | static int QStringFindLastOf(const QString& str, const QString& findStr, int index);
25 |
26 | static bool IsNumber(char ch);
27 | };
28 |
29 |
--------------------------------------------------------------------------------
/code/AddCodeHeader/CommonData.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 |
4 | enum eOutputFormat //输出的文本格式
5 | {
6 | OF_UTF8,
7 | OF_ANSI,
8 | OF_UTF16
9 | };
10 |
11 |
12 | //文件头项目
13 | enum eHeadItem
14 | {
15 | HI_COPYRIGHT, //版权
16 | HI_FILE, //文件名
17 | HI_BRIEF, //文件描述
18 | HI_AUTHOR, //作者
19 | HI_EMAL, //邮箱
20 | HI_VERSION, //版本号
21 | HI_DATE, //日期
22 | HI_LICENSE, //许可证
23 | HI_USER_DEFINE, //自定义的固定内容,通常包括版权等信息
24 | HI_MAX
25 | };
26 |
27 | struct HeadItemItem
28 | {
29 | eHeadItem item;
30 | QString value;
31 | bool enable{ true };
32 |
33 | HeadItemItem()
34 | {}
35 |
36 | HeadItemItem(eHeadItem _item)
37 | : item(_item)
38 | {}
39 |
40 | QString name() const;
41 |
42 | static QString GetHeadItemName(eHeadItem item);
43 |
44 | };
45 |
--------------------------------------------------------------------------------
/code/WallpaperTool/WallpapaerWidget.cpp:
--------------------------------------------------------------------------------
1 | #include "WallpapaerWidget.h"
2 | #include
3 | #include
4 | #include
5 |
6 | CWallpapaerWidget::CWallpapaerWidget(QWidget *parent)
7 | : QWidget(parent)
8 | {
9 | QVBoxLayout* pLayout = new QVBoxLayout();
10 | pLayout->setMargin(0);
11 | this->setLayout(pLayout);
12 | QHBoxLayout* pHLayout = new QHBoxLayout();
13 | pLayout->addLayout(pHLayout);
14 | //pHLayout->addWidget(new QLabel(u8"当前壁纸路径:"));
15 | pHLayout->addWidget(&m_pathEdit);
16 | m_pathEdit.setReadOnly(true);
17 | pLayout->addWidget(&m_imgLabel);
18 | }
19 |
20 | CWallpapaerWidget::~CWallpapaerWidget()
21 | {}
22 |
23 | void CWallpapaerWidget::SetWallpaper(const QString & strPath)
24 | {
25 | m_pathEdit.setText(strPath);
26 | m_imgLabel.SetImage(QPixmap(strPath));
27 | }
28 |
29 | QString CWallpapaerWidget::GetWallpaperPath()
30 | {
31 | return m_pathEdit.text();
32 | }
33 |
--------------------------------------------------------------------------------
/code/WallpaperTool/MainWidget.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include "WallpapaerWidget.h"
6 | #include
7 |
8 | class MainWidget : public QMainWindow
9 | {
10 | Q_OBJECT
11 |
12 | public:
13 | MainWidget(QWidget *parent = nullptr);
14 | ~MainWidget();
15 | //设置所有壁纸的路径
16 | void SetWallpapers(QList& wallpapersPath);
17 | bool IsGridLayout() const { return m_isGridLayout; }
18 |
19 | //回到宫格布局
20 | void ShowGridLayout();
21 |
22 | int GetWallpaperNum();
23 |
24 | signals:
25 | //布局在单窗口布局和宫格布局间发生了变化。
26 | //bGrid: 如果改变后的布局为宫格布局,则为true,否则为false
27 | //curWallpapaerPath:bGrid为false时有效,表示当前选中的壁纸路径
28 | void widgetLayoutChanged(bool bGrid, const QString& curWallpapaerPath);
29 |
30 | private slots:
31 | void OnWallpapaerWidgetClicked();
32 |
33 | private:
34 | QList m_wallpaperWidgets;
35 | QGridLayout* m_pLayout;
36 | bool m_isGridLayout{ true };
37 | };
38 |
--------------------------------------------------------------------------------
/code/PixelRuler/MainWidget.cpp:
--------------------------------------------------------------------------------
1 | #include "MainWidget.h"
2 | #include
3 | #include "RulerDrawer.h"
4 | #include "PixelRuler.h"
5 | #include "define.h"
6 |
7 | CMainWidget::CMainWidget(QWidget* parent)
8 | : QWidget(parent)
9 | {
10 | }
11 |
12 | CMainWidget::~CMainWidget()
13 | {}
14 |
15 | void CMainWidget::paintEvent(QPaintEvent * event)
16 | {
17 | QPainter painter(this);
18 | int scalePercent = PixelRuler::Instance()->GetScalePercent();
19 | CRulerDrawer drawer(painter, rect(), scalePercent);
20 | drawer.Draw(CRulerDrawer::Top);
21 | drawer.Draw(CRulerDrawer::Bottom);
22 | drawer.Draw(CRulerDrawer::Left);
23 | drawer.Draw(CRulerDrawer::Right);
24 |
25 | QRect scaleRect = rect();
26 | scaleRect.setLeft(scaleRect.right() - DPI(170));
27 | scaleRect.setTop(scaleRect.bottom() - DPI(65));
28 | painter.save();
29 | QString unitStr = QString(u8"当前缩放比例:%1%").arg(scalePercent);
30 | painter.drawText(scaleRect, unitStr);
31 | painter.restore();
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/code/PixelRuler/PixelRuler.pro:
--------------------------------------------------------------------------------
1 | # ----------------------------------------------------
2 | # This file is generated by the Qt Visual Studio Tools.
3 | # ------------------------------------------------------
4 |
5 | QT += core gui widgets
6 | CONFIG += c++11 plugin
7 |
8 | TEMPLATE = lib
9 | TARGET = PixelRuler
10 | CONFIG(debug, debug|release): {
11 | DESTDIR = $$PWD/../../bin/debug
12 | LIBS += -L$$PWD/../../bin/debug \
13 | -lCCommonTools
14 | }
15 | else {
16 | DESTDIR = $$PWD/../../bin/release
17 | LIBS += -L$$PWD/../../bin/release \
18 | -lCCommonTools
19 | }
20 | DEFINES += PIXELRULER_LIB
21 | #HEADERS += $$PWD/*.h
22 | #SOURCES += $$PWD/*.cpp
23 | RESOURCES += PixelRuler.qrc
24 |
25 | INCLUDEPATH += $$PWD/../../include
26 |
27 | HEADERS += \
28 | MainWidget.h \
29 | PixelRuler.h \
30 | RulerDrawer.h \
31 | RulerWidget.h \
32 | pixelruler_global.h
33 |
34 | SOURCES += \
35 | MainWidget.cpp \
36 | PixelRuler.cpp \
37 | RulerDrawer.cpp \
38 | RulerWidget.cpp
39 |
--------------------------------------------------------------------------------
/code/KeyboardTester/KeyboardTester.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "KeyboardTester_global.h"
4 | #include "moduleinterface.h"
5 | #include "mainframeinterface.h"
6 | #include
7 |
8 |
9 | class KEYBOARDTESTER_EXPORT KeyboardTester : public IModule
10 | {
11 | public:
12 | KeyboardTester();
13 | static KeyboardTester* Instance();
14 |
15 | // 通过 IModule 继承
16 | virtual void InitInstance() override;
17 | virtual void UiInitComplete(IMainFrame* pMainFrame) override;
18 | virtual void UnInitInstance() override;
19 | virtual void* GetMainWindow() override;
20 | virtual eMainWindowType GetMainWindowType() const override;
21 | virtual const char* GetModuleName() override;
22 | virtual void OnCommand(const char* strCmd, bool checked) override;
23 |
24 | private:
25 | QWebEngineView m_mainWidget;
26 | IMainFrame* m_pMainFrame{};
27 | };
28 |
29 | #ifdef __cplusplus
30 | extern "C" {
31 | #endif
32 | Q_DECL_EXPORT IModule* CreateInstance();
33 | #ifdef __cplusplus
34 | }
35 | #endif
36 |
--------------------------------------------------------------------------------
/code/PasswordGeneratorApi/PasswordGeneratorImp.h:
--------------------------------------------------------------------------------
1 | // PasswordGeneratorApi.h
2 |
3 | #pragma once
4 | #include
5 | #include "moduleinterface.h"
6 |
7 | using namespace System;
8 | using namespace PasswordGenerator;
9 |
10 | namespace PasswordGeneratorApi {
11 |
12 | public class CPasswordGenerator : public IModule
13 | {
14 | public:
15 | // 通过 IModule 继承
16 | virtual void InitInstance() override;
17 | virtual void UnInitInstance() override;
18 | virtual void UiInitComplete(IMainFrame* pMainFrame) override;
19 | virtual void* GetMainWindow() override;
20 | virtual eMainWindowType GetMainWindowType() const override;
21 | virtual const char* GetModuleName() override;
22 | virtual void OnCommand(const char* strCmd, bool checked) override;
23 | };
24 | }
25 |
26 | #ifdef __cplusplus
27 | extern "C" {
28 | #endif
29 | //导出一个名为CreateInstance的函数以创建对象
30 | __declspec(dllexport) IModule* CreateInstance();
31 |
32 | #ifdef __cplusplus
33 | }
34 | #endif
35 |
--------------------------------------------------------------------------------
/code/DeveloperTools/main.cpp:
--------------------------------------------------------------------------------
1 | #include "MainFrame.h"
2 | #include
3 | #include "define.h"
4 | #include
5 |
6 | void SetSharedMemoryData(QSharedMemory& shared, char data)
7 | {
8 | if (shared.size() >= 1)
9 | {
10 | char* strData = (char*)shared.data();
11 | strData[0] = data;
12 | }
13 | }
14 |
15 |
16 | int main(int argc, char *argv[])
17 | {
18 | QApplication a(argc, argv);
19 | a.setApplicationName(APP_NAME);
20 |
21 | //设置只能运行一个实例
22 | QSharedMemory shared("{53abf396-999b-438b-b480-7a22a8773409}");
23 | if (shared.attach())
24 | {
25 | //将共享内存的第一个字节为1
26 | SetSharedMemoryData(shared, 1);
27 | return 0;
28 | }
29 | shared.create(1);
30 | SetSharedMemoryData(shared, 0);
31 |
32 | QStringList cmdLine;
33 | for (int i = 0; i < argc; i++)
34 | cmdLine.push_back(argv[i]);
35 |
36 | MainFrame w(cmdLine);
37 | w.SetSharedMemory(&shared);
38 | w.show();
39 |
40 | return a.exec();
41 | }
42 |
--------------------------------------------------------------------------------
/code/WallpaperTool/HistoryWallpaperMgr.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 | #include
5 | #include
6 | #define HISTORY_WALLPAPER_MAX 200
7 |
8 | class CHistoryWallpaperMgr
9 | {
10 | public:
11 | void AddWallpapers(const QStringList& wallpapers);
12 | void Load();
13 | void Save() const;
14 |
15 | const QStringList& GetHistoryWallpapers() const;
16 | void RemoveRecord(const QString& wallpaperPath);
17 |
18 | private:
19 | QStringList m_historyWallpapers; //历史壁纸列表
20 |
21 | };
22 |
23 | //////////////////////////////////////////////////////////////////////////
24 | class HistoryWallpaperSearchThread : public QThread
25 | {
26 | public:
27 | HistoryWallpaperSearchThread(CHistoryWallpaperMgr& manager);
28 |
29 | const QIcon& GetWallpaperIcon(const QString& path);
30 |
31 | bool StartThread();
32 |
33 | protected:
34 | virtual void run() override;
35 |
36 | private:
37 | QMap m_imageMap; //保存所有壁纸的图片
38 | CHistoryWallpaperMgr& m_manager;
39 | };
40 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 zhongyang219
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 |
--------------------------------------------------------------------------------
/code/AddCodeHeader/AddFileHeadThread.cpp:
--------------------------------------------------------------------------------
1 | #include "AddFileHeadThread.h"
2 | #include "AddCodeHeader.h"
3 |
4 | CAddFileHeadThread::CAddFileHeadThread(QObject *parent)
5 | : QThread(parent)
6 | {
7 | }
8 |
9 | CAddFileHeadThread::~CAddFileHeadThread()
10 | {
11 | }
12 |
13 | void CAddFileHeadThread::Stop()
14 | {
15 | m_stoped = true;
16 | }
17 |
18 | bool CAddFileHeadThread::IsStopped()
19 | {
20 | return m_stoped;
21 | }
22 |
23 | void CAddFileHeadThread::run()
24 | {
25 | //m_removeResult = CRemoveCommentHelper::RemoveResult();
26 | //m_fileCount = AddCodeHeader::GetInstance()->GetEditor().RemoveComments(m_removeResult);
27 | QStringList filePathList = AddCodeHeader::GetInstance()->GetEditor().GetFilePathList();
28 | m_fileCount = 0;
29 | eOutputFormat outputFormat = AddCodeHeader::GetInstance()->GetEditor().GetOutputFormat();
30 | for (const QString& filePath : filePathList)
31 | {
32 | m_helper.AddFileHead(filePath, outputFormat);
33 | m_fileCount++;
34 | AddCodeHeader::GetInstance()->GetEditor().signalRemoveCommentProgress(m_fileCount * 100 / filePathList.size());
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/code/FileRename/MainWidget.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include "ui_MainWidget.h"
5 | #include "../CCommonTools/tableitemmodel.h"
6 |
7 |
8 | class MainWidget : public QWidget
9 | {
10 | Q_OBJECT
11 |
12 | public:
13 | MainWidget(QWidget *parent = nullptr);
14 | ~MainWidget();
15 |
16 | enum Column
17 | {
18 | COL_FILENAME,
19 | COL_FILEPATH,
20 | COL_NEW_NAME,
21 | COL_MAX
22 | };
23 |
24 | void LoadConfig();
25 | void SaveConfig() const;
26 |
27 | int ExcuteFileRename();
28 |
29 | void AddFile(const QString& filePath);
30 | void AddFolder(const QString& folderPath);
31 | QStringList GetFileList() const;
32 | CTableItemModel& GetModel();
33 | QTableView* GetTableView();
34 |
35 | protected:
36 | virtual void dragEnterEvent(QDragEnterEvent* event) override;
37 | virtual void dropEvent(QDropEvent* event) override;
38 |
39 | private slots:
40 | void OnSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
41 |
42 | private:
43 | Ui::MainWidgetClass ui;
44 | CTableItemModel m_model{ COL_MAX };
45 | };
46 |
--------------------------------------------------------------------------------
/code/CCommonTools/CCommonTools.pro:
--------------------------------------------------------------------------------
1 | # ----------------------------------------------------
2 | # This file is generated by the Qt Visual Studio Tools.
3 | # ------------------------------------------------------
4 |
5 | QT += core sql widgets
6 | CONFIG += c++11
7 | TEMPLATE = lib
8 | TARGET = CCommonTools
9 |
10 | CONFIG(debug, debug|release): {
11 | DESTDIR = $$PWD/../../bin/debug
12 | }
13 | else {
14 | DESTDIR = $$PWD/../../bin/release
15 | }
16 | DEFINES += CCOMMONTOOLS_LIB
17 | #HEADERS += $$PWD/*.h
18 | #SOURCES += $$PWD/*.cpp
19 | #RESOURCES += $$PWD/*.qrc
20 | INCLUDEPATH += $$PWD/../../include
21 |
22 | RESOURCES += \
23 | Resource.qrc
24 |
25 | HEADERS += \
26 | CommonTools.h \
27 | Config.h \
28 | DatabaseTool.h \
29 | LongTextEdit.h \
30 | StringHelper.h \
31 | TextEditWidget.h \
32 | PathListDialog.h \
33 | TreeItem.h \
34 | ccommontools_global.h \
35 | tableitemmodel.h \
36 | DialogBase.h \
37 | treeitemmodel.h
38 |
39 | SOURCES += \
40 | CommonTools.cpp \
41 | Config.cpp \
42 | DatabaseTool.cpp \
43 | LongTextEdit.cpp \
44 | StringHelper.cpp \
45 | TextEditWidget.cpp \
46 | PathListDialog.cpp \
47 | TreeItem.cpp \
48 | tableitemmodel.cpp \
49 | DialogBase.cpp \
50 | treeitemmodel.cpp
51 |
--------------------------------------------------------------------------------
/code/FileRename/FileRename.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "filerename_global.h"
4 | #include "moduleinterface.h"
5 | #include "mainframeinterface.h"
6 | #include "MainWidget.h"
7 |
8 | #define CMD_FileRenameAddFiles "FileRenameAddFiles"
9 | #define CMD_FileRenameAddFolder "FileRenameAddFolder"
10 | #define CMD_FileRenameDelete "FileRenameDelete"
11 | #define CMD_FileRenameClear "FileRenameClear"
12 | #define CMD_RenameWithModifiedTime "RenameWithModifiedTime"
13 |
14 | class FILERENAME_EXPORT FileRename : public IModule
15 | {
16 | public:
17 | FileRename();
18 | static FileRename* Instance();
19 | IMainFrame* GetMainFrame();
20 |
21 | // 通过 IModule 继承
22 | virtual void InitInstance() override;
23 | virtual void UiInitComplete(IMainFrame* pMainFrame) override;
24 | virtual void UnInitInstance() override;
25 | virtual void* GetMainWindow() override;
26 | virtual eMainWindowType GetMainWindowType() const override;
27 | virtual const char* GetModuleName() override;
28 | virtual void OnCommand(const char* strCmd, bool checked) override;
29 |
30 | private:
31 | MainWidget m_mainWidget;
32 | IMainFrame* m_pMainFrame{};
33 | };
34 |
35 | #ifdef __cplusplus
36 | extern "C" {
37 | #endif
38 | Q_DECL_EXPORT IModule* CreateInstance();
39 | #ifdef __cplusplus
40 | }
41 | #endif
42 |
--------------------------------------------------------------------------------
/code/KeyboardTester/KeyboardTester.cpp:
--------------------------------------------------------------------------------
1 | #include "KeyboardTester.h"
2 | #include
3 | #include
4 | #include
5 |
6 | static KeyboardTester* pIns = nullptr;
7 | KeyboardTester::KeyboardTester()
8 | {
9 | }
10 |
11 | KeyboardTester* KeyboardTester::Instance()
12 | {
13 | return pIns;
14 | }
15 |
16 | void KeyboardTester::InitInstance()
17 | {
18 | m_mainWidget.load(QUrl("qrc:/res/index.html"));
19 | qreal factor = QGuiApplication::primaryScreen()->logicalDotsPerInch() / 96.0;
20 | m_mainWidget.setZoomFactor(factor);
21 | }
22 |
23 | void KeyboardTester::UiInitComplete(IMainFrame* pMainFrame)
24 | {
25 | m_pMainFrame = pMainFrame;
26 | }
27 |
28 | void KeyboardTester::UnInitInstance()
29 | {
30 | }
31 |
32 | void* KeyboardTester::GetMainWindow()
33 | {
34 | return &m_mainWidget;
35 | }
36 |
37 | IModule::eMainWindowType KeyboardTester::GetMainWindowType() const
38 | {
39 | return IModule::MT_QWIDGET;
40 | }
41 |
42 | const char* KeyboardTester::GetModuleName()
43 | {
44 | return "KeyboardTester";
45 | }
46 |
47 | void KeyboardTester::OnCommand(const char* strCmd, bool checked)
48 | {
49 | QString cmd(QString::fromUtf8(strCmd));
50 | }
51 |
52 |
53 | IModule* CreateInstance()
54 | {
55 | pIns = new KeyboardTester();
56 | return pIns;
57 | }
58 |
--------------------------------------------------------------------------------
/code/CCommonTools/TextEditWidget.cpp:
--------------------------------------------------------------------------------
1 | #include "TextEditWidget.h"
2 | #include
3 | #include
4 | #include
5 |
6 | CTextEditDialog::CTextEditDialog(QWidget*parent, bool showButtons)
7 | : QDialog(parent)
8 | {
9 | QVBoxLayout* pLayout = new QVBoxLayout;
10 | setLayout(pLayout);
11 | pLayout->addWidget(m_label = new QLabel(this));
12 | pLayout->addWidget(m_edit = new QTextEdit(this));
13 | m_label->hide();
14 | if (showButtons)
15 | {
16 | QHBoxLayout* pButtonsLayout = new QHBoxLayout;
17 | pLayout->addLayout(pButtonsLayout);
18 | QPushButton* pOkBtn = new QPushButton(u8"确定", this);
19 | QPushButton* pCancelBtn = new QPushButton(u8"取消", this);
20 | connect(pOkBtn, SIGNAL(clicked()), this, SLOT(accept()));
21 | connect(pCancelBtn, SIGNAL(clicked()), this, SLOT(reject()));
22 | pButtonsLayout->addStretch();
23 | pButtonsLayout->addWidget(pOkBtn);
24 | pButtonsLayout->addWidget(pCancelBtn);
25 | }
26 | }
27 |
28 | CTextEditDialog::~CTextEditDialog()
29 | {}
30 |
31 | void CTextEditDialog::SetLabelText(const QString& text)
32 | {
33 | m_label->setVisible(!text.isEmpty());
34 | m_label->setText(text);
35 | }
36 |
37 | QTextEdit* CTextEditDialog::GetEdit()
38 | {
39 | return m_edit;
40 | }
41 |
--------------------------------------------------------------------------------
/code/AddCodeHeader/RemoveCommentHelper.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 | class CRemoveCommentHelper
5 | {
6 | public:
7 | CRemoveCommentHelper();
8 |
9 | //移除注释的结果
10 | struct RemoveResult
11 | {
12 | int single_line_comment_removed{};
13 | int multi_line_comment_removed{};
14 | int space_removed{};
15 | int return_removed{};
16 |
17 | void operator+=(const RemoveResult result)
18 | {
19 | single_line_comment_removed += result.single_line_comment_removed;
20 | multi_line_comment_removed += result.multi_line_comment_removed;
21 | space_removed += result.space_removed;
22 | return_removed += result.return_removed;
23 | }
24 | };
25 |
26 | static bool RemoveFileComment(const QString& file_path, bool removeComment, bool bRemoveSpace, bool bRemoveReturn, int keepReturnNum, RemoveResult& result);
27 | static void RemoveComment(QByteArray& file_contents, bool removeComment, bool bRemoveSpace, bool bRemoveReturn, int keepReturnNum, RemoveResult& result);
28 |
29 | private:
30 | static int FindFirstOf(const QByteArray& contents, const QByteArray& strFind, int index);
31 | static int FindStringNotInQuotation(const QByteArray& contents, const char* strFind, int index); //查找指定字符串,但是确保指定的字符串不在引号内
32 | };
33 |
--------------------------------------------------------------------------------
/code/AddCodeHeader/AddCodeHeader.pro:
--------------------------------------------------------------------------------
1 | # ----------------------------------------------------
2 | # This file is generated by the Qt Visual Studio Tools.
3 | # ------------------------------------------------------
4 |
5 | QT += core gui widgets
6 | CONFIG += c++11 plugin
7 |
8 | TEMPLATE = lib
9 | TARGET = AddCodeHeader
10 | CONFIG(debug, debug|release): {
11 | DESTDIR = $$PWD/../../bin/debug
12 | LIBS += -L$$PWD/../../bin/debug \
13 | -lCCommonTools
14 | }
15 | else {
16 | DESTDIR = $$PWD/../../bin/release
17 | LIBS += -L$$PWD/../../bin/release \
18 | -lCCommonTools
19 | }
20 | DEFINES += ADDCODEHEADER_LIB
21 | #HEADERS += $$PWD/*.h
22 | #SOURCES += $$PWD/*.cpp
23 |
24 | INCLUDEPATH += $$PWD/../../include
25 |
26 | HEADERS += \
27 | AddCodeHeader.h \
28 | AddCodeHeaderEditor.h \
29 | AddFileHeadThread.h \
30 | CRemoveCommentThread.h \
31 | CommonData.h \
32 | FileHeadHelper.h \
33 | HeadItemTableModel.h \
34 | MainWidget.h \
35 | RemoveCommentHelper.h \
36 | Test.h \
37 | addcodeheader_global.h
38 |
39 | SOURCES += \
40 | AddCodeHeader.cpp \
41 | AddCodeHeaderEditor.cpp \
42 | AddFileHeadThread.cpp \
43 | CRemoveCommentThread.cpp \
44 | CommonData.cpp \
45 | FileHeadHelper.cpp \
46 | HeadItemTableModel.cpp \
47 | MainWidget.cpp \
48 | RemoveCommentHelper.cpp \
49 | Test.cpp
50 |
--------------------------------------------------------------------------------
/code/WallpaperTool/WallpaperTool.pro:
--------------------------------------------------------------------------------
1 | # ----------------------------------------------------
2 | # This file is generated by the Qt Visual Studio Tools.
3 | # ------------------------------------------------------
4 |
5 | QT += core gui widgets
6 | CONFIG += c++11 plugin
7 | TEMPLATE = lib
8 | TARGET = WallpaperTool
9 | DEFINES += WALLPAPERTOOL_LIB
10 | CONFIG(debug, debug|release): {
11 | DESTDIR = $$PWD/../../bin/debug
12 | LIBS += -L$$PWD/../../bin/debug \
13 | -lCCommonTools
14 | }
15 | else {
16 | DESTDIR = $$PWD/../../bin/release
17 | LIBS += -L$$PWD/../../bin/release \
18 | -lCCommonTools
19 | }
20 |
21 | win32{
22 | LIBS += -lOle32 -lAdvapi32
23 | }
24 |
25 | #HEADERS += $$PWD/*.h
26 | #SOURCES += $$PWD/*.cpp
27 | #FORMS += $$PWD/*.ui
28 |
29 | INCLUDEPATH += $$PWD/../../include
30 |
31 | FORMS +=
32 |
33 | HEADERS += \
34 | HistoryWallpaperMgr.h \
35 | HistoryWallpaperWidget.h \
36 | ImageLabel.h \
37 | MainWidget.h \
38 | SettingsDlg.h \
39 | WallpapaerWidget.h \
40 | WallpaperHelper.h \
41 | WallpaperTool.h \
42 | wallpapertool_global.h
43 |
44 | SOURCES += \
45 | HistoryWallpaperMgr.cpp \
46 | HistoryWallpaperWidget.cpp \
47 | ImageLabel.cpp \
48 | MainWidget.cpp \
49 | SettingsDlg.cpp \
50 | WallpapaerWidget.cpp \
51 | WallpaperHelper.cpp \
52 | WallpaperTool.cpp
53 |
54 | RESOURCES += \
55 | WallpaperTool.qrc
56 |
--------------------------------------------------------------------------------
/include/define.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | #include
4 |
5 | inline int DPI(int x)
6 | {
7 | return QGuiApplication::primaryScreen()->logicalDotsPerInch() * x / 96;
8 | }
9 |
10 | #define APP_NAME "DeveloperTools"
11 | #define APP_VERSION "0.3.0"
12 |
13 | ///////////////////////////////////////////////////////////////////////////
14 | //定义安全删除指针的宏
15 | #ifndef SAFE_DELETE
16 | #define SAFE_DELETE(p) do \
17 | {\
18 | if(p != nullptr) \
19 | { \
20 | delete p; \
21 | p = nullptr; \
22 | } \
23 | } while (false)
24 | #endif
25 |
26 | // 简单接口定义宏
27 | #if !defined(DECLARE_CLASS_ATTR)
28 |
29 | //定义类的Get和Set的简单接口
30 | //func_name: 函数名(除了“Get”或“Set”以外的部分)
31 | //mem_name: 成员变量名
32 | //type: 变量类型
33 | #define DECLARE_CLASS_ATTR(func_name,mem_name,type) \
34 | type Get##func_name()const \
35 | { \
36 | return mem_name; \
37 | } \
38 | void Set##func_name(const type& input) \
39 | { \
40 | mem_name = input; \
41 | }
42 |
43 | #endif
44 |
45 | #if !defined(DECLARE_CLASS_SET_ATTR)
46 | //定义类的Set的简单接口
47 | #define DECLARE_CLASS_SET_ATTR(func_name,mem_name,type) \
48 | void Set##func_name(const type& input) \
49 | { \
50 | mem_name = input; \
51 | }
52 |
53 | #endif
54 |
55 | #if !defined(DECLARE_CLASS_GET_ATTR)
56 | //定义类的Get的简单接口
57 | #define DECLARE_CLASS_GET_ATTR(func_name,mem_name,type) \
58 | type Get##func_name()const \
59 | { \
60 | return mem_name; \
61 | }
62 | #endif
63 |
--------------------------------------------------------------------------------
/code/KeyboardTester/KeyboardTester.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | qml;cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | qrc;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 | {99349809-55BA-4b9d-BF79-8FDBB0286EB3}
18 | ui
19 |
20 |
21 |
22 |
23 | Source Files
24 |
25 |
26 | Header Files
27 |
28 |
29 |
30 |
31 | Header Files
32 |
33 |
34 |
35 |
36 | Resource Files
37 |
38 |
39 |
--------------------------------------------------------------------------------
/code/AddCodeHeader/AddCodeHeader.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "addcodeheader_global.h"
4 | #include "moduleinterface.h"
5 | #include "MainWidget.h"
6 | #include "AddCodeHeaderEditor.h"
7 | #include "CRemoveCommentThread.h"
8 | #include
9 | #include "mainframeinterface.h"
10 | #include "AddFileHeadThread.h"
11 |
12 | class ADDCODEHEADER_EXPORT AddCodeHeader
13 | : public QObject, public IModule
14 | {
15 | Q_OBJECT
16 | public:
17 | AddCodeHeader();
18 |
19 | virtual void InitInstance() override;
20 | virtual void UnInitInstance() override;
21 | virtual void UiInitComplete(IMainFrame* pMainFrame) override;
22 | virtual void* GetMainWindow() override;
23 | virtual const char* GetModuleName() override;
24 | virtual void OnCommand(const char* strCmd, bool checked) override;
25 | virtual eMainWindowType GetMainWindowType() const override;
26 | virtual void OnTabEntered() override;
27 |
28 | static AddCodeHeader* GetInstance();
29 |
30 | CAddCodeHeaderEditor& GetEditor();
31 | CRemoveCommentThread& GetRemoveCommentThread();
32 | IMainFrame* GetMainFrame() const;
33 |
34 | void EnableControl(bool enable);
35 |
36 | private slots:
37 | void OnRemoveCommentsComplete();
38 | void OnAddFileHeadComplete();
39 |
40 | private:
41 | CMainWidget m_mainWidget;
42 | CAddCodeHeaderEditor m_editor;
43 | CRemoveCommentThread m_removeCommentThread;
44 | CAddFileHeadThread m_addFileHeadThread;
45 | IMainFrame* m_pMainFrame;
46 |
47 | static AddCodeHeader* m_pInstance;
48 | };
49 |
50 | #ifdef __cplusplus
51 | extern "C" {
52 | #endif
53 | //导出一个名为CreateInstance的函数以创建对象
54 | ADDCODEHEADER_EXPORT IModule* CreateInstance();
55 |
56 | #ifdef __cplusplus
57 | }
58 | #endif
59 |
--------------------------------------------------------------------------------
/code/PixelRuler/PixelRuler.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "pixelruler_global.h"
4 | #include "moduleinterface.h"
5 | #include "mainframeinterface.h"
6 | #include "MainWidget.h"
7 | #include "RulerWidget.h"
8 |
9 | #define CMD_SystemScaleCheck "SystemScaleCheck"
10 | #define CMD_UserScaleCombo "UserScaleCombo"
11 | #define CMD_ShowHorizontalRuler "ShowHorizontalRuler"
12 | #define CMD_ShowVerticalRuler "ShowVerticalRuler"
13 | #define CMD_ScaleUnit10Pixel "ScaleUnit10Pixel"
14 | #define CMD_ScaleUnit8Pixel "ScaleUnit8Pixel"
15 | #define CMD_PixelRulerHelp "PixelRulerHelp"
16 |
17 | class PIXELRULER_EXPORT PixelRuler : public IModule
18 | {
19 | public:
20 | PixelRuler();
21 | static PixelRuler* Instance();
22 | int GetScalePercent();
23 | int GetScaleUnitSize();
24 | void Repaint();
25 |
26 | // 通过 IModule 继承
27 | virtual void InitInstance() override;
28 | virtual void UnInitInstance() override;
29 | virtual void UiInitComplete(IMainFrame* pMainFrame) override;
30 | virtual void* GetMainWindow() override;
31 | virtual eMainWindowType GetMainWindowType() const override;
32 | virtual const char* GetModuleName() override;
33 | virtual void OnCommand(const char* strCmd, bool checked) override;
34 | void OnItemChanged(const char* strId, int index, const char* text) override;
35 | virtual void OnAppExit() override;
36 |
37 | private:
38 | void EnableControl();
39 |
40 | private:
41 | CMainWidget m_mainWidget;
42 | CRulerWidget m_horizontalRuler{ Qt::Horizontal };
43 | CRulerWidget m_verticalRuler{ Qt::Vertical };
44 | IMainFrame* m_pMainFrame{};
45 | };
46 |
47 | #ifdef __cplusplus
48 | extern "C" {
49 | #endif
50 | Q_DECL_EXPORT IModule* CreateInstance();
51 | #ifdef __cplusplus
52 | }
53 | #endif
54 |
--------------------------------------------------------------------------------
/code/PasswordGeneratorApi/ReadMe.txt:
--------------------------------------------------------------------------------
1 | ========================================================================
2 | DYNAMIC LINK LIBRARY : PasswordGeneratorApi Project Overview
3 | ========================================================================
4 |
5 | AppWizard has created this PasswordGeneratorApi DLL for you.
6 |
7 | This file contains a summary of what you will find in each of the files that
8 | make up your PasswordGeneratorApi application.
9 |
10 | PasswordGeneratorApi.vcxproj
11 | This is the main project file for VC++ projects generated using an Application Wizard.
12 | It contains information about the version of Visual C++ that generated the file, and
13 | information about the platforms, configurations, and project features selected with the
14 | Application Wizard.
15 |
16 | PasswordGeneratorApi.vcxproj.filters
17 | This is the filters file for VC++ projects generated using an Application Wizard.
18 | It contains information about the association between the files in your project
19 | and the filters. This association is used in the IDE to show grouping of files with
20 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the
21 | "Source Files" filter).
22 |
23 | PasswordGeneratorApi.cpp
24 | This is the main DLL source file.
25 |
26 | PasswordGeneratorApi.h
27 | This file contains a class declaration.
28 |
29 | AssemblyInfo.cpp
30 | Contains custom attributes for modifying assembly metadata.
31 |
32 | /////////////////////////////////////////////////////////////////////////////
33 | Other notes:
34 |
35 | AppWizard uses "TODO:" to indicate parts of the source code you
36 | should add to or customize.
37 |
38 | /////////////////////////////////////////////////////////////////////////////
39 |
--------------------------------------------------------------------------------
/code/PasswordGeneratorApi/PasswordGeneratorApi.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 |
18 |
19 | 头文件
20 |
21 |
22 | 头文件
23 |
24 |
25 | 头文件
26 |
27 |
28 | 头文件
29 |
30 |
31 |
32 |
33 | 源文件
34 |
35 |
36 | 源文件
37 |
38 |
39 | 源文件
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 | 资源文件
48 |
49 |
50 |
51 |
52 | 资源文件
53 |
54 |
55 |
--------------------------------------------------------------------------------
/code/FileRename/FileRename.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | qml;cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | qrc;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 | {99349809-55BA-4b9d-BF79-8FDBB0286EB3}
18 | ui
19 |
20 |
21 |
22 |
23 | Header Files
24 |
25 |
26 | Source Files
27 |
28 |
29 | Header Files
30 |
31 |
32 | Header Files
33 |
34 |
35 |
36 |
37 | Source Files
38 |
39 |
40 | Source Files
41 |
42 |
43 |
44 |
45 | Header Files
46 |
47 |
48 |
49 |
50 | Form Files
51 |
52 |
53 |
--------------------------------------------------------------------------------
/code/AddCodeHeader/HeadItemTableModel.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 | #include "CommonData.h"
7 |
8 | class CHeadItemTableModel : public QAbstractTableModel
9 | {
10 | Q_OBJECT
11 |
12 | public:
13 | CHeadItemTableModel(QObject *parent = nullptr);
14 | ~CHeadItemTableModel();
15 |
16 | // Header:
17 | QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
18 |
19 | // Basic functionality:
20 | int rowCount(const QModelIndex &parent = QModelIndex()) const override;
21 | int columnCount(const QModelIndex &parent = QModelIndex()) const override;
22 |
23 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
24 |
25 | // Editable:
26 | bool setData(const QModelIndex &index, const QVariant &value,
27 | int role = Qt::EditRole) override;
28 |
29 | Qt::ItemFlags flags(const QModelIndex& index) const override;
30 |
31 |
32 | enum eFileHeadTableCol
33 | {
34 | COL_HEAD_ITEM_NAME,
35 | COL_HEAD_ITEM_VALUE,
36 | COL_HEAD_ITEM_MAX
37 | };
38 |
39 | QList& GetData();
40 |
41 | void AddItem();
42 |
43 | //序列化
44 | QByteArray ToByteArray() const;
45 |
46 | //反序列化
47 | void FromByteArray(const QByteArray& byteArray);
48 |
49 | private:
50 | void AppendItemIfNotExist(eHeadItem item);
51 |
52 | private:
53 | QList m_data;
54 | };
55 |
56 |
57 |
58 | class CHeadItemDelegate : public QStyledItemDelegate
59 | {
60 | Q_OBJECT
61 | // QAbstractItemDelegate interface
62 | public:
63 | virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
64 | virtual void setEditorData(QWidget *editor, const QModelIndex &index) const override;
65 | virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
66 |
67 | private:
68 | mutable QVariant m_curEditData;
69 | };
70 |
--------------------------------------------------------------------------------
/code/CCommonTools/DatabaseTool.h:
--------------------------------------------------------------------------------
1 | #ifndef CDATABASEOPERATOR_H
2 | #define CDATABASEOPERATOR_H
3 |
4 | #include "ccommontools_global.h"
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | //用于数据库读写的基类
12 | //继承此类并重写虚函数后可以实现对数据库中一张表的读写
13 | class CCOMMONTOOLS_EXPORT CDataBaseTool
14 | {
15 | public:
16 | CDataBaseTool();
17 | CDataBaseTool(const QSqlDatabase& database);
18 |
19 | public:
20 | virtual const char* GetTableName() = 0; //获取表的名称
21 | virtual void GetTableColumeList(QMap& mapColList) = 0; //获取表的列,key是列的名称,value是类型
22 | virtual const char* GetPrimaryKey() = 0; //获取主键的名称
23 |
24 | void CreateTable(); //初始化数据库表
25 |
26 | //执行一句SQL语句,成功返回true,否则返回false
27 | bool ExecuteSql(const QString& strSql);
28 |
29 | //执行一句SQL语句,返回QSqlQuery对象
30 | QSqlQuery ExecuteSql2(const QString& strSql);
31 |
32 | //查询一个值
33 | //primaryValue:主键的值
34 | //strKey:要查询的值
35 | virtual QVariant QueryValue(QVariant primaryValue, const char* strKey);
36 |
37 | //查询表中所有项目的主键
38 | void QueryPrimaryKeyList(QVariantList& keyList);
39 |
40 | //查询整个表格
41 | void QueryWholeTable(QList>& listTable);
42 |
43 | //通过某个键键值查询数据
44 | void QueryValueByFiled(const char* strFiled, const QString& strValue, QList>& resList);
45 |
46 |
47 | //插入一行记录
48 | //mapColValues:该行每一列的值。key:数据库表格列的字段,value:字段的值
49 | virtual bool AddRecord(const QMap& mapColValues);
50 |
51 | //删除一行记录
52 | bool DeleteRecord(QVariant primaryValue);
53 |
54 | //判断一个记录是否存在于表中
55 | bool IsRecordExist(QVariant primaryValue);
56 |
57 | //更新一个值
58 | //primaryValue:数据行的主键
59 | //filed:要更新的字段
60 | //value:更新后的值
61 | virtual bool UpdateRecode(QVariant primaryValue, const char* filed, const QString& value);
62 |
63 | QVector GetFiled();
64 |
65 | private:
66 | QSqlDatabase m_database;
67 |
68 | };
69 |
70 | #endif // CDATABASEOPERATOR_H
71 |
--------------------------------------------------------------------------------
/code/WallpaperTool/ImageLabel.cpp:
--------------------------------------------------------------------------------
1 | #include "ImageLabel.h"
2 | #include
3 | #include
4 | #include
5 |
6 | CImageLabel::CImageLabel(QWidget* pParent)
7 | {
8 | }
9 |
10 | void CImageLabel::SetImage(const QPixmap& image)
11 | {
12 | m_image = image;
13 | update();
14 | }
15 |
16 | QRect CImageLabel::GetImageViewRect() const
17 | {
18 | return m_imageRect;
19 | }
20 |
21 | QSize CImageLabel::GetImageSize() const
22 | {
23 | return m_image.size();
24 | }
25 |
26 | void CImageLabel::paintEvent(QPaintEvent *e)
27 | {
28 | QPainter painter(this);
29 |
30 | ////绘制图像
31 | //painter.setRenderHint(QPainter::SmoothPixmapTransform, true);
32 |
33 | //使背景图片在主窗口中保持设定的比例,在这里计算背景图片的大小
34 | int x = 0, y = 0, w = 0, h = 0;
35 | const double picWidthHeightRatio = static_cast(m_image.width()) / m_image.height();
36 | double widthHeightRatio = static_cast(size().width()) / size().height(); //当前窗口的宽高比
37 | //如果图片比窗口小,则图片在窗口中居中显示
38 | if (m_image.width() <= size().width() && m_image.height() <= size().height())
39 | {
40 | x = (size().width() - m_image.width()) / 2;
41 | y = (size().height() - m_image.height()) / 2;
42 | w = m_image.width();
43 | h = m_image.height();
44 | }
45 | //否则计算图片的大小
46 | else
47 | {
48 | if (picWidthHeightRatio > widthHeightRatio) //如果背景图片的宽高比大于窗口的宽高比
49 | {
50 | w = size().width();
51 | h = m_image.height() * w / m_image.width();
52 | x = 0;
53 | y = (size().height() - h) / 2;
54 | }
55 | else //如果背景图片的宽高比小于窗口的宽高比
56 | {
57 | h = size().height();
58 | w = m_image.width() * h / m_image.height();
59 | y = 0;
60 | x = (size().width() - w) / 2;
61 | }
62 | }
63 | m_imageRect = QRect(x, y, w, h);
64 | QPixmap drawImage = m_image.scaled(w, h, Qt::KeepAspectRatio, Qt::SmoothTransformation);
65 | painter.drawPixmap(m_imageRect, drawImage, QRect(0, 0, w, h));
66 |
67 |
68 | QWidget::paintEvent(e);
69 | }
70 |
71 | void CImageLabel::mouseReleaseEvent(QMouseEvent* event)
72 | {
73 | if (event->button() == Qt::LeftButton)
74 | {
75 | emit clicked();
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/code/AddCodeHeader/AddCodeHeaderEditor.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include "MainWidget.h"
6 | #include "RemoveCommentHelper.h"
7 | #include "../CCommonTools/tableitemmodel.h"
8 | #include
9 | #include
10 | #include "mainframeinterface.h"
11 | #include "HeadItemTableModel.h"
12 | #include "CommonData.h"
13 |
14 | class CAddCodeHeaderEditor : public QObject
15 | {
16 | Q_OBJECT
17 |
18 | public:
19 | CAddCodeHeaderEditor(QObject *parent = Q_NULLPTR);
20 | ~CAddCodeHeaderEditor();
21 |
22 | //对界面进行初始化操作
23 | void ConnectWidget(CMainWidget* pWidget, IMainFrame* pMainFrame);
24 |
25 | //界面关闭时执行的操作
26 | void ExitWidget();
27 |
28 | void AdjustColumeWidth();
29 |
30 | //扫描文件
31 | void ScanFiles();
32 |
33 | //移除所有文件的注释
34 | //remove_result:保存结果
35 | //func:一个函数对象,参数为已处理的文件个数
36 | //返回值:总共已处理的文件个数
37 | int RemoveComments(CRemoveCommentHelper::RemoveResult& remove_result);
38 |
39 | QStringList GetFilePathList();
40 | eOutputFormat GetOutputFormat();
41 | CHeadItemTableModel& GetHeadItemTableModel();
42 |
43 | enum eFileListColume
44 | {
45 | COL_FILENAME,
46 | COL_FILEPATH,
47 | COL_EXTENSION,
48 |
49 | COL_MAX
50 | };
51 |
52 | enum eFileHeadTableCol
53 | {
54 | COL_HEAD_ITEM_NAME,
55 | COL_HEAD_ITEM_VALUE,
56 | COL_HEAD_ITEM_MAX
57 | };
58 |
59 | signals:
60 | void signalRemoveCommentProgress(double percent);
61 |
62 | private:
63 | void InitFileTable();
64 | void AddFile(const QFileInfo& fileInfo);
65 |
66 | private slots:
67 | void OnSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
68 | void OnAddFileBtnClicked();
69 | void OnRemoveFileBtnClicked();
70 | void OnClearFileBtnClicked();
71 |
72 | void OnTemplateMoveUpBtnClicked();
73 | void OnTemplateMoveDownBtnClicked();
74 |
75 | private:
76 | CTableItemModel m_fileListModel;
77 | CHeadItemTableModel m_fileHeadItemModel;
78 |
79 | CMainWidget* m_pWidget{};
80 | IMainFrame* m_pMainFrame{};
81 |
82 | };
83 |
--------------------------------------------------------------------------------
/code/WallpaperTool/WallpaperTool.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "wallpapertool_global.h"
4 | #include "moduleinterface.h"
5 | #include
6 | #include "MainWidget.h"
7 | #include "WallpaperHelper.h"
8 | #include "SettingsDlg.h"
9 | #include "HistoryWallpaperMgr.h"
10 | #include "HistoryWallpaperWidget.h"
11 | #include
12 | #include
13 |
14 | class WALLPAPERTOOL_EXPORT WallpaperTool
15 | : public QObject, public IModule
16 | {
17 | Q_OBJECT
18 | public:
19 | WallpaperTool();
20 |
21 | static WallpaperTool* Instance();
22 | IMainFrame* GetMainFrame();
23 | CHistoryWallpaperMgr& GetHistoryWallpaperMgr();
24 | HistoryWallpaperSearchThread& GetHistoryWallpaperThread();
25 | void WallpaperSaveAs(const QString& path);
26 |
27 | // 通过 IModule 继承
28 | virtual void InitInstance() override;
29 | virtual void UnInitInstance() override;
30 | virtual void UiInitComplete(IMainFrame* pMainFrame) override;
31 | virtual void* GetMainWindow() override;
32 | virtual eMainWindowType GetMainWindowType() const override;
33 | virtual const char* GetModuleName() override;
34 | virtual void OnCommand(const char* strCmd, bool checked) override;
35 |
36 | void WriteLog(const QString& strLogInfo);
37 | private:
38 | void Refresh();
39 | void EnableControls();
40 | virtual void timerEvent(QTimerEvent* event) override;
41 |
42 | private slots:
43 | void OnMainWindowLayoutChanged(bool bGrid, const QString& curWallpaperPath); //响应窗口布局改变(在单席位查看和宫格布局中切换)
44 |
45 | private:
46 | QStackedWidget m_mainStackedWidget;
47 | MainWidget* m_mainWidget;
48 | HistoryWallpaperWidget* m_historyWidget;
49 | IMainFrame* m_pMainFrame{};
50 | QString m_strCurWallpaperPath;
51 | QSet m_strLastSaveDirs; //上次壁纸的保存路径
52 | CWallpaperHelper m_helper;
53 | SettingsDlg::Data m_settings;
54 | CHistoryWallpaperMgr m_historyWallpapers;
55 | HistoryWallpaperSearchThread m_historyWallpaperThread{ m_historyWallpapers };
56 | int m_autoRefreshTimerId{};
57 | };
58 |
59 | #ifdef __cplusplus
60 | extern "C" {
61 | #endif
62 | Q_DECL_EXPORT IModule* CreateInstance();
63 | #ifdef __cplusplus
64 | }
65 | #endif
66 |
--------------------------------------------------------------------------------
/code/vc15_build_u.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | ..\..
6 | $(Platform)_vc15_$(Configuration)
7 |
8 |
9 | $(ParentPath)\bin\$(BuildFolder)\
10 |
11 |
12 | $(BuildFolder)\
13 |
14 |
15 | $(ParentPath)\BuildLog\$(BuildFolder)\$(ProjectName).htm
16 |
17 |
18 |
19 | $(BuildFolder)\
20 | $(BuildFolder)\
21 | $(BuildFolder)\
22 | ..\..\include;..\..\include\thirdparty;$(BOOSTDIR)\include;$(BCGDIR)\include;%(AdditionalIncludeDirectories)
23 |
24 |
25 | $(OutDir)$(ProjectName)$(TargetExt)
26 | $(ParentPath)\library\$(BuildFolder)\$(ProjectName).lib
27 | $(ParentPath)\library\$(BuildFolder);$(BOOSTDIR)\library\$(BuildFolder);$(BCGDIR)\library\$(BuildFolder)
28 | $(ParentPath)\pdb\$(BuildFolder)\$(ProjectName).pdb
29 | true
30 |
31 |
32 | $(ParentPath)\BuildLog\$(BuildFolder)\$(ProjectName).htm
33 |
34 |
35 |
36 |
37 | $(ParentPath)
38 | true
39 |
40 |
41 | $(BuildFolder)
42 | true
43 |
44 |
45 |
--------------------------------------------------------------------------------
/code/CCommonTools/treeitemmodel.h:
--------------------------------------------------------------------------------
1 | #ifndef CTREEITEMMODEL_H
2 | #define CTREEITEMMODEL_H
3 |
4 | #include "TreeItem.h"
5 | #include
6 |
7 | class CCOMMONTOOLS_EXPORT CTreeItemModel : public QAbstractItemModel
8 | {
9 | Q_OBJECT
10 |
11 | public:
12 | explicit CTreeItemModel(QObject *parent = nullptr);
13 |
14 | // Basic functionality:
15 | QModelIndex index(int row, int column,
16 | const QModelIndex &parent = QModelIndex()) const override;
17 | QModelIndex parent(const QModelIndex &index) const override;
18 |
19 | int rowCount(const QModelIndex &parent = QModelIndex()) const override;
20 |
21 | bool setData(const QModelIndex &index, const QVariant &value,
22 | int role = Qt::EditRole) override;
23 |
24 | bool IsModified() const;
25 | void SetModified(bool modified = true);
26 |
27 | void SetReadOnly(bool readOnly);
28 |
29 | CTreeItemGroup& GetTreeData();
30 | const CTreeItemGroup& GetTreeData() const;
31 |
32 | //根据QModelIndex获取节点对象
33 | CTreeItem* getItem(const QModelIndex &index) const;
34 |
35 | /**
36 | * @brief 遍历所有子节点
37 | * @param[in] func: 传递一个函数对象或lambda表达式,当遍历到一个节点时,此函数对象或lambda表达式会被调用。
38 | * 如果需要中止遍历,则返回true,否则返回false
39 | * @param[in] parent 遍历的父节点
40 | * @param[in] column 遍历的Index的列
41 | */
42 | void IterateIndexs(std::function func, QModelIndex parent = QModelIndex(), int column = 0) const; //遍历指定节点下的所有节点
43 |
44 | //判断一个单独的节点是否已勾选(需要在派生类中重写)
45 | virtual bool isSingleItemChecked(CTreeItem* pItem) const;
46 |
47 | //设置单独一个节点的勾选状态(需要在派生类中重写)
48 | virtual void setSingleItemChecked(CTreeItem* pItem, bool checked);
49 |
50 |
51 | //判断一个节点是否已勾选
52 | int isItemChecked(CTreeItem* pItem) const;
53 |
54 | /*
55 | * 函数说明: 设置一个节点的勾选状态
56 | * 输入参数:
57 | * pItem: 节点对象的指针
58 | * checked: 是否勾选
59 | */
60 | void setItemChecked(CTreeItem* pItem, bool checked);
61 |
62 | protected:
63 | CTreeItemGroup m_treeData;
64 | bool m_modified = false;
65 | bool m_readOnly = false;
66 | };
67 |
68 | #endif // CTREEITEMMODEL_H
69 |
--------------------------------------------------------------------------------
/code/DeveloperTools/DeveloperTools.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 | {99349809-55BA-4b9d-BF79-8FDBB0286EB3}
18 | ui
19 |
20 |
21 | {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}
22 | qrc;*
23 | false
24 |
25 |
26 |
27 |
28 | Resource Files
29 |
30 |
31 |
32 |
33 | Source Files
34 |
35 |
36 | Source Files
37 |
38 |
39 |
40 |
41 | Header Files
42 |
43 |
44 |
45 |
46 | Header Files
47 |
48 |
49 | Header Files
50 |
51 |
52 |
53 |
54 | Resource Files
55 |
56 |
57 |
58 |
59 | Resource Files
60 |
61 |
62 |
--------------------------------------------------------------------------------
/code/CCommonTools/PathListDialog.cpp:
--------------------------------------------------------------------------------
1 | #include "PathListDialog.h"
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 |
10 | CPathListDialog::CPathListDialog(const QStringList& pathList, QWidget *parent)
11 | : DialogBase("PathListDialog", parent)
12 | {
13 | setWindowTitle(u8"选择一个文件夹");
14 | //添加控件
15 | QVBoxLayout* pLayout = new QVBoxLayout();
16 | setLayout(pLayout);
17 | m_pListWidget = new QListWidget();
18 | pLayout->addWidget(m_pListWidget);
19 | QHBoxLayout* pButtonsLayout = new QHBoxLayout();
20 | pLayout->addLayout(pButtonsLayout);
21 | QPushButton* addBtn = new QPushButton(u8"打开新文件夹");
22 | pButtonsLayout->addWidget(addBtn);
23 | connect(addBtn, SIGNAL(clicked()), this, SLOT(OnOpenNewFolder()));
24 | QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
25 | pButtonsLayout->addWidget(buttonBox);
26 | connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
27 | connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
28 |
29 | //向列表中填充数据
30 | for (const auto& path : pathList)
31 | {
32 | if (!path.isEmpty())
33 | m_pListWidget->addItem(path);
34 | }
35 | }
36 |
37 | CPathListDialog::~CPathListDialog()
38 | {
39 | }
40 |
41 | QString CPathListDialog::GetSelectedPath() const
42 | {
43 | //没有选择新的文件夹,则返回列表选中的项
44 | if (m_newfolderPath.isEmpty())
45 | {
46 | auto* listItem = m_pListWidget->currentItem();
47 | if (listItem != nullptr)
48 | {
49 | return listItem->text();
50 | }
51 | }
52 | //返回新文件夹
53 | return m_newfolderPath;
54 | }
55 |
56 | void CPathListDialog::accept()
57 | {
58 | if (m_pListWidget->selectedItems().isEmpty())
59 | {
60 | QMessageBox::warning(this, QString(), u8"请选择一个路径!", QMessageBox::Ok);
61 | return;
62 | }
63 | DialogBase::accept();
64 | }
65 |
66 | void CPathListDialog::OnOpenNewFolder()
67 | {
68 | //选择一个新文件夹
69 | m_newfolderPath = QFileDialog::getExistingDirectory(this, QString(), QString(), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
70 | if (!m_newfolderPath.isEmpty())
71 | {
72 | //添加了一个新文件后直接关闭窗口
73 | DialogBase::accept();
74 | }
75 | }
--------------------------------------------------------------------------------
/code/FileRename/FileRenameHelper.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 | class FileRenameHelper
4 | {
5 | public:
6 | /**
7 | * @brief 使用文件创建时间重命名
8 | * @param[in] filePath 文件路径
9 | * @param[out] newFileName 接收新文件名
10 | * @param[in] strPrefex 添加的前缀
11 | * @param[in] autoResoveConflict 是否自动解决命名冲突
12 | * @return 是否成功
13 | */
14 | static bool FileRenameByCreateTime(const QString& filePath, QString& newFileName, const QString& strPrefex, bool autoResoveConflict);
15 |
16 | /**
17 | * @brief 使用数字编号重命名
18 | * @param[in] filePath 文件路径
19 | * @param[in] nuber 数字编号
20 | * @param[in] digit 位数
21 | * @param[out] newFileName 接收新文件名
22 | * @param[in] strPrefex 添加的前缀
23 | * @param[in] autoResoveConflict 是否自动解决命名冲突
24 | * @return 是否成功
25 | */
26 | static bool FileRenameByNumber(const QString& filePath, int nuber, int digit, QString& newFileName, const QString& strPrefex, bool autoResoveConflict);
27 |
28 | /**
29 | * @brief 对文件名进行替换
30 | * @param[in] filePath 文件路径
31 | * @param[in] findStr 要查找的字符串
32 | * @param[in] replaceStr 替换的字符串
33 | * @param[out] newFileName 接收新文件名
34 | * @param[in] autoResoveConflict 是否自动解决命名冲突
35 | * @return 是否成功
36 | */
37 | static bool FileRenameReplace(const QString& filePath, const QString& findStr, const QString& replaceStr, QString& newFileName, bool autoResoveConflict);
38 |
39 | //判断一个字符串是否是数字
40 | static bool StrIsNumber(const QString& str);
41 |
42 | /**
43 | * @brief 判断文件名是末尾是否符合“(数字)”的形式
44 | * @param[in] file_name 要判断的文件名,不包含扩展名
45 | * @param[out] number 接收括号中的数字
46 | * @param[out] index 接收左括号在字符串中的索引
47 | * @return 成功返回true,否则返回false
48 | */
49 | static bool IsFileNameNumbered(const QString& file_name, int& number, int& index);
50 |
51 | /**
52 | * @brief 根据一个文件的路径自动解决命名冲突。如果file_path存在,则在其后面加上“(1)”,如果文件名后面存在带括号的数字的形式,则括号内的数字加1
53 | * @param[in][out] file_path 文件的路径
54 | */
55 | static void FileAutoResoveConfict(QString& file_path);
56 |
57 | private:
58 | /**
59 | * @brief 对一个文件重命名
60 | * @param[in] filePath 文件路径
61 | * @param[in] newFileName 新文件名(含扩展名)
62 | * @param[in] autoResoveConflict 是否自动解决命名冲突
63 | * @return
64 | */
65 | static bool FileRename(const QString& filePath, QString& newFileName, bool autoResoveConflict);
66 | };
67 |
68 |
--------------------------------------------------------------------------------
/code/PixelRuler/PixelRuler.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | qml;cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | qrc;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 | {99349809-55BA-4b9d-BF79-8FDBB0286EB3}
18 | ui
19 |
20 |
21 | {639EADAA-A684-42e4-A9AD-28FC9BCB8F7C}
22 | ts
23 |
24 |
25 |
26 |
27 | Header Files
28 |
29 |
30 | Source Files
31 |
32 |
33 | Header Files
34 |
35 |
36 | Header Files
37 |
38 |
39 | Header Files
40 |
41 |
42 |
43 |
44 | Source Files
45 |
46 |
47 | Source Files
48 |
49 |
50 | Source Files
51 |
52 |
53 |
54 |
55 | Header Files
56 |
57 |
58 |
59 |
60 | Resource Files
61 |
62 |
63 |
64 |
65 | Resource Files
66 |
67 |
68 |
--------------------------------------------------------------------------------
/code/WallpaperTool/HistoryWallpaperMgr.cpp:
--------------------------------------------------------------------------------
1 | #include "HistoryWallpaperMgr.h"
2 | #include "../CCommonTools/Config.h"
3 | #include "WallpaperTool.h"
4 | #include
5 | #include "define.h"
6 |
7 | void CHistoryWallpaperMgr::AddWallpapers(const QStringList& wallpapers)
8 | {
9 | for (const auto& wallpaper : wallpapers)
10 | {
11 | if (!m_historyWallpapers.contains(wallpaper))
12 | m_historyWallpapers.push_front(wallpaper);
13 | }
14 | while (m_historyWallpapers.size() > HISTORY_WALLPAPER_MAX)
15 | {
16 | m_historyWallpapers.pop_back();
17 | }
18 | }
19 |
20 | void CHistoryWallpaperMgr::Load()
21 | {
22 | CConfig settings(QString::fromUtf8(WallpaperTool::Instance()->GetModuleName()));
23 | m_historyWallpapers = settings.GetValue("HistoryWallpapers").toStringList();
24 | }
25 |
26 | void CHistoryWallpaperMgr::Save() const
27 | {
28 | CConfig settings(QString::fromUtf8(WallpaperTool::Instance()->GetModuleName()));
29 | settings.WriteValue("HistoryWallpapers", m_historyWallpapers);
30 | }
31 |
32 | const QStringList& CHistoryWallpaperMgr::GetHistoryWallpapers() const
33 | {
34 | return m_historyWallpapers;
35 | }
36 |
37 | void CHistoryWallpaperMgr::RemoveRecord(const QString& wallpaperPath)
38 | {
39 | m_historyWallpapers.removeAll(wallpaperPath);
40 | }
41 |
42 | //////////////////////////////////////////////////////////////////////////////////////////////
43 | HistoryWallpaperSearchThread::HistoryWallpaperSearchThread(CHistoryWallpaperMgr& manager)
44 | : m_manager(manager)
45 | {
46 | }
47 |
48 | const QIcon& HistoryWallpaperSearchThread::GetWallpaperIcon(const QString& path)
49 | {
50 | auto iter = m_imageMap.find(path);
51 | if (iter != m_imageMap.end())
52 | {
53 | return iter.value();
54 | }
55 | else
56 | {
57 | static QIcon emptyIcon;
58 | return emptyIcon;
59 | }
60 | }
61 |
62 | bool HistoryWallpaperSearchThread::StartThread()
63 | {
64 | if (!isRunning())
65 | {
66 | start();
67 | return true;
68 | }
69 | return false;
70 | }
71 |
72 | void HistoryWallpaperSearchThread::run()
73 | {
74 | //加载历史记录中所有图片并加载到内存
75 | for (const QString& path : m_manager.GetHistoryWallpapers())
76 | {
77 | if (!m_imageMap.contains(path))
78 | {
79 | QPixmap pixmap;
80 | pixmap.load(path);
81 | int iconSize = DPI(256);
82 | pixmap = pixmap.scaled(iconSize, iconSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
83 | m_imageMap.insert(path, QIcon(pixmap));
84 | }
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/code/WallpaperTool/SettingsDlg.cpp:
--------------------------------------------------------------------------------
1 | #include "SettingsDlg.h"
2 | #include "../CCommonTools/Config.h"
3 | #include "WallpaperTool.h"
4 | #include "define.h"
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | void SettingsDlg::Data::Save() const
12 | {
13 | //保存设置
14 | CConfig settings(QString::fromUtf8(WallpaperTool::Instance()->GetModuleName()));
15 | settings.WriteValue("wallpaperAcquireMethod", static_cast(wallpaperAcquireMethod));
16 | }
17 |
18 | void SettingsDlg::Data::Load()
19 | {
20 | CConfig settings(QString::fromUtf8(WallpaperTool::Instance()->GetModuleName()));
21 | wallpaperAcquireMethod = static_cast(settings.GetValue("wallpaperAcquireMethod", 1).toInt());
22 | }
23 |
24 | //////////////////////////////////////////////////////////////////////////////
25 | SettingsDlg::SettingsDlg(QWidget *parent)
26 | : QDialog(parent)
27 | {
28 | //ui.setupUi(this);
29 | //if (layout() != nullptr)
30 | // layout()->setMargin(DPI(8));
31 |
32 | setWindowTitle(u8"壁纸工具设置");
33 |
34 | QVBoxLayout* pLayout = new QVBoxLayout();
35 | setLayout(pLayout);
36 | QScrollArea* pScrollArea = new QScrollArea();
37 | pLayout->addWidget(pScrollArea);
38 | QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
39 | pLayout->addWidget(buttonBox);
40 | connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
41 | connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
42 |
43 | QVBoxLayout* pScrollLayout = new QVBoxLayout();
44 | pScrollArea->setLayout(pScrollLayout);
45 | pScrollLayout->addWidget(m_radioButtonReg = new QRadioButton(u8"注册表"));
46 | pScrollLayout->addWidget(m_radioButtonWallPaperInterface = new QRadioButton(u8"IDesktopWallpaper接口"));
47 | pScrollLayout->addStretch();
48 |
49 | resize(DPI(340), DPI(230));
50 |
51 | //非Windows下禁用壁纸获取方式选项
52 | #ifndef Q_OS_WIN
53 | m_radioButtonReg->setEnabled(false);
54 | m_radioButtonWallPaperInterface->setEnabled(false);
55 | #endif
56 | }
57 |
58 | SettingsDlg::~SettingsDlg()
59 | {}
60 |
61 | void SettingsDlg::SetData(const Data & data)
62 | {
63 | if (data.wallpaperAcquireMethod == Data::Registry)
64 | m_radioButtonReg->setChecked(true);
65 | else
66 | m_radioButtonWallPaperInterface->setChecked(true);
67 | }
68 |
69 | SettingsDlg::Data SettingsDlg::GetData() const
70 | {
71 | Data data;
72 | data.wallpaperAcquireMethod = m_radioButtonReg->isChecked() ? Data::Registry : Data::WallpaperInterface;
73 | return data;
74 | }
75 |
--------------------------------------------------------------------------------
/include/moduleinterface.h:
--------------------------------------------------------------------------------
1 | #ifndef MODULEINTERFACE
2 | #define MODULEINTERFACE
3 |
4 | class IMainFrame;
5 |
6 | //模块接口,所有需要被框架加载的项目都要实现此接口
7 | //接口中所有const char*类型均为UTF8编码。
8 | class IModule
9 | {
10 | public:
11 | IModule() {}
12 |
13 | virtual ~IModule() {}
14 |
15 | //定义返回的窗口的类型
16 | enum eMainWindowType
17 | {
18 | MT_QWIDGET, //QWidget类型的指针
19 | MT_HWND, //HWND
20 | };
21 |
22 | //模块被加载后由框架调用
23 | virtual void InitInstance() = 0;
24 |
25 | //模块被析构前由框架调用
26 | virtual void UnInitInstance() = 0;
27 |
28 | /**
29 | * @brief 界面加载完成后由框架调用,并向模块传递框架接口的指针
30 | * @param[in] pMainFrame 框架接口的指针
31 | */
32 | virtual void UiInitComplete(IMainFrame* pMainFrame) {}
33 |
34 | /**
35 | * @brief 获取模块的主窗口
36 | * @details 当切换到该模块的标签时,此窗口会被显示到MainFrame中。可以返回空指针。
37 | * @return 根据GetMainWindowType的返回值返回主模块主窗口的QWidget对象的指针或HWND句柄
38 | */
39 | virtual void* GetMainWindow() = 0;
40 |
41 | //获取返回的主窗口的类型
42 | virtual eMainWindowType GetMainWindowType() const = 0;
43 |
44 | //获取模块名称
45 | virtual const char* GetModuleName() = 0;
46 |
47 | /**
48 | * @brief 当主窗口触发了一个命令时由框架调用
49 | * @param[in] strCmd:命令的ID
50 | * @param[in] checked:命令按钮是否被选中
51 | */
52 | virtual void OnCommand(const char* strCmd, bool checked) = 0;
53 |
54 | /**
55 | * @brief 响应Ribbon标签中Combox或ListWidget当前选中项改变,或LineEdit或TextEdit文本改变
56 | * @param[in] strId: 命令的ID
57 | * @param[in] index: 选中项的序号
58 | * @param[in] text: 选中项的文本
59 | */
60 | virtual void OnItemChanged(const char* strId, int index, const char* text) {}
61 |
62 | /**
63 | * @brief 向模块发送一个消息,用于在同一个进程之间的各个模块发送消息
64 | * @param[in] msgType 消息类型
65 | * @param[in] msgData 消息体
66 | * @return 返回的数据(如果需要的话)
67 | */
68 | virtual void* OnMessage(const char* msgType, void* para1 = nullptr, void* para2 = nullptr) { return nullptr; }
69 |
70 | //当主窗口中切换到模块的标签页时响应
71 | virtual void OnTabEntered() {}
72 |
73 | /**
74 | * @brief 程序在退出前由框架调用
75 | */
76 | virtual void OnAppExit() {}
77 |
78 | /**
79 | * @brief 创建一个用户自定义控件(仅Qt模块支持此接口)
80 | * @note 当xml中使用了UserWidget节点时此函数会被框架调用以创建自定义控件,模块中根据id创建对应的控件,并返回其指针。
81 | * @param[in] strId 控件的id
82 | * @param[in] pParent 控件的父窗口(QWidget指针)
83 | * @return 创建的控件(QWidget指针)
84 | */
85 | virtual void* CreateUserWidget(const char* strId, void* pParent = nullptr) { return nullptr; }
86 |
87 | };
88 |
89 | //一个形如IModule* func()的函数的指针
90 | //模块实现IModule接口后,还应该导出一个名为“CreateInstance”的函数以创建对象,创建的对象由框架负责释放
91 | #if defined(WIN32) || defined(WIN64)
92 | typedef IModule* (__stdcall *pfCreateModuleInstance)();
93 | #else
94 | typedef IModule* (*pfCreateModuleInstance)();
95 | #endif
96 |
97 | #endif // MODULEINTERFACE
98 |
99 |
--------------------------------------------------------------------------------
/code/AddCodeHeader/MainWidget.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | //#include
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include "define.h"
15 |
16 | class CMainWidget : public QWidget
17 | {
18 | Q_OBJECT
19 |
20 | public:
21 | CMainWidget(QWidget *parent = Q_NULLPTR);
22 | ~CMainWidget();
23 |
24 | //DECLARE_CLASS_GET_ATTR(TemplateTextEdit, m_pTemplateTextEdit, QTextEdit*)
25 | DECLARE_CLASS_GET_ATTR(FolderPathEidt, m_pFolderPathEidt, QLineEdit*)
26 | DECLARE_CLASS_GET_ATTR(BrowseBtn, m_pBrowseBtn, QPushButton*)
27 | DECLARE_CLASS_GET_ATTR(FileTypeCombo, m_pFileTypeCombo, QComboBox*)
28 | DECLARE_CLASS_GET_ATTR(FileTableView, m_pFileTableView, QTableView*)
29 | DECLARE_CLASS_GET_ATTR(OutFormatCombo, m_pOutFormatCombo, QComboBox*)
30 | //DECLARE_CLASS_GET_ATTR(RemoveSpaceCheck, m_pRemoveSpace, QCheckBox*)
31 | //DECLARE_CLASS_GET_ATTR(RemoveReturnCheck, m_pRemoveReturn, QCheckBox*)
32 | //DECLARE_CLASS_GET_ATTR(ReturnNumEdit, m_pReturnNumEdit, QSpinBox*)
33 | DECLARE_CLASS_GET_ATTR(AddFileBtn, m_pAddFileBtn, QPushButton*)
34 | DECLARE_CLASS_GET_ATTR(RemoveFileBtn, m_pRemoveFileBtn, QPushButton*)
35 | DECLARE_CLASS_GET_ATTR(ClearFileBtn, m_pClearFileBtn, QPushButton*)
36 | DECLARE_CLASS_GET_ATTR(ProgressBar, m_pProgressBar, QProgressBar*)
37 | DECLARE_CLASS_GET_ATTR(TemplateItemTable, m_pTemplateItemTable, QTableView*)
38 | //DECLARE_CLASS_GET_ATTR(TemplateAddBtn, m_pTemplateAddBtn, QPushButton*)
39 | //DECLARE_CLASS_GET_ATTR(TemplateRemoveBtn, m_pTemplateRemoveBtn, QPushButton*)
40 | DECLARE_CLASS_GET_ATTR(TemplateMoveUpBtn, m_pTemplateMoveUpBtn, QPushButton*)
41 | DECLARE_CLASS_GET_ATTR(TemplateMoveDownBtn, m_pTemplateMoveDownBtn, QPushButton*)
42 |
43 | void ShowAddCodeHeader(bool show);
44 |
45 | private slots:
46 | void OnBrowseBtnClicked();
47 | void SetProgress(double progress);
48 |
49 | private:
50 | //QTextEdit* m_pTemplateTextEdit;
51 | QLineEdit* m_pFolderPathEidt;
52 | QPushButton* m_pBrowseBtn;
53 | QComboBox* m_pFileTypeCombo;
54 | QTableView* m_pFileTableView;
55 | QComboBox* m_pOutFormatCombo;
56 | QWidget* m_pAddCodeHeadWidget; //右侧控件
57 | //QCheckBox* m_pRemoveSpace;
58 | //QCheckBox* m_pRemoveReturn;
59 | //QSpinBox* m_pReturnNumEdit;
60 | QPushButton* m_pAddFileBtn; //添加文件按钮
61 | QPushButton* m_pRemoveFileBtn; //删除文件按钮
62 | QPushButton* m_pClearFileBtn; //删除文件按钮
63 | QProgressBar* m_pProgressBar;
64 | QLabel* m_pProgressLabel;
65 | QTableView* m_pTemplateItemTable;
66 | //QPushButton* m_pTemplateAddBtn;
67 | //QPushButton* m_pTemplateRemoveBtn;
68 | QPushButton* m_pTemplateMoveUpBtn;
69 | QPushButton* m_pTemplateMoveDownBtn;
70 | };
71 |
--------------------------------------------------------------------------------
/code/DeveloperTools/MainFrame.cpp:
--------------------------------------------------------------------------------
1 | #include "MainFrame.h"
2 | #include
3 | #include
4 | #include
5 | #include "../CCommonTools/Config.h"
6 | #include "define.h"
7 |
8 | #define QSTR(str) QString::fromWCharArray(L ## str)
9 |
10 | MainFrame::MainFrame(const QStringList& cmdLine, QWidget* parent) : RibbonFrameWindow(parent, QString(), false, cmdLine)
11 | {
12 | QIcon appIcon(":/DeveloperTools/res/DeveloperTools.ico");
13 | qApp->setWindowIcon(appIcon);
14 | SetItemIcon("AppAbout", appIcon);
15 |
16 | setMinimumSize(DPI(500), DPI(400));
17 |
18 | //载入配置
19 | CConfig settings;
20 | int tabIndex = settings.GetValue("tabIndex").toInt();
21 | SetTabIndex(tabIndex);
22 | int windowWidth = settings.GetValue("windowWidth", DPI(800)).toInt();
23 | int windowHeight = settings.GetValue("windowHeight", DPI(600)).toInt();
24 | resize(QSize(windowWidth, windowHeight));
25 |
26 | //启动1秒定时器
27 | m_timerId = startTimer(1000);
28 | }
29 |
30 | MainFrame::~MainFrame()
31 | {
32 | //保存配置
33 | CConfig settings;
34 | settings.WriteValue("tabIndex", GetTabIndex());
35 | if (!isMaximized())
36 | {
37 | QSize windowSize = size();
38 | settings.WriteValue("windowWidth", windowSize.width());
39 | settings.WriteValue("windowHeight", windowSize.height());
40 | }
41 | }
42 |
43 | void MainFrame::SetSharedMemory(QSharedMemory* pShared)
44 | {
45 | m_pSharedMemory = pShared;
46 | }
47 |
48 | void MainFrame::closeEvent(QCloseEvent* event)
49 | {
50 | RibbonFrameWindow::closeEvent(event);
51 | }
52 |
53 | void MainFrame::timerEvent(QTimerEvent* timerEvent)
54 | {
55 | if (timerEvent->timerId() == m_timerId)
56 | {
57 | char* strData = (char*)m_pSharedMemory->data();
58 | if (strData[0] != 0)
59 | {
60 | show();
61 | showNormal();
62 | activateWindow();
63 | strData[0] = 0;
64 | }
65 | }
66 | }
67 |
68 |
69 | bool MainFrame::OnCommand(const QString& strCmd, bool checked)
70 | {
71 | if (strCmd == "AppAbout")
72 | {
73 | QString strDebug;
74 | #ifdef _DEBUG
75 | strDebug = u8"(Debug 模式)";
76 | #endif // DEBUG
77 |
78 | QString strAboutInfo = QString(u8"%1 V%2 %3
"
79 | "一个各种小工具合集。
"
80 | "Copyright(C) 2024 by ZhongYang
"
81 | "GitHub")
82 | .arg(APP_NAME).arg(APP_VERSION).arg(strDebug);
83 |
84 | QMessageBox aboutBox;
85 | aboutBox.setWindowTitle(QString(u8"关于") + APP_NAME);
86 | aboutBox.setTextFormat(Qt::RichText); // 设置文本格式为富文本(HTML)
87 | aboutBox.setText(strAboutInfo);
88 | QIcon icon = QApplication::windowIcon();
89 | if (!icon.isNull())
90 | {
91 | QSize size = icon.actualSize(QSize(64, 64));
92 | aboutBox.setIconPixmap(icon.pixmap(size));
93 | }
94 | aboutBox.exec();
95 | }
96 | return RibbonFrameWindow::OnCommand(strCmd, checked);
97 | }
98 |
--------------------------------------------------------------------------------
/code/PasswordGeneratorApi/PasswordGeneratorImp.cpp:
--------------------------------------------------------------------------------
1 | // 这是主 DLL 文件。
2 |
3 | #include "stdafx.h"
4 |
5 | #include "PasswordGeneratorImp.h"
6 | #include "mainframeinterface.h"
7 |
8 | namespace PasswordGeneratorApi
9 | {
10 | IMainFrame* mainFrame = nullptr;
11 |
12 | static std::wstring ClrStringToStdWstring(System::String^ str)
13 | {
14 | const wchar_t* chars = reinterpret_cast((System::Runtime::InteropServices::Marshal::StringToHGlobalUni(str)).ToPointer());
15 | return std::wstring(chars);
16 | }
17 |
18 | static System::String^ utf8ToClrString(const char* str)
19 | {
20 | System::Text::Encoding^ u8enc = System::Text::Encoding::UTF8;
21 | return u8enc->GetString((unsigned char*)str, static_cast(strlen(str)));
22 | }
23 |
24 | static std::string ClrStringToUtf8(System::String^ str)
25 | {
26 | cli::array^ arr = System::Text::Encoding::UTF8->GetBytes(str);
27 | std::string rtnStr;
28 | for (int i = 0; i < arr->Length; i++)
29 | rtnStr[i] = arr[i];
30 | }
31 |
32 | static void SetStatusBarText(System::String^ str, int timeOut)
33 | {
34 | if (mainFrame != nullptr)
35 | {
36 | mainFrame->SetStatusBarText(ClrStringToUtf8(str).c_str(), timeOut);
37 | }
38 | }
39 |
40 | void CPasswordGenerator::InitInstance()
41 | {
42 | }
43 |
44 | void CPasswordGenerator::UnInitInstance()
45 | {
46 | Program::GetForm(true)->SaveConfig();
47 | }
48 |
49 | void CPasswordGenerator::UiInitComplete(IMainFrame* pMainFrame)
50 | {
51 | mainFrame = pMainFrame;
52 | }
53 |
54 | void* CPasswordGenerator::GetMainWindow()
55 | {
56 | return Program::GetForm(true)->GetHandle().ToPointer();
57 | }
58 |
59 | IModule::eMainWindowType CPasswordGenerator::GetMainWindowType() const
60 | {
61 | return IModule::MT_HWND;
62 | }
63 |
64 | const char* CPasswordGenerator::GetModuleName()
65 | {
66 | return "PasswordGenerator";
67 | }
68 |
69 | void CPasswordGenerator::OnCommand(const char* strCmd, bool checked)
70 | {
71 | std::string cmd = strCmd;
72 | if (cmd == "PasswordGeneratorAbout")
73 | Program::GetForm(true)->aboutButton_Click(nullptr, nullptr);
74 | else if (cmd == "PasswordGeneratorGenerate")
75 | Program::GetForm(true)->GenerateButton_Click(nullptr, nullptr);
76 | else if (cmd == "PasswordGeneratorCopy")
77 | Program::GetForm(true)->CopyButton_Click(nullptr, nullptr);
78 | else if (cmd == "PasswordGenerator8Num")
79 | Program::GetForm(true)->SetPasswordLenght(8);
80 | else if (cmd == "PasswordGenerator16Num")
81 | Program::GetForm(true)->SetPasswordLenght(16);
82 | else if (cmd == "PasswordGenerator24Num")
83 | Program::GetForm(true)->SetPasswordLenght(24);
84 | else if (cmd == "PasswordGenerator32Num")
85 | Program::GetForm(true)->SetPasswordLenght(32);
86 | }
87 |
88 | }
89 |
90 |
91 | IModule* CreateInstance()
92 | {
93 | return new PasswordGeneratorApi::CPasswordGenerator();
94 | }
95 |
--------------------------------------------------------------------------------
/code/CCommonTools/TreeItem.h:
--------------------------------------------------------------------------------
1 | #ifndef TREEITEM_H
2 | #define TREEITEM_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include "ccommontools_global.h"
10 |
11 | class CTreeItem;
12 | typedef std::shared_ptr CTreeItemPtr;
13 | typedef QList TreeItemList;
14 |
15 | class CCOMMONTOOLS_EXPORT CTreeItem
16 | {
17 | public:
18 | CTreeItem();
19 | ~CTreeItem();
20 |
21 | public:
22 | //获取属性
23 | QVariant GetProperty(const QString& strProperty) const;
24 |
25 | //设置属性
26 | void SetProperty(const QString& strProperty, QVariant value);
27 |
28 | //清除属性
29 | void ClearPorperty(const QString& strProperty);
30 |
31 | CTreeItem* GetParent() const;
32 | void SetParent(CTreeItem* pParent);
33 |
34 | //添加一个子节点
35 | void AddItem(CTreeItemPtr pItem);
36 |
37 | //获取子节点列表
38 | const TreeItemList& GetChildList();
39 |
40 | //查找一个节点在子节点中的索引
41 | int IndexOf(CTreeItem* pItem);
42 |
43 | //节点是否有子节点
44 | bool HasChildren() const;
45 |
46 | //获取节点级别。根节点为0,往下一级依次加1
47 | int GetLevel() const;
48 |
49 | //设置节点内部指针
50 | void SetInternalPointer(void* pInternalPointer);
51 |
52 | //获取节点内部指针
53 | void* GetInternalPointer() const;
54 |
55 | //从另一个节点对象复制所有属性
56 | void CopyProperties(const CTreeItem& another);
57 |
58 | /**
59 | * @brief 遍历所有子节点
60 | * @param[in] func: 传递一个函数对象或lambda表达式,当遍历到一个节点时,此函数对象或lambda表达式会被调用。
61 | * 此函数对象或lambda表达式的第1个参数为遍历到的节点;第2个参数为当前遍历到的席位序号(从0开始);如果需要中止遍历,则返回true,否则返回false
62 | * @return 已遍历的节点的个数
63 | */
64 | int IterateItems(std::function func);
65 |
66 |
67 | private:
68 | CTreeItem* m_pParent; //父节点
69 | TreeItemList m_childList; //子节点列表
70 | QMap m_propertyMap; //节点属性
71 | void* m_internalPointer = nullptr;
72 | };
73 |
74 | //用于管理所有节点
75 | class CCOMMONTOOLS_EXPORT CTreeItemGroup
76 | {
77 | public:
78 | CTreeItemGroup();
79 | void AddItem(CTreeItemPtr pItem); //添加一个节点
80 | CTreeItemPtr GetChild(int n) const; //获取一个子节点
81 | int IndexOf(CTreeItem* pItem); //查找一个节点在子节点中的索引
82 | const TreeItemList& GetChildList() const; //获取子节点列表
83 | TreeItemList& ChildList();
84 |
85 | /**
86 | * @brief 根据属性查找一个节点
87 | * @param[in] strProperty: 节点的属性
88 | * @param[in] value: 属性的值
89 | * @return 返回值
90 | */
91 | CTreeItem* FindItem(const QString& strProperty, QVariant value);
92 |
93 | /**
94 | * @brief 遍历所有子节点
95 | * @param[in] func: 传递一个函数对象或lambda表达式,当遍历到一个节点时,此函数对象或lambda表达式会被调用。
96 | * 此函数对象或lambda表达式的第1个参数为遍历到的节点;第2个参数为当前遍历到的席位序号(从0开始);如果需要中止遍历,则返回true,否则返回false
97 | * @return 已遍历的节点的个数
98 | */
99 | int IterateItems(std::function func) const; //遍历指定节点下的所有节点
100 | private:
101 | TreeItemList m_childList; //子节点列表
102 | };
103 |
104 | #endif // TREEITEM_H
105 |
--------------------------------------------------------------------------------
/code/WallpaperTool/MainWidget.cpp:
--------------------------------------------------------------------------------
1 | #include "MainWidget.h"
2 | #include "define.h"
3 |
4 | MainWidget::MainWidget(QWidget *parent)
5 | : QMainWindow(parent)
6 | {
7 | QWidget* pWidget = new QWidget(this);
8 | setCentralWidget(pWidget);
9 |
10 | m_pLayout = new QGridLayout();
11 | pWidget->setLayout(m_pLayout);
12 | }
13 |
14 | MainWidget::~MainWidget()
15 | {}
16 |
17 | void MainWidget::SetWallpapers(QList&wallpapersPath)
18 | {
19 | //清空布局
20 | for (auto* pWidget : m_wallpaperWidgets)
21 | {
22 | m_pLayout->removeWidget(pWidget);
23 | delete pWidget;
24 | }
25 | m_wallpaperWidgets.clear();
26 |
27 | //添加Widgets
28 | int row = 0; //子窗口在布局中的行
29 | int col = 0; //子窗口在布局中的列
30 | int colMax = 0; //每行的窗口数
31 | //根据窗口总数确定每行显示多少个窗口
32 | if (wallpapersPath.size() <= 1)
33 | colMax = 1;
34 | else if (wallpapersPath.size() <= 4)
35 | colMax = 2;
36 | else if (wallpapersPath.size() <= 6)
37 | colMax = 3;
38 | else if (wallpapersPath.size() <= 8)
39 | colMax = 4;
40 | else
41 | colMax = 5;
42 | int index = 0; //循环的序号
43 | for (const QString& path : wallpapersPath)
44 | {
45 | //计算窗口的行和列
46 | col = index % colMax;
47 | row = index / colMax;
48 | CWallpapaerWidget* pWidget = new CWallpapaerWidget(this);
49 | m_wallpaperWidgets.push_back(pWidget);
50 | pWidget->SetWallpaper(path);
51 | connect(&pWidget->GetImageLabel(), SIGNAL(clicked()), this, SLOT(OnWallpapaerWidgetClicked()));
52 | pWidget->show();
53 | if (wallpapersPath.size() > 1)
54 | pWidget->GetImageLabel().setCursor(QCursor(Qt::PointingHandCursor));
55 | else
56 | pWidget->GetImageLabel().setCursor(QCursor(Qt::ArrowCursor));
57 | m_pLayout->addWidget(pWidget, row, col, 1, 1);
58 | index++;
59 | }
60 | m_isGridLayout = true;
61 | emit widgetLayoutChanged(m_isGridLayout, QString());
62 | }
63 |
64 | void MainWidget::ShowGridLayout()
65 | {
66 | //显示所有子窗口
67 | for (auto* pWidget : m_wallpaperWidgets)
68 | {
69 | pWidget->setVisible(true);
70 | pWidget->GetImageLabel().setCursor(QCursor(Qt::PointingHandCursor)); //设置鼠标指针为手形
71 | }
72 | m_isGridLayout = true;
73 | emit widgetLayoutChanged(m_isGridLayout, QString());
74 | }
75 |
76 | int MainWidget::GetWallpaperNum()
77 | {
78 | return m_wallpaperWidgets.size();
79 | }
80 |
81 | void MainWidget::OnWallpapaerWidgetClicked()
82 | {
83 | if (GetWallpaperNum() <= 1)
84 | return;
85 | CWallpapaerWidget* pClickedWidget = qobject_cast(QObject::sender()->parent());
86 | if (pClickedWidget != nullptr)
87 | {
88 | //显示点击的窗口,隐藏其他窗口
89 | for (auto* pWidget : m_wallpaperWidgets)
90 | {
91 | if (pWidget == pClickedWidget)
92 | pWidget->show();
93 | else
94 | pWidget->hide();
95 | }
96 | m_isGridLayout = false;
97 | emit widgetLayoutChanged(m_isGridLayout, pClickedWidget->GetWallpaperPath());
98 | pClickedWidget->GetImageLabel().setCursor(QCursor(Qt::ArrowCursor));
99 | }
100 | }
--------------------------------------------------------------------------------
/code/FileRename/FileRename.cpp:
--------------------------------------------------------------------------------
1 | #include "FileRename.h"
2 | #include
3 | #include
4 | #include
5 |
6 | static FileRename* pIns = nullptr;
7 | FileRename::FileRename()
8 | {
9 | }
10 |
11 | FileRename* FileRename::Instance()
12 | {
13 | return pIns;
14 | }
15 |
16 | IMainFrame* FileRename::GetMainFrame()
17 | {
18 | return m_pMainFrame;
19 | }
20 |
21 | void FileRename::InitInstance()
22 | {
23 | m_mainWidget.LoadConfig();
24 | }
25 |
26 | void FileRename::UiInitComplete(IMainFrame* pMainFrame)
27 | {
28 | m_pMainFrame = pMainFrame;
29 | m_pMainFrame->SetItemEnable(CMD_FileRenameDelete, false);
30 |
31 | //QWidget* pMainWindow = dynamic_cast(pMainFrame);
32 | //if (pMainWindow != nullptr)
33 | // pMainWindow->setAcceptDrops(true);
34 | }
35 |
36 | void FileRename::UnInitInstance()
37 | {
38 | m_mainWidget.SaveConfig();
39 | }
40 |
41 | void* FileRename::GetMainWindow()
42 | {
43 | return &m_mainWidget;
44 | }
45 |
46 | IModule::eMainWindowType FileRename::GetMainWindowType() const
47 | {
48 | return IModule::MT_QWIDGET;
49 | }
50 |
51 | const char* FileRename::GetModuleName()
52 | {
53 | return "FileRename";
54 | }
55 |
56 | void FileRename::OnCommand(const char* strCmd, bool checked)
57 | {
58 | QString cmd(QString::fromUtf8(strCmd));
59 | if (cmd == CMD_FileRenameAddFiles)
60 | {
61 | QStringList files = QFileDialog::getOpenFileNames(&m_mainWidget, QString(), QString(), u8"所有文件 (*.*);;图片文件 (*.png *.bmp *.jpg)");
62 | if (!files.isEmpty())
63 | {
64 | for (const auto& file : files)
65 | m_mainWidget.AddFile(file);
66 | }
67 | }
68 | else if (cmd == CMD_FileRenameAddFolder)
69 | {
70 | QString strDir = QFileDialog::getExistingDirectory(&m_mainWidget);
71 | if (!strDir.isEmpty())
72 | {
73 | m_mainWidget.AddFolder(strDir);
74 | }
75 | }
76 | else if (cmd == CMD_FileRenameDelete)
77 | {
78 | auto selections = m_mainWidget.GetTableView()->selectionModel()->selectedRows();
79 | if (selections.isEmpty())
80 | return;
81 |
82 | if (QMessageBox::information(&m_mainWidget, nullptr, QString(u8"确实要移除选中的 %1 个文件吗?").arg(selections.size()), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes)
83 | {
84 | std::set selectedRows;
85 | for (const auto& selection : selections)
86 | {
87 | selectedRows.insert(selection.row());
88 | }
89 |
90 | for (auto iter = selectedRows.rbegin(); iter != selectedRows.rend(); ++iter)
91 | {
92 | int row = *iter;
93 | m_mainWidget.GetModel().DeleteItem(row);
94 | }
95 | }
96 | }
97 | else if (cmd == CMD_FileRenameClear)
98 | {
99 | m_mainWidget.GetModel().ClearData();
100 | }
101 | else if (cmd == CMD_RenameWithModifiedTime)
102 | {
103 | int count = m_mainWidget.ExcuteFileRename();
104 | QString info = QString(u8"完成,已重命名 %1 个文件。").arg(count);
105 | QMessageBox::information(&m_mainWidget, QString(), info);
106 | }
107 | }
108 |
109 |
110 | IModule* CreateInstance()
111 | {
112 | pIns = new FileRename();
113 | return pIns;
114 | }
115 |
--------------------------------------------------------------------------------
/code/PixelRuler/RulerWidget.cpp:
--------------------------------------------------------------------------------
1 | #include "RulerWidget.h"
2 | #include "RulerDrawer.h"
3 | #include "PixelRuler.h"
4 | #include
5 | #include
6 | #include "define.h"
7 | #include
8 | #include
9 |
10 | CRulerWidget::CRulerWidget(Qt::Orientation orientation, QWidget *parent)
11 | : QWidget(parent), m_orientation(orientation)
12 | {
13 | //设置窗口标题
14 | if (orientation == Qt::Horizontal)
15 | setWindowTitle(u8"水平标尺");
16 | else
17 | setWindowTitle(u8"垂直标尺");
18 |
19 | //设置无边框
20 | auto flags = windowFlags();
21 | flags |= Qt::FramelessWindowHint; //去掉窗口边框
22 | flags |= Qt::WindowStaysOnTopHint; //总是置顶
23 | this->setWindowFlags(flags);
24 |
25 | //设置窗口大小
26 | QSize screenSize = QGuiApplication::primaryScreen()->size();
27 | int rulerSize = DPI(46);
28 | if (orientation == Qt::Horizontal)
29 | resize(QSize(screenSize.width(), rulerSize));
30 | else
31 | resize(QSize(rulerSize, screenSize.height()));
32 | }
33 |
34 | CRulerWidget::~CRulerWidget()
35 | {}
36 |
37 | void CRulerWidget::paintEvent(QPaintEvent * event)
38 | {
39 | QPainter painter(this);
40 | CRulerDrawer drawer(painter, rect(), PixelRuler::Instance()->GetScalePercent());
41 | //绘制标尺
42 | if (m_orientation == Qt::Horizontal)
43 | {
44 | drawer.Draw(CRulerDrawer::Top, true);
45 | drawer.Draw(CRulerDrawer::Bottom, false);
46 | }
47 | else if (m_orientation == Qt::Vertical)
48 | {
49 | drawer.Draw(CRulerDrawer::Left, true);
50 | drawer.Draw(CRulerDrawer::Right, false);
51 | }
52 | //绘制窗口边框
53 | painter.save();
54 | painter.setPen(QPen(qApp->palette().color(QPalette::Text)));
55 | QRect windowRect = rect();
56 | windowRect.setRight(windowRect.right() - 1);
57 | windowRect.setBottom(windowRect.bottom() - 1);
58 | painter.drawRect(windowRect);
59 | painter.restore();
60 | }
61 |
62 | void CRulerWidget::mouseMoveEvent(QMouseEvent* event)
63 | {
64 | if (m_mousePressed)
65 | {
66 | move(event->globalPos() - m_mousePoint);
67 | }
68 | }
69 |
70 | void CRulerWidget::mousePressEvent(QMouseEvent* event)
71 | {
72 | if ((event->buttons() & Qt::LeftButton) != 0)
73 | {
74 | m_mousePressed = true;
75 | m_mousePoint = event->globalPos() - this->pos();
76 | }
77 | }
78 |
79 | void CRulerWidget::mouseReleaseEvent(QMouseEvent* event)
80 | {
81 | m_mousePressed = false;
82 | }
83 |
84 | void CRulerWidget::keyReleaseEvent(QKeyEvent* event)
85 | {
86 | //按下键盘方向键可以以一个像素为单位移动窗口位置
87 | if (event->key() == Qt::Key_Up)
88 | {
89 | QPoint point = this->pos();
90 | point.setY(point.y() - 1);
91 | move(point);
92 | }
93 | else if (event->key() == Qt::Key_Down)
94 | {
95 | QPoint point = this->pos();
96 | point.setY(point.y() + 1);
97 | move(point);
98 | }
99 | else if (event->key() == Qt::Key_Left)
100 | {
101 | QPoint point = this->pos();
102 | point.setX(point.x() - 1);
103 | move(point);
104 | }
105 | else if (event->key() == Qt::Key_Right)
106 | {
107 | QPoint point = this->pos();
108 | point.setX(point.x() + 1);
109 | move(point);
110 | }
111 |
112 | QWidget::keyReleaseEvent(event);
113 | }
114 |
--------------------------------------------------------------------------------
/code/WallpaperTool/WallpaperTool.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | qml;cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | qrc;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 | {99349809-55BA-4b9d-BF79-8FDBB0286EB3}
18 | ui
19 |
20 |
21 | {639EADAA-A684-42e4-A9AD-28FC9BCB8F7C}
22 | ts
23 |
24 |
25 | {9bbf64ad-36ba-48ce-947c-d7e779750507}
26 |
27 |
28 | {3ddd2786-4308-4578-9307-04382bb9a1d8}
29 |
30 |
31 |
32 |
33 | Header Files
34 |
35 |
36 | Source Files
37 |
38 |
39 | Header Files
40 |
41 |
42 | Header Files
43 |
44 |
45 |
46 |
47 | Source Files
48 |
49 |
50 | Widgets
51 |
52 |
53 | Widgets
54 |
55 |
56 | SettingsDlg
57 |
58 |
59 | Widgets
60 |
61 |
62 | Source Files
63 |
64 |
65 | Widgets
66 |
67 |
68 |
69 |
70 | Header Files
71 |
72 |
73 | Widgets
74 |
75 |
76 | Widgets
77 |
78 |
79 | SettingsDlg
80 |
81 |
82 | Widgets
83 |
84 |
85 | Widgets
86 |
87 |
88 |
89 |
90 | Resource Files
91 |
92 |
93 |
--------------------------------------------------------------------------------
/include/mainframeinterface.h:
--------------------------------------------------------------------------------
1 | #ifndef MAINWINDOWINTERFACE
2 | #define MAINWINDOWINTERFACE
3 |
4 | class IModule;
5 |
6 | //界面框架接口
7 | //接口中所有const char*类型均为UTF8编码。
8 | class IMainFrame
9 | {
10 | public:
11 | /**
12 | * @brief 设置主窗口Ribbin工具栏命令的启用/禁用状态
13 | * @param[in] strId: 命令的ID
14 | * @param[in] enable: 是否启用
15 | */
16 | virtual void SetItemEnable(const char* strId, bool enable) = 0;
17 |
18 | /**
19 | * @brief 判断主窗口Ribbin工具栏的一个命令是否被被启用
20 | * @param[in] strId: 命令的ID
21 | * @return 是否被启用
22 | */
23 | virtual bool IsItemEnable(const char* strId) = 0;
24 |
25 | /*
26 | * 函数说明: 设置主窗口Ribbin工具栏命令的选中状态
27 | * 输入参数:
28 | * strId: 命令的ID
29 | * enable: 是否选中
30 | */
31 | virtual void SetItemChecked(const char* strId, bool checked) = 0;
32 |
33 | /**
34 | * @brief 判断主窗口Ribbin工具栏的一个命令是否被选中
35 | * @param[in] strId: 命令的ID
36 | * @return 是否被选中
37 | */
38 | virtual bool IsItemChecked(const char* strId) = 0;
39 |
40 | /**
41 | * @brief 获取Ribbon标签中一个元素的文本
42 | * @param[in] strId: 命令的ID
43 | * @return 获取的文本
44 | */
45 | virtual const char* GetItemText(const char* strId) = 0;
46 |
47 | /**
48 | * @brief 设置Ribbon标签中一个元素的文本
49 | * @param[in] strId: 命令的ID
50 | * @param[in] text: 设置的文本
51 | */
52 | virtual void SetItemText(const char* strId, const char* text) = 0;
53 |
54 | /**
55 | * @brief 设置Ribbon标签中一个元素的图标
56 | * @param[in] strId: 命令的ID
57 | * @param[in] iconPath: 图标的路径
58 | * @param[in] iconSize: 图标的大小
59 | */
60 | virtual void SetItemIcon(const char* strId, const char* iconPath, int iconSize) = 0;
61 |
62 | /**
63 | * @brief 获取Ribbon标签中Combox或ListWidget当前选中项
64 | * @param[in] strId: 命令的ID
65 | * @return 选中项的序号
66 | */
67 | virtual int GetItemCurIndex(const char* strId) = 0;
68 |
69 | /**
70 | * @brief 设置Ribbon标签中Combox或ListWidget当前选中项
71 | * @param[in] strId: 命令的ID
72 | * @param[in] index: 选中项的序号
73 | */
74 | virtual void SetItemCurIIndex(const char* strId, int index) = 0;
75 |
76 | /**
77 | * @brief 根据模块名称获取模块对象的指针
78 | * @param[in] moduleName 模块名称,由模块接口GetModuleName()返回。
79 | * @return 模块对象的指针
80 | */
81 | virtual IModule *GetModule(const char* strModuleName) const = 0;
82 |
83 | /**
84 | * @brief 向一个模块发送消息
85 | * @param[in] moduleName 模块名称(如果为nullptr或空字符,则向所有模块发送)
86 | * @param[in] msgType 消息类型
87 | * @param[in] para1 para2 可选参数
88 | * @return 返回的消息
89 | */
90 | virtual void* SendModuleMessage(const char* moduleName, const char* msgType, void* para1 = nullptr, void* para2 = nullptr) = 0;
91 |
92 | /**
93 | * @brief 从主窗口Ribbin工具栏获取一个命令
94 | * @param[in] strId: 命令的ID
95 | * @return 命令的QAction指针
96 | */
97 | virtual void* GetAcion(const char* strId) = 0;
98 |
99 | /**
100 | * @brief 从主窗口Ribbin工具栏获取一个控件
101 | * @param[in] strId: 命令的ID
102 | * @return 控件的QWidget指针(如果是Action则返回QToolButton的指针)
103 | */
104 | virtual void* GetWidget(const char* strId) = 0;
105 |
106 | /**
107 | * @brief 从主窗口Ribbin工具栏获取一个菜单
108 | * @param[in] strId: 菜单的ID
109 | * @return 菜单的QMenu指针
110 | */
111 | virtual void* GetMenu(const char* strId) = 0;
112 |
113 | /**
114 | * @brief 设置状态栏文本
115 | * @param[in] text 要设置的文本
116 | * @param[in] timeOut 文本显示的时长,单位为毫秒,0表示一直显示
117 | */
118 | virtual void SetStatusBarText(const char* text, int timeOut) = 0;
119 | };
120 |
121 | #endif // MAINWINDOWINTERFACE
122 |
123 |
--------------------------------------------------------------------------------
/code/CCommonTools/CommonTools.cpp:
--------------------------------------------------------------------------------
1 | #include "CommonTools.h"
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | CCommonTools::CCommonTools()
12 | {
13 | }
14 |
15 | QFileInfoList CCommonTools::FindFile(const QString & strFilePath, const QStringList & nameFilters)
16 | {
17 | QFileInfoList fileList;
18 | if (strFilePath.isEmpty())
19 | {
20 | return fileList;
21 | }
22 |
23 | QDir dir;
24 | dir.setPath(strFilePath);
25 | if (!nameFilters.isEmpty())
26 | dir.setNameFilters(nameFilters);
27 | QDirIterator iter(dir, QDirIterator::Subdirectories);
28 | while (iter.hasNext())
29 | {
30 | iter.next();
31 | QFileInfo info = iter.fileInfo();
32 | if (info.isFile())
33 | {
34 | fileList.append(info);
35 | }
36 | }
37 | return fileList;
38 | }
39 |
40 | QMainWindow * CCommonTools::GetMainWindow()
41 | {
42 | Q_FOREACH(QWidget* w, qApp->topLevelWidgets())
43 | {
44 | QMainWindow* pMainWindow = qobject_cast(w);
45 | if (pMainWindow != nullptr)
46 | return pMainWindow;
47 | }
48 | return nullptr;
49 | }
50 |
51 | void CCommonTools::WriteLog(const QString& strLogInfo, const QString& strFilePath)
52 | {
53 | QString strLogPath = strFilePath;
54 | if (strLogPath.isEmpty())
55 | strLogPath = QString("%1/%2.log").arg(qApp->applicationDirPath()).arg(qApp->applicationName());
56 | QFile file(strLogPath);
57 | if (file.open(QIODevice::ReadWrite | QIODevice::Append))
58 | {
59 | QTextStream textOutput(&file);
60 | textOutput.setCodec("UTF-8");
61 | QString currentTime = QDateTime::currentDateTime().toString("yyyyMMdd hh:mm:ss ");
62 | textOutput << currentTime << strLogInfo << "\r\n";
63 | file.close();
64 | }
65 | }
66 |
67 | QIcon CCommonTools::CreateIcon(const QString& strPath, int size)
68 | {
69 | QPixmap image(strPath);
70 | image = image.scaled(size, size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
71 | return QIcon(image);
72 | }
73 |
74 | void CCommonTools::DelayNotBlocked(int msec)
75 | {
76 | QEventLoop loop;
77 | QTimer::singleShot(msec, &loop, SLOT(quit()));
78 | loop.exec();
79 | }
80 |
81 | bool CCommonTools::IsUtf8Bytes(const QByteArray& data)
82 | {
83 | int charByteCounter = 1; //计算当前正分析的字符应还有的字节数
84 | unsigned char curByte; //当前分析的字节.
85 | bool ascii = true;
86 | for (int i = 0; i < data.size(); i++)
87 | {
88 | curByte = static_cast(data[i]);
89 | if (charByteCounter == 1)
90 | {
91 | if (curByte >= 0x80)
92 | {
93 | ascii = false;
94 | //判断当前
95 | while (((curByte <<= 1) & 0x80) != 0)
96 | {
97 | charByteCounter++;
98 | }
99 | //标记位首位若为非0 则至少以2个1开始 如:110XXXXX...........1111110X
100 | if (charByteCounter == 1 || charByteCounter > 6)
101 | {
102 | return false;
103 | }
104 | }
105 | }
106 | else
107 | {
108 | //若是UTF-8 此时第一位必须为1
109 | if ((curByte & 0xC0) != 0x80)
110 | {
111 | return false;
112 | }
113 | charByteCounter--;
114 | }
115 | }
116 | if (ascii) return false; //如果全是ASCII字符,返回false
117 | else return true;
118 | }
119 |
120 | //int CCommonTools::QStringFindFirstOf(const QString& str, const char* findStr, int start)
121 | //{
122 | //
123 | //}
124 |
--------------------------------------------------------------------------------
/code/AddCodeHeader/AddCodeHeader.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 | {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}
18 | qrc;*
19 | false
20 |
21 |
22 | {99349809-55BA-4b9d-BF79-8FDBB0286EB3}
23 | ui
24 | true
25 |
26 |
27 | {10fd99a1-da8e-42bd-90e9-a473ceb53dff}
28 |
29 |
30 |
31 |
32 | Header Files
33 |
34 |
35 | Source Files
36 |
37 |
38 | Header Files
39 |
40 |
41 | Header Files
42 |
43 |
44 | Header Files
45 |
46 |
47 | Header Files
48 |
49 |
50 |
51 |
52 | Header Files
53 |
54 |
55 | Header Files
56 |
57 |
58 | Header Files
59 |
60 |
61 | Header Files
62 |
63 |
64 | Header Files
65 |
66 |
67 | Header Files
68 |
69 |
70 |
71 |
72 | Source Files
73 |
74 |
75 | Source Files
76 |
77 |
78 | Source Files
79 |
80 |
81 | Source Files
82 |
83 |
84 | Source Files
85 |
86 |
87 | Source Files
88 |
89 |
90 | Source Files
91 |
92 |
93 | Source Files
94 |
95 |
96 | Source Files
97 |
98 |
99 |
--------------------------------------------------------------------------------
/code/CCommonTools/tableitemmodel.h:
--------------------------------------------------------------------------------
1 | #ifndef CTABLEITEMMODEL_H
2 | #define CTABLEITEMMODEL_H
3 |
4 | #include
5 | #include
6 | #include "ccommontools_global.h"
7 |
8 | typedef QMap ColumeItemMap;
9 | class TableItemModelPrivate;
10 |
11 | //提供一个表格的数据模型
12 | class CCOMMONTOOLS_EXPORT CTableItemModel : public QAbstractTableModel
13 | {
14 | Q_OBJECT
15 |
16 | public:
17 | explicit CTableItemModel(int columeCount, QObject *parent = nullptr);
18 | virtual ~CTableItemModel();
19 |
20 | // Header:
21 | QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
22 | bool setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role = Qt::EditRole) override;
23 |
24 | // Basic functionality:
25 | int rowCount(const QModelIndex &parent = QModelIndex()) const override;
26 | int columnCount(const QModelIndex &parent = QModelIndex()) const override;
27 |
28 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
29 |
30 | // Editable:
31 | bool setData(const QModelIndex &index, const QVariant &value,
32 | int role = Qt::EditRole) override;
33 |
34 | /**
35 | * @brief 设置是否启用鼠标提示
36 | * @param[in] enable 是否启用鼠标提示
37 | */
38 | void SetMouseTooltipEnable(bool enable);
39 |
40 | //清空表格数据
41 | void ClearData();
42 |
43 | /**
44 | * @brief 删除一行数据
45 | * @param[in] row: 要删除的行号
46 | */
47 | void DeleteItem(int row);
48 |
49 | /**
50 | * @brief 修改指定行的数据
51 | * @param[in] row: 要修改的行号
52 | * @param[in] itemMap: 每一列的列号和其对应的数据
53 | * @return 返回值
54 | */
55 | void ModifyItem(int row, const ColumeItemMap& itemMap);
56 |
57 | /**
58 | * @brief 向表格的末尾追加一行数据
59 | * @param[in] itemMap: 每一列的列号和其对应的数据
60 | */
61 | void AddItem(const ColumeItemMap& itemMap);
62 |
63 | /**
64 | * @brief 为表格中的一行设置用户自定义数据
65 | * @param[in] row: 要修改的行号
66 | * @param[in] key: 用户数据的key
67 | * @param[in] value: 用户数据的值
68 | * @return 是否成功。如果行号为无效值则会返回false。
69 | */
70 | bool SetItemData(int row, const QString& key, const QVariant& value);
71 |
72 | /**
73 | * @brief 获取表格中一行的用户数据
74 | * @param[in] row: 要修改的行号
75 | * @param[in] key: 用户数据的key
76 | * @return 用户数据的值
77 | */
78 | QVariant ItemData(int row, const QString& key);
79 |
80 | /**
81 | * @brief 获取指定行的数据
82 | * @param[in] row: 行号
83 | * @param[in] itemMap: 每一列的列号和其对应的数据
84 | * @return 返回值
85 | */
86 | void GetItem(int row, ColumeItemMap& itemMap);
87 |
88 | /**
89 | * @brief 获取指定单元格的数据
90 | * @param[in] row: 行号
91 | * @param[out] col: 列号
92 | * @return 单元格的文本
93 | */
94 | QString GetItemText(int row, int col) const;
95 |
96 | /**
97 | * @brief 设置指定单元格的数据
98 | * @param[in] row: 行号
99 | * @param[out] col: 列号
100 | * @param[out] str: 要设置的字符串
101 | */
102 | void SetItemText(int row, int col, const QString& str);
103 |
104 | /**
105 | * @brief 获取表格的行数
106 | * @return 表格的行数
107 | */
108 | int ItemCount() const;
109 |
110 | /**
111 | * @brief 查找一个数据所在行
112 | * @param[in] str: 要查找的名称
113 | * @param[in] col: 要查找的列
114 | * @return 找到的行号。未找到返回负数
115 | */
116 | int FindItem(const QString& str, int col);
117 |
118 | /**
119 | * @brief 对表格进行快速搜索,将不匹配的项目隐藏
120 | * @param[in] strText: 搜索的文文本
121 | * @param[in] pTableView: 表格控件
122 | */
123 | void QuickSearch(const QString& text, QTableView* pTableView);
124 |
125 | protected:
126 | TableItemModelPrivate* d;
127 | };
128 |
129 | #endif // CTABLEITEMMODEL_H
130 |
--------------------------------------------------------------------------------
/code/FileRename/FileRenameHelper.cpp:
--------------------------------------------------------------------------------
1 | #include "FileRenameHelper.h"
2 | #include
3 | #include
4 | #include
5 |
6 | bool FileRenameHelper::FileRename(const QString& filePath, QString& newFileName, bool autoResoveConflict)
7 | {
8 | QFileInfo fileInfo(filePath);
9 | if (!fileInfo.isFile())
10 | return false;
11 | QString newFilePath = fileInfo.dir().filePath(newFileName);
12 | if (autoResoveConflict)
13 | {
14 | FileAutoResoveConfict(newFilePath);
15 | newFileName = QFileInfo(newFilePath).fileName();
16 | }
17 | if (filePath == newFilePath)
18 | return true;
19 | return QFile::rename(filePath, newFilePath);
20 | }
21 |
22 | bool FileRenameHelper::FileRenameByCreateTime(const QString& filePath, QString& newFileName, const QString& strPrefex, bool autoResoveConflict)
23 | {
24 | QFileInfo fileInfo(filePath);
25 | if (!fileInfo.isFile())
26 | return false;
27 |
28 | QDateTime lastModified = fileInfo.lastModified();
29 | newFileName = strPrefex + lastModified.toString("yyyyMMdd_hhmmss");
30 | newFileName += '.';
31 | newFileName += fileInfo.completeSuffix();
32 |
33 | return FileRename(filePath, newFileName, autoResoveConflict);
34 | }
35 |
36 | bool FileRenameHelper::FileRenameByNumber(const QString& filePath, int number, int digit, QString& newFileName, const QString& strPrefex, bool autoResoveConflict)
37 | {
38 | QFileInfo fileInfo(filePath);
39 | if (!fileInfo.isFile())
40 | return false;
41 |
42 | newFileName = strPrefex;
43 | newFileName += QString("%1").arg(number, digit, 10, QChar('0'));
44 | newFileName += '.';
45 | newFileName += fileInfo.completeSuffix();
46 |
47 | return FileRename(filePath, newFileName, autoResoveConflict);
48 | }
49 |
50 | bool FileRenameHelper::FileRenameReplace(const QString& filePath, const QString& findStr, const QString& replaceStr, QString& newFileName, bool autoResoveConflict)
51 | {
52 | QFileInfo fileInfo(filePath);
53 | if (!fileInfo.isFile())
54 | return false;
55 |
56 | newFileName = fileInfo.baseName();
57 | newFileName.replace(findStr, replaceStr, Qt::CaseInsensitive);
58 | newFileName += '.';
59 | newFileName += fileInfo.completeSuffix();
60 |
61 | return FileRename(filePath, newFileName, autoResoveConflict);
62 | }
63 |
64 | bool FileRenameHelper::StrIsNumber(const QString& str)
65 | {
66 | if (str.isEmpty())
67 | return false;
68 | for (const auto& ch : str)
69 | {
70 | if (ch < '0' || ch > '9')
71 | return false;
72 | }
73 | return true;
74 | }
75 |
76 | bool FileRenameHelper::IsFileNameNumbered(const QString& file_name, int& number, int& index)
77 | {
78 | if (file_name.isEmpty())
79 | return false;
80 | if (file_name.back() != ')')
81 | return false;
82 | int size{ file_name.size() };
83 | index = file_name.lastIndexOf('('); //往前查找右括号
84 | if (index <= 0) //左括号不能在字符串开头
85 | return false;
86 | QString number_str{ file_name.mid(index + 1, size - index - 2) }; //获取两个括号之间的文本
87 | if (StrIsNumber(number_str)) //判断文本是否是数字
88 | {
89 | number = number_str.toInt();
90 | return true;
91 | }
92 | else
93 | {
94 | return false;
95 | }
96 | }
97 |
98 | void FileRenameHelper::FileAutoResoveConfict(QString& file_path)
99 | {
100 | while (QFileInfo(file_path).isFile())
101 | {
102 | //判断文件名的末尾是否符合“(数字)”的形式
103 | QString file_name; //文件名(不含扩展名)
104 | QFileInfo c_file_path(file_path);
105 | file_name = c_file_path.baseName();
106 | QString ext{ c_file_path.completeSuffix() };
107 | int num;
108 | int index;
109 | bool is_numbered{ IsFileNameNumbered(file_name, num, index) }; //文件名的末尾是否符合“(数字)”的形式
110 | if (!is_numbered) //如果文件名末尾没有“(数字)”,则在末尾添加“ (1)”
111 | {
112 | file_name += " (1)";
113 | }
114 | else //否则,将原来的数字加1
115 | {
116 | file_name = file_name.mid(0, index);
117 | QString num_str = QString("(%1)").arg(num + 1);
118 | file_name += num_str;
119 | }
120 | file_path = c_file_path.dir().filePath(file_name + '.' + ext);
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/code/CCommonTools/CCommonTools.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
15 |
16 |
17 | {D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}
18 | qrc;*
19 | false
20 |
21 |
22 | {25865afb-acfb-4e18-8dbc-5ee2775d54a2}
23 |
24 |
25 | {0118e4c3-a7af-4528-a7c4-3a2395fccacb}
26 |
27 |
28 | {fe9082a6-3e3e-474f-90f1-23ea77d246f3}
29 |
30 |
31 |
32 |
33 | Header Files
34 |
35 |
36 | Source Files
37 |
38 |
39 | Header Files
40 |
41 |
42 | DatabaseTool
43 |
44 |
45 | Header Files
46 |
47 |
48 | Header Files
49 |
50 |
51 | Widgets
52 |
53 |
54 | Widgets
55 |
56 |
57 | Models
58 |
59 |
60 |
61 |
62 | DatabaseTool
63 |
64 |
65 | Source Files
66 |
67 |
68 | Source Files
69 |
70 |
71 | Models
72 |
73 |
74 | Widgets
75 |
76 |
77 | Widgets
78 |
79 |
80 | Widgets
81 |
82 |
83 | Widgets
84 |
85 |
86 | Models
87 |
88 |
89 | Models
90 |
91 |
92 |
93 |
94 | Resource Files
95 |
96 |
97 |
98 |
99 | Models
100 |
101 |
102 | Widgets
103 |
104 |
105 | Widgets
106 |
107 |
108 | Models
109 |
110 |
111 |
--------------------------------------------------------------------------------
/code/CCommonTools/TreeItem.cpp:
--------------------------------------------------------------------------------
1 | #include "TreeItem.h"
2 |
3 | CTreeItem::CTreeItem()
4 | : m_pParent(nullptr)
5 | {
6 |
7 | }
8 |
9 | CTreeItem::~CTreeItem()
10 | {
11 |
12 | }
13 |
14 | QVariant CTreeItem::GetProperty(const QString &strProperty) const
15 | {
16 | return m_propertyMap.value(strProperty);
17 | }
18 |
19 | void CTreeItem::SetProperty(const QString &strProperty, QVariant value)
20 | {
21 | m_propertyMap[strProperty] = value;
22 | }
23 |
24 | void CTreeItem::ClearPorperty(const QString &strProperty)
25 | {
26 | m_propertyMap.remove(strProperty);
27 | }
28 |
29 | CTreeItem *CTreeItem::GetParent() const
30 | {
31 | return m_pParent;
32 | }
33 |
34 | void CTreeItem::SetParent(CTreeItem *pParent)
35 | {
36 | m_pParent = pParent;
37 | }
38 |
39 | void CTreeItem::AddItem(CTreeItemPtr pItem)
40 | {
41 | m_childList.push_back(pItem);
42 | pItem->SetParent(this);
43 | }
44 |
45 | const TreeItemList &CTreeItem::GetChildList()
46 | {
47 | return m_childList;
48 | }
49 |
50 | int CTreeItem::IndexOf(CTreeItem *pItem)
51 | {
52 | for (int i = 0; i < m_childList.size(); i++)
53 | {
54 | if (m_childList[i].get() == pItem)
55 | return i;
56 | }
57 | return -1;
58 | }
59 |
60 | bool CTreeItem::HasChildren() const
61 | {
62 | return !m_childList.isEmpty();
63 | }
64 |
65 | int CTreeItem::GetLevel() const
66 | {
67 | int level = 0;
68 | const CTreeItem* pItem = this;
69 | while (true)
70 | {
71 | pItem = pItem->GetParent();
72 | if (pItem != nullptr)
73 | level++;
74 | else
75 | break;
76 | }
77 | return level;
78 | }
79 |
80 | void CTreeItem::SetInternalPointer(void *pInternalPointer)
81 | {
82 | m_internalPointer = pInternalPointer;
83 | }
84 |
85 | void *CTreeItem::GetInternalPointer() const
86 | {
87 | return m_internalPointer;
88 | }
89 |
90 | void CTreeItem::CopyProperties(const CTreeItem &another)
91 | {
92 | m_propertyMap = another.m_propertyMap;
93 | }
94 |
95 | int CTreeItem::IterateItems(std::function func)
96 | {
97 | int itemCount = 0;
98 | bool rtn = func(this, itemCount);
99 | itemCount++;
100 | if (rtn)
101 | return itemCount;
102 | Q_FOREACH(auto& item, m_childList)
103 | {
104 | itemCount += item->IterateItems(func);
105 | }
106 | return itemCount;
107 | }
108 |
109 |
110 | /////////////////////////////////////////////////////////////////////////////////////////
111 | /////////////////////////////////////////////////////////////////////////////////////////
112 |
113 | CTreeItemGroup::CTreeItemGroup()
114 | {
115 |
116 | }
117 |
118 | void CTreeItemGroup::AddItem(CTreeItemPtr pItem)
119 | {
120 | m_childList.push_back(pItem);
121 | }
122 |
123 | CTreeItemPtr CTreeItemGroup::GetChild(int n) const
124 | {
125 | if (n >= 0 && n < m_childList.size())
126 | return m_childList[n];
127 | else
128 | return nullptr;
129 | }
130 |
131 | int CTreeItemGroup::IndexOf(CTreeItem *pItem)
132 | {
133 | for (int i = 0; i < m_childList.size(); i++)
134 | {
135 | if (m_childList[i].get() == pItem)
136 | return i;
137 | }
138 | return -1;
139 | }
140 |
141 | const TreeItemList &CTreeItemGroup::GetChildList() const
142 | {
143 | return m_childList;
144 | }
145 |
146 | TreeItemList &CTreeItemGroup::ChildList()
147 | {
148 | return m_childList;
149 | }
150 |
151 | CTreeItem *CTreeItemGroup::FindItem(const QString &strProperty, QVariant value)
152 | {
153 | CTreeItem* pFindItem = nullptr;
154 | IterateItems([&](CTreeItem* pItem, int) ->bool
155 | {
156 | if (pItem != nullptr && pItem->GetProperty(strProperty) == value)
157 | {
158 | pFindItem = pItem;
159 | return true;
160 | }
161 | return false;
162 | });
163 | return pFindItem;
164 | }
165 |
166 |
167 | int CTreeItemGroup::IterateItems(std::function func) const
168 | {
169 | int itemCount = 0;
170 | Q_FOREACH(auto& item, m_childList)
171 | {
172 | itemCount += item->IterateItems(func);
173 | }
174 | return itemCount;
175 | }
176 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # DeveloperTools
2 | 一些小工具集合。
3 |
4 | 使用Qt开发,支持跨平台。
5 |
6 | Windows下使用 Visual Studio 2022 + Qt VS Tools 开发,Qt 版本:5.15.2。
7 |
8 | Linux下使用QtCreator开发。
9 |
10 | 支持模块扩展。
11 |
12 | 目前集成了以下模块:
13 |
14 | | 模块名 | 语言 | 使用的框架 |
15 | | ---------- | ---- | ---------- |
16 | | 代码工具 | C++ | Qt |
17 | | 壁纸工具 | C++ | Qt |
18 | | 窗口调整器 | C++ | MFC |
19 | | 取色器 | C++ | MFC |
20 | | 密码生成器 | C# | WinForm |
21 | | 像素尺 | C++ | Qt |
22 | | 文件重命名 | C++ | Qt |
23 |
24 | 其中窗口调整器、取色器和密码生成器是我以前开发的小工具,也可以单独运行。
25 |
26 | ## 界面框架
27 |
28 | 界面框架使用Qt编写,实现了Ribbon风格界面,通过`MainFrame.xml`文件配置Ribbon标签中的元素以及加载的模块。
29 |
30 | 界面框架的说明和源代码请参见此版本库:
31 |
32 | [zhongyang219/RibbonUiFrame: 这是一个界面框架模块,实现了Ribbon风格的样式,使用xml文件配置Ribbon标签页。此框架可以将Qt或MFC/Win32程序集成到同一个应用程序中。 (github.com)](https://github.com/zhongyang219/RibbonUiFrame/)
33 |
34 | 界面框架采用动态库的形式保存在本项目中,如果使用的Qt版本与本项目不同,请从以上版本库拉取界面框架的源代码后自行编译生成`RibbonFrame.dll`和`StylePlugin.dll`文件。
35 |
36 | ## 代码工具
37 |
38 |
39 |
40 | 代码工具具有批量删除代码注释和添加代码头的功能。
41 |
42 | ### 添加文件
43 |
44 | * 在“设置扫描路径”下方的文本框右侧点击“浏览”按钮选择一个扫描文件。
45 |
46 | * 在扫描文件的格式下拉框中输入要扫描文件格式,多种格式使用半角分号分隔。
47 |
48 | * 点击Ribbon栏中的“扫描文件”按钮,此时符合条件的文件会在“文件列表”中显示出来。
49 | * 列表右侧的“添加”、“移除”、“清空”可以对列表中的文件进行操作。
50 |
51 | ### 批量删除注释
52 |
53 | 将要操作的文件添加到列表后,可以通过Ribbon栏中设置相关的选项,如下图所示:
54 |
55 | 
56 |
57 | 选中“删除注释”可以删除代码中的注释。
58 |
59 | 选中“移除多余的空格”可以删除每行代码末尾的空格。
60 |
61 | 选中“移除多余的空白行”可以将代码中多余的空行删除,可以在右侧的下拉列表中选择需要保留的连续空白行数。
62 |
63 | 点击“执行”工具即可根据设置的选项批量处理列表中的文件。
64 |
65 | ### 添加代码头
66 |
67 | 选中Ribbon栏中的“添加加代码头”按钮后,窗口右侧会显示添加代码头的界面。
68 |
69 | 将要操作的文件添加到左侧列表中后,在添加代码头列表中勾选要添加到代码头中的内容,点击Ribbon栏中“添加代码头”右侧的“执行”按钮即可为列表中的文件批量添加代码头。
70 |
71 | ## 壁纸工具
72 |
73 |
74 |
75 | 此工具的作用是,当你将桌面壁纸设置为“幻灯片播放”并且你的壁纸文件夹下有很多图片时,它可以告诉你当前显示的是哪片图片,并且可以将当前图片保存到指定目录。
76 |
77 | 目前实现了显示当前壁纸,当前壁纸另存为,删除当前壁纸的功能。
78 |
79 | ## 窗口调整器
80 |
81 | 这是一个用于调整窗口大小的软件,具有以去除窗口的边框、强制最大化等功能。源代码和说明请参见以下版本库:
82 |
83 | [zhongyang219/WindowResizer: 这是一个用于调整窗口大小的软件,这对于那些无法调整大小的窗口尤其有用。 (github.com)](https://github.com/zhongyang219/WindowResizer)
84 |
85 |
86 |
87 | 如果需要将WindowResizer作为一个模块加载到DevelperTools中,拉取WindowResizer后,请在Visual Studio菜单栏选择“项目”>“属性”,选择“常规”,将“配置类型”由“应用程序(.exe)”改成“动态库(.dll)”,编译生成dll文件后即可被DevelperTools加载。
88 |
89 | ## 取色器
90 |
91 | 取色器是一个取色工具,源代码和说明请参见以下版本库:
92 |
93 | [zhongyang219/ColorPicker: 这是一个简单的取色软件 (github.com)](https://github.com/zhongyang219/ColorPicker)
94 |
95 |
96 |
97 | 要将ColorPicker作为一个模块加载到DevelperTools中,同样需要在Visual Studio菜单栏选择“项目”>“属性”,选择“常规”,将“配置类型”由“应用程序(.exe)”改成“动态库(.dll)”。
98 |
99 | ## 密码生成器
100 |
101 |
102 |
103 | 这是一个用于生成随机密码的小工具,源代码和说明请参见以下版本库:
104 |
105 | [zhongyang219/PasswordGenerator: 这是一个用于生成一个随机字符串的小工具。 (github.com)](https://github.com/zhongyang219/PasswordGenerator)
106 |
107 | ## 像素尺
108 |
109 | 像素尺是一个用于测量屏幕上元素像素值的小工具。
110 |
111 | 
112 |
113 | 点击Ribbon栏中的“显示水平标尺”和“显示垂直标尺”按钮可以在屏上显示一个可自由拖动的标尺。
114 |
115 | ### 设置缩放比例
116 |
117 | * 勾选Ribbon菜单中的“系统缩放比例”可以使像素尺的刻度按照当前系统DPI设置放大。
118 | * 不勾选“系统缩放比例”时可以在“自定义比例”下拉列表中选择一个缩放比例,默认为100%。
119 |
120 | 如果你希望在不同dpi设置的电脑上测量同一界面元素时得到相同的测量结果,那么你应该勾选“系统缩放比例”,使得像素尺的刻度会跟随系统DPI设置而缩放。
121 |
122 | ### 设置标尺最小刻度
123 |
124 | 点击Ribbon菜单中“标尺最小刻度”组中的单选框可以设置标尺最小刻度。
125 |
126 | ### 显示屏标尺
127 |
128 | 点击Ribbon菜单中的“显示水平标尺”或“显示垂直标尺”可以显示一个屏幕标尺,你可以将屏幕标尺拖动到需要测量的地方。
129 |
130 | 当屏幕标尺处于激活状态时,可以通过键盘上的上下左右方向键以1像素为单位移动屏幕标尺的位置。
131 |
132 | ## 文件重命名
133 |
134 | 
135 |
136 | 这是一个简单的文件重命名工具,实现了使用修改时间重命名、使用数字编辑重命名和替换功能。
137 |
138 | 点击Ribbon栏中的“添加文件”或“添加文件夹”按钮可以将要操作的文件添加到文件列表中。也可以直接将文件或文件夹拖放到窗口中。
139 |
140 | 在“重命名选项”中可以设置重命名模式。
141 |
142 | * 勾选“添加前缀”后可以设置重命名时在文件名前面添加的字符串。
143 |
144 | * 勾选“自动解决命名冲突”时,如果重命名时目标文件已经存在,则会自动使用新的文件名,新文件的命名规则为:如果文件名不是以“(数字)”的格式结尾,则会在文件名末尾加上“(1)”;如果文件名是以“(数字)”的格式结尾,则将括号内的数字加1。
145 |
146 | 设置好选项后点击Ribbon栏中的“执行”按钮可以对列表中的文件进行重命名。
147 |
148 | ### 使用修改时间重命名
149 |
150 | 选择“使用修改时间重命名”时,会根据文件名的修改时间重命名。
151 |
152 | ### 使用数字编号重命名
153 |
154 | 选择“使用数字编号重命名”时,可以设置数字的起始值和数字的位数。
155 |
156 | ### 替换
157 |
158 | 选择“替换”时,在文本框中填入替换前和替换后的文本,点击“执行”即可完成替换。
159 |
160 | 此功能不区分大小写。
161 |
--------------------------------------------------------------------------------
/code/AddCodeHeader/RemoveCommentHelper.cpp:
--------------------------------------------------------------------------------
1 | #include "RemoveCommentHelper.h"
2 | #include
3 | #include
4 |
5 | CRemoveCommentHelper::CRemoveCommentHelper()
6 | {
7 | }
8 |
9 | bool CRemoveCommentHelper::RemoveFileComment(const QString& file_path, bool removeComment, bool bRemoveSpace, bool bRemoveReturn, int keepReturnNum, RemoveResult& result)
10 | {
11 | QFile file(file_path);
12 | if (!file.open(QFile::ReadOnly))
13 | return false;
14 | QByteArray file_contents(file.readAll());
15 | file.close();
16 |
17 | RemoveComment(file_contents, removeComment, bRemoveSpace, bRemoveReturn, keepReturnNum, result);
18 |
19 | file.setFileName(file_path);
20 | if (!file.open(QFile::WriteOnly))
21 | return false;
22 | file.write(file_contents);
23 | file.close();
24 | return true;
25 | }
26 |
27 | void CRemoveCommentHelper::RemoveComment(QByteArray& file_contents, bool removeComment, bool bRemoveSpace, bool bRemoveReturn, int keepReturnNum, RemoveResult& result)
28 | {
29 | result = RemoveResult();
30 | if (removeComment)
31 | {
32 | //删除“//”
33 | int index1 = -1, index2 = -1;
34 | while (true)
35 | {
36 | index1 = FindStringNotInQuotation(file_contents, "//", index1 + 1);
37 | index2 = FindFirstOf(file_contents, "\r\n", index1 + 1);
38 | if (index1 < 0 || index2 < 0)
39 | break;
40 |
41 | file_contents.remove(index1, index2 - index1);
42 | result.single_line_comment_removed++;
43 | }
44 | //删除“/**/”
45 | index1 = -1, index2 = -1;
46 | while (true)
47 | {
48 | index1 = FindStringNotInQuotation(file_contents, "/*", index1 + 1);
49 | index2 = FindStringNotInQuotation(file_contents, "*/", index1 + 1);
50 | if (index1 < 0 || index2 < 0)
51 | break;
52 | file_contents.remove(index1, index2 - index1 + 2);
53 | result.multi_line_comment_removed++;
54 | }
55 | }
56 |
57 | //移除多余的空格
58 | if (bRemoveSpace)
59 | {
60 | while (file_contents.contains(" \r\n"))
61 | {
62 | file_contents.replace(" \r\n", "\r\n");
63 | result.space_removed++;
64 | }
65 | while (file_contents.contains(" \n"))
66 | {
67 | file_contents.replace(" \n", "\n");
68 | result.space_removed++;
69 | }
70 |
71 | //移除多余的制表符
72 | while (file_contents.contains("\t\r\n"))
73 | {
74 | file_contents.replace("\t\r\n", "\r\n");
75 | result.space_removed++;
76 | }
77 | while (file_contents.contains("\t\n"))
78 | {
79 | file_contents.replace("\t\n", "\n");
80 | result.space_removed++;
81 | }
82 | }
83 |
84 | //移除多余的回车
85 | if (bRemoveReturn)
86 | {
87 | auto createString = [](const char* str, int repeatTimes) ->QByteArray
88 | {
89 | QByteArray strResult;
90 | for (int i = 0; i < repeatTimes; i++)
91 | strResult += str;
92 | return strResult;
93 | };
94 | while (file_contents.contains(createString("\r\n", keepReturnNum + 2)))
95 | {
96 | file_contents.replace(createString("\r\n", keepReturnNum + 2), createString("\r\n", keepReturnNum + 1));
97 | result.return_removed++;
98 | }
99 | while (file_contents.contains(createString("\n", keepReturnNum + 2)))
100 | {
101 | file_contents.replace(createString("\n", keepReturnNum + 2), createString("\n", keepReturnNum + 1));
102 | result.return_removed++;
103 | }
104 | }
105 | }
106 |
107 | int CRemoveCommentHelper::FindFirstOf(const QByteArray& contents, const QByteArray& strFind, int index)
108 | {
109 | for (int i = index; i < contents.size(); i++)
110 | {
111 | if (strFind.contains(contents[i]))
112 | return i;
113 | }
114 | return -1;
115 | }
116 |
117 | int CRemoveCommentHelper::FindStringNotInQuotation(const QByteArray& contents, const char * strFind, int index)
118 | {
119 | index--;
120 | while (true)
121 | {
122 | index = contents.indexOf(strFind, index + 1);
123 | if (index < 0)
124 | break;
125 |
126 | int indexPreviousReturn = contents.lastIndexOf('\n', index);
127 | //QByteArray curLine(contents.mid(indexPreviousReturn + 1, indexReturn)); //当前行
128 |
129 | //判断找到的字符串是否在引号内
130 | //如果找到的字符串前面的引号个数为偶数,则认为找到的字符串不在引号内
131 | if (contents.mid(indexPreviousReturn, index - indexPreviousReturn).count('\"') % 2 == 0)
132 | break;
133 | }
134 | return index;
135 | }
136 |
--------------------------------------------------------------------------------
/code/PixelRuler/PixelRuler.cpp:
--------------------------------------------------------------------------------
1 | #include "PixelRuler.h"
2 | #include
3 | #include
4 | #include "../CCommonTools/Config.h"
5 | #include "../CCommonTools/TextEditWidget.h"
6 | #include
7 | #include "define.h"
8 |
9 | static PixelRuler* pIns = nullptr;
10 |
11 | PixelRuler::PixelRuler()
12 | {
13 | }
14 |
15 | PixelRuler* PixelRuler::Instance()
16 | {
17 | return pIns;
18 | }
19 |
20 | int PixelRuler::GetScalePercent()
21 | {
22 | if (m_pMainFrame != nullptr)
23 | {
24 | if (m_pMainFrame->IsItemChecked(CMD_SystemScaleCheck))
25 | {
26 | return static_cast(QGuiApplication::primaryScreen()->logicalDotsPerInch() * 100 / 96);
27 | }
28 | else
29 | {
30 | QString strPercent = QString::fromUtf8(m_pMainFrame->GetItemText(CMD_UserScaleCombo));
31 | strPercent.chop(1);
32 | return strPercent.toInt();
33 | }
34 | }
35 | return 100;
36 | }
37 |
38 | int PixelRuler::GetScaleUnitSize()
39 | {
40 | if (m_pMainFrame != nullptr)
41 | {
42 | if (m_pMainFrame->IsItemChecked(CMD_ScaleUnit8Pixel))
43 | return 8;
44 | }
45 | return 10;
46 | }
47 |
48 | void PixelRuler::Repaint()
49 | {
50 | m_mainWidget.update();
51 | m_horizontalRuler.update();
52 | m_verticalRuler.update();
53 | }
54 |
55 | void PixelRuler::InitInstance()
56 | {
57 |
58 | }
59 |
60 | void PixelRuler::UnInitInstance()
61 | {
62 | //保存设置
63 | CConfig settings(QString::fromUtf8(GetModuleName()));
64 | settings.WriteValue("useSystemScale", m_pMainFrame->IsItemChecked(CMD_SystemScaleCheck));
65 | settings.WriteValue("userScale", m_pMainFrame->GetItemCurIndex(CMD_UserScaleCombo));
66 | settings.WriteValue("scaleUnit8Pixel", m_pMainFrame->IsItemChecked(CMD_ScaleUnit8Pixel));
67 | }
68 |
69 | void PixelRuler::UiInitComplete(IMainFrame* pMainFrame)
70 | {
71 | m_pMainFrame = pMainFrame;
72 | //载入设置
73 | CConfig settings(QString::fromUtf8(GetModuleName()));
74 | m_pMainFrame->SetItemChecked(CMD_SystemScaleCheck, settings.GetValue("useSystemScale").toBool());
75 | m_pMainFrame->SetItemCurIIndex(CMD_UserScaleCombo, settings.GetValue("userScale").toInt());
76 | bool scaleUnit8Pixel = settings.GetValue("scaleUnit8Pixel").toBool();
77 | if (scaleUnit8Pixel)
78 | m_pMainFrame->SetItemChecked(CMD_ScaleUnit8Pixel, true);
79 | else
80 | m_pMainFrame->SetItemChecked(CMD_ScaleUnit10Pixel, true);
81 |
82 | EnableControl();
83 | }
84 |
85 | void* PixelRuler::GetMainWindow()
86 | {
87 | return &m_mainWidget;
88 | }
89 |
90 | IModule::eMainWindowType PixelRuler::GetMainWindowType() const
91 | {
92 | return IModule::MT_QWIDGET;
93 | }
94 |
95 | const char* PixelRuler::GetModuleName()
96 | {
97 | return "PixelRuler";
98 | }
99 |
100 | void PixelRuler::OnCommand(const char* strCmd, bool checked)
101 | {
102 | QString cmd(strCmd);
103 | if (cmd == CMD_SystemScaleCheck)
104 | {
105 | EnableControl();
106 | Repaint();
107 | }
108 | else if (cmd == CMD_ShowHorizontalRuler)
109 | {
110 | m_horizontalRuler.setVisible(checked);
111 | }
112 | else if (cmd == CMD_ShowVerticalRuler)
113 | {
114 | m_verticalRuler.setVisible(checked);
115 | }
116 | else if (cmd == CMD_ScaleUnit10Pixel || cmd == CMD_ScaleUnit8Pixel)
117 | {
118 | Repaint();
119 | }
120 | else if (cmd == CMD_PixelRulerHelp)
121 | {
122 | CTextEditDialog dlg(&m_mainWidget);
123 | dlg.resize(DPI(560), DPI(360));
124 | dlg.setWindowTitle(u8"像素尺帮助");
125 | QFile file(":/res/help.md");
126 | if (file.open(QIODevice::ReadOnly))
127 | {
128 | QString helpContents = QString::fromUtf8(file.readAll());
129 | #if (QT_VERSION >= QT_VERSION_CHECK(5,14,0))
130 | dlg.GetEdit()->setMarkdown(helpContents);
131 | #else
132 | dlg.GetEdit()->setPlainText(helpContents);
133 | #endif
134 | dlg.GetEdit()->setReadOnly(true);
135 | }
136 | dlg.exec();
137 | }
138 | }
139 |
140 | void PixelRuler::OnItemChanged(const char* strId, int index, const char* text)
141 | {
142 | QString cmd(strId);
143 | if (cmd == CMD_UserScaleCombo)
144 | {
145 | Repaint();
146 | }
147 | }
148 |
149 | void PixelRuler::OnAppExit()
150 | {
151 | m_horizontalRuler.close();
152 | m_verticalRuler.close();
153 | }
154 |
155 | void PixelRuler::EnableControl()
156 | {
157 | if (m_pMainFrame != nullptr)
158 | {
159 | m_pMainFrame->SetItemEnable(CMD_UserScaleCombo, !m_pMainFrame->IsItemChecked(CMD_SystemScaleCheck));
160 | }
161 | }
162 |
163 |
164 | IModule* CreateInstance()
165 | {
166 | pIns = new PixelRuler();
167 | return pIns;
168 | }
169 |
--------------------------------------------------------------------------------
/code/PixelRuler/RulerDrawer.cpp:
--------------------------------------------------------------------------------
1 | #include "RulerDrawer.h"
2 | #include
3 | #include "PixelRuler.h"
4 | #include "define.h"
5 |
6 | const int SCALE_MARGIN = ::DPI(32);
7 |
8 | CRulerDrawer::CRulerDrawer(QPainter& painter, QRect rect, int scalePercent)
9 | : m_painter(painter), m_rect(rect), m_scalePercent(scalePercent)
10 | {
11 | m_palette = qApp->palette();
12 | m_scaleUnitSize = PixelRuler::Instance()->GetScaleUnitSize();
13 | }
14 |
15 | void CRulerDrawer::Draw(ScaleDirection direction, bool drawText)
16 | {
17 | switch (direction)
18 | {
19 | case CRulerDrawer::Top:
20 | DrawHorizontalScale(true, drawText);
21 | break;
22 | case CRulerDrawer::Bottom:
23 | DrawHorizontalScale(false, drawText);
24 | break;
25 | case CRulerDrawer::Left:
26 | DrawVerticalScale(true, drawText);
27 | break;
28 | case CRulerDrawer::Right:
29 | DrawVerticalScale(false, drawText);
30 | break;
31 | }
32 | }
33 |
34 | void CRulerDrawer::DrawHorizontalScale(int top, bool drawText)
35 | {
36 | m_painter.save();
37 | //绘制水平标尺
38 | int x_pos{ 0 }; //水平刻度
39 | m_painter.setPen(QPen(m_palette.color(QPalette::Text)));
40 | //绘制刻度
41 |
42 | int y_pos_start;
43 | if (top)
44 | y_pos_start = 0;
45 | else
46 | y_pos_start = m_rect.height();
47 |
48 | while (DPI(x_pos) <= m_rect.width() - 2 * SCALE_MARGIN)
49 | {
50 | int line_length; //刻度的长度
51 | if (x_pos % (m_scaleUnitSize * m_scaleUnitSize) == 0) //刻度值为100的倍数时绘制刻度的长度为10像素
52 | line_length = DPI(10);
53 | else if (x_pos % (m_scaleUnitSize * m_scaleUnitSize / 2) == 0) //刻度值为50的倍数时绘制刻度的长度为8像素
54 | line_length = DPI(8);
55 | else
56 | line_length = DPI(5);
57 | int y_pos_end;
58 | if (top)
59 | y_pos_end = y_pos_start + line_length;
60 | else
61 | y_pos_end = y_pos_start - line_length;
62 | m_painter.drawLine(QPoint(DPI(x_pos) + SCALE_MARGIN - 1, y_pos_start), QPoint(DPI(x_pos) + SCALE_MARGIN - 1, y_pos_end));
63 | //画刻度上的文本
64 | if (drawText && x_pos % (m_scaleUnitSize * m_scaleUnitSize) == 0) //当刻度值为100的倍数时显示刻度值
65 | {
66 | QString str = QString::number(x_pos);
67 | QSize str_size = m_painter.fontMetrics().size(Qt::TextSingleLine, str);
68 | int y_pos_text;
69 | if (top)
70 | y_pos_text = DPI(12);
71 | else
72 | y_pos_text = y_pos_start - DPI(12) - str_size.height();
73 | QRect rect{ QPoint{ DPI(x_pos) + SCALE_MARGIN - str_size.width() / 2, y_pos_text }, str_size };
74 | m_painter.drawText(rect, str);
75 | }
76 | x_pos += m_scaleUnitSize;
77 | }
78 | m_painter.restore();
79 | }
80 |
81 | void CRulerDrawer::DrawVerticalScale(int left, bool drawText)
82 | {
83 | m_painter.save();
84 | //绘制垂直标尺
85 | int y_pos{ 0 }; //垂直刻度
86 | m_painter.setPen(QPen(m_palette.color(QPalette::Text)));
87 | //绘制刻度
88 |
89 | int x_pos_start;
90 | if (left)
91 | x_pos_start = 0;
92 | else
93 | x_pos_start = m_rect.width();
94 |
95 | while (DPI(y_pos) <= m_rect.height() - 2 * SCALE_MARGIN)
96 | {
97 | int line_length; //刻度的长度
98 | if (y_pos % (m_scaleUnitSize * m_scaleUnitSize) == 0) //刻度值为100的倍数时绘制刻度的长度为10像素
99 | line_length = DPI(10);
100 | else if (y_pos % (m_scaleUnitSize * m_scaleUnitSize / 2) == 0) //刻度值为50的倍数时绘制刻度的长度为8像素
101 | line_length = DPI(8);
102 | else
103 | line_length = DPI(5);
104 | int x_pos_end;
105 | if (left)
106 | x_pos_end = x_pos_start + line_length;
107 | else
108 | x_pos_end = x_pos_start - line_length;
109 | m_painter.drawLine(QPoint(x_pos_start, DPI(y_pos) + SCALE_MARGIN - 1), QPoint(x_pos_end, DPI(y_pos) + SCALE_MARGIN - 1));
110 | //画刻度上的文本
111 | if (drawText && y_pos % (m_scaleUnitSize * m_scaleUnitSize) == 0) //当刻度值为100的倍数时显示刻度值
112 | {
113 | QString str = QString::number(y_pos);
114 | QSize str_size = m_painter.fontMetrics().size(Qt::TextSingleLine, str);
115 | int x_pos_text;
116 | if (left)
117 | x_pos_text = DPI(12);
118 | else
119 | x_pos_text = x_pos_start - DPI(12) - str_size.width();
120 | QRect rect{ QPoint{ x_pos_text, DPI(y_pos) + SCALE_MARGIN - str_size.height() / 2 }, str_size };
121 | m_painter.drawText(rect, str);
122 | }
123 | y_pos += m_scaleUnitSize;
124 | }
125 | m_painter.restore();
126 | }
127 |
128 | int CRulerDrawer::DPI(int pixel)
129 | {
130 | return pixel * m_scalePercent / 100;
131 | }
132 |
--------------------------------------------------------------------------------
/code/AddCodeHeader/MainWidget.cpp:
--------------------------------------------------------------------------------
1 | #include "MainWidget.h"
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | CMainWidget::CMainWidget(QWidget *parent)
12 | : QWidget(parent)
13 | {
14 | QVBoxLayout* pLayout = new QVBoxLayout();
15 | QSplitter* pSpliter = new QSplitter(this);
16 | pSpliter->setChildrenCollapsible(false);
17 | pLayout->addWidget(pSpliter);
18 | pLayout->setMargin(0);
19 | this->setLayout(pLayout);
20 |
21 | //创建左侧控件
22 | QWidget* pLeftWidget = new QWidget();
23 | pSpliter->addWidget(pLeftWidget);
24 |
25 | QVBoxLayout* pLeftLayout = new QVBoxLayout();
26 | pLeftWidget->setLayout(pLeftLayout);
27 | pLeftLayout->addWidget(new QLabel(u8"设置扫描路径:"));
28 | QHBoxLayout* pPathEditLayout = new QHBoxLayout();
29 | pPathEditLayout->addWidget(m_pFolderPathEidt = new QLineEdit());
30 | m_pBrowseBtn = new QPushButton(u8"浏览(&B)...");
31 | int width = DPI(65);
32 | pPathEditLayout->addWidget(m_pBrowseBtn);
33 | pLeftLayout->addLayout(pPathEditLayout);
34 | pLeftLayout->addWidget(new QLabel(u8"扫描文件的格式:"));
35 | pLeftLayout->addWidget(m_pFileTypeCombo = new QComboBox());
36 |
37 | //QGroupBox* pOptionGroupBox = new QGroupBox(u8"删除注释选项");
38 | //QHBoxLayout* pOptionsLayout = new QHBoxLayout();
39 | //pOptionGroupBox->setLayout(pOptionsLayout);
40 | //pOptionsLayout->addWidget(m_pRemoveSpace = new QCheckBox(u8"移除多余的空格"));
41 | //pOptionsLayout->addWidget(m_pRemoveReturn = new QCheckBox(u8"移除多余的空白行"));
42 | //pOptionsLayout->addWidget(new QLabel(u8"保留连续的空白行的个数:"));
43 | //pOptionsLayout->addWidget(m_pReturnNumEdit = new QSpinBox());
44 | //m_pReturnNumEdit->setMinimumWidth(DPI(40));
45 | //m_pReturnNumEdit->setRange(0, 4);
46 | //pOptionsLayout->addStretch();
47 | //pLeftLayout->addWidget(pOptionGroupBox);
48 |
49 | pLeftLayout->addWidget(new QLabel(u8"文件列表:"));
50 | QHBoxLayout* pHLayout2 = new QHBoxLayout();
51 | pLeftLayout->addLayout(pHLayout2);
52 | pHLayout2->addWidget(m_pFileTableView = new QTableView());
53 | QVBoxLayout* pVLayout2 = new QVBoxLayout();
54 | pHLayout2->addLayout(pVLayout2);
55 | pVLayout2->addWidget(m_pAddFileBtn = new QPushButton(u8"添加"));
56 | pVLayout2->addWidget(m_pRemoveFileBtn = new QPushButton(u8"移除"));
57 | pVLayout2->addWidget(m_pClearFileBtn = new QPushButton(u8"清空"));
58 | pVLayout2->addStretch();
59 | //添加进度条
60 | QHBoxLayout* pHLayout3 = new QHBoxLayout();
61 | pLeftLayout->addLayout(pHLayout3);
62 | pHLayout3->addWidget(m_pProgressBar = new QProgressBar());
63 | m_pProgressBar->setRange(0, 10000);
64 | m_pProgressBar->setMaximumHeight(DPI(16));
65 | m_pProgressBar->setTextVisible(false);
66 | pHLayout3->addWidget(m_pProgressLabel = new QLabel());
67 | m_pProgressBar->setVisible(false);
68 | m_pProgressLabel->setVisible(false);
69 |
70 | //创建右侧控件
71 | m_pAddCodeHeadWidget = new QWidget();
72 | pSpliter->addWidget(m_pAddCodeHeadWidget);
73 | QVBoxLayout* pRightLayout = new QVBoxLayout();
74 | m_pAddCodeHeadWidget->setLayout(pRightLayout);
75 | pRightLayout->addWidget(new QLabel(u8"添加文件头:"));
76 | pRightLayout->addWidget(m_pTemplateItemTable = new QTableView());
77 | QHBoxLayout* pButtonLayout = new QHBoxLayout();
78 | pRightLayout->addLayout(pButtonLayout);
79 | pButtonLayout->addWidget(m_pTemplateMoveUpBtn = new QPushButton(u8"上移"));
80 | pButtonLayout->addWidget(m_pTemplateMoveDownBtn = new QPushButton(u8"下移"));
81 | pButtonLayout->addStretch();
82 | QHBoxLayout* pOptionHLayout = new QHBoxLayout();
83 | pOptionHLayout->addWidget(new QLabel(u8"输出编码格式:"));
84 | pOptionHLayout->addWidget(m_pOutFormatCombo = new QComboBox(), 1);
85 | pRightLayout->addLayout(pOptionHLayout);
86 |
87 |
88 | //m_pFolderPathEidt->setReadOnly(true);
89 | m_pFileTypeCombo->setEditable(true);
90 |
91 | //
92 | connect(m_pBrowseBtn, SIGNAL(clicked()), this, SLOT(OnBrowseBtnClicked()));
93 | }
94 |
95 | CMainWidget::~CMainWidget()
96 | {
97 | }
98 |
99 | void CMainWidget::ShowAddCodeHeader(bool show)
100 | {
101 | if (show)
102 | m_pAddCodeHeadWidget->show();
103 | else
104 | m_pAddCodeHeadWidget->hide();
105 | }
106 |
107 | void CMainWidget::SetProgress(double progress)
108 | {
109 | bool showProgress = (progress > 0 && progress < 100);
110 | m_pProgressBar->setVisible(showProgress);
111 | m_pProgressLabel->setVisible(showProgress);
112 |
113 | if (showProgress)
114 | {
115 | m_pProgressBar->setValue(static_cast(progress * 100));
116 | m_pProgressLabel->setText(QString(u8"正在处理……已完成 %1%").arg(progress, 0, 'f', 1));
117 | }
118 | }
119 |
120 | void CMainWidget::OnBrowseBtnClicked()
121 | {
122 | QString strNewPath = QFileDialog::getExistingDirectory(this, QString(), m_pFolderPathEidt->text());
123 | if (!strNewPath.isEmpty())
124 | m_pFolderPathEidt->setText(strNewPath);
125 | }
126 |
--------------------------------------------------------------------------------
/code/CCommonTools/treeitemmodel.cpp:
--------------------------------------------------------------------------------
1 | #include "treeitemmodel.h"
2 |
3 | CTreeItemModel::CTreeItemModel(QObject *parent)
4 | : QAbstractItemModel(parent)
5 | {
6 | }
7 |
8 | QModelIndex CTreeItemModel::index(int row, int column, const QModelIndex &parent) const
9 | {
10 | if (!parent.isValid())
11 | {
12 | if (row >= 0 && row < m_treeData.GetChildList().size())
13 | return createIndex(row, column, m_treeData.GetChild(row).get());
14 | }
15 | else
16 | {
17 | CTreeItem* pItem = getItem(parent);
18 | if (pItem != nullptr)
19 | {
20 | if (row >= 0 && row < pItem->GetChildList().size())
21 | {
22 | return createIndex(row, column, pItem->GetChildList()[row].get());
23 | }
24 | }
25 | }
26 |
27 | return QModelIndex();
28 | }
29 |
30 | QModelIndex CTreeItemModel::parent(const QModelIndex &index) const
31 | {
32 | CTreeItem* pItem = getItem(index);
33 | if (pItem != nullptr)
34 | {
35 | CTreeItem* pParent = pItem->GetParent();
36 | if (pParent != nullptr)
37 | {
38 | return createIndex(pParent->IndexOf(pItem), 0, pParent);
39 | }
40 | }
41 | return QModelIndex();
42 | }
43 |
44 | int CTreeItemModel::rowCount(const QModelIndex &parent) const
45 | {
46 | CTreeItem* pItem = getItem(parent);
47 | if (pItem == nullptr)
48 | {
49 | // 根节点下的数据行数
50 | return m_treeData.GetChildList().size();
51 | }
52 | else
53 | {
54 | // 节点下的数据行数
55 | return pItem->GetChildList().size();
56 | }
57 | }
58 |
59 | bool CTreeItemModel::setData(const QModelIndex &index, const QVariant &value, int role)
60 | {
61 | if (index.isValid() && data(index, role) != value)
62 | {
63 | m_modified = true;
64 | return true;
65 | }
66 |
67 | return false;
68 | }
69 |
70 | bool CTreeItemModel::IsModified() const
71 | {
72 | return m_modified;
73 | }
74 |
75 | void CTreeItemModel::SetModified(bool modified)
76 | {
77 | m_modified = modified;
78 | }
79 |
80 | void CTreeItemModel::SetReadOnly(bool readOnly)
81 | {
82 | m_readOnly = readOnly;
83 | }
84 |
85 | CTreeItemGroup &CTreeItemModel::GetTreeData()
86 | {
87 | return m_treeData;
88 | }
89 |
90 | const CTreeItemGroup &CTreeItemModel::GetTreeData() const
91 | {
92 | return m_treeData;
93 | }
94 |
95 | CTreeItem *CTreeItemModel::getItem(const QModelIndex &index) const
96 | {
97 | if (index.isValid())
98 | {
99 | CTreeItem* pItem = static_cast(index.internalPointer());
100 | if (pItem != nullptr)
101 | return pItem;
102 | }
103 | return nullptr;
104 | }
105 |
106 | void CTreeItemModel::IterateIndexs(std::function func, QModelIndex parent, int column) const
107 | {
108 | if (func(parent)) //func返回true,则终止遍历
109 | return;
110 | int childrenCount = rowCount(parent);
111 | for (int i = 0; i < childrenCount; i++)
112 | {
113 | //获取parent的每个子index
114 | QModelIndex childIndex = index(i, column, parent);
115 | if (childIndex.isValid())
116 | {
117 | //递归调用此函数
118 | IterateIndexs(func, childIndex, column);
119 | }
120 | }
121 | }
122 |
123 | bool CTreeItemModel::isSingleItemChecked(CTreeItem *pItem) const
124 | {
125 | Q_UNUSED(pItem)
126 | return false;
127 | }
128 |
129 | void CTreeItemModel::setSingleItemChecked(CTreeItem *pItem, bool checked)
130 | {
131 | Q_UNUSED(pItem)
132 | Q_UNUSED(checked)
133 | }
134 |
135 | int CTreeItemModel::isItemChecked(CTreeItem *pItem) const
136 | {
137 | if (pItem != nullptr)
138 | {
139 | if (!pItem->HasChildren()) //子节点返回该节点的选中状态
140 | {
141 | return (isSingleItemChecked(pItem) ? Qt::Checked : Qt::Unchecked);
142 | }
143 | else //父节点当子节点全部选中时为选中状态
144 | {
145 | bool hasChecked = false;
146 | bool hasUnchecked = false;
147 | for (const auto& pSubItem : pItem->GetChildList())
148 | {
149 | if (isItemChecked(pSubItem.get()))
150 | hasChecked = true;
151 | else
152 | hasUnchecked = true;
153 | }
154 | if (hasChecked && !hasUnchecked) //如果子节点只有选中而没有未选中的节点,则为选中状态
155 | return Qt::Checked;
156 | else if (!hasChecked && hasUnchecked) //如果子节点没有选中只有未选中的节点,则为未选中状态
157 | return Qt::Unchecked;
158 | else
159 | return Qt::PartiallyChecked; //其他情况则为部分选中状态
160 | }
161 | }
162 | return Qt::Unchecked;
163 | }
164 |
165 | void CTreeItemModel::setItemChecked(CTreeItem *pItem, bool checked)
166 | {
167 | if (pItem != nullptr)
168 | {
169 | setSingleItemChecked(pItem, checked);
170 | for (const auto& pSubItem : pItem->GetChildList())
171 | {
172 | setItemChecked(pSubItem.get(), checked);
173 | }
174 | }
175 | }
176 |
--------------------------------------------------------------------------------
/code/PasswordGeneratorApi/PasswordGeneratorApi.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | x64
7 |
8 |
9 | Release
10 | x64
11 |
12 |
13 |
14 | {C0A42F4A-ABB3-4575-B4D5-CEDD8379AC26}
15 | v4.7.2
16 | ManagedCProj
17 | PasswordGeneratorApi
18 | 10.0
19 |
20 |
21 |
22 | DynamicLibrary
23 | true
24 | v143
25 | true
26 | Unicode
27 |
28 |
29 | DynamicLibrary
30 | false
31 | v143
32 | true
33 | Unicode
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | true
51 |
52 |
53 | false
54 |
55 |
56 |
57 | Level3
58 | Disabled
59 | _DEBUG;%(PreprocessorDefinitions)
60 | Use
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 | Level3
69 | NDEBUG;%(PreprocessorDefinitions)
70 | Use
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 | PasswordGenerator.dll
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 | Create
95 | Create
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
--------------------------------------------------------------------------------
/code/AddCodeHeader/AddCodeHeader.cpp:
--------------------------------------------------------------------------------
1 | #include "AddCodeHeader.h"
2 | #include
3 | #include "RemoveCommentHelper.h"
4 | #include "Test.h"
5 |
6 | AddCodeHeader* AddCodeHeader::m_pInstance{};
7 |
8 | AddCodeHeader::AddCodeHeader()
9 | {
10 | m_pInstance = this;
11 | }
12 |
13 | void AddCodeHeader::InitInstance()
14 | {
15 | //#ifdef _DEBUG
16 | // CTest::Test();
17 | //#endif
18 |
19 | connect(&m_removeCommentThread, SIGNAL(finished()), this, SLOT(OnRemoveCommentsComplete()));
20 | connect(&m_addFileHeadThread, SIGNAL(finished()), this, SLOT(OnAddFileHeadComplete()));
21 | connect(&m_editor, SIGNAL(signalRemoveCommentProgress(double)), &m_mainWidget, SLOT(SetProgress(double)));
22 | }
23 |
24 | void AddCodeHeader::UnInitInstance()
25 | {
26 | m_editor.ExitWidget();
27 | m_removeCommentThread.Stop();
28 | m_addFileHeadThread.Stop();
29 | m_removeCommentThread.wait(2000);
30 | m_addFileHeadThread.wait(2000);
31 | m_pInstance = nullptr;
32 | }
33 |
34 | void AddCodeHeader::UiInitComplete(IMainFrame* pMainFrame)
35 | {
36 | m_editor.ConnectWidget(&m_mainWidget, pMainFrame);
37 | m_pMainFrame = pMainFrame;
38 | m_pMainFrame->SetItemEnable(CMD_ADD_CODE_HEADER_EXCUTE, false);
39 | }
40 |
41 | void* AddCodeHeader::GetMainWindow()
42 | {
43 | return (void*)&m_mainWidget;
44 | }
45 |
46 | const char* AddCodeHeader::GetModuleName()
47 | {
48 | return "AddCodeHeader";
49 | }
50 |
51 | void AddCodeHeader::OnCommand(const char* cmd, bool checked)
52 | {
53 | QString strCmd = QString::fromUtf8(cmd);
54 | if (strCmd == CMD_ADD_CODE_HEADER_EXCUTE)
55 | {
56 | if (QMessageBox::question(&m_mainWidget, nullptr, u8"注意:所有文件的文件头将会被覆盖,且无法恢复,如果有必要的话请事先做好备份。\r\n要继续吗?", QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes)
57 | {
58 | if (!m_addFileHeadThread.isRunning())
59 | {
60 | AddCodeHeader::GetInstance()->EnableControl(false);
61 | m_addFileHeadThread.start();
62 | }
63 | }
64 | }
65 | else if (strCmd == CMD_SCAN_FILE)
66 | {
67 | m_editor.ScanFiles();
68 | }
69 | else if (strCmd == CMD_REMOVE_COMMENT_EXCUTE)
70 | {
71 | bool removeComment = m_pMainFrame->IsItemChecked(CMD_RemoveCommentCheck);
72 | bool removeSpace = m_pMainFrame->IsItemChecked(CMD_RemoveSpaceCheck);
73 | bool removeEmptyLine = m_pMainFrame->IsItemChecked(CMD_RemoveEmptyLineCheck);
74 | if (!removeComment && !removeSpace && !removeEmptyLine)
75 | {
76 | QMessageBox::warning(&m_mainWidget, nullptr, u8"你至少应该选中“删除注释”、“移除多余的空格”和“移除多余的回车”中的一项!", QMessageBox::Ok);
77 | return;
78 | }
79 |
80 | if (!m_removeCommentThread.isRunning())
81 | {
82 | AddCodeHeader::GetInstance()->EnableControl(false);
83 | m_removeCommentThread.start();
84 | }
85 | }
86 | else if (strCmd == CMD_SHOW_ADD_CODE_HEADER)
87 | {
88 | m_mainWidget.ShowAddCodeHeader(checked);
89 | m_pMainFrame->SetItemEnable(CMD_ADD_CODE_HEADER_EXCUTE, checked);
90 | }
91 | }
92 |
93 | IModule::eMainWindowType AddCodeHeader::GetMainWindowType() const
94 | {
95 | return IModule::MT_QWIDGET;
96 | }
97 |
98 | void AddCodeHeader::OnTabEntered()
99 | {
100 | m_editor.AdjustColumeWidth();
101 | }
102 |
103 | AddCodeHeader* AddCodeHeader::GetInstance()
104 | {
105 | return m_pInstance;
106 | }
107 |
108 |
109 | CAddCodeHeaderEditor& AddCodeHeader::GetEditor()
110 | {
111 | return m_editor;
112 | }
113 |
114 |
115 | CRemoveCommentThread& AddCodeHeader::GetRemoveCommentThread()
116 | {
117 | return m_removeCommentThread;
118 | }
119 |
120 | IMainFrame* AddCodeHeader::GetMainFrame() const
121 | {
122 | return m_pMainFrame;
123 | }
124 |
125 | void AddCodeHeader::EnableControl(bool enable)
126 | {
127 | m_mainWidget.GetAddFileBtn()->setEnabled(enable);
128 | m_mainWidget.GetBrowseBtn()->setEnabled(enable);
129 | m_mainWidget.GetFileTableView()->setEnabled(enable);
130 | m_mainWidget.GetFileTypeCombo()->setEnabled(enable);
131 | m_mainWidget.GetFolderPathEidt()->setEnabled(enable);
132 | m_mainWidget.GetRemoveFileBtn()->setEnabled(enable);
133 | m_mainWidget.GetClearFileBtn()->setEnabled(enable);
134 | m_pMainFrame->SetItemEnable(CMD_RemoveCommentCheck, enable);
135 | m_pMainFrame->SetItemEnable(CMD_RemoveSpaceCheck, enable);
136 | m_pMainFrame->SetItemEnable(CMD_RemoveEmptyLineCheck, enable);
137 | m_pMainFrame->SetItemEnable(CMD_KeepEmptyLineNum, enable);
138 | m_pMainFrame->SetItemEnable(CMD_SCAN_FILE, enable);
139 | m_pMainFrame->SetItemEnable(CMD_REMOVE_COMMENT_EXCUTE, enable);
140 | }
141 |
142 |
143 | void AddCodeHeader::OnRemoveCommentsComplete()
144 | {
145 | EnableControl(true);
146 |
147 | QString info;
148 | const auto& result{ m_removeCommentThread.m_removeResult };
149 | info = QString(u8"完成,已处理 %1 个文件。已移除:").arg(m_removeCommentThread.m_fileCount);
150 | if (m_pMainFrame->IsItemChecked(CMD_RemoveCommentCheck))
151 | info += QString(u8"\r\n%1 个单行注释,%2 个多行注释").arg(result.single_line_comment_removed).arg(result.multi_line_comment_removed);
152 | if (m_pMainFrame->IsItemChecked(CMD_RemoveSpaceCheck))
153 | info += QString(u8"\r\n%1 个空格").arg(result.space_removed);
154 | if (m_pMainFrame->IsItemChecked(CMD_RemoveEmptyLineCheck))
155 | info += QString(u8"\r\n%1 个空白行").arg(result.return_removed);
156 | QMessageBox::information(&m_mainWidget, nullptr, info, QMessageBox::Ok);
157 | }
158 |
159 |
160 | void AddCodeHeader::OnAddFileHeadComplete()
161 | {
162 | EnableControl(true);
163 | QString info = QString(u8"完成,已处理 %1 个文件").arg(m_addFileHeadThread.m_fileCount);
164 | QMessageBox::information(&m_mainWidget, nullptr, info, QMessageBox::Ok);
165 | }
166 |
167 | IModule * CreateInstance()
168 | {
169 | return new AddCodeHeader();
170 | }
171 |
--------------------------------------------------------------------------------
/code/AddCodeHeader/FileHeadHelper.cpp:
--------------------------------------------------------------------------------
1 | #include "FileHeadHelper.h"
2 | #include
3 | #include "../CCommonTools/CommonTools.h"
4 | #include
5 | #include "AddCodeHeader.h"
6 | #include
7 | #include
8 |
9 | const QString FILE_HEAD_START = "/**************************************************************************************";
10 | const QString FILE_HEAD_END = "**************************************************************************************/";
11 |
12 | CFileHeadHelper::CFileHeadHelper()
13 | {
14 | }
15 |
16 |
17 | CFileHeadHelper::~CFileHeadHelper()
18 | {
19 | }
20 |
21 | bool CFileHeadHelper::AddFileHead(const QString& filePath, eOutputFormat outputFormat)
22 | {
23 | QFile file(filePath);
24 | if (!file.open(QIODevice::ReadOnly))
25 | return false;
26 | QByteArray fileData = file.readAll();
27 | file.close();
28 | //判断编码类型
29 | bool hasBom;
30 | eOutputFormat codeType = JudgeCode(fileData, hasBom);
31 | //移除文件BOM
32 | if (hasBom)
33 | {
34 | if (codeType == OF_UTF8)
35 | fileData.remove(0, 3);
36 | else if (codeType == OF_UTF16)
37 | fileData.remove(0, 2);
38 | }
39 | //根据编码格式转换为QString
40 | QString fileContents;
41 | if (codeType == OF_UTF8)
42 | {
43 | fileContents = QString::fromUtf8(fileData);
44 | }
45 | else if (codeType == OF_UTF16)
46 | {
47 | fileContents = QString::fromWCharArray((const wchar_t*)fileData.constData());
48 | }
49 | else
50 | {
51 | fileContents = QString::fromLocal8Bit(fileData);
52 | }
53 | //去掉原来的文件头
54 | RemoveFileHead(fileContents);
55 | //添加文件头
56 | QString strFileHead = GenerateFileHeadContents(filePath);
57 | fileContents.push_front(strFileHead);
58 | //根据输出格式转换成QByteArray
59 | QByteArray outputData;
60 | if (outputFormat == OF_UTF8)
61 | {
62 | if (hasBom)
63 | {
64 | outputData.append('\xef');
65 | outputData.append('\xbb');
66 | outputData.append('\xbf');
67 | }
68 | outputData.append(fileContents.toUtf8());
69 | }
70 | else if (outputFormat == OF_UTF16)
71 | {
72 | outputData.append('\xff');
73 | outputData.append('\xfe');
74 | std::wstring contentsWcs = fileContents.toStdWString();
75 | outputData.append((const char*)contentsWcs.c_str(), contentsWcs.size() * 2);
76 | }
77 | else
78 | {
79 | outputData.append(fileContents.toLocal8Bit());
80 | }
81 | //写入文件
82 | if (!file.open(QIODevice::WriteOnly))
83 | return false;
84 | file.write(outputData);
85 | file.close();
86 | return true;
87 | }
88 |
89 | eOutputFormat CFileHeadHelper::JudgeCode(const QByteArray& data, bool& hasBom)
90 | {
91 | hasBom = false;
92 | if (data.size() >= 3 && data[0] == '\xef' && data[1] == '\xbb' && data[2] == '\xbf')
93 | {
94 | hasBom = true;
95 | return OF_UTF8;
96 | }
97 | if (data.size() >= 2 && data[0] == '\xff' && data[1] == '\xfe')
98 | {
99 | hasBom = false;
100 | return OF_UTF16;
101 | }
102 | if (CCommonTools::IsUtf8Bytes(data))
103 | {
104 | return OF_UTF8;
105 | }
106 | return OF_ANSI;
107 | }
108 |
109 | void CFileHeadHelper::RemoveFileHead(QString& strContents)
110 | {
111 | //移除文件头
112 | if (strContents.startsWith(FILE_HEAD_START))
113 | {
114 | int endIndex = strContents.indexOf(FILE_HEAD_END, FILE_HEAD_START.size());
115 | if (endIndex > 0)
116 | strContents.remove(0, endIndex + FILE_HEAD_END.size());
117 | }
118 | //删除文件最前面的一个换行符
119 | if (strContents.startsWith('\r'))
120 | strContents = strContents.mid(1);
121 | if (strContents.startsWith('\n'))
122 | strContents = strContents.mid(1);
123 | }
124 |
125 | QString CFileHeadHelper::GenerateFileHeadContents(const QString& filePath) const
126 | {
127 | QFileInfo fileInfo(filePath);
128 | QString str;
129 | const auto& data = AddCodeHeader::GetInstance()->GetEditor().GetHeadItemTableModel().GetData();
130 | QTextStream contents(&str);
131 | contents << FILE_HEAD_START << endl;
132 | //依次添加文件头
133 | for (const auto& headItem : data)
134 | {
135 | if (!headItem.enable)
136 | continue;
137 | switch (headItem.item)
138 | {
139 | case HI_COPYRIGHT:
140 | contents << "* @copyright ";
141 | break;
142 | case HI_FILE:
143 | contents << "* @file ";
144 | break;
145 | case HI_BRIEF:
146 | contents << "* @brief ";
147 | break;
148 | case HI_AUTHOR:
149 | contents << "* @author ";
150 | break;
151 | case HI_EMAL:
152 | contents << "* @email ";
153 | break;
154 | case HI_VERSION:
155 | contents << "* @version ";
156 | break;
157 | case HI_DATE:
158 | contents << "* @date ";
159 | break;
160 | case HI_LICENSE:
161 | contents << "* @license ";
162 | break;
163 | default:
164 | contents << "* ";
165 | break;
166 | }
167 |
168 | if (headItem.item == HI_FILE)
169 | {
170 | contents << fileInfo.fileName() << endl;
171 | }
172 | else if (headItem.item == HI_DATE)
173 | {
174 | QDateTime fileDate = fileInfo.lastModified();
175 | contents << fileDate.toString("yyyy-MM-dd") << endl;
176 | }
177 | else
178 | {
179 | QString strValue = headItem.value;
180 | ProcessHeadString(strValue);
181 | contents << strValue << endl;
182 | }
183 | }
184 | contents << FILE_HEAD_END << endl;
185 | return str;
186 | }
187 |
188 | void CFileHeadHelper::ProcessHeadString(QString& str)
189 | {
190 | int index = -1;
191 | while (true)
192 | {
193 | index = str.indexOf('\n', index + 1);
194 | if (index >= 0)
195 | str.insert(index + 1, "* ");
196 | else
197 | break;
198 | }
199 | }
200 |
--------------------------------------------------------------------------------
/code/KeyboardTester/KeyboardTester.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | x64
7 |
8 |
9 | Release
10 | x64
11 |
12 |
13 |
14 | {135EF1EC-BD47-4136-9AA0-2103A0E8D1E2}
15 | QtVS_v304
16 | 10.0
17 | 10.0
18 | $(MSBuildProjectDirectory)\QtMsBuild
19 |
20 |
21 |
22 | DynamicLibrary
23 | v143
24 |
25 |
26 | DynamicLibrary
27 | v143
28 |
29 |
30 |
31 |
32 |
33 |
34 | 5.15.2_msvc2019_64
35 | core;gui;widgets;webenginewidgets
36 | debug
37 |
38 |
39 | 5.15.2_msvc2019_64
40 | core;gui;widgets;webenginewidgets
41 | release
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 | %(AdditionalDependencies)
66 |
67 |
68 |
69 |
70 | %(AdditionalDependencies)
71 |
72 |
73 |
74 |
75 | true
76 | true
77 | ProgramDatabase
78 | Disabled
79 | KEYBOARDTESTER_LIB;%(PreprocessorDefinitions)
80 |
81 |
82 | Windows
83 | true
84 |
85 |
86 |
87 |
88 | true
89 | true
90 | None
91 | MaxSpeed
92 | KEYBOARDTESTER_LIB;%(PreprocessorDefinitions)
93 |
94 |
95 | Windows
96 | false
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
--------------------------------------------------------------------------------