mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-18 06:29:44 +08:00
Merge branch 'master' of https://github.com/microsoft/Launcher into windowsIndexerPlugin
This commit is contained in:
commit
1842c9ed3b
@ -26,17 +26,6 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReser
|
||||
|
||||
// These are the properties shown in the Settings page.
|
||||
struct ModuleSettings {
|
||||
// Add the PowerToy module properties with default values.
|
||||
// Currently available types:
|
||||
// - int
|
||||
// - bool
|
||||
// - string
|
||||
|
||||
//bool bool_prop = true;
|
||||
//int int_prop = 10;
|
||||
//std::wstring string_prop = L"The quick brown fox jumps over the lazy dog";
|
||||
//std::wstring color_prop = L"#1212FF";
|
||||
|
||||
} g_settings;
|
||||
|
||||
// Implement the PowerToy Module Interface and all the required methods.
|
||||
@ -94,53 +83,6 @@ public:
|
||||
// Create a Settings object.
|
||||
PowerToysSettings::Settings settings(hinstance, get_name());
|
||||
settings.set_description(GET_RESOURCE_STRING(IDS_LAUNCHER_SETTINGS_DESC));
|
||||
|
||||
// Show an overview link in the Settings page
|
||||
//settings.set_overview_link(L"https://");
|
||||
|
||||
// Show a video link in the Settings page.
|
||||
//settings.set_video_link(L"https://");
|
||||
|
||||
// A bool property with a toggle editor.
|
||||
/*settings.add_bool_toogle(
|
||||
L"bool_toggle_1", // property name.
|
||||
L"This is what a BoolToggle property looks like", // description or resource id of the localized string.
|
||||
g_settings.bool_prop // property value.
|
||||
);*/
|
||||
|
||||
// An integer property with a spinner editor.
|
||||
/*settings.add_int_spinner(
|
||||
L"int_spinner_1", // property name
|
||||
L"This is what a IntSpinner property looks like", // description or resource id of the localized string.
|
||||
g_settings.int_prop, // property value.
|
||||
0, // min value.
|
||||
100, // max value.
|
||||
10 // incremental step.
|
||||
);*/
|
||||
|
||||
// A string property with a textbox editor.
|
||||
/*settings.add_string(
|
||||
L"string_text_1", // property name.
|
||||
L"This is what a String property looks like", // description or resource id of the localized string.
|
||||
g_settings.string_prop // property value.
|
||||
);*/
|
||||
|
||||
// A string property with a color picker editor.
|
||||
/*settings.add_color_picker(
|
||||
L"color_picker_1", // property name.
|
||||
L"This is what a ColorPicker property looks like", // description or resource id of the localized string.
|
||||
g_settings.color_prop // property value.
|
||||
);*/
|
||||
|
||||
// A custom action property. When using this settings type, the "PowertoyModuleIface::call_custom_action()"
|
||||
// method should be overriden as well.
|
||||
/*settings.add_custom_action(
|
||||
L"custom_action_id", // action name.
|
||||
L"This is what a CustomAction property looks like", // label above the field.
|
||||
L"Call a custom action", // button text.
|
||||
L"Press the button to call a custom action." // display values / extended info.
|
||||
);*/
|
||||
|
||||
return settings.serialize_to_buffer(buffer, buffer_size);
|
||||
}
|
||||
|
||||
@ -152,12 +94,6 @@ public:
|
||||
// Parse the action values, including name.
|
||||
PowerToysSettings::CustomActionObject action_object =
|
||||
PowerToysSettings::CustomActionObject::from_json_string(action);
|
||||
|
||||
/*
|
||||
if (action_object.get_name() == L"custom_action_id") {
|
||||
// Execute your custom action
|
||||
}
|
||||
*/
|
||||
}
|
||||
catch (std::exception ex) {
|
||||
// Improper JSON.
|
||||
@ -171,34 +107,6 @@ public:
|
||||
PowerToysSettings::PowerToyValues values =
|
||||
PowerToysSettings::PowerToyValues::from_json_string(config);
|
||||
|
||||
// Update a bool property.
|
||||
/*
|
||||
if (values.is_bool_value(L"bool_toggle_1")) {
|
||||
g_settings.bool_prop = values.get_bool_value(L"bool_toggle_1");
|
||||
}
|
||||
*/
|
||||
|
||||
// Update an int property.
|
||||
/*
|
||||
if (values.is_int_value(L"int_spinner_1")) {
|
||||
g_settings.int_prop = values.get_int_value(L"int_spinner_1");
|
||||
}
|
||||
*/
|
||||
|
||||
// Update a string property.
|
||||
/*
|
||||
if (values.is_string_value(L"string_text_1")) {
|
||||
g_settings.string_prop = values.get_string_value(L"string_text_1");
|
||||
}
|
||||
*/
|
||||
|
||||
// Update a color property.
|
||||
/*
|
||||
if (values.is_string_value(L"color_picker_1")) {
|
||||
g_settings.color_prop = values.get_string_value(L"color_picker_1");
|
||||
}
|
||||
*/
|
||||
|
||||
// If you don't need to do any custom processing of the settings, proceed
|
||||
// to persists the values calling:
|
||||
values.save_to_settings_file();
|
||||
@ -269,79 +177,12 @@ void Wox_Launcher::init_settings() {
|
||||
PowerToysSettings::PowerToyValues settings =
|
||||
PowerToysSettings::PowerToyValues::load_from_settings_file(get_name());
|
||||
|
||||
// Load a bool property.
|
||||
/*
|
||||
if (settings.is_bool_value(L"bool_toggle_1")) {
|
||||
g_settings.bool_prop = settings.get_bool_value(L"bool_toggle_1");
|
||||
}
|
||||
*/
|
||||
|
||||
// Load an int property.
|
||||
/*
|
||||
if (settings.is_int_value(L"int_spinner_1")) {
|
||||
g_settings.int_prop = settings.get_int_value(L"int_spinner_1");
|
||||
}
|
||||
*/
|
||||
|
||||
// Load a string property.
|
||||
/*
|
||||
if (settings.is_string_value(L"string_text_1")) {
|
||||
g_settings.string_prop = settings.get_string_value(L"string_text_1");
|
||||
}
|
||||
*/
|
||||
|
||||
// Load a color property.
|
||||
/*
|
||||
if (settings.is_string_value(L"color_picker_1")) {
|
||||
g_settings.color_prop = settings.get_string_value(L"color_picker_1");
|
||||
}
|
||||
*/
|
||||
}
|
||||
catch (std::exception ex) {
|
||||
// Error while loading from the settings file. Let default values stay as they are.
|
||||
}
|
||||
}
|
||||
|
||||
// This method of saving the module settings is only required if you need to do any
|
||||
// custom processing of the settings before saving them to disk.
|
||||
/*
|
||||
void Wox.Launcher::save_settings() {
|
||||
try {
|
||||
// Create a PowerToyValues object for this PowerToy
|
||||
PowerToysSettings::PowerToyValues values(get_name());
|
||||
|
||||
// Save a bool property.
|
||||
//values.add_property(
|
||||
// L"bool_toggle_1", // property name
|
||||
// g_settings.bool_prop // property value
|
||||
//);
|
||||
|
||||
// Save an int property.
|
||||
//values.add_property(
|
||||
// L"int_spinner_1", // property name
|
||||
// g_settings.int_prop // property value
|
||||
//);
|
||||
|
||||
// Save a string property.
|
||||
//values.add_property(
|
||||
// L"string_text_1", // property name
|
||||
// g_settings.string_prop // property value
|
||||
);
|
||||
|
||||
// Save a color property.
|
||||
//values.add_property(
|
||||
// L"color_picker_1", // property name
|
||||
// g_settings.color_prop // property value
|
||||
//);
|
||||
|
||||
// Save the PowerToyValues JSON to the power toy settings file.
|
||||
values.save_to_settings_file();
|
||||
}
|
||||
catch (std::exception ex) {
|
||||
// Couldn't save the settings.
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
extern "C" __declspec(dllexport) PowertoyModuleIface* __cdecl powertoy_create() {
|
||||
return new Wox_Launcher();
|
||||
|
Loading…
Reference in New Issue
Block a user