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 Member Functions | Protected Attributes | Friends | List of all members
Preferences Class Reference

#include <preferences.h>

Public Member Functions

 Preferences ()
 
void resetToDefaults ()
 
QByteArray serialize () const
 
bool deserialize (const QByteArray &data)
 
void setSourceDevice (const QString &value)
 
const QString & getSourceDevice () const
 
void setSourceIndex (const int value)
 
int getSourceIndex () const
 
void setAudioType (const QString &value)
 
const QString & getAudioType () const
 
void setAudioDevice (const QString &value)
 
const QString & getAudioDevice () const
 
void setLatitude (float latitude)
 
void setLongitude (float longitude)
 
float getLatitude () const
 
float getLongitude () const
 
void setConsoleMinLogLevel (const QtMsgType &minLogLevel)
 
void setFileMinLogLevel (const QtMsgType &minLogLevel)
 
void setUseLogFile (bool useLogFile)
 
void setLogFileName (const QString &value)
 
QtMsgType getConsoleMinLogLevel () const
 
QtMsgType getFileMinLogLevel () const
 
bool getUseLogFile () const
 
const QString & getLogFileName () const
 

Protected Attributes

QString m_sourceDevice
 Identification of the source used in R0 tab (GUI flavor) at startup. More...
 
int m_sourceIndex
 Index of the source used in R0 tab (GUI flavor) at startup. More...
 
QString m_audioType
 
QString m_audioDevice
 
float m_latitude
 
float m_longitude
 
QtMsgType m_consoleMinLogLevel
 
QtMsgType m_fileMinLogLevel
 
bool m_useLogFile
 
QString m_logFileName
 

Friends

class WebAPIAdapterBase
 

Detailed Description

Definition at line 8 of file preferences.h.

Constructor & Destructor Documentation

◆ Preferences()

Preferences::Preferences ( )

Definition at line 4 of file preferences.cpp.

References resetToDefaults().

5 {
7 }
void resetToDefaults()
Definition: preferences.cpp:9
+ Here is the call graph for this function:

Member Function Documentation

◆ deserialize()

bool Preferences::deserialize ( const QByteArray &  data)

Definition at line 39 of file preferences.cpp.

References SimpleDeserializer::getVersion(), SimpleDeserializer::isValid(), m_audioDevice, m_audioType, m_consoleMinLogLevel, m_fileMinLogLevel, m_latitude, m_logFileName, m_longitude, m_sourceDevice, m_sourceIndex, m_useLogFile, SimpleDeserializer::readBool(), SimpleDeserializer::readFloat(), SimpleDeserializer::readS32(), SimpleDeserializer::readString(), and resetToDefaults().

Referenced by MainSettings::load().

40 {
41  int tmpInt;
42 
43  SimpleDeserializer d(data);
44 
45  if(!d.isValid()) {
47  return false;
48  }
49 
50  if(d.getVersion() == 1)
51  {
52  d.readString(2, &m_sourceDevice);
53  d.readString(3, &m_audioType);
54  d.readString(4, &m_audioDevice);
55  d.readS32(5, &m_sourceIndex, 0);
56  d.readFloat(6, &m_latitude, 0.0);
57  d.readFloat(7, &m_longitude, 0.0);
58 
59  d.readS32(8, &tmpInt, (int) QtDebugMsg);
60 
61  if ((tmpInt == (int) QtDebugMsg) ||
62  (tmpInt == (int) QtInfoMsg) ||
63  (tmpInt == (int) QtWarningMsg) ||
64  (tmpInt == (int) QtCriticalMsg) ||
65  (tmpInt == (int) QtFatalMsg)) {
66  m_consoleMinLogLevel = (QtMsgType) tmpInt;
67  } else {
68  m_consoleMinLogLevel = QtDebugMsg;
69  }
70 
71  d.readBool(9, &m_useLogFile, false);
72  d.readString(10, &m_logFileName, "sdrangel.log");
73 
74  d.readS32(11, &tmpInt, (int) QtDebugMsg);
75 
76  if ((tmpInt == (int) QtDebugMsg) ||
77  (tmpInt == (int) QtInfoMsg) ||
78  (tmpInt == (int) QtWarningMsg) ||
79  (tmpInt == (int) QtCriticalMsg) ||
80  (tmpInt == (int) QtFatalMsg)) {
81  m_fileMinLogLevel = (QtMsgType) tmpInt;
82  } else {
83  m_fileMinLogLevel = QtDebugMsg;
84  }
85 
86  return true;
87  } else
88  {
90  return false;
91  }
92 }
void resetToDefaults()
Definition: preferences.cpp:9
float m_longitude
Definition: preferences.h:50
QtMsgType m_consoleMinLogLevel
Definition: preferences.h:52
bool m_useLogFile
Definition: preferences.h:54
int m_sourceIndex
Index of the source used in R0 tab (GUI flavor) at startup.
Definition: preferences.h:44
QString m_audioType
Definition: preferences.h:46
QString m_sourceDevice
Identification of the source used in R0 tab (GUI flavor) at startup.
Definition: preferences.h:43
float m_latitude
Definition: preferences.h:49
QString m_audioDevice
Definition: preferences.h:47
QtMsgType m_fileMinLogLevel
Definition: preferences.h:53
QString m_logFileName
Definition: preferences.h:55
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAudioDevice()

const QString& Preferences::getAudioDevice ( ) const
inline

Definition at line 24 of file preferences.h.

24 { return m_audioDevice; }
QString m_audioDevice
Definition: preferences.h:47

◆ getAudioType()

const QString& Preferences::getAudioType ( ) const
inline

Definition at line 22 of file preferences.h.

22 { return m_audioType; }
QString m_audioType
Definition: preferences.h:46

◆ getConsoleMinLogLevel()

QtMsgType Preferences::getConsoleMinLogLevel ( ) const
inline

Definition at line 35 of file preferences.h.

35 { return m_consoleMinLogLevel; }
QtMsgType m_consoleMinLogLevel
Definition: preferences.h:52

◆ getFileMinLogLevel()

QtMsgType Preferences::getFileMinLogLevel ( ) const
inline

Definition at line 36 of file preferences.h.

36 { return m_fileMinLogLevel; }
QtMsgType m_fileMinLogLevel
Definition: preferences.h:53

◆ getLatitude()

float Preferences::getLatitude ( ) const
inline

Definition at line 28 of file preferences.h.

28 { return m_latitude; }
float m_latitude
Definition: preferences.h:49

◆ getLogFileName()

const QString& Preferences::getLogFileName ( ) const
inline

Definition at line 38 of file preferences.h.

38 { return m_logFileName; }
QString m_logFileName
Definition: preferences.h:55

◆ getLongitude()

float Preferences::getLongitude ( ) const
inline

Definition at line 29 of file preferences.h.

29 { return m_longitude; }
float m_longitude
Definition: preferences.h:50

◆ getSourceDevice()

const QString& Preferences::getSourceDevice ( ) const
inline

Definition at line 17 of file preferences.h.

17 { return m_sourceDevice; }
QString m_sourceDevice
Identification of the source used in R0 tab (GUI flavor) at startup.
Definition: preferences.h:43

◆ getSourceIndex()

int Preferences::getSourceIndex ( ) const
inline

Definition at line 19 of file preferences.h.

19 { return m_sourceIndex; }
int m_sourceIndex
Index of the source used in R0 tab (GUI flavor) at startup.
Definition: preferences.h:44

◆ getUseLogFile()

bool Preferences::getUseLogFile ( ) const
inline

Definition at line 37 of file preferences.h.

37 { return m_useLogFile; }
bool m_useLogFile
Definition: preferences.h:54

◆ resetToDefaults()

void Preferences::resetToDefaults ( )

Definition at line 9 of file preferences.cpp.

References m_audioDevice, m_audioType, m_consoleMinLogLevel, m_fileMinLogLevel, m_latitude, m_logFileName, m_longitude, m_sourceDevice, m_sourceIndex, and m_useLogFile.

Referenced by deserialize(), Preferences(), and MainSettings::resetToDefaults().

10 {
11  m_sourceDevice.clear();
12  m_audioType.clear();
13  m_audioDevice.clear();
14  m_sourceIndex = 0;
15  m_latitude = 0.0;
16  m_longitude = 0.0;
17  m_useLogFile = false;
18  m_logFileName = "sdrangel.log";
19  m_consoleMinLogLevel = QtDebugMsg;
20  m_fileMinLogLevel = QtDebugMsg;
21 }
float m_longitude
Definition: preferences.h:50
QtMsgType m_consoleMinLogLevel
Definition: preferences.h:52
bool m_useLogFile
Definition: preferences.h:54
int m_sourceIndex
Index of the source used in R0 tab (GUI flavor) at startup.
Definition: preferences.h:44
QString m_audioType
Definition: preferences.h:46
QString m_sourceDevice
Identification of the source used in R0 tab (GUI flavor) at startup.
Definition: preferences.h:43
float m_latitude
Definition: preferences.h:49
QString m_audioDevice
Definition: preferences.h:47
QtMsgType m_fileMinLogLevel
Definition: preferences.h:53
QString m_logFileName
Definition: preferences.h:55
+ Here is the caller graph for this function:

◆ serialize()

QByteArray Preferences::serialize ( ) const

Definition at line 23 of file preferences.cpp.

References SimpleSerializer::final(), m_audioDevice, m_audioType, m_consoleMinLogLevel, m_fileMinLogLevel, m_latitude, m_logFileName, m_longitude, m_sourceDevice, m_sourceIndex, m_useLogFile, SimpleSerializer::writeBool(), SimpleSerializer::writeFloat(), SimpleSerializer::writeS32(), and SimpleSerializer::writeString().

Referenced by MainSettings::save().

