Files
PowerToys/src/modules/fancyzones/FancyZonesLib/FancyZonesData/DefaultLayouts.h
sosssego e42bbaaaf7 [Analyzers][CPP] Turn on warning 4702 (#22285)
* Turn on 4702
unreachable code

* fix warnings that didnt show locally

* add comments about disable warnings

* improve comments

* changes from comments

* fix from PR comments
2022-12-12 17:21:48 +00:00

58 lines
1.7 KiB
C++

#pragma once
#include <FancyZonesLib/FancyZonesData/LayoutData.h>
#include <FancyZonesLib/ModuleConstants.h>
#include <common/SettingsAPI/FileWatcher.h>
#include <common/SettingsAPI/settings_helpers.h>
namespace NonLocalizable
{
namespace DefaultLayoutsIds
{
const static wchar_t* DefaultLayoutsArrayID = L"default-layouts";
const static wchar_t* MonitorConfigurationTypeID = L"monitor-configuration";
const static wchar_t* LayoutID = L"layout";
const static wchar_t* UuidID = L"uuid";
const static wchar_t* TypeID = L"type";
const static wchar_t* ShowSpacingID = L"show-spacing";
const static wchar_t* SpacingID = L"spacing";
const static wchar_t* ZoneCountID = L"zone-count";
const static wchar_t* SensitivityRadiusID = L"sensitivity-radius";
}
}
enum class MonitorConfigurationType
{
Horizontal = 0,
Vertical
};
class DefaultLayouts
{
public:
using TDefaultLayoutsContainer = std::map<MonitorConfigurationType, LayoutData>;
static DefaultLayouts& instance();
inline static std::wstring DefaultLayoutsFileName()
{
std::wstring saveFolderPath = PTSettingsHelper::get_module_save_folder_location(NonLocalizable::ModuleKey);
#if defined(UNIT_TESTS)
return saveFolderPath + L"\\test-default-layouts.json";
#else
return saveFolderPath + L"\\default-layouts.json";
#endif
}
void LoadData();
LayoutData GetDefaultLayout(MonitorConfigurationType type = MonitorConfigurationType::Horizontal) const noexcept;
private:
DefaultLayouts();
~DefaultLayouts() = default;
TDefaultLayoutsContainer m_layouts;
std::unique_ptr<FileWatcher> m_fileWatcher;
};