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
@@ -25,23 +25,31 @@ class QSplitter;
class QPushButton;
namespace Swift {
class QtChatView;
class QtOccupantListWidget;
class QtChatTheme;
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();
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);
@@ -71,22 +79,24 @@ namespace Swift {
// message receipts
void setMessageReceiptState(const std::string& id, ChatWindow::ReceiptState state);
void flash();
QByteArray getSplitterState();
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);
void setAlert(const std::string& alertText, const std::string& buttonText = "");
void cancelAlert();
void setCorrectionEnabled(Tristate enabled);
signals:
void geometryChanged();
@@ -107,32 +117,39 @@ namespace Swift {
private slots:
void returnPressed();
void handleInputChanged();
void handleKeyPressEvent(QKeyEvent* event);
void handleSplitterMoved(int pos, int index);
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_;
LastLineTracker lastLineTracker_;
QString contact_;
QString lastSentMessage_;
QtChatView* messageLog_;
QtChatTheme* theme_;
QtTextEdit* input_;
@@ -142,28 +159,26 @@ namespace Swift {
QLabel* alertLabel_;
QWidget* alertWidget_;
QPushButton* alertButton_;
TabComplete* completer_;
QLineEdit* subject_;
QPushButton* actionButton_;
std::vector<SecurityLabelsCatalog::Item> availableLabels_;
bool isCorrection_;
bool previousMessageWasSelf_;
- bool previousMessageWasSystem_;
- bool previousMessageWasPresence_;
- bool previousMessageWasFileTransfer_;
+ PreviousMessageKind previousMessageKind_;
QString previousSenderName_;
bool inputClearing_;
UIEventStream* eventStream_;
bool inputEnabled_;
QSplitter *logRosterSplitter_;
Tristate correctionEnabled_;
QString alertStyleSheet_;
std::map<QString, QString> descriptions;
- QtFileTransferJSBridge* fileTransferJS;
+ QtChatWindowJSBridge* jsBridge;
QPointer<QtMUCConfigurationWindow> mucConfigurationWindow_;
QPointer<QtAffiliationEditor> affiliationEditor_;
int idCounter_;
SettingsProvider* settings_;
std::vector<ChatWindow::RoomAction> availableRoomActions_;
};
}