mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Implements resetting default settings on startup. Fixes https://gitlab.com/kicad/code/kicad/-/issues/7273
64 lines
2.0 KiB
C++
64 lines
2.0 KiB
C++
/*
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
*
|
|
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License as published by the
|
|
* Free Software Foundation, either version 3 of the License, or (at your
|
|
* option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef STARTUP_KEY_HANDLER_H
|
|
#define STARTUP_KEY_HANDLER_H
|
|
|
|
#include <kicommon.h>
|
|
#include <map>
|
|
#include <vector>
|
|
#include <wx/wx.h>
|
|
|
|
|
|
// A class to handle key press detection and execute multiple actions at startup
|
|
class KICOMMON_API StartupKeyHandler
|
|
{
|
|
public:
|
|
// Enum to define actions for key presses
|
|
enum class KEY_ACTION
|
|
{
|
|
RESET_TO_FACTORY_DEFAULTS
|
|
};
|
|
|
|
// Constructor to initialize key-action mappings
|
|
StartupKeyHandler();
|
|
|
|
~StartupKeyHandler();
|
|
|
|
// Function to handle the startup key check
|
|
void CheckStartupKeys();
|
|
|
|
private:
|
|
// Function to check if a ctrl key is pressed
|
|
static bool isKeyActionRequested( wxKeyCode aKeyCode );
|
|
|
|
// Function to perform actions if ctrl key pressed
|
|
void performKeyActions( const std::vector<KEY_ACTION>& aActions );
|
|
|
|
// Resets all user-configurable settings to their original factory default values.
|
|
// This operation will erase any customized settings or preferences.
|
|
void resetToFactoryDefaults();
|
|
|
|
private:
|
|
// A map to store the combination of keys and their corresponding list of actions
|
|
std::map<std::vector<wxKeyCode>, std::vector<KEY_ACTION>> m_keyActions;
|
|
};
|
|
|
|
#endif // STARTUP_KEY_HANDLER_H
|