From 8b438ccd30ee767de32854e09d6a3b008c3a7b49 Mon Sep 17 00:00:00 2001 From: Martin Prikryl Date: Wed, 4 Feb 2026 16:20:34 +0000 Subject: [PATCH] Refactoring Source commit: ccadcd5e989d237f44bf93203541a0cc0b7f3019 --- source/forms/CustomScpExplorer.cpp | 7 ++++--- source/windows/QueueController.cpp | 32 ++++++++++++++++++++---------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/source/forms/CustomScpExplorer.cpp b/source/forms/CustomScpExplorer.cpp index 87bd205a2..9ed277b42 100644 --- a/source/forms/CustomScpExplorer.cpp +++ b/source/forms/CustomScpExplorer.cpp @@ -5149,17 +5149,18 @@ void __fastcall TCustomScpExplorerForm::UpdateStatusBar() } NoteStatusPanel->Hint = FNoteHints; - UnicodeString LoginTime; + UnicodeString LoginTimeStr; // See the comment in TScpCommanderForm::UpdateControls() TTerminal * ActiveTerminal = TTerminalManager::Instance()->ActiveTerminal; // Active is not enough here if ((ActiveTerminal != NULL) && (ActiveTerminal->Status == ssOpened)) { const TSessionInfo & SessionInfo = ActiveTerminal->GetSessionInfo(); - LoginTime = FormatDateTimeSpan(Now() - SessionInfo.LoginTime); + TDateTime LoginTime = Now() - SessionInfo.LoginTime; + LoginTimeStr = FormatDateTimeSpan(LoginTime); } TTBXStatusPanel * DurationStatusPanel = SessionStatusBar->Panels->Items[SessionStatusBar->Panels->Count - 1]; - DurationStatusPanel->Caption = LoginTime; + DurationStatusPanel->Caption = LoginTimeStr; } //--------------------------------------------------------------------------- void __fastcall TCustomScpExplorerForm::UpdateStatusPanelText(TTBXStatusPanel * Panel) diff --git a/source/windows/QueueController.cpp b/source/windows/QueueController.cpp index ad7e0693d..7862189e5 100644 --- a/source/windows/QueueController.cpp +++ b/source/windows/QueueController.cpp @@ -281,9 +281,14 @@ static UnicodeString GetTime(TFileOperationProgressType * ProgressData) return Result; } //--------------------------------------------------------------------------- -static UnicodeString GetOverallProgress(TFileOperationProgressType * ProgressData) +static UnicodeString FormatProgress(int Progress) { - return FORMAT(L"%d%%", (ProgressData->OverallProgress())); + return FORMAT(L"%d%%", (Progress)); +} +//--------------------------------------------------------------------------- +static UnicodeString FormatOverallProgress(TFileOperationProgressType * ProgressData) +{ + return FormatProgress(ProgressData->OverallProgress()); } //--------------------------------------------------------------------------- void __fastcall TQueueController::FillQueueViewItem(TListItem * Item, @@ -356,7 +361,7 @@ void __fastcall TQueueController::FillQueueViewItem(TListItem * Item, { if (ProgressData->Count > 1) { - ProgressStr = GetOverallProgress(ProgressData); + ProgressStr = FormatOverallProgress(ProgressData); } else { @@ -414,13 +419,15 @@ void __fastcall TQueueController::FillQueueViewItem(TListItem * Item, { if (QueueItem->Status != TQueueItem::qsDone) { - Values[3] = GetTime(ProgressData); - Values[4] = FORMAT(L"%s/s", (FormatBytes(ProgressData->CPS()))); + UnicodeString Time = GetTime(ProgressData); + unsigned int CPS = ProgressData->CPS(); + Values[3] = Time; + Values[4] = FORMAT(L"%s/s", (FormatBytes(CPS))); } if (ProgressStr.IsEmpty()) { - ProgressStr = GetOverallProgress(ProgressData); + ProgressStr = FormatOverallProgress(ProgressData); } } else if (ProgressData->Operation == foCalculateSize) @@ -434,23 +441,26 @@ void __fastcall TQueueController::FillQueueViewItem(TListItem * Item, { if (ProgressData != NULL) { + UnicodeString FileName; if ((Info->Side == osRemote) || !ProgressData->Temp) { - Values[0] = ProgressData->FileName; + FileName = ProgressData->FileName; } else { - Values[0] = ExtractFileName(ProgressData->FileName); + FileName = ExtractFileName(ProgressData->FileName); } + Values[0] = FileName; if (ProgressData->Operation == Info->Operation) { - Values[2] = - FormatPanelBytes(ProgressData->TransferredSize, WinConfiguration->FormatSizeBytes); + __int64 TransferredSize = ProgressData->TransferredSize; + Values[2] = FormatPanelBytes(TransferredSize, WinConfiguration->FormatSizeBytes); if (ProgressStr.IsEmpty()) { - ProgressStr = FORMAT(L"%d%%", (ProgressData->TransferProgress())); + int Progress = ProgressData->TransferProgress(); + ProgressStr = FormatProgress(Progress); } } }