mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-15 04:41:55 -05:00
Server: load presets on start and save them on exit
This commit is contained in:
parent
debdae9529
commit
e428f55c82
@ -526,7 +526,7 @@ void MainWindow::loadSettings()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setLoggingOpions();
|
setLoggingOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::loadPresetSettings(const Preset* preset, int tabIndex)
|
void MainWindow::loadPresetSettings(const Preset* preset, int tabIndex)
|
||||||
@ -987,7 +987,7 @@ void MainWindow::on_action_Logging_triggered()
|
|||||||
{
|
{
|
||||||
LoggingDialog loggingDialog(m_settings, this);
|
LoggingDialog loggingDialog(m_settings, this);
|
||||||
loggingDialog.exec();
|
loggingDialog.exec();
|
||||||
setLoggingOpions();
|
setLoggingOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_action_My_Position_triggered()
|
void MainWindow::on_action_My_Position_triggered()
|
||||||
@ -1290,7 +1290,7 @@ void MainWindow::updateStatus()
|
|||||||
m_dateTimeWidget->setText(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss t"));
|
m_dateTimeWidget->setText(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss t"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::setLoggingOpions()
|
void MainWindow::setLoggingOptions()
|
||||||
{
|
{
|
||||||
m_logger->setConsoleMinMessageLevel(m_settings.getConsoleMinLogLevel());
|
m_logger->setConsoleMinMessageLevel(m_settings.getConsoleMinLogLevel());
|
||||||
|
|
||||||
|
@ -297,7 +297,7 @@ private:
|
|||||||
void addSinkDevice();
|
void addSinkDevice();
|
||||||
void removeLastDevice();
|
void removeLastDevice();
|
||||||
|
|
||||||
void setLoggingOpions();
|
void setLoggingOptions();
|
||||||
|
|
||||||
bool handleMessage(const Message& cmd);
|
bool handleMessage(const Message& cmd);
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ int WebAPIAdapterGUI::instanceLoggingPut(
|
|||||||
m_mainWindow.m_settings.setLogFileName(*fileName);
|
m_mainWindow.m_settings.setLogFileName(*fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_mainWindow.setLoggingOpions();
|
m_mainWindow.setLoggingOptions();
|
||||||
|
|
||||||
// build response
|
// build response
|
||||||
response.init();
|
response.init();
|
||||||
|
@ -52,6 +52,8 @@ MainCore::MainCore(qtwebapp::LoggerWithFile *logger, const MainParser& parser, Q
|
|||||||
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleMessages()), Qt::QueuedConnection);
|
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleMessages()), Qt::QueuedConnection);
|
||||||
m_masterTimer.start(50);
|
m_masterTimer.start(50);
|
||||||
|
|
||||||
|
loadSettings();
|
||||||
|
|
||||||
m_apiAdapter = new WebAPIAdapterSrv(*this);
|
m_apiAdapter = new WebAPIAdapterSrv(*this);
|
||||||
m_requestMapper = new WebAPIRequestMapper(this);
|
m_requestMapper = new WebAPIRequestMapper(this);
|
||||||
m_requestMapper->setAdapter(m_apiAdapter);
|
m_requestMapper->setAdapter(m_apiAdapter);
|
||||||
@ -63,7 +65,8 @@ MainCore::MainCore(qtwebapp::LoggerWithFile *logger, const MainParser& parser, Q
|
|||||||
|
|
||||||
MainCore::~MainCore()
|
MainCore::~MainCore()
|
||||||
{
|
{
|
||||||
m_apiServer->stop();
|
m_apiServer->stop();
|
||||||
|
m_settings.save();
|
||||||
delete m_apiServer;
|
delete m_apiServer;
|
||||||
delete m_requestMapper;
|
delete m_requestMapper;
|
||||||
delete m_apiAdapter;
|
delete m_apiAdapter;
|
||||||
@ -99,3 +102,35 @@ void MainCore::handleMessages()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainCore::loadSettings()
|
||||||
|
{
|
||||||
|
qDebug() << "MainCore::loadSettings";
|
||||||
|
|
||||||
|
m_settings.load();
|
||||||
|
m_settings.sortPresets();
|
||||||
|
setLoggingOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainCore::setLoggingOptions()
|
||||||
|
{
|
||||||
|
m_logger->setConsoleMinMessageLevel(m_settings.getConsoleMinLogLevel());
|
||||||
|
|
||||||
|
if (m_settings.getUseLogFile())
|
||||||
|
{
|
||||||
|
qtwebapp::FileLoggerSettings fileLoggerSettings; // default values
|
||||||
|
|
||||||
|
if (m_logger->hasFileLogger()) {
|
||||||
|
fileLoggerSettings = m_logger->getFileLoggerSettings(); // values from file logger if it exists
|
||||||
|
}
|
||||||
|
|
||||||
|
fileLoggerSettings.fileName = m_settings.getLogFileName(); // put new values
|
||||||
|
m_logger->createOrSetFileLogger(fileLoggerSettings, 2000); // create file logger if it does not exist and apply settings in any case
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_logger->hasFileLogger()) {
|
||||||
|
m_logger->setFileMinMessageLevel(m_settings.getFileMinLogLevel());
|
||||||
|
}
|
||||||
|
|
||||||
|
m_logger->setUseFileLogger(m_settings.getUseLogFile());
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -98,6 +98,9 @@ private:
|
|||||||
WebAPIServer *m_apiServer;
|
WebAPIServer *m_apiServer;
|
||||||
WebAPIAdapterSrv *m_apiAdapter;
|
WebAPIAdapterSrv *m_apiAdapter;
|
||||||
|
|
||||||
|
void loadSettings();
|
||||||
|
void setLoggingOptions();
|
||||||
|
|
||||||
bool handleMessage(const Message& cmd);
|
bool handleMessage(const Message& cmd);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
Loading…
Reference in New Issue
Block a user