Added test button to notifications table

This commit is contained in:
Jordan Sherer 2019-10-11 20:09:47 -04:00
parent fed50180eb
commit 9a097e20c9
4 changed files with 26 additions and 13 deletions

View File

@ -1597,13 +1597,13 @@ void Configuration::impl::initialize_models ()
on_notifications_check_box_toggled(enable_notifications_);
QList<QPair<QString, QString>> notifyRows = {
{"notify_cq", "CQ Message Received"},
{"notify_hb", "HB Message Received"},
{"notify_ack", "ACK Message Received"},
{"notify_directed", "Directed Message Received"},
{"notify_inbox", "Inbox Message Received"},
{"notify_call_new", "New Callsign Heard"},
{"notify_call_old", "Worked Callsign Heard"},
{"cq", "CQ Message Received"},
{"hb", "HB Message Received"},
{"ack", "ACK Message Received"},
{"directed", "Directed Message Received"},
{"inbox", "Inbox Message Received"},
{"call_new", "New Callsign Heard"},
{"call_old", "Worked Callsign Heard"},
};
int i = 0;
@ -1663,6 +1663,18 @@ void Configuration::impl::initialize_models ()
}
});
QPushButton *testPushButton = new QPushButton(this);
testPushButton->setSizePolicy(minimumPolicy);
testPushButton->setText("Test");
buttonLayout->addWidget(testPushButton);
connect(testPushButton, &QPushButton::pressed, this, [this, key, pathLabel](){
// hack for testing...
notifications_enabled_[key] = true;
notifications_paths_[key] = pathLabel->text();
emit this->self_->test_notify(key);
});
QPushButton *clearPushButton = new QPushButton(this);
clearPushButton->setSizePolicy(minimumPolicy);
clearPushButton->setText("Clear");

View File

@ -91,6 +91,7 @@ public:
bool notifications_enabled() const;
QString notification_path(const QString &key) const;
Q_SIGNAL void test_notify(const QString &key);
// These query methods should be used after a call to exec() to
// determine if either the audio input or audio output stream

View File

@ -514,8 +514,9 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
connect (this, &MainWindow::outAttenuationChanged, m_soundOutput, &SoundOutput::setAttenuation);
connect (&m_audioThread, &QThread::finished, m_soundOutput, &QObject::deleteLater);
connect(this, &MainWindow::initializeNotificationAudioOutputStream, m_notification, &NotificationAudio::init);
connect(this, &MainWindow::playNotification, m_notification, &NotificationAudio::play);
connect (this, &MainWindow::initializeNotificationAudioOutputStream, m_notification, &NotificationAudio::init);
connect (&m_config, &Configuration::test_notify, this, &MainWindow::tryNotify);
connect (this, &MainWindow::playNotification, m_notification, &NotificationAudio::play);
connect (&m_notificationAudioThread, &QThread::finished, m_notification, &QObject::deleteLater);
// hook up Modulator slots and disposal
@ -9503,9 +9504,7 @@ void MainWindow::postDecode (bool is_new, QString const& message)
}
void MainWindow::tryNotify(const QString &key){
auto k = QString("notify_%1").arg(key);
auto path = m_config.notification_path(k);
auto path = m_config.notification_path(key);
if(path.isEmpty()){
return;
}

View File

@ -166,6 +166,8 @@ public slots:
QString createMessageTransmitQueue(QString const& text, bool reset);
void resetMessageTransmitQueue();
QPair<QString, int> popMessageFrame();
void tryNotify(const QString &key);
protected:
void keyPressEvent (QKeyEvent *) override;
void closeEvent(QCloseEvent *) override;
@ -433,7 +435,6 @@ private slots:
void checkStartupWarnings ();
void clearCallsignSelected();
void refreshTextDisplay();
void tryNotify(const QString &key);
private:
Q_SIGNAL void playNotification(const QString &name);