|
1 | 1 | #include "Include/SettingButton.hpp" |
2 | 2 | #include "../Language/Include/Translate.hpp" |
3 | | -#include "../Utils/Include/Settings.hpp" |
4 | | -#include "../Utils/Include/Config.hpp" |
5 | | -#include "../Utils/Include/Utils.hpp" |
6 | | -#include "../Language/Include/Language.hpp" |
7 | 3 | #include "Include/Window.hpp" |
8 | 4 | #include <QStringLiteral> |
9 | 5 | #include <QSettings> |
10 | 6 | #include <QIcon> |
11 | | -#include "../Core/Include/CoreSetting.hpp" |
12 | 7 |
|
13 | | -using ZClipboard::Core::SettingCore; |
14 | | -using ZClipboard::Core::SettingCoreParams; |
15 | | -using ZClipboard::Language::Translate; |
| 8 | +using ZClipboard::Core::CoreSettingWindowData; |
16 | 9 | using ZClipboard::Language::TransValue; |
17 | 10 | using ZClipboard::GUI::SettingButton; |
18 | 11 | using ZClipboard::AppUtils::Utils; |
19 | 12 |
|
20 | | -void SettingButton::SetupSettingButton(QMainWindow *window, Toolkit *toolkit) { |
21 | | - auto settingButton = toolkit->GetSettingButton(); |
22 | | - settingCore = new SettingCore(); |
| 13 | +#if defined (Z_DEBUG) |
| 14 | + #include "../Utils/Include/AssertNullPtr.hpp" |
| 15 | +#endif |
23 | 16 |
|
24 | | - const auto function = [this, window]() { |
| 17 | +void SettingButton::SetupSettingButton( |
| 18 | + QMainWindow *window, MainWindowComponents *mainWindowComponents) { |
| 19 | + |
| 20 | + auto settingButton = mainWindowComponents->GetSettingButton(); |
| 21 | + |
| 22 | + Utils::MakeSmartPtr<CoreSettingWindow>(coreSettingWindow); |
| 23 | + Utils::MakeSmartPtr<QDialog>(dialog); |
| 24 | + Utils::MakeSmartPtr<QGridLayout>(layout, dialog.get()); |
| 25 | + |
| 26 | + // settingCore = new SettingCore(); |
| 27 | + |
| 28 | + const auto function = [this, settingButton, window]() { |
25 | 29 | // window->hide(); |
26 | 30 | // showSettingDialog(window); |
| 31 | + |
| 32 | + #if defined (Z_DEBUG) |
| 33 | + using Assert = AssertContext; |
| 34 | + |
| 35 | + Assert{}.RequireNonNullPtr(settingButton); |
| 36 | + Assert{}.RequireNonNullPtr(layout.get()); |
| 37 | + Assert{}.RequireNonNullPtr(window); |
| 38 | + |
| 39 | + #endif |
| 40 | + |
| 41 | + using DataImpl = CoreSettingWindowData; |
| 42 | + coreSettingWindow |
| 43 | + -> StartBuild() |
| 44 | + -> WithAndThen(&DataImpl::settingButton, settingButton) |
| 45 | + -> WithAndThen(&DataImpl::layout, layout.get()) |
| 46 | + -> WithAndThen(&DataImpl::mainWindow, window) |
| 47 | + -> Finally_Add_Listener(); |
| 48 | + |
| 49 | + dialog->exec(); |
| 50 | + |
27 | 51 | }; |
28 | 52 | connect(settingButton, &QPushButton::clicked, this, function); |
29 | 53 |
|
|
0 commit comments