mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-08-12 10:42:27 -04:00
Refactored help windows into a helpful class
Also used it to implement the prefixes, shortcuts and mouse help windows. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5554 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
05a060c740
commit
982b4edcd0
104
mainwindow.cpp
104
mainwindow.cpp
@ -63,6 +63,33 @@ namespace
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class HelpTextWindow
|
||||||
|
: public QLabel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
HelpTextWindow (QString const& title, QString const& file_name, QFont const& = QFont {}, QWidget * parent = nullptr);
|
||||||
|
};
|
||||||
|
|
||||||
|
HelpTextWindow::HelpTextWindow (QString const& title, QString const& file_name, QFont const& font, QWidget * parent)
|
||||||
|
: QLabel {parent, Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint}
|
||||||
|
{
|
||||||
|
QFile source {file_name};
|
||||||
|
if (!source.open (QIODevice::ReadOnly | QIODevice::Text))
|
||||||
|
{
|
||||||
|
QMessageBox::warning (this, QApplication::applicationName ()
|
||||||
|
, "Cannot open \"" + source.fileName ()
|
||||||
|
+ "\" for reading:" + source.errorString ());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setText (QTextStream {&source}.readAll ());
|
||||||
|
setWindowTitle(QApplication::applicationName () + " - " + title);
|
||||||
|
setTextFormat (Qt::PlainText);
|
||||||
|
setMargin (10);
|
||||||
|
setBackgroundRole (QPalette::Base);
|
||||||
|
setAutoFillBackground (true);
|
||||||
|
setStyleSheet (font_as_stylesheet (font));
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------- MainWindow constructor
|
//--------------------------------------------------- MainWindow constructor
|
||||||
MainWindow::MainWindow(bool multiple, QSettings * settings, QSharedMemory *shdmem,
|
MainWindow::MainWindow(bool multiple, QSettings * settings, QSharedMemory *shdmem,
|
||||||
unsigned downSampleFactor, QWidget *parent) :
|
unsigned downSampleFactor, QWidget *parent) :
|
||||||
@ -1445,56 +1472,24 @@ void MainWindow::on_actionKeyboard_shortcuts_triggered()
|
|||||||
{
|
{
|
||||||
if (!m_shortcuts)
|
if (!m_shortcuts)
|
||||||
{
|
{
|
||||||
QFile f(":/shortcuts.txt");
|
QFont font;
|
||||||
if(!f.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
font.setPointSize (10);
|
||||||
msgBox("Cannot open \"" + f.fileName () + "\" for reading:"+f.errorString ());
|
m_shortcuts.reset (new HelpTextWindow {tr ("Keyboard Shortcuts")
|
||||||
return;
|
, ":/shortcuts.txt", font});
|
||||||
}
|
|
||||||
m_shortcuts.reset (new QTextEdit);
|
|
||||||
m_shortcuts->setReadOnly(true);
|
|
||||||
m_shortcuts->setFontPointSize(10);
|
|
||||||
m_shortcuts->setWindowTitle(QApplication::applicationName () + " - " + tr ("Keyboard Shortcuts"));
|
|
||||||
m_shortcuts->setGeometry(QRect(45,50,430,460));
|
|
||||||
Qt::WindowFlags flags = Qt::WindowCloseButtonHint |
|
|
||||||
Qt::WindowMinimizeButtonHint;
|
|
||||||
m_shortcuts->setWindowFlags(flags);
|
|
||||||
QTextStream s(&f);
|
|
||||||
QString t;
|
|
||||||
for(int i=0; i<100; i++) {
|
|
||||||
t=s.readLine();
|
|
||||||
m_shortcuts->append(t);
|
|
||||||
if(s.atEnd()) break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
m_shortcuts->showNormal();
|
m_shortcuts->showNormal ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionSpecial_mouse_commands_triggered()
|
void MainWindow::on_actionSpecial_mouse_commands_triggered()
|
||||||
{
|
{
|
||||||
if (!m_mouseCmnds)
|
if (!m_mouseCmnds)
|
||||||
{
|
{
|
||||||
QFile f(":/mouse_commands.txt");
|
QFont font;
|
||||||
if(!f.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
font.setPointSize (10);
|
||||||
msgBox("Cannot open \"" + f.fileName () + "\" for reading:" + f.errorString ());
|
m_mouseCmnds.reset (new HelpTextWindow {tr ("Special Mouse Commands")
|
||||||
return;
|
, ":/mouse_commands.txt", font});
|
||||||
}
|
|
||||||
m_mouseCmnds.reset (new QTextEdit);
|
|
||||||
m_mouseCmnds->setReadOnly(true);
|
|
||||||
m_mouseCmnds->setFontPointSize(10);
|
|
||||||
m_mouseCmnds->setWindowTitle(QApplication::applicationName () + " - " + tr ("Special Mouse Commands"));
|
|
||||||
m_mouseCmnds->setGeometry(QRect(45,50,440,300));
|
|
||||||
Qt::WindowFlags flags = Qt::WindowCloseButtonHint |
|
|
||||||
Qt::WindowMinimizeButtonHint;
|
|
||||||
m_mouseCmnds->setWindowFlags(flags);
|
|
||||||
QTextStream s(&f);
|
|
||||||
QString t;
|
|
||||||
for(int i=0; i<100; i++) {
|
|
||||||
t=s.readLine();
|
|
||||||
m_mouseCmnds->append(t);
|
|
||||||
if(s.atEnd()) break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
m_mouseCmnds->showNormal();
|
m_mouseCmnds->showNormal ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_DecodeButton_clicked (bool /* checked */) //Decode request
|
void MainWindow::on_DecodeButton_clicked (bool /* checked */) //Decode request
|
||||||
@ -3770,30 +3765,7 @@ void MainWindow::on_actionShort_list_of_add_on_prefixes_and_suffixes_triggered()
|
|||||||
{
|
{
|
||||||
if (!m_prefixes)
|
if (!m_prefixes)
|
||||||
{
|
{
|
||||||
QFile f(":/prefixes.txt");
|
m_prefixes.reset (new HelpTextWindow {tr ("Prefixes"), ":/prefixes.txt", {"Courier", 10}});
|
||||||
if(!f.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
|
||||||
msgBox("Cannot open \"" + f.fileName () + "\" for reading:" + f.errorString ());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
m_prefixes.reset (new QLabel {
|
|
||||||
QTextStream {&f}.readAll ()
|
|
||||||
, nullptr
|
|
||||||
, Qt::WindowCloseButtonHint | Qt::WindowMinimizeButtonHint
|
|
||||||
});
|
|
||||||
m_prefixes->setWindowTitle(QApplication::applicationName () +
|
|
||||||
" - " + tr ("Prefixes"));
|
|
||||||
m_prefixes->setTextFormat (Qt::PlainText);
|
|
||||||
m_prefixes->setMargin (10);
|
|
||||||
m_prefixes->setBackgroundRole (QPalette::Base);
|
|
||||||
m_prefixes->setAutoFillBackground (true);
|
|
||||||
|
|
||||||
// Formatting in columns thanks to Sandro, IW3RAB:
|
|
||||||
QFont font;
|
|
||||||
font.setFamily("Courier");
|
|
||||||
font.setStyleHint(QFont::Monospace);
|
|
||||||
font.setFixedPitch(true);
|
|
||||||
font.setPointSize(10); //as for decoded text
|
|
||||||
m_prefixes->setStyleSheet (font_as_stylesheet (font));
|
|
||||||
}
|
}
|
||||||
m_prefixes->showNormal();
|
m_prefixes->showNormal();
|
||||||
}
|
}
|
||||||
|
@ -63,6 +63,7 @@ class MessageAveraging;
|
|||||||
class MessageClient;
|
class MessageClient;
|
||||||
class QTime;
|
class QTime;
|
||||||
class WSPRBandHopping;
|
class WSPRBandHopping;
|
||||||
|
class HelpTextWindow;
|
||||||
|
|
||||||
class MainWindow : public QMainWindow
|
class MainWindow : public QMainWindow
|
||||||
{
|
{
|
||||||
@ -274,9 +275,9 @@ private:
|
|||||||
QScopedPointer<EchoGraph> m_echoGraph;
|
QScopedPointer<EchoGraph> m_echoGraph;
|
||||||
QScopedPointer<LogQSO> m_logDlg;
|
QScopedPointer<LogQSO> m_logDlg;
|
||||||
QScopedPointer<Astro> m_astroWidget;
|
QScopedPointer<Astro> m_astroWidget;
|
||||||
QScopedPointer<QTextEdit> m_shortcuts;
|
QScopedPointer<HelpTextWindow> m_shortcuts;
|
||||||
QScopedPointer<QLabel> m_prefixes;
|
QScopedPointer<HelpTextWindow> m_prefixes;
|
||||||
QScopedPointer<QTextEdit> m_mouseCmnds;
|
QScopedPointer<HelpTextWindow> m_mouseCmnds;
|
||||||
QScopedPointer<MessageAveraging> m_msgAvgWidget;
|
QScopedPointer<MessageAveraging> m_msgAvgWidget;
|
||||||
|
|
||||||
Frequency m_dialFreq;
|
Frequency m_dialFreq;
|
||||||
|
@ -1,17 +1,15 @@
|
|||||||
Click on Action
|
Click on Action
|
||||||
__________________________________________________________
|
_______________________________________________________________
|
||||||
|
|
||||||
Waterfall: Set Rx frequency
|
Waterfall: Set Rx frequency.
|
||||||
Double-click to set Rx frequency and decode there
|
Double-click to set Rx frequency and decode there.
|
||||||
Ctrl-click to set Rx and Tx frequencies and decode
|
Ctrl-click to set Rx and Tx frequencies and decode.
|
||||||
|
|
||||||
Decoded text: Double-click to copy second callsign to Dx Call,
|
Decoded text: Double-click to copy second callsign to Dx Call,
|
||||||
locator to Dx Grid; change Rx and Tx frequencies to
|
locator to Dx Grid; change Rx and Tx frequencies to
|
||||||
decoded signal's frequency; generate standard messages.
|
decoded signal's frequency; generate standard messages.
|
||||||
If first callsign is your own, Tx frequency is not
|
If first callsign is your own, Tx frequency is not
|
||||||
changed unless Ctrl is held down when double-clicking.
|
changed unless Ctrl is held down when double-clicking.
|
||||||
|
|
||||||
Erase button: Click to erase QSO window
|
Erase button: Click to erase QSO window.
|
||||||
Double-click to erase QSO and Band Activity windows
|
Double-click to erase QSO and Band Activity windows.
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,28 +1,28 @@
|
|||||||
F1 Online User's Guide
|
F1 Online User's Guide
|
||||||
Ctrl+F1 About WSJT-X
|
Ctrl+F1 About WSJT-X
|
||||||
F2 Open configuration window
|
F2 Open configuration window
|
||||||
F3 Display keyboard shortcuts
|
F3 Display keyboard shortcuts
|
||||||
F4 Clear DX Call, DX Grid, Tx messages 1-5
|
F4 Clear DX Call, DX Grid, Tx messages 1-5
|
||||||
Alt+F4 Exit program
|
Alt+F4 Exit program
|
||||||
F5 Display special mouse commands
|
F5 Display special mouse commands
|
||||||
F6 Open next file in directory
|
F6 Open next file in directory
|
||||||
Shift+F6 Decode all remaining files in directrory
|
Shift+F6 Decode all remaining files in directrory
|
||||||
F11 Move Rx frequency down 1 Hz
|
F11 Move Rx frequency down 1 Hz
|
||||||
Ctrl+F11 Move Rx and Tx frequencies down 1 Hz
|
Ctrl+F11 Move Rx and Tx frequencies down 1 Hz
|
||||||
F12 Move Rx frequency up 1 Hz
|
F12 Move Rx frequency up 1 Hz
|
||||||
Ctrl+F12 Move Rx and Tx frequencies up 1 Hz
|
Ctrl+F12 Move Rx and Tx frequencies up 1 Hz
|
||||||
Alt+1-6 Set now transmission to this number on Tab 1
|
Alt+1-6 Set now transmission to this number on Tab 1
|
||||||
Ctl+1-6 Set next transmission to this number on Tab 1
|
Ctl+1-6 Set next transmission to this number on Tab 1
|
||||||
Alt+D Decode again at QSO frequency
|
Alt+D Decode again at QSO frequency
|
||||||
Shift+D Full decode (both windows)
|
Shift+D Full decode (both windows)
|
||||||
Alt+E Erase
|
Alt+E Erase
|
||||||
Ctrl+F Edit the free text message box
|
Ctrl+F Edit the free text message box
|
||||||
Alt+G Generate standard messages
|
Alt+G Generate standard messages
|
||||||
Alt+H Halt Tx
|
Alt+H Halt Tx
|
||||||
Ctrl+L Lookup callsign in database, generate standard messages
|
Ctrl+L Lookup callsign in database, generate standard messages
|
||||||
Alt+M Monitor
|
Alt+M Monitor
|
||||||
Alt+N Enable Tx
|
Alt+N Enable Tx
|
||||||
Alt+Q Log QSO
|
Alt+Q Log QSO
|
||||||
Alt+S Stop monitoring
|
Alt+S Stop monitoring
|
||||||
Alt+T Tune
|
Alt+T Tune
|
||||||
Alt+V Save the most recently completed *.wav file
|
Alt+V Save the most recently completed *.wav file
|
||||||
|
Loading…
x
Reference in New Issue
Block a user