[53] Allow selection of Unraid OS Language within the USB creator#62
[53] Allow selection of Unraid OS Language within the USB creator#62jlre249 wants to merge 77 commits intounraid:mainfrom
Conversation
* main window in pretty good shape - now onto the popup boxes * hw popup + delegate, os popup + delegate, and dst popup + delegate pretty much in a good spot. based on how the icons are displayed, didn't end up needing orange pngs, because the dark ones can be changed using ColorOverlay * about to start working on options popup * think the settings menu seems okay now * language/keyboard selector & progress bar theming * removal of a few now unused rpi pngs * replace instances of "#2B2A29" with new UnColors singleton member mediumGray * replace instances of "#FF8C2F" with new UnColors singleton member orange * replace instances of "#1C1B1B" with new UnColors singleton member darkGray * replace instances of "#FFFFFF" with color name white
* removes "use saved settings" pop up and always displays options popup instead
* ico for windows * removed rpi-imager.ico and rpi-image.png; mods to CMakeLists.txt to swap from rpi to unraid for windows RC file and copying to 128x128 app icon folder, will need a few other changes to make this work with linux still * renaming application from rpi-imager to unraid-imager * changes for linux * mac icns
* changed os list url in config.h * default select unraid device on load
* seems to be in a good place now for both ident and network config * added in the boot img stuff from the old usb creator (this also ensures that the volume label gets changed to UNRAID) * get rid of unnecessary if inside else clause * works on windows, though i did have to disable secure boot * some misc cleanup: *help button linking to website *info button opening "about" popup *putenv to enable darkmode title bar on windows *remove obe img gz files *minor text edits *changed logo background from white to darkgray * pushing to check on linux and mac
* local commit before switching branches * pushing to check on linux * working on linux * committing new files * completely disable devices in list that have an invalid guid
misc updates: * shrink help/info icons + add text * hyperlink urls in about popup *adjust text in about popup *adjust wording of formatting text *adjust wording of custom img select *limit custom img select to zip files *adjust wording of invalid guid text *add text for missing guid
* renaming unraid-imager -> unraid-usb-creator * more renaming + new icons * guid working on mac, troubleshooting make bootable * rename on format for mac * rather than trying to make the make bootable script work on all platforms (since it's only needed for legacy boot, and we don't let the user select that as an option right now), simply display a message telling the user to run the script after burn successful * fix embedded links in info popup * adding back in linux drive renaming * deb file updates
Co-authored-by: Jessica Reid <jlr@Jessicas-Mini-875.hsd1.va.comcast.net>
Always Run make_bootable.bat on Windows
The legacy url currently being linked to is going away
Fix incorrect link to docs
# Conflicts: # src/imagewriter.cpp # src/linux/org.raspberrypi.rpi-imager.desktop
De part 2
De part 3 until line 458
FR final
Update unraid-usb-creator_fr.ts
ZH translation
fr part 1
This reverts commit 9e11634.
part 3 up to line 480
|
@jlre249 is this good to review? |
| if(oldData == dataText) | ||
| { | ||
| // if this string wasn't found for replacement, just add it | ||
| dataText += "locale=\"" + unraidLangCode + "\""; |
There was a problem hiding this comment.
We need to make sure we put this locale= block under the "[display]" section - you may want to use an XML parser to parse the file and add a new section, I believe that you may want to parse this as XML
#include <QDomDocument>
#include <QString>
#include <QDebug>
void addLocaleToDisplaySection(QString& dataText, const QString& unraidLangCode) {
QDomDocument doc;
QString errorMsg;
int errorLine, errorColumn;
// Load the dataText as an XML document
if (!doc.setContent(dataText, &errorMsg, &errorLine, &errorColumn)) {
qDebug() << "Error parsing XML at line" << errorLine << "column" << errorColumn << ":" << errorMsg;
return;
}
// Find the [display] section
QDomElement root = doc.documentElement(); // Get the root element
QDomNodeList displaySections = root.elementsByTagName("display");
if (!displaySections.isEmpty()) {
QDomElement display = displaySections.at(0).toElement(); // Assuming only one [display] section
if (!display.isNull()) {
// Check if "locale" attribute exists
if (display.hasAttribute("locale")) {
display.setAttribute("locale", unraidLangCode);
} else {
// Add "locale" attribute if not present
display.setAttribute("locale", unraidLangCode);
}
}
} else {
// Add a new [display] section with the locale attribute
QDomElement newDisplay = doc.createElement("display");
newDisplay.setAttribute("locale", unraidLangCode);
root.appendChild(newDisplay);
}
// Convert the modified XML back to a string
QString newXml;
QTextStream stream(&newXml);
doc.save(stream, 4); // Indent with 4 spaces
dataText = newXml;
}|
@jlre249 - left a comment about your mechanism of parsing the display config. Let's change this to use a proper XML parser. |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Closes #53
A few things to be aware of:
For some reason, when using the regular DownloadThread to download the JSON and XML files, it automatically pads the files with extra null characters out to 1 MB. I suspect this has something to do with how the buffer is being written to file. I added a quick & dirty workaround for it, but it's possible we might want to look more into how DownloadThread is conducting its business.
The unraid zip I was pulling didn't actually have anything in the dynamix.cfg, so the behavior right now is to add that 'locale=""' line if it wasn't found for replacement. Hopefully this is the behavior we want.