mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJClient.git
synced 2026-03-28 05:25:39 +03:00
feat: add instructor updateBehaviour
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
#include "updatenotifywidget.h"
|
||||
#include "updatenotifywidget.h"
|
||||
|
||||
#include <QFontDatabase>
|
||||
#include <QMessageBox>
|
||||
#include <QPaintEvent>
|
||||
#include <QPainter>
|
||||
#include <QTimer>
|
||||
@@ -34,7 +36,9 @@ void MainWindow::initialize()
|
||||
ui->autostartCheckBox->hide();
|
||||
ui->startButton->setEnabled(false);
|
||||
ui->loginWidget->hide();
|
||||
|
||||
ui->updateWidget->hide();
|
||||
ui->updateButtonGroup_2->hide();
|
||||
|
||||
createObjects();
|
||||
|
||||
@@ -51,7 +55,6 @@ void MainWindow::initialize()
|
||||
emit sigSetConnect(dataParser->getServerSettings(),connectionThread);
|
||||
|
||||
checkAppAvailable();
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::createObjects()
|
||||
@@ -96,11 +99,15 @@ void MainWindow::bindConnection()
|
||||
connect(recognizeSystem,&RecognizeSystem::sigSocketWaitForReadyRead,client,&TCPClient::waitRead,Qt::AutoConnection);
|
||||
connect(recognizeSystem,&RecognizeSystem::sigServerBlocked,this,&MainWindow::serverBlocked);
|
||||
|
||||
connect(updateController,&UpdateController::sigUpdateComplete,this,&MainWindow::showCompleteDialogBox);
|
||||
|
||||
connect(hashComparer,&HashComparer::sigCallCheck,this,&MainWindow::checkUpdate);
|
||||
connect(hashComparer,&HashComparer::sigHaveDelta,this,&MainWindow::showUpdateInfo);
|
||||
|
||||
connect(sendSystem,&SendSystem::sigSend,this,&MainWindow::updateProgress);
|
||||
connect(sendSystem,&SendSystem::sigGetXmlAnswer,dataParser,&DataParser::slotGetXmlAnswer);
|
||||
|
||||
connect(this,&MainWindow::sigUpdateFilesOnServer,updateController,&UpdateController::updateFilesOnServer);
|
||||
connect(this,&MainWindow::sigInitializeClient,client,&TCPClient::initialize,Qt::AutoConnection);
|
||||
connect(this,&MainWindow::sigSetConnect,client,&TCPClient::setConnect,Qt::AutoConnection);
|
||||
connect(this,&MainWindow::sigSendCommand,client,&TCPClient::slotSendCommand,Qt::AutoConnection);
|
||||
@@ -156,6 +163,7 @@ void MainWindow::setNeedUpdate(bool flag,quint64 size, quint64 fileCount)
|
||||
ui->loadingProgressBar->setValue(100);
|
||||
autoStart();
|
||||
ui->startButton->show();
|
||||
ui->offlineStartButton->setGeometry(570,510,220,35);
|
||||
ui->offlineStartButton->show();
|
||||
}
|
||||
|
||||
@@ -311,14 +319,13 @@ void MainWindow::callUpdateList()
|
||||
QByteArray answer = dataParser->xmlAnswer_notify("GETSERVERDATALIST");
|
||||
sendSystem->sendXMLAnswer(answer);
|
||||
|
||||
updateWidget->initialize(this,updateController);
|
||||
updateWidget->initialize(this);
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::bindNotifyWidget(UpdateNotifyWidget *widget)
|
||||
{
|
||||
updateWidget = widget;
|
||||
connect(sendSystem,&SendSystem::sigSend,updateWidget,&UpdateNotifyWidget::updateCount);
|
||||
}
|
||||
|
||||
void MainWindow::on_loginButton_clicked()
|
||||
@@ -406,6 +413,36 @@ void MainWindow::on_languageComboBox_activated(const QString &arg1)
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
|
||||
void MainWindow::on_loadToServerButton_clicked()
|
||||
{
|
||||
ui->inlineTextDebug->setText(tr("Отправка файлов..."));
|
||||
ui->loadingProgressBar->show();
|
||||
ui->updateButtonGroup_2->hide();
|
||||
ui->offlineStartButton->hide();
|
||||
ui->updateWidget->hide();
|
||||
|
||||
emit sigUpdateFilesOnServer(hashComparer->getFilesForUpdate());
|
||||
}
|
||||
|
||||
void MainWindow::on_undoChangesButton_clicked()
|
||||
{
|
||||
ui->loadingProgressBar->show();
|
||||
ui->offlineStartButton->hide();
|
||||
ui->updateButtonGroup_2->hide();
|
||||
ui->updateWidget->hide();
|
||||
on_updateButton_clicked();
|
||||
}
|
||||
|
||||
void MainWindow::on_startWithCurrentChangesButton_clicked()
|
||||
{
|
||||
on_startButton_clicked();
|
||||
}
|
||||
|
||||
void MainWindow::on_updateListGuideLabel_linkActivated(const QString &link)
|
||||
{
|
||||
updateWidget->show();
|
||||
}
|
||||
|
||||
void MainWindow::checkUpdate()
|
||||
{
|
||||
ui->loadingProgressBar->setValue(0);
|
||||
@@ -420,14 +457,42 @@ void MainWindow::showUpdateInfo()
|
||||
QString list = tr("Возможные действия:\n"
|
||||
" 1. Загрузить изменения на сервер\n"
|
||||
" 2. Отменить изменения с загрузкой версии с сервера \n"
|
||||
" 3. Запустить с текущими изменениями");
|
||||
" 3. Запустить без отправки файлов, но с текущими изменениями");
|
||||
|
||||
|
||||
ui->updateListGuideLabel->setText(text);
|
||||
ui->updateActionListLabel->setText(list);
|
||||
|
||||
ui->updateWidget->show();
|
||||
ui->updateButtonGroup_2->show();
|
||||
ui->offlineStartButton->setGeometry(570,552,220,35);
|
||||
fileCountForUpdate = hashComparer->getFilesForUpdate()->length();
|
||||
|
||||
filesLoaded = 0;
|
||||
}
|
||||
|
||||
void MainWindow::showCompleteDialogBox(bool flag)
|
||||
{
|
||||
QMessageBox *messageBox = new QMessageBox(this);
|
||||
|
||||
if(flag)
|
||||
{
|
||||
messageBox->setIcon(QMessageBox::Information);
|
||||
messageBox->setWindowTitle(tr("Информация"));
|
||||
messageBox->addButton(QMessageBox::Ok);
|
||||
messageBox->setStyleSheet("QMessageBox {color: black;}");
|
||||
messageBox->setText(tr("Загрузка завершена"));
|
||||
}
|
||||
else
|
||||
{
|
||||
messageBox->setIcon(QMessageBox::Warning);
|
||||
messageBox->setWindowTitle(tr("Ошибка"));
|
||||
messageBox->addButton(QMessageBox::Ok);
|
||||
messageBox->setText(tr("Произошла ошибка при загрузке"));
|
||||
}
|
||||
|
||||
connect(messageBox,&QMessageBox::accepted,this,&MainWindow::checkUpdate);
|
||||
messageBox->show();
|
||||
}
|
||||
|
||||
void MainWindow::keyPressEvent(QKeyEvent *event)
|
||||
@@ -441,12 +506,6 @@ void MainWindow::keyPressEvent(QKeyEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_updateListGuideLabel_linkActivated(const QString &link)
|
||||
{
|
||||
updateWidget->show();
|
||||
}
|
||||
|
||||
void MainWindow::painting()
|
||||
{
|
||||
QFontDatabase::addApplicationFont(":/resource/Fonts/Kanit Cyrillic.ttf");
|
||||
@@ -479,3 +538,4 @@ MainWindow::~MainWindow()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user