diff options
Diffstat (limited to 'Swift/QtUI/QtChatWindow.h')
-rw-r--r-- | Swift/QtUI/QtChatWindow.h | 78 |
1 files changed, 67 insertions, 11 deletions
diff --git a/Swift/QtUI/QtChatWindow.h b/Swift/QtUI/QtChatWindow.h index 910019b..b011427 100644 --- a/Swift/QtUI/QtChatWindow.h +++ b/Swift/QtUI/QtChatWindow.h @@ -1,30 +1,38 @@ /* - * Copyright (c) 2010 Kevin Smith + * Copyright (c) 2010-2011 Kevin Smith * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ -#ifndef SWIFT_QtChatWindow_H -#define SWIFT_QtChatWindow_H +#pragma once -#include "Swift/Controllers/UIInterfaces/ChatWindow.h" +#include <Swift/Controllers/UIInterfaces/ChatWindow.h> +#include <Swift/QtUI/QtMUCConfigurationWindow.h> -#include "QtTabbable.h" +#include <QtTabbable.h> -#include "Swiften/Base/IDGenerator.h" +#include <SwifTools/LastLineTracker.h> + +#include <Swiften/Base/IDGenerator.h> + +#include <map> +#include <QPointer> class QTextEdit; class QLineEdit; class QComboBox; +class QLabel; +class QSplitter; +class QPushButton; namespace Swift { class QtChatView; - class QtTreeWidget; - class QtTreeWidgetFactory; + class QtOccupantListWidget; class QtChatTheme; class TreeWidget; class QtTextEdit; class UIEventStream; + class QtFileTransferJSBridge; class QtChatWindow : public QtTabbable, public ChatWindow { Q_OBJECT public: @@ -35,6 +43,12 @@ namespace Swift { 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); + // 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); + void setFileTransferStatus(std::string id, const FileTransferState state, const std::string& msg); + void show(); void activate(); void setUnreadMessageCount(int count); @@ -54,9 +68,22 @@ namespace Swift { void replaceLastMessage(const std::string& message); void setAckState(const std::string& id, AckState state); void flash(); + QByteArray getSplitterState(); + virtual void setAvailableOccupantActions(const std::vector<OccupantAction>& actions); + void setSubject(const std::string& subject); + void showRoomConfigurationForm(Form::ref); + + 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(); + void splitterMoved(); + void fontResized(int); protected slots: void qAppFocusChanged(QWidget* old, QWidget* now); @@ -64,6 +91,9 @@ namespace Swift { void resizeEvent(QResizeEvent* event); void moveEvent(QMoveEvent* event); + void dragEnterEvent(QDragEnterEvent *event); + void dropEvent(QDropEvent *event); + protected: void showEvent(QShowEvent* event); @@ -71,31 +101,57 @@ namespace Swift { 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); 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); int unreadCount_; bool contactIsTyping_; + LastLineTracker lastLineTracker_; QString contact_; + QString lastSentMessage_; QtChatView* messageLog_; QtChatTheme* theme_; QtTextEdit* input_; QComboBox* labelsWidget_; - QtTreeWidget* treeWidget_; + QtOccupantListWidget* treeWidget_; + QLabel* correctingLabel_; + 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_; QString previousSenderName_; bool inputClearing_; UIEventStream* eventStream_; bool inputEnabled_; IDGenerator id_; + QSplitter *logRosterSplitter_; + Tristate correctionEnabled_; + QString alertStyleSheet_; + std::map<QString, QString> descriptions; + QtFileTransferJSBridge* fileTransferJS; + QPointer<QtMUCConfigurationWindow> mucConfigurationWindow; }; } - -#endif |