11#include " Include/ClearButton.hpp"
22#include " ../Utils/Include/Config.hpp"
3- #include " ../Listener/Include/ListenerClearCache.hpp"
43#include " ../Core/Include/CoreClearCache.hpp"
54#include " Include/TableView.hpp"
65#include " ../Utils/Include/Utils.hpp"
76
87using ZClipboard::Lib_Memory::PtrUnique;
98using ZClipboard::GUI ::ClearButton;
10- using ZClipboard::Listener::ListenerCacheImpl ;
9+ using ZClipboard::Core::CoreClearBuilderData ;
1110using ZClipboard::AppUtils::Utils;
1211
1312#if defined (Z_DEBUG)
@@ -25,8 +24,6 @@ void ClearButton::SetupClearButton(ComponentsManager *toolkit, TableView *tableV
2524}
2625
2726void ClearButton::SetupEventListener (QPushButton *clearButton, TableView *tableView) {
28- using Impl = ListenerCacheImpl;
29-
3027 #if defined (Z_DEBUG)
3128
3229 AssertContext{}.RequireNonNullPtr (clearButton);
@@ -35,15 +32,16 @@ void ClearButton::SetupEventListener(QPushButton *clearButton, TableView *tableV
3532
3633 #endif
3734
38- const auto Function = BuilderFunc
39- . StartBuild ()
40- -> WithAndThen (&Impl::button, clearButton)
41- -> WithAndThen (&Impl::settings, settings.get ())
42- -> WithAndThen (&Impl::table, tableView)
43- -> WhenDone ()
44- -> TryGetListener ();
35+ if (!BuilderCore) {
36+ Utils::MakeSmartPtr<CoreClearBuilder>(BuilderCore);
37+ }
4538
39+ using ImplData = CoreClearBuilderData;
4640 BuilderCore
47- . StartBuild (clearButton)
48- -> ThenAddListener (Function);
41+ -> StartBuild ()
42+ -> WithAndThen (&ImplData::button, clearButton)
43+ -> WithAndThen (&ImplData::settings, settings.get ())
44+ -> WithAndThen (&ImplData::tableView, tableView)
45+ -> WhenDone ()
46+ -> Finally_Setup_Listener ();
4947}
0 commit comments