diff options
m--------- | celt | 0 | ||||
-rw-r--r-- | src/mumble/GlobalShortcut.cpp | 5 | ||||
-rw-r--r-- | src/mumble/GlobalShortcutTarget.ui | 18 | ||||
-rw-r--r-- | src/mumble/MainWindow.cpp | 22 | ||||
-rw-r--r-- | src/mumble/MainWindow.h | 3 | ||||
-rw-r--r-- | src/mumble/Settings.cpp | 10 | ||||
-rw-r--r-- | src/mumble/Settings.h | 1 |
7 files changed, 35 insertions, 24 deletions
diff --git a/celt b/celt -Subproject 033e60910425621d5d7eb342ca4c655c9fcb9da +Subproject 695ab70027465a774b64159535069a0d3b5eb93 diff --git a/src/mumble/GlobalShortcut.cpp b/src/mumble/GlobalShortcut.cpp index 8d3f983b1..3eb80fbfd 100644 --- a/src/mumble/GlobalShortcut.cpp +++ b/src/mumble/GlobalShortcut.cpp @@ -196,6 +196,9 @@ ShortcutTargetDialog::ShortcutTargetDialog(const ShortcutTarget &st, QWidget *p) stTarget = st; setupUi(this); + qcbForceCenter->setChecked(st.bForceCenter); + qgbModifiers->setVisible(g.s.bExpert); + if (st.bUsers) { qrbUsers->setChecked(true); qswStack->setCurrentWidget(qwUserPage); @@ -303,6 +306,8 @@ void ShortcutTargetDialog::accept() { stTarget.bLinks = qcbLinks->isChecked(); stTarget.bChildren = qcbChildren->isChecked(); + stTarget.bForceCenter = qcbForceCenter->isChecked(); + stTarget.qlUsers.clear(); QList<QListWidgetItem *> ql = qlwUsers->findItems(QString(), Qt::MatchStartsWith); foreach(QListWidgetItem *itm, ql) { diff --git a/src/mumble/GlobalShortcutTarget.ui b/src/mumble/GlobalShortcutTarget.ui index 4225e26cd..05b5855ad 100644 --- a/src/mumble/GlobalShortcutTarget.ui +++ b/src/mumble/GlobalShortcutTarget.ui @@ -140,7 +140,7 @@ </widget> </widget> </item> - <item row="3" column="0" colspan="2"> + <item row="4" column="0" colspan="2"> <widget class="QDialogButtonBox" name="qbbButtons"> <property name="orientation"> <enum>Qt::Horizontal</enum> @@ -157,6 +157,22 @@ </property> </widget> </item> + <item row="3" column="0" colspan="2"> + <widget class="QGroupBox" name="qgbModifiers"> + <property name="title"> + <string>Modifiers</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <item> + <widget class="QCheckBox" name="qcbForceCenter"> + <property name="text"> + <string>Ignore positional audio</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> </layout> </widget> <tabstops> diff --git a/src/mumble/MainWindow.cpp b/src/mumble/MainWindow.cpp index a565d53bf..1f43f590c 100644 --- a/src/mumble/MainWindow.cpp +++ b/src/mumble/MainWindow.cpp @@ -184,9 +184,6 @@ void MainWindow::createActions() { gsUnlink=new GlobalShortcut(this, idx++, tr("Unlink Plugin", "Global Shortcut")); gsUnlink->setObjectName(QLatin1String("UnlinkPlugin")); - gsCenterPos=new GlobalShortcut(this, idx++, tr("Force Center Position", "Global Shortcut")); - gsCenterPos->setObjectName(QLatin1String("CenterPos")); - gsPushMute=new GlobalShortcut(this, idx++, tr("Push-to-Mute", "Global Shortcut")); gsPushMute->setObjectName(QLatin1String("PushToMute")); @@ -1387,17 +1384,6 @@ void MainWindow::on_PushToMute_triggered(bool down, QVariant) { g.bPushToMute = down; } -void MainWindow::on_CenterPos_triggered(bool down, QVariant) { - // TODO: Make this be a targetshortcut option - g.bCenterPosition = down; - - if (down) { - g.iPushToTalk++; - } else if (g.iPushToTalk) { - g.iPushToTalk--; - } -} - void MainWindow::on_VolumeUp_triggered(bool down, QVariant) { if (down) { float v = floorf(g.s.fVolume * 10.0f); @@ -1442,12 +1428,15 @@ Channel *MainWindow::mapChannel(int idx) const { } void MainWindow::updateTarget() { - if (qsCurrentTargets.isEmpty()) + if (qsCurrentTargets.isEmpty()) { + g.bCenterPosition = false; g.iTarget = 0; - else { + } else { + bool center = false; QList<ShortcutTarget> ql; foreach(const ShortcutTarget &st, qsCurrentTargets) { ShortcutTarget nt; + center = center || st.bForceCenter; nt.bUsers = st.bUsers; if (st.bUsers) { foreach(const QString &hash, st.qlUsers) { @@ -1527,6 +1516,7 @@ void MainWindow::updateTarget() { } } qmTargetUse.insert(idx, iTargetCounter); + g.bCenterPosition = center; g.iTarget = idx; } } diff --git a/src/mumble/MainWindow.h b/src/mumble/MainWindow.h index 8a98457e5..8ea1be610 100644 --- a/src/mumble/MainWindow.h +++ b/src/mumble/MainWindow.h @@ -87,7 +87,7 @@ class MainWindow : public QMainWindow, public MessageHandler, public Ui::MainWin QIcon qiIcon, qiIconMute, qiIconDeaf; GlobalShortcut *gsPushTalk, *gsResetAudio, *gsMuteSelf, *gsDeafSelf; - GlobalShortcut *gsUnlink, *gsCenterPos, *gsPushMute, *gsMetaChannel, *gsToggleOverlay; + GlobalShortcut *gsUnlink, *gsPushMute, *gsMetaChannel, *gsToggleOverlay; GlobalShortcut *gsMinimal, *gsVolumeUp, *gsVolumeDown, *gsWhisper; DockTitleBar *dtbLogDockTitle, *dtbChatDockTitle; @@ -181,7 +181,6 @@ class MainWindow : public QMainWindow, public MessageHandler, public Ui::MainWin void on_qteLog_highlighted(const QUrl & link); void on_PushToTalk_triggered(bool, QVariant); void on_PushToMute_triggered(bool, QVariant); - void on_CenterPos_triggered(bool, QVariant); void on_VolumeUp_triggered(bool, QVariant); void on_VolumeDown_triggered(bool, QVariant); void on_gsMuteSelf_down(QVariant); diff --git a/src/mumble/Settings.cpp b/src/mumble/Settings.cpp index fc82f5939..d8a9f8652 100644 --- a/src/mumble/Settings.cpp +++ b/src/mumble/Settings.cpp @@ -41,7 +41,7 @@ bool Shortcut::operator <(const Shortcut &other) const { ShortcutTarget::ShortcutTarget() { bUsers = true; iChannel = -3; - bLinks = bChildren = false; + bLinks = bChildren = bForceCenter = false; } bool ShortcutTarget::isServerSpecific() const { @@ -49,7 +49,7 @@ bool ShortcutTarget::isServerSpecific() const { } bool ShortcutTarget::operator ==(const ShortcutTarget &o) const { - if (bUsers != o.bUsers) + if ((bUsers != o.bUsers) || (bForceCenter != o.bForceCenter)) return false; if (bUsers) return (qlUsers == o.qlUsers) && (qlSessions == o.qlSessions); @@ -58,7 +58,7 @@ bool ShortcutTarget::operator ==(const ShortcutTarget &o) const { } quint32 qHash(const ShortcutTarget &t) { - quint32 h = 0; + quint32 h = t.bForceCenter ? 0x55555555 : 0xaaaaaaaa; if (t.bUsers) { foreach(unsigned int u, t.qlSessions) h ^= u; @@ -82,7 +82,7 @@ quint32 qHash(const QList<ShortcutTarget> &l) { } QDataStream &operator<<(QDataStream &qds, const ShortcutTarget &st) { - qds << st.bUsers; + qds << st.bUsers << st.bForceCenter; if (st.bUsers) return qds << st.qlUsers; @@ -91,7 +91,7 @@ QDataStream &operator<<(QDataStream &qds, const ShortcutTarget &st) { } QDataStream &operator>>(QDataStream &qds, ShortcutTarget &st) { - qds >> st.bUsers; + qds >> st.bUsers >> st.bForceCenter; if (st.bUsers) return qds >> st.qlUsers; else diff --git a/src/mumble/Settings.h b/src/mumble/Settings.h index 404ac9600..b1e6ee2b3 100644 --- a/src/mumble/Settings.h +++ b/src/mumble/Settings.h @@ -56,6 +56,7 @@ struct ShortcutTarget { QString qsGroup; bool bLinks; bool bChildren; + bool bForceCenter; ShortcutTarget(); bool isServerSpecific() const; bool operator <(const ShortcutTarget &) const; |