MCPcopy Create free account
hub / github.com/ChiyukiGana/Quickinput / Trigger

Function Trigger

source/src/trigger.cpp:5–132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3#ifdef DEBUG
4#define InputHookT InputState
5#else
6#define InputHookT InputHook
7#endif
8
9namespace QiTr
10{
11 void Trigger(short vk, const bool* state)
12 {
13 // state swtich
14 if ((vk == Qi::set.key1 || vk == Qi::set.key2) && (Qi::set.key1 ? state[Qi::set.key1] : true) && (Qi::set.key2 ? state[Qi::set.key2] : true)) QiState(!Qi::state);
15 // show clock
16 if (Qi::fun.showClock.state && Qi::fun.showClock.key == vk && state[Qi::fun.showClock.key]) Qi::popText->Popup(QDateTime::currentDateTime().toString(L"hh:mm:ss"));
17 if (!Qi::run) return;
18 // quick click
19 if (Qi::fun.quickClick.state && Qi::fun.quickClick.key == vk)
20 {
21 if (state[Qi::fun.quickClick.key]) // key down
22 {
23 if (Qi::fun.quickClick.mode) // switch mode
24 {
25 if (Qi::fun.quickClick.thread.active())
26 {
27 Qi::fun.quickClick.thread.stop();
28 if (Qi::set.showTips && !Qi::ui.pop.qcd.t.isEmpty()) QiFn::QuickClickPop(false);
29 if (Qi::set.audFx) QiFn::SoundPlay(Qi::ui.pop.qcd.s, false);
30 }
31 else
32 {
33 Qi::fun.quickClick.thread.start();
34 if (Qi::set.showTips && !Qi::ui.pop.qce.t.isEmpty()) QiFn::QuickClickPop(true);
35 if (Qi::set.audFx) QiFn::SoundPlay(Qi::ui.pop.qce.s, false);
36 }
37 }
38 else // press mode
39 {
40 if (!Qi::fun.quickClick.thread.active())
41 {
42 Qi::fun.quickClick.thread.start();
43 if (Qi::set.showTips && !Qi::ui.pop.qce.t.isEmpty()) QiFn::QuickClickPop(true);
44 if (Qi::set.audFx) QiFn::SoundPlay(Qi::ui.pop.qce.s, false);
45 }
46 }
47 }
48 else // key up
49 {
50 if (!Qi::fun.quickClick.mode) // press mode
51 {
52 if (Qi::fun.quickClick.thread.active())
53 {
54 Qi::fun.quickClick.thread.stop();
55 if (Qi::set.showTips && !Qi::ui.pop.qcd.t.isEmpty()) QiFn::QuickClickPop(false);
56 if (Qi::set.audFx) QiFn::SoundPlay(Qi::ui.pop.qcd.s, false);
57 }
58 }
59 }
60 }
61 // macros
62 for (auto& m : Qi::macroActive)

Callers 2

InputTaskFunction · 0.85
QiHookFunction · 0.85

Calls 14

QiStateFunction · 0.85
QuickClickPopFunction · 0.85
SoundPlayFunction · 0.85
MacroPopFunction · 0.85
PopupMethod · 0.80
run_activeMethod · 0.80
end_startMethod · 0.80
run_startMethod · 0.80
toStringMethod · 0.45
activeMethod · 0.45
stopMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected