mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJClient.git
synced 2026-03-28 05:25:39 +03:00
bugfix/feat: main loading bar, add bar for sender
This commit is contained in:
@@ -9,13 +9,17 @@ UpdateNotifyWidget::UpdateNotifyWidget(QWidget *parent) :
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowFlag(Qt::SubWindow);
|
||||
setAttribute(Qt::WA_ShowModal,true);
|
||||
}
|
||||
|
||||
void UpdateNotifyWidget::initialize(MainWindow *mainWindow,UpdateController *updateController)
|
||||
{
|
||||
setWindowTitle("Отправка новых файлов");
|
||||
|
||||
ui->LoadingBar->hide();
|
||||
this->mainWindow = mainWindow;
|
||||
this->updateController = updateController;
|
||||
currentLoadingCount = 0;
|
||||
fillList();
|
||||
|
||||
connect(updateController,&UpdateController::sigUpdateComplete,this,&UpdateNotifyWidget::showCompleteDialogBox);
|
||||
@@ -24,18 +28,32 @@ void UpdateNotifyWidget::initialize(MainWindow *mainWindow,UpdateController *upd
|
||||
|
||||
void UpdateNotifyWidget::setUpdateList(QList<FileData> *fileDataList)
|
||||
{
|
||||
int listCount = fileDataList->count();
|
||||
this->updateList = fileDataList;
|
||||
|
||||
ui->LoadingBar->setRange(0,listCount);
|
||||
}
|
||||
|
||||
void UpdateNotifyWidget::updateCount()
|
||||
{
|
||||
currentLoadingCount++;
|
||||
ui->LoadingBar->setValue(currentLoadingCount);
|
||||
}
|
||||
|
||||
void UpdateNotifyWidget::addToList(FileData fileData)
|
||||
{
|
||||
ui->updateListWidget->addItem(fileData.path);
|
||||
QString itemName = fileData.path;
|
||||
itemName = itemName.remove(streamingAssetsPath);
|
||||
ui->updateListWidget->addItem(itemName);
|
||||
}
|
||||
|
||||
|
||||
void UpdateNotifyWidget::on_StartLoadButton_clicked()
|
||||
{
|
||||
emit sigUpdateFilesOnServer(updateList);
|
||||
ui->StartLoadButton->setEnabled(false);
|
||||
ui->CancelButton->setEnabled(false);
|
||||
ui->LoadingBar->show();
|
||||
}
|
||||
|
||||
void UpdateNotifyWidget::on_CancelButton_clicked()
|
||||
@@ -56,7 +74,7 @@ UpdateNotifyWidget::~UpdateNotifyWidget()
|
||||
|
||||
void UpdateNotifyWidget::showCompleteDialogBox(bool flag)
|
||||
{
|
||||
QMessageBox *messageBox = new QMessageBox;
|
||||
QMessageBox *messageBox = new QMessageBox(this);
|
||||
|
||||
if(flag)
|
||||
{
|
||||
@@ -64,7 +82,6 @@ void UpdateNotifyWidget::showCompleteDialogBox(bool flag)
|
||||
messageBox->setWindowTitle("Информация");
|
||||
messageBox->addButton(QMessageBox::Ok);
|
||||
messageBox->setText("Загрузка завершена");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -76,6 +93,5 @@ void UpdateNotifyWidget::showCompleteDialogBox(bool flag)
|
||||
|
||||
connect(messageBox,&QMessageBox::accepted,this,&UpdateNotifyWidget::hide);
|
||||
connect(messageBox,&QMessageBox::accepted,this,&UpdateNotifyWidget::on_CancelButton_clicked);
|
||||
|
||||
messageBox->show();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user