Browse Source

Load radio settings after core startup and apply from dialog

master
evgeny 2 days ago
parent
commit
afbce0efeb
  1. 1
      tools/chatgui/src/mainwindow.cpp
  2. 1
      tools/chatgui/src/messagelist.cpp
  3. 8
      tools/chatgui/src/settingsdialog.cpp

1
tools/chatgui/src/mainwindow.cpp

@ -392,6 +392,7 @@ void MainWindow::setupBridgeCallbacks() {
gui_bridge_set_db_ready_cb([]() {
if (!s_mainWindow || !s_mainWindow->m_db) return;
s_mainWindow->m_db->setDb(chat_core_get_db(gui_bridge_get_inst()));
RadioAudioEngine::instance()->loadSettings(s_mainWindow->m_cfgPath);
s_mainWindow->m_channelList->loadChannels();
s_mainWindow->restoreWindowGeometry();
PttHotkeyManager::instance()->init(s_mainWindow->m_db); /* глобальные PTT-хоткеи */

1
tools/chatgui/src/messagelist.cpp

@ -15,6 +15,7 @@
#include <QPainter>
#include <QPixmap>
#include <QStyle>
#include <QSignalBlocker>
#include <QDateTime>
#include <QJsonDocument>
#include <QJsonObject>

8
tools/chatgui/src/settingsdialog.cpp

@ -26,6 +26,7 @@ extern "C" {
#include <QComboBox>
#include <QFile>
#include <QTextStream>
#include <QMessageBox>
SettingsDialog::SettingsDialog(const QString& configPath, DbManager* db, UtunNode* node,
AudioRecorder* recorder, QWidget* parent)
@ -221,6 +222,7 @@ void SettingsDialog::onCategoryChanged(int row) {
if (row == 6) m_nodesPage->refreshNodes();
if (row == 7) m_soundPage->loadFromDb();
if (row == 8) m_audioDevicePage->loadFromDb();
if (row == 9) m_radioPage->loadFromDb();
}
void SettingsDialog::onSave() {
@ -295,7 +297,11 @@ void SettingsDialog::onSave() {
m_soundPage->applyAndSave();
m_audioDevicePage->applyAndSave();
m_storagePage->applyAndSave();
m_radioPage->apply();
if (!m_radioPage->apply()) {
QMessageBox::warning(this, QStringLiteral("Настройки рации"), QStringLiteral("Не удалось применить настройки рации. "
"Проверьте доступность ядра и файла конфигурации; подробности в логе radio."));
return;
}
/* Физические сочетания сохраняем в БД; Wayland-хоткеями владеет системный портал. */
if (!PttHotkeyManager::usesPortal()) {

Loading…
Cancel
Save