REFAC(client): Move channel sep. setting to own category

This setting will be needed for other purposes as well and therefore
putting this into the TalkingUI group of settings in no longer
applicable.
This commit is contained in:
Robert Adam 2021-04-15 19:41:59 +02:00
parent 7a482a0aec
commit fb8d6d4881
5 changed files with 271 additions and 254 deletions

View File

@ -199,8 +199,9 @@ void LookConfig::load(const Settings &r) {
qsbMaxNameLength->setValue(r.iTalkingUI_MaxChannelNameLength);
qsbPrefixCharCount->setValue(r.iTalkingUI_PrefixCharCount);
qsbPostfixCharCount->setValue(r.iTalkingUI_PostfixCharCount);
qleChannelSeparator->setText(r.qsTalkingUI_ChannelSeparator);
qleAbbreviationReplacement->setText(r.qsTalkingUI_AbbreviationReplacement);
qleChannelSeparator->setText(r.qsHierarchyChannelSeparator);
}
void LookConfig::save() const {
@ -266,8 +267,9 @@ void LookConfig::save() const {
s.iTalkingUI_MaxChannelNameLength = qsbMaxNameLength->value();
s.iTalkingUI_PrefixCharCount = qsbPrefixCharCount->value();
s.iTalkingUI_PostfixCharCount = qsbPostfixCharCount->value();
s.qsTalkingUI_ChannelSeparator = qleChannelSeparator->text();
s.qsTalkingUI_AbbreviationReplacement = qleAbbreviationReplacement->text();
s.qsHierarchyChannelSeparator = qleChannelSeparator->text();
}
void LookConfig::accept() const {
@ -294,6 +296,5 @@ void LookConfig::on_qcbAbbreviateChannelNames_stateChanged(int state) {
qsbMaxNameLength->setEnabled(abbreviateNames);
qsbPrefixCharCount->setEnabled(abbreviateNames);
qsbPostfixCharCount->setEnabled(abbreviateNames);
qleChannelSeparator->setEnabled(abbreviateNames);
qleAbbreviationReplacement->setEnabled(abbreviateNames);
}

View File

@ -7,243 +7,13 @@
<x>0</x>
<y>0</y>
<width>728</width>
<height>1148</height>
<height>1273</height>
</rect>
</property>
<property name="windowTitle">
<string notr="true">Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="4" column="1">
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Talking UI</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<property name="horizontalSpacing">
<number>6</number>
</property>
<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>
</widget>
</item>
<item row="7" 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>
</widget>
</item>
<item row="14" column="1">
<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>
</widget>
</item>
<item row="13" column="0">
<widget class="QLabel" name="qlChannelSeparator">
<property name="toolTip">
<string>String to separate a channel name from its parent's.</string>
</property>
<property name="text">
<string>Channel separator</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="qsbRelFontSize">
<property name="toolTip">
<string>Relative font size to use in the Talking UI in percent.</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>500</number>
</property>
</widget>
</item>
<item row="0" 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="9" 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>
</widget>
</item>
<item row="10" column="0">
<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>
</property>
<property name="text">
<string>Abbreviated prefix characters</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QSpinBox" name="qsbSilentUserLifetime">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>A user that is silent for the given amount of seconds will be removed from the Talkin UI.</string>
</property>
</widget>
</item>
<item row="11" 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>
</widget>
</item>
<item row="9" column="0">
<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>
</property>
<property name="text">
<string>Max. channel name length</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<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>
</property>
<property name="text">
<string>Abbreviate current channel name</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="qlSilentUserLifetime">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>A user that is silent for the given amount of seconds will be removed from the Talkin UI.</string>
</property>
<property name="text">
<string>Remove silent user after</string>
</property>
</widget>
</item>
<item row="1" 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="11" 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>
</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>
</widget>
</item>
<item row="10" 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>
</widget>
</item>
<item row="13" column="1">
<widget class="QLineEdit" name="qleChannelSeparator">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>String to separate a channel name from its parent's.</string>
</property>
</widget>
</item>
<item row="4" 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>
</widget>
</item>
<item row="3" column="0" colspan="2">
<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>
</property>
<property name="text">
<string>Show local user's listeners (ears)</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QGroupBox" name="qgbLayout">
<property name="title">
@ -662,19 +432,6 @@
</layout>
</widget>
</item>
<item row="5" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1">
<widget class="QGroupBox" name="qgbChannel">
<property name="title">
@ -792,7 +549,214 @@
</layout>
</widget>
</item>
<item row="6" column="1">
<item row="5" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Talking UI</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<property name="horizontalSpacing">
<number>6</number>
</property>
<item row="11" 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>
</widget>
</item>
<item row="9" 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>
</widget>
</item>
<item row="13" column="1">
<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>
</widget>
</item>
<item row="11" 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>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="qsbRelFontSize">
<property name="toolTip">
<string>Relative font size to use in the Talking UI in percent.</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>500</number>
</property>
</widget>
</item>
<item row="9" column="0">
<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>
</property>
<property name="text">
<string>Max. channel name length</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QSpinBox" name="qsbSilentUserLifetime">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>A user that is silent for the given amount of seconds will be removed from the Talkin UI.</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<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>
</property>
<property name="text">
<string>Abbreviate current channel name</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="qlSilentUserLifetime">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>A user that is silent for the given amount of seconds will be removed from the Talkin UI.</string>
</property>
<property name="text">
<string>Remove silent user after</string>
</property>
</widget>
</item>
<item row="1" 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="7" 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>
</widget>
</item>
<item row="3" column="0" colspan="2">
<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>
</property>
<property name="text">
<string>Show local user's listeners (ears)</string>
</property>
</widget>
</item>
<item row="13" 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>
</widget>
</item>
<item row="10" column="0">
<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>
</property>
<property name="text">
<string>Abbreviated prefix characters</string>
</property>
</widget>
</item>
<item row="0" 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="10" 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>
</widget>
</item>
<item row="4" 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>
</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>
</widget>
</item>
</layout>
</widget>
</item>
<item row="6" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -805,6 +769,51 @@
</property>
</spacer>
</item>
<item row="6" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="5" column="1">
<widget class="QGroupBox" name="qgbChannelHierarchyString">
<property name="title">
<string>Channel Hierarchy String</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="qlChannelSeparator">
<property name="toolTip">
<string>String to separate a channel name from its parent's.</string>
</property>
<property name="text">
<string>Channel separator</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="qleChannelSeparator">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>String to separate a channel name from its parent's.</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>

View File

@ -505,9 +505,10 @@ Settings::Settings() {
iTalkingUI_MaxChannelNameLength = 20;
iTalkingUI_PrefixCharCount = 3;
iTalkingUI_PostfixCharCount = 2;
qsTalkingUI_ChannelSeparator = QLatin1String("/");
qsTalkingUI_AbbreviationReplacement = QLatin1String("...");
qsHierarchyChannelSeparator = QLatin1String("/");
manualPlugin_silentUserDisplaytime = 1;
bShortcutEnable = true;
@ -934,9 +935,12 @@ void Settings::load(QSettings *settings_ptr) {
LOAD(iTalkingUI_MaxChannelNameLength, "ui/talkingUI_MaxChannelNameLength");
LOAD(iTalkingUI_PrefixCharCount, "ui/talkingUI_PrefixCharCount");
LOAD(iTalkingUI_PostfixCharCount, "ui/talkingUI_PostfixCharCount");
LOAD(qsTalkingUI_ChannelSeparator, "ui/talkingUI_ChannelSeparator");
LOAD(qsTalkingUI_AbbreviationReplacement, "ui/talkingUI_AbbreviationReplacement");
// Load the old setting first in case it is set and then load the actual setting
LOAD(qsHierarchyChannelSeparator, "ui/talkingUI_ChannelSeparator");
LOAD(qsHierarchyChannelSeparator, "ui/hierarchy_channelSeparator");
LOAD(manualPlugin_silentUserDisplaytime, "ui/manualPlugin_silentUserDisplaytime");
// PTT Button window
@ -1329,9 +1333,11 @@ void Settings::save() {
SAVE(iTalkingUI_MaxChannelNameLength, "ui/talkingUI_MaxChannelNameLength");
SAVE(iTalkingUI_PrefixCharCount, "ui/talkingUI_PrefixCharCount");
SAVE(iTalkingUI_PostfixCharCount, "ui/talkingUI_PostfixCharCount");
SAVE(qsTalkingUI_ChannelSeparator, "ui/talkingUI_ChannelSeparator");
SAVE(qsTalkingUI_AbbreviationReplacement, "ui/talkingUI_AbbreviationReplacement");
DEPRECATED("ui/talkingUI_ChannelSeparator");
SAVE(qsHierarchyChannelSeparator, "ui/hierarchy_channelSeparator");
SAVE(manualPlugin_silentUserDisplaytime, "ui/manualPlugin_silentUserDisplaytime");
// PTT Button window

View File

@ -315,9 +315,10 @@ struct Settings {
int iTalkingUI_MaxChannelNameLength;
int iTalkingUI_PrefixCharCount;
int iTalkingUI_PostfixCharCount;
QString qsTalkingUI_ChannelSeparator;
QString qsTalkingUI_AbbreviationReplacement;
QString qsHierarchyChannelSeparator;
int manualPlugin_silentUserDisplaytime;
QMap< int, QString > qmMessageSounds;

View File

@ -332,7 +332,7 @@ void TalkingUI::addChannel(const Channel *channel) {
const QString channelName = createChannelName(
channel, Global::get().s.bTalkingUI_AbbreviateChannelNames, Global::get().s.iTalkingUI_PrefixCharCount,
Global::get().s.iTalkingUI_PostfixCharCount, Global::get().s.iTalkingUI_MaxChannelNameLength,
Global::get().s.iTalkingUI_ChannelHierarchyDepth, Global::get().s.qsTalkingUI_ChannelSeparator,
Global::get().s.iTalkingUI_ChannelHierarchyDepth, Global::get().s.qsHierarchyChannelSeparator,
Global::get().s.qsTalkingUI_AbbreviationReplacement, Global::get().s.bTalkingUI_AbbreviateCurrentChannel);
std::unique_ptr< TalkingUIChannel > channelContainer =
@ -729,7 +729,7 @@ void TalkingUI::on_settingsChanged() {
channelContainer->setName(createChannelName(
channel, Global::get().s.bTalkingUI_AbbreviateChannelNames, Global::get().s.iTalkingUI_PrefixCharCount,
Global::get().s.iTalkingUI_PostfixCharCount, Global::get().s.iTalkingUI_MaxChannelNameLength,
Global::get().s.iTalkingUI_ChannelHierarchyDepth, Global::get().s.qsTalkingUI_ChannelSeparator,
Global::get().s.iTalkingUI_ChannelHierarchyDepth, Global::get().s.qsHierarchyChannelSeparator,
Global::get().s.qsTalkingUI_AbbreviationReplacement,
Global::get().s.bTalkingUI_AbbreviateCurrentChannel));
} else {