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 | Private Slots | Private Member Functions | Private Attributes | List of all members
LoggingDialog Class Reference

#include <loggingdialog.h>

Inherits QDialog.

+ Collaboration diagram for LoggingDialog:

Public Member Functions

 LoggingDialog (MainSettings &mainSettings, QWidget *parent=0)
 
 ~LoggingDialog ()
 

Private Slots

void accept ()
 
void on_showFileDialog_clicked (bool checked)
 

Private Member Functions

QtMsgType msgLevelFromIndex (int intMsgLevel)
 
int msgLevelToIndex (const QtMsgType &msgLevel)
 

Private Attributes

Ui::LoggingDialog * ui
 
MainSettingsm_mainSettings
 
QString m_fileName
 

Detailed Description

Definition at line 30 of file loggingdialog.h.

Constructor & Destructor Documentation

◆ LoggingDialog()

LoggingDialog::LoggingDialog ( MainSettings mainSettings,
QWidget *  parent = 0 
)
explicit

Definition at line 24 of file loggingdialog.cpp.

References MainSettings::getConsoleMinLogLevel(), MainSettings::getFileMinLogLevel(), MainSettings::getLogFileName(), MainSettings::getUseLogFile(), m_fileName, m_mainSettings, msgLevelToIndex(), and ui.

24  :
25  QDialog(parent),
26  ui(new Ui::LoggingDialog),
27  m_mainSettings(mainSettings)
28 {
29  ui->setupUi(this);
30  ui->consoleLevel->setCurrentIndex(msgLevelToIndex(m_mainSettings.getConsoleMinLogLevel()));
31  ui->fileLevel->setCurrentIndex(msgLevelToIndex(m_mainSettings.getFileMinLogLevel()));
32  ui->logToFile->setChecked(m_mainSettings.getUseLogFile());
33  ui->logFileNameText->setText(m_mainSettings.getLogFileName());
35 }
const QString & getLogFileName() const
Definition: mainsettings.h:65
bool getUseLogFile() const
Definition: mainsettings.h:64
QtMsgType getFileMinLogLevel() const
Definition: mainsettings.h:63
int msgLevelToIndex(const QtMsgType &msgLevel)
QString m_fileName
Definition: loggingdialog.h:39
MainSettings & m_mainSettings
Definition: loggingdialog.h:38
Ui::LoggingDialog * ui
Definition: loggingdialog.h:37
QtMsgType getConsoleMinLogLevel() const
Definition: mainsettings.h:62
+ Here is the call graph for this function:

◆ ~LoggingDialog()

LoggingDialog::~LoggingDialog ( )

Definition at line 37 of file loggingdialog.cpp.

References ui.

38 {
39  delete ui;
40 }
Ui::LoggingDialog * ui
Definition: loggingdialog.h:37

Member Function Documentation

◆ accept

void LoggingDialog::accept ( )
privateslot

Definition at line 42 of file loggingdialog.cpp.

References m_fileName, m_mainSettings, msgLevelFromIndex(), MainSettings::setConsoleMinLogLevel(), MainSettings::setFileMinLogLevel(), MainSettings::setLogFileName(), MainSettings::setUseLogFile(), and ui.

43 {
44  m_mainSettings.setConsoleMinLogLevel(msgLevelFromIndex(ui->consoleLevel->currentIndex()));
45  m_mainSettings.setFileMinLogLevel(msgLevelFromIndex(ui->fileLevel->currentIndex()));
46  m_mainSettings.setUseLogFile(ui->logToFile->isChecked());
48  QDialog::accept();
49 }
void setConsoleMinLogLevel(const QtMsgType &minLogLevel)
Definition: mainsettings.h:58
void setFileMinLogLevel(const QtMsgType &minLogLevel)
Definition: mainsettings.h:59
QString m_fileName
Definition: loggingdialog.h:39
MainSettings & m_mainSettings
Definition: loggingdialog.h:38
void setUseLogFile(bool useLogFile)
Definition: mainsettings.h:60
QtMsgType msgLevelFromIndex(int intMsgLevel)
Ui::LoggingDialog * ui
Definition: loggingdialog.h:37
void setLogFileName(const QString &value)
Definition: mainsettings.h:61
+ Here is the call graph for this function:

◆ msgLevelFromIndex()

QtMsgType LoggingDialog::msgLevelFromIndex ( int  intMsgLevel)
private

Definition at line 65 of file loggingdialog.cpp.

Referenced by accept().

66 {
67  switch (intMsgLevel)
68  {
69  case 0:
70  return QtDebugMsg;
71  break;
72  case 1:
73  return QtInfoMsg;
74  break;
75  case 2:
76  return QtWarningMsg;
77  break;
78  case 3:
79  return QtCriticalMsg;
80  break;
81  default:
82  return QtDebugMsg;
83  break;
84  }
85 }
+ Here is the caller graph for this function:

◆ msgLevelToIndex()

int LoggingDialog::msgLevelToIndex ( const QtMsgType &  msgLevel)
private

Definition at line 87 of file loggingdialog.cpp.

Referenced by LoggingDialog().

88 {
89  switch (msgLevel)
90  {
91  case QtDebugMsg:
92  return 0;
93  break;
94  case QtInfoMsg:
95  return 1;
96  break;
97  case QtWarningMsg:
98  return 2;
99  break;
100  case QtCriticalMsg:
101  case QtFatalMsg:
102  return 3;
103  break;
104  default:
105  return 0;
106  break;
107  }
108 }
+ Here is the caller graph for this function:

◆ on_showFileDialog_clicked

void LoggingDialog::on_showFileDialog_clicked ( bool  checked)
privateslot

Definition at line 51 of file loggingdialog.cpp.

References m_fileName, and ui.

52 {
53  (void) checked;
54  QString fileName = QFileDialog::getSaveFileName(this,
55  tr("Save log file"), ".", tr("Log Files (*.log)"), 0, QFileDialog::DontUseNativeDialog);
56 
57  if (fileName != "")
58  {
59  qDebug("LoggingDialog::on_showFileDialog_clicked: selected: %s", qPrintable(fileName));
60  m_fileName = fileName;
61  ui->logFileNameText->setText(fileName);
62  }
63 }
QString m_fileName
Definition: loggingdialog.h:39
Ui::LoggingDialog * ui
Definition: loggingdialog.h:37

Member Data Documentation

◆ m_fileName

QString LoggingDialog::m_fileName
private

Definition at line 39 of file loggingdialog.h.

Referenced by accept(), LoggingDialog(), and on_showFileDialog_clicked().

◆ m_mainSettings

MainSettings& LoggingDialog::m_mainSettings
private

Definition at line 38 of file loggingdialog.h.

Referenced by accept(), and LoggingDialog().

◆ ui

Ui::LoggingDialog* LoggingDialog::ui
private

Definition at line 37 of file loggingdialog.h.

Referenced by accept(), LoggingDialog(), on_showFileDialog_clicked(), and ~LoggingDialog().


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