Исправил VersionSelectWidget

This commit is contained in:
2025-07-03 11:13:01 +03:00
parent 6e8968ee1f
commit 396562dd03
4 changed files with 56 additions and 39 deletions

View File

@@ -3,23 +3,36 @@
#include "ui_versionselectwidget.h"
#include <QMessageBox>
#include <QResizeEvent>
VersionSelectWidget::VersionSelectWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::VersionSelectWidget),
selectedVersion(nullptr)
selectedVersion(nullptr),
waitAnimationWidget(nullptr),
recognizeSystem(nullptr)
{
ui->setupUi(this);
setWindowFlags(Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
setAttribute(Qt::WA_ShowModal,true);
}
void VersionSelectWidget::initialize(SendSystem *sendSystem,VersionContainer *versionContainer,NotifyController *notifyController)
void VersionSelectWidget::initialize(SendSystem *sendSystem,VersionContainer *versionContainer,NotifyController *notifyController, RecognizeSystem *recognizeSystem)
{
this->recognizeSystem = recognizeSystem;
waitAnimationWidget = new WaitAnimationWidget;
QMovie *movie = new QMovie(":/resources/icons/762.gif");
waitAnimationWidget->setParent(this);
waitAnimationWidget->initialize(movie,this);
connect(this,&VersionSelectWidget::sigSendSwitchVersion,sendSystem,&SendSystem::sendChangeVersion,Qt::AutoConnection);
connect(this,&VersionSelectWidget::sigSendCopyVersion,sendSystem,&SendSystem::sendCopyVersion,Qt::AutoConnection);
connect(this,&VersionSelectWidget::sigSendDeleteVersion,sendSystem,&SendSystem::sendDeleteVersion,Qt::AutoConnection);
connect(this,&VersionSelectWidget::sigSendNotify,notifyController,&NotifyController::showWarning,Qt::AutoConnection);
connect(recognizeSystem,&RecognizeSystem::sigAnimationActivated,this,&VersionSelectWidget::activateLoadAnimation,Qt::AutoConnection);
this->versionContainer = versionContainer;
hide();
setWindowTitle(tr("Version control"));
@@ -66,7 +79,7 @@ void VersionSelectWidget::on_createDuplicateButton_clicked()
if (selectedVersion == nullptr)
{
sigSendNotify(tr("Version not selected"));
emit sigSendNotify(tr("Version not selected"));
return;
}
@@ -93,7 +106,7 @@ void VersionSelectWidget::sendCopyEmit(QString newName)
if (selectedVersion == nullptr)
{
sigSendNotify(tr("Version not selected"));
emit sigSendNotify(tr("Version not selected"));
return;
}
@@ -105,7 +118,7 @@ void VersionSelectWidget::on_DeleteVersionButton_clicked()
{
if (selectedVersion == nullptr)
{
sigSendNotify(tr("Version not selected"));
emit sigSendNotify(tr("Version not selected"));
return;
}
@@ -116,7 +129,7 @@ void VersionSelectWidget::on_switchServerVersionButton_clicked()
{
if (selectedVersion == nullptr)
{
sigSendNotify(tr("Version not selected"));
emit sigSendNotify(tr("Version not selected"));
return;
}
@@ -125,13 +138,35 @@ void VersionSelectWidget::on_switchServerVersionButton_clicked()
emit sigSendSwitchVersion(selectedVersion);
}
void VersionSelectWidget::activateLoadAnimation(bool flag)
{
if (flag)
{
waitAnimationWidget->showWithPlay();
}
else
{
waitAnimationWidget->hideWithStop();
}
}
void VersionSelectWidget::setAuthor(QString name)
{
authorName = name;
}
void VersionSelectWidget::resizeEvent(QResizeEvent *event)
{
QSize size = event->size();
waitAnimationWidget->resize(size);
}
VersionSelectWidget::~VersionSelectWidget()
{
waitAnimationWidget->hideWithStop();
delete waitAnimationWidget;
delete ui;
}