1 | /******************************************************************** |
2 | KWin - the KDE window manager |
3 | This file is part of the KDE project. |
4 | |
5 | Copyright (C) 1999, 2000 Matthias Ettrich <ettrich@kde.org> |
6 | Copyright (C) 2003 Lubos Lunak <l.lunak@kde.org> |
7 | |
8 | This program is free software; you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by |
10 | the Free Software Foundation; either version 2 of the License, or |
11 | (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 | *********************************************************************/ |
21 | |
22 | // This file is #included from within: |
23 | // Workspace::initShortcuts() |
24 | // { |
25 | |
26 | // Some shortcuts have Tarzan-speech like names, they need extra |
27 | // normal human descriptions with DEF2() the others can use DEF() |
28 | // new DEF3 allows to pass data to the action, replacing the %1 argument in the name |
29 | |
30 | #define DEF2( name, descr, key, fnSlot ) \ |
31 | a = actionCollection->addAction( name ); \ |
32 | a->setText( i18n(descr) ); \ |
33 | qobject_cast<KAction*>( a )->setGlobalShortcut(KShortcut(key)); \ |
34 | connect(a, SIGNAL(triggered(bool)), SLOT(fnSlot)); |
35 | |
36 | #define DEF( name, key, fnSlot ) \ |
37 | DEF2(name, name, key, fnSlot) |
38 | |
39 | #define DEF3( name, key, fnSlot, value ) \ |
40 | a = actionCollection->addAction( QString(name).arg(value) ); \ |
41 | a->setText( i18n(name, value) ); \ |
42 | qobject_cast<KAction*>( a )->setGlobalShortcut(KShortcut(key)); \ |
43 | a->setData(value); \ |
44 | connect(a, SIGNAL(triggered(bool)), SLOT(fnSlot)); |
45 | |
46 | |
47 | a = actionCollection->addAction("Program:kwin" ); |
48 | a->setText(i18n("System" )); |
49 | |
50 | a = actionCollection->addAction("Group:Navigation" ); |
51 | a->setText(i18n("Navigation" )); |
52 | DEF(I18N_NOOP("Walk Through Window Tabs" ), 0, slotActivateNextTab()); |
53 | DEF(I18N_NOOP("Walk Through Window Tabs (Reverse)" ), 0, slotActivatePrevTab()); |
54 | DEF(I18N_NOOP("Remove Window From Group" ), 0, slotUntab()); |
55 | |
56 | a = actionCollection->addAction("Group:Windows" ); |
57 | a->setText(i18n("Windows" )); |
58 | DEF(I18N_NOOP("Window Operations Menu" ), |
59 | Qt::ALT + Qt::Key_F3, slotWindowOperations()); |
60 | DEF2("Window Close" , I18N_NOOP("Close Window" ), |
61 | Qt::ALT + Qt::Key_F4, slotWindowClose()); |
62 | DEF2("Window Maximize" , I18N_NOOP("Maximize Window" ), |
63 | 0, slotWindowMaximize()); |
64 | DEF2("Window Maximize Vertical" , I18N_NOOP("Maximize Window Vertically" ), |
65 | 0, slotWindowMaximizeVertical()); |
66 | DEF2("Window Maximize Horizontal" , I18N_NOOP("Maximize Window Horizontally" ), |
67 | 0, slotWindowMaximizeHorizontal()); |
68 | DEF2("Window Minimize" , I18N_NOOP("Minimize Window" ), |
69 | 0, slotWindowMinimize()); |
70 | DEF2("Window Shade" , I18N_NOOP("Shade Window" ), |
71 | 0, slotWindowShade()); |
72 | DEF2("Window Move" , I18N_NOOP("Move Window" ), |
73 | 0, slotWindowMove()); |
74 | DEF2("Window Resize" , I18N_NOOP("Resize Window" ), |
75 | 0, slotWindowResize()); |
76 | DEF2("Window Raise" , I18N_NOOP("Raise Window" ), |
77 | 0, slotWindowRaise()); |
78 | DEF2("Window Lower" , I18N_NOOP("Lower Window" ), |
79 | 0, slotWindowLower()); |
80 | DEF(I18N_NOOP("Toggle Window Raise/Lower" ), |
81 | 0, slotWindowRaiseOrLower()); |
82 | DEF2("Window Fullscreen" , I18N_NOOP("Make Window Fullscreen" ), |
83 | 0, slotWindowFullScreen()); |
84 | DEF2("Window No Border" , I18N_NOOP("Hide Window Border" ), |
85 | 0, slotWindowNoBorder()); |
86 | DEF2("Window Above Other Windows" , I18N_NOOP("Keep Window Above Others" ), |
87 | 0, slotWindowAbove()); |
88 | DEF2("Window Below Other Windows" , I18N_NOOP("Keep Window Below Others" ), |
89 | 0, slotWindowBelow()); |
90 | DEF(I18N_NOOP("Activate Window Demanding Attention" ), |
91 | Qt::CTRL + Qt::ALT + Qt::Key_A, slotActivateAttentionWindow()); |
92 | DEF(I18N_NOOP("Setup Window Shortcut" ), |
93 | 0, slotSetupWindowShortcut()); |
94 | DEF2("Window Pack Right" , I18N_NOOP("Pack Window to the Right" ), |
95 | 0, slotWindowPackRight()); |
96 | DEF2("Window Pack Left" , I18N_NOOP("Pack Window to the Left" ), |
97 | 0, slotWindowPackLeft()); |
98 | DEF2("Window Pack Up" , I18N_NOOP("Pack Window Up" ), |
99 | 0, slotWindowPackUp()); |
100 | DEF2("Window Pack Down" , I18N_NOOP("Pack Window Down" ), |
101 | 0, slotWindowPackDown()); |
102 | DEF2("Window Grow Horizontal" , I18N_NOOP("Pack Grow Window Horizontally" ), |
103 | 0, slotWindowGrowHorizontal()); |
104 | DEF2("Window Grow Vertical" , I18N_NOOP("Pack Grow Window Vertically" ), |
105 | 0, slotWindowGrowVertical()); |
106 | DEF2("Window Shrink Horizontal" , I18N_NOOP("Pack Shrink Window Horizontally" ), |
107 | 0, slotWindowShrinkHorizontal()); |
108 | DEF2("Window Shrink Vertical" , I18N_NOOP("Pack Shrink Window Vertically" ), |
109 | 0, slotWindowShrinkVertical()); |
110 | DEF2("Window Quick Tile Left" , I18N_NOOP("Quick Tile Window to the Left" ), |
111 | 0, slotWindowQuickTileLeft()); |
112 | DEF2("Window Quick Tile Right" , I18N_NOOP("Quick Tile Window to the Right" ), |
113 | 0, slotWindowQuickTileRight()); |
114 | DEF2("Window Quick Tile Top Left" , I18N_NOOP("Quick Tile Window to the Top Left" ), |
115 | 0, slotWindowQuickTileTopLeft()); |
116 | DEF2("Window Quick Tile Bottom Left" , I18N_NOOP("Quick Tile Window to the Bottom Left" ), |
117 | 0, slotWindowQuickTileBottomLeft()); |
118 | DEF2("Window Quick Tile Top Right" , I18N_NOOP("Quick Tile Window to the Top Right" ), |
119 | 0, slotWindowQuickTileTopRight()); |
120 | DEF2("Window Quick Tile Bottom Right" , I18N_NOOP("Quick Tile Window to the Bottom Right" ), |
121 | 0, slotWindowQuickTileBottomRight()); |
122 | DEF2("Switch Window Up" , I18N_NOOP("Switch to Window Above" ), |
123 | Qt::META + Qt::ALT + Qt::Key_Up, slotSwitchWindowUp()); |
124 | DEF2("Switch Window Down" , I18N_NOOP("Switch to Window Below" ), |
125 | Qt::META + Qt::ALT + Qt::Key_Down, slotSwitchWindowDown()); |
126 | DEF2("Switch Window Right" , I18N_NOOP("Switch to Window to the Right" ), |
127 | Qt::META + Qt::ALT + Qt::Key_Right, slotSwitchWindowRight()); |
128 | DEF2("Switch Window Left" , I18N_NOOP("Switch to Window to the Left" ), |
129 | Qt::META + Qt::ALT + Qt::Key_Left, slotSwitchWindowLeft()); |
130 | DEF2("Increase Opacity" , I18N_NOOP("Increase Opacity of Active Window by 5 %" ), |
131 | 0, slotIncreaseWindowOpacity()); |
132 | DEF2("Decrease Opacity" , I18N_NOOP("Decrease Opacity of Active Window by 5 %" ), |
133 | 0, slotLowerWindowOpacity()); |
134 | |
135 | a = actionCollection->addAction("Group:Window Desktop" ); |
136 | a->setText(i18n("Window & Desktop" )); |
137 | DEF2("Window On All Desktops" , I18N_NOOP("Keep Window on All Desktops" ), |
138 | 0, slotWindowOnAllDesktops()); |
139 | |
140 | for (int i = 1; i < 21; ++i) { |
141 | DEF3(I18N_NOOP("Window to Desktop %1" ), 0, slotWindowToDesktop(), i); |
142 | } |
143 | DEF(I18N_NOOP("Window to Next Desktop" ), 0, slotWindowToNextDesktop()); |
144 | DEF(I18N_NOOP("Window to Previous Desktop" ), 0, slotWindowToPreviousDesktop()); |
145 | DEF(I18N_NOOP("Window One Desktop to the Right" ), 0, slotWindowToDesktopRight()); |
146 | DEF(I18N_NOOP("Window One Desktop to the Left" ), 0, slotWindowToDesktopLeft()); |
147 | DEF(I18N_NOOP("Window One Desktop Up" ), 0, slotWindowToDesktopUp()); |
148 | DEF(I18N_NOOP("Window One Desktop Down" ), 0, slotWindowToDesktopDown()); |
149 | |
150 | for (int i = 0; i < 8; ++i) { |
151 | DEF3(I18N_NOOP("Window to Screen %1" ), 0, slotWindowToScreen(), i); |
152 | } |
153 | DEF(I18N_NOOP("Window to Next Screen" ), 0, slotWindowToNextScreen()); |
154 | DEF(I18N_NOOP("Window to Previous Screen" ), 0, slotWindowToPrevScreen()); |
155 | DEF(I18N_NOOP("Show Desktop" ), 0, slotToggleShowDesktop()); |
156 | |
157 | for (int i = 0; i < 8; ++i) { |
158 | DEF3(I18N_NOOP("Switch to Screen %1" ), 0, slotSwitchToScreen(), i); |
159 | } |
160 | |
161 | DEF(I18N_NOOP("Switch to Next Screen" ), 0, slotSwitchToNextScreen()); |
162 | DEF(I18N_NOOP("Switch to Previous Screen" ), 0, slotSwitchToPrevScreen()); |
163 | |
164 | a = actionCollection->addAction("Group:Miscellaneous" ); |
165 | a->setText(i18n("Miscellaneous" )); |
166 | DEF(I18N_NOOP("Kill Window" ), Qt::CTRL + Qt::ALT + Qt::Key_Escape, slotKillWindow()); |
167 | DEF(I18N_NOOP("Suspend Compositing" ), Qt::SHIFT + Qt::ALT + Qt::Key_F12, slotToggleCompositing()); |
168 | DEF(I18N_NOOP("Invert Screen Colors" ), 0, slotInvertScreen()); |
169 | |
170 | #undef DEF |
171 | #undef DEF2 |
172 | #undef DEF3 |
173 | |
174 | // } |
175 | |