SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Public Types | Public Member Functions | Public Attributes | List of all members
CWKeyerSettings Class Reference

#include <cwkeyersettings.h>

Public Types

enum  CWMode {
  CWNone, CWText, CWDots, CWDashes,
  CWKeyboard
}
 

Public Member Functions

 CWKeyerSettings ()
 
void resetToDefaults ()
 
QByteArray serialize () const
 
bool deserialize (const QByteArray &data)
 

Public Attributes

bool m_loop
 
CWMode m_mode
 
int m_sampleRate
 
QString m_text
 
int m_wpm
 
bool m_keyboardIambic
 
Qt::Key m_dotKey
 
Qt::KeyboardModifiers m_dotKeyModifiers
 
Qt::Key m_dashKey
 
Qt::KeyboardModifiers m_dashKeyModifiers
 

Detailed Description

Definition at line 27 of file cwkeyersettings.h.

Member Enumeration Documentation

◆ CWMode

Enumerator
CWNone 
CWText 
CWDots 
CWDashes 
CWKeyboard 

Definition at line 30 of file cwkeyersettings.h.

Constructor & Destructor Documentation

◆ CWKeyerSettings()

CWKeyerSettings::CWKeyerSettings ( )

Definition at line 22 of file cwkeyersettings.cpp.

References resetToDefaults().

23 {
25 }
+ Here is the call graph for this function:

Member Function Documentation

◆ deserialize()

bool CWKeyerSettings::deserialize ( const QByteArray &  data)

Definition at line 59 of file cwkeyersettings.cpp.

References SimpleDeserializer::getVersion(), SimpleDeserializer::isValid(), m_dashKey, m_dashKeyModifiers, m_dotKey, m_dotKeyModifiers, m_keyboardIambic, m_loop, m_mode, m_sampleRate, m_text, m_wpm, SimpleDeserializer::readBool(), SimpleDeserializer::readS32(), SimpleDeserializer::readString(), SimpleDeserializer::readU32(), and resetToDefaults().

Referenced by CWKeyerGUI::deserialize().

60 {
61  SimpleDeserializer d(data);
62 
63  if (!d.isValid())
64  {
66  return false;
67  }
68 
69  if (d.getVersion() == 1)
70  {
71  int intval;
72  unsigned int uintval;
73 
74  d.readBool(2, &m_loop, false);
75  d.readS32(3, &intval, 0);
76  m_mode = (CWMode) intval;
77  d.readS32(4, &m_sampleRate, 48000);
78  d.readString(5, &m_text, "");
79  d.readS32(6, &m_wpm, 13);
80  d.readS32(7, &intval, (int) Qt::Key_Period);
81  m_dotKey = (Qt::Key) (intval < 0 ? 0 : intval);
82  d.readU32(8, &uintval, 0);
83  m_dotKeyModifiers = (Qt::KeyboardModifiers) uintval;
84  d.readS32(9, &intval, (int) Qt::Key_Minus);
85  m_dashKey = (Qt::Key) (intval < 0 ? 0 : intval);
86  d.readU32(10, &uintval, 0);
87  m_dashKeyModifiers = (Qt::KeyboardModifiers) uintval;
88  d.readBool(11, &m_keyboardIambic, true);
89 
90  return true;
91  }
92  else
93  {
95  return false;
96  }
97 }
Qt::KeyboardModifiers m_dotKeyModifiers
Qt::KeyboardModifiers m_dashKeyModifiers
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetToDefaults()

void CWKeyerSettings::resetToDefaults ( )

Definition at line 27 of file cwkeyersettings.cpp.

References CWNone, m_dashKey, m_dashKeyModifiers, m_dotKey, m_dotKeyModifiers, m_keyboardIambic, m_loop, m_mode, m_sampleRate, m_text, and m_wpm.

Referenced by CWKeyerSettings(), deserialize(), and CWKeyerGUI::resetToDefaults().

28 {
29  m_loop = false;
30  m_mode = CWNone;
31  m_sampleRate = 48000;
32  m_text = "";
33  m_wpm = 13;
34  m_keyboardIambic = true;
35  m_dotKey = Qt::Key_Period;
36  m_dotKeyModifiers = Qt::NoModifier;
37  m_dashKey = Qt::Key_Minus;
38  m_dashKeyModifiers = Qt::NoModifier;
39 }
Qt::KeyboardModifiers m_dotKeyModifiers
Qt::KeyboardModifiers m_dashKeyModifiers
+ Here is the caller graph for this function:

◆ serialize()

QByteArray CWKeyerSettings::serialize ( ) const

Definition at line 41 of file cwkeyersettings.cpp.

References SimpleSerializer::final(), m_dashKey, m_dashKeyModifiers, m_dotKey, m_dotKeyModifiers, m_keyboardIambic, m_loop, m_mode, m_sampleRate, m_text, m_wpm, SimpleSerializer::writeBool(), SimpleSerializer::writeS32(), SimpleSerializer::writeString(), and SimpleSerializer::writeU32().

Referenced by CWKeyerGUI::serialize().

42 {
43  SimpleSerializer s(1);
44 
45  s.writeBool(2, m_loop);
46  s.writeS32(3, (int) m_mode);
47  s.writeS32(4, m_sampleRate);
48  s.writeString(5, m_text);
49  s.writeS32(6, m_wpm);
50  s.writeS32(7, (int) m_dotKey);
51  s.writeU32(8, (unsigned int) m_dotKeyModifiers);
52  s.writeS32(9, (int) m_dashKey);
53  s.writeU32(10, (unsigned int) m_dashKeyModifiers);
54  s.writeBool(11, m_keyboardIambic);
55 
56  return s.final();
57 }
Qt::KeyboardModifiers m_dotKeyModifiers
Qt::KeyboardModifiers m_dashKeyModifiers
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_dashKey

Qt::Key CWKeyerSettings::m_dashKey

◆ m_dashKeyModifiers

Qt::KeyboardModifiers CWKeyerSettings::m_dashKeyModifiers

◆ m_dotKey

Qt::Key CWKeyerSettings::m_dotKey

◆ m_dotKeyModifiers

Qt::KeyboardModifiers CWKeyerSettings::m_dotKeyModifiers

◆ m_keyboardIambic

bool CWKeyerSettings::m_keyboardIambic

◆ m_loop

bool CWKeyerSettings::m_loop

◆ m_mode

CWMode CWKeyerSettings::m_mode

◆ m_sampleRate

int CWKeyerSettings::m_sampleRate

◆ m_text

QString CWKeyerSettings::m_text

◆ m_wpm

int CWKeyerSettings::m_wpm

The documentation for this class was generated from the following files: