Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't Save Shortcut Data #6666

Open
MaxNarr opened this issue Dec 11, 2024 · 2 comments
Open

Can't Save Shortcut Data #6666

MaxNarr opened this issue Dec 11, 2024 · 2 comments
Labels
bug A bug (error) in the software client GlobalShortcuts good first issue Good for first-time contributors

Comments

@MaxNarr
Copy link

MaxNarr commented Dec 11, 2024

Description

The data field of a shortcut (for example Whisper/shout -> Subchannel #1) will not be saved after restarting. After restarting the data field says "empty" instead of Subchannel #1. The rest of the shortcut is stored correctly.

The command line prompts this when pressing apply :QVariant::save: unable to save type 'ShortcutTarget' (type id: 65538).
The command line prompts this on startup:
./mumble <X>2024-12-11 22:31:02.804 Loading settings from "/home/coms/.config/Mumble/Mumble/mumble_settings.json" <W>2024-12-11 22:31:02.804 QVariant::load: unable to load type 65538. <W>2024-12-11 22:31:02.804 QVariant::load: unable to load type 65538.

Steps to reproduce

  1. Open Settings Menu
  2. Go to Shortcuts
  3. Press add button
  4. choose whisper/ shout in the "Function" section
  5. in the "data" section choose a channel. For example "Subchannel Experimental Typo Fix #1"
  6. restart mumble

Mumble version

1.6.0

Mumble component

Client

OS

Linux

Reproducible?

Yes

Additional information

Mumble was compiled using the latest available code from git on a raspbian on RPI 5.
Using this manual https://wikiarchiv.natenom.de/mumble/entwicklung/mumble-selbst-bauen.html

Relevant log output

No response

Screenshots

No response

@MaxNarr MaxNarr added bug A bug (error) in the software triage This issue is waiting to be triaged by one of the project members labels Dec 11, 2024
@Krzmbrzl
Copy link
Member

@davidebeatrici I strongly suspect this is due to some difference introduced with Qt 6 👀

@Krzmbrzl Krzmbrzl added client GlobalShortcuts good first issue Good for first-time contributors and removed triage This issue is waiting to be triaged by one of the project members labels Dec 11, 2024
@davidebeatrici
Copy link
Member

The error is usually caused by the data type not being registered, but we're doing that:

struct ShortcutTarget {
bool bCurrentSelection = false;
bool bUsers = true;
QStringList qlUsers = {};
QList< unsigned int > qlSessions = {};
int iChannel = -3;
QString qsGroup = {};
bool bLinks = false;
bool bChildren = false;
bool bForceCenter = false;
ShortcutTarget() = default;
bool isServerSpecific() const;
bool operator==(const ShortcutTarget &) const;
};
Q_DECLARE_METATYPE(ShortcutTarget)

#if defined(Q_OS_WIN)
GlobalShortcutWin::registerMetaTypes();
#endif
qRegisterMetaType< ShortcutTarget >("ShortcutTarget");
qRegisterMetaType< ChannelTarget >("ChannelTarget");
qRegisterMetaType< QVariant >("QVariant");
qRegisterMetaType< PluginSetting >("PluginSetting");
qRegisterMetaType< Search::SearchDialog::UserAction >("SearchDialog::UserAction");
qRegisterMetaType< Search::SearchDialog::ChannelAction >("SearchDialog::ChannelAction");

One difference I'm aware of is the deprecation of qRegisterMetaTypeStreamOperators, in fact in #6516 all instances were surrounded by a Qt version check:

#if QT_VERSION < 0x060000
	qRegisterMetaTypeStreamOperators< ChannelTarget >("ChannelTarget");
	qRegisterMetaTypeStreamOperators< PluginSetting >("PluginSetting");
	qRegisterMetaTypeStreamOperators< ShortcutTarget >("ShortcutTarget");
#endif

From https://www.qt.io/blog/whats-new-in-qmetatype-qvariant:

With Qt 6, the first thing we did was to extend the information stored in QMetaType: Modern C++ is now almost 10 years old, so it was about time to store information about the move constructor in QMetaType. And to provide better support for overaligned types, we now also store the alignment requirements of your types. Moreover, we considered the registries to be a bit clunky. After all, why should we require you to call QMetaType::registerEqualsComparator() when we could already know this by simply looking at the type? So in Qt 6, QMetaType::registerEqualsComparator, QMetaType::registerComparators, qRegisterMetaTypeStreamOperators and QMetaType::registerDebugStreamOperator have been removed. The metatype system will instead know about those automatically.

I suspect we may have to implement the stream operators in the class ourselves.

And, if that's actually the case, I would expect the same issue with ChannelTarget and PluginSetting as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug (error) in the software client GlobalShortcuts good first issue Good for first-time contributors
Projects
None yet
Development

No branches or pull requests

3 participants