diff --git a/CMakeLists.txt b/CMakeLists.txt index adfcc71b..196a7f29 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,13 +5,21 @@ if(NOT ("$ENV{BUILD_VERSION}" STREQUAL "")) string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" VERSION $ENV{BUILD_VERSION}) endif() +string(REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)" _version_match ${VERSION}) +set(VERSION_MAJOR ${CMAKE_MATCH_1}) +set(VERSION_MINOR ${CMAKE_MATCH_2}) +set(VERSION_PATCH ${CMAKE_MATCH_3}) + project(efibooteditor VERSION ${VERSION} - DESCRIPTION "Boot Editor for (U)EFI based systems" + DESCRIPTION "Boot Editor for (U)EFI based systems." LANGUAGES C CXX ) set(PROJECT_NAME_CAPITALIZED "EFIBootEditor") +set(PROJECT_HOMEPAGE_URL "https://github.com/Neverous/efibooteditor") +set(APPLICATION_NAME "EFI Boot Editor") +set(APPLICATION_ICON "${CMAKE_SOURCE_DIR}/icons/Tango/256/categories/preferences-system.ico") set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) @@ -51,6 +59,7 @@ find_package(Qt${QT_VERSION_MAJOR} Gui Network Widgets + LinguistTools REQUIRED) add_executable(${PROJECT_NAME} WIN32 MACOSX_BUNDLE @@ -71,12 +80,39 @@ if(${QT_VERSION_MAJOR} GREATER 5) target_link_libraries(${PROJECT_NAME} PRIVATE Qt::Core5Compat ) +else() + if(NOT COMMAND qt_add_translations) + function(qt_add_translations TARGET) + cmake_parse_arguments(arg "" "" "TS_FILES;INCLUDE_DIRECTORIES" ${ARGN}) + qt5_add_translation(QM_FILES ${arg_TS_FILES}) + + get_target_property(BINARY_DIR ${TARGET} BINARY_DIR) + set(QRC ${BINARY_DIR}/translations.qrc) + file(WRITE ${QRC} "\n") + foreach (QM_PATH ${QM_FILES}) + file(RELATIVE_PATH QM_FILE ${BINARY_DIR} ${QM_PATH}) + file(APPEND ${QRC} "${QM_FILE}\n") + endforeach (QM) + file(APPEND ${QRC} "") + + qt_add_resources(RESOURCES ${QRC}) + target_sources(${PROJECT_NAME} PRIVATE ${RESOURCES}) + endfunction() + endif() endif() target_compile_definitions(${PROJECT_NAME} PRIVATE + APPLICATION_NAME="${APPLICATION_NAME}" + VERSION="${VERSION}" + VERSION_MAJOR=${VERSION_MAJOR} + VERSION_MINOR=${VERSION_MINOR} + VERSION_PATCH=${VERSION_PATCH} + PROJECT_NAME="${PROJECT_NAME}" + PROJECT_DESCRIPTION="${PROJECT_DESCRIPTION}" + PROJECT_HOMEPAGE_URL="${PROJECT_HOMEPAGE_URL}" + APPLICATION_ICON="${APPLICATION_ICON}" QT_DEPRECATED_WARNINGS QT_DISABLE_DEPRECATED_BEFORE=0xFFFFFF - VERSION="$ENV{BUILD_VERSION}" ) # GCC @@ -143,12 +179,16 @@ if(WIN32) # Enable all warnings in application code /Wall /permissive- /WX # Disable some warnings + # C4464: relative include path contains '.. + /wd4464 # C4702: unreachable code /wd4702 # C4710: 'function' : function not inlined /wd4710 # C4711: function 'function' selected for inline expansion /wd4711 + # C4820: 'bytes' bytes padding added after construct 'member_name' + /wd4820 # C4866: compiler may not enforce left-to-right evaluation order for call to 'C++17 operator' /wd4866 # C5045: Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified @@ -189,6 +229,7 @@ if(WIN32) src/efivar-lite.c src/efivar-lite.common.h src/efivar-lite.win32.c + windows.rc ) endif() @@ -236,6 +277,15 @@ target_sources(${PROJECT_NAME} PRIVATE qt_add_resources(RESOURCES icons.qrc) target_sources(${PROJECT_NAME} PRIVATE ${RESOURCES}) +# Translations +FILE(GLOB TRANSLATIONS + ${CMAKE_SOURCE_DIR}/translations/${PROJECT_NAME}_*.ts +) + +qt_add_translations(${PROJECT_NAME} + TS_FILES ${TRANSLATIONS} + INCLUDE_DIRECTORIES "include") + if(APPLE) target_link_libraries(${PROJECT_NAME} PRIVATE "-framework CoreFoundation" @@ -290,6 +340,7 @@ if(WIN32) install(DIRECTORY "${CMAKE_BINARY_DIR}/qt/" TYPE BIN COMPONENT Runtime + PATTERN "*.pdb" EXCLUDE ) if(("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") OR ("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")) @@ -297,6 +348,13 @@ if(WIN32) TYPE BIN COMPONENT Debug ) + + install(DIRECTORY "${CMAKE_BINARY_DIR}/qt/" + TYPE BIN + COMPONENT Debug + FILES_MATCHING + PATTERN "*.pdb" + ) endif() elseif(APPLE) @@ -333,14 +391,14 @@ set(CPACK_PACKAGE_CONTACT "Maciej Szeptuch ") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_DESCRIPTION}") set(CPACK_PACKAGE_DIRECTORY dist) set(CPACK_PACKAGE_EXECUTABLES ${PROJECT_NAME} "${PROJECT_NAME_CAPITALIZED}") -set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/Neverous/efibooteditor") +set(CPACK_PACKAGE_HOMEPAGE_URL ${PROJECT_HOMEPAGE_URL}) set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME_CAPITALIZED}") -set(CPACK_PACKAGE_NAME "${PROJECT_NAME_CAPITALIZED}") +set(CPACK_PACKAGE_NAME "${APPLICATION_NAME}") set(CPACK_PACKAGE_VENDOR ${PROJECT_NAME_CAPITALIZED}) set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE.txt") set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md") -set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/icons/Tango/scalable/categories/preferences-desktop.svg") +set(CPACK_PACKAGE_ICON "${APPLICATION_ICON}") if("${CMAKE_BUILD_TYPE}" STREQUAL "Release") set(CPACK_STRIP_FILES TRUE) @@ -352,6 +410,8 @@ if(WIN32) set(CPACK_WIX_LIGHT_EXTRA_FLAGS "-dcl:high") set(CPACK_WIX_PRODUCT_ICON ${CPACK_PACKAGE_ICON}) + set(CPACK_WIX_UI_BANNER "${CMAKE_SOURCE_DIR}/misc/wix_banner.png") + set(CPACK_WIX_UI_DIALOG "${CMAKE_SOURCE_DIR}/misc/wix_dialog.png") set(CPACK_WIX_PROPERTY_ARPHELPLINK "${CPACK_PACKAGE_HOMEPAGE_URL}") set(CPACK_WIX_PROPERTY_ARPURLINFOABOUT "${CPACK_PACKAGE_HOMEPAGE_URL}") set(CPACK_WIX_ROOT_FEATURE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}") diff --git a/README.md b/README.md index db260edf..9f98f41c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # EFI Boot Editor -GUI for managing EFI Boot Manager configuration. +Boot Editor for (U)EFI based systems. ![EFIBootEditor](doc/efibooteditor.png) ![Device path dialog](doc/devicepathdialog.png) diff --git a/icons/Tango/256/categories/preferences-system.ico b/icons/Tango/256/categories/preferences-system.ico new file mode 100644 index 00000000..43ac1434 Binary files /dev/null and b/icons/Tango/256/categories/preferences-system.ico differ diff --git a/misc/wix_banner.png b/misc/wix_banner.png new file mode 100644 index 00000000..a060dd86 Binary files /dev/null and b/misc/wix_banner.png differ diff --git a/misc/wix_dialog.png b/misc/wix_dialog.png new file mode 100644 index 00000000..433941d9 Binary files /dev/null and b/misc/wix_dialog.png differ diff --git a/src/bootentryform.cpp b/src/bootentryform.cpp index ceb05d63..d926b12a 100644 --- a/src/bootentryform.cpp +++ b/src/bootentryform.cpp @@ -82,7 +82,7 @@ void BootEntryForm::optionalDataFormatChanged(int format) if(!success) { - QMessageBox::critical(this, qApp->applicationName(), tr("Couldn't change Optional data format!")); + QMessageBox::critical(this, qApp->applicationName(), tr("Couldn't change optional data format!")); ui->optional_data_format_combo->setCurrentIndex(static_cast(current_item->optional_data_format)); } } diff --git a/src/efibooteditor.cpp b/src/efibooteditor.cpp index e1da02e7..a7592065 100644 --- a/src/efibooteditor.cpp +++ b/src/efibooteditor.cpp @@ -258,7 +258,7 @@ void EFIBootEditor::saveBootConfiguration() void EFIBootEditor::import() { - const auto file_name = QFileDialog::getOpenFileName(this, tr("Open Boot Configuration Dump"), "", tr("JSON Documents (*.json)")); + const auto file_name = QFileDialog::getOpenFileName(this, tr("Open boot configuration dump"), "", tr("JSON documents (*.json)")); if(!file_name.isEmpty()) importBootConfiguration(file_name); } @@ -341,7 +341,7 @@ void EFIBootEditor::importJSONEFIData(const QJsonObject &input) const auto &name = QString("BootOrder[%1]").arg(i); if(!index.isDouble()) { - errors.push_back(tr("%1: number expected").arg(name)); + errors.push_back(tr("%1: %2 expected").arg(name,tr("number"))); continue; } @@ -354,7 +354,7 @@ void EFIBootEditor::importJSONEFIData(const QJsonObject &input) // clang-format on if(!input["Boot"].isObject()) - errors.push_back(tr("%1: object expected").arg("Boot")); + errors.push_back(tr("%1: %2 expected").arg("Boot", tr("object"))); else { @@ -367,7 +367,7 @@ void EFIBootEditor::importJSONEFIData(const QJsonObject &input) const uint16_t index = static_cast(name.toULong(&success, HEX_BASE)); if(!success) { - errors.push_back(tr("%1: hexadecimal number expected").arg(prefix_ + name)); + errors.push_back(tr("%1: %2 expected").arg(prefix_ + name, tr("hexadecimal number"))); continue; } @@ -430,14 +430,14 @@ void EFIBootEditor::importRawEFIData(const QJsonObject &input) showProgressBar(step++, total_steps, tr("Importing EFI Boot Manager entries (%1)...").arg(full_name)); if(!root[name].isObject()) { - errors.push_back(tr("%1: object expected").arg(full_name)); + errors.push_back(tr("%1: %2 expected").arg(full_name, tr("object"))); return; } const auto obj = root[name].toObject(); if(!obj["raw_data"].isString() || !obj["efi_attributes"].isDouble()) { - errors.push_back(tr("%1: object(raw_data: string, efi_attributes: number) expected").arg(full_name)); + errors.push_back(tr("%1: %2 expected").arg(full_name).arg(tr("object(raw_data: string, efi_attributes: number)"))); return; } @@ -472,7 +472,7 @@ void EFIBootEditor::importRawEFIData(const QJsonObject &input) // clang-format on if(!input["Boot"].isObject()) - errors.push_back(tr("%1: object expected").arg("Boot")); + errors.push_back(tr("%1: %2 expected").arg("Boot", tr("object"))); else { @@ -485,7 +485,7 @@ void EFIBootEditor::importRawEFIData(const QJsonObject &input) const uint16_t index = static_cast(name.toULong(&success, HEX_BASE)); if(!success) { - errors.push_back(tr("%1: hexadecimal number expected").arg(prefix_ + name)); + errors.push_back(tr("%1: %2 expected").arg(prefix_ + name, tr("hexadecimal number"))); continue; } @@ -522,7 +522,7 @@ void EFIBootEditor::importRawEFIData(const QJsonObject &input) void EFIBootEditor::export_() { - QString file_name = QFileDialog::getSaveFileName(this, tr("Save Boot Configuration Dump"), "", tr("JSON documents (*.json)")); + QString file_name = QFileDialog::getSaveFileName(this, tr("Save boot configuration dump"), "", tr("JSON documents (*.json)")); if(!file_name.isEmpty()) exportBootConfiguration(file_name); } @@ -577,7 +577,7 @@ void EFIBootEditor::exportBootConfiguration(const QString &file_name) void EFIBootEditor::dump() { - const QString file_name = QFileDialog::getSaveFileName(this, tr("Save Raw EFI Dump"), "", tr("JSON documents (*.json)")); + const QString file_name = QFileDialog::getSaveFileName(this, tr("Save raw EFI dump"), "", tr("JSON documents (*.json)")); if(!file_name.isEmpty()) dumpRawEFIData(file_name); } @@ -657,15 +657,21 @@ void EFIBootEditor::dumpRawEFIData(const QString &file_name) void EFIBootEditor::showAboutBox() { auto *about = new QMessageBox(QMessageBox::Information, - qApp->applicationName(), - QString("

EFI Boot Editor

%1

").arg(QCoreApplication::applicationVersion()), + tr("About %1").arg(qApp->applicationName()), + QString("

%1

" + "

%2

" + "

%3

") + .arg(qApp->applicationName(), QCoreApplication::applicationVersion(), PROJECT_DESCRIPTION), QMessageBox::Close, this); + about->setIconPixmap(QIcon::fromTheme("preferences-system").pixmap(128, 128)); about->setInformativeText(tr( - "

License: GNU LGPL Version 3

" + "

Website

" + "

The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

" + "

License: GNU LGPL Version 3

" "

On Linux uses efivar for EFI variables access.

" - "

Uses Tango Icons as fallback icons

" - "

The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

")); + "

Uses Tango Icons as fallback icons.

") + .arg(PROJECT_HOMEPAGE_URL)); QObject::connect(about->button(QMessageBox::Close), &QAbstractButton::clicked, about, &QObject::deleteLater); QObject::connect(qApp, &QApplication::aboutToQuit, about, &QObject::deleteLater); about->show(); diff --git a/src/form/bootentryform.ui b/src/form/bootentryform.ui index 865f905d..8dec871f 100644 --- a/src/form/bootentryform.ui +++ b/src/form/bootentryform.ui @@ -154,7 +154,8 @@ - + + .. false @@ -185,7 +186,8 @@ - + + .. false @@ -216,7 +218,8 @@ - + + .. false @@ -247,7 +250,8 @@ - + + .. false @@ -278,7 +282,8 @@ - + + .. false @@ -530,7 +535,10 @@ <html><head/><body><p>Order</p></body></html> - >\0\xHHHH;_ + >\0\xHHHH;_ + + + 0x diff --git a/src/form/bootentrywidget.ui b/src/form/bootentrywidget.ui index 669904df..9d8433b3 100644 --- a/src/form/bootentrywidget.ui +++ b/src/form/bootentrywidget.ui @@ -74,7 +74,7 @@ - 0 + 5 @@ -109,6 +109,12 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + 0 + + + -1 + Qt::NoTextInteraction @@ -146,6 +152,9 @@ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + -1 + Qt::NoTextInteraction @@ -177,7 +186,7 @@ <html><head/><body><p>Boot file path</p></body></html> - file path + File path Qt::PlainText @@ -217,7 +226,7 @@ <html><head/><body><p>Optional data, arguments passed to boot executable</p></body></html> - data + Data Qt::PlainText diff --git a/src/form/devicepathdialog.ui b/src/form/devicepathdialog.ui index ccda3f6c..ce017fab 100644 --- a/src/form/devicepathdialog.ui +++ b/src/form/devicepathdialog.ui @@ -17,7 +17,7 @@ - Device Path + Device path Device path dialog @@ -47,7 +47,7 @@ QTabWidget::West - 10 + 8 true @@ -66,7 +66,8 @@ <html><head/><body><p>PCI tab</p></body></html> - + + .. PCI @@ -167,7 +168,8 @@ <html><head/><body><p>HID tab</p></body></html> - + + .. HID @@ -207,7 +209,10 @@ <html><head/><body><p>HID in hexadecimal.</p></body></html> - <\0\xHHHHHHHH;_ + <\0\xHHHHHHHH;_ + + + 0x @@ -239,7 +244,10 @@ <html><head/><body><p>UID in hexadecimal.</p></body></html> - <\0\xHHHHHHHH;_ + <\0\xHHHHHHHH;_ + + + 0x @@ -256,7 +264,8 @@ <html><head/><body><p>USB tab</p></body></html> - + + .. USB @@ -360,7 +369,8 @@ <html><head/><body><p>Vendor tab</p></body></html> - + + .. Vendor @@ -400,7 +410,10 @@ <html><head/><body><p>GUID</p></body></html> - <HHHHHHHH-HHHH-HHHH-HHHH-HHHHHHHHHHHH;_ + <HHHHHHHH-HHHH-HHHH-HHHH-HHHHHHHHHHHH;_ + + + ---- @@ -533,7 +546,8 @@ <html><head/><body><p>MAC tab</p></body></html> - + + .. MAC @@ -573,7 +587,10 @@ <html><head/><body><p>MAC address</p></body></html> - <HH:HH:HH:HH:HH:HH:HH:HH:HH:HH:HH:HH:HH:HH:HH:HH;_ + <HH:HH:HH:HH:HH:HH:HH:HH:HH:HH:HH:HH:HH:HH:HH:HH;_ + + + ::::::::::::::: @@ -625,7 +642,8 @@ <html><head/><body><p>IPv4 tab</p></body></html> - + + .. IPv4 @@ -713,10 +731,10 @@ <html><head/><body><p>Local IP address</p></body></html> - 000.000.000.000 + 000.000.000.000 - 0.0.0.0 + 0.0.0.0 @@ -751,10 +769,10 @@ <html><head/><body><p>Remote IP address</p></body></html> - 000.000.000.000 + 000.000.000.000 - 0.0.0.0 + 0.0.0.0 @@ -881,10 +899,10 @@ <html><head/><body><p>Gateway IP address</p></body></html> - 000.000.000.000 + 000.000.000.000 - 0.0.0.0 + 0.0.0.0 @@ -916,7 +934,10 @@ <html><head/><body><p>Subnet mask</p></body></html> - 000.000.000.000 + 000.000.000.000 + + + 0.0.0.0 @@ -933,7 +954,8 @@ <html><head/><body><p>IPv6 tab</p></body></html> - + + .. IPv6 @@ -1085,7 +1107,10 @@ <html><head/><body><p>Local IP address</p></body></html> - <HHHH:HHHH:HHHH:HHHH:HHHH:HHHH:HHHH:HHHH + <HHHH:HHHH:HHHH:HHHH:HHHH:HHHH:HHHH:HHHH + + + ::::::: @@ -1120,7 +1145,10 @@ <html><head/><body><p>Remote IP address</p></body></html> - <HHHH:HHHH:HHHH:HHHH:HHHH:HHHH:HHHH:HHHH + <HHHH:HHHH:HHHH:HHHH:HHHH:HHHH:HHHH:HHHH + + + ::::::: @@ -1208,7 +1236,10 @@ <html><head/><body><p>Gateway IP address</p></body></html> - <HHHH:HHHH:HHHH:HHHH:HHHH:HHHH:HHHH:HHHH + <HHHH:HHHH:HHHH:HHHH:HHHH:HHHH:HHHH:HHHH + + + ::::::: @@ -1244,7 +1275,8 @@ <html><head/><body><p>SATA tab</p></body></html> - + + .. SATA @@ -1383,7 +1415,8 @@ <html><head/><body><p>Disk tab</p></body></html> - + + .. HD @@ -1461,7 +1494,8 @@ - + + .. @@ -1534,7 +1568,10 @@ <html><head/><body><p>Partition signature.</p></body></html> - <HHHHHHHH-HHHH-HHHH-HHHH-HHHHHHHHHHHH;_ + <HHHHHHHH-HHHH-HHHH-HHHH-HHHHHHHHHHHH;_ + + + ---- @@ -1609,10 +1646,10 @@ <html><head/><body><p>Partition start offset in hexadecimal.</p></body></html> - <\0\xHHHHHHHHHHHHHHHH;_ + <\0\xHHHHHHHHHHHHHHHH;_ - 0x0000000000000000 + 0x0000000000000000 @@ -1644,7 +1681,10 @@ <html><head/><body><p>Partition size in hexadecimal.</p></body></html> - <\0\xHHHHHHHHHHHHHHHH;_ + <\0\xHHHHHHHHHHHHHHHH;_ + + + 0x @@ -1661,7 +1701,8 @@ <html><head/><body><p>File tab</p></body></html> - + + .. File @@ -1715,7 +1756,8 @@ <html><head/><body><p>Firmware file tab</p></body></html> - + + .. Firmware file @@ -1772,7 +1814,8 @@ <html><head/><body><p>Firmware volume tab</p></body></html> - + + .. Firmware volume @@ -1820,16 +1863,17 @@ - BIOS boot specification tab + BIOS Boot Specification tab - BIOS boot specification tab + BIOS Boot Specification tab - <html><head/><body><p>BIOS boot specification tab</p></body></html> + <html><head/><body><p>BIOS Boot Specification tab</p></body></html> - + + .. BIOS Boot Specification @@ -1869,7 +1913,10 @@ <html><head/><body><p>Device type</p></body></html> - <\0\xHH;_ + <\0\xHH;_ + + + 0x @@ -1901,7 +1948,10 @@ <html><head/><body><p>Status flag</p></body></html> - <\0\xHH;_ + <\0\xHH;_ + + + 0x @@ -1947,7 +1997,8 @@ <html><head/><body><p>End of hardware tab</p></body></html> - + + .. End @@ -2017,7 +2068,8 @@ <html><head/><body><p>Unknown device path node tab</p></body></html> - + + .. Unknown @@ -2080,14 +2132,20 @@ - <\0\xHH;_ + <\0\xHH;_ + + + 0x - <\0\xHH;_ + <\0\xHH;_ + + + 0x diff --git a/src/form/efibooteditor.ui b/src/form/efibooteditor.ui index aaad24ef..567d389d 100644 --- a/src/form/efibooteditor.ui +++ b/src/form/efibooteditor.ui @@ -26,7 +26,8 @@ EFI Boot Editor - + + .. @@ -90,7 +91,8 @@ - + + .. @@ -121,7 +123,8 @@ - + + .. @@ -152,7 +155,8 @@ - + + .. @@ -183,7 +187,8 @@ - + + .. @@ -214,7 +219,8 @@ - + + .. @@ -325,7 +331,7 @@ - Ttimeout + Timeout Timeout @@ -348,7 +354,7 @@ 0 0 800 - 22 + 23 @@ -371,7 +377,7 @@ <html><head/><body><p>File menu</p></body></html> - File + &File @@ -391,7 +397,7 @@ <html><head/><body><p>Help menu</p></body></html> - Help + &Help @@ -413,13 +419,14 @@ - + + .. - Exit + &Quit - Exit + Quit <html><head/><body><p>Exit the program</p></body></html> @@ -430,10 +437,11 @@ - + + .. - Save + &Save Save @@ -447,10 +455,11 @@ - + + .. - Reload + &Reload Reload @@ -464,10 +473,11 @@ - + + .. - About EFI Boot Editor + About &EFI Boot Editor About EFI Boot Editor @@ -478,10 +488,11 @@ - + + .. - Export + &Export Export @@ -495,10 +506,11 @@ - + + .. - Import + &Import Import @@ -512,10 +524,11 @@ - + + .. - Dump raw EFI data + &Dump raw EFI data Dump raw EFI data diff --git a/src/main.cpp b/src/main.cpp index 7d6edf28..e7161fd4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,31 +1,53 @@ // SPDX-License-Identifier: LGPL-3.0-or-later #include #include +#include #include +#include #include "efibooteditor.h" auto main(int argc, char *argv[]) -> int { QApplication a(argc, argv); + a.setApplicationName(APPLICATION_NAME); QApplication::setApplicationVersion(VERSION); QIcon::setFallbackThemeName("Tango"); if(QIcon::themeName().isEmpty()) QIcon::setThemeName("Tango"); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + const auto translations_path = QLibraryInfo::path(QLibraryInfo::TranslationsPath); +#else + const auto translations_path = QLibraryInfo::location(QLibraryInfo::TranslationsPath); +#endif + + // Enable translation + for(const char *module: {"qt", "qtbase", PROJECT_NAME}) + { + std::unique_ptr translator{std::make_unique()}; + if(!translator->load(QLocale::system(), module, "_", ":/i18n") && !translator->load(QLocale::system(), module, "_", translations_path)) + continue; + + a.installTranslator(translator.release()); + } + + // Check for EFI support if(auto error_message = EFIBoot::init(); error_message) { return QMessageBox::critical( nullptr, - "EFI support required", + EFIBootEditor::tr("EFI support required"), QStringFromStdTString(*error_message)); } + // Command line support QCommandLineParser parser; parser.addHelpOption(); parser.addVersionOption(); parser.process(a); + // Show window EFIBootEditor w; w.show(); diff --git a/translations/efibooteditor_en.ts b/translations/efibooteditor_en.ts new file mode 100644 index 00000000..38176b9f --- /dev/null +++ b/translations/efibooteditor_en.ts @@ -0,0 +1,2051 @@ + + + + + BootEntryForm + + + Form + + + + + + Entry form + + + + + <html><head/><body><p>Entry form</p></body></html> + + + + + + + + + Description + + + + + + <html><head/><body><p>Description</p></body></html> + + + + + + + Path + + + + + <html><head/><body><p>Path</p></body></html> + + + + + + Paths list + + + + + <html><head/><body><p>Paths list</p></body></html> + + + + + + Move up + + + + + <html><head/><body><p>Move up</p></body></html> + + + + + + Move down + + + + + <html><head/><body><p>Move down</p></body></html> + + + + + + Remove + + + + + <html><head/><body><p>Remove</p></body></html> + + + + + + Edit + + + + + <html><head/><body><p>Edit</p></body></html> + + + + + + Add + + + + + <html><head/><body><p>Add</p></body></html> + + + + + + + + Optional data + + + + + + <html><head/><body><p>Optional data</p></body></html> + + + + + Optional + + + + + + Optional data format + + + + + <html><head/><body><p>Optional data format</p></body></html> + + + + + BASE64 + + + + + UTF-16 + + + + + UTF-8 + + + + + HEX + + + + + + + Attributes + + + + + <html><head/><body><p>Attributes</p></body></html> + + + + + + + Active + + + + + <html><head/><body><p>Active</p></body></html> + + + + + + + Force reconnect + + + + + <html><head/><body><p>Force reconnect</p></body></html> + + + + + + + Hidden + + + + + <html><head/><body><p>Hidden</p></body></html> + + + + + + + + + Category + + + + + + <html><head/><body><p>Category</p></body></html> + + + + + Boot + + + + + App + + + + + + + Index + + + + + <html><head/><body><p>Index</p></body></html> + + + + + + Order + + + + + <html><head/><body><p>Order</p></body></html> + + + + + Couldn't change optional data format! + + + + + BootEntryWidget + + + + + + Boot entry + + + + + <html><head/><body><p>Single boot entry</p></body></html> + + + + + Next boot + + + + + Run at next boot + + + + + <html><head/><body><p>When chosen, entry will run at next boot</p></body></html> + + + + + + Boot entry index + + + + + <html><head/><body><p>Boot entry index</p></body></html> + + + + + Index + + + + + + Boot entry description + + + + + <html><head/><body><p>Boot entry description, human readable name</p></body></html> + + + + + + + File path + + + + + <html><head/><body><p>Boot file path</p></body></html> + + + + + Optional data + + + + + + Data + + + + + <html><head/><body><p>Optional data, arguments passed to boot executable</p></body></html> + + + + + DevicePathDialog + + + Device path + + + + + + Device path dialog + + + + + <html><head/><body><p>Device path dialog</p></body></html> + + + + + + Options + + + + + <html><head/><body><p>Options</p></body></html> + + + + + + PCI tab + + + + + <html><head/><body><p>PCI tab</p></body></html> + + + + + PCI + + + + + + + + + Function + + + + + + <html><head/><body><p>Function</p></body></html> + + + + + + + + + Device + + + + + + <html><head/><body><p>Device</p></body></html> + + + + + + HID tab + + + + + <html><head/><body><p>HID tab</p></body></html> + + + + + + + + + + HID + + + + + <html><head/><body><p>HID</p></body></html> + + + + + <html><head/><body><p>HID in hexadecimal.</p></body></html> + + + + + + + + + UID + + + + + <html><head/><body><p>UID</p></body></html> + + + + + <html><head/><body><p>UID in hexadecimal.</p></body></html> + + + + + + USB tab + + + + + <html><head/><body><p>USB tab</p></body></html> + + + + + USB + + + + + + + + + Parent port number + + + + + + <html><head/><body><p>Parent port number</p></body></html> + + + + + + + + + Interface + + + + + + <html><head/><body><p>Interface</p></body></html> + + + + + + + Vendor tab + + + + + <html><head/><body><p>Vendor tab</p></body></html> + + + + + Vendor + + + + + Vendor GUID + + + + + Firmware GUID + + + + + <html><head/><body><p>Firmware GUID</p></body></html> + + + + + + + + GUID + + + + + <html><head/><body><p>GUID</p></body></html> + + + + + + + + Data format + + + + + + <html><head/><body><p>Data format</p></body></html> + + + + + + BASE64 + + + + + + UTF-16 + + + + + + UTF-8 + + + + + + HEX + + + + + + + + + + Data + + + + + + <html><head/><body><p>Data</p></body></html> + + + + + + Vendor data + + + + + <html><head/><body><p>Vendor data</p></body></html> + + + + + + + + + + Type + + + + + + <html><head/><body><p>Type</p></body></html> + + + + + HW + + + + + MSG + + + + + MEDIA + + + + + + MAC tab + + + + + <html><head/><body><p>MAC tab</p></body></html> + + + + + MAC + + + + + + + + + MAC address + + + + + + <html><head/><body><p>MAC address</p></body></html> + + + + + + + + + Interface type + + + + + + <html><head/><body><p>Interface type</p></body></html> + + + + + + IPv4 tab + + + + + <html><head/><body><p>IPv4 tab</p></body></html> + + + + + IPv4 + + + + + + + + + + + + Local IP address + + + + + + + + <html><head/><body><p>Local IP address</p></body></html> + + + + + + Local IP + + + + + + + + + + + + + + Local port + + + + + + + + <html><head/><body><p>Local port</p></body></html> + + + + + + + + + + + + Remote IP address + + + + + + + + <html><head/><body><p>Remote IP address</p></body></html> + + + + + + Remote IP + + + + + + + + + + + + + + Remote port + + + + + + + + <html><head/><body><p>Remote port</p></body></html> + + + + + + + + + + + + + + Protocol + + + + + + + + <html><head/><body><p>Protocol</p></body></html> + + + + + + + + Static IP address + + + + + + <html><head/><body><p>Static IP address</p></body></html> + + + + + + Static + + + + + + + + + + + + Gateway IP address + + + + + + + + <html><head/><body><p>Gateway IP address</p></body></html> + + + + + + Gateway IP + + + + + + + + + Subnet mask + + + + + + <html><head/><body><p>Subnet mask</p></body></html> + + + + + + IPv6 tab + + + + + <html><head/><body><p>IPv6 tab</p></body></html> + + + + + IPv6 + + + + + + + + IP address origin + + + + + + <html><head/><body><p>IP address origin</p></body></html> + + + + + Origin + + + + + + + + + Prefix length + + + + + + <html><head/><body><p>Prefix length</p></body></html> + + + + + Stateless auto-configuration + + + + + Stateful auto-configuration + + + + + + SATA tab + + + + + <html><head/><body><p>SATA tab</p></body></html> + + + + + SATA + + + + + + + + + HBA port + + + + + + <html><head/><body><p>HBA port</p></body></html> + + + + + + + + + Port multiplier port + + + + + + <html><head/><body><p>Port multiplier port</p></body></html> + + + + + + + + + LUN + + + + + + <html><head/><body><p>LUN</p></body></html> + + + + + + Disk tab + + + + + <html><head/><body><p>Disk tab</p></body></html> + + + + + HD + + + + + + + Disk + + + + + <html><head/><body><p>Disk</p></body></html> + + + + + + Choose disk + + + + + <html><head/><body><p>Choose disk from discovered in the system.</p></body></html> + + + + + Custom + + + + + + Reload drives + + + + + <html><head/><body><p>Reload system drives list.</p></body></html> + + + + + + + + Partition signature + + + + + <html><head/><body><p>Partition signature</p></body></html> + + + + + Signature + + + + + + Partition signature type + + + + + <html><head/><body><p>Choose partition signature type.</p></body></html> + + + + + NONE + + + + + MBR + + + + + <html><head/><body><p>Partition signature.</p></body></html> + + + + + + + + Partition number + + + + + + <html><head/><body><p>Partition number</p></body></html> + + + + + Partition + + + + + + + + Partition start offset + + + + + <html><head/><body><p>Partition start offset</p></body></html> + + + + + Start + + + + + <html><head/><body><p>Partition start offset in hexadecimal.</p></body></html> + + + + + + + + Partition size + + + + + <html><head/><body><p>Partition size</p></body></html> + + + + + Size + + + + + <html><head/><body><p>Partition size in hexadecimal.</p></body></html> + + + + + + File tab + + + + + <html><head/><body><p>File tab</p></body></html> + + + + + File + + + + + + + + File path + + + + + <html><head/><body><p>File path</p></body></html> + + + + + File name + + + + + <html><head/><body><p>File path to boot executable.</p></body></html> + + + + + + Firmware file tab + + + + + <html><head/><body><p>Firmware file tab</p></body></html> + + + + + Firmware file + + + + + + Firmware file name + + + + + <html><head/><body><p>Firmware file name</p></body></html> + + + + + + + + + + Name + + + + + <html><head/><body><p>Firmware file name.</p></body></html> + + + + + + <HHHHHHHH-HHHH-HHHH-HHHH-HHHHHHHHHHHH;_ + + + + + + Firmware volume tab + + + + + <html><head/><body><p>Firmware volume tab</p></body></html> + + + + + Firmware volume + + + + + + Firmware volume name + + + + + <html><head/><body><p>Firmware volume name</p></body></html> + + + + + <html><head/><body><p>Firmware volume name.</p></body></html> + + + + + + BIOS Boot Specification tab + + + + + <html><head/><body><p>BIOS Boot Specification tab</p></body></html> + + + + + BIOS Boot Specification + + + + + + + + + Device type + + + + + + <html><head/><body><p>Device type</p></body></html> + + + + + + + + + Status flag + + + + + + <html><head/><body><p>Status flag</p></body></html> + + + + + + + + + Description + + + + + + <html><head/><body><p>Description</p></body></html> + + + + + + End of hardware tab + + + + + <html><head/><body><p>End of hardware tab</p></body></html> + + + + + End + + + + + + + + + + Sub-Type + + + + + + <html><head/><body><p>Sub-Type</p></body></html> + + + + + End This Instance + + + + + End Entire + + + + + + Unknown device path node tab + + + + + <html><head/><body><p>Unknown device path node tab</p></body></html> + + + + + Unknown + + + + + + Unknown Type + + + + + <html><head/><body><p>Unknown Type</p></body></html> + + + + + + Unknown Sub-Type + + + + + <html><head/><body><p>Unknown Sub-Type</p></body></html> + + + + + + Unknown data + + + + + <html><head/><body><p>Unknown data</p></body></html> + + + + + + Action buttons + + + + + <html><head/><body><p>Action buttons</p></body></html> + + + + + + Couldn't change Vendor data format! + + + + + EFIBootEditor + + + EFI Boot Editor + + + + + + Boot entries + + + + + <html><head/><body><p>This is the list of the boot entries.</p></body></html> + + + + + + Add new entry + + + + + <html><head/><body><p>Click this to add new boot entry.</p></body></html> + + + + + + Remove entry + + + + + <html><head/><body><p>Click this to remove currently selected entry.</p></body></html> + + + + + + Move entry up + + + + + <html><head/><body><p>Click this to move currently selected entry up.</p></body></html> + + + + + + Move entry down + + + + + <html><head/><body><p>Click this to move currently selected entry down.</p></body></html> + + + + + + Reorder entries + + + + + <html><head/><body><p>Click here to adjust the order of all entries based on their position on the list.</p></body></html> + + + + + + Entry form + + + + + <html><head/><body><p>Entry form</p></body></html> + + + + + + + Global settings + + + + + <html><head/><body><p>Global settings</p></body></html> + + + + + <html><head/><body><p>Boot manager timeout</p></body></html> + + + + + + + + Timeout + + + + + <html><head/><body><p>Timeout</p></body></html> + + + + + + Menu bar + + + + + <html><head/><body><p>Menu bar</p></body></html> + + + + + + File + + + + + <html><head/><body><p>File menu</p></body></html> + + + + + &File + + + + + + Help + + + + + <html><head/><body><p>Help menu</p></body></html> + + + + + &Help + + + + + + Status bar + + + + + <html><head/><body><p>Status bar</p></body></html> + + + + + &Quit + + + + + Quit + + + + + <html><head/><body><p>Exit the program</p></body></html> + + + + + Ctrl+Q + + + + + &Save + + + + + Save + + + + + <html><head/><body><p>Apply changes to the system</p></body></html> + + + + + Ctrl+S + + + + + &Reload + + + + + Reload + + + + + <html><head/><body><p>Reloads EFI data from the system</p></body></html> + + + + + Ctrl+R + + + + + About &EFI Boot Editor + + + + + About EFI Boot Editor + + + + + <html><head/><body><p>Show information about the program</p></body></html> + + + + + &Export + + + + + Export + + + + + <html><head/><body><p>Export current entries into JSON</p></body></html> + + + + + Ctrl+E + + + + + &Import + + + + + Import + + + + + <html><head/><body><p>Import EFI data from JSON dump</p></body></html> + + + + + Ctrl+I + + + + + &Dump raw EFI data + + + + + Dump raw EFI data + + + + + <html><head/><body><p>Dumps raw EFI data for debugging purposes</p></body></html> + + + + + Working... + + + + + Are you sure you want to reload the entries?<br/>ALL of your changes will be lost! + + + + + Loading EFI Boot Manager entries... + + + + + + Searching EFI Boot Manager entries... + + + + + + + + %1: not found + + + + + Processing EFI Boot Manager entries (%1)... + + + + + + + %1: failed deserialization + + + + + Error loading entries + + + + + Failed to load some EFI Boot Manager entries: + + - %1 + + + + + Are you sure you want to reorder the boot entries?<br/>All indexes will be overwritten! + + + + + Are you sure you want to save?<br/>Your EFI configuration will be overwritten! + + + + + Saving EFI Boot Manager entries... + + + + + Searching old EFI Boot Manager entries... + + + + + + Error saving entries + + + + + + Entry %1(%2): duplicated index! + + + + + + + + Saving EFI Boot Manager entries (%1)... + + + + + + + + Error saving %1 + + + + + Removing old EFI Boot Manager entries (%1)... + + + + + Error removing %1 + + + + + Open boot configuration dump + + + + + + + JSON documents (*.json) + + + + + + + Importing boot configuration... + + + + + + + + Error importing boot configuration + + + + + + + Couldn't open selected file (%1). + + + + + Invalid _Type: %1 + + + + + + Importing EFI Boot Manager entries (%1)... + + + + + + + + + + + + %1: %2 expected + + + + + + + number + + + + + array + + + + + + + + object + + + + + + hexadecimal number + + + + + %1: failed parsing + + + + + + Failed to import some EFI Boot Manager entries: + + - %1 + + + + + object(raw_data: string, efi_attributes: number) + + + + + Save boot configuration dump + + + + + + Exporting boot configuration... + + + + + Error exporting boot configuration + + + + + + Exporting EFI Boot Manager entries (%1)... + + + + + Save raw EFI dump + + + + + + Error dumping raw EFI data + + + + + Failed to dump some EFI Boot Manager entries: + + - %1 + + + + + About %1 + + + + + <p><a href='%1'>Website</a></p><p>The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.</p><p>License: <a href='https://www.gnu.org/licenses/lgpl.html'>GNU LGPL Version 3</a></p><p>On Linux uses <a href='https://github.com/rhboot/efivar'>efivar</a> for EFI variables access.</p><p>Uses Tango Icons as fallback icons.</p> + + + + + Are you sure you want to quit? + + + + + EFI support required + + + + diff --git a/windows.rc b/windows.rc new file mode 100644 index 00000000..98bf6446 --- /dev/null +++ b/windows.rc @@ -0,0 +1,28 @@ +#include + +IDI_ICON1 ICON DISCARDABLE APPLICATION_ICON + +VS_VERSION_INFO VERSIONINFO + FILEVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_PATCH,0 + PRODUCTVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_PATCH,0 +{ + BLOCK "StringFileInfo" + { + // U.S. English - Windows, Multilingual + BLOCK "040904E4" + { + VALUE "ProductName", APPLICATION_NAME + VALUE "CompanyName", APPLICATION_NAME + VALUE "ProductVersion", VERSION + VALUE "FileDescription", PROJECT_DESCRIPTION + VALUE "FileVersion", VERSION + VALUE "InternalName", PROJECT_NAME + VALUE "LegalCopyright", APPLICATION_NAME + VALUE "OriginalFilename", PROJECT_NAME + } + } + BLOCK "VarFileInfo" + { + VALUE "Translation", 0x409, 1252 // 1252 = 0x04E4 + } +}