2014-09-01 23:02:26 +08:00
|
|
|
/*
|
2015-06-06 09:40:08 +08:00
|
|
|
Copyright © 2014-2015 by The qTox Project
|
|
|
|
|
2014-09-01 23:02:26 +08:00
|
|
|
This file is part of qTox, a Qt-based graphical interface for Tox.
|
|
|
|
|
2015-06-06 09:40:08 +08:00
|
|
|
qTox is libre software: you can redistribute it and/or modify
|
2014-09-01 23:02:26 +08:00
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
2015-06-06 09:40:08 +08:00
|
|
|
|
|
|
|
qTox is distributed in the hope that it will be useful,
|
2014-09-01 23:02:26 +08:00
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2015-06-06 09:40:08 +08:00
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
2014-09-01 23:02:26 +08:00
|
|
|
|
2015-06-06 09:40:08 +08:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with qTox. If not, see <http://www.gnu.org/licenses/>.
|
2014-09-01 23:02:26 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GENERICCHATROOMWIDGET_H
|
|
|
|
#define GENERICCHATROOMWIDGET_H
|
|
|
|
|
2015-05-28 08:45:23 +08:00
|
|
|
#include "genericchatitemwidget.h"
|
2014-10-01 17:13:49 +08:00
|
|
|
|
|
|
|
class CroppingLabel;
|
|
|
|
class MaskablePixmapWidget;
|
2015-06-11 00:11:50 +08:00
|
|
|
class QVBoxLayout;
|
|
|
|
class QHBoxLayout;
|
2015-06-17 02:25:19 +08:00
|
|
|
class ContentLayout;
|
2015-06-19 22:58:48 +08:00
|
|
|
class Friend;
|
2015-06-23 02:01:50 +08:00
|
|
|
class Group;
|
2014-09-02 00:20:28 +08:00
|
|
|
|
2015-06-10 07:42:51 +08:00
|
|
|
class GenericChatroomWidget : public GenericChatItemWidget
|
2014-09-01 23:02:26 +08:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
GenericChatroomWidget(QWidget *parent = 0);
|
|
|
|
|
2015-06-11 00:11:50 +08:00
|
|
|
virtual void setAsActiveChatroom() = 0;
|
|
|
|
virtual void setAsInactiveChatroom() = 0;
|
|
|
|
virtual void updateStatusLight() = 0;
|
2015-06-23 02:01:50 +08:00
|
|
|
virtual bool chatFormIsSet(bool focus) const = 0;
|
2015-06-17 02:25:19 +08:00
|
|
|
virtual void setChatForm(ContentLayout* contentLayout) = 0;
|
2015-06-11 00:11:50 +08:00
|
|
|
virtual void resetEventFlags() = 0;
|
2015-06-23 02:01:50 +08:00
|
|
|
virtual QString getStatusString() const = 0;
|
2015-06-19 22:58:48 +08:00
|
|
|
virtual Friend* getFriend() const{return nullptr;}
|
2015-06-23 02:01:50 +08:00
|
|
|
virtual Group* getGroup() const{return nullptr;}
|
2015-06-11 00:11:50 +08:00
|
|
|
|
|
|
|
virtual bool eventFilter(QObject *, QEvent *) final override;
|
2014-09-02 00:20:28 +08:00
|
|
|
|
2014-10-01 02:10:42 +08:00
|
|
|
bool isActive();
|
|
|
|
void setActive(bool active);
|
2014-09-01 23:02:26 +08:00
|
|
|
|
2014-10-01 17:13:49 +08:00
|
|
|
void setName(const QString& name);
|
|
|
|
void setStatusMsg(const QString& status);
|
|
|
|
QString getStatusMsg() const;
|
2015-06-23 02:01:50 +08:00
|
|
|
QString getTitle() const;
|
2014-10-01 17:13:49 +08:00
|
|
|
|
2015-06-11 00:11:50 +08:00
|
|
|
void reloadTheme();
|
2014-12-11 20:02:45 +08:00
|
|
|
|
2015-06-07 06:33:03 +08:00
|
|
|
public slots:
|
2015-06-11 00:11:50 +08:00
|
|
|
void compactChange(bool compact);
|
2014-12-11 20:02:45 +08:00
|
|
|
|
2014-09-01 23:02:26 +08:00
|
|
|
signals:
|
2015-06-23 02:01:50 +08:00
|
|
|
void chatroomWidgetClicked(GenericChatroomWidget* widget, bool group = false);
|
2014-09-01 23:02:26 +08:00
|
|
|
|
2015-06-07 06:33:03 +08:00
|
|
|
protected:
|
2015-06-11 00:11:50 +08:00
|
|
|
virtual void mouseReleaseEvent(QMouseEvent* event) override;
|
2015-06-09 02:08:24 +08:00
|
|
|
virtual void enterEvent(QEvent* e) override;
|
|
|
|
virtual void leaveEvent(QEvent* e) override;
|
2014-09-01 23:02:26 +08:00
|
|
|
|
2015-06-27 04:13:20 +08:00
|
|
|
QPoint dragStartPos;
|
|
|
|
|
2014-09-01 23:02:26 +08:00
|
|
|
protected:
|
|
|
|
QColor lastColor;
|
2015-05-28 08:45:23 +08:00
|
|
|
QHBoxLayout* mainLayout = nullptr;
|
2015-01-26 21:09:19 +08:00
|
|
|
QVBoxLayout* textLayout = nullptr;
|
2014-10-01 17:13:49 +08:00
|
|
|
MaskablePixmapWidget* avatar;
|
2015-06-03 21:51:23 +08:00
|
|
|
CroppingLabel* statusMessageLabel;
|
2015-06-11 00:11:50 +08:00
|
|
|
bool active;
|
2014-09-01 23:02:26 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // GENERICCHATROOMWIDGET_H
|