qTox
Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
|
Go to the documentation of this file.
22 #include <QApplication>
23 #include <QContextMenuEvent>
25 #include <QDragEnterEvent>
46 , groupId{
chatroom->getGroup()->getPersistentId()}
51 statusPic.setMargin(3);
53 Group* g = chatroom->getGroup();
54 nameLabel->setText(g->
getName());
79 setBackgroundRole(QPalette::Highlight);
82 installEventFilter(
this);
86 QAction* openChatWindow =
nullptr;
87 if (
chatroom->possibleToOpenInNewWindow() ) {
88 openChatWindow = menu.addAction(tr(
"Open chat in new window"));
91 QAction* removeChatWindow =
nullptr;
92 if (
chatroom->canBeRemovedFromWindow()) {
93 removeChatWindow = menu.addAction(tr(
"Remove chat from this window"));
98 QAction* setTitle = menu.addAction(tr(
"Set title..."));
99 QAction* quitGroup = menu.addAction(tr(
"Quit group",
"Menu to quit a groupchat"));
101 QAction* selectedItem = menu.exec(event->globalPos());
103 removeEventFilter(
this);
106 setBackgroundRole(QPalette::Window);
113 if (selectedItem == quitGroup) {
115 }
else if (selectedItem == openChatWindow) {
117 }
else if (selectedItem == removeChatWindow) {
119 }
else if (selectedItem == setTitle) {
126 if (ev->button() == Qt::LeftButton) {
130 GenericChatroomWidget::mousePressEvent(ev);
135 if (!(ev->buttons() & Qt::LeftButton)) {
139 if ((
dragStartPos - ev->pos()).manhattanLength() > QApplication::startDragDistance()) {
140 QMimeData* mdata =
new QMimeData;
142 mdata->setText(group->
getName());
145 QDrag* drag =
new QDrag(
this);
146 drag->setMimeData(mdata);
148 drag->exec(Qt::CopyAction | Qt::MoveAction);
181 return tr(
"New Message");
219 return QDateTime::currentDateTime();
250 if (!ev->mimeData()->hasFormat(
"toxPk")) {
253 const ToxPk pk{ev->mimeData()->data(
"toxPk")};
255 ev->acceptProposedAction();
259 setBackgroundRole(QPalette::Highlight);
266 setBackgroundRole(QPalette::Window);
272 if (!ev->mimeData()->hasFormat(
"toxPk")) {
275 const ToxPk pk{ev->mimeData()->data(
"toxPk")};
283 setBackgroundRole(QPalette::Window);
void editFinished(const QString &newText)
void titleChanged(const QString &author, const QString &title)
int getPeersCount() const
void setText(const QString &text)
static void unregister(void *owner)
Unregisters all handlers of an owner.
QString getIconPath(Status status, bool event)
void numPeersChanged(int numPeers)
This class represents a Tox Public Key, which is a part of Tox ID.
bool getEventFlag() const override
const GroupId & getPersistentId() const override
static void registerHandler(const std::function< void()> &, void *owner)
Register a function to be called when the UI needs to be retranslated.
void setName(const QString &newTitle) override
QString fullText()
Get original full text.
static QPixmap scaleSvgImage(const QString &path, uint32_t width, uint32_t height)