Starting to implement popup macros for Tx messages.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3055 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2013-03-18 22:47:24 +00:00
parent d5f79d68bb
commit c1dab73dfd
2 changed files with 32 additions and 3 deletions

View File

@ -92,6 +92,10 @@ MainWindow::MainWindow(QWidget *parent) :
connect(&proc_jt9, SIGNAL(readyReadStandardError()),
this, SLOT(readFromStderr()));
ui->tx5->setContextMenuPolicy(Qt::CustomContextMenu);
connect(ui->tx5, SIGNAL(customContextMenuRequested(const QPoint&)),
this, SLOT(showMacros(const QPoint&)));
QTimer *guiTimer = new QTimer(this);
connect(guiTimer, SIGNAL(timeout()), this, SLOT(guiUpdate()));
guiTimer->start(100); //Don't change the 100 ms!
@ -1896,3 +1900,26 @@ void MainWindow::on_actionErase_wsjtx_log_adi_triggered()
f.remove();
}
}
void MainWindow::showMacros(const QPoint &pos)
{
QPoint globalPos = ui->tx5->mapToGlobal(pos);
QMenu popupMenu;
QAction* popup1 = new QAction("5W DIP 73 GL",ui->tx5);
QAction* popup2 = new QAction("TNX 73 GL",ui->tx5);
popupMenu.addAction(popup1);
popupMenu.addAction(popup2);
connect(popup1,SIGNAL(triggered()), this, SLOT(onPopup1()));
connect(popup2,SIGNAL(triggered()), this, SLOT(onPopup2()));
QAction* selectedItem = popupMenu.exec(globalPos);
}
void MainWindow::onPopup1()
{
ui->tx5->setText("5W DIP 73 GL");
}
void MainWindow::onPopup2()
{
ui->tx5->setText("TNX 73 GL");
}

View File

@ -108,12 +108,14 @@ private slots:
void bumpFqso(int n);
void on_actionMonitor_OFF_at_startup_triggered();
void dialFreqChanged2(double f);
void on_actionErase_ALL_TXT_triggered();
void on_actionErase_wsjtx_log_adi_triggered();
private:
void showMacros(const QPoint& pos);
void onPopup1();
void onPopup2();
private:
Ui::MainWindow *ui;
double m_dialFreq;