Skip to content
Permalink
Browse files

Merge PR #2709: Add setting to configure user dragging

  • Loading branch information...
mkrautz committed Dec 23, 2016
2 parents 3c62a18 + 6366ff4 commit ddd476499d4b39c76808603ab88bc6c9c9c749a9
Showing with 48 additions and 5 deletions.
  1. +7 −0 src/mumble/LookConfig.cpp
  2. +22 −5 src/mumble/LookConfig.ui
  3. +3 −0 src/mumble/Settings.cpp
  4. +1 −0 src/mumble/Settings.h
  5. +15 −0 src/mumble/UserModel.cpp
@@ -56,6 +56,10 @@ LookConfig::LookConfig(Settings &st) : ConfigWidget(st) {
qcbChannelDrag->insertItem(Settings::DoNothing, tr("Do Nothing"), Settings::DoNothing);
qcbChannelDrag->insertItem(Settings::Move, tr("Move"), Settings::Move);

qcbUserDrag->insertItem(Settings::Ask, tr("Ask"), Settings::Ask);
qcbUserDrag->insertItem(Settings::DoNothing, tr("Do Nothing"), Settings::DoNothing);
qcbUserDrag->insertItem(Settings::Move, tr("Move"), Settings::Move);

QDir userThemeDirectory = Themes::getUserThemesDirectory();
if (userThemeDirectory.exists()) {
m_themeDirectoryWatcher = new QFileSystemWatcher(this);
@@ -118,6 +122,7 @@ void LookConfig::reloadThemes(const boost::optional<ThemeInfo::StyleInfo> config
void LookConfig::load(const Settings &r) {
loadComboBox(qcbLanguage, 0);
loadComboBox(qcbChannelDrag, 0);
loadComboBox(qcbUserDrag, 0);

// Load Layout checkbox state
switch (r.wlWindowLayout) {
@@ -149,6 +154,7 @@ void LookConfig::load(const Settings &r) {

loadComboBox(qcbExpand, r.ceExpand);
loadComboBox(qcbChannelDrag, r.ceChannelDrag);
loadComboBox(qcbUserDrag, r.ceUserDrag);
loadCheckBox(qcbUsersTop, r.bUserTop);
loadCheckBox(qcbAskOnQuit, r.bAskOnQuit);
loadCheckBox(qcbHideTray, r.bHideInTray);
@@ -188,6 +194,7 @@ void LookConfig::save() const {

s.ceExpand=static_cast<Settings::ChannelExpand>(qcbExpand->currentIndex());
s.ceChannelDrag=static_cast<Settings::ChannelDrag>(qcbChannelDrag->currentIndex());
s.ceUserDrag=static_cast<Settings::ChannelDrag>(qcbUserDrag->currentIndex());

if (qcbUsersTop->isChecked() != s.bUserTop) {
s.bUserTop = qcbUsersTop->isChecked();
@@ -260,13 +260,30 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="qliUserDrag">
<property name="text">
<string>User Dragging</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="MUComboBox" name="qcbUserDrag">
<property name="toolTip">
<string>This changes the behavior when moving users.</string>
</property>
<property name="whatsThis">
<string>This sets the behavior of user drags; it can be used to prevent accidental dragging. &lt;i&gt;Move&lt;/i&gt; moves the user without prompting. &lt;i&gt;Do Nothing&lt;/i&gt; does nothing and prints an error message. &lt;i&gt;Ask&lt;/i&gt; uses a message box to confirm if you really wanted to move the user.</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="qliExpand">
<property name="text">
<string>Expand</string>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="2" column="1">
<widget class="MUComboBox" name="qcbExpand">
<property name="toolTip">
<string>When to automatically expand channels</string>
@@ -276,7 +293,7 @@
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="qcbUsersTop">
<property name="toolTip">
<string>List users above subchannels (requires restart).</string>
@@ -289,7 +306,7 @@
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="qcbShowUserCount">
<property name="toolTip">
<string>Show number of users in each channel</string>
@@ -299,14 +316,14 @@
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="qcbChatBarUseSelection">
<property name="text">
<string>Use selected item as the chat bar target</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<item row="6" column="0" colspan="2">
<widget class="QCheckBox" name="qcbFilterHidesEmptyChannels">
<property name="text">
<string>Filter automatically hides empty channels</string>
@@ -279,6 +279,7 @@ Settings::Settings() {

ceExpand = ChannelsWithUsers;
ceChannelDrag = Ask;
ceUserDrag = Move;
bMinimalView = false;
bHideFrame = false;
aotbAlwaysOnTop = OnTopNever;
@@ -681,6 +682,7 @@ void Settings::load(QSettings* settings_ptr) {
SAVELOAD(themeStyleName, "ui/themestyle");
LOADENUM(ceExpand, "ui/expand");
LOADENUM(ceChannelDrag, "ui/drag");
LOADENUM(ceUserDrag, "ui/userdrag");
LOADENUM(aotbAlwaysOnTop, "ui/alwaysontop");
SAVELOAD(bAskOnQuit, "ui/askonquit");
SAVELOAD(bMinimalView, "ui/minimalview");
@@ -995,6 +997,7 @@ void Settings::save() {
SAVELOAD(themeStyleName, "ui/themestyle");
SAVELOAD(ceExpand, "ui/expand");
SAVELOAD(ceChannelDrag, "ui/drag");
SAVELOAD(ceUserDrag, "ui/userdrag");
SAVELOAD(aotbAlwaysOnTop, "ui/alwaysontop");
SAVELOAD(bAskOnQuit, "ui/askonquit");
SAVELOAD(bMinimalView, "ui/minimalview");
@@ -252,6 +252,7 @@ struct Settings {
WindowLayout wlWindowLayout;
ChannelExpand ceExpand;
ChannelDrag ceChannelDrag;
ChannelDrag ceUserDrag;
bool bMinimalView;
bool bHideFrame;
enum AlwaysOnTopBehaviour { OnTopNever, OnTopAlways, OnTopInMinimal, OnTopInNormal };
@@ -1365,6 +1365,21 @@ bool UserModel::dropMimeData(const QMimeData *md, Qt::DropAction, int row, int c

if (! isChannel) {
// User dropped somewhere
int ret;
switch (g.s.ceUserDrag) {
case Settings::Ask:
ret=QMessageBox::question(g.mw, QLatin1String("Mumble"), tr("Are you sure you want to drag this user?"), QMessageBox::Yes, QMessageBox::No);

if (ret == QMessageBox::No)
return false;
break;
case Settings::DoNothing:
g.l->log(Log::Information, MainWindow::tr("You have User Dragging set to \"Do Nothing\" so the user wasn't moved."));
return false;
break;
case Settings::Move:
break;
}
MumbleProto::UserState mpus;
mpus.set_session(uiSession);
mpus.set_channel_id(c->iId);

0 comments on commit ddd4764

Please sign in to comment.
You can’t perform that action at this time.