From 4febe405e36d6d605ad51d47148da99d16b92661 Mon Sep 17 00:00:00 2001 From: Popkornium18 Date: Wed, 17 Jun 2020 21:36:08 +0200 Subject: [PATCH 1/2] FEAT(client): Show info if some change could not be saved Log a message if a change like local muting of a user could not be saved because this user does not have a certificate. --- src/mumble/MainWindow.cpp | 28 ++++++++++++++++++++++------ src/mumble/MainWindow.h | 6 ++++++ src/mumble/UserLocalVolumeDialog.cpp | 9 +++++++-- 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/src/mumble/MainWindow.cpp b/src/mumble/MainWindow.cpp index a3eed35330..c4b5c4744b 100644 --- a/src/mumble/MainWindow.cpp +++ b/src/mumble/MainWindow.cpp @@ -1674,38 +1674,50 @@ void MainWindow::on_qaUserMute_triggered() { void MainWindow::on_qaUserLocalMute_triggered() { ClientUser *p = getContextMenuUser(); - if (!p) + if (!p) { return; + } bool muted = qaUserLocalMute->isChecked(); p->setLocalMute(muted); - if (! p->qsHash.isEmpty()) + if (! p->qsHash.isEmpty()) { g.db->setLocalMuted(p->qsHash, muted); + } else { + logChangeNotPermanent(QObject::tr("Local Mute"), p); + } } void MainWindow::on_qaUserLocalIgnore_triggered() { ClientUser *p = getContextMenuUser(); - if (!p) + if (!p) { return; + } bool ignored = qaUserLocalIgnore->isChecked(); p->setLocalIgnore(ignored); - if (! p->qsHash.isEmpty()) + if (! p->qsHash.isEmpty()) { g.db->setLocalIgnored(p->qsHash, ignored); + } else { + logChangeNotPermanent(QObject::tr("Ignore Messages"), p); + } } void MainWindow::on_qaUserLocalIgnoreTTS_triggered() { ClientUser *p = getContextMenuUser(); - if (!p) + if (!p) { return; + } bool ignoredTTS = qaUserLocalIgnoreTTS->isChecked(); p->setLocalIgnoreTTS(ignoredTTS); - if (! p->qsHash.isEmpty()) + if (! p->qsHash.isEmpty()) { g.db->setLocalIgnoredTTS(p->qsHash, ignoredTTS); + } else { + logChangeNotPermanent(QObject::tr("Disable Text-To-Speech"), p); + } } void MainWindow::on_qaUserLocalVolume_triggered() { @@ -3524,6 +3536,10 @@ QPair MainWindow::openImageFile() { return retval; } +void MainWindow::logChangeNotPermanent(const QString &actionName, ClientUser * const p) const { + g.l->log(Log::Warning, QObject::tr("\"%1\" could not be saved permanently and is lost on restart because %2 does not have a certificate.").arg(actionName).arg(Log::formatClientUser(p, Log::Target))); +} + void MainWindow::destroyUserInformation() { UserInformation *ui = static_cast(sender()); QMap::iterator i; diff --git a/src/mumble/MainWindow.h b/src/mumble/MainWindow.h index a9e94a502e..b7fe532cad 100644 --- a/src/mumble/MainWindow.h +++ b/src/mumble/MainWindow.h @@ -329,6 +329,12 @@ class MainWindow : public QMainWindow, public MessageHandler, public Ui::MainWin MUMBLE_MH_ALL #undef MUMBLE_MH_MSG void removeContextAction(const MumbleProto::ContextActionModify &msg); + /// Logs a message that an action could not be saved permanently because + /// the user has no certificate and can't be reliably identified. + /// + /// @param actionName The name of the action that has been executed. + /// @param p The user on which the action was performed. + void logChangeNotPermanent(const QString &actionName, ClientUser * const p) const; }; #endif diff --git a/src/mumble/UserLocalVolumeDialog.cpp b/src/mumble/UserLocalVolumeDialog.cpp index 76cf27cd87..8cd5b5bd08 100644 --- a/src/mumble/UserLocalVolumeDialog.cpp +++ b/src/mumble/UserLocalVolumeDialog.cpp @@ -37,6 +37,7 @@ #include "UserLocalVolumeDialog.h" #include "ClientUser.h" #include "Database.h" +#include "MainWindow.h" #include #include @@ -99,8 +100,12 @@ void UserLocalVolumeDialog::on_qbbUserLocalVolume_clicked(QAbstractButton *butto } if (button == qbbUserLocalVolume->button(QDialogButtonBox::Ok)) { ClientUser *user = ClientUser::get(m_clientSession); - if (user && !user->qsHash.isEmpty()) { - g.db->setUserLocalVolume(user->qsHash, user->fLocalVolume); + if (user) { + if (!user->qsHash.isEmpty()) { + g.db->setUserLocalVolume(user->qsHash, user->fLocalVolume); + } else { + g.mw->logChangeNotPermanent(QObject::tr("Local Volume Adjustment..."), user); + } } UserLocalVolumeDialog::close(); } From fd7befc54dec2ffcfc3532d3245cde6ee06e199f Mon Sep 17 00:00:00 2001 From: Popkornium18 Date: Sat, 20 Jun 2020 12:44:08 +0200 Subject: [PATCH 2/2] Translation update Updating 'mumble_en.ts'... Found 1880 source text(s) (5 new and 1875 already existing) --- src/mumble/mumble_en.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/mumble/mumble_en.ts b/src/mumble/mumble_en.ts index c9c189bd7b..07e6241262 100644 --- a/src/mumble/mumble_en.ts +++ b/src/mumble/mumble_en.ts @@ -6961,6 +6961,26 @@ Multichannel echo cancellation requires more CPU, so you should try mixed first< See <a href="https://wiki.mumble.info/wiki/Installing_Mumble">the Mumble wiki</a> for what alternatives there are.</p> + + Local Mute + + + + Ignore Messages + + + + Disable Text-To-Speech + + + + "%1" could not be saved permanently and is lost on restart because %2 does not have a certificate. + + + + Local Volume Adjustment... + + RichTextEditor