summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/QtChatWindow.h')
-rw-r--r--Swift/QtUI/QtChatWindow.h55
1 files changed, 39 insertions, 16 deletions
diff --git a/Swift/QtUI/QtChatWindow.h b/Swift/QtUI/QtChatWindow.h
index 3416b42..a29edad 100644
--- a/Swift/QtUI/QtChatWindow.h
+++ b/Swift/QtUI/QtChatWindow.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2012 Kevin Smith
+ * Copyright (c) 2010-2013 Kevin Smith
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
@@ -10,6 +10,7 @@
#include <Swift/QtUI/QtMUCConfigurationWindow.h>
#include <Swift/QtUI/QtAffiliationEditor.h>
#include <Swift/QtUI/QtSwiftUtil.h>
+#include <Swift/QtUI/ChatSnippet.h>
#include <QtTabbable.h>
@@ -37,6 +38,9 @@ namespace Swift {
class QtChatWindowJSBridge;
class SettingsProvider;
+ // FIXME: Move this to a different file
+ std::string formatSize(const boost::uintmax_t bytes);
+
class LabelModel : public QAbstractListModel {
Q_OBJECT
public:
@@ -83,15 +87,17 @@ namespace Swift {
static const QString ButtonMUCInvite;
public:
- QtChatWindow(const QString &contact, QtChatTheme* theme, UIEventStream* eventStream, SettingsProvider* settings, QMap<QString, QString> emoticons);
+ QtChatWindow(const QString &contact, QtChatTheme* theme, UIEventStream* eventStream, SettingsProvider* settings);
~QtChatWindow();
- std::string addMessage(const std::string &message, const std::string &senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time);
- std::string addAction(const std::string &message, const std::string &senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time);
- void addSystemMessage(const std::string& message);
- void addPresenceMessage(const std::string& message);
- void addErrorMessage(const std::string& errorMessage);
- void replaceMessage(const std::string& message, const std::string& id, const boost::posix_time::ptime& time);
- void replaceWithAction(const std::string& message, const std::string& id, const boost::posix_time::ptime& time);
+ std::string addMessage(const ChatMessage& message, const std::string &senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time, const HighlightAction& highlight);
+ std::string addAction(const ChatMessage& message, const std::string &senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const boost::posix_time::ptime& time, const HighlightAction& highlight);
+
+ void addSystemMessage(const ChatMessage& message, Direction direction);
+ void addPresenceMessage(const ChatMessage& message, Direction direction);
+ void addErrorMessage(const ChatMessage& message);
+
+ void replaceMessage(const ChatMessage& message, const std::string& id, const boost::posix_time::ptime& time, const HighlightAction& highlight);
+ void replaceWithAction(const ChatMessage& message, const std::string& id, const boost::posix_time::ptime& time, const HighlightAction& highlight);
// File transfer related stuff
std::string addFileTransfer(const std::string& senderName, bool senderIsSelf, const std::string& filename, const boost::uintmax_t sizeInBytes);
void setFileTransferProgress(std::string id, const int percentageDone);
@@ -116,7 +122,7 @@ namespace Swift {
void setRosterModel(Roster* roster);
void setTabComplete(TabComplete* completer);
int getCount();
- void replaceLastMessage(const std::string& message);
+ void replaceLastMessage(const ChatMessage& message);
void setAckState(const std::string& id, AckState state);
// message receipts
@@ -129,7 +135,8 @@ namespace Swift {
void showRoomConfigurationForm(Form::ref);
void addMUCInvitation(const std::string& senderName, const JID& jid, const std::string& reason, const std::string& password, bool direct = true);
void setAffiliations(MUCOccupant::Affiliation, const std::vector<JID>&);
- void setAvailableRoomActions(const std::vector<RoomAction> &actions);
+ void setAvailableRoomActions(const std::vector<RoomAction>& actions);
+ void setBlockingState(BlockingState state);
InviteToChatWindow* createInviteToChatWindow();
@@ -189,11 +196,27 @@ namespace Swift {
void beginCorrection();
void cancelCorrection();
void handleSettingChanged(const std::string& setting);
- std::string addMessage(const QString& message, const std::string& senderName, bool senderIsSelf, boost::shared_ptr<SecurityLabel> label, const std::string& avatarPath, const QString& style, const boost::posix_time::ptime& time);
- void replaceMessage(const QString& message, const std::string& id, const boost::posix_time::ptime& time, const QString& style);
+ std::string addMessage(
+ const QString& message,
+ const std::string& senderName,
+ bool senderIsSelf,
+ boost::shared_ptr<SecurityLabel> label,
+ const std::string& avatarPath,
+ const QString& style,
+ const boost::posix_time::ptime& time,
+ const HighlightAction& highlight,
+ ChatSnippet::Direction direction);
+ void replaceMessage(
+ const QString& message,
+ const std::string& id,
+ const boost::posix_time::ptime& time,
+ const QString& style,
+ const HighlightAction& highlight);
void handleOccupantSelectionChanged(RosterItem* item);
bool appendToPreviousCheck(PreviousMessageKind messageKind, const std::string& senderName, bool senderIsSelf) const;
- QString linkimoticonify(const QString& message) const;
+ static ChatSnippet::Direction getActualDirection(const ChatMessage& message, Direction direction);
+ QString chatMessageToHTML(const ChatMessage& message);
+ QString getHighlightSpanStart(const HighlightAction& highlight);
int unreadCount_;
bool contactIsTyping_;
@@ -205,6 +228,7 @@ namespace Swift {
QtChatTheme* theme_;
QtTextEdit* input_;
QWidget* midBar_;
+ QBoxLayout* subjectLayout_;
QComboBox* labelsWidget_;
QtOccupantListWidget* treeWidget_;
QLabel* correctingLabel_;
@@ -213,7 +237,6 @@ namespace Swift {
QPushButton* alertButton_;
TabComplete* completer_;
QLineEdit* subject_;
- QPushButton* actionButton_;
bool isCorrection_;
bool previousMessageWasSelf_;
PreviousMessageKind previousMessageKind_;
@@ -232,9 +255,9 @@ namespace Swift {
int idCounter_;
SettingsProvider* settings_;
std::vector<ChatWindow::RoomAction> availableRoomActions_;
- QMap<QString, QString> emoticons_;
bool showEmoticons_;
QPalette defaultLabelsPalette_;
LabelModel* labelModel_;
+ BlockingState blockingState_;
};
}