gtk: interface GTK4, préférences, versions, traductions, licence MIT

- interface gtkmm-4 : véhicules, ajout par VIN, mises à jour, dossier,
  téléchargement avec reprise et arrêt, choix de la clé, confirmation,
  écriture avec progression, fin avec guide d'installation ; travail
  dans un thread, résultats renvoyés via Glib::Dispatcher
- préférences : dossier de téléchargement, langue (système par défaut),
  recherche automatique de nouvelle version d'OpenPU
- recherche de nouvelle version (releases GitHub, format tags Gitea
  accepté) avec ouverture de la page dans le navigateur ;
  openpu-cli app-update
- versions : project(VERSION) + git describe régénéré à chaque build,
  openpu-cli --version, À propos, User-Agent, CHANGELOG, tools/release.sh
  (étiquette annotée, push vers tous les remotes, release GitHub)
- traductions gettext : textes anglais, fr.po complet (96 chaînes),
  extracteur de secours sans xgettext
- core : module job (téléchargement licence/fw/carte), liens des guides
  PDF, ordre des véhicules conservé (ordered_json)
- licence MIT (LICENSE, en-têtes SPDX) ; dépôt principal sur GitHub
- validé dans WSLg : parcours complet jusqu'à l'écriture d'une clé loop
  (FAT32 propre, fichiers téléchargés supprimés)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WDASLCiN764v685boRVYar
This commit is contained in:
yann64andClaude Opus 5.5 committed 2026-11-28 19:54:04 +01:00
1 parent 6a7a2f1ee9
commit 384aaf78c6
62 files changed
+3029 -20

No files matched your search

+141
View File
@@ -0,0 +1,141 @@
// SPDX-License-Identifier: MIT
#pragma once
#include "ui_queue.hpp"
#include "openpu/api_client.hpp"
#include "openpu/app_update.hpp"
#include "openpu/job.hpp"
#include "openpu/storage.hpp"
#include "openpu/usb.hpp"
#include <gtkmm.h>
#include <memory>
#include <optional>
#include <thread>
namespace openpu::gtk {
class MainWindow : public Gtk::ApplicationWindow {
public:
MainWindow();
~MainWindow() override;
MainWindow(const MainWindow&) = delete;
MainWindow& operator=(const MainWindow&) = delete;
private:
// pages
void buildVehiclesPage();
void buildAddPage();
void buildUpdatesPage();
void buildDownloadPage();
void buildUsbPage();
void buildWritePage();
void buildDonePage();
void show(const char* page);
// vehicles
void refreshVehicles();
std::optional<Vehicle> selectedVehicle() const;
void onAddVehicle();
void onRemoveVehicle();
void onCheckUpdates();
// updates / download
void showUpdates(const AvailableUpdates& updates);
void onChooseFolder();
void onStartDownload();
void startDownload(const DownloadPlan& plan);
void onDownloadProgress(const JobProgress& p);
void onDownloaded(const DownloadedFiles& files);
// usb
void enterUsbPage();
void refreshDrives();
void onPrepareUsb();
void startWrite(const UsbDrive& drive);
void onWriteProgress(const UsbProgress& p);
void onWritten();
// helpers
template <typename F>
void runAsync(F&& work);
void joinWorker();
void showError(const Glib::ustring& title, const Glib::ustring& detail);
void showAbout();
void showPreferences();
void checkAppUpdate(bool manual);
void offerAppUpdate(const AppRelease& release);
void saveVehicles();
void updateDownloadDirLabel();
std::string language() const;
UiQueue ui_;
std::unique_ptr<Transport> transport_;
std::unique_ptr<ApiClient> api_;
std::unique_ptr<UsbBackend> usb_;
VehicleStore store_;
Settings settings_;
std::filesystem::path settingsFile_;
std::thread worker_;
std::thread updateThread_; // OpenPU new-version check, independent of the main flow
bool updateCheckRunning_ = false;
CancelToken cancel_;
// flow state
std::optional<Vehicle> current_;
AvailableUpdates updates_;
DownloadedFiles files_;
std::vector<UsbDrive> drives_;
std::uint64_t payload_ = 0;
// widgets
Gtk::HeaderBar header_;
Gtk::Button back_;
Gtk::MenuButton menu_;
Gtk::Label* prefsDirLabel_ = nullptr; // download folder shown in the open preferences window
Gtk::Stack stack_;
Gtk::Box vehiclesPage_{Gtk::Orientation::VERTICAL, 12};
Gtk::ListBox vehicleList_;
Gtk::Label vehiclesEmpty_;
Gtk::Button addButton_, removeButton_, checkButton_;
Gtk::Box addPage_{Gtk::Orientation::VERTICAL, 12};
Gtk::Entry vinEntry_, nameEntry_;
Gtk::Label addStatus_;
Gtk::Spinner addSpinner_;
Gtk::Button addConfirm_;
Gtk::Box updatesPage_{Gtk::Orientation::VERTICAL, 12};
Gtk::Label updatesTitle_, updatesStatus_;
Gtk::Spinner updatesSpinner_;
Gtk::CheckButton firmwareCheck_, mapCheck_;
Gtk::Label downloadDirLabel_;
Gtk::Button chooseDir_, downloadButton_, guideButton_;
Gtk::Box downloadPage_{Gtk::Orientation::VERTICAL, 12};
Gtk::Label downloadTitle_;
Gtk::Label licenseLabel_, firmwareLabel_, mapLabel_;
Gtk::ProgressBar firmwareBar_, mapBar_;
Gtk::Label etaLabel_;
Gtk::Button cancelDownload_;
Gtk::Box usbPage_{Gtk::Orientation::VERTICAL, 12};
Gtk::Label usbInfo_;
Gtk::DropDown driveDrop_;
Glib::RefPtr<Gtk::StringList> driveModel_;
Gtk::Button refreshDrives_, prepareButton_;
Gtk::Label usbStatus_;
Gtk::Box writePage_{Gtk::Orientation::VERTICAL, 12};
Gtk::Label writeStep_, writeDetail_;
Gtk::ProgressBar writeBar_;
Gtk::Button cancelWrite_;
Gtk::Box donePage_{Gtk::Orientation::VERTICAL, 12};
Gtk::Label doneText_;
Gtk::Button doneGuide_, doneButton_;
};
} // namespace openpu::gtk