qTox  Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
genericchatroomwidget.h
Go to the documentation of this file.
1 /*
2  Copyright © 2014-2019 by The qTox Project Contributors
3 
4  This file is part of qTox, a Qt-based graphical interface for Tox.
5 
6  qTox is libre software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  qTox is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with qTox. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #pragma once
21 
22 #include "genericchatitemwidget.h"
23 
24 class CroppingLabel;
26 class QVBoxLayout;
27 class QHBoxLayout;
28 class ContentLayout;
29 class Friend;
30 class Group;
31 class Contact;
33 {
34  Q_OBJECT
35 public:
36  explicit GenericChatroomWidget(bool compact, QWidget* parent = nullptr);
37 
38 public slots:
39  virtual void setAsActiveChatroom() = 0;
40  virtual void setAsInactiveChatroom() = 0;
41  virtual void updateStatusLight() = 0;
42  virtual void resetEventFlags() = 0;
43  virtual QString getStatusString() const = 0;
44  virtual const Contact* getContact() const = 0;
45  virtual const Friend* getFriend() const
46  {
47  return nullptr;
48  }
49  virtual Group* getGroup() const
50  {
51  return nullptr;
52  }
53 
54  bool eventFilter(QObject*, QEvent*) final;
55 
56  bool isActive();
57 
58  void setName(const QString& name);
59  void setStatusMsg(const QString& status);
60  QString getStatusMsg() const;
61  QString getTitle() const;
62 
63  void activate();
64  void compactChange(bool compact);
65  void reloadTheme() override;
66 
67 signals:
70  void middleMouseClicked();
71 
72 protected:
73  void mouseReleaseEvent(QMouseEvent* event) override;
74  void enterEvent(QEvent* e) override;
75  void leaveEvent(QEvent* e) override;
76  void setActive(bool active);
77 
78 protected:
79  QPoint dragStartPos;
80  QColor lastColor;
81  QHBoxLayout* mainLayout = nullptr;
82  QVBoxLayout* textLayout = nullptr;
85  bool active;
86 };
GenericChatroomWidget::avatar
MaskablePixmapWidget * avatar
Definition: genericchatroomwidget.h:83
GenericChatroomWidget::reloadTheme
void reloadTheme() override
Definition: genericchatroomwidget.cpp:159
GenericChatroomWidget::setName
void setName(const QString &name)
Definition: genericchatroomwidget.cpp:134
genericchatitemwidget.h
GenericChatroomWidget::getGroup
virtual Group * getGroup() const
Definition: genericchatroomwidget.h:49
GenericChatItemWidget::compact
bool compact
Definition: genericchatitemwidget.h:47
GenericChatroomWidget::isActive
bool isActive()
Definition: genericchatroomwidget.cpp:119
GenericChatroomWidget::mouseReleaseEvent
void mouseReleaseEvent(QMouseEvent *event) override
Definition: genericchatroomwidget.cpp:169
GenericChatroomWidget::mainLayout
QHBoxLayout * mainLayout
Definition: genericchatroomwidget.h:81
CroppingLabel
Definition: croppinglabel.h:26
GenericChatroomWidget::setActive
void setActive(bool active)
Definition: genericchatroomwidget.cpp:124
GenericChatroomWidget::getContact
virtual const Contact * getContact() const =0
GenericChatroomWidget::setStatusMsg
void setStatusMsg(const QString &status)
Definition: genericchatroomwidget.cpp:139
GenericChatroomWidget::setAsInactiveChatroom
virtual void setAsInactiveChatroom()=0
GenericChatroomWidget::enterEvent
void enterEvent(QEvent *e) override
Definition: genericchatroomwidget.cpp:180
GenericChatroomWidget::leaveEvent
void leaveEvent(QEvent *e) override
Definition: genericchatroomwidget.cpp:186
GenericChatItemWidget
Definition: genericchatitemwidget.h:27
MaskablePixmapWidget
Definition: maskablepixmapwidget.h:24
Contact
Definition: contact.h:26
Friend
Definition: friend.h:31
GenericChatroomWidget::newWindowOpened
void newWindowOpened(GenericChatroomWidget *widget)
GenericChatroomWidget::GenericChatroomWidget
GenericChatroomWidget(bool compact, QWidget *parent=nullptr)
Definition: genericchatroomwidget.cpp:28
GenericChatroomWidget::dragStartPos
QPoint dragStartPos
Definition: genericchatroomwidget.h:79
GenericChatroomWidget::middleMouseClicked
void middleMouseClicked()
GenericChatroomWidget::setAsActiveChatroom
virtual void setAsActiveChatroom()=0
Group
Definition: group.h:34
GenericChatroomWidget::chatroomWidgetClicked
void chatroomWidgetClicked(GenericChatroomWidget *widget)
GenericChatroomWidget::textLayout
QVBoxLayout * textLayout
Definition: genericchatroomwidget.h:82
GenericChatroomWidget::eventFilter
bool eventFilter(QObject *, QEvent *) final
Definition: genericchatroomwidget.cpp:59
GenericChatroomWidget::compactChange
void compactChange(bool compact)
Definition: genericchatroomwidget.cpp:64
GenericChatroomWidget::getStatusString
virtual QString getStatusString() const =0
GenericChatroomWidget::resetEventFlags
virtual void resetEventFlags()=0
GenericChatroomWidget::active
bool active
Definition: genericchatroomwidget.h:85
ContentLayout
Definition: contentlayout.h:25
GenericChatroomWidget::activate
void activate()
Definition: genericchatroomwidget.cpp:164
GenericChatroomWidget
Definition: genericchatroomwidget.h:32
GenericChatroomWidget::updateStatusLight
virtual void updateStatusLight()=0
GenericChatroomWidget::statusMessageLabel
CroppingLabel * statusMessageLabel
Definition: genericchatroomwidget.h:84
GenericChatroomWidget::lastColor
QColor lastColor
Definition: genericchatroomwidget.h:80
GenericChatroomWidget::getFriend
virtual const Friend * getFriend() const
Definition: genericchatroomwidget.h:45
GenericChatroomWidget::getTitle
QString getTitle() const
Definition: genericchatroomwidget.cpp:149
GenericChatroomWidget::getStatusMsg
QString getStatusMsg() const
Definition: genericchatroomwidget.cpp:144