diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 3a90b2a15..7afc7dba0 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -202,7 +202,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Install lcov
- run: brew install lcov
+ run: brew install lcov --head # \todo Remove when lcov commit b34c844 is released.
+ # \todo See https://github.com/linux-test-project/lcov/commit/b34c84431a97b49e55785286fa05e9a95b873920
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
@@ -276,6 +277,9 @@ jobs:
ctest --output-on-failure --test-dir "$RUNNER_TEMP/coverage" --verbose
ctest --output-on-failure --test-dir "$RUNNER_TEMP/release" --verbose
timeout-minutes: 1
+ - name: Disable lcov consistency checks for gcc
+ if: matrix.cc == 'gcc'
+ run: echo 'check_data_consistency = 0' >> "$HOME/.lcovrc"
- name: Collate test coverage
if: matrix.os != 'macos-13' || matrix.cc == 'gcc'
run: cmake --build "$RUNNER_TEMP/coverage" --target coverage
diff --git a/src/cli/i18n/en_AU.ts b/src/cli/i18n/en_AU.ts
index 3f01ad648..e6a1c1744 100644
--- a/src/cli/i18n/en_AU.ts
+++ b/src/cli/i18n/en_AU.ts
@@ -715,107 +715,90 @@ success
- getCliCommand
+ cli_main
-
+
-
+
-
-
- main
-
-
-
-
-
-
-
-
-
-
-
- parseCommandLine
-
-
+
- Colours the console output. Valid options are: yes, no and auto. The default is auto.
+ Colours the console output. Valid options are: yes, no and auto. The default is auto.
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -825,110 +808,128 @@ See --help for usage information.
-
+
-
+
-
+
-
-
+
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ parseCommandLine
+
+
+ Colours the console output. Valid options are: yes, no and auto. The default is auto.
+
diff --git a/src/cli/i18n/en_GB.ts b/src/cli/i18n/en_GB.ts
index e41e01f39..c4a619b8f 100644
--- a/src/cli/i18n/en_GB.ts
+++ b/src/cli/i18n/en_GB.ts
@@ -715,107 +715,90 @@ success
- getCliCommand
+ cli_main
-
+
-
+
-
-
- main
-
-
-
-
-
-
-
-
-
-
-
- parseCommandLine
-
-
+
- Colours the console output. Valid options are: yes, no and auto. The default is auto.
+ Colours the console output. Valid options are: yes, no and auto. The default is auto.
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -825,110 +808,128 @@ See --help for usage information.
-
+
-
+
-
+
-
-
+
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ parseCommandLine
+
+
+ Colours the console output. Valid options are: yes, no and auto. The default is auto.
+
diff --git a/src/cli/i18n/en_US.ts b/src/cli/i18n/en_US.ts
index 912116046..cc58d275a 100644
--- a/src/cli/i18n/en_US.ts
+++ b/src/cli/i18n/en_US.ts
@@ -715,107 +715,90 @@ success
- getCliCommand
+ cli_main
-
+
-
+
-
-
- main
-
-
-
-
-
-
-
-
-
-
-
-
- parseCommandLine
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -825,110 +808,121 @@ See --help for usage information.
-
+
-
+
-
+
-
-
+
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/cli/main.cpp b/src/cli/main.cpp
index 33729fcf5..8ea961715 100644
--- a/src/cli/main.cpp
+++ b/src/cli/main.cpp
@@ -30,6 +30,11 @@
static Q_LOGGING_CATEGORY(lc, "dokit.cli.main", QtInfoMsg);
+class Private
+{
+ Q_DECLARE_TR_FUNCTIONS(cli_main)
+};
+
inline bool haveConsole()
{
#if defined(Q_OS_UNIX)
@@ -99,8 +104,7 @@ Command getCliCommand(const QStringList &posArguments)
return Command::None;
}
if (posArguments.size() > 1) {
- showCliError(QCoreApplication::translate("getCliCommand", "More than one command: %1")
- .arg(posArguments.join(QStringLiteral(", "))));
+ showCliError(Private::tr("More than one command: %1").arg(posArguments.join(QStringLiteral(", "))));
::exit(EXIT_FAILURE);
}
@@ -120,7 +124,7 @@ Command getCliCommand(const QStringList &posArguments)
};
const Command command = supportedCommands.value(posArguments.first().toLower(), Command::None);
if (command == Command::None) {
- showCliError(QCoreApplication::translate("getCliCommand", "Unknown command: %1").arg(posArguments.first()));
+ showCliError(Private::tr("Unknown command: %1").arg(posArguments.first()));
::exit(EXIT_FAILURE);
}
return command;
@@ -131,112 +135,90 @@ Command parseCommandLine(const QStringList &appArguments, QCommandLineParser &pa
// Setup the command line options.
parser.addOptions({
{ QStringLiteral("color"),
- QCoreApplication::translate("parseCommandLine", "Colors the console output. Valid options "
- "are: yes, no and auto. The default is auto."),
+ Private::tr("Colors the console output. Valid options are: yes, no and auto. The default is auto."),
QStringLiteral("yes|no|auto"), QStringLiteral("auto")},
{{QStringLiteral("debug")},
- QCoreApplication::translate("parseCommandLine", "Enable debug output.")},
+ Private::tr("Enable debug output.")},
{{QStringLiteral("d"), QStringLiteral("device")},
- QCoreApplication::translate("parseCommandLine",
- "Set the name, hardware address or macOS UUID of Pokit device to use. If not specified, "
+ Private::tr("Set the name, hardware address or macOS UUID of Pokit device to use. If not specified, "
"the first discovered Pokit device will be used."),
- QCoreApplication::translate("parseCommandLine", "device")},
+ Private::tr("device")},
});
parser.addHelpOption();
parser.addOptions({
{{QStringLiteral("interval")},
- QCoreApplication::translate("parseCommandLine", "Set the update interval for DOS, meter and "
+ Private::tr("Set the update interval for DOS, meter and "
"logger modes. Suffixes such as 's' and 'ms' (for seconds and milliseconds) may be used. "
"If no suffix is present, the units will be inferred from the magnitide of the given "
"interval. If the option itself is not specified, a sensible default will be chosen "
"according to the selected command."),
- QCoreApplication::translate("parseCommandLine", "interval")},
+ Private::tr("interval")},
{{QStringLiteral("mode")},
- QCoreApplication::translate("parseCommandLine", "Set the desired operation mode. For "
+ Private::tr("Set the desired operation mode. For "
"meter, dso, and logger commands, the supported modes are: AC Voltage, DC Voltage, AC Current, "
"DC Current, Resistance, Diode, Continuity, and Temperature. All are case insensitive. "
"Only the first four options are available for dso and logger commands; the rest are "
"available in meter mode only. Temperature is also available for logger commands, but "
"requires firmware v1.5 or later for Pokit devices to support it. For the set-torch command "
"supported modes are On and Off."),
- QCoreApplication::translate("parseCommandLine", "mode")},
+ Private::tr("mode")},
{{QStringLiteral("new-name")},
- QCoreApplication::translate("parseCommandLine","Give the desired new name for the set-"
- "name command."), QCoreApplication::translate("parseCommandLine", "name")},
+ Private::tr("Give the desired new name for the set-name command."), Private::tr("name")},
{{QStringLiteral("output")},
- QCoreApplication::translate("parseCommandLine","Set the format for output. Supported "
+ Private::tr("Set the format for output. Supported "
"formats are: CSV, JSON and Text. All are case insenstitve. The default is Text."),
- QCoreApplication::translate("parseCommandLine", "format"),
- QCoreApplication::translate("parseCommandLine", "text")},
+ Private::tr("format"),
+ Private::tr("text")},
{{QStringLiteral("range")},
- QCoreApplication::translate("parseCommandLine","Set the desired measurement range. Pokit "
+ Private::tr("Set the desired measurement range. Pokit "
"devices support specific ranges, such as 0 to 300mV. Specify the desired upper limit, "
"and the best range will be selected, or use 'auto' to enable the Pokit device's auto-"
"range feature. The default is 'auto'."),
- QCoreApplication::translate("parseCommandLine", "range"), QStringLiteral("auto")},
- {{QStringLiteral("samples")},
- QCoreApplication::translate("parseCommandLine","Set the number of samples to acquire."),
- QCoreApplication::translate("parseCommandLine", "count")},
+ Private::tr("range"), QStringLiteral("auto")},
+ {{QStringLiteral("samples")}, Private::tr("Set the number of samples to acquire."), Private::tr("count")},
{{QStringLiteral("temperature")},
- QCoreApplication::translate("parseCommandLine","Set the current ambient temperature for "
- "the calibration command."), QCoreApplication::translate("parseCommandLine", "degrees")},
+ Private::tr("Set the current ambient temperature for the calibration command."), Private::tr("degrees")},
{{QStringLiteral("timeout")},
- QCoreApplication::translate("parseCommandLine","Set the device discovery scan timeout."
+ Private::tr("Set the device discovery scan timeout. "
"Suffixes such as 's' and 'ms' (for seconds and milliseconds) may be used. "
"If no suffix is present, the units will be inferred from the magnitide of the given "
"interval. The default behaviour is no timeout."),
- QCoreApplication::translate("parseCommandLine","period")},
+ Private::tr("period")},
{{QStringLiteral("timestamp")},
- QCoreApplication::translate("parseCommandLine","Set the optional starting timestamp for "
- "data logging. Default to 'now'."),
- QCoreApplication::translate("parseCommandLine","period")},
- {{QStringLiteral("trigger-level")},
- QCoreApplication::translate("parseCommandLine","Set the DSO trigger level."),
- QCoreApplication::translate("parseCommandLine", "level")},
+ Private::tr("Set the optional starting timestamp for data logging. Default to 'now'."),
+ Private::tr("period")},
+ {{QStringLiteral("trigger-level")}, Private::tr("Set the DSO trigger level."), Private::tr("level")},
{{QStringLiteral("trigger-mode")},
- QCoreApplication::translate("parseCommandLine","Set the DSO trigger mode. Supported "
- "modes are: free, rising and falling. The default is free."),
- QCoreApplication::translate("parseCommandLine", "mode"), QStringLiteral("free")},
+ Private::tr("Set the DSO trigger mode. Supported modes are: free, rising and falling. The default is free."),
+ Private::tr("mode"), QStringLiteral("free")},
});
parser.addVersionOption();
// Add supported 'commands' (as positional arguments, so they'll appear in the help text).
parser.addPositionalArgument(QStringLiteral("info"),
- QCoreApplication::translate("parseCommandLine", "Get Pokit device information"),
- QStringLiteral(" "));
+ Private::tr("Get Pokit device information"), QStringLiteral(" "));
parser.addPositionalArgument(QStringLiteral("status"),
- QCoreApplication::translate("parseCommandLine", "Get Pokit device status"),
- QStringLiteral(" "));
+ Private::tr("Get Pokit device status"), QStringLiteral(" "));
parser.addPositionalArgument(QStringLiteral("meter"),
- QCoreApplication::translate("parseCommandLine", "Access Pokit device's multimeter mode"),
- QStringLiteral(" "));
+ Private::tr("Access Pokit device's multimeter mode"), QStringLiteral(" "));
parser.addPositionalArgument(QStringLiteral("dso"),
- QCoreApplication::translate("parseCommandLine", "Access Pokit device's DSO mode"),
- QStringLiteral(" "));
+ Private::tr("Access Pokit device's DSO mode"), QStringLiteral(" "));
parser.addPositionalArgument(QStringLiteral("logger-start"),
- QCoreApplication::translate("parseCommandLine", "Start Pokit device's data logger mode"),
- QStringLiteral(" "));
+ Private::tr("Start Pokit device's data logger mode"), QStringLiteral(" "));
parser.addPositionalArgument(QStringLiteral("logger-stop"),
- QCoreApplication::translate("parseCommandLine", "Stop Pokit device's data logger mode"),
- QStringLiteral(" "));
+ Private::tr("Stop Pokit device's data logger mode"), QStringLiteral(" "));
parser.addPositionalArgument(QStringLiteral("logger-fetch"),
- QCoreApplication::translate("parseCommandLine", "Fetch Pokit device's data logger samples"),
- QStringLiteral(" "));
+ Private::tr("Fetch Pokit device's data logger samples"), QStringLiteral(" "));
parser.addPositionalArgument(QStringLiteral("scan"),
- QCoreApplication::translate("parseCommandLine", "Scan Bluetooth for Pokit devices"),
- QStringLiteral(" "));
+ Private::tr("Scan Bluetooth for Pokit devices"), QStringLiteral(" "));
parser.addPositionalArgument(QStringLiteral("set-name"),
- QCoreApplication::translate("parseCommandLine", "Set Pokit device's name"),
- QStringLiteral(" "));
+ Private::tr("Set Pokit device's name"), QStringLiteral(" "));
parser.addPositionalArgument(QStringLiteral("set-torch"),
- QCoreApplication::translate("parseCommandLine", "Set Pokit device's torch on or off"),
- QStringLiteral(" "));
+ Private::tr("Set Pokit device's torch on or off"), QStringLiteral(" "));
parser.addPositionalArgument(QStringLiteral("flash-led"),
- QCoreApplication::translate("parseCommandLine", "Flash Pokit device's LED (Pokit Meter only)"),
- QStringLiteral(" "));
+ Private::tr("Flash Pokit device's LED (Pokit Meter only)"), QStringLiteral(" "));
parser.addPositionalArgument(QStringLiteral("calibrate"),
- QCoreApplication::translate("parseCommandLine", "Calibrate Pokit device temperature"),
- QStringLiteral(" "));
+ Private::tr("Calibrate Pokit device temperature"), QStringLiteral(" "));
// Do the initial parse, the see if we have a command specified yet.
parser.parse(appArguments);
@@ -271,8 +253,7 @@ AbstractCommand * getCommandObject(const Command command, QObject * const parent
{
switch (command) {
case Command::None:
- showCliError(QCoreApplication::translate("main",
- "Missing argument: \nSee --help for usage information."));
+ showCliError(Private::tr("Missing argument: \nSee --help for usage information."));
return nullptr;
case Command::Calibrate: return new CalibrateCommand(parent);
case Command::DSO: return new DsoCommand(parent);
@@ -287,7 +268,7 @@ AbstractCommand * getCommandObject(const Command command, QObject * const parent
case Command::SetName: return new SetNameCommand(parent);
case Command::SetTorch: return new SetTorchCommand(parent);
}
- showCliError(QCoreApplication::translate("main", "Unknown command (%1)").arg((int)command));
+ showCliError(Private::tr("Unknown command (%1)").arg((int)command));
return nullptr;
}
diff --git a/src/lib/i18n/en_AU.ts b/src/lib/i18n/en_AU.ts
index c96067b95..ce74608c8 100644
--- a/src/lib/i18n/en_AU.ts
+++ b/src/lib/i18n/en_AU.ts
@@ -181,36 +181,6 @@
-
- CapacitanceRange
-
-
-
- toString
-
-
-
-
-
- maxValue
-
-
-
-
- CurrentRange
-
-
-
- toString
-
-
-
-
-
- maxValue
-
-
-
DataLoggerService
@@ -747,415 +717,303 @@
PokitMeter
-
+
- CurrentRange
-
+
- CurrentRange
-
+
- CurrentRange
-
+
- CurrentRange
-
+
- CurrentRange
-
+
+
+
- CurrentRange
-
+
+
+
- CurrentRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
-
- ResistanceRange
-
-
-
-
-
- ResistanceRange
-
-
-
-
+
- VoltageRange
-
+
- VoltageRange
-
+
- VoltageRange
-
+
- VoltageRange
-
+
- VoltageRange
-
+
- VoltageRange
-
-
-
-
-
- VoltageRange
-
-
-
-
-
- VoltageRange
PokitPro
-
+
- CapacitanceRange
-
+
- CapacitanceRange
-
+
- CapacitanceRange
-
+
+
+
+
- CapacitanceRange
-
+
+
+
+
- CapacitanceRange
-
+
- CurrentRange
-
+
- CurrentRange
-
+
- CurrentRange
-
+
- CurrentRange
-
+
- CurrentRange
-
+
- CurrentRange
-
+
- CurrentRange
-
-
-
-
-
- CurrentRange
-
-
-
-
-
- CurrentRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
-
-
-
-
- ResistanceRange
-
-
- ResistanceRange
-
-
-
-
+
- VoltageRange
-
+
- VoltageRange
-
+
- VoltageRange
-
+
- VoltageRange
-
+
- VoltageRange
-
+
- VoltageRange
-
+
- VoltageRange
-
+
- VoltageRange
-
-
-
-
-
- VoltageRange
-
-
-
-
-
- VoltageRange
PokitProducts
-
-
- toString
-
-
-
-
+
- pokitProduct
-
-
+
+
- toString
-
-
- ResistanceRange
-
-
- toString
-
-
-
-
+
+
+
+
+
+
+
+
+
- maxValue
@@ -1295,19 +1153,4 @@
-
- VoltageRange
-
-
-
- toString
-
-
-
-
-
- maxValue
-
-
-
diff --git a/src/lib/i18n/en_GB.ts b/src/lib/i18n/en_GB.ts
index d15ba29ca..b3c9c5b89 100644
--- a/src/lib/i18n/en_GB.ts
+++ b/src/lib/i18n/en_GB.ts
@@ -181,36 +181,6 @@
-
- CapacitanceRange
-
-
-
- toString
-
-
-
-
-
- maxValue
-
-
-
-
- CurrentRange
-
-
-
- toString
-
-
-
-
-
- maxValue
-
-
-
DataLoggerService
@@ -747,415 +717,303 @@
PokitMeter
-
+
- CurrentRange
-
+
- CurrentRange
-
+
- CurrentRange
-
+
- CurrentRange
-
+
- CurrentRange
-
+
+
+
- CurrentRange
-
+
+
+
- CurrentRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
-
- ResistanceRange
-
-
-
-
-
- ResistanceRange
-
-
-
-
+
- VoltageRange
-
+
- VoltageRange
-
+
- VoltageRange
-
+
- VoltageRange
-
+
- VoltageRange
-
+
- VoltageRange
-
-
-
-
-
- VoltageRange
-
-
-
-
-
- VoltageRange
PokitPro
-
+
- CapacitanceRange
-
+
- CapacitanceRange
-
+
- CapacitanceRange
-
+
+
+
+
- CapacitanceRange
-
+
+
+
+
- CapacitanceRange
-
+
- CurrentRange
-
+
- CurrentRange
-
+
- CurrentRange
-
+
- CurrentRange
-
+
- CurrentRange
-
+
- CurrentRange
-
+
- CurrentRange
-
-
-
-
-
- CurrentRange
-
-
-
-
-
- CurrentRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
-
-
-
-
- ResistanceRange
-
-
- ResistanceRange
-
-
-
-
+
- VoltageRange
-
+
- VoltageRange
-
+
- VoltageRange
-
+
- VoltageRange
-
+
- VoltageRange
-
+
- VoltageRange
-
+
- VoltageRange
-
+
- VoltageRange
-
-
-
-
-
- VoltageRange
-
-
-
-
-
- VoltageRange
PokitProducts
-
-
- toString
-
-
-
-
+
- pokitProduct
-
-
+
+
- toString
-
-
- ResistanceRange
-
-
- toString
-
-
-
-
+
+
+
+
+
+
+
+
+
- maxValue
@@ -1295,19 +1153,4 @@
-
- VoltageRange
-
-
-
- toString
-
-
-
-
-
- maxValue
-
-
-
diff --git a/src/lib/i18n/en_US.ts b/src/lib/i18n/en_US.ts
index 51228daa9..2eaa4bc0d 100644
--- a/src/lib/i18n/en_US.ts
+++ b/src/lib/i18n/en_US.ts
@@ -181,36 +181,6 @@
-
- CapacitanceRange
-
-
-
- toString
-
-
-
-
-
- maxValue
-
-
-
-
- CurrentRange
-
-
-
- toString
-
-
-
-
-
- maxValue
-
-
-
DataLoggerService
@@ -747,415 +717,303 @@
PokitMeter
-
+
- CurrentRange
-
+
- CurrentRange
-
+
- CurrentRange
-
+
- CurrentRange
-
+
- CurrentRange
-
+
+
+
- CurrentRange
-
+
+
+
- CurrentRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
-
- ResistanceRange
-
-
-
-
-
- ResistanceRange
-
-
-
-
+
- VoltageRange
-
+
- VoltageRange
-
+
- VoltageRange
-
+
- VoltageRange
-
+
- VoltageRange
-
+
- VoltageRange
-
-
-
-
-
- VoltageRange
-
-
-
-
-
- VoltageRange
PokitPro
-
+
- CapacitanceRange
-
+
- CapacitanceRange
-
+
- CapacitanceRange
-
+
+
+
+
- CapacitanceRange
-
+
+
+
+
- CapacitanceRange
-
+
- CurrentRange
-
+
- CurrentRange
-
+
- CurrentRange
-
+
- CurrentRange
-
+
- CurrentRange
-
+
- CurrentRange
-
+
- CurrentRange
-
-
-
-
-
- CurrentRange
-
-
-
-
-
- CurrentRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
+
- ResistanceRange
-
-
-
-
-
- ResistanceRange
-
-
- ResistanceRange
-
-
-
-
+
- VoltageRange
-
+
- VoltageRange
-
+
- VoltageRange
-
+
- VoltageRange
-
+
- VoltageRange
-
+
- VoltageRange
-
+
- VoltageRange
-
+
- VoltageRange
-
-
-
-
-
- VoltageRange
-
-
-
-
-
- VoltageRange
PokitProducts
-
-
- toString
-
-
-
-
+
- pokitProduct
-
-
+
+
- toString
-
-
- ResistanceRange
-
-
- toString
-
-
-
-
+
+
+
+
+
+
+
+
+
- maxValue
@@ -1295,19 +1153,4 @@
-
- VoltageRange
-
-
-
- toString
-
-
-
-
-
- maxValue
-
-
-
diff --git a/src/lib/pokitmeter.cpp b/src/lib/pokitmeter.cpp
index 17279f5fe..24fd0afb7 100644
--- a/src/lib/pokitmeter.cpp
+++ b/src/lib/pokitmeter.cpp
@@ -12,16 +12,23 @@
namespace PokitMeter {
+namespace {
+ class Private
+ {
+ Q_DECLARE_TR_FUNCTIONS(PokitMeter)
+ };
+}
+
/// Returns \a range as a user-friendly string.
QString toString(const CurrentRange &range)
{
switch (range) {
- case CurrentRange::_10mA: return QCoreApplication::translate("PokitMeter", "Up to 10mA", "CurrentRange");
- case CurrentRange::_30mA: return QCoreApplication::translate("PokitMeter", "Up to 30mA", "CurrentRange");
- case CurrentRange::_150mA: return QCoreApplication::translate("PokitMeter", "Up to 150mA", "CurrentRange");
- case CurrentRange::_300mA: return QCoreApplication::translate("PokitMeter", "Up to 300mA", "CurrentRange");
- case CurrentRange::_2A: return QCoreApplication::translate("PokitMeter", "Up to 2A", "CurrentRange");
- case CurrentRange::AutoRange: return QCoreApplication::translate("PokitMeter", "Auto-range", "CurrentRange");
+ case CurrentRange::_10mA: return Private::tr("Up to 10mA");
+ case CurrentRange::_30mA: return Private::tr("Up to 30mA");
+ case CurrentRange::_150mA: return Private::tr("Up to 150mA");
+ case CurrentRange::_300mA: return Private::tr("Up to 300mA");
+ case CurrentRange::_2A: return Private::tr("Up to 2A");
+ case CurrentRange::AutoRange: return Private::tr("Auto-range");
default: return QString();
}
}
@@ -38,7 +45,7 @@ QVariant maxValue(const CurrentRange &range)
case CurrentRange::_150mA: return 150'000;
case CurrentRange::_300mA: return 300'000;
case CurrentRange::_2A: return 2'000'000;
- case CurrentRange::AutoRange: return QCoreApplication::translate("PokitMeter", "Auto", "CurrentRange");
+ case CurrentRange::AutoRange: return Private::tr("Auto");
default: return QVariant();
}
}
@@ -47,15 +54,15 @@ QVariant maxValue(const CurrentRange &range)
QString toString(const ResistanceRange &range)
{
switch (range) {
- case ResistanceRange::_160: return QCoreApplication::translate("PokitMeter", "Up to 160Ω", "ResistanceRange");
- case ResistanceRange::_330: return QCoreApplication::translate("PokitMeter", "Up to 330Ω", "ResistanceRange");
- case ResistanceRange::_890: return QCoreApplication::translate("PokitMeter", "Up to 890Ω", "ResistanceRange");
- case ResistanceRange::_1K5: return QCoreApplication::translate("PokitMeter", "Up to 1.5KΩ", "ResistanceRange");
- case ResistanceRange::_10K: return QCoreApplication::translate("PokitMeter", "Up to 10KΩ", "ResistanceRange");
- case ResistanceRange::_100K: return QCoreApplication::translate("PokitMeter", "Up to 100KΩ", "ResistanceRange");
- case ResistanceRange::_470K: return QCoreApplication::translate("PokitMeter", "Up to 470KΩ", "ResistanceRange");
- case ResistanceRange::_1M: return QCoreApplication::translate("PokitMeter", "Up to 1MΩ", "ResistanceRange");
- case ResistanceRange::AutoRange: return QCoreApplication::translate("PokitMeter", "Auto-range", "ResistanceRange");
+ case ResistanceRange::_160: return Private::tr("Up to 160Ω");
+ case ResistanceRange::_330: return Private::tr("Up to 330Ω");
+ case ResistanceRange::_890: return Private::tr("Up to 890Ω");
+ case ResistanceRange::_1K5: return Private::tr("Up to 1.5KΩ");
+ case ResistanceRange::_10K: return Private::tr("Up to 10KΩ");
+ case ResistanceRange::_100K: return Private::tr("Up to 100KΩ");
+ case ResistanceRange::_470K: return Private::tr("Up to 470KΩ");
+ case ResistanceRange::_1M: return Private::tr("Up to 1MΩ");
+ case ResistanceRange::AutoRange: return Private::tr("Auto-range");
default: return QString();
}
}
@@ -75,7 +82,7 @@ QVariant maxValue(const ResistanceRange &range)
case ResistanceRange::_100K: return 100'000;
case ResistanceRange::_470K: return 470'000;
case ResistanceRange::_1M: return 1'000'000;
- case ResistanceRange::AutoRange: return QCoreApplication::translate("PokitMeter", "Auto", "ResistanceRange");
+ case ResistanceRange::AutoRange: return Private::tr("Auto");
default: return QVariant();
}
}
@@ -84,13 +91,13 @@ QVariant maxValue(const ResistanceRange &range)
QString toString(const VoltageRange &range)
{
switch (range) {
- case VoltageRange::_300mV: return QCoreApplication::translate("PokitMeter", "Up to 300mV", "VoltageRange");
- case VoltageRange::_2V: return QCoreApplication::translate("PokitMeter", "Up to 2V", "VoltageRange");
- case VoltageRange::_6V: return QCoreApplication::translate("PokitMeter", "Up to 6V", "VoltageRange");
- case VoltageRange::_12V: return QCoreApplication::translate("PokitMeter", "Up to 12V", "VoltageRange");
- case VoltageRange::_30V: return QCoreApplication::translate("PokitMeter", "Up to 30V", "VoltageRange");
- case VoltageRange::_60V: return QCoreApplication::translate("PokitMeter", "Up to 60V", "VoltageRange");
- case VoltageRange::AutoRange: return QCoreApplication::translate("PokitMeter", "Auto-range", "VoltageRange");
+ case VoltageRange::_300mV: return Private::tr("Up to 300mV");
+ case VoltageRange::_2V: return Private::tr("Up to 2V");
+ case VoltageRange::_6V: return Private::tr("Up to 6V");
+ case VoltageRange::_12V: return Private::tr("Up to 12V");
+ case VoltageRange::_30V: return Private::tr("Up to 30V");
+ case VoltageRange::_60V: return Private::tr("Up to 60V");
+ case VoltageRange::AutoRange: return Private::tr("Auto-range");
default: return QString();
}
}
@@ -108,7 +115,7 @@ QVariant maxValue(const VoltageRange &range)
case VoltageRange::_12V: return 12'000;
case VoltageRange::_30V: return 30'000;
case VoltageRange::_60V: return 60'000;
- case VoltageRange::AutoRange: return QCoreApplication::translate("PokitMeter", "Auto", "VoltageRange");
+ case VoltageRange::AutoRange: return Private::tr("Auto");
default: return QVariant();
}
}
diff --git a/src/lib/pokitpro.cpp b/src/lib/pokitpro.cpp
index 2e0e93851..8dfff92cc 100644
--- a/src/lib/pokitpro.cpp
+++ b/src/lib/pokitpro.cpp
@@ -12,6 +12,13 @@
namespace PokitPro {
+namespace {
+ class Private
+ {
+ Q_DECLARE_TR_FUNCTIONS(PokitPro)
+ };
+}
+
/*!
* \cond internal
* \enum CapacitanceRange
@@ -25,10 +32,10 @@ namespace PokitPro {
QString toString(const CapacitanceRange &range)
{
switch (range) {
- case CapacitanceRange::_100nF: return QCoreApplication::translate("PokitPro", "Up to 100nF", "CapacitanceRange");
- case CapacitanceRange::_10uF: return QCoreApplication::translate("PokitPro", "Up to 10μF", "CapacitanceRange");
- case CapacitanceRange::_1mF: return QCoreApplication::translate("PokitPro", "Up to 1mF", "CapacitanceRange");
- case CapacitanceRange::AutoRange: return QCoreApplication::translate("PokitPro", "Auto-range", "CapacitanceRange");
+ case CapacitanceRange::_100nF: return Private::tr("Up to 100nF");
+ case CapacitanceRange::_10uF: return Private::tr("Up to 10μF");
+ case CapacitanceRange::_1mF: return Private::tr("Up to 1mF");
+ case CapacitanceRange::AutoRange: return Private::tr("Auto-range");
default: return QString();
}
}
@@ -43,7 +50,7 @@ QVariant maxValue(const CapacitanceRange &range)
case CapacitanceRange::_100nF: return 100;
case CapacitanceRange::_10uF: return 10'000;
case CapacitanceRange::_1mF: return 1'000'000;
- case CapacitanceRange::AutoRange: return QCoreApplication::translate("PokitPro", "Auto", "CapacitanceRange");
+ case CapacitanceRange::AutoRange: return Private::tr("Auto");
default: return QVariant();
}
}
@@ -61,14 +68,14 @@ QVariant maxValue(const CapacitanceRange &range)
QString toString(const CurrentRange &range)
{
switch (range) {
- case CurrentRange::_500uA: return QCoreApplication::translate("PokitPro", "Up to 500μA", "CurrentRange");
- case CurrentRange::_2mA: return QCoreApplication::translate("PokitPro", "Up to 2mA", "CurrentRange");
- case CurrentRange::_10mA: return QCoreApplication::translate("PokitPro", "Up to 10mA", "CurrentRange");
- case CurrentRange::_125mA: return QCoreApplication::translate("PokitPro", "Up to 125mA", "CurrentRange");
- case CurrentRange::_300mA: return QCoreApplication::translate("PokitPro", "Up to 300mA", "CurrentRange");
- case CurrentRange::_3A: return QCoreApplication::translate("PokitPro", "Up to 3A", "CurrentRange");
- case CurrentRange::_10A: return QCoreApplication::translate("PokitPro", "Up to 10A", "CurrentRange");
- case CurrentRange::AutoRange: return QCoreApplication::translate("PokitPro", "Auto-range", "CurrentRange");
+ case CurrentRange::_500uA: return Private::tr("Up to 500μA");
+ case CurrentRange::_2mA: return Private::tr("Up to 2mA");
+ case CurrentRange::_10mA: return Private::tr("Up to 10mA");
+ case CurrentRange::_125mA: return Private::tr("Up to 125mA");
+ case CurrentRange::_300mA: return Private::tr("Up to 300mA");
+ case CurrentRange::_3A: return Private::tr("Up to 3A");
+ case CurrentRange::_10A: return Private::tr("Up to 10A");
+ case CurrentRange::AutoRange: return Private::tr("Auto-range");
default: return QString();
}
}
@@ -87,7 +94,7 @@ QVariant maxValue(const CurrentRange &range)
case CurrentRange::_300mA: return 300'000;
case CurrentRange::_3A: return 3'000'000;
case CurrentRange::_10A: return 10'000'000;
- case CurrentRange::AutoRange: return QCoreApplication::translate("PokitPro", "Auto", "CurrentRange");
+ case CurrentRange::AutoRange: return Private::tr("Auto");
default: return QVariant();
}
}
@@ -105,18 +112,18 @@ QVariant maxValue(const CurrentRange &range)
QString toString(const ResistanceRange &range)
{
switch (range) {
- case ResistanceRange::_30: return QCoreApplication::translate("PokitPro", "Up to 30Ω", "ResistanceRange");
- case ResistanceRange::_75: return QCoreApplication::translate("PokitPro", "Up to 75Ω", "ResistanceRange");
- case ResistanceRange::_400: return QCoreApplication::translate("PokitPro", "Up to 400Ω", "ResistanceRange");
- case ResistanceRange::_5K: return QCoreApplication::translate("PokitPro", "Up to 5KΩ", "ResistanceRange");
- case ResistanceRange::_10K: return QCoreApplication::translate("PokitPro", "Up to 10KΩ", "ResistanceRange");
- case ResistanceRange::_15K: return QCoreApplication::translate("PokitPro", "Up to 15KΩ", "ResistanceRange");
- case ResistanceRange::_40K: return QCoreApplication::translate("PokitPro", "Up to 40KΩ", "ResistanceRange");
- case ResistanceRange::_500K: return QCoreApplication::translate("PokitPro", "Up to 500KΩ", "ResistanceRange");
- case ResistanceRange::_700K: return QCoreApplication::translate("PokitPro", "Up to 700KΩ", "ResistanceRange");
- case ResistanceRange::_1M: return QCoreApplication::translate("PokitPro", "Up to 1MΩ", "ResistanceRange");
- case ResistanceRange::_3M: return QCoreApplication::translate("PokitPro", "Up to 3MΩ", "ResistanceRange");
- case ResistanceRange::AutoRange: return QCoreApplication::translate("PokitPro", "Auto-range", "ResistanceRange");
+ case ResistanceRange::_30: return Private::tr("Up to 30Ω");
+ case ResistanceRange::_75: return Private::tr("Up to 75Ω");
+ case ResistanceRange::_400: return Private::tr("Up to 400Ω");
+ case ResistanceRange::_5K: return Private::tr("Up to 5KΩ");
+ case ResistanceRange::_10K: return Private::tr("Up to 10KΩ");
+ case ResistanceRange::_15K: return Private::tr("Up to 15KΩ");
+ case ResistanceRange::_40K: return Private::tr("Up to 40KΩ");
+ case ResistanceRange::_500K: return Private::tr("Up to 500KΩ");
+ case ResistanceRange::_700K: return Private::tr("Up to 700KΩ");
+ case ResistanceRange::_1M: return Private::tr("Up to 1MΩ");
+ case ResistanceRange::_3M: return Private::tr("Up to 3MΩ");
+ case ResistanceRange::AutoRange: return Private::tr("Auto-range");
default: return QString();
}
}
@@ -139,7 +146,7 @@ QVariant maxValue(const ResistanceRange &range)
case ResistanceRange::_700K: return 700'000;
case ResistanceRange::_1M: return 1'000'000;
case ResistanceRange::_3M: return 3'000'000;
- case ResistanceRange::AutoRange: return QCoreApplication::translate("PokitPro", "Auto", "ResistanceRange");
+ case ResistanceRange::AutoRange: return Private::tr("Auto");
default: return QVariant();
}
}
@@ -157,15 +164,15 @@ QVariant maxValue(const ResistanceRange &range)
QString toString(const VoltageRange &range)
{
switch (range) {
- case VoltageRange::_250mV: return QCoreApplication::translate("PokitPro", "Up to 250mV", "VoltageRange");
- case VoltageRange::_2V: return QCoreApplication::translate("PokitPro", "Up to 2V", "VoltageRange");
- case VoltageRange::_10V: return QCoreApplication::translate("PokitPro", "Up to 10V", "VoltageRange");
- case VoltageRange::_30V: return QCoreApplication::translate("PokitPro", "Up to 30V", "VoltageRange");
- case VoltageRange::_60V: return QCoreApplication::translate("PokitPro", "Up to 60V", "VoltageRange");
- case VoltageRange::_125V: return QCoreApplication::translate("PokitPro", "Up to 125V", "VoltageRange");
- case VoltageRange::_400V: return QCoreApplication::translate("PokitPro", "Up to 400V", "VoltageRange");
- case VoltageRange::_600V: return QCoreApplication::translate("PokitPro", "Up to 600V", "VoltageRange");
- case VoltageRange::AutoRange: return QCoreApplication::translate("PokitPro", "Auto-range", "VoltageRange");
+ case VoltageRange::_250mV: return Private::tr("Up to 250mV");
+ case VoltageRange::_2V: return Private::tr("Up to 2V");
+ case VoltageRange::_10V: return Private::tr("Up to 10V");
+ case VoltageRange::_30V: return Private::tr("Up to 30V");
+ case VoltageRange::_60V: return Private::tr("Up to 60V");
+ case VoltageRange::_125V: return Private::tr("Up to 125V");
+ case VoltageRange::_400V: return Private::tr("Up to 400V");
+ case VoltageRange::_600V: return Private::tr("Up to 600V");
+ case VoltageRange::AutoRange: return Private::tr("Auto-range");
default: return QString();
}
}
@@ -185,7 +192,7 @@ QVariant maxValue(const VoltageRange &range)
case VoltageRange::_125V: return 125'000;
case VoltageRange::_400V: return 400'000;
case VoltageRange::_600V: return 600'000;
- case VoltageRange::AutoRange: return QCoreApplication::translate("PokitPro", "Auto", "VoltageRange");
+ case VoltageRange::AutoRange: return Private::tr("Auto");
default: return QVariant();
}
}
diff --git a/src/lib/pokitproducts.cpp b/src/lib/pokitproducts.cpp
index 3bdaa3d93..db984f61b 100644
--- a/src/lib/pokitproducts.cpp
+++ b/src/lib/pokitproducts.cpp
@@ -20,6 +20,13 @@ static Q_LOGGING_CATEGORY(lc, "dokit.pokit.products", QtInfoMsg); ///< Logging c
QTPOKIT_BEGIN_NAMESPACE
+namespace {
+ class Private
+ {
+ Q_DECLARE_TR_FUNCTIONS(PokitProducts)
+ };
+}
+
/*!
* Returns \c product as user-friendly string.
*/
@@ -29,8 +36,7 @@ QString toString(const PokitProduct product)
case PokitProduct::PokitMeter: return QStringLiteral("Pokit Meter");
case PokitProduct::PokitPro: return QStringLiteral("Pokit Pro");
}
- qCWarning(lc).noquote() << QCoreApplication::translate("PokitProducts",
- "Unknown PokitProduct value: %1", "toString").arg((int)product);
+ qCWarning(lc).noquote() << Private::tr("Unknown PokitProduct value: %1").arg((int)product);
return QString();
}
@@ -99,8 +105,7 @@ PokitProduct pokitProduct(const QList &serviceUuids)
} else if (serviceUuids.contains(StatusService::ServiceUuids::pokitPro)) {
return PokitProduct::PokitPro;
} else {
- qCWarning(lc).noquote()
- << QCoreApplication::translate("PokitProducts", "Device is not a Pokit product", "pokitProduct");
+ qCWarning(lc).noquote() << Private::tr("Device is not a Pokit product");
qCDebug(lc).noquote() << "Service UUIDs:" << serviceUuids;
return PokitProduct::PokitMeter; // Need to fallback to something; Pokit Meter is just the lowest product.
}
@@ -135,14 +140,12 @@ QString toString(const PokitProduct product, const quint8 range)
{
switch (product) {
case PokitProduct::PokitMeter:
- qCWarning(lc).noquote()
- << QCoreApplication::translate("PokitProducts", "Pokit Meter has no capacitance support", "toString");
+ qCWarning(lc).noquote() << Private::tr("Pokit Meter has no capacitance support");
return QString();
case PokitProduct::PokitPro:
return PokitPro::toString(static_cast(range));
}
- qCWarning(lc).noquote() << QCoreApplication::translate("CapacitanceRange",
- "Unknown PokitProduct value: %1", "toString").arg((int)product);
+ qCWarning(lc).noquote() << Private::tr("Unknown PokitProduct value: %1").arg((int)product);
return QString();
}
@@ -158,14 +161,12 @@ QVariant maxValue(const PokitProduct product, const quint8 range)
{
switch (product) {
case PokitProduct::PokitMeter:
- qCWarning(lc).noquote()
- << QCoreApplication::translate("PokitProducts", "Pokit Meter has no capacitance support", "toString");
+ qCWarning(lc).noquote() << Private::tr("Pokit Meter has no capacitance support");
return QVariant();
case PokitProduct::PokitPro:
return PokitPro::maxValue(static_cast(range));
}
- qCWarning(lc).noquote() << QCoreApplication::translate("CapacitanceRange",
- "Unknown PokitProduct value: %1", "maxValue").arg((int)product);
+ qCWarning(lc).noquote() << Private::tr("Unknown PokitProduct value: %1").arg((int)product);
return QVariant();
}
@@ -188,8 +189,7 @@ QString toString(const PokitProduct product, const quint8 range)
case PokitProduct::PokitPro:
return PokitPro::toString(static_cast(range));
}
- qCWarning(lc).noquote() << QCoreApplication::translate("CurrentRange",
- "Unknown PokitProduct value: %1", "toString").arg((int)product);
+ qCWarning(lc).noquote() << Private::tr("Unknown PokitProduct value: %1").arg((int)product);
return QString();
}
@@ -208,8 +208,7 @@ QVariant maxValue(const PokitProduct product, const quint8 range)
case PokitProduct::PokitPro:
return PokitPro::maxValue(static_cast(range));
}
- qCWarning(lc).noquote() << QCoreApplication::translate("CurrentRange",
- "Unknown PokitProduct value: %1", "maxValue").arg((int)product);
+ qCWarning(lc).noquote() << Private::tr("Unknown PokitProduct value: %1").arg((int)product);
return QVariant();
}
@@ -232,8 +231,7 @@ QString toString(const PokitProduct product, const quint8 range)
case PokitProduct::PokitPro:
return PokitPro::toString(static_cast(range));
}
- qCWarning(lc).noquote() << QCoreApplication::translate("ResistanceRange",
- "Unknown PokitProduct value: %1", "toString").arg((int)product);
+ qCWarning(lc).noquote() << Private::tr("Unknown PokitProduct value: %1").arg((int)product);
return QString();
}
@@ -252,8 +250,7 @@ QVariant maxValue(const PokitProduct product, const quint8 range)
case PokitProduct::PokitPro:
return PokitPro::maxValue(static_cast(range));
}
- qCWarning(lc).noquote() << QCoreApplication::translate("ResistanceRange",
- "Unknown PokitProduct value: %1", "maxValue").arg((int)product);
+ qCWarning(lc).noquote() << Private::tr("Unknown PokitProduct value: %1").arg((int)product);
return QVariant();
}
@@ -276,8 +273,7 @@ QString toString(const PokitProduct product, const quint8 range)
case PokitProduct::PokitPro:
return PokitPro::toString(static_cast(range));
}
- qCWarning(lc).noquote() << QCoreApplication::translate("VoltageRange",
- "Unknown PokitProduct value: %1", "toString").arg((int)product);
+ qCWarning(lc).noquote() << Private::tr("Unknown PokitProduct value: %1").arg((int)product);
return QString();
}
@@ -296,8 +292,7 @@ QVariant maxValue(const PokitProduct product, const quint8 range)
case PokitProduct::PokitPro:
return PokitPro::maxValue(static_cast(range));
}
- qCWarning(lc).noquote() << QCoreApplication::translate("VoltageRange",
- "Unknown PokitProduct value: %1", "maxValue").arg((int)product);
+ qCWarning(lc).noquote() << Private::tr("Unknown PokitProduct value: %1").arg((int)product);
return QVariant();
}