mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJClient.git
synced 2026-03-28 05:25:39 +03:00
119 lines
3.8 KiB
C++
119 lines
3.8 KiB
C++
#include "updatenotifywidget.h"
|
||
#include "ui_updatenotifywidget.h"
|
||
#include "mainwindow.h"
|
||
|
||
#include <QMessageBox>
|
||
|
||
UpdateNotifyWidget::UpdateNotifyWidget(QWidget *) :
|
||
ui(new Ui::UpdateNotifyWidget)
|
||
{
|
||
ui->setupUi(this);
|
||
// setWindowFlag(Qt::FramelessWindowHint);
|
||
// setAttribute(Qt::WA_ShowModal,true);
|
||
}
|
||
|
||
void UpdateNotifyWidget::initialize(MainWindow *mainWindow,VersionContainer *verContainer)
|
||
{
|
||
this->mainWindow = mainWindow;
|
||
this->versionContainer = verContainer;
|
||
currentLoadingCount = 0;
|
||
hide();
|
||
|
||
auto pos = mainWindow->pos();
|
||
pos.setY(pos.y() + 40);
|
||
move(pos);
|
||
}
|
||
|
||
void UpdateNotifyWidget::addToList(FileData fileData)
|
||
{
|
||
QString itemName = fileData.path;
|
||
itemName = itemName.remove(streamingAssetsPath);
|
||
ui->updateListWidget->addItem(itemName);
|
||
}
|
||
|
||
void UpdateNotifyWidget::showWithFill()
|
||
{
|
||
clearList();
|
||
|
||
if(versionContainer->getServerVersion() == baseNamePackage)
|
||
{
|
||
QString link;
|
||
|
||
ui->labelsLayout->addWidget(createLabel(tr("Данные изменения нельзя выгрузить на сервер, так как версия сервера не изменяема \n")));
|
||
ui->labelsLayout->addWidget(createLabel(tr("Чтобы внести изменения нужно:")));
|
||
ui->labelsLayout->addWidget(createLabel(tr("1. Скопировать измененные или созданные файлы в временную папку")));
|
||
ui->labelsLayout->addWidget(createLabel(tr("2. Изменить версию сервера на изменяемую")));
|
||
ui->labelsLayout->addWidget(createLabel(tr("3. Запустить клиент и обновить версию и выключить клиент")));
|
||
|
||
//СОЗДАНИЕ
|
||
QString path = QDir::currentPath() + streamingAssetsPath;
|
||
link = "\"<a href=\""+ path + "\">папку</a>\"";
|
||
QLabel *linkLabel = new QLabel;
|
||
linkLabel->setText(tr("4. Скопировать файлы из временной папки в эту ") + link);
|
||
linkLabel->setOpenExternalLinks(true);
|
||
|
||
ui->labelsLayout->addWidget(linkLabel);
|
||
ui->labelsLayout->addWidget(createLabel(tr("5.Запустить клиент и выгрузить изменения на сервер")));
|
||
|
||
ui->instructorButtonGroup->hide();
|
||
}
|
||
else
|
||
{
|
||
ui->labelsLayout->addWidget(createLabel(tr("Возможные действия:")));
|
||
ui->labelsLayout->addWidget(createLabel(tr(" 1. Выгрузить изменения на сервер")));
|
||
ui->labelsLayout->addWidget(createLabel(tr(" 2. Отменить изменения с загрузкой версии с сервера")));
|
||
ui->labelsLayout->addWidget(createLabel(tr(" 3. Запустить без отправки файлов, но с текущими изменениями")));
|
||
|
||
ui->instructorButtonGroup->show();
|
||
}
|
||
|
||
qDebug() << ui->NotificationLabel->text();
|
||
show();
|
||
}
|
||
|
||
void UpdateNotifyWidget::clearList()
|
||
{
|
||
QLayoutItem* item;
|
||
while ( ( item = ui->labelsLayout->layout()->takeAt( 0 ) ) != NULL )
|
||
{
|
||
delete item->widget();
|
||
delete item;
|
||
}
|
||
}
|
||
QLabel* UpdateNotifyWidget::createLabel(QString text)
|
||
{
|
||
QLabel *label = new QLabel;
|
||
label->setText(text);
|
||
|
||
return label;
|
||
}
|
||
void UpdateNotifyWidget::on_loadToServerButton_clicked()
|
||
{
|
||
mainWindow->loadToServer();
|
||
}
|
||
|
||
void UpdateNotifyWidget::on_undoChangesButton_clicked()
|
||
{
|
||
mainWindow->undoCurrentChanges();
|
||
}
|
||
|
||
void UpdateNotifyWidget::on_startWithCurrentChangesButton_clicked()
|
||
{
|
||
mainWindow->startUnityClient();
|
||
}
|
||
|
||
UpdateNotifyWidget::~UpdateNotifyWidget()
|
||
{
|
||
delete ui;
|
||
}
|
||
|
||
void UpdateNotifyWidget::on_closeButton_clicked()
|
||
{
|
||
close();
|
||
}
|
||
|
||
void UpdateNotifyWidget::on_updateActionListLabel_linkActivated(const QString &link)
|
||
{
|
||
|
||
}
|