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
+18
-2
@@ -34,8 +34,11 @@
|
||||
// across the code base feed it without extra plumbing.
|
||||
//
|
||||
// The file lives in the user's own data tree (XDG_CONFIG_HOME / home) so it is
|
||||
// never lost when a sandbox is rebuilt. All methods are safe to call from any
|
||||
// thread.
|
||||
// never lost when a sandbox is rebuilt, and both that directory and a size cap
|
||||
// are the user's to choose on the Settings screen: changing either takes effect
|
||||
// immediately, the existing journal being moved along (see AppSettings).
|
||||
//
|
||||
// All methods are safe to call from any thread.
|
||||
class LogManager : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -70,6 +73,14 @@ public:
|
||||
// Path of the journal as written on disk (useful for debugging).
|
||||
QString filePath() const;
|
||||
|
||||
// Size the journal currently takes on disk, 0 when there is none yet. The
|
||||
// Settings screen shows it next to the cap the user picked.
|
||||
qint64 currentSizeBytes() const;
|
||||
|
||||
// Path of the rotated journal, kept so the user can still read what came
|
||||
// before the last rotation.
|
||||
static QString backupFilePath();
|
||||
|
||||
// Routes every Qt log message into the journal. Call once, after the
|
||||
// QApplication exists. Safe to call more than once.
|
||||
static void installQtMessageHandler();
|
||||
@@ -83,6 +94,11 @@ private:
|
||||
// lock; this method takes it.
|
||||
void write(const QString& text);
|
||||
|
||||
// Applies the current AppSettings: moves the journal to the configured
|
||||
// directory and adopts the size cap. Called once from the constructor and
|
||||
// again whenever a setting changes.
|
||||
void applySettings();
|
||||
|
||||
QString m_filePath;
|
||||
FILE* m_file = nullptr;
|
||||
mutable QMutex m_mutex;
|
||||
|
||||
Reference in new issue
Block a user