Fix typos
[TortoiseGit.git] / src / TortoiseProc / Settings / Settings.h
blobe2300257e113ac14c8cc02543128911a260d6e4f
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2013, 2016, 2020, 2023 - TortoiseGit
4 // Copyright (C) 2003-2011 - TortoiseSVN
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #pragma once
22 #include "StandAloneDlg.h"
23 #include "TreePropSheet/TreePropSheet.h"
24 #include "TGitPath.h"
25 #include "SettingsPropPage.h"
26 #include "SettingGitRemote.h"
28 using namespace TreePropSheet;
30 class CSettingsPage
32 public:
33 CSettingsPage(ISettingsPropPage* page, CString pageName)
34 : pageName(pageName)
35 , page(page)
38 ~CSettingsPage()
40 delete page;
42 CSettingsPage(const CSettingsPage&) = delete;
43 CSettingsPage(CSettingsPage&& t) noexcept
45 this->pageName = t.pageName;
46 this->page = t.page;
47 t.page = nullptr;
50 public:
51 ISettingsPropPage* page = nullptr;
52 CString pageName;
55 /**
56 * \ingroup TortoiseProc
57 * This is the container for all settings pages. A setting page is
58 * a class derived from CPropertyPage with an additional method called
59 * SaveData(). The SaveData() method is used by the dialog to save
60 * the settings the user has made - if that method is not called then
61 * it means that the changes are discarded! Each settings page has
62 * to make sure that no changes are saved outside that method.
64 class CSettings : public CTreePropSheet
66 DECLARE_DYNAMIC(CSettings)
68 private:
69 /**
70 * Adds all pages to this Settings-Dialog.
72 void AddPropPages();
73 /**
74 * Removes the pages and frees up memory.
76 void RemovePropPages();
78 ISettingsPropPage* AddPropPage(ISettingsPropPage* page, CString pageName);
79 void AddPropPage(ISettingsPropPage* page, CString pageName, CPropertyPage* parentPage);
81 private:
82 std::vector<CSettingsPage> m_pPages;
83 ISettingsPropPage* m_pGitConfig = nullptr;
84 CSettingGitRemote* m_pGitRemote = nullptr;
86 public:
87 CSettings(UINT nIDCaption, CTGitPath* CmdPath = nullptr, CWnd* pParentWnd = nullptr, UINT iSelectPage = 0);
88 virtual ~CSettings();
89 CString m_DefaultPage;
90 /**
91 * Calls the SaveData()-methods of each of the settings pages.
93 void HandleRestart();
95 void SetTheme(bool bDark);
97 protected:
98 DECLARE_MESSAGE_MAP()
99 BOOL OnInitDialog() override;