Skip to content

Convert settings menu to QML - #1215

Open
fracturehill wants to merge 5 commits into
mainfrom
work/settingsqml
Open

fracturehill wants to merge 5 commits into
mainfrom
work/settingsqml

Conversation

@fracturehill

Copy link
Copy Markdown
Contributor

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).

@fracturehill
fracturehill force-pushed the work/settingsqml branch 2 times, most recently from cd78bae to 15109d8 Compare November 2, 2026 13:27
Comment thread src/gui/folderman.cpp
}
changed = true;
folder->setIgnoreHiddenFiles(ignore);
if (!ignore && folder->canSync()) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of topic but the folder manages the rescheduling itself after a recent change so we should remove that.

Comment thread src/gui/generalsettings.cpp Outdated
qCDebug(lcGeneralSettings) << u"Warning: could not find native language name for locale" << availableLocale;
nativeLanguageName = tr("unknown (%1)").arg(availableLocale);
}
void GeneralSettings::slotSetLanguage(int index)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer if qml could pass the actual language, we could expose both display name and the language code to qml.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would a QML_VALUE_TYPE type help here, or just a list of std::pair?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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
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

Comment thread src/gui/folderman.h Resolved
Comment thread src/gui/generalsettings.cpp Resolved
Comment thread src/gui/qml/GeneralSettings.qml Resolved
Comment thread src/gui/qml/SettingsPanel.qml Resolved
Comment thread src/gui/qml/GeneralSettings.qml Resolved
Comment thread src/gui/qml/GeneralSettings.qml Resolved
Comment thread src/gui/qml/SettingsPanel.qml Resolved
Comment thread src/gui/qml/GeneralSettings.qml Resolved
Comment thread src/gui/qml/GeneralSettings.qml Resolved
Comment thread src/gui/folderman.cpp Resolved
Comment thread src/gui/generalsettings.cpp Resolved
Comment thread src/gui/qml/GeneralSettings.qml Resolved
text: qsTr("Language changes require a restart of this application to take effect.")
}

standardButtons: Dialog.Ok // TODO clicking the button makes it disappear?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a bug with Qt Quick (on top of KDE Plasma, at least). For a split second after closing the window, as the fade out animation is playing, the button will disappear. I think it's a minor enough problem we can fix it later
image
image

Comment thread src/gui/qml/SettingsPanel.qml Resolved
Comment thread src/gui/folderman.cpp Outdated
{
Q_ASSERT(f);

bool hiddenFiles = !ignoreHiddenFiles();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the folder manager should own this property? Then we would no longer depend on the values of the children?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread src/gui/generalsettings.cpp Resolved
Comment thread src/gui/qml/GeneralSettings.qml Outdated

visible: !(Qt.platform.os == "windows" && OCUtils.isInstalledByStore)
Component.onCompleted: {
if (OCUtils.hasSystemLaunchOnStartup) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should just hide it like with the store install?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/gui/qmlutils.h Resolved
@fracturehill
fracturehill force-pushed the work/settingsqml branch 2 times, most recently from 0408c21 to d1dbb7e Compare November 13, 2026 12:57
Comment thread src/gui/qmlutils.cpp Fixed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread src/gui/qml/SettingsPanel.qml Resolved
Comment thread src/gui/folderman.cpp Resolved
Comment thread src/gui/qml/GeneralSettings.qml Resolved
Comment thread src/gui/qml/GeneralSettings.qml Resolved
Comment thread src/gui/qml/SettingsPanel.qml Resolved
Comment thread src/gui/qmlutils.cpp
Comment on lines +174 to +176
bool OCC::QmlUtils::OCUtils::hasLaunchOnStartup() const
{
return _hasLaunchOnStartup;
Comment thread src/gui/qmlutils.cpp Resolved
Comment thread src/gui/qmlutils.h Resolved
@fracturehill
fracturehill force-pushed the work/settingsqml branch 5 times, most recently from 993abb8 to 2f1d8a5 Compare November 16, 2026 13:12
@fracturehill

Copy link
Copy Markdown
Contributor Author

@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)
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
@TheOneRing

Copy link
Copy Markdown
Contributor

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();
@saw-jan

saw-jan commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

@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.

features/sync-edge-cases/syncResources.feature:298  Sync hidden files
features/sync-edge-cases/syncResources.feature:350  Sync hidden folders

And this one passes locally but don't know why it's failing in ci:

features/sync-edge-cases/syncResources.feature:224  Sync same unicode folder from server and client at the same time

@saw-jan

saw-jan commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

@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.

features/sync-edge-cases/syncResources.feature:298  Sync hidden files
features/sync-edge-cases/syncResources.feature:350  Sync hidden folders

And this one passes locally but don't know why it's failing in ci:

features/sync-edge-cases/syncResources.feature:224  Sync same unicode folder from server and client at the same time

hmm, interesting, it works when tested manually. I need to check if there's something wrong in the test code.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants