2010-09-01 10:15:50 -04:00
|
|
|
/****************************************************************
|
|
|
|
* RetroShare is distributed under the following license:
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006 - 2010 The RetroShare Team
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
****************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _IMHISTORYBROWSER_H
|
|
|
|
#define _IMHISTORYBROWSER_H
|
|
|
|
|
|
|
|
#include <QDialog>
|
2010-12-30 12:09:32 -05:00
|
|
|
#include <QThread>
|
2010-09-01 10:15:50 -04:00
|
|
|
|
2010-10-02 18:42:30 -04:00
|
|
|
#include <retroshare/rsmsgs.h>
|
2010-09-04 19:59:08 -04:00
|
|
|
#include "gui/chat/ChatStyle.h"
|
2010-09-01 10:15:50 -04:00
|
|
|
|
|
|
|
#include "ui_ImHistoryBrowser.h"
|
|
|
|
|
2010-09-05 16:50:34 -04:00
|
|
|
class QTextEdit;
|
2010-10-03 19:55:11 -04:00
|
|
|
class ImHistoryBrowserCreateItemsThread;
|
2011-09-29 05:20:09 -04:00
|
|
|
class HistoryMsg;
|
2010-09-05 16:50:34 -04:00
|
|
|
|
2010-09-01 10:15:50 -04:00
|
|
|
class ImHistoryBrowser : public QDialog
|
|
|
|
{
|
2010-10-03 19:55:11 -04:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
friend class ImHistoryBrowserCreateItemsThread;
|
2010-09-01 10:15:50 -04:00
|
|
|
|
|
|
|
public:
|
|
|
|
/** Default constructor */
|
2011-09-29 05:20:09 -04:00
|
|
|
ImHistoryBrowser(const std::string &peerId, QTextEdit *edit, QWidget *parent = 0, Qt::WFlags flags = 0);
|
2010-09-01 10:15:50 -04:00
|
|
|
/** Default destructor */
|
2010-09-05 06:32:32 -04:00
|
|
|
virtual ~ImHistoryBrowser();
|
|
|
|
|
2010-09-05 16:50:34 -04:00
|
|
|
protected:
|
|
|
|
bool eventFilter(QObject *obj, QEvent *ev);
|
|
|
|
|
2010-09-01 10:15:50 -04:00
|
|
|
private slots:
|
2010-10-03 19:55:11 -04:00
|
|
|
void createThreadFinished();
|
|
|
|
void createThreadProgress(int current, int count);
|
|
|
|
|
2011-09-29 05:20:09 -04:00
|
|
|
void historyChanged(uint msgId, int type);
|
2010-09-01 10:15:50 -04:00
|
|
|
|
2012-04-05 17:03:03 -04:00
|
|
|
void filterChanged(const QString& text);
|
2010-09-04 19:59:08 -04:00
|
|
|
|
2010-09-05 16:50:34 -04:00
|
|
|
void itemSelectionChanged();
|
|
|
|
void customContextMenuRequested(QPoint pos);
|
|
|
|
|
|
|
|
void copyMessage();
|
|
|
|
void removeMessages();
|
|
|
|
void clearHistory();
|
|
|
|
void sendMessage();
|
|
|
|
|
2010-10-02 18:42:30 -04:00
|
|
|
|
2010-09-01 10:15:50 -04:00
|
|
|
private:
|
2011-09-29 05:20:09 -04:00
|
|
|
void historyAdd(HistoryMsg& msg);
|
|
|
|
|
|
|
|
QListWidgetItem *createItem(HistoryMsg& msg);
|
|
|
|
void fillItem(QListWidgetItem *itemWidget, HistoryMsg& msg);
|
2012-04-05 17:03:03 -04:00
|
|
|
void filterItems(const QString &text, QListWidgetItem *item = NULL);
|
2010-09-04 10:23:30 -04:00
|
|
|
|
2011-09-29 05:20:09 -04:00
|
|
|
void getSelectedItems(std::list<uint32_t> &items);
|
2010-09-05 16:50:34 -04:00
|
|
|
|
2010-10-03 19:55:11 -04:00
|
|
|
ImHistoryBrowserCreateItemsThread *m_createThread;
|
|
|
|
|
2010-10-02 18:42:30 -04:00
|
|
|
std::string m_peerId;
|
|
|
|
bool m_isPrivateChat;
|
2010-09-05 16:50:34 -04:00
|
|
|
QTextEdit *textEdit;
|
2010-09-04 19:59:08 -04:00
|
|
|
bool embedSmileys;
|
|
|
|
ChatStyle style;
|
2010-09-01 10:15:50 -04:00
|
|
|
|
2011-09-29 05:20:09 -04:00
|
|
|
QList<HistoryMsg> itemsAddedOnLoad;
|
2010-10-02 18:42:30 -04:00
|
|
|
|
2010-09-01 10:15:50 -04:00
|
|
|
/** Qt Designer generated object */
|
|
|
|
Ui::ImHistoryBrowser ui;
|
|
|
|
};
|
|
|
|
|
2010-10-03 19:55:11 -04:00
|
|
|
class ImHistoryBrowserCreateItemsThread : public QThread
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2011-09-29 05:20:09 -04:00
|
|
|
ImHistoryBrowserCreateItemsThread(ImHistoryBrowser *parent, const std::string& peerId);
|
2010-10-03 19:55:11 -04:00
|
|
|
~ImHistoryBrowserCreateItemsThread();
|
|
|
|
|
|
|
|
void run();
|
2011-06-07 18:28:07 -04:00
|
|
|
void stop();
|
|
|
|
bool wasStopped() { return stopped; }
|
2010-10-03 19:55:11 -04:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void progress(int current, int count);
|
|
|
|
|
|
|
|
public:
|
|
|
|
QList<QListWidgetItem*> m_items;
|
|
|
|
|
|
|
|
private:
|
|
|
|
ImHistoryBrowser *m_historyBrowser;
|
2011-09-29 05:20:09 -04:00
|
|
|
std::string m_peerId;
|
2011-06-07 18:28:07 -04:00
|
|
|
volatile bool stopped;
|
2010-10-03 19:55:11 -04:00
|
|
|
};
|
|
|
|
|
2010-09-01 10:15:50 -04:00
|
|
|
#endif
|