LMMS
Loading...
Searching...
No Matches
KeyboardShortcuts.h
Go to the documentation of this file.
1/*
2 * KeyboardShortcuts.h - Cross-platform handling of keyboard modifier keys
3 *
4 * Copyright (c) 2025 Michael Gregorius
5 * Copyright (c) 2025 Tres Finocchiaro <tres.finocchiaro/at/gmail.com>
6 *
7 * This file is part of LMMS - https://lmms.io
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public
20 * License along with this program (see COPYING); if not, write to the
21 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301 USA.
23 *
24 */
25
26#ifndef LMMS_KEYBOARDSHORTCUTS_H
27#define LMMS_KEYBOARDSHORTCUTS_H
28
29#include "lmmsconfig.h"
30
31#include "qnamespace.h"
32
33
34namespace lmms
35{
36
37// Qt on macOS maps:
38// - ControlModifier --> Command keys
39// - MetaModifier value --> Control keys
40// - Qt::AltModifier --> Option keys
41//
42// Our UI hints need to be adjusted to accommodate for this
43constexpr const char* UI_CTRL_KEY =
44#ifdef LMMS_BUILD_APPLE
45"⌘";
46#else
47"Ctrl";
48#endif
49
50constexpr const char* UI_ALT_KEY =
51#ifdef LMMS_BUILD_APPLE
52"Option";
53#else
54"Alt";
55#endif
56
57// UI hint for copying OR linking a UI component
58// this MUST be consistent with KBD_COPY_MODIFIER
59constexpr const char* UI_COPY_KEY =
60#ifdef LMMS_BUILD_APPLE
62#else
64#endif
65
66// Shortcut for copying OR linking a UI component
67// this MUST be consistent with UI_COPY_KEY
68constexpr Qt::KeyboardModifier KBD_COPY_MODIFIER =
69#ifdef LMMS_BUILD_APPLE
70Qt::AltModifier;
71#else
72Qt::ControlModifier;
73#endif
74
75} // namespace lmms
76
77#endif // LMMS_KEYBOARDSHORTCUTS_H
Definition AudioAlsa.cpp:35
constexpr const char * UI_COPY_KEY
Definition KeyboardShortcuts.h:59
constexpr const char * UI_CTRL_KEY
Definition KeyboardShortcuts.h:43
constexpr const char * UI_ALT_KEY
Definition KeyboardShortcuts.h:50
constexpr Qt::KeyboardModifier KBD_COPY_MODIFIER
Definition KeyboardShortcuts.h:68