hmatuschek / qdmr

A GUI application for configuring and programming cheap DMR radios under Linux and MacOS X.
https://dm3mat.darc.de/qdmr/
GNU General Public License v3.0
216 stars 45 forks source link

Implement merging of codeplugs #426

Closed hmatuschek closed 4 months ago

hmatuschek commented 5 months ago

This is needed to implement the import of CHIRP CSV files. The simple CHRIP format does not contain a proper codeplug for FM capable DMR radios. Consequently, the CHIRP FM channels must be imported into an existing codeplug. Hence, an import/merge function is needed anyway.

This, however, is highly non-trivial, as the elements of codeplugs are linked. So, I cannot simply copy channels, zones, etc from another codeplug. Also, how to handle duplicates? My suggestion would be: Allow the user to select a merge strategy for items (atomic element like channel, contact) and sets (groups/lists of elements like zones, group lists, ...). I.e.,

  1. Items: ignore/override/duplicate
  2. Sets: ignore/override/duplicate/merge
allesand commented 4 months ago

The import dialog presents the option to import *.yaml, but the file picker dialog does not show any of the .yaml files in the directory. Should importing another QDMR codeplug (aka "codeplug merging") work already? Filtering for .csv seems to work, but I do not habe any chirp-configs to test. Merging DMR codeplug would be pretty cool, though!

hmatuschek commented 4 months ago

The import dialog presents the option to import *.yaml, but the file picker dialog does not show any of the .yaml files in the directory. Should importing another QDMR codeplug (aka "codeplug merging") work already? Filtering for .csv seems to work, but I do not habe any chirp-configs to test. Merging DMR codeplug would be pretty cool, though!

Should be fixed now.

allesand commented 4 months ago

Yes, selecting .yaml files works now!

Note: the description below "Items" in the "Merge Codeplugs" window does change with the selected option, the one below "Sets" does not.

I tried to import the following .yaml into an empty codeplug:

---
version: 0.12.0
settings:
  introLine1: ""
  introLine2: ""
  micLevel: 3
  speech: false
  power: High
  squelch: 1
  vox: 0
  tot: 0
radioIDs:
  []
contacts:
  - dmr: {id: cont1, name: AB1CDE, ring: false, type: PrivateCall, number: 1234567}
groupLists:
  []
channels:
  []
zones:
  []
commercial:
  encryptionKeys:
    []
...

I expected that one contact to be added to the empty codeplug, but it does not seem to work?

hmatuschek commented 4 months ago

Which strategy did you select? The result would be correct, if you selected Ignore for items.

allesand commented 4 months ago
hmatuschek commented 4 months ago
  • Started qdmr, empty codeplug, selected "Import", above file and "Duplicate / Duplicate" in the "Merge" window

    • Contact from above file is not showing up in the "Contacts" tab

    • Should it not be imported in the empty codeplug with this workflow?

Ok, I can reproduce it. Unfortunately, not in the unit tests. This is weird.

hmatuschek commented 4 months ago

Fixed it. Was a stupid typo.

allesand commented 4 months ago

Fixed it. Was a stupid typo.

Works! Will try some more with different options and report. Thanks!

Side note: since merged items get added to the end: how much work would implementing #259 be, for example "move by 10"?

hmatuschek commented 4 months ago

Does the merge itself work so far? If so, I would merge it into devel. Concerning the "move by 10" feature request, I would rather prefer a drag-and-drop implementation.

allesand commented 4 months ago

I only imported contacts so far - that worked as expected. Trying more complex merges of zones etc. is next todo. But general workflow functions as expected.