feat(settings): add a dedicated screen for every user preference
The preferences used to be spread across a menu entry and hardcoded paths, so the user could not see them, let alone change them: where the journal goes, whether a dropped Flatpak file is accepted, and when the app checks its own version were all decided in code. They now live in AppSettings, one model the rest of the app already reads, and the new Settings screen only writes to it. Nothing keeps a second copy of a value, so a change is visible everywhere at once — switching directory moves the journal, unchecking drag & drop makes the window refuse the drop, blocking the update has the manual check say why instead of silently doing nothing. The update block is deliberately limited to PacManager itself: blocking a system package update is a decision the app has no business making. The language setting installs a Qt catalogue and asks every widget to retranslate. The interface is still written in French with QStringLiteral, so no catalogue ships yet; a language with none is shown in the list but disabled rather than silently doing nothing, and Qt Linguist stays optional so the build does not depend on it.
This commit is contained in:
27 files changed
+1906
-27
No files matched your search
@@ -1,5 +1,6 @@
|
||||
#include "app-core.h"
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QTimer>
|
||||
@@ -1194,10 +1195,36 @@ QString AppCore::packageDetails(const PackageInfo& pkg) {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
bool AppCore::shouldCheckForAppUpdate() const {
|
||||
if (!appUpdateCheckRefusal().isEmpty()) return false;
|
||||
return m_update->shouldCheck();
|
||||
}
|
||||
|
||||
QString AppCore::appUpdateCheckRefusal() const {
|
||||
AppSettings& preferences = AppSettings::instance();
|
||||
|
||||
// The user parked the app's own updates: no automatic check, and the manual
|
||||
// one says why instead of quietly doing nothing.
|
||||
if (preferences.updatesBlocked()) {
|
||||
return AppSettings::blockDescription(
|
||||
preferences.updatesBlockedIndefinitely(), preferences.updateBlockedUntil(),
|
||||
QDateTime::currentDateTime());
|
||||
}
|
||||
if (!preferences.autoUpdateCheckEnabled()) {
|
||||
return QStringLiteral(
|
||||
"La vérification automatique des mises à jour est désactivée dans "
|
||||
"les paramètres.");
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
void AppCore::checkForAppUpdate() {
|
||||
const QString refusal = appUpdateCheckRefusal();
|
||||
if (!refusal.isEmpty()) {
|
||||
LogManager::instance().logEvent(QStringLiteral("maj-app"), refusal);
|
||||
emit statusMessage(refusal);
|
||||
return;
|
||||
}
|
||||
|
||||
LogManager::instance().logEvent(QStringLiteral("maj-app"),
|
||||
QStringLiteral("vérification de version"));
|
||||
emit statusMessage(QStringLiteral("Vérification des mises à jour..."));
|
||||
|
||||
Reference in new issue
Block a user