summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2012-03-27 23:01:17 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-04-12 14:09:34 (GMT)
commit2dcdee8e9f657c7f5c5d5c507373fd328beaa568 (patch)
treef6c0516afefdcf1561e32b45a415a387bc71f9d3 /Swift/QtUI/QtChatWindow.h
parent0bf6afc5c01b9eb3024a8cfd04bfd743890db4f6 (diff)
downloadswift-contrib-2dcdee8e9f657c7f5c5d5c507373fd328beaa568.zip
swift-contrib-2dcdee8e9f657c7f5c5d5c507373fd328beaa568.tar.bz2
Refactoring incoming MUC invites UI.
Making MUC invites non-modal by moving them into the chat view. Adding event classes for invites so they turn up in 'Notices'-tab and generate notifications. License: This patch is BSD-licensed, see http://www.opensource.org/licenses/bsd-license.php
Diffstat (limited to 'Swift/QtUI/QtChatWindow.h')
-rw-r--r--Swift/QtUI/QtChatWindow.h37
1 files changed, 26 insertions, 11 deletions
diff --git a/Swift/QtUI/QtChatWindow.h b/Swift/QtUI/QtChatWindow.h
index 189a12a..18eb092 100644
--- a/Swift/QtUI/QtChatWindow.h
+++ b/Swift/QtUI/QtChatWindow.h
@@ -31,11 +31,19 @@ namespace Swift {
class TreeWidget;
class QtTextEdit;
class UIEventStream;
- class QtFileTransferJSBridge;
+ class QtChatWindowJSBridge;
class SettingsProvider;
class QtChatWindow : public QtTabbable, public ChatWindow {
Q_OBJECT
+
+ public:
+ static const QString ButtonFileTransferCancel;
+ static const QString ButtonFileTransferSetDescription;
+ static const QString ButtonFileTransferSendRequest;
+ static const QString ButtonFileTransferAcceptRequest;
+ static const QString ButtonMUCInvite;
+
public:
QtChatWindow(const QString &contact, QtChatTheme* theme, UIEventStream* eventStream, SettingsProvider* settings);
~QtChatWindow();
@@ -77,10 +85,12 @@ namespace Swift {
virtual void setAvailableOccupantActions(const std::vector<OccupantAction>& actions);
void setSubject(const std::string& subject);
void showRoomConfigurationForm(Form::ref);
- void addMUCInvitation(const JID& jid, const std::string& reason, const std::string& password, bool direct = true);
+ 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);
+ static QString buildChatWindowButton(const QString& name, const QString& id, const QString& arg1 = QString(), const QString& arg2 = QString(), const QString& arg3 = QString());
+
public slots:
void handleChangeSplitterState(QByteArray state);
void handleFontResized(int fontSizeSteps);
@@ -113,20 +123,27 @@ namespace Swift {
void handleAlertButtonClicked();
void handleActionButtonClicked();
-
- void handleFileTransferCancel(QString id);
- void handleFileTransferSetDescription(QString id);
- void handleFileTransferStart(QString id);
- void handleFileTransferAccept(QString id, QString filename);
+ void handleHTMLButtonClicked(QString id, QString arg1, QString arg2, QString arg3);
void handleAffiliationEditorAccepted();
private:
+ enum PreviousMessageKind {
+ PreviosuMessageWasNone,
+ PreviousMessageWasMessage,
+ PreviousMessageWasSystem,
+ PreviousMessageWasPresence,
+ PreviousMessageWasFileTransfer,
+ PreviousMessageWasMUCInvite
+ };
+
+ private:
void updateTitleWithUnreadCount();
void tabComplete();
void beginCorrection();
void cancelCorrection();
std::string addMessage(const std::string &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 handleOccupantSelectionChanged(RosterItem* item);
+ bool appendToPreviousCheck(PreviousMessageKind messageKind, const std::string& senderName, bool senderIsSelf) const;
int unreadCount_;
bool contactIsTyping_;
@@ -148,9 +165,7 @@ namespace Swift {
std::vector<SecurityLabelsCatalog::Item> availableLabels_;
bool isCorrection_;
bool previousMessageWasSelf_;
- bool previousMessageWasSystem_;
- bool previousMessageWasPresence_;
- bool previousMessageWasFileTransfer_;
+ PreviousMessageKind previousMessageKind_;
QString previousSenderName_;
bool inputClearing_;
UIEventStream* eventStream_;
@@ -159,7 +174,7 @@ namespace Swift {
Tristate correctionEnabled_;
QString alertStyleSheet_;
std::map<QString, QString> descriptions;
- QtFileTransferJSBridge* fileTransferJS;
+ QtChatWindowJSBridge* jsBridge;
QPointer<QtMUCConfigurationWindow> mucConfigurationWindow_;
QPointer<QtAffiliationEditor> affiliationEditor_;
int idCounter_;