WSJT-X/EmulateSplitTransceiver.hpp
Bill Somerville 45b12e6028
Preparation for UI i18n
Re-enabling the WSJT-X i18n  facilities. This allows translation files
to  be created  for languages  that are  automatically used  to lookup
translatable strings. To enable a  new language the language name must
be added to the CMakeLists.txt LANGUAGES list variable in BCP47 format
(i.e. en_US,  en_GB, pt_PT, ...). Do  one build with the  CMake option
UPDATE_TRANSLATIONS enabled  (do not  leave it enabled  as there  is a
danger of loosing existing translated texts), that will create a fresh
translations/wsjtx_<lang>.ts file which  should be immediately checked
in with the  CMakeLists.txt change. The .ts should then  be updated by
the translator using  the Qt Linguist tool to  add translations. Check
in the  updated .ts file  to complete the initial  translation process
for that language.

To  aid translators  their WIP  .ts file  may be  tested by  releasing
(using the  lrelease tool or  from the Linguist  menu) a .qm  file and
placing  that  .qm  file  in the  current  directory  before  starting
WSJT-X. The translations will be used if the system locale matches the
file name.   If the system  locale does not  match the file  name; the
language may be  overridden by setting the  LANG environment variable.
For  example if  a wsjtx_pt_PT.qm  file  is in  the current  directory
WSJT-X will use it for  translation lookups, regardless of the current
system locale setting, if the LANG variable is set to pt_PT or pt-PT.

On MS Windows from a command prompt:

 set LANG=pt_PT
 C:\WSJT\wsjtx\bin\wsjtx

elsewhere:

 LANG=pt_PT wsjtx
2019-06-06 12:56:25 +01:00

54 lines
1.6 KiB
C++

#ifndef EMULATE_SPLIT_TRANSCEIVER_HPP__
#define EMULATE_SPLIT_TRANSCEIVER_HPP__
#include <memory>
#include "Transceiver.hpp"
//
// Emulate Split Transceiver
//
// Helper decorator class that encapsulates the emulation of split TX
// operation.
//
// Responsibilities
//
// Delegates all but setting of other (split) frequency to the
// wrapped Transceiver instance. Also routes failure signals from the
// wrapped Transceiver instance to this instances failure signal.
//
// Intercepts status updates from the wrapped Transceiver instance
// and re-signals it with the emulated status.
//
// Generates a status update signal if the other (split) frequency is
// changed, this is necessary since the wrapped transceiver instance
// never receives other frequency changes.
//
class EmulateSplitTransceiver final
: public Transceiver
{
Q_OBJECT
public:
// takes ownership of wrapped Transceiver
explicit EmulateSplitTransceiver (std::unique_ptr<Transceiver> wrapped,
QObject * parent = nullptr);
void set (TransceiverState const&,
unsigned sequence_number) noexcept override;
// forward everything else to wrapped Transceiver
void start (unsigned sequence_number) noexcept override {wrapped_->start (sequence_number);}
void stop () noexcept override {wrapped_->stop ();}
private:
void handle_update (TransceiverState const&, unsigned seqeunce_number);
std::unique_ptr<Transceiver> wrapped_;
Frequency rx_frequency_; // requested Rx frequency
Frequency tx_frequency_; // requested Tx frequency
bool split_; // requested split state
};
#endif