overte-HifiExperiments/interface/src/ui/ChatWindow.h
Stojce Slavkovski 519b36240c build fix
2014-05-06 01:05:04 +02:00

83 lines
1.7 KiB
C++

//
// ChatWindow.h
// interface/src/ui
//
// Created by Dimitar Dobrev on 3/6/14.
// Copyright 2014 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef hifi_ChatWindow_h
#define hifi_ChatWindow_h
#include <QDateTime>
#include <QDockWidget>
#include <QMediaPlayer>
#include <QSystemTrayIcon>
#include <QTimer>
#include <Application.h>
#include "FramelessDialog.h"
#ifdef HAVE_QXMPP
#include <QXmppClient.h>
#include <QXmppMessage.h>
#endif
namespace Ui {
// Maximum amount the chat can be scrolled up in order to auto scroll.
const int AUTO_SCROLL_THRESHOLD = 20;
class ChatWindow;
}
class ChatWindow : public FramelessDialog {
Q_OBJECT
public:
ChatWindow(QWidget* parent);
~ChatWindow();
protected:
bool eventFilter(QObject* sender, QEvent* event);
virtual void keyPressEvent(QKeyEvent *event);
virtual void showEvent(QShowEvent* event);
private:
#ifdef HAVE_QXMPP
QString getParticipantName(const QString& participant);
#endif
void startTimerForTimeStamps();
void addTimeStamp();
bool isNearBottom();
void scrollToBottom();
Ui::ChatWindow* ui;
int numMessagesAfterLastTimeStamp;
QDateTime lastMessageStamp;
bool _mousePressed;
QPoint _mouseStartPosition;
QSystemTrayIcon _trayIcon;
QStringList _mentionSounds;
QMediaPlayer _effectPlayer;
private slots:
void connected();
void timeout();
#ifdef HAVE_QXMPP
void error(QXmppClient::Error error);
void participantsChanged();
void messageReceived(const QXmppMessage& message);
void notificationClicked();
#endif
};
#endif // hifi_ChatWindow_h