Skip to content

Commit 18d614f

Browse files
committed
[重构Windows系统集成模块并统一代码规范]: 将ShowInMyComputer模块重构为WindowsIntegration,增强功能性和用户体验,同时统一命名空间规范和Qt头文件包含方式
- **模块重构与功能增强**: 将ShowInMyComputer模块重命名为WindowsIntegration,提供更完善的Windows"此电脑"集成功能,包含状态检查、注册管理和用户友好的GUI界面 - **命名空间统一**: 将AutoStartManager命名空间统一为Utils,提升代码组织的一致性和可维护性 - **构建系统优化**: 更新CMakeLists.txt,将目标名称从ShowInMyComputer改为windows_integration,AutoStartManager改为auto_start_manager,遵循更规范的命名约定 - **代码现代化**: 统一多个模块的main.cc文件,使用标准的`<QApplication>`头文件包含,移除过时的Qt版本条件编译 - **文档与资源更新**: 更新README.md文档,移除旧的ShowInMyComputer描述,新增WindowsIntegration详细说明和效果截图展示 - **用户体验改进**: WindowsIntegration模块提供完整的注册状态管理、操作确认对话框和状态刷新功能,增强交互体验和操作安全性
1 parent c644062 commit 18d614f

26 files changed

Lines changed: 317 additions & 167 deletions

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,6 @@ void ThreadedTcpServer::incomingConnection(qintptr socketDescriptor)
228228
- 灵活回调系统,支持Lambda和成员函数
229229
- 包含Echo服务器示例和Python测试脚本
230230
231-
### [ShowInMyComputer](src/ShowInMyComputer/) - 系统集成
232-
233-
- 在系统位置中显示应用程序
234-
- 防火墙白名单
235-
236231
### [SimpleUdp](src/SimpleUdp/) - UDP 通信
237232
238233
- UDP 广播和接收
@@ -276,6 +271,13 @@ void ThreadedTcpServer::incomingConnection(qintptr socketDescriptor)
276271
- 改进的 IntValidator 和 DoubleValidator
277272
- 自定义验证规则
278273
274+
### [WindowsIntegration](src/WindowsIntegration/) - Windows"此电脑"集成
275+
276+
- **Windows**:注册表 `HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\{GUID}` 和 `HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\NameSpace\{GUID}`
277+
- **功能**:将应用程序图标添加到Windows"此电脑"中,与磁盘驱动器并列显示
278+
- **特点**:双击直接启动应用,使用应用自身图标,无需管理员权限
279+
- <img src="src/WindowsIntegration/images/windows_integration.png" width="1125" alt="此电脑集成">
280+
279281
### [packaging](src/packaging/) - 跨平台打包解决方案
280282
281283
##### macOS 打包

src/AutoStartManager/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ else()
88
list(APPEND PROJECT_SOURCES autostartmanager_linux.cc)
99
endif()
1010

11-
qt_add_executable(AutoStartManager ${PROJECT_SOURCES})
12-
target_link_libraries(AutoStartManager PRIVATE Qt::Widgets)
11+
qt_add_executable(auto_start_manager ${PROJECT_SOURCES})
12+
target_link_libraries(auto_start_manager PRIVATE Qt::Widgets)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#pragma once
22

3-
namespace AutoStartManager {
3+
namespace Utils {
44

55
bool isAutoRunStart();
66

77
void setAutoRunStart(bool run);
88

9-
} // namespace AutoStartManager
9+
} // namespace Utils

src/AutoStartManager/autostartmanager_linux.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <QDir>
66
#include <QFile>
77

8-
namespace AutoStartManager {
8+
namespace Utils {
99

1010
bool isAutoRunStart()
1111
{
@@ -67,4 +67,4 @@ X-GNOME-Autostart-enabled=true
6767
}
6868
}
6969

70-
} // namespace AutoStartManager
70+
} // namespace Utils

src/AutoStartManager/autostartmanager_macos.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <QFile>
77
#include <QProcess>
88

9-
namespace AutoStartManager {
9+
namespace Utils {
1010

1111
bool isAutoRunStart()
1212
{
@@ -88,4 +88,4 @@ void setAutoRunStart(bool run)
8888
}
8989
}
9090

91-
} // namespace AutoStartManager
91+
} // namespace Utils

src/AutoStartManager/autostartmanager_windows.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <QDir>
55
#include <QSettings>
66

7-
namespace AutoStartManager {
7+
namespace Utils {
88

99
// 注册表路径定义
1010
static const QString REG_RUN_PATH
@@ -36,4 +36,4 @@ void setAutoRunStart(bool run)
3636
}
3737
}
3838

39-
} // namespace AutoStartManager
39+
} // namespace Utils

src/AutoStartManager/mainwindow.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ MainWindow::MainWindow(QWidget *parent)
8989
};
9090

9191
// Initialize checkbox state
92-
bool isAutoRun = AutoStartManager::isAutoRunStart();
92+
bool isAutoRun = Utils::isAutoRunStart();
9393
autoRunCheckBox->setChecked(isAutoRun);
9494
updateStatusLabel(statusLabel, isAutoRun);
9595

@@ -111,7 +111,7 @@ MainWindow::MainWindow(QWidget *parent)
111111

112112
if (reply == QMessageBox::Yes) {
113113
// Set auto-start state
114-
AutoStartManager::setAutoRunStart(checked);
114+
Utils::setAutoRunStart(checked);
115115

116116
// Update status display
117117
updateStatusLabel(statusLabel, checked);
@@ -137,7 +137,7 @@ MainWindow::MainWindow(QWidget *parent)
137137
&QPushButton::clicked,
138138
this,
139139
[this, statusLabel, autoRunCheckBox, updateStatusLabel]() {
140-
bool isAutoRun = AutoStartManager::isAutoRunStart();
140+
bool isAutoRun = Utils::isAutoRunStart();
141141
autoRunCheckBox->blockSignals(true);
142142
autoRunCheckBox->setChecked(isAutoRun);
143143
autoRunCheckBox->blockSignals(false);

src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ add_subdirectory(TreeViewModel)
3232
add_subdirectory(Validator)
3333

3434
if(CMAKE_HOST_WIN32)
35-
add_subdirectory(ShowInMyComputer)
35+
add_subdirectory(WindowsIntegration)
3636
endif()

src/CheckableTreeItem/main.cc

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
#include "mainwindow.hpp"
22

3-
#include <QtCore/qglobal.h>
4-
#if QT_VERSION >= 0x050000
5-
#include <QtWidgets/QApplication>
6-
#else
7-
#include <QtGui/QApplication>
8-
#endif
3+
#include <QApplication>
94

105
auto main(int argc, char *argv[]) -> int
116
{

src/PasswordLineEdit/main.cc

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
#include "mainwindow.hpp"
22

3-
#include <QtCore/qglobal.h>
4-
#if QT_VERSION >= 0x050000
5-
#include <QtWidgets/QApplication>
6-
#else
7-
#include <QtGui/QApplication>
8-
#endif
3+
#include <QApplication>
94

105
auto main(int argc, char *argv[]) -> int
116
{

0 commit comments

Comments
 (0)