Add files via upload

1.0.0 v1.0.0
PianetaRadio 2022-03-12 20:09:26 +01:00 zatwierdzone przez GitHub
rodzic 10b606608f
commit 5a684f3947
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
29 zmienionych plików z 6271 dodań i 0 usunięć

51
CatRadio.pro 100644
Wyświetl plik

@ -0,0 +1,51 @@
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
dialogconfig.cpp \
dialogsetup.cpp \
guidata.cpp \
main.cpp \
mainwindow.cpp \
rigcommand.cpp \
rigdaemon.cpp \
rigdata.cpp \
smeter.cpp \
submeter.cpp \
vfodisplay.cpp
HEADERS += \
dialogconfig.h \
dialogsetup.h \
guidata.h \
mainwindow.h \
rigcommand.h \
rigdaemon.h \
rigdata.h \
smeter.h \
submeter.h \
vfodisplay.h
FORMS += \
dialogconfig.ui \
dialogsetup.ui \
mainwindow.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
LIBS += -L$$PWD/hamlib/ -llibhamlib
INCLUDEPATH += $$PWD/hamlib
VERSION = 1.0.0
RC_ICONS = catradio.ico

426
CatRadio.pro.user 100644
Wyświetl plik

@ -0,0 +1,426 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 5.0.1, 2022-02-21T12:02:32. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{3eda28a5-2ae6-4f98-9ee1-3326cb54ce82}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.PreferSingleLineComments">false</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="bool" key="EditorConfiguration.UseIndenter">false</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="QString" key="EditorConfiguration.ignoreFileTypes">*.md, *.MD, Makefile</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
<value type="bool" key="EditorConfiguration.skipTrailingWhitespace">true</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap">
<valuemap type="QVariantMap" key="AutoTest.ActiveFrameworks">
<value type="bool" key="AutoTest.Framework.Boost">true</value>
<value type="bool" key="AutoTest.Framework.CTest">false</value>
<value type="bool" key="AutoTest.Framework.Catch">true</value>
<value type="bool" key="AutoTest.Framework.GTest">true</value>
<value type="bool" key="AutoTest.Framework.QtQuickTest">true</value>
<value type="bool" key="AutoTest.Framework.QtTest">true</value>
</valuemap>
<valuemap type="QVariantMap" key="AutoTest.CheckStates"/>
<value type="int" key="AutoTest.RunAfterBuild">0</value>
<value type="bool" key="AutoTest.UseGlobal">true</value>
<valuelist type="QVariantList" key="ClangCodeModel.CustomCommandLineKey">
<value type="QString">-fno-delayed-template-parsing</value>
</valuelist>
<value type="bool" key="ClangCodeModel.UseGlobalConfig">true</value>
<value type="QString" key="ClangCodeModel.WarningConfigId">Builtin.BuildSystem</value>
<valuemap type="QVariantMap" key="ClangTools">
<value type="bool" key="ClangTools.AnalyzeOpenFiles">true</value>
<value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value>
<value type="QString" key="ClangTools.DiagnosticConfig">Builtin.DefaultTidyAndClazy</value>
<value type="int" key="ClangTools.ParallelJobs">4</value>
<valuelist type="QVariantList" key="ClangTools.SelectedDirs"/>
<valuelist type="QVariantList" key="ClangTools.SelectedFiles"/>
<valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/>
<value type="bool" key="ClangTools.UseGlobalSettings">true</value>
</valuemap>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="DeviceType">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.15.2 MinGW 32-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.15.2 MinGW 32-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5152.win32_mingw81_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\Johnny\Documents\QT\build-CatRadio-Desktop_Qt_5_15_2_MinGW_32_bit-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/Johnny/Documents/QT/build-CatRadio-Desktop_Qt_5_15_2_MinGW_32_bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\Johnny\Documents\QT\build-CatRadio-Desktop_Qt_5_15_2_MinGW_32_bit-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/Johnny/Documents/QT/build-CatRadio-Desktop_Qt_5_15_2_MinGW_32_bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="int" key="QtQuickCompiler">0</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\Johnny\Documents\QT\build-CatRadio-Desktop_Qt_5_15_2_MinGW_32_bit-Profile</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/Johnny/Documents/QT/build-CatRadio-Desktop_Qt_5_15_2_MinGW_32_bit-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="int" key="QtQuickCompiler">0</value>
<value type="int" key="SeparateDebugInfo">0</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">CatRadio2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/Users/Johnny/Documents/QT/CatRadio_1.0.0/CatRadio.pro</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">C:/Users/Johnny/Documents/QT/CatRadio_1.0.0/CatRadio.pro</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">C:/Users/Johnny/Documents/QT/build-CatRadio-Desktop_Qt_5_15_2_MinGW_32_bit-Debug</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.1</variable>
<valuemap type="QVariantMap">
<value type="QString" key="DeviceType">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 6.1.3 MinGW 64-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 6.1.3 MinGW 64-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt6.613.win64_mingw81_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\Johnny\Documents\QT\build-CatRadio-Desktop_Qt_6_1_3_MinGW_64_bit-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/Johnny/Documents/QT/build-CatRadio-Desktop_Qt_6_1_3_MinGW_64_bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\Johnny\Documents\QT\build-CatRadio-Desktop_Qt_6_1_3_MinGW_64_bit-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/Johnny/Documents/QT/build-CatRadio-Desktop_Qt_6_1_3_MinGW_64_bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="int" key="QtQuickCompiler">0</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="int" key="EnableQmlDebugging">0</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">C:\Users\Johnny\Documents\QT\build-CatRadio-Desktop_Qt_6_1_3_MinGW_64_bit-Profile</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">C:/Users/Johnny/Documents/QT/build-CatRadio-Desktop_Qt_6_1_3_MinGW_64_bit-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="int" key="QtQuickCompiler">0</value>
<value type="int" key="SeparateDebugInfo">0</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="CustomOutputParsers"/>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/Users/Johnny/Documents/QT/CatRadio/CatRadio.pro</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">C:/Users/Johnny/Documents/QT/CatRadio/CatRadio.pro</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">2</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">22</value>
</data>
<data>
<variable>Version</variable>
<value type="int">22</value>
</data>
</qtcreator>

1249
CatRadio.qss 100644

Plik diff jest za duży Load Diff

BIN
catradio.ico 100644

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 10 KiB

BIN
catradio.png 100644

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 2.7 KiB

115
dialogconfig.cpp 100644
Wyświetl plik

