diff --git a/CMakeLists.txt b/CMakeLists.txt index a23cbfb..0e074f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -303,6 +303,7 @@ set (wsjtx_CXXSRCS astro.cpp messageaveraging.cpp WsprTxScheduler.cpp + varicode.cpp mainwindow.cpp Configuration.cpp main.cpp diff --git a/varicode.cpp b/varicode.cpp new file mode 100644 index 0000000..4f32466 --- /dev/null +++ b/varicode.cpp @@ -0,0 +1,24 @@ +#include "varicode.h" + +QString alphabet = {"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ+-./?"}; + +qint16 Varicode::unpack16bits(QString const& triple){ + int a = alphabet.indexOf(triple.at(0)); + int b = alphabet.indexOf(triple.at(1)); + int c = alphabet.indexOf(triple.at(2)); + return (41*41) * a + 41*b + c; +} + +QString Varicode::pack16bits(qint16 packed){ + QString out; + qint16 tmp = packed / (41*41); + out.append(alphabet.at(tmp)); + + tmp = (packed - (tmp * (41*41))) / 41; + out.append(alphabet.at(tmp)); + + tmp = packed % 41; + out.append(alphabet.at(tmp)); + + return out; +} diff --git a/varicode.h b/varicode.h new file mode 100644 index 0000000..b490c4d --- /dev/null +++ b/varicode.h @@ -0,0 +1,15 @@ +#ifndef VARICODE_H +#define VARICODE_H + +#include + +class Varicode +{ +public: + //Varicode(); + + qint16 unpack16bits(QString const& triple); + QString pack16bits(qint16 packed); +}; + +#endif // VARICODE_H diff --git a/wsjtx.pro b/wsjtx.pro index 277f876..b18a1e2 100644 --- a/wsjtx.pro +++ b/wsjtx.pro @@ -67,7 +67,8 @@ SOURCES += \ echoplot.cpp echograph.cpp fastgraph.cpp fastplot.cpp Modes.cpp \ WSPRBandHopping.cpp MessageAggregator.cpp SampleDownloader.cpp qt_helpers.cpp\ MultiSettings.cpp PhaseEqualizationDialog.cpp IARURegions.cpp MessageBox.cpp \ - EqualizationToolsDialog.cpp + EqualizationToolsDialog.cpp \ + varicode.cpp HEADERS += qt_helpers.hpp \ pimpl_h.hpp pimpl_impl.hpp \ @@ -84,7 +85,8 @@ HEADERS += qt_helpers.hpp \ messageaveraging.h echoplot.h echograph.h fastgraph.h fastplot.h Modes.hpp WSPRBandHopping.hpp \ WsprTxScheduler.h SampleDownloader.hpp MultiSettings.hpp PhaseEqualizationDialog.hpp \ IARURegions.hpp MessageBox.hpp EqualizationToolsDialog.hpp \ - qorderedmap.h + qorderedmap.h \ + varicode.h INCLUDEPATH += qmake_only