Cleanup of ellipsis and added custom HB/CQ repeat intervals

This commit is contained in:
Jordan Sherer 2019-02-08 20:45:50 -05:00
parent 35cfbbc2e5
commit 81af627836

View File

@ -1208,7 +1208,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
restoreAction->setDisabled(m_lastTxMessage.isEmpty()); restoreAction->setDisabled(m_lastTxMessage.isEmpty());
menu->addAction(restoreAction); menu->addAction(restoreAction);
auto savedMenu = menu->addMenu("Saved messages..."); auto savedMenu = menu->addMenu("Saved Messages...");
buildSavedMessagesMenu(savedMenu); buildSavedMessagesMenu(savedMenu);
auto directedMenu = menu->addMenu(QString("Directed to %1...").arg(selectedCall)); auto directedMenu = menu->addMenu(QString("Directed to %1...").arg(selectedCall));
@ -1283,7 +1283,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
} }
if(selectedOffset != -1){ if(selectedOffset != -1){
auto qsyAction = menu->addAction(QString("Jump to %1Hz...").arg(selectedOffset)); auto qsyAction = menu->addAction(QString("Jump to %1Hz").arg(selectedOffset));
connect(qsyAction, &QAction::triggered, this, [this, selectedOffset](){ connect(qsyAction, &QAction::triggered, this, [this, selectedOffset](){
setFreqOffsetForRestore(selectedOffset, false); setFreqOffsetForRestore(selectedOffset, false);
}); });
@ -1295,7 +1295,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
menu->addSeparator(); menu->addSeparator();
auto savedMenu = menu->addMenu("Saved messages..."); auto savedMenu = menu->addMenu("Saved Messages...");
buildSavedMessagesMenu(savedMenu); buildSavedMessagesMenu(savedMenu);
auto directedMenu = menu->addMenu(QString("Directed to %1...").arg(selectedCall)); auto directedMenu = menu->addMenu(QString("Directed to %1...").arg(selectedCall));
@ -1337,7 +1337,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
auto addStation = new QAction(QString("Add New Station or Group..."), ui->tableWidgetCalls); auto addStation = new QAction(QString("Add New Station or Group..."), ui->tableWidgetCalls);
connect(addStation, &QAction::triggered, this, [this](){ connect(addStation, &QAction::triggered, this, [this](){
bool ok = false; bool ok = false;
QString callsign = QInputDialog::getText(this, tr("Add New Station or Group..."), QString callsign = QInputDialog::getText(this, tr("Add New Station or Group"),
tr("Station or Group Callsign:"), QLineEdit::Normal, tr("Station or Group Callsign:"), QLineEdit::Normal,
"", &ok).toUpper().trimmed(); "", &ok).toUpper().trimmed();
if(!ok || callsign.trimmed().isEmpty()){ if(!ok || callsign.trimmed().isEmpty()){
@ -1380,7 +1380,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
displayActivity(true); displayActivity(true);
}); });
auto historyAction = new QAction(QString("View Message Inbox..."), ui->tableWidgetCalls); auto historyAction = new QAction(QString("Message Inbox..."), ui->tableWidgetCalls);
connect(historyAction, &QAction::triggered, this, [this](){ connect(historyAction, &QAction::triggered, this, [this](){
QString selectedCall = callsignSelected(); QString selectedCall = callsignSelected();
if(selectedCall.isEmpty()){ if(selectedCall.isEmpty()){
@ -1473,7 +1473,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
if(!missingCallsign && !isAllCall){ if(!missingCallsign && !isAllCall){
int selectedOffset = m_callActivity[selectedCall].freq; int selectedOffset = m_callActivity[selectedCall].freq;
if(selectedOffset != -1){ if(selectedOffset != -1){
auto qsyAction = menu->addAction(QString("Jump to %1Hz...").arg(selectedOffset)); auto qsyAction = menu->addAction(QString("Jump to %1Hz").arg(selectedOffset));
connect(qsyAction, &QAction::triggered, this, [this, selectedOffset](){ connect(qsyAction, &QAction::triggered, this, [this, selectedOffset](){
setFreqOffsetForRestore(selectedOffset, false); setFreqOffsetForRestore(selectedOffset, false);
}); });
@ -1492,7 +1492,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
menu->addSeparator(); menu->addSeparator();
auto savedMenu = menu->addMenu("Saved messages..."); auto savedMenu = menu->addMenu("Saved Messages...");
buildSavedMessagesMenu(savedMenu); buildSavedMessagesMenu(savedMenu);
auto directedMenu = menu->addMenu(QString("Directed to %1...").arg(selectedCall)); auto directedMenu = menu->addMenu(QString("Directed to %1...").arg(selectedCall));
@ -2615,7 +2615,7 @@ void MainWindow::on_menuWindow_aboutToShow(){
void MainWindow::on_actionSetOffset_triggered(){ void MainWindow::on_actionSetOffset_triggered(){
bool ok = false; bool ok = false;
auto currentFreq = currentFreqOffset(); auto currentFreq = currentFreqOffset();
QString newFreq = QInputDialog::getText(this, tr("Set Frequency Offset..."), QString newFreq = QInputDialog::getText(this, tr("Set Frequency Offset"),
tr("Offset in Hz:"), QLineEdit::Normal, tr("Offset in Hz:"), QLineEdit::Normal,
QString("%1").arg(currentFreq), &ok).toUpper().trimmed(); QString("%1").arg(currentFreq), &ok).toUpper().trimmed();
int offset = newFreq.toInt(&ok); int offset = newFreq.toInt(&ok);
@ -6940,7 +6940,7 @@ void MainWindow::buildFrequencyMenu(QMenu *menu){
connect(custom, &QAction::triggered, this, [this](){ connect(custom, &QAction::triggered, this, [this](){
bool ok = false; bool ok = false;
auto currentFreq = Radio::frequency_MHz_string(dialFrequency()); auto currentFreq = Radio::frequency_MHz_string(dialFrequency());
QString newFreq = QInputDialog::getText(this, tr("Set a Custom Frequency..."), QString newFreq = QInputDialog::getText(this, tr("Set a Custom Frequency"),
tr("Frequency in MHz:"), QLineEdit::Normal, tr("Frequency in MHz:"), QLineEdit::Normal,
currentFreq, &ok).toUpper().trimmed(); currentFreq, &ok).toUpper().trimmed();
if(!ok){ if(!ok){
@ -6990,21 +6990,37 @@ void MainWindow::buildRepeatMenu(QMenu *menu, QPushButton * button, int * interv
{"Repeat every 15 minutes", 15}, {"Repeat every 15 minutes", 15},
{"Repeat every 30 minutes", 30}, {"Repeat every 30 minutes", 30},
{"Repeat every 60 minutes", 60}, {"Repeat every 60 minutes", 60},
{"Custom (Repeat every N minutes)", -1},
}; };
QActionGroup * group = new QActionGroup(menu); QActionGroup * group = new QActionGroup(menu);
bool set = false;
foreach(auto pair, items){ foreach(auto pair, items){
int minutes = pair.second; int minutes = pair.second;
auto action = menu->addAction(pair.first); auto action = menu->addAction(pair.first);
action->setData(pair.second); action->setData(minutes);
action->setCheckable(true); action->setCheckable(true);
action->setChecked(*interval == minutes); action->setChecked(*interval == minutes || (minutes == -1 && set == false));
if(*interval == minutes){
set = true;
}
group->addAction(action); group->addAction(action);
connect(action, &QAction::toggled, this, [this, minutes, interval, button](bool checked){ connect(action, &QAction::toggled, this, [this, minutes, interval, button](bool checked){
if(checked){ if(checked){
if(minutes == -1){
bool ok = false;
int min = QInputDialog::getInt(this, "Repeat every N minutes", "Minutes", 0, 1, 1440, 1, &ok);
if(!ok){
return;
}
*interval = min;
} else {
*interval = minutes; *interval = minutes;
}
if(minutes > 0){ if(minutes > 0){
// force a re-toggle // force a re-toggle
button->setChecked(false); button->setChecked(false);