@ -0,0 +1,115 @@
/**
** This file is part of the CatRadio project.
** Copyright 2022 Gianfranco Sordetti IZ8EWD <iz8ewd@pianetaradio.it>.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
#include "dialogconfig.h"
#include "ui_dialogconfig.h"
#include <QSettings>
#include <QFile>
#include <QTextStream>
#include "rigdata.h"
#include <hamlib/rig.h>
extern rigConnect rigCom;
QString rigListFile = "rig.lst"; //Text file containing the list of rig supported by hamlib
QFile file(rigListFile);
DialogConfig::DialogConfig(QWidget *parent) :
QDialog(parent),
ui(new Ui::DialogConfig)
{
ui->setupUi(this);
//* rigModel comboBox
if (!file.exists()) //Create file rig.lst if not exists
{
file.open(QIODevice::ReadWrite);
rig_load_all_backends(); //Load all backends information
rig_list_foreach(printRigList, NULL); //Create the rig list
}
else file.open(QIODevice::ReadOnly); //Open file rig.lst and populate the combobox
file.seek(0);
ui->comboBox_rigModel->clear();
while(!file.atEnd())
{
QString line = file.readLine();
ui->comboBox_rigModel->addItem(line.trimmed());
}
file.close();
//* serialSpeed comboBox
ui->comboBox_serialSpeed->clear();
ui->comboBox_serialSpeed->addItem("4800");
ui->comboBox_serialSpeed->addItem("9600");
ui->comboBox_serialSpeed->addItem("19200");
ui->comboBox_serialSpeed->addItem("38400");
ui->comboBox_serialSpeed->addItem("57600");
ui->comboBox_serialSpeed->addItem("115200");
//* Update values in the GUI
ui->comboBox_rigModel->setCurrentIndex(ui->comboBox_rigModel->findText(QString::number(rigCom.rigModel),Qt::MatchStartsWith));
ui->lineEdit_RigPath->setText(rigCom.rigPort);
ui->comboBox_serialSpeed->setCurrentText(QString::number(rigCom.serialSpeed));
if (rigCom.civAddr) ui->lineEdit_civAddr->setText(QString::number(rigCom.civAddr));
ui->spinBox_RefreshRate->setValue(rigCom.rigRefresh);
ui->checkBox_fullPoll->setChecked(rigCom.fullPoll);
}
DialogConfig::~DialogConfig()
{
delete ui;
}
void DialogConfig::on_buttonBox_accepted()
{
//* Read settings from GUI
QString rigModel = ui->comboBox_rigModel->currentText();
QRegularExpression regexp("[0-9]+");
QRegularExpressionMatch rigNumber = regexp.match(rigModel);
rigCom.rigModel = rigNumber.captured(0).toInt();
rigCom.rigPort = ui->lineEdit_RigPath->text();
rigCom.serialSpeed = ui->comboBox_serialSpeed->currentText().toInt();
rigCom.civAddr = ui->lineEdit_civAddr->text().toInt();
rigCom.rigRefresh = ui->spinBox_RefreshRate->value();
rigCom.fullPoll = ui->checkBox_fullPoll->isChecked();
//* Save settings in config.ini
QSettings configFile(QString("config.ini"), QSettings::IniFormat);
configFile.setValue("rigModel", rigCom.rigModel);
configFile.setValue("rigPort", ui->lineEdit_RigPath->text());
configFile.setValue("serialSpeed", ui->comboBox_serialSpeed->currentText());
configFile.setValue("civAddress", ui->lineEdit_civAddr->text());
configFile.setValue("rigRefresh", ui->spinBox_RefreshRate->value());
configFile.setValue("fullPolling", ui->checkBox_fullPoll->isChecked());
}
int printRigList(const struct rig_caps *rigCaps, void *data) //Load rig list from hamlib and save into file rig.lst
{
if (data) return 0;
QTextStream stream(&file);
stream << rigCaps->rig_model << " " << rigCaps->mfg_name << " " << rigCaps->model_name << "\n";
return 1;
}

46
dialogconfig.h 100644
Wyświetl plik

@ -0,0 +1,46 @@
/**
** This file is part of the CatRadio project.
** Copyright 2022 Gianfranco Sordetti IZ8EWD <iz8ewd@pianetaradio.it>.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
#ifndef DIALOGCONFIG_H
#define DIALOGCONFIG_H
#include <QDialog>
namespace Ui {
class DialogConfig;
}
class DialogConfig : public QDialog
{
Q_OBJECT
public:
explicit DialogConfig(QWidget *parent = nullptr);
~DialogConfig();
private slots:
void on_buttonBox_accepted();
private:
Ui::DialogConfig *ui;
};
int printRigList(const struct rig_caps *rigCaps, void *data);
#endif // DIALOGCONFIG_H

164
dialogconfig.ui 100644
Wyświetl plik

@ -0,0 +1,164 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogConfig</class>
<widget class="QDialog" name="DialogConfig">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Config</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_RigModel">
<property name="text">
<string>Model</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBox_rigModel"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_RigPath">
<property name="text">
<string>Path</string>
</property>
<property name="buddy">
<cstring>lineEdit_RigPath</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit_RigPath"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_serialSpeed">
<property name="text">
<string>Speed</string>
</property>
<property name="buddy">
<cstring>comboBox_serialSpeed</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBox_serialSpeed"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_RefreshRate">
<property name="text">
<string>Refresh Rate</string>
</property>
<property name="buddy">
<cstring>spinBox_RefreshRate</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="spinBox_RefreshRate">
<property name="minimum">
<number>50</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="singleStep">
<number>50</number>
</property>
<property name="value">
<number>200</number>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Options</string>
</property>
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_civAddr">
<property name="text">
<string>CI-V Address</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="checkBox_fullPoll">
<property name="text">
<string>Full polling</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit_civAddr">
<property name="toolTip">
<string>CI-V address (decimal, Icom only)</string>
</property>
<property name="statusTip">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>lineEdit_RigPath</tabstop>
<tabstop>comboBox_serialSpeed</tabstop>
<tabstop>spinBox_RefreshRate</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>DialogConfig</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>DialogConfig</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

43
dialogsetup.cpp 100644
Wyświetl plik

@ -0,0 +1,43 @@
#include "dialogsetup.h"
#include "ui_dialogsetup.h"
#include "guidata.h"
#include <QSettings>
#include <QFile>
extern guiConfig guiConf;
DialogSetup::DialogSetup(QWidget *parent) :
QDialog(parent),
ui(new Ui::DialogSetup)
{
ui->setupUi(this);
if (guiConf.vfoDisplayMode) ui->radioButton_vfoDispMode_UD->setChecked(true);
}
DialogSetup::~DialogSetup()
{
delete ui;
}
void DialogSetup::on_radioButton_vfoDispMode_LR_toggled(bool checked)
{
if (checked) guiConf.vfoDisplayMode=0;
}
void DialogSetup::on_radioButton_vfoDispMode_UD_toggled(bool checked)
{
if (checked) guiConf.vfoDisplayMode=1;
}
void DialogSetup::on_buttonBox_accepted()
{
//* Save settings in config.ini
QSettings configFile(QString("config.ini"), QSettings::IniFormat);
configFile.setValue("vfoDisplayMode", guiConf.vfoDisplayMode);
}

31
dialogsetup.h 100644
Wyświetl plik

@ -0,0 +1,31 @@
#ifndef DIALOGSETUP_H
#define DIALOGSETUP_H
#include <QDialog>
namespace Ui {
class DialogSetup;
}
class DialogSetup : public QDialog
{
Q_OBJECT
public:
explicit DialogSetup(QWidget *parent = nullptr);
~DialogSetup();
private slots:
void on_radioButton_vfoDispMode_LR_toggled(bool checked);
void on_radioButton_vfoDispMode_UD_toggled(bool checked);
void on_buttonBox_accepted();
private:
Ui::DialogSetup *ui;
};
#endif // DIALOGSETUP_H

103
dialogsetup.ui 100644
Wyświetl plik

@ -0,0 +1,103 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DialogSetup</class>
<widget class="QDialog" name="DialogSetup">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Setup</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_vfoDisplayMode">
<property name="title">
<string>VFO Display Mode</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QRadioButton" name="radioButton_vfoDispMode_LR">
<property name="text">
<string>Left/Right buttons</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioButton_vfoDispMode_UD">
<property name="text">
<string>Up/Down click</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>DialogSetup</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>DialogSetup</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

22
guidata.cpp 100644
Wyświetl plik

@ -0,0 +1,22 @@
/**
** This file is part of the CatRadio project.
** Copyright 2022 Gianfranco Sordetti IZ8EWD <iz8ewd@pianetaradio.it>.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
#include "guidata.h"
guiConfig guiConf;

10
guidata.h 100644
Wyświetl plik

@ -0,0 +1,10 @@
#ifndef GUIDATA_H
#define GUIDATA_H
#endif // GUIDATA_H
typedef struct {
int vfoDisplayMode; //0: use Left/Right mouse button, 1: click digit up or down
} guiConfig;

43
main.cpp 100644
Wyświetl plik

@ -0,0 +1,43 @@
/**
** This file is part of the CatRadio project.
** Copyright 2022 Gianfranco Sordetti IZ8EWD <iz8ewd@pianetaradio.it>.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
#include "mainwindow.h"
#include <QApplication>
#include <QFile>
#include <QString>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
/*
QFile file("./CatRadio.qss"); //open qss file
//if(!file.open(QFile::ReadOnly))
file.open(QFile::ReadOnly);
QString styleSheet (file.readAll());
file.close();
a.setStyleSheet(styleSheet); //setup stylesheet
*/
w.show();
return a.exec();
}

839
mainwindow.cpp 100644
Wyświetl plik

