Skip to content

Commit 9e3751c

Browse files
committed
new commit
1 parent 585b64c commit 9e3751c

File tree

16 files changed

+461
-18
lines changed

16 files changed

+461
-18
lines changed

AutoRun.pro

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,18 @@ LIBS += -luser32 -lAdvapi32
1111
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
1212

1313
SOURCES += \
14+
add.cpp \
1415
main.cpp \
1516
mainwindow.cpp
1617

1718
HEADERS += \
19+
add.h \
1820
mainwindow.h \
19-
global.h
21+
global.h \
22+
regItem.h
2023

2124
FORMS += \
25+
add.ui \
2226
mainwindow.ui
2327

2428
TRANSLATIONS += \
@@ -30,3 +34,12 @@ CONFIG += embed_translations
3034
qnx: target.path = /tmp/$${TARGET}/bin
3135
else: unix:!android: target.path = /opt/$${TARGET}/bin
3236
!isEmpty(target.path): INSTALLS += target
37+
38+
RESOURCES += \
39+
resources.qrc
40+
41+
DISTFILES += \
42+
logo.rc
43+
44+
RC_FILE += \
45+
logo.rc

Properties_32x32.png

2.47 KB
Loading

ReadMe.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# AutoRun
2+
3+
中文 | [ENG](doc/ENG.md)
4+
5+
编辑Windows系统自启动项,分为两个根路径:
6+
7+
+ 当前用户启动项:`HKEY_CURRENT_USER`
8+
+ 系统启动项:`HKEY_LOCAL_MACHINE`(需要管理员权限)
9+
10+
11+
12+
# 界面
13+
14+
### 1. add registry
15+
16+
![add](C:\Users\zwjiang\Documents\Qt project\AutoRun\doc\add.png)
17+
18+
19+
20+
### 2. delete registry
21+
22+
![delete](C:\Users\zwjiang\Documents\Qt project\AutoRun\doc\delete.png)

add.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include "add.h"
2+
#include "ui_add.h"
3+
4+
add::add(QString & NEWNAME, QString & NEWVALUE, QWidget *parent) :
5+
QDialog(parent),
6+
ui(new Ui::add),
7+
newName(NEWNAME),
8+
newValue(NEWVALUE)
9+
{
10+
ui->setupUi(this);
11+
setWindowTitle("Add Registry");
12+
setWindowIcon(QIcon("://Properties_32x32.png"));
13+
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
14+
ui->nameEdit->setFocus();
15+
}
16+
17+
add::~add()
18+
{
19+
delete ui;
20+
}
21+
22+
void add::on_buttonBox_accepted()
23+
{
24+
newName = ui->nameEdit->text();
25+
newValue = ui->valueEdit->text();
26+
}
27+

add.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#ifndef ADD_H
2+
#define ADD_H
3+
4+
#include <QDialog>
5+
#include <QIcon>
6+
7+
namespace Ui {
8+
class add;
9+
}
10+
11+
class add : public QDialog
12+
{
13+
Q_OBJECT
14+
15+
public:
16+
explicit add(QString & NEWNAME, QString & NEWVALUE, QWidget *parent = nullptr);
17+
~add();
18+
19+
private slots:
20+
void on_buttonBox_accepted();
21+
22+
private:
23+
Ui::add *ui;
24+
QString & newName;
25+
QString & newValue;
26+
};
27+
28+
#endif // ADD_H

add.ui

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>add</class>
4+
<widget class="QDialog" name="add">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>400</width>
10+
<height>137</height>
11+
</rect>
12+
</property>
13+
<property name="windowTitle">
14+
<string>Dialog</string>
15+
</property>
16+
<layout class="QGridLayout" name="gridLayout_3">
17+
<item row="0" column="0">
18+
<layout class="QGridLayout" name="gridLayout_2" rowstretch="0,0">
19+
<property name="verticalSpacing">
20+
<number>15</number>
21+
</property>
22+
<item row="1" column="0">
23+
<widget class="QLabel" name="label_2">
24+
<property name="text">
25+
<string>值:</string>
26+
</property>
27+
</widget>
28+
</item>
29+
<item row="1" column="1">
30+
<widget class="QLineEdit" name="valueEdit"/>
31+
</item>
32+
<item row="0" column="0">
33+
<widget class="QLabel" name="label">
34+
<property name="text">
35+
<string>名称:</string>
36+
</property>
37+
</widget>
38+
</item>
39+
<item row="0" column="1">
40+
<widget class="QLineEdit" name="nameEdit">
41+
<property name="text">
42+
<string/>
43+
</property>
44+
</widget>
45+
</item>
46+
</layout>
47+
</item>
48+
<item row="1" column="0">
49+
<widget class="QDialogButtonBox" name="buttonBox">
50+
<property name="orientation">
51+
<enum>Qt::Horizontal</enum>
52+
</property>
53+
<property name="standardButtons">
54+
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
55+
</property>
56+
</widget>
57+
</item>
58+
</layout>
59+
</widget>
60+
<resources/>
61+
<connections>
62+
<connection>
63+
<sender>buttonBox</sender>
64+
<signal>accepted()</signal>
65+
<receiver>add</receiver>
66+
<slot>accept()</slot>
67+
<hints>
68+
<hint type="sourcelabel">
69+
<x>248</x>
70+
<y>254</y>
71+
</hint>
72+
<hint type="destinationlabel">
73+
<x>157</x>
74+
<y>274</y>
75+
</hint>
76+
</hints>
77+
</connection>
78+
<connection>
79+
<sender>buttonBox</sender>
80+
<signal>rejected()</signal>
81+
<receiver>add</receiver>
82+
<slot>reject()</slot>
83+
<hints>
84+
<hint type="sourcelabel">
85+
<x>316</x>
86+
<y>260</y>
87+
</hint>
88+
<hint type="destinationlabel">
89+
<x>286</x>
90+
<y>274</y>
91+
</hint>
92+
</hints>
93+
</connection>
94+
</connections>
95+
</ui>

doc/ENG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# AutoRun
2+
3+
[中文](../ReadMe.md) | ENG
4+
5+
To edit Automatic Startup on Windows,where two ROOTs included:
6+
7+
+ current user: `HKEY_CURRENT_USER`
8+
+ system: `HKEY_LOCAL_MACHINE`(Require Administrator Permission)
9+
10+
11+
12+
# Interface
13+
14+
### 1. add registry
15+
16+
![add](add.png)
17+
18+
19+
20+
### 2. delete registry
21+
22+
![delete](delete.png)

doc/add.png

188 KB
Loading

doc/delete.png

175 KB
Loading

global.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
#define CURRENT_USER_AUTORUN_PATH L"Software\\Microsoft\\Windows\\CurrentVersion\\Run"
55
#define LOCAL_MACHINE_AUTORUN_PATH L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"
66

7-
#endif
7+
8+
#endif

0 commit comments

Comments
 (0)