mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-05 23:45:00 -04:00
Main window: implement the logging options dialog. Use it only for log level
This commit is contained in:
@@ -33,6 +33,13 @@ public:
|
||||
float getLatitude() const { return m_preferences.getLatitude(); }
|
||||
float getLongitude() const { return m_preferences.getLongitude(); }
|
||||
|
||||
void setMinLogLevel(const QtMsgType& minLogLevel) { m_preferences.setMinLogLevel(minLogLevel); }
|
||||
void setUseLogFile(bool useLogFile) { m_preferences.setUseLogFile(useLogFile); }
|
||||
void setLogFileName(const QString& value) { m_preferences.setLogFileName(value); }
|
||||
QtMsgType getMinLogLevel() const { return m_preferences.getMinLogLevel(); }
|
||||
bool getUseLogFile() const { return m_preferences.getUseLogFile(); }
|
||||
const QString& getLogFileName() const { return m_preferences.getLogFileName(); }
|
||||
|
||||
const AudioDeviceInfo *getAudioDeviceInfo() const { return m_audioDeviceInfo; }
|
||||
void setAudioDeviceInfo(AudioDeviceInfo *audioDeviceInfo) { m_audioDeviceInfo = audioDeviceInfo; }
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@ void Preferences::resetToDefaults()
|
||||
m_sourceIndex = 0;
|
||||
m_latitude = 0.0;
|
||||
m_longitude = 0.0;
|
||||
m_useLogFile = false;
|
||||
m_logFileName = "sdrangel.log";
|
||||
}
|
||||
|
||||
QByteArray Preferences::serialize() const
|
||||
@@ -27,11 +29,16 @@ QByteArray Preferences::serialize() const
|
||||
s.writeS32(5, m_sourceIndex);
|
||||
s.writeFloat(6, m_latitude);
|
||||
s.writeFloat(7, m_longitude);
|
||||
s.writeS32(8, (int) m_minLogLevel);
|
||||
s.writeBool(9, m_useLogFile);
|
||||
s.writeString(10, m_logFileName);
|
||||
return s.final();
|
||||
}
|
||||
|
||||
bool Preferences::deserialize(const QByteArray& data)
|
||||
{
|
||||
int tmpInt;
|
||||
|
||||
SimpleDeserializer d(data);
|
||||
|
||||
if(!d.isValid()) {
|
||||
@@ -47,6 +54,21 @@ bool Preferences::deserialize(const QByteArray& data)
|
||||
d.readS32(5, &m_sourceIndex, 0);
|
||||
d.readFloat(6, &m_latitude, 0.0);
|
||||
d.readFloat(7, &m_longitude, 0.0);
|
||||
|
||||
d.readS32(8, &tmpInt, (int) QtDebugMsg);
|
||||
|
||||
if ((tmpInt == (int) QtDebugMsg) ||
|
||||
(tmpInt == (int) QtInfoMsg) ||
|
||||
(tmpInt == (int) QtWarningMsg) ||
|
||||
(tmpInt == (int) QtCriticalMsg) ||
|
||||
(tmpInt == (int) QtFatalMsg)) {
|
||||
m_minLogLevel = (QtMsgType) tmpInt;
|
||||
} else {
|
||||
m_minLogLevel = QtDebugMsg;
|
||||
}
|
||||
|
||||
d.readBool(9, &m_useLogFile, false);
|
||||
d.readString(10, &m_logFileName, "sdrangel.log");
|
||||
return true;
|
||||
} else {
|
||||
resetToDefaults();
|
||||
|
||||
@@ -28,6 +28,13 @@ public:
|
||||
float getLatitude() const { return m_latitude; }
|
||||
float getLongitude() const { return m_longitude; }
|
||||
|
||||
void setMinLogLevel(const QtMsgType& minLogLevel) { m_minLogLevel = minLogLevel; }
|
||||
void setUseLogFile(bool useLogFile) { m_useLogFile = useLogFile; }
|
||||
void setLogFileName(const QString& value) { m_logFileName = value; }
|
||||
QtMsgType getMinLogLevel() const { return m_minLogLevel; }
|
||||
bool getUseLogFile() const { return m_useLogFile; }
|
||||
const QString& getLogFileName() const { return m_logFileName; }
|
||||
|
||||
protected:
|
||||
QString m_sourceType;
|
||||
QString m_sourceDevice;
|
||||
@@ -38,6 +45,10 @@ protected:
|
||||
|
||||
float m_latitude;
|
||||
float m_longitude;
|
||||
|
||||
QtMsgType m_minLogLevel;
|
||||
bool m_useLogFile;
|
||||
QString m_logFileName;
|
||||
};
|
||||
|
||||
#endif // INCLUDE_PREFERENCES_H
|
||||
|
||||
Reference in New Issue
Block a user