pages/ was a flat row of eight screens, so a change to one meant scanning the whole folder to see what else was in it. The screens now sit in packages/ (browse, cleanup), overview/ (dashboard, history), system/ (logs, settings) and extensions/ (plugins), with the scaffolding they all build on — the Page base and the shared widgets — in base/.
92 lines
2.7 KiB
C++
92 lines
2.7 KiB
C++
#pragma once
|
|
|
|
#include <QString>
|
|
|
|
#include "page.h"
|
|
|
|
class QCheckBox;
|
|
class QComboBox;
|
|
class QFrame;
|
|
class QLabel;
|
|
class QLineEdit;
|
|
class QPushButton;
|
|
class QVBoxLayout;
|
|
|
|
// The Settings screen: one card per family of preferences, each one writing
|
|
// straight to the model the rest of the app reads (AppSettings, and the core's
|
|
// credential mode), so nothing here holds a private copy of a value.
|
|
//
|
|
// Four families are the user's alone — the journal (where it is written, how big
|
|
// it may grow), drag & drop of Flatpak files, the language, and the app's own
|
|
// update policy. The fifth, the sudo credential mode, is not new: the screen
|
|
// drives the same AppCore::setCredentialMode() the Paramètres menu already did,
|
|
// and the two stay in step.
|
|
class SettingsPage : public Page {
|
|
Q_OBJECT
|
|
public:
|
|
explicit SettingsPage(AppCore* core, QWidget* parent = nullptr);
|
|
|
|
QString navTitle() const override;
|
|
QString navSubtitle() const override;
|
|
|
|
// Re-reads every control from the model, so a value changed elsewhere (the
|
|
// menu bar, a restored settings file) is reflected when the screen opens.
|
|
void refresh() override;
|
|
|
|
private:
|
|
// ---- Credentials ----
|
|
QFrame* buildCredentialsCard();
|
|
|
|
// ---- Journal ----
|
|
QFrame* buildLogCard();
|
|
void loadLogCard();
|
|
void chooseLogDirectory();
|
|
void openLogDirectory();
|
|
void resetLogDirectory();
|
|
void updateLogSizeLabel();
|
|
|
|
// ---- Drag & drop ----
|
|
QFrame* buildDragDropCard();
|
|
|
|
// ---- Language ----
|
|
QFrame* buildLanguageCard();
|
|
void loadLanguageCard();
|
|
|
|
// ---- Application updates ----
|
|
QFrame* buildUpdateCard();
|
|
void loadUpdateCard();
|
|
void applyUpdateBlock();
|
|
void clearUpdateBlock();
|
|
void updateUpdateHint();
|
|
|
|
// One titled card, the building block every section below is made of. The
|
|
// card's own vertical layout is handed back so a section can fill it
|
|
// without going through QWidget::layout(), which hides the typed layout.
|
|
QFrame* card(const QString& title, QVBoxLayout** layoutOut) const;
|
|
|
|
AppSettings* preferences() const;
|
|
|
|
// Credentials
|
|
QComboBox* m_credentialMode = nullptr;
|
|
QLabel* m_credentialHint = nullptr;
|
|
|
|
// Journal
|
|
QLineEdit* m_logDirectory = nullptr;
|
|
QComboBox* m_logMaxSize = nullptr;
|
|
QLabel* m_logSizeLabel = nullptr;
|
|
QPushButton* m_logResetButton = nullptr;
|
|
|
|
// Drag & drop
|
|
QCheckBox* m_dragDrop = nullptr;
|
|
|
|
// Language
|
|
QComboBox* m_language = nullptr;
|
|
QLabel* m_languageHint = nullptr;
|
|
|
|
// Application updates
|
|
QCheckBox* m_autoUpdateCheck = nullptr;
|
|
QComboBox* m_updateBlockDelay = nullptr;
|
|
QPushButton* m_updateBlockButton = nullptr;
|
|
QLabel* m_updateHint = nullptr;
|
|
};
|