mirror of
https://github.com/mumble-voip/mumble.git
synced 2025-10-26 11:19:16 +00:00
FEAT(client): Add option to change TalkingUI background color
This is a revisit to issue #5411. This commit adds an optional QColor in settings to set the talkingUI background color.
This commit is contained in:
parent
be52c596be
commit
e7ec59e39e
@ -436,3 +436,19 @@ void from_json(const nlohmann::json &j, QSizeF &size) {
|
||||
size.setWidth(j.at("width").get< qreal >());
|
||||
size.setHeight(j.at("height").get< qreal >());
|
||||
}
|
||||
|
||||
template< typename T > void to_json(nlohmann::json &j, const std::optional< T > &opt) {
|
||||
if (opt.has_value()) {
|
||||
j = *opt;
|
||||
} else {
|
||||
j = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
template< typename T > void from_json(const nlohmann::json &j, std::optional< T > &opt) {
|
||||
if (j.is_null()) {
|
||||
opt = std::nullopt;
|
||||
} else {
|
||||
opt = j.get< T >();
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
#include "SearchDialog.h"
|
||||
#include "Global.h"
|
||||
|
||||
#include <QColorDialog>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QtCore/QFileSystemWatcher>
|
||||
#include <QtCore/QStack>
|
||||
@ -69,6 +70,8 @@ LookConfig::LookConfig(Settings &st) : ConfigWidget(st) {
|
||||
qcbUserDrag->insertItem(Settings::Move, tr("Move"), Settings::Move);
|
||||
|
||||
connect(qrbLCustom, SIGNAL(toggled(bool)), qcbLockLayout, SLOT(setEnabled(bool)));
|
||||
connect(qbClearBackgroundColor, &QPushButton::clicked, this, &LookConfig::talkinguiBackgroundCleared);
|
||||
connect(qbBackgroundColor, &QPushButton::clicked, this, &LookConfig::qbBackgroundColor_clicked);
|
||||
|
||||
QDir userThemeDirectory = Themes::getUserThemesDirectory();
|
||||
if (userThemeDirectory.exists()) {
|
||||
@ -109,6 +112,27 @@ QString LookConfig::title() const {
|
||||
return tr("User Interface");
|
||||
}
|
||||
|
||||
void LookConfig::qbBackgroundColor_clicked() {
|
||||
QColor color = QColorDialog::getColor(Qt::white, this, tr("Choose a Color"));
|
||||
if (color.isValid()) {
|
||||
talkinguiBackgroundSet(color);
|
||||
}
|
||||
}
|
||||
|
||||
void LookConfig::talkinguiBackgroundSet(QColor color) {
|
||||
selectedBackgroundColor = color;
|
||||
QString style = QString("background-color: %1;").arg(color.name());
|
||||
qccolorPreview->setStyleSheet(style);
|
||||
swBackgroundColor->setCurrentIndex(0);
|
||||
qlBackgroundColor->setBuddy(qbClearBackgroundColor);
|
||||
}
|
||||
|
||||
void LookConfig::talkinguiBackgroundCleared() {
|
||||
selectedBackgroundColor = std::nullopt;
|
||||
swBackgroundColor->setCurrentIndex(1);
|
||||
qlBackgroundColor->setBuddy(qbBackgroundColor);
|
||||
}
|
||||
|
||||
const QString &LookConfig::getName() const {
|
||||
return LookConfig::name;
|
||||
}
|
||||
@ -208,6 +232,11 @@ void LookConfig::load(const Settings &r) {
|
||||
qsbPrefixCharCount->setValue(r.iTalkingUI_PrefixCharCount);
|
||||
qsbPostfixCharCount->setValue(r.iTalkingUI_PostfixCharCount);
|
||||
qleAbbreviationReplacement->setText(r.qsTalkingUI_AbbreviationReplacement);
|
||||
if (r.talkingUI_BackgroundColor.has_value()) {
|
||||
talkinguiBackgroundSet(*r.talkingUI_BackgroundColor);
|
||||
} else {
|
||||
talkinguiBackgroundCleared();
|
||||
}
|
||||
|
||||
qleChannelSeparator->setText(r.qsHierarchyChannelSeparator);
|
||||
|
||||
@ -280,6 +309,7 @@ void LookConfig::save() const {
|
||||
s.iTalkingUI_PrefixCharCount = qsbPrefixCharCount->value();
|
||||
s.iTalkingUI_PostfixCharCount = qsbPostfixCharCount->value();
|
||||
s.qsTalkingUI_AbbreviationReplacement = qleAbbreviationReplacement->text();
|
||||
s.talkingUI_BackgroundColor = selectedBackgroundColor;
|
||||
|
||||
s.qsHierarchyChannelSeparator = qleChannelSeparator->text();
|
||||
|
||||
|
||||
@ -6,6 +6,8 @@
|
||||
#ifndef MUMBLE_MUMBLE_LOOKCONFIG_H_
|
||||
#define MUMBLE_MUMBLE_LOOKCONFIG_H_
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include "ConfigDialog.h"
|
||||
#include "ThemeInfo.h"
|
||||
|
||||
@ -18,6 +20,8 @@ class LookConfig : public ConfigWidget, Ui::LookConfig {
|
||||
private:
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY(LookConfig)
|
||||
std::optional< QColor > selectedBackgroundColor;
|
||||
|
||||
public:
|
||||
/// The unique name of this ConfigWidget
|
||||
static const QString name;
|
||||
@ -30,9 +34,12 @@ public slots:
|
||||
void accept() const Q_DECL_OVERRIDE;
|
||||
void save() const Q_DECL_OVERRIDE;
|
||||
void load(const Settings &r) Q_DECL_OVERRIDE;
|
||||
void talkinguiBackgroundSet(QColor color);
|
||||
void talkinguiBackgroundCleared();
|
||||
void themeDirectoryChanged();
|
||||
void on_qcbAbbreviateChannelNames_stateChanged(int state);
|
||||
void on_qcbUsersAlwaysVisible_stateChanged(int state);
|
||||
void qbBackgroundColor_clicked();
|
||||
|
||||
private:
|
||||
/// Reload themes combobox and select given configuredStyle in it
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>728</width>
|
||||
<width>777</width>
|
||||
<height>1273</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -152,7 +152,7 @@
|
||||
<item row="6" column="1">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@ -162,19 +162,6 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QGroupBox" name="qgbLayout">
|
||||
<property name="title">
|
||||
@ -283,7 +270,7 @@
|
||||
<item row="1" column="2">
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@ -325,7 +312,7 @@
|
||||
<item row="1" column="4">
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@ -338,7 +325,7 @@
|
||||
<item row="1" column="0">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@ -351,7 +338,7 @@
|
||||
<item row="1" column="8">
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@ -364,7 +351,7 @@
|
||||
<item row="1" column="6">
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@ -598,59 +585,152 @@
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<property name="horizontalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="12" column="0">
|
||||
<widget class="QLabel" name="qlPostfixCharCount">
|
||||
<property name="toolTip">
|
||||
<string>How many characters from the original name to display at the end of an abbreviated name.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Abbreviated postfix characters</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>qsbPostfixCharCount</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QSpinBox" name="qsbMaxNameLength">
|
||||
<property name="toolTip">
|
||||
<string>The preferred maximum length of a channel (hierarchy) name in the Talking UI. Note that this is not a hard limit though.</string>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string>Maximum channel name length</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="1">
|
||||
<widget class="QLineEdit" name="qleAbbreviationReplacement">
|
||||
<item row="12" column="2">
|
||||
<widget class="QStackedWidget" name="swBackgroundColor">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page_1">
|
||||
<layout class="QGridLayout" name="gridLayout_8">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="qbClearBackgroundColor">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Clears the TalkingUI background setting.</string>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string>Clear Background Color</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clear</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="qccolorPreview">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: white</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Shape::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Shadow::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_0">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_7">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="qbBackgroundColor">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Color that gets used for the background of the talkingUI.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Choose</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="qcbUsersAlwaysVisible">
|
||||
<property name="toolTip">
|
||||
<string>If this is checked, users will always be visible in the TalkingUI (regardless of talking state).</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Always keep users visible</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="qlRelFontSize">
|
||||
<property name="toolTip">
|
||||
<string>Relative font size to use in the Talking UI in percent.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Rel. font size (%)</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>qsbRelFontSize</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<widget class="QLabel" name="qlAbbreviationReplacement">
|
||||
<property name="toolTip">
|
||||
<string>String that gets used instead of the cut-out part of an abbreviated name.</string>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string>Abbreviation replacement characters</string>
|
||||
<property name="text">
|
||||
<string>Abbreviation replacement</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>qleAbbreviationReplacement</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<widget class="QSpinBox" name="qsbPostfixCharCount">
|
||||
<property name="toolTip">
|
||||
<string>How many characters from the original name to display at the end of an abbreviated name.</string>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string>Postfix character count</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="5" column="2">
|
||||
<widget class="QSpinBox" name="qsbRelFontSize">
|
||||
<property name="toolTip">
|
||||
<string>Relative font size to use in the Talking UI in percent.</string>
|
||||
@ -666,7 +746,17 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<item row="8" column="2">
|
||||
<widget class="QSpinBox" name="qsbMaxNameLength">
|
||||
<property name="toolTip">
|
||||
<string>The preferred maximum length of a channel (hierarchy) name in the Talking UI. Note that this is not a hard limit though.</string>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string>Maximum channel name length</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="2">
|
||||
<widget class="QLabel" name="qlMaxNameLength">
|
||||
<property name="toolTip">
|
||||
<string>The preferred maximum length of a channel (hierarchy) name in the Talking UI. Note that this is not a hard limit though.</string>
|
||||
@ -679,7 +769,92 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QCheckBox" name="qcbLocalUserVisible">
|
||||
<property name="toolTip">
|
||||
<string>If this is checked, the local user (yourself) will always be visible in the TalkingUI (regardless of talking state).</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Always keep local user visible</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="2">
|
||||
<widget class="QSpinBox" name="qsbPostfixCharCount">
|
||||
<property name="toolTip">
|
||||
<string>How many characters from the original name to display at the end of an abbreviated name.</string>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string>Postfix character count</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="qcbAbbreviateChannelNames">
|
||||
<property name="toolTip">
|
||||
<string>Whether the channel (hierarchy) name should be abbreviated, if it exceeds the specified maximum length.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Abbreviate channel names</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<widget class="QLabel" name="qlBackgroundColor">
|
||||
<property name="toolTip">
|
||||
<string>Background color that, if set, overrides the theme background color.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Background Color</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>qbBackgroundColor</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0" colspan="2">
|
||||
<widget class="QLabel" name="qlPostfixCharCount">
|
||||
<property name="toolTip">
|
||||
<string>How many characters from the original name to display at the end of an abbreviated name.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Abbreviated postfix characters</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>qsbPostfixCharCount</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="2">
|
||||
<widget class="QLineEdit" name="qleAbbreviationReplacement">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>String that gets used instead of the cut-out part of an abbreviated name.</string>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string>Abbreviation replacement characters</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="qlChannelHierarchyDepth">
|
||||
<property name="toolTip">
|
||||
<string>The names of how many parent channels should be included in the channel's name when displaying it in the TalkingUI?</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Channel hierarchy depth</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>qsbChannelHierarchyDepth</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QSpinBox" name="qsbSilentUserLifetime">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
@ -701,7 +876,27 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<item row="7" column="2">
|
||||
<widget class="QSpinBox" name="qsbChannelHierarchyDepth">
|
||||
<property name="toolTip">
|
||||
<string>The names of how many parent channels should be included in the channel's name when displaying it in the TalkingUI?</string>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string>Channel hierarchy depth</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="2">
|
||||
<widget class="QSpinBox" name="qsbPrefixCharCount">
|
||||
<property name="toolTip">
|
||||
<string>How many characters from the original name to display at the beginning of an abbreviated name.</string>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string>Prefix character count</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="3">
|
||||
<widget class="QCheckBox" name="qcbAbbreviateCurrentChannel">
|
||||
<property name="toolTip">
|
||||
<string>Whether to also allow abbreviating the current channel of a user (instead of only its parent channels).</string>
|
||||
@ -730,27 +925,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="qcbAbbreviateChannelNames">
|
||||
<property name="toolTip">
|
||||
<string>Whether the channel (hierarchy) name should be abbreviated, if it exceeds the specified maximum length.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Abbreviate channel names</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QSpinBox" name="qsbChannelHierarchyDepth">
|
||||
<property name="toolTip">
|
||||
<string>The names of how many parent channels should be included in the channel's name when displaying it in the TalkingUI?</string>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string>Channel hierarchy depth</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<item row="4" column="0" colspan="3">
|
||||
<widget class="QCheckBox" name="qcbShowLocalListeners">
|
||||
<property name="toolTip">
|
||||
<string>Whether to show all of the local user's listeners (ears) in the TalkingUI (and thereby also the channels they are in). </string>
|
||||
@ -760,20 +935,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="0">
|
||||
<widget class="QLabel" name="qlAbbreviationReplacement">
|
||||
<property name="toolTip">
|
||||
<string>String that gets used instead of the cut-out part of an abbreviated name.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Abbreviation replacement</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>qleAbbreviationReplacement</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<item row="9" column="0" colspan="2">
|
||||
<widget class="QLabel" name="qlPrefixCharCount">
|
||||
<property name="toolTip">
|
||||
<string>How many characters from the original name to display at the beginning of an abbreviated name.</string>
|
||||
@ -786,62 +948,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="qcbLocalUserVisible">
|
||||
<property name="toolTip">
|
||||
<string>If this is checked, the local user (yourself) will always be visible in the TalkingUI (regardless of talking state).</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Always keep local user visible</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QSpinBox" name="qsbPrefixCharCount">
|
||||
<property name="toolTip">
|
||||
<string>How many characters from the original name to display at the beginning of an abbreviated name.</string>
|
||||
</property>
|
||||
<property name="accessibleName">
|
||||
<string>Prefix character count</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="qlRelFontSize">
|
||||
<property name="toolTip">
|
||||
<string>Relative font size to use in the Talking UI in percent.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Rel. font size (%)</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>qsbRelFontSize</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="qlChannelHierarchyDepth">
|
||||
<property name="toolTip">
|
||||
<string>The names of how many parent channels should be included in the channel's name when displaying it in the TalkingUI?</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Channel hierarchy depth</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>qsbChannelHierarchyDepth</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="qcbUsersAlwaysVisible">
|
||||
<property name="toolTip">
|
||||
<string>If this is checked, users will always be visible in the TalkingUI (regardless of talking state).</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Always keep users visible</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -913,7 +1019,7 @@
|
||||
<item row="6" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@ -939,7 +1045,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -1013,7 +1119,7 @@
|
||||
<item row="2" column="0">
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@ -1026,6 +1132,19 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
@ -1074,6 +1193,8 @@
|
||||
<tabstop>qsbPrefixCharCount</tabstop>
|
||||
<tabstop>qsbPostfixCharCount</tabstop>
|
||||
<tabstop>qleAbbreviationReplacement</tabstop>
|
||||
<tabstop>qbBackgroundColor</tabstop>
|
||||
<tabstop>qbClearBackgroundColor</tabstop>
|
||||
<tabstop>qleChannelSeparator</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
#include <QStringList>
|
||||
#include <QVariant>
|
||||
#include <Qt>
|
||||
#include <optional>
|
||||
|
||||
#include "Channel.h"
|
||||
#include "EchoCancelOption.h"
|
||||
@ -382,13 +383,14 @@ struct Settings {
|
||||
bool bTalkingUI_AbbreviateCurrentChannel = false;
|
||||
bool bTalkingUI_ShowLocalListeners = false;
|
||||
/// relative font size in %
|
||||
int iTalkingUI_RelativeFontSize = 100;
|
||||
int iTalkingUI_SilentUserLifeTime = 10;
|
||||
int iTalkingUI_ChannelHierarchyDepth = 1;
|
||||
int iTalkingUI_MaxChannelNameLength = 20;
|
||||
int iTalkingUI_PrefixCharCount = 3;
|
||||
int iTalkingUI_PostfixCharCount = 2;
|
||||
QString qsTalkingUI_AbbreviationReplacement = QStringLiteral("...");
|
||||
int iTalkingUI_RelativeFontSize = 100;
|
||||
int iTalkingUI_SilentUserLifeTime = 10;
|
||||
int iTalkingUI_ChannelHierarchyDepth = 1;
|
||||
int iTalkingUI_MaxChannelNameLength = 20;
|
||||
int iTalkingUI_PrefixCharCount = 3;
|
||||
int iTalkingUI_PostfixCharCount = 2;
|
||||
QString qsTalkingUI_AbbreviationReplacement = QStringLiteral("...");
|
||||
std::optional< QColor > talkingUI_BackgroundColor = std::nullopt;
|
||||
|
||||
QString qsHierarchyChannelSeparator = QStringLiteral("/");
|
||||
|
||||
|
||||
@ -237,6 +237,7 @@ const SettingsKey TALKINGUI_MAX_CHANNEL_NAME_LENGTH_KEY = { "max_channel_name
|
||||
const SettingsKey TALKINGUI_NAME_PREFIX_COUNT_KEY = { "name_prefix_count" };
|
||||
const SettingsKey TALKINGUI_NAME_POSTFIX_COUNT_KEY = { "name_postfix_count" };
|
||||
const SettingsKey TALKINGUI_ABBREVIATION_REPLACEMENT_KEY = { "abbreviation_replacement" };
|
||||
const SettingsKey TALKINGUI_BACKGROUND_COLOR_KEY = { "background_color" };
|
||||
|
||||
// Channel hierarchy
|
||||
const SettingsKey CHANNEL_NAME_SEPARATOR_KEY = { "channel_name_separator" };
|
||||
|
||||
@ -204,7 +204,8 @@
|
||||
PROCESS(talkingui, TALKINGUI_MAX_CHANNEL_NAME_LENGTH_KEY, iTalkingUI_MaxChannelNameLength) \
|
||||
PROCESS(talkingui, TALKINGUI_NAME_PREFIX_COUNT_KEY, iTalkingUI_PrefixCharCount) \
|
||||
PROCESS(talkingui, TALKINGUI_NAME_POSTFIX_COUNT_KEY, iTalkingUI_PostfixCharCount) \
|
||||
PROCESS(talkingui, TALKINGUI_ABBREVIATION_REPLACEMENT_KEY, qsTalkingUI_AbbreviationReplacement)
|
||||
PROCESS(talkingui, TALKINGUI_ABBREVIATION_REPLACEMENT_KEY, qsTalkingUI_AbbreviationReplacement) \
|
||||
PROCESS(talkingui, TALKINGUI_BACKGROUND_COLOR_KEY, talkingUI_BackgroundColor)
|
||||
|
||||
|
||||
#define CHANNEL_HIERARCHY_SETTINGS PROCESS(channel_hierarchy, CHANNEL_NAME_SEPARATOR_KEY, qsHierarchyChannelSeparator)
|
||||
|
||||
@ -232,6 +232,10 @@ void TalkingUI::setupUI() {
|
||||
// properly and as the TalkingUI doesn't provide context help anyways, this is not a big loss.
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
|
||||
if (Global::get().s.talkingUI_BackgroundColor.has_value()) {
|
||||
setBackgroundColor(*Global::get().s.talkingUI_BackgroundColor);
|
||||
}
|
||||
|
||||
connect(Global::get().mw->qtvUsers->selectionModel(), &QItemSelectionModel::currentChanged, this,
|
||||
&TalkingUI::on_mainWindowSelectionChanged);
|
||||
}
|
||||
@ -805,6 +809,13 @@ void TalkingUI::on_settingsChanged() {
|
||||
|
||||
const ClientUser *self = ClientUser::get(Global::get().uiSession);
|
||||
|
||||
// Update Background Color
|
||||
if (Global::get().s.talkingUI_BackgroundColor.has_value()) {
|
||||
setBackgroundColor(*Global::get().s.talkingUI_BackgroundColor);
|
||||
} else {
|
||||
clearBackgroundColor();
|
||||
}
|
||||
|
||||
// Whether or not the current user should always be displayed might also have changed,
|
||||
// so we'll have to update that as well.
|
||||
TalkingUIUser *localUserEntry = findUser(Global::get().uiSession);
|
||||
@ -882,3 +893,13 @@ void TalkingUI::on_channelListenerLocalVolumeAdjustmentChanged(unsigned int chan
|
||||
listenerEntry->setDisplayString(UserModel::createDisplayString(*self, true, channel));
|
||||
}
|
||||
}
|
||||
|
||||
void TalkingUI::setBackgroundColor(QColor backgroundColor) {
|
||||
if (backgroundColor.isValid()) {
|
||||
setStyleSheet(QString("background-color: %1;").arg(backgroundColor.name()));
|
||||
}
|
||||
}
|
||||
|
||||
void TalkingUI::clearBackgroundColor() {
|
||||
setStyleSheet("");
|
||||
}
|
||||
|
||||
@ -6,10 +6,11 @@
|
||||
#ifndef MUMBLE_MUMBLE_TALKINGUI_H_
|
||||
#define MUMBLE_MUMBLE_TALKINGUI_H_
|
||||
|
||||
#include <QColor>
|
||||
#include <QHash>
|
||||
#include <QIcon>
|
||||
#include <QSet>
|
||||
#include <QWidget>
|
||||
#include <QtCore/QHash>
|
||||
#include <QtCore/QSet>
|
||||
#include <QtGui/QIcon>
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
@ -91,6 +92,14 @@ private:
|
||||
/// shall be set
|
||||
void setFontSize(MultiStyleWidgetWrapper &widgetWrapper);
|
||||
|
||||
/// Sets the background color to to a color
|
||||
///
|
||||
/// @param backgroundColor An instance of QColor that will be set as the background color
|
||||
void setBackgroundColor(QColor backgroundColor);
|
||||
|
||||
/// Clears the stylesheet of the TalkingUI window
|
||||
void clearBackgroundColor();
|
||||
|
||||
/// Updates the user's status icons (reflecting e.g. its mut-state)
|
||||
///
|
||||
/// @param user A pointer to the user that shall be processed
|
||||
|
||||
@ -104,6 +104,8 @@ def getDefaultValueForType(dataType):
|
||||
if dataType in ["int", "short", "long", "float", "double", "qreal"] or dataType.startswith("qint") or dataType.startswith("quint") or \
|
||||
dataType.startswith("uint"):
|
||||
return "42"
|
||||
elif match := re.search(r"optional<(.*)>", dataType):
|
||||
return getDefaultValueForType(match.group(1))
|
||||
elif dataType in ["bool"]:
|
||||
return "true"
|
||||
elif dataType in ["QString", "std::string"]:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user