Repository navigation
Convert settings menu to QML - #1215
fracturehill wants to merge 5 commits into
Conversation
cd78bae to
15109d8
Compare
| } | ||
| changed = true; | ||
| folder->setIgnoreHiddenFiles(ignore); | ||
| if (!ignore && folder->canSync()) { |
There was a problem hiding this comment.
Of topic but the folder manages the rescheduling itself after a recent change so we should remove that.
| qCDebug(lcGeneralSettings) << u"Warning: could not find native language name for locale" << availableLocale; | ||
| nativeLanguageName = tr("unknown (%1)").arg(availableLocale); | ||
| } | ||
| void GeneralSettings::slotSetLanguage(int index) |
There was a problem hiding this comment.
I'd prefer if qml could pass the actual language, we could expose both display name and the language code to qml.
There was a problem hiding this comment.
Done. Now the model contains the display name as a textRole and the lang id as valueRole. Kept the two arrays (languageDisplayNames, languageIds) as separate properties because exposing them as a QVariant would be very messy
There was a problem hiding this comment.
Would a QML_VALUE_TYPE type help here, or just a list of std::pair?
There was a problem hiding this comment.
A list of std::pairs woudn't be accessible from qml. I guess I could create a custom pair-like type, but if it's a value type it'll just result in a bunch of unnecessary copies at runtime.
15109d8 to
92bbac9
Compare
92bbac9 to
af4418b
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved regressions leave active transfers using stale bandwidth limits, misconfigure metered-network visibility, and make some settings unreachable or inaccessible.
8 open issues
Refresh the hidden-file checkbox when folders change · New Refresh active sync engines after bandwidth changes · New Focus the language selector when autostart is unavailable · New Make network settings scrollable on small screens · New Refresh the autostart entry during initialization · New Read metered support from GeneralSettings · New Restore accessible names for bandwidth inputs · New Keep the minimum manual upload limit at 1 · New
What changed in this PR
Moves the desktop client’s general and network settings interface to QML, retaining C++ helpers for configuration and application actions.
Changes:
- Adds a QML settings page with reusable bandwidth controls.
- Exposes settings, startup utilities, and hidden-file preferences to QML.
- Replaces the widget-based settings layout and removes the separate network settings implementation.
| File | Description |
|---|---|
src/gui/qmlutils.h |
Declares startup and installation properties for QML. |
src/gui/qmlutils.cpp |
Implements startup utility wrappers. |
src/gui/qml/GeneralSettings.qml |
Adds the general and network settings interface. |
src/gui/networksettings.ui |
Removes the widget-based network form. |
src/gui/networksettings.h |
Removes the separate network settings class. |
src/gui/networksettings.cpp |
Removes the old network settings handlers. |
src/gui/generalsettings.ui |
Replaces widget controls with a QML host. |
src/gui/generalsettings.h |
Exposes settings properties and actions to QML. |
src/gui/generalsettings.cpp |
Loads QML and implements configuration accessors. |
src/gui/folderman.h |
Exposes FolderMan as a QML singleton with hidden-file settings. |
src/gui/folderman.cpp |
Adds singleton access and hidden-file change notifications. |
src/gui/CMakeLists.txt |
Registers the QML page and removes obsolete network sources. |
Review effort: Balanced
af4418b to
4921235
Compare
| text: qsTr("Language changes require a restart of this application to take effect.") | ||
| } | ||
|
|
||
| standardButtons: Dialog.Ok // TODO clicking the button makes it disappear? |
| { | ||
| Q_ASSERT(f); | ||
|
|
||
| bool hiddenFiles = !ignoreHiddenFiles(); |
There was a problem hiding this comment.
Maybe the folder manager should own this property? Then we would no longer depend on the values of the children?
There was a problem hiding this comment.
That would need to be a separate change. In the config file, the setting is per-folder, but we only expose a global checkmark so it needs special attention
|
|
||
| visible: !(Qt.platform.os == "windows" && OCUtils.isInstalledByStore) | ||
| Component.onCompleted: { | ||
| if (OCUtils.hasSystemLaunchOnStartup) { |
There was a problem hiding this comment.
I think we should just hide it like with the store install?
There was a problem hiding this comment.
Not sure i agree. The current design at least points the user towards why they can't change the setting here, instead of just hiding it. If anything, I'd prefer we make the message more specific, and have it say something like "Open the 'Startup Apps' setting in Windows". And have it show up for store installs as well.
0408c21 to
d1dbb7e
Compare
d1dbb7e to
a04a235
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The local QML type shadows the C++ settings controller, preventing its assignment and breaking controller-dependent bindings and actions.
8 open issues
QML GeneralSettings type shadows the controller · New Hidden-files notification condition is reversed · New Translation contexts no longer match the catalogs · New Changed captions break settings page selectors · New Initialization handlers persist inherited bandwidth settings · New Autostart state is stale when changed outside the app · New Cache the actual autostart state after setting it · New Public constructor bypasses the OCUtils singleton · New
8 resolved since last review
Keep the minimum manual upload limit at 1 Restore accessible names for bandwidth inputs Read metered support from GeneralSettings Refresh the autostart entry during initialization Make network settings scrollable on small screens Focus the language selector when autostart is unavailable Refresh active sync engines after bandwidth changes Refresh the hidden-file checkbox when folders change
Review effort: Max
| bool OCC::QmlUtils::OCUtils::hasLaunchOnStartup() const | ||
| { | ||
| return _hasLaunchOnStartup; |
993abb8 to
2f1d8a5
Compare
2f1d8a5 to
49f60f8
Compare
|
@saw-jan This is failing a couple of the gui tests and i'm not sure what's going wrong. Could you take a look please? |
Only exposes the one property we need for the settings menu (ignoreHiddenFiles)
49f60f8 to
eb4d992
Compare
Adds GeneralSettings.qml, which contains an exact replica of the C++ settings menu. The C++ GeneralSettings class is now exported as a QML element, and contains some helper properties that let us skip exporting several other classes as QML singletons (e.g. ConfigFile).
The class has been reimplemented in QML, inside GeneralSettings.qml
We don't want this to be themed anymore
eb4d992 to
cd6dc7c
Compare
|
on halt until after the release |
| connect(_ui->syncHiddenFilesCheckBox, &QCheckBox::toggled, this, [](bool checked) { FolderMan::instance()->setIgnoreHiddenFiles(!checked); }); | ||
| // Make sure the binary location is set correctly on startup | ||
| // TODO this should probably be moved elsewhere | ||
| const QString appName = Resources::JsonTheme::instance().applicationName(); |
| // Make sure the binary location is set correctly on startup | ||
| // TODO this should probably be moved elsewhere | ||
| const QString appName = Resources::JsonTheme::instance().applicationName(); | ||
| const QString displayName = Resources::JsonTheme::instance().applicationDisplayName(); |
Signed-off-by: Saw-jan <[email protected]>
|
@fracturehill There are two hard test failures. When sync is enabled for hidden files and folders, they are not being synced to/from the client. And this one passes locally but don't know why it's failing in ci: |
hmm, interesting, it works when tested manually. I need to check if there's something wrong in the test code. |




Adds GeneralSettings.qml, which contains an exact replica
of the C++ settings menu. The C++ GeneralSettings class is now
exported as a QML element, and contains some helper properties
that let us skip exporting several other classes as QML singletons
(e.g. ConfigFile).