Files
PowerToys/src/modules/previewpane/powerpreview/powerpreview.h
Andrey Nekrasov 212ea2de30 common: refactor common library pt2 (#8588)
- remove common lib
- split settings, remove common-md
- move ipc interop/kb_layout to interop
- rename core -> settings, settings -> old_settings
- os-detect header-only; interop -> PowerToysInterop
- split notifications, move single-use headers where they're used
- winstore lib
- rename com utils
- rename Updating and Telemetry projects
- rename core -> settings-ui and remove examples folder
- rename settings-ui folder + consisent common/version include
2020-12-15 15:16:09 +03:00

52 lines
1.8 KiB
C++

#include "pch.h"
#include <interface/powertoy_module_interface.h>
#include "trace.h"
#include "settings.h"
#include "thumbnail_provider.h"
#include "preview_handler.h"
#include "registry_wrapper.h"
#include <powerpreview/powerpreviewConstants.h>
#include <functional>
using namespace PowerPreviewSettings;
// Implement the PowerToy Module Interface and all the required methods.
class PowerPreviewModule : public PowertoyModuleIface
{
private:
// The PowerToy state.
bool m_enabled = false;
std::wstring m_moduleName;
//contains the non localized key of the powertoy
std::wstring app_key;
std::vector<std::unique_ptr<FileExplorerPreviewSettings>> m_fileExplorerModules;
// Function to check if the registry states need to be updated
bool is_registry_update_required();
// Function to warn the user that PowerToys needs to run as administrator for changes to take effect
void show_update_warning_message();
// Function that checks if a registry method is required and if so checks if the process is elevated and accordingly executes the method or shows a warning
void registry_and_elevation_check_wrapper(std::function<void()> method);
// Function that checks if the process is elevated and accordingly executes the method or shows a warning
void elevation_check_wrapper(std::function<void()> method);
// Function that updates the registry state to match the toggle states
void update_registry_to_match_toggles();
public:
PowerPreviewModule();
virtual void destroy();
virtual const wchar_t* get_name();
virtual const wchar_t* get_key();
virtual bool get_config(_Out_ wchar_t* buffer, _Out_ int* buffer_size);
virtual void set_config(const wchar_t* config);
virtual void enable();
virtual void disable();
virtual bool is_enabled();
virtual void init_settings();
};