@ -0,0 +1,839 @@
/**
** This file is part of the CatRadio project.
** Copyright 2022 Gianfranco Sordetti IZ8EWD <iz8ewd@pianetaradio.it>.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "dialogconfig.h"
#include "dialogsetup.h"
#include "rigdaemon.h"
#include "rigdata.h"
#include "guidata.h"
#include "rigcommand.h"
#include <QDebug>
#include <QMessageBox>
#include <QThread>
#include <QSettings>
#include <QString>
#include <rig.h> //Hamlib
extern RIG *my_rig; //Defined in rigdaemon.cpp
extern rigConnect rigCom;
extern rigSettings rigGet;
extern rigSettings rigSet;
extern rigCommand rigCmd;
extern rigCommand rigCap;
extern guiConfig guiConf;
int retcode; //Return code from function
int i; //Index
int prevDial; //Previous dial value
int fastDial; //Fast pushbutton state
FILE* debugFile;
QThread workerThread; //
RigDaemon *rigDaemon = new RigDaemon;
//***** MainWindow *****
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
timer = new QTimer(this); //timer for rigDaemon thread call
//* Debug
rig_set_debug_level(RIG_DEBUG_WARN);
rig_set_debug_time_stamp(true);
if ((debugFile=fopen("debug.log","w+")) == NULL) rig_set_debug_level(RIG_DEBUG_NONE);
else rig_set_debug_file(debugFile);
//* Signal and Slot connection for Slider and associated Label
connect(ui->horizontalSlider_RFpower, &QAbstractSlider::valueChanged, ui->label_RFpowerValue, qOverload<int>(&QLabel::setNum));
connect(ui->horizontalSlider_RFgain, &QAbstractSlider::valueChanged, ui->label_RFgainValue, qOverload<int>(&QLabel::setNum));
connect(ui->horizontalSlider_IFshift, &QAbstractSlider::valueChanged, ui->label_IFshiftValue, qOverload<int>(&QLabel::setNum));
//* Signal and Slot connection for vfoDisplay
connect(ui->lineEdit_vfoMain, &vfoDisplay::on_valueChanged, this, &MainWindow::on_vfoDisplayValueChanged);
//* Thread for RigDaemon
rigDaemon->moveToThread(&workerThread); //
connect(&workerThread, &QThread::finished, rigDaemon, &QObject::deleteLater);
connect(timer, &QTimer::timeout, rigDaemon, &RigDaemon::rigUpdate);
connect(rigDaemon, &RigDaemon::resultReady, this, &MainWindow::on_rigDaemonResultReady);
workerThread.start();
//* Load settings from config.ini
QSettings configFile(QString("config.ini"), QSettings::IniFormat);
rigCom.rigModel = configFile.value("rigModel", 0).toInt();
rigCom.rigPort = configFile.value("rigPort").toString();
rigCom.serialSpeed = configFile.value("serialSpeed", 9600).toInt();
rigCom.civAddr = configFile.value("civAddress", 0).toInt();
rigCom.rigRefresh = configFile.value("rigRefresh", 100).toInt();
rigCom.fullPoll = configFile.value("fullPolling", false).toBool();
guiConf.vfoDisplayMode = configFile.value("vfoDisplayMode", 0).toInt();
}
MainWindow::~MainWindow()
{
workerThread.quit(); //
workerThread.wait();
if (rigCom.connected)
{
timer->stop();
rigCom.connected = 0;
rig_close(my_rig); //Close the communication to the rig
}
rig_cleanup(my_rig); //Release rig handle and free associated memory
fclose(debugFile); //Close debug.log
delete ui;
}
//***** GUI function *****
void MainWindow::guiInit()
{
ui->statusbar->showMessage(my_rig->caps->model_name);
if (rig_has_set_func(my_rig, RIG_FUNCTION_SET_POWERSTAT)==0) //Power pushbutton
{
ui->pushButton_Power->setDisabled(true);
rigCap.onoff = 0;
}
else
{
ui->pushButton_Power->setDisabled(false);
rigCap.onoff = 1;
}
if (rig_has_set_func(my_rig, RIG_FUNCTION_SET_PTT)==0) //PTT pushbutton
{
ui->pushButton_PTT->setDisabled(true);
rigCap.ptt = 0;
}
else
{
ui->pushButton_PTT->setDisabled(false);
rigCap.ptt = 1;
}
//* Mode combobox
if (my_rig->state.mode_list==RIG_MODE_NONE)
{
ui->comboBox_Mode->setDisabled(true);
ui->comboBox_ModeSub->setDisabled(true);
}
else
{
ui->comboBox_Mode->clear(); //Clear old contents
ui->comboBox_ModeSub->clear();
for (i=0; i<HAMLIB_MAX_MODES; i++)
{
if (my_rig->state.mode_list & (1ULL << i))
{
ui->comboBox_Mode->addItem(rig_strrmode(my_rig->state.mode_list & (1ULL << i)));
ui->comboBox_ModeSub->addItem(rig_strrmode(my_rig->state.mode_list & (1ULL << i)));
}
}
rigCmd.bwidthList = 1; //Command to populate BW combobox in guiUpdate()
}
//* AGC level comboBox
ui->comboBox_AGC->clear();
/* It seems that has_set_level or has_get_level is not well implemented in Hamlib, at the moment it is skipped in favour of fix values entry
agc_level_e agcLevel;
for (i = 0; i < 7; i++)
{
agcLevel = levelagcvalue(i);
if (rig_has_set_level(my_rig, agcLevel))
{
ui->comboBox_AGC->addItem(rig_stragclevel(agcLevel));
}
}*/
ui->comboBox_AGC->addItem(rig_stragclevel(RIG_AGC_OFF));
ui->comboBox_AGC->addItem(rig_stragclevel(RIG_AGC_AUTO));
ui->comboBox_AGC->addItem(rig_stragclevel(RIG_AGC_FAST));
ui->comboBox_AGC->addItem(rig_stragclevel(RIG_AGC_MEDIUM));
ui->comboBox_AGC->addItem(rig_stragclevel(RIG_AGC_SLOW));
//* Meter comboBox
ui->comboBox_Meter->clear();
if (rig_has_get_level(my_rig, RIG_METER_SWR)) ui->comboBox_Meter->addItem("SWR");
if (rig_has_get_level(my_rig, RIG_METER_ALC)) ui->comboBox_Meter->addItem("ALC");
rigSet.meter = levelmeterstr (ui->comboBox_Meter->currentText());
setSubMeter();
//* Attenuator comboBox
ui->comboBox_Att->clear();
ui->comboBox_Att->addItem("0");
for (i = 0; i < HAMLIB_MAXDBLSTSIZ && my_rig->state.attenuator[i] != 0; i++)
{
ui->comboBox_Att->addItem(QString::number(my_rig->state.attenuator[i]));
}
//* Preamp comboBox
ui->comboBox_Preamp->clear();
ui->comboBox_Preamp->addItem("0");
for (i = 0; i < HAMLIB_MAXDBLSTSIZ && my_rig->state.preamp[i] != 0; i++)
{
ui->comboBox_Preamp->addItem(QString::number(my_rig->state.preamp[i]));
}
rigCmd.rangeList = 1;
rigCmd.antList = 1;
}
void MainWindow::guiUpdate()
{
//* Power button
if (rigGet.onoff == RIG_POWER_ON) ui->pushButton_Power->setChecked(true);
//* VFOs
ui->lineEdit_vfoMain->setValue(rigGet.freqMain);
ui->lineEdit_vfoSub->setText(QString::number(rigGet.freqSub/1000,'f',2));
ui->label_vfoMain->setText(rig_strvfo(rigGet.vfoMain));
switch (rigGet.vfoMain)
{
case RIG_VFO_A: rigGet.vfoSub = RIG_VFO_B; break;
case RIG_VFO_B: rigGet.vfoSub = RIG_VFO_A; break;
case RIG_VFO_MAIN: rigGet.vfoSub = RIG_VFO_SUB; break;
case RIG_VFO_SUB: rigGet.vfoSub = RIG_VFO_MAIN; break;
}
ui->label_vfoSub->setText(rig_strvfo(rigGet.vfoSub));
//* Mode
ui->comboBox_Mode->setCurrentText(rig_strrmode(rigGet.mode));
ui->comboBox_ModeSub->setCurrentText(rig_strrmode(rigGet.modeSub));
//* BW combobox
if (rigCmd.bwidthList)
{
ui->comboBox_BW->clear();
filter_list bwidth_list; //IF filter bandwidth per mode
for (i=0; i<HAMLIB_FLTLSTSIZ && !RIG_IS_FLT_END(my_rig->state.filters[i]); i++)
{
char modeslist[1000] = "";
QString modes, mode;
bwidth_list = my_rig->state.filters[i];
rig_strrmodes(bwidth_list.modes, modeslist, sizeof(modeslist));
modes = modeslist;
modes.append(" ");
//qDebug() << modes << bwidth_list.width;
mode = rig_strrmode(rigGet.mode);
QRegularExpression rx("\\b"+mode+"?\\s");
if (modes.contains (rx) && bwidth_list.width != RIG_FLT_ANY) ui->comboBox_BW->addItem(QString::number(bwidth_list.width));
}
ui->comboBox_BW->model()->sort(0, Qt::DescendingOrder);
rigCmd.bwidthList = 0;
}
ui->comboBox_BW->setCurrentText(QString::number(rigGet.bwidth));
ui->checkBox_NAR->setChecked(rigGet.bwNarrow);
//* Range list
if (rigCmd.rangeList)
{
for (i=0; i<HAMLIB_FRQRANGESIZ; i++)
{
if (rigGet.freqMain >= my_rig->state.tx_range_list[i].startf && rigGet.freqMain <= my_rig->state.tx_range_list[i].endf) break;
}
rigGet.rangeListTxIndex = i;
for (i=0; i<HAMLIB_FRQRANGESIZ; i++)
{
if (rigGet.freqMain >= my_rig->state.rx_range_list[i].startf && rigGet.freqMain <= my_rig->state.rx_range_list[i].endf) break;
}
if (rigGet.rangeListRxIndex != i) rigCmd.antList = 1;
rigGet.rangeListRxIndex = i;
rigCmd.rangeList = 0;
}
//* Antenna comboBox
if (rigCmd.antList)
{
ui->comboBox_Ant->clear();
if (my_rig->state.tx_range_list[rigGet.rangeListRxIndex].ant == RIG_ANT_NONE) ui->comboBox_Ant->addItem("NONE"); //RIG_ANT_NONE
else for (i=0; i < RIG_ANT_MAX; i++)
{
if (my_rig->state.tx_range_list[rigGet.rangeListRxIndex].ant & (1UL << i))
{
switch (i)
{
case 0: ui->comboBox_Ant->addItem("ANT1"); break; //RIG_ANT_1
case 1: ui->comboBox_Ant->addItem("ANT2"); break; //RIG_ANT_2
case 2: ui->comboBox_Ant->addItem("ANT3"); break; //RIG_ANT_3
case 3: ui->comboBox_Ant->addItem("ANT4"); break; //RIG_ANT_4
case 4: ui->comboBox_Ant->addItem("ANT5"); break; //RIG_ANT_5
case 30: ui->comboBox_Ant->addItem("UNK"); break; //RIG_ANT_UNKNOWN
case 31: ui->comboBox_Ant->addItem("CURR"); break; //RIG_ANT_CURR
default: ui->comboBox_Ant->addItem("UNK"); break;
}
}
}
rigCmd.antList = 0;
}
//* Split
if (rigGet.split == RIG_SPLIT_ON)
{
ui->pushButton_Split->setChecked(true);
if (rigGet.vfoSub == rigGet.vfoTx)
{
ui->label_vfoMainRxTx->setText("RX");
ui->label_vfoSubRxTx->setText("TX");
}
else
{
ui->label_vfoMainRxTx->setText("TX");
ui->label_vfoSubRxTx->setText("RX");
}
}
else
{
ui->pushButton_Split->setChecked(false);
ui->label_vfoMainRxTx->setText("RX TX");
ui->label_vfoSubRxTx->setText("");
}
//* PTT & Meter
if (rigGet.ptt == RIG_PTT_ON)
{
ui->pushButton_PTT->setChecked(true);
ui->progressBar_Smeter->setTx(true);
ui->progressBar_Smeter->setValue(rigGet.powerMeter.f*100);
ui->progressBar_subMeter->setValue(rigGet.subMeter.f);
}
else
{
ui->pushButton_PTT->setChecked(false);
ui->progressBar_Smeter->setTx(false);
ui->progressBar_Smeter->setValue(rigGet.sMeter.i);
if (rigSet.meter == RIG_LEVEL_SWR) ui->progressBar_subMeter->setValue(1.0);
else ui->progressBar_subMeter->setValue(0.0);
}
//*
if (!ui->horizontalSlider_RFpower->isSliderDown()) ui->horizontalSlider_RFpower->setValue((int)(rigGet.rfPower*100));
//*
ui->radioButton_Tuner->setChecked(rigGet.tuner);
ui->checkBox_BKIN->setChecked(rigGet.bkin);
ui->comboBox_AGC->setCurrentText(rig_stragclevel(rigGet.agc));
ui->comboBox_Att->setCurrentText(QString::number(rigGet.att));
ui->comboBox_Preamp->setCurrentText(QString::number(rigGet.pre));
}
//* RigDaemon handle results
void MainWindow::on_rigDaemonResultReady()
{
guiUpdate();
}
//* SubMeter
void MainWindow::setSubMeter()
{
if (rigSet.meter == RIG_LEVEL_SWR)
{
ui->progressBar_subMeter->setMaxValue(5.0);
ui->progressBar_subMeter->setMinValue(1.0);
ui->progressBar_subMeter->setGateValue(2.0);
ui->progressBar_subMeter->setPrecision(1);
ui->progressBar_subMeter->setLongStep(0.5);
ui->progressBar_subMeter->setShortStep(0.1);
ui->progressBar_subMeter->setValue(1);
}
else
{
ui->progressBar_subMeter->setMaxValue(1.0);
ui->progressBar_subMeter->setMinValue(0.0);
ui->progressBar_subMeter->setGateValue(0.5);
ui->progressBar_subMeter->setPrecision(1);
ui->progressBar_subMeter->setLongStep(0.5);
ui->progressBar_subMeter->setShortStep(0.1);
ui->progressBar_subMeter->setValue(0);
}
}
//***** PushButton *****
void MainWindow::on_pushButton_Connect_toggled(bool checked)
{
if (checked && rigCom.connected == 0)
{
retcode = rigDaemon->rigConnect(); //Open Rig connection
if (retcode != RIG_OK) //Connection error
{
rigCom.connected = 0;
ui->statusbar->showMessage(rigerror(retcode));
ui->pushButton_Connect->setChecked(false); //Uncheck the button
}
else //Rig connected
{
rigCom.connected = 1;
guiInit();
if (rigCap.onoff == 0 || rigGet.onoff == RIG_POWER_ON) timer->start(rigCom.rigRefresh);
}
}
else if (rigCom.connected) //Button unchecked
{
rigCom.connected = 0;
timer->stop();
rig_close(my_rig); //Close the communication to the rig
//rig_cleanup(my_rig); //Release rig handle and free associated memory
}
}
void MainWindow::on_pushButton_Power_toggled(bool checked)
{
if (checked && !rigGet.onoff)
{
retcode = rig_set_powerstat(my_rig, RIG_POWER_ON);
if (retcode != RIG_OK)
{
ui->pushButton_Power->setChecked(false); //Uncheck the button
ui->statusbar->showMessage(rigerror(retcode));
}
else timer->start(rigCom.rigRefresh);
}
else if (!checked && rigGet.onoff)
{
retcode = rig_set_powerstat(my_rig, RIG_POWER_OFF);
if (retcode != RIG_OK)
{
ui->pushButton_Power->setChecked(false); //Uncheck the button
timer->stop();
}
}
}
void MainWindow::on_pushButton_PTT_toggled(bool checked)
{
if (checked && !rigGet.ptt)
{
rigSet.ptt = RIG_PTT_ON;
rigCmd.ptt = 1;
}
else if (!checked && rigGet.ptt)
{
rigSet.ptt = RIG_PTT_OFF;
rigCmd.ptt = 1;
}
}
void MainWindow::on_pushButton_Split_toggled(bool checked)
{
if (checked && !rigGet.split)
{
rigSet.split = RIG_SPLIT_ON;
rigCmd.split = 1;
}
else if (!checked && rigGet.split)
{
rigSet.split = RIG_SPLIT_OFF;
rigCmd.split = 1;
}
}
void MainWindow::on_pushButton_QSplit_clicked()
{
quick_split();
}
void MainWindow::on_pushButton_AB_clicked()
{
rigCmd.vfoXchange = 1;
}
void MainWindow::on_pushButton_AeqB_clicked()
{
rigCmd.vfoCopy = 1;
}
void MainWindow::on_pushButton_Fast_toggled(bool checked)
{
if (checked) fastDial = 1;
else fastDial = 0;
}
void MainWindow::on_pushButton_Tune_clicked()
{
rigCmd.tune = 1;
}
void MainWindow::on_pushButton_Band160_clicked()
{
set_band(160);
}
void MainWindow::on_pushButton_Band80_clicked()
{
set_band(80);
}
void MainWindow::on_pushButton_Band60_clicked()
{
set_band(60);
}
void MainWindow::on_pushButton_Band40_clicked()
{
set_band(40);
}
void MainWindow::on_pushButton_Band30_clicked()
{
set_band(30);
}
void MainWindow::on_pushButton_Band20_clicked()
{
set_band(20);
}
void MainWindow::on_pushButton_Band17_clicked()
{
set_band(17);
}
void MainWindow::on_pushButton_Band15_clicked()
{
set_band(15);
}
void MainWindow::on_pushButton_Band12_clicked()
{
set_band(12);
}
void MainWindow::on_pushButton_Band10_clicked()
{
set_band(10);
}
void MainWindow::on_pushButton_Band6_clicked()
{
set_band(6);
}
void MainWindow::on_pushButton_Band2_clicked()
{
set_band(2);
}
void MainWindow::on_pushButton_Band70_clicked()
{
set_band(70);
}
void MainWindow::on_pushButton_BandGen_clicked()
{
set_band(1);
}
void MainWindow::on_pushButton_BandDown_clicked()
{
rigCmd.bandDown = 1;
}
void MainWindow::on_pushButton_BandUp_clicked()
{
rigCmd.bandUp = 1;
}
//***** CheckBox *****
void MainWindow::on_checkBox_NAR_toggled(bool checked)
{
if (checked && !rigGet.bwNarrow)
{
rigSet.bwidth = rig_passband_narrow(my_rig, rigGet.mode);
rigCmd.bwidth = 1;
}
else if (!checked && rigGet.bwNarrow)
{
rigSet.bwidth = RIG_PASSBAND_NORMAL;
rigCmd.bwidth = 1;
}
}
void MainWindow::on_checkBox_BKIN_toggled(bool checked)
{
if (checked && !rigGet.bkin)
{
rigSet.bkin = 1;
rigCmd.bkin = 1;
}
else if (!checked && rigGet.bkin)
{
rigSet.bkin = 0;
rigCmd.bkin = 1;
}
}
void MainWindow::on_checkBox_NB_toggled(bool checked)
{
if (checked && !rigGet.noiseBlanker)
{
rigSet.noiseBlanker = 1;
rigCmd.noiseBlanker = 1;
}
else if (!checked && rigGet.noiseBlanker)
{
rigSet.noiseBlanker = 0;
rigCmd.noiseBlanker = 1;
}
}
void MainWindow::on_checkBox_NR_toggled(bool checked)
{
if (checked && !rigGet.noiseReduction)
{
rigSet.noiseReduction = 1;
rigCmd.noiseReduction = 1;
}
else if (!checked && rigGet.noiseReduction)
{
rigSet.noiseReduction = 0;
rigCmd.noiseReduction = 1;
}
}
void MainWindow::on_checkBox_NF_toggled(bool checked)
{
if (checked && !rigGet.notchFilter)
{
rigSet.notchFilter = 1;
rigCmd.notchFilter = 1;
}
else if (!checked && rigGet.notchFilter)
{
rigSet.notchFilter = 0;
rigCmd.notchFilter = 1;
}
}
//***** RadioButton *****
void MainWindow::on_radioButton_Tuner_toggled(bool checked)
{
if (checked && !rigGet.tuner)
{
rigSet.tuner = 1;
rigCmd.tuner = 1;
}
else if (!checked && rigGet.tuner)
{
rigSet.tuner = 0;
rigCmd.tuner = 1;
}
}
//***** Dial *****
void MainWindow::on_dial_valueChanged(int value)
{
int step;
step = value - prevDial;
if (step<=99 && step>50) step = value - 100 - prevDial;
if (step>=-99 && step<-50) step = value + 100 - prevDial;
prevDial = value;
if (ui->radioButton_VFOSub->isChecked()) //dial VFO Sub
{
rigSet.freqSub = rigGet.freqSub + step*(!fastDial*10+fastDial*100);
rigCmd.freqSub = 1;
}
else //dial VFO Main
{
rigSet.freqMain = rigGet.freqMain + step*(!fastDial*10+fastDial*100);
rigCmd.freqMain = 1;
}
}
void MainWindow::on_vfoDisplayValueChanged(int value)
{
rigSet.freqMain = value;
rigCmd.freqMain = 1;
}
//***** ComboBox *****
void MainWindow::on_comboBox_Mode_activated(int index)
{
rigSet.mode = rig_parse_mode(ui->comboBox_Mode->itemText(index).toLatin1());
rigCmd.mode = 1;
}
void MainWindow::on_comboBox_BW_activated(int index)
{
rigSet.bwidth = ui->comboBox_BW->itemText(index).toInt();
rigCmd.bwidth = 1;
}
void MainWindow::on_comboBox_AGC_activated(int index)
{
rigSet.agc = levelagcstr(ui->comboBox_AGC->itemText(index));
rigCmd.agc = 1;
}
void MainWindow::on_comboBox_Att_activated(int index)
{
rigSet.att = ui->comboBox_Att->itemText(index).toInt();
rigCmd.att = 1;
}
void MainWindow::on_comboBox_Preamp_activated(int index)
{
rigSet.pre = ui->comboBox_Preamp->itemText(index).toInt();
rigCmd.pre = 1;
}
void MainWindow::on_comboBox_Ant_activated(int index)
{
rigSet.ant = antstr(ui->comboBox_Ant->itemText(index));
rigCmd.ant = 1;
}
void MainWindow::on_comboBox_Meter_activated(int index)
{
rigSet.meter = levelmeterstr (ui->comboBox_Meter->itemText(index));
setSubMeter();
}
//***** Spin Box *****
void MainWindow::on_spinBox_NR_valueChanged(int arg1)
{
rigSet.noiseReductionLevel = arg1;
rigCmd.noiseReductionLevel = 1;
}
//***** Slider *****
void MainWindow::on_horizontalSlider_RFpower_valueChanged(int value)
{
if (!rigCmd.rfPower)
{
if (value < 5) value = 5;
rigSet.rfPower = (float)(value)/100;
if (rigSet.rfPower != rigGet.rfPower) rigCmd.rfPower = 1;
}
}
void MainWindow::on_horizontalSlider_RFgain_valueChanged(int value)
{
if (!rigCmd.rfGain)
{
rigSet.rfGain = (float)(value)/100;
if (rigSet.rfGain != rigGet.rfGain) rigCmd.rfGain = 1;
}
}
void MainWindow::on_horizontalSlider_IFshift_valueChanged(int value)
{
if (!rigCmd.ifShift)
{
rigSet.ifShift = value;
if (rigSet.ifShift != rigGet.ifShift) rigCmd.ifShift = 1;
}
}
//***** Menu *****
void MainWindow::on_action_Connection_triggered()
{
DialogConfig config;
config.setModal(true);
config.exec();
}
void MainWindow::on_action_Setup_triggered()
{
DialogSetup setup;
setup.setModal(true);
setup.exec();
}
void MainWindow::on_action_AboutCatRadio_triggered()
{
QMessageBox msgBox;
msgBox.setWindowTitle("About");
msgBox.setTextFormat(Qt::RichText);
QString version = QString::number(VERSION_MAJ)+"."+QString::number(VERSION_MIN)+"."+QString::number(VERSION_MIC);
msgBox.setText("<b>CatRadio</b> <i>Radio control software</i><br/>version "+version+" "+RELEASE_DATE);
msgBox.setInformativeText("Copyright (C) 2022 Gianfranco Sordetti IZ8EWD<br/>"
"<a href='https://www.pianetaradio.it'>www.pianetaradio.it</a></p>"
"<p>This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.<br/>"
"This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.<br/>"
"You should have received a copy of the GNU General Public License along with this program. If not, see <a href='http://www.gnu.org/licenses/'>www.gnu.org/licenses</a>.");
msgBox.setIcon(QMessageBox::NoIcon);
msgBox.setStandardButtons(QMessageBox::Ok);
QPixmap icon("catradio.png");
msgBox.setIconPixmap(icon);
msgBox.exec();
}
void MainWindow::on_action_AboutQT_triggered()
{
QMessageBox::aboutQt(this);
}
void MainWindow::on_action_AboutHamLib_triggered()
{
QMessageBox msgBox;
msgBox.setWindowTitle("About Hamlib");
msgBox.setText(rig_version());
msgBox.setInformativeText(rig_copyright());
//msgBox.setDetailedText(rig_license());
msgBox.setIcon(QMessageBox::Information);
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.exec();
}

