Skip to content

Commit 769f13c

Browse files
committed
Add Output Pane for Logs and Messages (#2663) (2)
1 parent 38c3e24 commit 769f13c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1230
-13
lines changed

Src/DirView.cpp

Lines changed: 49 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,17 +1031,56 @@ void CDirView::ConfirmAndPerformActions(FileActionScript & actionList)
10311031
* @brief Perform an array of actions
10321032
* @note There can be only COPY or DELETE actions, not both!
10331033
*/
1034-
void CDirView::PerformActionList(FileActionScript & actionScript)
1034+
void CDirView::PerformActionList(FileActionScript& actionScript)
10351035
{
10361036
// Check option and enable putting deleted items to Recycle Bin
1037-
if (GetOptionsMgr()->GetBool(OPT_USE_RECYCLE_BIN))
1038-
actionScript.UseRecycleBin(true);
1039-
else
1040-
actionScript.UseRecycleBin(false);
1037+
actionScript.UseRecycleBin(GetOptionsMgr()->GetBool(OPT_USE_RECYCLE_BIN));
10411038

10421039
actionScript.SetParentWindow(GetMainFrame()->GetSafeHwnd());
10431040

10441041
theApp.AddOperation();
1042+
1043+
String src, dst, op;
1044+
const int itemCount = actionScript.GetActionItemCount();
1045+
if (itemCount >= 1)
1046+
{
1047+
FileActionItem item = actionScript.GetHeadActionItem();
1048+
if (itemCount == 1)
1049+
{
1050+
src = item.src;
1051+
dst = item.dest;
1052+
}
1053+
else
1054+
{
1055+
const CDiffContext& ctxt = GetDiffContext();
1056+
src = ctxt.GetPath(item.UIOrigin);
1057+
if (item.atype == FileActionItem::ACT_DEL)
1058+
{
1059+
dst = actionScript.UseRecycleBin() ? _("Recycle Bin") : _("Permanently deleted");
1060+
}
1061+
else
1062+
{
1063+
if (item.UIResult != FileActionItem::UI_DONT_CARE)
1064+
dst = ctxt.GetPath(item.UIDestination);
1065+
else
1066+
dst = (!actionScript.m_destBase.empty()) ? actionScript.m_destBase : item.dest;
1067+
}
1068+
}
1069+
if (item.atype == FileActionItem::ACT_COPY)
1070+
op = _("Copying files...");
1071+
else if (item.atype == FileActionItem::ACT_MOVE)
1072+
op = _("Moving files...");
1073+
else if (item.atype == FileActionItem::ACT_DEL)
1074+
op = _("Deleting files...");
1075+
else
1076+
ASSERT(FALSE);
1077+
String msg = op + _T(" (") + src;
1078+
if (itemCount > 1)
1079+
msg += _T(", ") + strutils::format_string1(_("Items: %1"), strutils::to_str(itemCount));
1080+
msg += + _T(" -> ") + dst + _T(")");
1081+
RootLogger::Info(msg);
1082+
}
1083+
10451084
bool succeeded = actionScript.Run();
10461085
if (succeeded)
10471086
UpdateAfterFileScript(actionScript);
@@ -1050,6 +1089,11 @@ void CDirView::PerformActionList(FileActionScript & actionScript)
10501089
throw FileOperationException(_T("File operation failed"));
10511090
m_firstDiffItem.reset();
10521091
m_lastDiffItem.reset();
1092+
1093+
if (succeeded)
1094+
RootLogger::Info(_("File operation completed successfully"));
1095+
if (actionScript.IsCanceled())
1096+
RootLogger::Info(_("File operation canceled"));
10531097
}
10541098

10551099
/**

Src/FileActionScript.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ class FileActionScript
9898

9999
void SetParentWindow(HWND hWnd);
100100
void UseRecycleBin(bool bUseRecycleBin);
101+
bool UseRecycleBin();
101102
bool Run();
102103

103104
// Manipulate the FileActionList
@@ -159,6 +160,15 @@ inline void FileActionScript::UseRecycleBin(bool bUseRecycleBin)
159160
m_bUseRecycleBin = bUseRecycleBin;
160161
}
161162

163+
/**
164+
* @brief Does user want to move deleted files to Recycle Bin?
165+
* @return If `true` deleted files are moved to Recycle Bin.
166+
*/
167+
inline bool FileActionScript::UseRecycleBin()
168+
{
169+
return m_bUseRecycleBin;
170+
}
171+
162172
/**
163173
* @brief Return amount of actions (copy, move, etc) in script.
164174
* @return Amount of actions.

Src/Merge.rc

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4639,10 +4639,19 @@ END
46394639

46404640
STRINGTABLE
46414641
BEGIN
4642-
IDS_LOG_COMPARE_2 "Comparing %1 with %2"
4643-
IDS_LOG_COMPARE_3 "Comparing %1 with %2 and %3"
4644-
IDS_LOG_COMPARE_RESULT "Comparison completed"
4642+
IDS_LOG_COMPARING_2 "Comparing %1 with %2"
4643+
IDS_LOG_COMPARING_3 "Comparing %1 with %2 and %3"
4644+
IDS_LOG_COMPARE_COMPLETED "Comparison completed"
4645+
IDS_LOG_COMPARE_ERROR_2 "Failed to compare %1 with %2: "
4646+
IDS_LOG_COMPARE_ERROR_3 "Failed to compare %1 with %2 and %3: "
46454647
IDS_LOG_FILE_SAVED "File saved"
4648+
IDS_LOG_COPYING_FILES "Copying files..."
4649+
IDS_LOG_MOVING_FILES "Moving files..."
4650+
IDS_LOG_DELETING_FILES "Deleting files..."
4651+
IDS_LOG_RECYCLEBIN "Recycle Bin"
4652+
IDS_LOG_PERMANENTLY_DELETED "Permanently deleted"
4653+
IDS_LOG_FILEOPERATION_COMPLETED "File operation completed successfully"
4654+
IDS_LOG_FILEOPERATION_CANCELED "File operation canceled"
46464655
END
46474656

46484657
#endif // English (United States) resources

Src/TrDialogs.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,18 @@ BOOL CTrPropertyPage::OnInitDialog()
5353
return TRUE;
5454
}
5555

56+
void CTrPropertyPage::OnOK()
57+
{
58+
RootLogger::Info(GetTitleText() + _T(": ") + _("OK"));
59+
__super::OnOK();
60+
}
61+
62+
void CTrPropertyPage::OnCancel()
63+
{
64+
RootLogger::Info(GetTitleText() + _T(": ") + _("Cancel"));
65+
__super::OnCancel();
66+
}
67+
5668
BOOL CTrDialogBar::Create(CWnd* pParentWnd, LPCTSTR lpszTemplateName,
5769
UINT nStyle, UINT nID)
5870
{

Src/TrDialogs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ class CTrPropertyPage : public CPropertyPage, public DlgUtils<CTrPropertyPage>
112112
using CPropertyPage::CPropertyPage;
113113

114114
virtual BOOL OnInitDialog();
115+
virtual void OnOK();
116+
virtual void OnCancel();
115117
};
116118

117119
class CTrDialogBar : public CDialogBar, public DlgUtils<CTrDialogBar>

Src/resource.h

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1806,10 +1806,19 @@
18061806
#define IDS_COPY_GRANULARITY_Character 44644
18071807
#define IDS_VIEW_MENU_BAR 44645
18081808
#define IDS_COPY_ONLYDIFFITEMS 44646
1809-
#define IDS_LOG_COMPARE_2 44650
1810-
#define IDS_LOG_COMPARE_3 44651
1811-
#define IDS_LOG_COMPARE_RESULT 44652
1812-
#define IDS_LOG_FILE_SAVED 44653
1809+
#define IDS_LOG_COMPARING_2 44650
1810+
#define IDS_LOG_COMPARING_3 44651
1811+
#define IDS_LOG_COMPARE_COMPLETED 44652
1812+
#define IDS_LOG_COMPARE_ERROR_2 44653
1813+
#define IDS_LOG_COMPARE_ERROR_3 44654
1814+
#define IDS_LOG_FILE_SAVED 44655
1815+
#define IDS_LOG_COPYING_FILES 44656
1816+
#define IDS_LOG_MOVING_FILES 44657
1817+
#define IDS_LOG_DELETING_FILES 44658
1818+
#define IDS_LOG_RECYCLEBIN 44659
1819+
#define IDS_LOG_PERMANENTLY_DELETED 44660
1820+
#define IDS_LOG_FILEOPERATION_COMPLETED 44661
1821+
#define IDS_LOG_FILEOPERATION_CANCELED 44662
18131822

18141823
// Next default values for new objects
18151824
//

Translations/WinMerge/Arabic.po

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4320,9 +4320,38 @@ msgstr ""
43204320
msgid "Comparison completed"
43214321
msgstr ""
43224322

4323+
#, c-format
4324+
msgid "Failed to compare %1 with %2: "
4325+
msgstr ""
4326+
4327+
#, c-format
4328+
msgid "Failed to compare %1 with %2 and %3: "
4329+
msgstr ""
4330+
43234331
msgid "File saved"
43244332
msgstr ""
43254333

4334+
msgid "Copying files..."
4335+
msgstr ""
4336+
4337+
msgid "Moving files..."
4338+
msgstr ""
4339+
4340+
msgid "Deleting files..."
4341+
msgstr ""
4342+
4343+
msgid "Recycle Bin"
4344+
msgstr ""
4345+
4346+
msgid "Permanently deleted"
4347+
msgstr ""
4348+
4349+
msgid "File operation completed successfully"
4350+
msgstr ""
4351+
4352+
msgid "File operation canceled"
4353+
msgstr ""
4354+
43264355
msgid "Prettification"
43274356
msgstr ""
43284357

Translations/WinMerge/Basque.po

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4935,9 +4935,38 @@ msgstr ""
49354935
msgid "Comparison completed"
49364936
msgstr ""
49374937

4938+
#, c-format
4939+
msgid "Failed to compare %1 with %2: "
4940+
msgstr ""
4941+
4942+
#, c-format
4943+
msgid "Failed to compare %1 with %2 and %3: "
4944+
msgstr ""
4945+
49384946
msgid "File saved"
49394947
msgstr ""
49404948

4949+
msgid "Copying files..."
4950+
msgstr ""
4951+
4952+
msgid "Moving files..."
4953+
msgstr ""
4954+
4955+
msgid "Deleting files..."
4956+
msgstr ""
4957+
4958+
msgid "Recycle Bin"
4959+
msgstr ""
4960+
4961+
msgid "Permanently deleted"
4962+
msgstr ""
4963+
4964+
msgid "File operation completed successfully"
4965+
msgstr ""
4966+
4967+
msgid "File operation canceled"
4968+
msgstr ""
4969+
49414970
msgid "Prettification"
49424971
msgstr ""
49434972

Translations/WinMerge/Brazilian.po

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4038,9 +4038,38 @@ msgstr "Comparando %1 com %2 e %3"
40384038
msgid "Comparison completed"
40394039
msgstr "Comparação finalizada"
40404040

4041+
#, c-format
4042+
msgid "Failed to compare %1 with %2: "
4043+
msgstr ""
4044+
4045+
#, c-format
4046+
msgid "Failed to compare %1 with %2 and %3: "
4047+
msgstr ""
4048+
40414049
msgid "File saved"
40424050
msgstr "Arquivo salvo"
40434051

4052+
msgid "Copying files..."
4053+
msgstr ""
4054+
4055+
msgid "Moving files..."
4056+
msgstr ""
4057+
4058+
msgid "Deleting files..."
4059+
msgstr ""
4060+
4061+
msgid "Recycle Bin"
4062+
msgstr ""
4063+
4064+
msgid "Permanently deleted"
4065+
msgstr ""
4066+
4067+
msgid "File operation completed successfully"
4068+
msgstr ""
4069+
4070+
msgid "File operation canceled"
4071+
msgstr ""
4072+
40444073
msgid "Prettification"
40454074
msgstr "Embelezamento"
40464075

Translations/WinMerge/Bulgarian.po

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4368,9 +4368,38 @@ msgstr ""
43684368
msgid "Comparison completed"
43694369
msgstr ""
43704370

4371+
#, c-format
4372+
msgid "Failed to compare %1 with %2: "
4373+
msgstr ""
4374+
4375+
#, c-format
4376+
msgid "Failed to compare %1 with %2 and %3: "
4377+
msgstr ""
4378+
43714379
msgid "File saved"
43724380
msgstr ""
43734381

4382+
msgid "Copying files..."
4383+
msgstr ""
4384+
4385+
msgid "Moving files..."
4386+
msgstr ""
4387+
4388+
msgid "Deleting files..."
4389+
msgstr ""
4390+
4391+
msgid "Recycle Bin"
4392+
msgstr ""
4393+
4394+
msgid "Permanently deleted"
4395+
msgstr ""
4396+
4397+
msgid "File operation completed successfully"
4398+
msgstr ""
4399+
4400+
msgid "File operation canceled"
4401+
msgstr ""
4402+
43744403
msgid "Prettification"
43754404
msgstr ""
43764405

Translations/WinMerge/Catalan.po

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5090,9 +5090,38 @@ msgstr ""
50905090
msgid "Comparison completed"
50915091
msgstr ""
50925092

5093+
#, c-format
5094+
msgid "Failed to compare %1 with %2: "
5095+
msgstr ""
5096+
5097+
#, c-format
5098+
msgid "Failed to compare %1 with %2 and %3: "
5099+
msgstr ""
5100+
50935101
msgid "File saved"
50945102
msgstr ""
50955103

5104+
msgid "Copying files..."
5105+
msgstr ""
5106+
5107+
msgid "Moving files..."
5108+
msgstr ""
5109+
5110+
msgid "Deleting files..."
5111+
msgstr ""
5112+
5113+
msgid "Recycle Bin"
5114+
msgstr ""
5115+
5116+
msgid "Permanently deleted"
5117+
msgstr ""
5118+
5119+
msgid "File operation completed successfully"
5120+
msgstr ""
5121+
5122+
msgid "File operation canceled"
5123+
msgstr ""
5124+
50965125
msgid "Prettification"
50975126
msgstr "Embellir"
50985127

0 commit comments

Comments
 (0)