X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fclient%2Fclient.h;h=7c42784424de8d48890181e9c5f4b34292098d4c;hb=765e6548b026a61e8b71ec8b336d1e4ad4c7ac8f;hp=f2b3ec3c5a5cfb46f8ba8de8cc5d23335c4da458;hpb=7f8acf4ede38a0178a97eb701a9382e455ca7c2d;p=quassel.git diff --git a/src/client/client.h b/src/client/client.h index f2b3ec3c..7c427844 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -27,25 +27,27 @@ #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 ClientIrcListHelper; +class BufferViewManager; class IrcUser; class IrcChannel; class SignalProxy; struct NetworkInfo; -class QTimer; - - class Client : public QObject { Q_OBJECT @@ -58,7 +60,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,25 +90,28 @@ 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 ClientIrcListHelper *ircListHelper() { return instance()->_ircListHelper; } + static inline BufferViewManager *bufferViewManager() { return instance()->_bufferViewManager; } - static AbstractUiMsg *layoutMsg(const Message &); + static AccountId currentCoreAccount(); static bool isConnected(); static bool isSynced(); 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 *); @@ -118,13 +123,10 @@ signals: 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 +152,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,15 +172,21 @@ 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 layoutMsg(); + void updateLastSeenMsg(BufferId id, const MsgId &msgId); void bufferDestroyed(); 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 +194,38 @@ 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; + ClientIrcListHelper *_ircListHelper; + + MessageModel *_messageModel; ClientMode clientMode; bool _connectedToCore, _syncedToCore; QHash _buffers; + QHash _statusBuffers; // fast lookup QHash _networks; QHash _identities; Buffer *_monitorBuffer; - QTimer *layoutTimer; - QList layoutQueue; - - QVariantMap sessionData; + static AccountId _currentCoreAccount; friend class ClientSyncer; };