69 lines
2.0 KiB
C++
69 lines
2.0 KiB
C++
#pragma once
|
|
|
|
#include "ptt_key_chord.h"
|
|
#include <QWidget>
|
|
#include <QVector>
|
|
#include <QMap>
|
|
|
|
class DbManager;
|
|
class QPushButton;
|
|
class QLabel;
|
|
class QHideEvent;
|
|
class QShowEvent;
|
|
class QSpinBox;
|
|
class QCheckBox;
|
|
class QButtonGroup;
|
|
class RadioLevelMeter;
|
|
|
|
/* Общий редактор вкладки и мини-блока; метрики не перезаписывают редактируемые настройки. */
|
|
class RadioActivationSettings : public QWidget {
|
|
Q_OBJECT
|
|
public:
|
|
explicit RadioActivationSettings(bool compact, QWidget* parent = nullptr);
|
|
void loadSettings();
|
|
bool apply();
|
|
bool canApply() const;
|
|
signals:
|
|
void changed();
|
|
private:
|
|
QMap<QString, int> values() const;
|
|
void updateControls();
|
|
void updateMeters();
|
|
bool m_compact, m_loaded = false;
|
|
QButtonGroup* m_mode;
|
|
QSpinBox *m_threshold, *m_hangover, *m_txGain = nullptr, *m_vadGain, *m_levelOn, *m_levelOff;
|
|
QCheckBox* m_compressor = nullptr;
|
|
RadioLevelMeter *m_levelMeter, *m_vadMeter;
|
|
QLabel *m_levelText, *m_vadText, *m_gainText, *m_error;
|
|
};
|
|
|
|
// Запись глобальных сочетаний PTT, включая отдельные левые/правые модификаторы.
|
|
class RadioSettingsPage : public QWidget {
|
|
Q_OBJECT
|
|
public:
|
|
explicit RadioSettingsPage(DbManager* db, QWidget* parent = nullptr);
|
|
~RadioSettingsPage() override;
|
|
void loadFromDb();
|
|
QStringList hotkeys() const;
|
|
bool apply();
|
|
|
|
protected:
|
|
bool eventFilter(QObject* object, QEvent* event) override;
|
|
void showEvent(QShowEvent* event) override;
|
|
void hideEvent(QHideEvent* event) override;
|
|
|
|
private:
|
|
void updatePortalLabels();
|
|
RadioActivationSettings* m_activation;
|
|
QLabel* m_portalStatus = nullptr;
|
|
void startCapture(int index);
|
|
void finishCapture(bool save);
|
|
void updateLabel(int index);
|
|
DbManager* m_db;
|
|
QVector<PttKeyChord> m_chords;
|
|
QVector<QPushButton*> m_buttons;
|
|
QVector<QLabel*> m_labels;
|
|
PttChordCapture m_capture;
|
|
int m_captureIndex = -1;
|
|
};
|