mirror of
https://github.com/Adaptix-Framework/AdaptixC2
synced 2026-06-08 10:20:39 +00:00
55 lines
1.4 KiB
C++
55 lines
1.4 KiB
C++
#include <UI/Dialogs/DialogSyncPacket.h>
|
|
|
|
DialogSyncPacket::DialogSyncPacket()
|
|
{
|
|
splashScreen = new CustomSplashScreen();
|
|
splashScreen->setPixmap(QPixmap(":/SyncLogo"));
|
|
|
|
logNameLabel = new QLabel("Log synchronization");
|
|
|
|
logProgressLabel = new QLabel();
|
|
logProgressLabel->setAlignment(Qt::AlignCenter);
|
|
|
|
progressBar = new QProgressBar();
|
|
|
|
layout = new QVBoxLayout(splashScreen);
|
|
layout->addWidget(logNameLabel);
|
|
layout->addStretch();
|
|
layout->addWidget(progressBar);
|
|
layout->addWidget(logProgressLabel);
|
|
}
|
|
|
|
DialogSyncPacket::~DialogSyncPacket() = default;
|
|
|
|
void DialogSyncPacket::init(int count)
|
|
{
|
|
receivedLogs = 0;
|
|
totalLogs = count;
|
|
QString progress = QString("Received: %1 / %2").arg(receivedLogs).arg(totalLogs);
|
|
logProgressLabel->setText(progress);
|
|
logProgressLabel->setAlignment(Qt::AlignCenter);
|
|
|
|
progressBar->setRange(receivedLogs, totalLogs);
|
|
progressBar->setValue(receivedLogs);
|
|
}
|
|
|
|
void DialogSyncPacket::upgrade() const
|
|
{
|
|
QString progress = QString("Received: %1 / %2").arg(receivedLogs).arg(totalLogs);
|
|
logProgressLabel->setText(progress);
|
|
|
|
if (totalLogs > 0) {
|
|
progressBar->setValue(receivedLogs);
|
|
}
|
|
|
|
if (receivedLogs >= totalLogs) {
|
|
finish();
|
|
}
|
|
}
|
|
|
|
void DialogSyncPacket::finish() const
|
|
{
|
|
logProgressLabel->setText("Synchronization complete!");
|
|
splashScreen->close();
|
|
}
|