-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathmain_qt.cpp
More file actions
185 lines (153 loc) · 4.88 KB
/
main_qt.cpp
File metadata and controls
185 lines (153 loc) · 4.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#include "src/LicenseManager.h"
#include <QApplication>
#include <QClipboard>
#include <QGraphicsDropShadowEffect>
#include <QHBoxLayout>
#include <QLabel>
#include <QPushButton>
#include <QString>
#include <QTextEdit>
#include <QVBoxLayout>
#include <QWidget>
#include <QtConcurrent/QtConcurrent>
#include <QFuture>
#include <QFutureWatcher>
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
app.setStyle("fusion");
QWidget window;
window.setWindowTitle("EsetKeysScrapper");
window.setFixedSize(520, 450);
window.setAttribute(Qt::WA_TranslucentBackground);
app.setStyleSheet(R"(
QWidget {
color: #f1f1f1;
font-family: 'Segoe UI';
font-size: 14px;
}
QFrame#mainCard {
background-color: #2b2d31;
border-radius: 14px;
}
QLabel#title {
font-size: 22px;
font-weight: 700;
color: #ffffff;
margin-bottom: 8px;
}
QLabel#disclaimerTitle {
font-size: 13px;
font-weight: bold;
letter-spacing: 2px;
color: #6ab04c;
margin-top: 4px;
}
QLabel#disclaimer {
font-size: 12px;
color: #aaaaaa;
line-height: 1.4em;
margin-bottom: 12px;
}
QTextEdit {
border: 1px solid #3d3f44;
border-radius: 10px;
background-color: #1b1c1e;
padding: 14px;
font-family: Consolas, monospace;
font-size: 16px;
font-weight: 600;
color: #00ff9c;
text-align: center;
}
QPushButton {
border: none;
border-radius: 8px;
padding: 10px 20px;
font-weight: 600;
background-color: #0078d7;
color: #ffffff;
transition: all 0.2s ease-in-out;
}
QPushButton:hover {
background-color: #3794ff;
}
QPushButton:disabled {
background-color: #55585c;
color: #aaaaaa;
}
)");
QFrame *card = new QFrame();
card->setObjectName("mainCard");
QGraphicsDropShadowEffect *shadow = new QGraphicsDropShadowEffect();
shadow->setBlurRadius(25);
shadow->setOffset(0, 6);
shadow->setColor(QColor(0, 0, 0, 160));
card->setGraphicsEffect(shadow);
QLabel *title = new QLabel("🔑 EsetKeysScrapper");
title->setObjectName("title");
title->setAlignment(Qt::AlignCenter);
QLabel *disclaimerTitle = new QLabel("D I S C L A I M E R");
disclaimerTitle->setObjectName("disclaimerTitle");
disclaimerTitle->setAlignment(Qt::AlignCenter);
QLabel *disclaimerText = new QLabel(
"EsetKeysScrapper is intended for educational and research purposes only.<br>"
"The developers assume no responsibility for any misuse or illegal activities conducted with this tool.<br>"
"Users are advised to comply with all relevant laws and ethical guidelines when using this software."
);
disclaimerText->setObjectName("disclaimer");
disclaimerText->setAlignment(Qt::AlignCenter);
disclaimerText->setWordWrap(true);
QTextEdit *result = new QTextEdit();
result->setReadOnly(true);
result->setFixedHeight(100);
result->setAlignment(Qt::AlignCenter);
QPushButton *copyBtn = new QPushButton("📋 Copy");
QPushButton *generateBtn = new QPushButton("⚙️ Generate");
QHBoxLayout *buttons = new QHBoxLayout();
buttons->addStretch();
buttons->addWidget(copyBtn);
buttons->addWidget(generateBtn);
buttons->addStretch();
QVBoxLayout *layout = new QVBoxLayout(card);
layout->setContentsMargins(24, 24, 24, 24);
layout->setSpacing(16);
layout->addWidget(title);
layout->addWidget(disclaimerTitle);
layout->addWidget(disclaimerText);
layout->addSpacing(8);
layout->addWidget(result);
layout->addLayout(buttons);
QVBoxLayout *root = new QVBoxLayout(&window);
root->setContentsMargins(20, 20, 20, 20);
root->addWidget(card);
window.show();
QFutureWatcher<QString> *watcher = new QFutureWatcher<QString>(&window);
auto startGenerate = [=]() {
copyBtn->setEnabled(false);
generateBtn->setEnabled(false);
result->setText("⏳ Generating license...");
QApplication::processEvents();
QFuture<QString> future = QtConcurrent::run([]() -> QString {
LicenseManager manager(1, 10, "");
manager.generateLicenses();
auto licenses = manager.getLicenses();
if (!licenses.empty())
return QString::fromStdString(licenses[0].license);
return QString("❌ No license generated.");
});
watcher->setFuture(future);
};
QObject::connect(watcher, &QFutureWatcher<QString>::finished, [&]() {
QString lic = watcher->result();
result->setText(lic);
copyBtn->setEnabled(true);
generateBtn->setEnabled(true);
});
QObject::connect(copyBtn, &QPushButton::clicked, [=]() {
QApplication::clipboard()->setText(result->toPlainText());
});
QObject::connect(generateBtn, &QPushButton::clicked, startGenerate);
startGenerate();
return app.exec();
}
#include "main_qt.moc"