24 {
25  SimpleSerializer s(1);
26  s.writeString(2, m_sourceDevice);
27  s.writeString(3, m_audioType);
28  s.writeString(4, m_audioDevice);
29  s.writeS32(5, m_sourceIndex);
30  s.writeFloat(6, m_latitude);
31  s.writeFloat(7, m_longitude);
32  s.writeS32(8, (int) m_consoleMinLogLevel);
33  s.writeBool(9, m_useLogFile);
34  s.writeString(10, m_logFileName);
35  s.writeS32(11, (int) m_fileMinLogLevel);
36  return s.final();
37 }
float m_longitude
Definition: preferences.h:50
QtMsgType m_consoleMinLogLevel
Definition: preferences.h:52
bool m_useLogFile
Definition: preferences.h:54
int m_sourceIndex
Index of the source used in R0 tab (GUI flavor) at startup.
Definition: preferences.h:44
QString m_audioType
Definition: preferences.h:46
QString m_sourceDevice
Identification of the source used in R0 tab (GUI flavor) at startup.
Definition: preferences.h:43
float m_latitude
Definition: preferences.h:49
QString m_audioDevice
Definition: preferences.h:47
QtMsgType m_fileMinLogLevel
Definition: preferences.h:53
QString m_logFileName
Definition: preferences.h:55
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setAudioDevice()

void Preferences::setAudioDevice ( const QString &  value)
inline

Definition at line 23 of file preferences.h.

23 { m_audioDevice= value; }
QString m_audioDevice
Definition: preferences.h:47

◆ setAudioType()

void Preferences::setAudioType ( const QString &  value)
inline

Definition at line 21 of file preferences.h.

21 { m_audioType = value; }
QString m_audioType
Definition: preferences.h:46

◆ setConsoleMinLogLevel()

void Preferences::setConsoleMinLogLevel ( const QtMsgType &  minLogLevel)
inline

Definition at line 31 of file preferences.h.

31 { m_consoleMinLogLevel = minLogLevel; }
QtMsgType m_consoleMinLogLevel
Definition: preferences.h:52

◆ setFileMinLogLevel()

void Preferences::setFileMinLogLevel ( const QtMsgType &  minLogLevel)
inline

Definition at line 32 of file preferences.h.

32 { m_fileMinLogLevel = minLogLevel; }
QtMsgType m_fileMinLogLevel
Definition: preferences.h:53

◆ setLatitude()

void Preferences::setLatitude ( float  latitude)
inline

Definition at line 26 of file preferences.h.

26 { m_latitude = latitude; }
float m_latitude
Definition: preferences.h:49

◆ setLogFileName()

void Preferences::setLogFileName ( const QString &  value)
inline

Definition at line 34 of file preferences.h.

34 { m_logFileName = value; }
QString m_logFileName
Definition: preferences.h:55

◆ setLongitude()

void Preferences::setLongitude ( float  longitude)
inline

Definition at line 27 of file preferences.h.

27 { m_longitude = longitude; }
float m_longitude
Definition: preferences.h:50

◆ setSourceDevice()

void Preferences::setSourceDevice ( const QString &  value)
inline

Definition at line 16 of file preferences.h.

16 { m_sourceDevice= value; }
QString m_sourceDevice
Identification of the source used in R0 tab (GUI flavor) at startup.
Definition: preferences.h:43

◆ setSourceIndex()

void Preferences::setSourceIndex ( const int  value)
inline

Definition at line 18 of file preferences.h.

18 { m_sourceIndex = value; }
int m_sourceIndex
Index of the source used in R0 tab (GUI flavor) at startup.
Definition: preferences.h:44

◆ setUseLogFile()

void Preferences::setUseLogFile ( bool  useLogFile)
inline

Definition at line 33 of file preferences.h.

33 { m_useLogFile = useLogFile; }
bool m_useLogFile
Definition: preferences.h:54

Friends And Related Function Documentation

◆ WebAPIAdapterBase

friend class WebAPIAdapterBase
friend

Definition at line 40 of file preferences.h.

Member Data Documentation

◆ m_audioDevice

QString Preferences::m_audioDevice
protected

◆ m_audioType

QString Preferences::m_audioType
protected

◆ m_consoleMinLogLevel

QtMsgType Preferences::m_consoleMinLogLevel
protected

◆ m_fileMinLogLevel

QtMsgType Preferences::m_fileMinLogLevel
protected

◆ m_latitude

float Preferences::m_latitude
protected

◆ m_logFileName

QString Preferences::m_logFileName
protected

◆ m_longitude

float Preferences::m_longitude
protected

◆ m_sourceDevice

QString Preferences::m_sourceDevice
protected

Identification of the source used in R0 tab (GUI flavor) at startup.

Definition at line 43 of file preferences.h.

Referenced by deserialize(), resetToDefaults(), serialize(), and WebAPIAdapterBase::webapiFormatPreferences().

◆ m_sourceIndex

int Preferences::m_sourceIndex
protected

Index of the source used in R0 tab (GUI flavor) at startup.

Definition at line 44 of file preferences.h.

Referenced by deserialize(), resetToDefaults(), serialize(), and WebAPIAdapterBase::webapiFormatPreferences().

◆ m_useLogFile

bool Preferences::m_useLogFile
protected

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