X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fclient%2Fclient.h;h=4e7eb0e203bbb80304c57a32c3f9fb47d9a30285;hb=fd8d472f11d024b2df59027f719fbf3387315ec5;hp=f2b3ec3c5a5cfb46f8ba8de8cc5d23335c4da458;hpb=7f8acf4ede38a0178a97eb701a9382e455ca7c2d;p=quassel.git diff --git a/src/client/client.h b/src/client/client.h index f2b3ec3c..4e7eb0e2 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -27,17 +27,21 @@ #include #include "buffer.h" // needed for activity lvl + class BufferInfo; class Message; +class MessageModel; class Identity; class Network; - class AbstractUi; class AbstractUiMsg; class NetworkModel; class BufferModel; +class BufferSyncer; +class ClientBacklogManager; +class BufferViewManager; class IrcUser; class IrcChannel; class SignalProxy; @@ -45,7 +49,6 @@ struct NetworkInfo; class QTimer; - class Client : public QObject { Q_OBJECT @@ -58,7 +61,7 @@ public: static QList buffers(); static Buffer *buffer(BufferId bufferUid); static Buffer *buffer(BufferInfo); - static Buffer *monitorBuffer(); + static inline Buffer *monitorBuffer() { return instance()->_monitorBuffer; } static QList networkIds(); static const Network * network(NetworkId); @@ -88,9 +91,15 @@ public: static void updateNetwork(const NetworkInfo &info); static void removeNetwork(NetworkId id); - static NetworkModel *networkModel(); - static BufferModel *bufferModel(); - static SignalProxy *signalProxy(); + static inline NetworkModel *networkModel() { return instance()->_networkModel; } + static inline BufferModel *bufferModel() { return instance()->_bufferModel; } + static inline MessageModel *messageModel() { return instance()->_messageModel; } + static inline SignalProxy *signalProxy() { return instance()->_signalProxy; } + + static inline ClientBacklogManager *backlogManager() { return instance()->_backlogManager; } + static inline BufferViewManager *bufferViewManager() { return instance()->_bufferViewManager; } + + static AccountId currentCoreAccount(); static AbstractUiMsg *layoutMsg(const Message &); @@ -99,14 +108,12 @@ public: static void userInput(BufferInfo bufferInfo, QString message); - static void storeSessionData(const QString &key, const QVariant &data); - static QVariant retrieveSessionData(const QString &key, const QVariant &def = QVariant()); - static QStringList sessionDataKeys(); - - static void disconnectFromNetwork(NetworkId); - enum ClientMode { LocalCore, RemoteCore }; + static void checkForHighlight(Message &msg); + static void setBufferLastSeenMsg(BufferId id, const MsgId &msgId); // this is synced to core and other clients + static void removeBuffer(BufferId id); + signals: void sendInput(BufferInfo, QString message); void showBuffer(Buffer *); @@ -114,17 +121,15 @@ signals: void backlogReceived(Buffer *, QList); void requestBacklog(BufferInfo, QVariant, QVariant); void requestNetworkStates(); + void messageReceived(const Message &msg); void showConfigWizard(const QVariantMap &coredata); void connected(); + void securedConnection(); void disconnected(); void coreConnectionStateChanged(bool); - void sessionDataChanged(const QString &key); - void sessionDataChanged(const QString &key, const QVariant &data); - void sendSessionData(const QString &key, const QVariant &data); - //! The identity with the given ID has been newly created in core and client. /** \param id The ID of the newly created identity. */ @@ -150,20 +155,19 @@ signals: void requestCreateNetwork(const NetworkInfo &info); void requestUpdateNetwork(const NetworkInfo &info); - void requestRemoveNetwork(const NetworkInfo &info); + void requestRemoveNetwork(NetworkId); public slots: //void selectBuffer(Buffer *); - void setConnectedToCore(QIODevice *socket); - void setSyncedToCore(); void disconnectFromCore(); void setCoreConfiguration(const QVariantMap &settings); -private slots: - void recvSessionData(const QString &key, const QVariant &data); + void bufferRemoved(BufferId bufferId); + void bufferRenamed(BufferId bufferId, const QString &newName); +private slots: //void coreSocketError(QAbstractSocket::SocketError); //void networkConnected(NetworkId); @@ -171,8 +175,9 @@ private slots: void recvMessage(const Message &message); void recvStatusMsg(QString network, QString message); - void recvBacklogData(BufferInfo, QVariantList, bool); + void receiveBacklog(BufferId bufferId, const QVariantList &msgs); void updateBufferInfo(BufferInfo); + void updateLastSeenMsg(BufferId id, const MsgId &msgId); void layoutMsg(); @@ -180,6 +185,13 @@ private slots: void networkDestroyed(); void coreIdentityCreated(const Identity &); void coreIdentityRemoved(IdentityId); + void coreNetworkCreated(NetworkId); + void coreNetworkRemoved(NetworkId); + + void setConnectedToCore(QIODevice *socket, AccountId id); + void setSyncedToCore(); + void setSecuredConnection(); + private: Client(QObject *parent = 0); @@ -187,29 +199,40 @@ private: void init(); static void addNetwork(Network *); + static void setCurrentCoreAccount(AccountId); + static inline BufferSyncer *bufferSyncer() { return instance()->_bufferSyncer; } + + Buffer *statusBuffer(const NetworkId &networkid) const; static QPointer instanceptr; QPointer socket; - QPointer _signalProxy; - QPointer mainUi; - QPointer _networkModel; - QPointer _bufferModel; + + SignalProxy * _signalProxy; + AbstractUi * mainUi; + NetworkModel * _networkModel; + BufferModel * _bufferModel; + BufferSyncer * _bufferSyncer; + ClientBacklogManager *_backlogManager; + BufferViewManager *_bufferViewManager; + + MessageModel *_messageModel; ClientMode clientMode; bool _connectedToCore, _syncedToCore; QHash _buffers; + QHash _statusBuffers; // fast lookup QHash _networks; QHash _identities; Buffer *_monitorBuffer; QTimer *layoutTimer; - QList layoutQueue; + QLinkedList layoutQueue; - QVariantMap sessionData; + static AccountId _currentCoreAccount; friend class ClientSyncer; };