Just Intonation  Version 1.3.0 (18)
Explore scale-independent dynamically adapting tuning in just intonation
touchscreenkeyboard.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright 2016-2017 Karolin Stange, Christoph Wick, and Haye Hinrichsen
3  *
4  * This file is part of JustIntonation.
5  *
6  * JustIntonation is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by the
8  * Free Software Foundation, either version 3 of the License, or (at your
9  * option) any later version.
10  *
11  * JustIntonation is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14  * for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with JustIntonation. If not, see http://www.gnu.org/licenses/.
18  *****************************************************************************/
19 
20 #ifndef TOUCHSCREENKEYBOARD_H
21 #define TOUCHSCREENKEYBOARD_H
22 
23 #include <QObject>
24 #include <QSet>
25 #include <QVariant>
26 #include <QMidiMessage>
27 
28 #include "system/shared.h"
29 
44 
45 class TouchscreenKeyboard : public QObject
46 {
47  Q_OBJECT
48 public:
50 
51  bool init() { mActive = true; return true; }
52  bool start() { mActive = true; return true; }
53  bool stop() { clear(); mActive = false; return true; }
54  bool exit() { clear(); mActive = false; return true; }
55  void suspend(){ mActive = false; }
56  void resume() { mActive = true; }
57 
58 public slots:
59  void receiveTouchpadKeyboardEvent (QVariant keys);
60  void setToggleMode (bool on) { clear(); mToggleMode=on; }
61  void clear();
62 
63 signals:
65  void sendTouchpadMidiEvent (QMidiMessage event);
67  void highlightKey (QVariant key, QVariant on);
68 
69 private:
70  void switchNote (int key, bool on);
71 
72  QSet<int> mPressedKeys;
73  QVector<bool> mSoundActive;
74  bool mToggleMode;
75  bool mActive;
76 };
77 
78 #endif // TOUCHSCREENKEYBOARD_H
void highlightKey(QVariant key, QVariant on)
Signal: Tells the Qml layer to highlight pressed keys.
QVector< bool > mSoundActive
Flag wether the sound is turned on.
bool mActive
Flag that allows to send data.
bool mToggleMode
Flag for desktop toggling mode.
void sendTouchpadMidiEvent(QMidiMessage event)
Signal: On keypress send the corresponding Midi event to a different module.
void receiveTouchpadKeyboardEvent(QVariant keys)
SLOT: Receive an event from the touchscreen keyboard.
Touchscreen keyboard.
void setToggleMode(bool on)
QSet< int > mPressedKeys
Keeps track of pressed keys.
void switchNote(int key, bool on)
Switch note on or off.
void clear()
Clear the keyboard memory and turn all notes off.
TouchscreenKeyboard()
Constructor.