Show progress if file size is lager 10Mb

This commit is contained in:
Anton 2024-10-22 14:48:54 +03:00
parent 1f99ad5551
commit 5bf6edb8c4
2 changed files with 7 additions and 5 deletions

View File

@ -20,7 +20,9 @@ int progress (uint64_t const sent, uint64_t const total,
void const * const data)
{
uint64_t progress_percent = (100*sent)/total;
if (((progress_percent % 10) == 0) && (progress_percent > prev_progress)) {
if (((progress_percent % 10) == 0) &&
(progress_percent > prev_progress) &&
(total>10*1024*1024)){
printf(" Progress %d\n", progress_percent);
mainwin->uploadDownloadNotification->SetProgress((float)sent/total);

View File

@ -227,8 +227,8 @@ MainWindow::MessageReceived(BMessage *msg)
uploadDownloadNotification->SetTitle("Uploading");
uploadDownloadNotification->SetContent(openFileName);
uploadDownloadNotification->SetMessageID("mainwindow_progress");
uploadDownloadNotification->SetProgress(0.5);
uploadDownloadNotification->Send();
//uploadDownloadNotification->SetProgress(0.5);
//uploadDownloadNotification->Send();
int send_res = sendfile_function(openFileName, selectedItem->fileId(), newFileId);
if (send_res == 0)
@ -274,8 +274,8 @@ MainWindow::MessageReceived(BMessage *msg)
uploadDownloadNotification->SetTitle("Downloading");
uploadDownloadNotification->SetContent(selectedItem->Text());
uploadDownloadNotification->SetMessageID("mainwindow_progress");
uploadDownloadNotification->SetProgress(0.5);
uploadDownloadNotification->Send();
//uploadDownloadNotification->SetProgress(0.5);
//uploadDownloadNotification->Send();
if (LIBMTP_Get_File_To_File(selectedItem->device(), selectedItem->fileId(),
/*selectedItem->Text()*/ fullSaveFileName, progress, NULL) != 0 ){