153
mainwindow.h 100644
Wyświetl plik

@ -0,0 +1,153 @@
/**
** This file is part of the CatRadio project.
** Copyright 2022 Gianfranco Sordetti IZ8EWD <iz8ewd@pianetaradio.it>.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QTimer>
#define RELEASE_DATE __DATE__
#define VERSION_MAJ 1
#define VERSION_MIN 0
#define VERSION_MIC 0
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
public slots:
void guiUpdate();
void on_rigDaemonResultReady(); //Slot for rigDaemon resultReady
void on_vfoDisplayValueChanged(int value); //Slot for vfoDisplay valueChanged
signals:
private slots:
void on_pushButton_Connect_toggled(bool checked);
void on_pushButton_Power_toggled(bool checked);
void on_pushButton_PTT_toggled(bool checked);
void on_pushButton_Split_toggled(bool checked);
void on_pushButton_AB_clicked();
void on_pushButton_AeqB_clicked();
void on_dial_valueChanged(int value);
void on_action_AboutQT_triggered();
void on_action_AboutHamLib_triggered();
void on_comboBox_Mode_activated(int index);
void on_pushButton_Fast_toggled(bool checked);
void on_horizontalSlider_RFpower_valueChanged(int value);
void on_pushButton_Band160_clicked();
void on_pushButton_Band80_clicked();
void on_pushButton_Band60_clicked();
void on_pushButton_Band40_clicked();
void on_pushButton_Band30_clicked();
void on_pushButton_Band20_clicked();
void on_pushButton_Band17_clicked();
void on_pushButton_Band15_clicked();
void on_pushButton_Band12_clicked();
void on_pushButton_Band10_clicked();
void on_pushButton_Band6_clicked();
void on_pushButton_Tune_clicked();
void on_radioButton_Tuner_toggled(bool checked);
void on_pushButton_BandDown_clicked();
void on_pushButton_BandUp_clicked();
void on_pushButton_QSplit_clicked();
void on_action_Connection_triggered();
void on_comboBox_BW_activated(int index);
void on_checkBox_NAR_toggled(bool checked);
void on_checkBox_BKIN_toggled(bool checked);
void on_comboBox_AGC_activated(int index);
void on_comboBox_Att_activated(int index);
void on_comboBox_Preamp_activated(int index);
void on_comboBox_Ant_activated(int index);
void on_action_AboutCatRadio_triggered();
void on_checkBox_NB_toggled(bool checked);
void on_checkBox_NR_toggled(bool checked);
void on_checkBox_NF_toggled(bool checked);
void on_comboBox_Meter_activated(int index);
void on_horizontalSlider_RFgain_valueChanged(int value);
void on_spinBox_NR_valueChanged(int arg1);
void on_horizontalSlider_IFshift_valueChanged(int value);
void on_pushButton_Band2_clicked();
void on_pushButton_Band70_clicked();
void on_pushButton_BandGen_clicked();
void on_action_Setup_triggered();
private:
Ui::MainWindow *ui;
QTimer *timer;
void guiInit();
void setSubMeter();
};
#endif // MAINWINDOW_H

1353
mainwindow.ui 100644

Plik diff jest za duży Load Diff

153
rigcommand.cpp 100644
Wyświetl plik

@ -0,0 +1,153 @@
/**
** This file is part of the CatRadio project.
** Copyright 2022 Gianfranco Sordetti IZ8EWD <iz8ewd@pianetaradio.it>.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
#include "rigcommand.h"
#include "rigdata.h"
#include <rig.h> //Hamlib
#include <QDebug>
extern rigSettings rigGet;
extern rigSettings rigSet;
extern rigCommand rigCmd;
extern rigCommand rigCap;
void set_band (int band)
{
freq_t freq;
switch (band)
{
case 160: freq = 1840000; break;
case 80: freq = 3600000; break;
case 60: freq = 5355000; break;
case 40: freq = 7100000; break;
case 30: freq = 10130000; break;
case 20: freq = 14100000; break;
case 17: freq = 18120000; break;
case 15: freq = 21150000; break;
case 12: freq = 24940000; break;
case 10: freq = 28320000; break;
case 6: freq = 50150000; break;
case 2: freq = 144300000; break;
case 70: freq = 432200000; break;
default: freq = rigSet.freqMain; break;
}
rigSet.freqMain = freq;
rigCmd.freqMain = 1;
rigCmd.bandChange = 1;
}
void quick_split ()
{
if (rigGet.vfoMain == RIG_VFO_A)
{
rigSet.freqSub = rigGet.freqMain + 5000;
//rigSet.modeSub = rigGet.modeMain;
rigCmd.freqSub = 1;
//rigCmd.modeSub = 1;
}
else
{
rigSet.freqMain = rigGet.freqSub + 5000;
rigCmd.freqMain = 1;
}
rigCmd.split = 1;
}
agc_level_e levelagcvalue (int agcValue)
{
agc_level_e agcLevel;
switch (agcValue)
{
case 0: agcLevel = RIG_AGC_OFF; break;
case 1: agcLevel = RIG_AGC_SUPERFAST; break;
case 2: agcLevel = RIG_AGC_FAST; break;
case 3: agcLevel = RIG_AGC_SLOW; break;
case 4: agcLevel = RIG_AGC_USER; break;
case 5: agcLevel = RIG_AGC_MEDIUM; break;
case 6: agcLevel = RIG_AGC_AUTO; break;
default: agcLevel = RIG_AGC_AUTO; break;
}
return agcLevel;
}
agc_level_e levelagcstr (QString agcString)
{
agc_level_e agcLevel;
if (agcString == "OFF") agcLevel = RIG_AGC_OFF;
else if (agcString == "SUPERFAST") agcLevel = RIG_AGC_SUPERFAST;
else if (agcString == "FAST") agcLevel = RIG_AGC_FAST;
else if (agcString == "SLOW") agcLevel = RIG_AGC_SLOW;
else if (agcString == "USER") agcLevel = RIG_AGC_USER;
else if (agcString == "MEDIUM") agcLevel = RIG_AGC_MEDIUM;
else agcLevel = RIG_AGC_AUTO;
return agcLevel;
}
value_t valueagclevel (agc_level_e agcLevel)
{
value_t value;
if (agcLevel == RIG_AGC_OFF) value.i = 0;
else if (agcLevel == RIG_AGC_SUPERFAST) value.i = 1;
else if (agcLevel == RIG_AGC_FAST) value.i = 2;
else if (agcLevel == RIG_AGC_SLOW) value.i = 3;
else if (agcLevel == RIG_AGC_USER) value.i = 4;
else if (agcLevel == RIG_AGC_MEDIUM) value.i = 5;
else value.i = 6; //RIG_AGC_AUTO
return value;
}
ant_t antstr (QString antString)
{
ant_t ant;
if (antString == "NONE") ant = RIG_ANT_NONE;
else if (antString == "ANT1") ant = RIG_ANT_1;
else if (antString == "ANT2") ant = RIG_ANT_2;
else if (antString == "ANT3") ant = RIG_ANT_3;
else if (antString == "ANT4") ant = RIG_ANT_4;
else if (antString == "ANT5") ant = RIG_ANT_5;
else if (antString == "UNK") ant = RIG_ANT_UNKNOWN;
else if (antString == "CURR") ant = RIG_ANT_CURR;
else ant = RIG_ANT_UNKNOWN;
return ant;
}
unsigned levelmeterstr (QString meterString)
{
unsigned levelMeter;
if (meterString == "SWR") levelMeter = RIG_LEVEL_SWR;
else if (meterString == "COMP") levelMeter = RIG_LEVEL_COMP;
else if (meterString == "ALC") levelMeter = RIG_LEVEL_ALC;
//...
else levelMeter = RIG_METER_NONE;
return levelMeter;
}

36
rigcommand.h 100644
Wyświetl plik

@ -0,0 +1,36 @@
/**
** This file is part of the CatRadio project.
** Copyright 2022 Gianfranco Sordetti IZ8EWD <iz8ewd@pianetaradio.it>.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
#ifndef RIGCOMMAND_H
#define RIGCOMMAND_H
#endif // RIGCOMMAND_H
#include <QString>
#include <rig.h>
void set_band (int band);
void quick_split ();
agc_level_e levelagcvalue (int agcValue);
agc_level_e levelagcstr (QString agcString);
value_t valueagclevel (agc_level_e agcLevel);
ant_t antstr (QString antString);
unsigned levelmeterstr (QString meterString);

424
rigdaemon.cpp 100644
Wyświetl plik

@ -0,0 +1,424 @@
/**
** This file is part of the CatRadio project.
** Copyright 2022 Gianfranco Sordetti IZ8EWD <iz8ewd@pianetaradio.it>.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
#include "rigdaemon.h"
#include "rigdata.h"
#include "rigcommand.h"
#include <QThread>
#include <QDebug>
#include <QMessageBox>
#include <rig.h>
RIG *my_rig;
extern rigConnect rigCom;
extern rigSettings rigGet;
extern rigSettings rigSet;
extern rigCommand rigCmd;
extern rigCommand rigCap;
int commandPriority = 0;
RigDaemon::RigDaemon(QObject *parent) : QObject(parent)
{
}
int RigDaemon::rigConnect()
{
int retcode;
my_rig = rig_init(rigCom.rigModel); //Allocate rig handle
if (!my_rig) //Wrong Rig number
{
QMessageBox msgBox; //Show error MessageBox
msgBox.setWindowTitle("Warning");
msgBox.setText("Rig model error");
msgBox.setIcon(QMessageBox::Warning);
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.exec();
return -1; //RIG_EINVAL, Invalid parameter
}
else
{
if (rigCom.rigModel == 2) //Rigctld
{
//myport.type.rig = RIG_PORT_NETWORK;
strncpy(my_rig->state.rigport.pathname, rigCom.rigPort.toLatin1(), HAMLIB_FILPATHLEN - 1);
//strncpy(my_rig->state.rigport.pathname, RIG_FILE, HAMLIB_FILPATHLEN - 1);
}
else
{
//myport.type.rig = RIG_PORT_SERIAL;
strncpy(my_rig->state.rigport.pathname, rigCom.rigPort.toLatin1(), HAMLIB_FILPATHLEN - 1);
my_rig->state.rigport.parm.serial.rate = rigCom.serialSpeed;
if (rigCom.civAddr) //CI-V address Icom
{
std::string civaddrS = std::to_string(rigCom.civAddr); //Convert int to string
char const *civaddr = civaddrS.c_str(); //Convert string to char*
rig_set_conf(my_rig, rig_token_lookup(my_rig, "civaddr"), civaddr);
}
}
retcode = rig_open(my_rig);
if (retcode != RIG_OK) return retcode; //Rig not connected
else //Rig connected
{
rig_get_powerstat(my_rig, &rigGet.onoff);
return 0;
}
}
}
void RigDaemon::rigUpdate()
{
int retcode;
value_t retvalue;
//***** Command execution *****
//* PTT
if (rigCmd.ptt)
{
retcode = rig_set_ptt(my_rig, RIG_VFO_CURR, rigSet.ptt);
if (retcode == RIG_OK) rigGet.ptt = rigSet.ptt;
rigCmd.ptt = 0;
}
//* VFO
if (rigCmd.freqMain) //VFO Main
{
retcode = rig_set_freq(my_rig, RIG_VFO_CURR, rigSet.freqMain);
if (retcode == RIG_OK) rigGet.freqMain = rigSet.freqMain;
rigCmd.freqMain = 0;
rigCmd.rangeList = 1;
}
else if (rigCmd.freqSub) //VFO Sub
{
retcode = rig_set_freq(my_rig, rigGet.vfoSub, rigSet.freqSub);
if (retcode == RIG_OK) rigGet.freqSub = rigSet.freqSub;
rigCmd.freqSub = 0;
}
else
{
freq_t retfreq;
retcode = rig_get_freq(my_rig, RIG_VFO_CURR, &retfreq);
if (retcode == RIG_OK) rigGet.freqMain = retfreq;
retcode = rig_get_freq(my_rig, rigGet.vfoSub, &retfreq);
if (retcode == RIG_OK) rigGet.freqSub = retfreq;
ptt_t retptt;
retcode = rig_get_ptt(my_rig, RIG_VFO_CURR, &retptt);
if (retcode == RIG_OK) rigGet.ptt = retptt;
//* Meter
if (rigGet.ptt==1)
{
rig_get_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_RFPOWER_METER, &rigGet.powerMeter);
rig_get_level(my_rig, RIG_VFO_CURR, rigSet.meter, &rigGet.subMeter);
}
else
{
retcode = rig_get_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_STRENGTH, &retvalue);
if (retcode == RIG_OK) rigGet.sMeter = retvalue;
}
if (!rigGet.ptt)
{
//* Mode
if (rigCmd.mode)
{
retcode = rig_set_mode(my_rig, RIG_VFO_CURR, rigSet.mode, RIG_PASSBAND_NOCHANGE);
if (retcode == RIG_OK)
{
rigCmd.bwidthList = 1; //Update BWidth list
commandPriority = 0;
//rig_get_mode(my_rig, RIG_VFO_CURR, &rigGet.mode, &rigGet.bwidth); //Get BW
}
rigCmd.mode = 0;
}
//* BandWidth
if (rigCmd.bwidth)
{
retcode = rig_set_mode(my_rig, RIG_VFO_CURR, rigGet.mode, rigSet.bwidth);
if (retcode == RIG_OK) rigGet.bwidth = rigSet.bwidth;
rigCmd.bwidth = 0;
}
//* Split
if (rigCmd.split)
{
retcode = rig_set_split_vfo(my_rig, RIG_VFO_RX, rigSet.split, RIG_VFO_TX);
if (retcode == RIG_OK) rigGet.split = rigSet.split;
rigCmd.split = 0;
}
//* VFO Exchange
if (rigCmd.vfoXchange)
{
retcode = rig_vfo_op(my_rig, RIG_VFO_CURR, RIG_OP_XCHG);
if (retcode == RIG_OK) commandPriority = 0;
rigCmd.vfoXchange = 0;
}
//* VFO Copy
if (rigCmd.vfoCopy)
{
rig_vfo_op(my_rig, RIG_VFO_CURR, RIG_OP_CPY);
rigCmd.vfoCopy = 0;
}
//* Band Up
if (rigCmd.bandUp)
{
retcode = rig_vfo_op(my_rig, RIG_VFO_CURR, RIG_OP_BAND_UP);
if (retcode == RIG_OK) commandPriority = 0;
rigCmd.bandUp = 0;
}
//* Band Down
if (rigCmd.bandDown)
{
retcode = rig_vfo_op(my_rig, RIG_VFO_CURR, RIG_OP_BAND_DOWN);
if (retcode == RIG_OK) commandPriority = 0;
rigCmd.bandDown = 0;
}
//* Band change
if (rigCmd.bandChange) commandPriority = 0;
//* Tune
if (rigCmd.tune)
{
rig_vfo_op(my_rig, RIG_VFO_CURR, RIG_OP_TUNE);
rigCmd.tune = 0;
}
//* Antenna
if (rigCmd.ant)
{
retcode = rig_set_ant(my_rig, RIG_VFO_CURR, rigSet.ant, retvalue);
if (retcode == RIG_OK) rigGet.ant = rigSet.ant;
rigCmd.ant = 0;
}
//* AGC
if (rigCmd.agc)
{
retcode = rig_set_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_AGC, valueagclevel(rigSet.agc));
if (retcode == RIG_OK) rigGet.agc = rigSet.agc;
rigCmd.agc = 0;
}
//* Attenuator
if (rigCmd.att)
{
retvalue.i = rigSet.att;
retcode = rig_set_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_ATT, retvalue);
if (retcode == RIG_OK) rigGet.att = rigSet.att;
rigCmd.att = 0;
}
//* Preamp
if (rigCmd.pre)
{
retvalue.i = rigSet.pre;
retcode = rig_set_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_PREAMP, retvalue);
if (retcode == RIG_OK) rigGet.pre = rigSet.pre;
rigCmd.pre = 0;
}
//* RF gain
if (rigCmd.rfGain)
{
retvalue.f = rigSet.rfGain;
retcode = rig_set_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_RF, retvalue);
if (retcode == RIG_OK) rigGet.rfGain = rigSet.rfGain;
rigCmd.rfGain = 0;
}
//* NB noise blanker
if (rigCmd.noiseBlanker)
{
retcode = rig_set_func(my_rig, RIG_VFO_CURR, RIG_FUNC_NB, rigSet.noiseBlanker);
if (retcode == RIG_OK) rigGet.noiseBlanker = rigSet.noiseBlanker;
rigCmd.noiseBlanker = 0;
}
//* NR noise reduction
if (rigCmd.noiseReduction)
{
retcode = rig_set_func(my_rig, RIG_VFO_CURR, RIG_FUNC_NR, rigSet.noiseReduction);
if (retcode == RIG_OK) rigGet.noiseReduction = rigSet.noiseReduction;
rigCmd.noiseReduction = 0;
}
if (rigCmd.noiseReductionLevel)
{
retvalue.i = rigSet.noiseReductionLevel;
retcode = rig_set_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_NR, retvalue);
if (retcode == RIG_OK) rigGet.noiseReductionLevel = rigSet.noiseReductionLevel;
rigCmd.noiseReductionLevel = 0;
}
//* NF notch filter
if (rigCmd.notchFilter)
{
retcode = rig_set_func(my_rig, RIG_VFO_CURR, RIG_FUNC_ANF, rigSet.notchFilter);
if (retcode == RIG_OK) rigGet.notchFilter = rigSet.notchFilter;
rigCmd.notchFilter = 0;
}
//* IF Shift
if (rigCmd.ifShift)
{
retvalue.i = rigSet.ifShift;
retcode = rig_set_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_IF, retvalue);
if (retcode == RIG_OK) rigGet.ifShift = rigSet.ifShift;
rigCmd.ifShift = 0;
}
} //end if (!rigGet.ptt)
//* Tuner
if (rigCmd.tuner)
{
retcode = rig_set_func(my_rig, RIG_VFO_CURR, RIG_FUNC_TUNER, rigSet.tuner);
if (retcode == RIG_OK) rigGet.tuner = rigSet.tuner;
rigCmd.tune = 0;
}
//* RF power
if (rigCmd.rfPower)
{
retvalue.f = rigSet.rfPower;
retcode = rig_set_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_RFPOWER, retvalue);
if (retcode == RIG_OK) rigGet.rfPower = rigSet.rfPower;
rigCmd.rfPower = 0;
}
//***** Poll execution *****
if ((commandPriority == 1 && !rigGet.ptt && rigCom.fullPoll) || commandPriority == 0)
{
//* Mode and BW
rig_get_mode(my_rig, RIG_VFO_CURR, &rigGet.mode, &rigGet.bwidth);
//rig_get_mode(my_rig, rigGet.vfoSub, &rigGet.modeSub, &rigGet.bwidthSub);
if (rigGet.bwidth == rig_passband_narrow(my_rig, rigGet.mode)) rigGet.bwNarrow = 1;
else rigGet.bwNarrow = 0;
}
if ((commandPriority == 2 && !rigGet.ptt && rigCom.fullPoll) || commandPriority == 0)
{
//* Split
rig_get_split_vfo(my_rig, RIG_VFO_CURR, &rigGet.split, &rigGet.vfoTx);
//else rig_get_split(my_rig, RIG_VFO_CURR, &rigGet.split);
rig_get_vfo(my_rig, &rigGet.vfoMain);
}
//* Tuner
if ((commandPriority == 3 && !rigGet.ptt && rigCom.fullPoll) || commandPriority == 0) rig_get_func(my_rig, RIG_VFO_CURR, RIG_FUNC_TUNER, &rigGet.tuner);
//* Antenna
if ((commandPriority == 4 && !rigGet.ptt && rigCom.fullPoll) || commandPriority == 0) rig_get_ant(my_rig, RIG_VFO_CURR, RIG_ANT_CURR, &retvalue, &rigGet.ant, &rigGet.antTx, &rigGet.antRx);
//* AGC
if ((commandPriority == 5 && !rigGet.ptt && rigCom.fullPoll) || commandPriority == 0)
{
rig_get_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_AGC, &retvalue);
rigGet.agc = levelagcvalue(retvalue.i);
}
//* Attenuator
if ((commandPriority == 6 && !rigGet.ptt && rigCom.fullPoll) || commandPriority == 0)
{
rig_get_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_ATT, &retvalue);
rigGet.att = retvalue.i;
}
//* Preamp
if ((commandPriority == 7 && !rigGet.ptt && rigCom.fullPoll) || commandPriority == 0)
{
rig_get_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_PREAMP, &retvalue);
rigGet.pre = retvalue.i;
}
//* RF power
if ((commandPriority == 8 && !rigGet.ptt && rigCom.fullPoll) || commandPriority == 0)
{
rig_get_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_RFPOWER, &retvalue);
rigGet.rfPower = retvalue.f;
}
//* RF gain
if ((commandPriority == 9 && !rigGet.ptt && rigCom.fullPoll) || commandPriority == 0)
{
rig_get_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_RF, &retvalue);
rigGet.rfGain = retvalue.f;
}
//* NB noise blanker
if ((commandPriority == 10 && !rigGet.ptt && rigCom.fullPoll) || commandPriority == 0) rig_get_func(my_rig, RIG_VFO_CURR, RIG_FUNC_NB, &rigGet.noiseBlanker);
//* NR noise reduction
if ((commandPriority == 11 && !rigGet.ptt && rigCom.fullPoll) || commandPriority == 0)
{
rig_get_func(my_rig, RIG_VFO_CURR, RIG_FUNC_NR, &rigGet.noiseReduction);
rig_get_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_NR, &retvalue);
rigGet.noiseReductionLevel = retvalue.i;
}
//* NF notch filter
if ((commandPriority == 12 && !rigGet.ptt && rigCom.fullPoll) || commandPriority == 0) rig_get_func(my_rig, RIG_VFO_CURR, RIG_FUNC_ANF, &rigGet.notchFilter);
//* IF Shift
if ((commandPriority == 13 && !rigGet.ptt && rigCom.fullPoll) || commandPriority == 0)
{
rig_get_level(my_rig, RIG_VFO_CURR, RIG_LEVEL_IF, &retvalue);
rigGet.ifShift = retvalue.i;
}
if ((commandPriority == 14 && !rigGet.ptt && rigCom.fullPoll) || commandPriority == 0) //&& mode=CW
{
//* CW Full Break-in
if (rigCmd.bkin)
{
retcode = rig_set_func(my_rig, RIG_VFO_CURR, RIG_FUNC_FBKIN, rigSet.bkin);
if (retcode == RIG_OK) rigGet.bkin = rigSet.bkin;
rigCmd.bkin = 0;
}
else rig_get_func(my_rig, RIG_VFO_CURR, RIG_FUNC_FBKIN, &rigGet.bkin);
}
commandPriority ++;
if (commandPriority == 15) commandPriority = 1;
}
emit resultReady();
}

42
rigdaemon.h 100644
Wyświetl plik

@ -0,0 +1,42 @@
/**
** This file is part of the CatRadio project.
** Copyright 2022 Gianfranco Sordetti IZ8EWD <iz8ewd@pianetaradio.it>.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
#ifndef RIGDAEMON_H
#define RIGDAEMON_H
#include <QObject>
#include <rig.h>
class RigDaemon : public QObject
{
Q_OBJECT
public:
explicit RigDaemon(QObject *parent = nullptr);
int rigConnect();
public slots:
void rigUpdate();
signals:
void resultReady();
};
#endif // RIGDAEMON_H

26
rigdata.cpp 100644
Wyświetl plik

@ -0,0 +1,26 @@
/**
** This file is part of the CatRadio project.
** Copyright 2022 Gianfranco Sordetti IZ8EWD <iz8ewd@pianetaradio.it>.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
#include "rigdata.h"
rigConnect rigCom;
rigSettings rigGet;
rigSettings rigSet;
rigCommand rigCmd;
rigCommand rigCap;

100
rigdata.h 100644
Wyświetl plik

@ -0,0 +1,100 @@
/**
** This file is part of the CatRadio project.
** Copyright 2022 Gianfranco Sordetti IZ8EWD <iz8ewd@pianetaradio.it>.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
#ifndef RIGDATA_H
#define RIGDATA_H
#endif // RIGDATA_H
#include <rig.h> //Hamlib
#include <QString>
typedef struct {
unsigned rigModel; //Hamlib rig model
QString rigPort; //COM port or IP address
unsigned serialSpeed; //Serial port baud rate
int civAddr; //CI-V address (decimal, Icom radio)
unsigned rigRefresh; //GUI refresh interval (ms)
int connected; //connected flag
bool fullPoll; //full polling flag
} rigConnect;
typedef struct {
powerstat_t onoff; //on/off status
freq_t freqMain, freqSub; //Frequency
rmode_t mode, modeSub; //Mode
pbwidth_t bwidth, bwidthSub; //IF filter bandwidth
int bwNarrow; //IF narrow filter
vfo_t vfoMain, vfoSub; //VFO
vfo_t vfoTx;
split_t split; //Split
ptt_t ptt; //PTT
value_t sMeter; //Smeter signal strenght
value_t powerMeter; //RF power meter
value_t subMeter; //secondary meter
unsigned meter; //secondary meter type
float rfPower; //RF power output level
float rfGain; //RF gain rx
agc_level_e agc; //AGC level
int att; //Attenuator
int pre; //Preamplifier
ant_t ant, antTx, antRx; //Antenna
int rangeListTxIndex, rangeListRxIndex;
int tuner; //Tuner
int bkin; //CW Break-in
int apf;
int noiseBlanker;
int noiseReduction, noiseReductionLevel;
int notchFilter;
int ifShift;
} rigSettings;
typedef struct {
int onoff;
int freqMain;
int freqSub;
int mode;
int bwidth;
int bwidthList;
int vfo;
int split;
int vfoXchange;
int vfoCopy;
int ptt;
int rfPower;
int rfGain;
int agc;
int att;
int pre;
int ant;
int antList;
int rangeList;
int tuner;
int tune;
int bandUp;
int bandDown;
int bandChange;
int bkin;
int apf;
int noiseBlanker;
int noiseReduction, noiseReductionLevel;
int notchFilter;
int ifShift;
} rigCommand;

318
smeter.cpp 100644
Wyświetl plik

@ -0,0 +1,318 @@
/**
** This file is part of the CatRadio project.
** Copyright 2022 Gianfranco Sordetti IZ8EWD <iz8ewd@pianetaradio.it>.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
#include "smeter.h"
#include <QPainter>
SMeter::SMeter(QWidget *parent) : QWidget(parent)
{
lineColor = QColor(Qt::black);
bgColor = QColor(Qt::white);
progressColor = QColor(Qt::green);
//Default value
minValue = 0;
maxValue = 100;
gateValue = 80;
longStep = 20;
shortStep = 10;
precision = 0;
meterTx = 0;
currentValue = -54;
}
void SMeter::paintEvent(QPaintEvent *)
{
QPainter painter(this);
painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);
QFont font;
font = painter.font();
font.setPointSize(font.pointSize() - 2);
painter.setFont(font);
drawMeter(&painter);
drawProgress(&painter);
drawScaleSMeter(&painter);
drawScalePWRMeter(&painter);
}
void SMeter::drawMeter(QPainter *painter)
{
painter->save();
QPen pen(lineColor, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
painter->setPen(pen);
painter->setBrush(bgColor);
painter->drawRect(0, height()/3+2, width()-12, height()/3-4);
painter->restore();
}
void SMeter::drawProgress(QPainter *painter)
{
double max, min;
double gate;
painter->save();
painter->setPen(Qt::NoPen);
painter->setBrush(progressColor);
if (meterTx) //RF power meter
{
max = maxValue;
min = minValue;
gate = gateValue;
}
else //SMeter
{
max = 60;
min = -54;
gate = 0;
}
double length = width()-14;
double increment = length / (max - min);
double initX, initXX;
if (currentValue>gate)
{
initX = (gate - min) * increment;
QRect rect(1, height()/3+2+1, initX, height()/3-4-2);
painter->drawRect(rect);
//Red bar
initXX = (currentValue - gate) * increment;
QRect rect2(initX+1, height()/3+2+1, initXX, height()/3-4-2);
painter->setBrush(Qt::red);
painter->drawRect(rect2);
}
else
{
initX = (currentValue - min) * increment;
QRect rect(1, height()/3+2+1, initX, height()/3-4-2);
painter->drawRect(rect);
}
painter->restore();
}
void SMeter::drawScalePWRMeter(QPainter *painter)
{
painter->save();
painter->setPen(lineColor);
double initX = 0;
double initTopY = height()*2/3-2;
double length = width()-12;
double increment = length / (maxValue - minValue);
int longLineLen = 6;
int shortLineLen = 3;
QFontMetrics meterFont(painter->font());
double textHeight = meterFont.height();
//Draw scale values and scale values based on range values Long lines
int stepNumber = (maxValue - minValue) / shortStep;
for (int i = 0; i <= stepNumber; i++)
{
double j = i * shortStep + minValue;
if (fmod(j,longStep) == 0)
{
if (j == minValue) //Do not draw the first value
{
QPointF textPot = QPointF(initX, initTopY + textHeight);
painter->drawText(textPot, "PO");
initX += increment * shortStep;
continue;
}
QPointF topPot = QPointF(initX, initTopY);
QPointF bottomPot = QPointF(initX, initTopY + longLineLen);
painter->drawLine(topPot, bottomPot);
QString strValue = QString("%1").arg(j, 0, 'f', precision);
double textWidth = fontMetrics().horizontalAdvance(strValue);
QPointF textPot = QPointF(initX - textWidth / 2, initTopY + textHeight + longLineLen);
painter->drawText(textPot, strValue);
}
else
{
QPointF topPot = QPointF(initX, initTopY);
QPointF bottomPot = QPointF(initX, initTopY + shortLineLen);
painter->drawLine(topPot, bottomPot);
}
initX += increment * shortStep;
}
painter->restore();
}
void SMeter::drawScaleSMeter(QPainter *painter)
{
int minValue = -54; //Set min and max value according to Hamlib SMeter definition
int maxValue = 60;
int longLineLen = 6;
int shortLineLen = 3;
double initX = 0;
int sUnit = 0;
double initBottomY = height()/3+2;
double length = width()-12;
double increment = length / (maxValue - minValue);
QFontMetrics meterFont(painter->font());
double textHeight = meterFont.height();
painter->save();
painter->setPen(lineColor);
//Draw scale values and scale values based on range values
int longStep = 12;
int shortStep = 6;
for (int i = minValue; i <= 0; i = i + shortStep) //S0 to S9
{
if (i == minValue)
{
QPointF textPot = QPointF(initX, initBottomY - 2);
painter->drawText(textPot, "S");
initX += increment * shortStep;
sUnit = sUnit + 1;
continue;
}
if (i % longStep == 0)
{
QPointF topPot = QPointF(initX, initBottomY);
QPointF bottomPot = QPointF(initX, initBottomY - longLineLen);
painter->drawLine(topPot, bottomPot);
QString strValue = QString::number(sUnit);
double textWidth = fontMetrics().horizontalAdvance(strValue);
QPointF textPot = QPointF(initX - textWidth / 2, initBottomY - textHeight / 2 - longLineLen + 2);
painter->drawText(textPot, strValue);
}
else
{
QPointF topPot = QPointF(initX, initBottomY);
QPointF bottomPot = QPointF(initX, initBottomY - shortLineLen);
painter->drawLine(topPot, bottomPot);
}
sUnit = sUnit + 1;
initX += increment * shortStep;
}
initX -= increment * shortStep;
shortStep = 10;
longStep = 20;
for (int i = 0; i <= maxValue; i = i + shortStep) //S9+ to S9+60
{
if (i % longStep == 0)
{
QPointF topPot = QPointF(initX, initBottomY);
QPointF bottomPot = QPointF(initX, initBottomY - longLineLen);
painter->drawLine(topPot, bottomPot);
if (i == 0) //Do not draw the first value
{
initX += increment * shortStep;
continue;
}
QString strValue = "+" + QString::number(i);
double textWidth = fontMetrics().horizontalAdvance(strValue);
QPointF textPot = QPointF(initX - textWidth / 2, initBottomY - textHeight / 2 - longLineLen + 2);
painter->drawText(textPot, strValue);
}
else
{
QPointF topPot = QPointF(initX, initBottomY);
QPointF bottomPot = QPointF(initX, initBottomY - shortLineLen);
painter->drawLine(topPot, bottomPot);
}
initX += increment * shortStep;
}
painter->restore();
}
void SMeter::setMinValue(double value)
{
minValue = value;
update();
}
void SMeter::setMaxValue(double value)
{
maxValue = value;
update();
}
void SMeter::setGateValue(double value)
{
gateValue = value;
}
void SMeter::setLongStep(double value)
{
longStep = value;
update();
}
void SMeter::setShortStep(double value)
{
shortStep = value;
update();
}
void SMeter::setPrecision(int value)
{
precision = value;
update();
}
void SMeter::setValue(double value)
{
currentValue = value;
update();
}
void SMeter::setValue(int value)
{
setValue(double(value));
}
void SMeter::setTx(bool Tx)
{
meterTx = Tx;
}

73
smeter.h 100644
Wyświetl plik

@ -0,0 +1,73 @@
/**
** This file is part of the CatRadio project.
** Copyright 2022 Gianfranco Sordetti IZ8EWD <iz8ewd@pianetaradio.it>.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
#ifndef SMETER_H
#define SMETER_H
#include <QWidget>
class SMeter : public QWidget
{
Q_OBJECT
public:
explicit SMeter(QWidget *parent = nullptr);
public slots:
void setMinValue(double value);
void setMaxValue(double value);
void setGateValue(double value);
void setLongStep(double value);
void setShortStep(double value);
void setPrecision(int value);
void setValue(double value);
void setValue(int value);
void setTx(bool Tx);
protected:
void paintEvent(QPaintEvent *);
void drawMeter(QPainter *painter);
void drawProgress(QPainter *painter);
void drawScaleSMeter(QPainter *painter);
void drawScalePWRMeter(QPainter *painter);
private:
double minValue; //Minimum scale value
double maxValue; //Maximum scale value
double gateValue; //Gate value to bar color change
double longStep; //Long lines with equal steps
double shortStep; //Short lines with equal steps
int precision; //Precision, the last few decimal places
double value; //target value
double currentValue; //current value
bool meterTx; //Switch between SMeter or PowerMeter
QColor bgColor; //background color
QColor lineColor; //line color
QColor progressColor; //progress color
signals:
};
#endif // SMETER_H

195
submeter.cpp 100644
Wyświetl plik

@ -0,0 +1,195 @@
/**
** This file is part of the CatRadio project.
** Copyright 2022 Gianfranco Sordetti IZ8EWD <iz8ewd@pianetaradio.it>.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
#include "submeter.h"
#include <QPainter>
#include <QDebug>
SubMeter::SubMeter(QWidget *parent) : QWidget(parent)
{
lineColor = QColor(Qt::black);
bgColor = QColor(Qt::white);
progressColor = QColor(Qt::green);
//Default value
minValue = 0;
maxValue = 10;
gateValue = 10;
longStep = 5;
shortStep = 1;
precision = 0;
currentValue = 0;
}
void SubMeter::paintEvent(QPaintEvent *)
{
QPainter painter(this);
painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);
QFont font;
font = painter.font();
font.setPointSize(font.pointSize() - 2);
painter.setFont(font);
drawMeter(&painter);
drawProgress(&painter);
drawScale(&painter);
}
void SubMeter::drawMeter(QPainter *painter)
{
painter->save();
QPen pen(lineColor, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
painter->setPen(pen);
painter->setBrush(bgColor);
painter->drawRect(0, height()/3+2, width()-12, height()/3-4);
painter->restore();
}
void SubMeter::drawProgress(QPainter *painter)
{
painter->save();
painter->setPen(Qt::NoPen);
painter->setBrush(progressColor);
double length = width()-14;
double increment = length / (maxValue - minValue);
double initX, initXX;
if (currentValue>gateValue)
{
initX = (gateValue - minValue) * increment;
QRect rect(1, height()/3+2+1, initX, height()/3-4-2);
painter->drawRect(rect);
//Red bar
initXX = (currentValue - gateValue) * increment;
QRect rect2(initX+1, height()/3+2+1, initXX, height()/3-4-2);
painter->setBrush(Qt::red);
painter->drawRect(rect2);
}
else
{
initX = (currentValue - minValue) * increment;
QRect rect(1, height()/3+2+1, initX, height()/3-4-2);
painter->drawRect(rect);
}
painter->restore();
}
void SubMeter::drawScale(QPainter *painter)
{
painter->save();
painter->setPen(lineColor);
double initX = 0;
double initTopY = height()*2/3-2;
double length = width()-12;
double increment = length / (maxValue - minValue);
int longLineLen = 6;
int shortLineLen = 3;
QFontMetrics meterFont(painter->font());
double textHeight = meterFont.height();
//Draw scale values and scale values based on range values
int stepNumber = (maxValue - minValue) / shortStep;
for (int i = 0; i <= stepNumber; i++)
{
double j = i * shortStep + minValue;
if (fmod(j,longStep) == 0)
{
if (j == minValue) //Do not draw the first value
{
initX += increment * shortStep;
continue;
}
QPointF topPot = QPointF(initX, initTopY);
QPointF bottomPot = QPointF(initX, initTopY + longLineLen);
painter->drawLine(topPot, bottomPot);
QString strValue = QString("%1").arg(j, 0, 'f', precision);
double textWidth = fontMetrics().horizontalAdvance(strValue);
QPointF textPot = QPointF(initX - textWidth / 2, initTopY + textHeight + longLineLen);
painter->drawText(textPot, strValue);
}
else
{
QPointF topPot = QPointF(initX, initTopY);
QPointF bottomPot = QPointF(initX, initTopY + shortLineLen);
painter->drawLine(topPot, bottomPot);
}
initX += increment * shortStep;
}
painter->restore();
}
void SubMeter::setMinValue(double value)
{
minValue = value;
update();
}
void SubMeter::setMaxValue(double value)
{
maxValue = value;
update();
}
void SubMeter::setGateValue(double value)
{
gateValue = value;
}
void SubMeter::setLongStep(double value)
{
longStep = value;
update();
}
void SubMeter::setShortStep(double value)
{
shortStep = value;
update();
}
void SubMeter::setPrecision(int value)
{
precision = value;
update();
}
void SubMeter::setValue(double value)
{
currentValue = value;
update();
}
void SubMeter::setValue(int value)
{
setValue(double(value));
}

67
submeter.h 100644
Wyświetl plik

@ -0,0 +1,67 @@
/**
** This file is part of the CatRadio project.
** Copyright 2022 Gianfranco Sordetti IZ8EWD <iz8ewd@pianetaradio.it>.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
#ifndef SUBMETER_H
#define SUBMETER_H
#include <QWidget>
class SubMeter : public QWidget
{
Q_OBJECT
public:
explicit SubMeter(QWidget *parent = nullptr);
public slots:
void setMinValue(double value);
void setMaxValue(double value);
void setGateValue(double value);
void setLongStep(double value);
void setShortStep(double value);
void setPrecision(int value);
void setValue(double value);
void setValue(int value);
protected:
void paintEvent(QPaintEvent *);
void drawMeter(QPainter *painter);
void drawProgress(QPainter *painter);
void drawScale(QPainter *painter);
private:
double minValue; //Minimum scale value
double maxValue; //Maximum scale value
double gateValue; //Gate value to bar color change
double longStep; //Long lines with equal steps
double shortStep; //Short lines with equal steps
int precision; //Precision, the last few decimal places
double value; //target value
double currentValue; //current value
QColor bgColor; //background color
QColor lineColor; //line color
QColor progressColor; //progress color
signals:
};
#endif // SUBMETER_H

152
vfodisplay.cpp 100644
Wyświetl plik

@ -0,0 +1,152 @@
/**
** This file is part of the CatRadio project.
** Copyright 2022 Gianfranco Sordetti IZ8EWD <iz8ewd@pianetaradio.it>.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**/
#include "vfodisplay.h"
#include "guidata.h"
#include <QPainter>
#include <QInputEvent>
#include <QDebug>
extern guiConfig guiConf;
vfoDisplay::vfoDisplay(QWidget *parent) : QWidget(parent)
{
lineColor = QColor(Qt::black);
bgColor = QColor(Qt::white);
textColor = QColor(Qt::black);
}
void vfoDisplay::paintEvent(QPaintEvent *)
{
//setMouseTracking(true);
QPainter painter(this);
painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);
QFont font;
font = painter.font();
font.setPointSize(height() - 18);
painter.setFont(font);
drawDisplay(&painter);
drawText(&painter);
}
void vfoDisplay::drawDisplay(QPainter *painter)
{
painter->save();
QPen pen(lineColor, 1, Qt::SolidLine, Qt::SquareCap, Qt::MiterJoin);
painter->setPen(pen);
painter->setBrush(bgColor);
painter->drawRect(1, 1, width()-3, height()-2);
painter->restore();
}
void vfoDisplay::drawText(QPainter *painter)
{
painter->save();
painter->setPen(textColor);
QFontMetrics meterFont(painter->font());
double textHeight = meterFont.ascent();
textWidth = meterFont.horizontalAdvance("0",-1);
QPointF textPot;
long val = currentValue;
for (int i = 1; i < 10; i++)
{
val = qFloor(val/10);
int d = val % 10;
if (i==2)
{
textPot = QPointF(width()-3-(textWidth+2)*i-4, textHeight);
painter->drawText(textPot, ".");
}
textPot = QPointF(width()-3-(textWidth+2)*i, textHeight);
if (val==0 && d==0) painter->drawText(textPot, " ");
else painter->drawText(textPot, QString::number(d));
}
painter->restore();
}
void vfoDisplay::setValue(unsigned long value)
{
currentValue = value;
update();
}
//* Tuning using mouse buttons
void vfoDisplay::mousePressEvent(QMouseEvent *event)
{
event->accept();
QPoint pointerPos = event->pos();
for (int i = 1; i < 10; i ++)
{
if (pointerPos.x() > (width()-3-(textWidth+2)*i+1) && pointerPos.x() < (width()-3-(textWidth+2)*(i-1)-1))
{
if (guiConf.vfoDisplayMode && event->button() == Qt::LeftButton) //Up/Down mode
{
if (pointerPos.y() < height()/2) currentValue = currentValue + pow(10,i); //Up
else if (currentValue - pow(10,i) > 0) currentValue = currentValue - pow(10,i); //Down
}
else if (!guiConf.vfoDisplayMode) //Left/Right mode
{
if (event->button() == Qt::LeftButton) currentValue = currentValue + pow(10,i); //LeftButton
else if (currentValue - pow(10,i) > 0) currentValue = currentValue - pow(10,i); //RightButton
}
break;
}
}
update();
emit on_valueChanged(currentValue);
}
//* Tuning using mouse wheel
void vfoDisplay::wheelEvent(QWheelEvent *event)
{
event->accept();
QPointF pointerPos = event->position();
for (int i = 1; i < 10; i ++)
{
if (pointerPos.x() > (width()-3-(textWidth+2)*i+1) && pointerPos.x() < (width()-3-(textWidth+2)*(i-1)-1))
{
if (event->angleDelta().y() > 0) currentValue = currentValue + pow(10,i); //Wheel up
else if (currentValue - pow(10,i) > 0) currentValue = currentValue - pow(10,i); //Wheel down
}
}
update();
emit on_valueChanged(currentValue);
}

37
vfodisplay.h 100644
Wyświetl plik

@ -0,0 +1,37 @@
#ifndef VFODISPLAY_H
#define VFODISPLAY_H
#include <QWidget>
class vfoDisplay : public QWidget
{
Q_OBJECT
public:
explicit vfoDisplay(QWidget *parent = nullptr);
public slots:
void setValue(unsigned long value);
signals:
void on_valueChanged(int value);
protected:
void paintEvent(QPaintEvent *);
void drawDisplay(QPainter *painter);
void drawText(QPainter *painter);
void mousePressEvent(QMouseEvent *event); //Mouse buttons
void wheelEvent(QWheelEvent *event); //Mouse wheel
private:
QColor bgColor; //background color
QColor lineColor; //line color
QColor textColor; //text color
unsigned long currentValue; //current frequency value (Hz)
unsigned long value; //target value
int textWidth; //number width
};
#endif // VFODISPLAY_H