Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
fe12f71b
Commit
fe12f71b
authored
Jul 27, 2014
by
Fabio Bas
Browse files
Disable some usercontextmenu actions if the user is offline; fix #234
parent
ea897ee2
Changes
4
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/playerlistwidget.cpp
View file @
fe12f71b
...
@@ -178,5 +178,5 @@ void PlayerListWidget::showContextMenu(const QPoint &pos, const QModelIndex &ind
...
@@ -178,5 +178,5 @@ void PlayerListWidget::showContextMenu(const QPoint &pos, const QModelIndex &ind
int
playerId
=
index
.
sibling
(
index
.
row
(),
4
).
data
(
Qt
::
UserRole
+
1
).
toInt
();
int
playerId
=
index
.
sibling
(
index
.
row
(),
4
).
data
(
Qt
::
UserRole
+
1
).
toInt
();
UserLevelFlags
userLevel
(
index
.
sibling
(
index
.
row
(),
3
).
data
(
Qt
::
UserRole
).
toInt
());
UserLevelFlags
userLevel
(
index
.
sibling
(
index
.
row
(),
3
).
data
(
Qt
::
UserRole
).
toInt
());
userContextMenu
->
showContextMenu
(
pos
,
userName
,
userLevel
,
playerId
);
userContextMenu
->
showContextMenu
(
pos
,
userName
,
userLevel
,
true
,
playerId
);
}
}
cockatrice/src/user_context_menu.cpp
View file @
fe12f71b
...
@@ -102,7 +102,7 @@ void UserContextMenu::banUser_dialogFinished()
...
@@ -102,7 +102,7 @@ void UserContextMenu::banUser_dialogFinished()
client
->
sendCommand
(
client
->
prepareModeratorCommand
(
cmd
));
client
->
sendCommand
(
client
->
prepareModeratorCommand
(
cmd
));
}
}
void
UserContextMenu
::
showContextMenu
(
const
QPoint
&
pos
,
const
QString
&
userName
,
UserLevelFlags
userLevel
,
int
playerId
)
void
UserContextMenu
::
showContextMenu
(
const
QPoint
&
pos
,
const
QString
&
userName
,
UserLevelFlags
userLevel
,
bool
online
,
int
playerId
)
{
{
aUserName
->
setText
(
userName
);
aUserName
->
setText
(
userName
);
...
@@ -132,8 +132,9 @@ void UserContextMenu::showContextMenu(const QPoint &pos, const QString &userName
...
@@ -132,8 +132,9 @@ void UserContextMenu::showContextMenu(const QPoint &pos, const QString &userName
menu
->
addAction
(
aBan
);
menu
->
addAction
(
aBan
);
}
}
bool
anotherUser
=
userName
!=
QString
::
fromStdString
(
tabSupervisor
->
getUserInfo
()
->
name
());
bool
anotherUser
=
userName
!=
QString
::
fromStdString
(
tabSupervisor
->
getUserInfo
()
->
name
());
aChat
->
setEnabled
(
anotherUser
);
aDetails
->
setEnabled
(
online
);
aShowGames
->
setEnabled
(
anotherUser
);
aChat
->
setEnabled
(
anotherUser
&&
online
);
aShowGames
->
setEnabled
(
anotherUser
&&
online
);
aAddToBuddyList
->
setEnabled
(
anotherUser
);
aAddToBuddyList
->
setEnabled
(
anotherUser
);
aRemoveFromBuddyList
->
setEnabled
(
anotherUser
);
aRemoveFromBuddyList
->
setEnabled
(
anotherUser
);
aAddToIgnoreList
->
setEnabled
(
anotherUser
);
aAddToIgnoreList
->
setEnabled
(
anotherUser
);
...
...
cockatrice/src/user_context_menu.h
View file @
fe12f71b
...
@@ -36,7 +36,7 @@ private slots:
...
@@ -36,7 +36,7 @@ private slots:
public:
public:
UserContextMenu
(
const
TabSupervisor
*
_tabSupervisor
,
QWidget
*
_parent
,
TabGame
*
_game
=
0
);
UserContextMenu
(
const
TabSupervisor
*
_tabSupervisor
,
QWidget
*
_parent
,
TabGame
*
_game
=
0
);
void
retranslateUi
();
void
retranslateUi
();
void
showContextMenu
(
const
QPoint
&
pos
,
const
QString
&
userName
,
UserLevelFlags
userLevel
,
int
playerId
=
-
1
);
void
showContextMenu
(
const
QPoint
&
pos
,
const
QString
&
userName
,
UserLevelFlags
userLevel
,
bool
online
=
true
,
int
playerId
=
-
1
);
};
};
#endif
#endif
cockatrice/src/userlist.cpp
View file @
fe12f71b
...
@@ -311,8 +311,9 @@ void UserList::userClicked(QTreeWidgetItem *item, int /*column*/)
...
@@ -311,8 +311,9 @@ void UserList::userClicked(QTreeWidgetItem *item, int /*column*/)
void
UserList
::
showContextMenu
(
const
QPoint
&
pos
,
const
QModelIndex
&
index
)
void
UserList
::
showContextMenu
(
const
QPoint
&
pos
,
const
QModelIndex
&
index
)
{
{
const
ServerInfo_User
&
userInfo
=
static_cast
<
UserListTWI
*>
(
userTree
->
topLevelItem
(
index
.
row
()))
->
getUserInfo
();
const
ServerInfo_User
&
userInfo
=
static_cast
<
UserListTWI
*>
(
userTree
->
topLevelItem
(
index
.
row
()))
->
getUserInfo
();
bool
online
=
index
.
sibling
(
index
.
row
(),
0
).
data
(
Qt
::
UserRole
+
1
).
toBool
();
userContextMenu
->
showContextMenu
(
pos
,
QString
::
fromStdString
(
userInfo
.
name
()),
UserLevelFlags
(
userInfo
.
user_level
()));
userContextMenu
->
showContextMenu
(
pos
,
QString
::
fromStdString
(
userInfo
.
name
()),
UserLevelFlags
(
userInfo
.
user_level
()),
online
);
}
}
void
UserList
::
sortItems
()
void
UserList
::
sortItems
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment