Added ability to open settings to a specific tab to make editing macros easier

This commit is contained in:
Jordan Sherer 2018-09-09 15:47:26 -04:00
parent 8b9042e2d6
commit 5a18b3f9fb
2 changed files with 77 additions and 68 deletions

View File

@ -2274,8 +2274,13 @@ void MainWindow::on_actionReset_Window_Sizes_triggered(){
}); });
} }
void MainWindow::on_actionSettings_triggered() //Setup Dialog void MainWindow::on_actionSettings_triggered(){
{ openSettings();
}
void MainWindow::openSettings(int tab){
m_config.select_tab(tab);
// things that might change that we need know about // things that might change that we need know about
auto callsign = m_config.my_callsign (); auto callsign = m_config.my_callsign ();
auto my_grid = m_config.my_grid (); auto my_grid = m_config.my_grid ();
@ -2288,6 +2293,7 @@ void MainWindow::on_actionSettings_triggered() //Setup Dialog
if (m_config.my_callsign () != callsign || m_config.my_grid () != my_grid) { if (m_config.my_callsign () != callsign || m_config.my_grid () != my_grid) {
statusUpdate (); statusUpdate ();
} }
on_dxGridEntry_textChanged (m_hisGrid); // recalculate distances in case of units change on_dxGridEntry_textChanged (m_hisGrid); // recalculate distances in case of units change
enable_DXCC_entity (m_config.DXCC ()); // sets text window proportions and (re)inits the logbook enable_DXCC_entity (m_config.DXCC ()); // sets text window proportions and (re)inits the logbook
@ -2325,8 +2331,8 @@ void MainWindow::on_actionSettings_triggered() //Setup Dialog
ui->label_6->setText("Single-Period Decodes"); ui->label_6->setText("Single-Period Decodes");
ui->label_7->setText("Average Decodes"); ui->label_7->setText("Average Decodes");
} else { } else {
// ui->label_6->setText("Band Activity"); // ui->label_6->setText("Band Activity");
// ui->label_7->setText("Rx Frequency"); // ui->label_7->setText("Rx Frequency");
} }
update_watchdog_label (); update_watchdog_label ();
if(!m_splitMode) ui->cbCQTx->setChecked(false); if(!m_splitMode) ui->cbCQTx->setChecked(false);
@ -6077,13 +6083,13 @@ void MainWindow::resetMessageUI(){
bool MainWindow::ensureCallsignSet(bool alert){ bool MainWindow::ensureCallsignSet(bool alert){
if(m_config.my_callsign().trimmed().isEmpty()){ if(m_config.my_callsign().trimmed().isEmpty()){
if(alert) MessageBox::warning_message(this, tr ("Please enter your callsign in the settings.")); if(alert) MessageBox::warning_message(this, tr ("Please enter your callsign in the settings."));
on_actionSettings_triggered(); openSettings();
return false; return false;
} }
if(m_config.my_grid().trimmed().isEmpty()){ if(m_config.my_grid().trimmed().isEmpty()){
if(alert) MessageBox::warning_message(this, tr ("Please enter your grid locator in the settings.")); if(alert) MessageBox::warning_message(this, tr ("Please enter your grid locator in the settings."));
on_actionSettings_triggered(); openSettings();
return false; return false;
} }
@ -7870,7 +7876,7 @@ void MainWindow::on_queryButton_pressed(){
void MainWindow::on_macrosMacroButton_pressed(){ void MainWindow::on_macrosMacroButton_pressed(){
if(m_config.macros()->stringList().isEmpty()){ if(m_config.macros()->stringList().isEmpty()){
on_actionSettings_triggered(); openSettings(3);
return; return;
} }
@ -7888,7 +7894,9 @@ void MainWindow::on_macrosMacroButton_pressed(){
menu->addSeparator(); menu->addSeparator();
auto action = new QAction(QIcon::fromTheme("edit-edit"), QString("Edit"), menu); auto action = new QAction(QIcon::fromTheme("edit-edit"), QString("Edit"), menu);
menu->addAction(action); menu->addAction(action);
connect(action, &QAction::triggered, this, &MainWindow::on_actionSettings_triggered); connect(action, &QAction::triggered, this, [this](){
openSettings(3);
});
ui->macrosMacroButton->setMenu(menu); ui->macrosMacroButton->setMenu(menu);
ui->macrosMacroButton->showMenu(); ui->macrosMacroButton->showMenu();

View File

@ -173,6 +173,7 @@ private slots:
void on_actionShow_Waterfall_Controls_triggered(bool checked); void on_actionShow_Waterfall_Controls_triggered(bool checked);
void on_actionReset_Window_Sizes_triggered(); void on_actionReset_Window_Sizes_triggered();
void on_actionSettings_triggered(); void on_actionSettings_triggered();
void openSettings(int tab=0);
void prepareSpotting(); void prepareSpotting();
void on_spotButton_clicked(bool checked); void on_spotButton_clicked(bool checked);
void on_monitorButton_clicked (bool); void on_monitorButton_clicked (bool);