2019-03-29 14:54:34 +00:00
|
|
|
#ifndef SQUAWK_H
|
|
|
|
#define SQUAWK_H
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
|
|
|
#include <QScopedPointer>
|
|
|
|
#include <QCloseEvent>
|
2019-03-30 20:13:13 +00:00
|
|
|
#include <deque>
|
2019-04-02 15:46:18 +00:00
|
|
|
#include <map>
|
2019-03-29 14:54:34 +00:00
|
|
|
|
|
|
|
#include "accounts.h"
|
2019-04-09 15:04:08 +00:00
|
|
|
#include "conversation.h"
|
2019-03-31 21:05:09 +00:00
|
|
|
#include "models/roster.h"
|
|
|
|
|
|
|
|
#include "../global.h"
|
2019-03-29 14:54:34 +00:00
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class Squawk;
|
|
|
|
}
|
|
|
|
|
|
|
|
class Squawk : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit Squawk(QWidget *parent = nullptr);
|
|
|
|
~Squawk() override;
|
2019-03-30 20:13:13 +00:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void newAccountRequest(const QMap<QString, QVariant>&);
|
2019-03-31 21:05:09 +00:00
|
|
|
void connectAccount(const QString&);
|
|
|
|
void disconnectAccount(const QString&);
|
2019-04-07 20:14:15 +00:00
|
|
|
void changeState(int state);
|
2019-04-11 14:58:59 +00:00
|
|
|
void sendMessage(const QString& account, const Shared::Message& data);
|
2019-03-30 20:13:13 +00:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
void newAccount(const QMap<QString, QVariant>& account);
|
2019-03-31 21:05:09 +00:00
|
|
|
void accountConnectionStateChanged(const QString& account, int state);
|
2019-04-07 20:14:15 +00:00
|
|
|
void accountAvailabilityChanged(const QString& account, int state);
|
2019-04-03 21:23:51 +00:00
|
|
|
void addGroup(const QString& account, const QString& name);
|
|
|
|
void removeGroup(const QString& account, const QString& name);
|
2019-04-07 20:14:15 +00:00
|
|
|
void addContact(const QString& account, const QString& jid, const QString& group, const QMap<QString, QVariant>& data);
|
2019-04-06 10:14:32 +00:00
|
|
|
void removeContact(const QString& account, const QString& jid, const QString& group);
|
|
|
|
void removeContact(const QString& account, const QString& jid);
|
2019-04-07 20:14:15 +00:00
|
|
|
void changeContact(const QString& account, const QString& jid, const QMap<QString, QVariant>& data);
|
2019-04-07 14:02:41 +00:00
|
|
|
void addPresence(const QString& account, const QString& jid, const QString& name, const QMap<QString, QVariant>& data);
|
|
|
|
void removePresence(const QString& account, const QString& jid, const QString& name);
|
2019-04-07 20:14:15 +00:00
|
|
|
void stateChanged(int state);
|
2019-04-11 14:58:59 +00:00
|
|
|
void accountMessage(const QString& account, const Shared::Message& data);
|
2019-03-30 20:13:13 +00:00
|
|
|
|
2019-03-29 14:54:34 +00:00
|
|
|
private:
|
2019-04-09 15:04:08 +00:00
|
|
|
typedef std::map<Models::Roster::ElId, Conversation*> Conversations;
|
2019-03-29 14:54:34 +00:00
|
|
|
QScopedPointer<Ui::Squawk> m_ui;
|
|
|
|
|
|
|
|
Accounts* accounts;
|
2019-03-31 21:05:09 +00:00
|
|
|
Models::Roster rosterModel;
|
2019-04-09 15:04:08 +00:00
|
|
|
Conversations conversations;
|
2019-03-29 14:54:34 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void closeEvent(QCloseEvent * event) override;
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void onAccounts();
|
|
|
|
void onAccountsClosed(QObject* parent = 0);
|
2019-04-09 15:04:08 +00:00
|
|
|
void onConversationClosed(QObject* parent = 0);
|
2019-03-31 21:05:09 +00:00
|
|
|
void onComboboxActivated(int index);
|
2019-04-09 15:04:08 +00:00
|
|
|
void onRosterItemDoubleClicked(const QModelIndex& item);
|
2019-04-11 14:58:59 +00:00
|
|
|
void onConversationMessage(const Shared::Message& msg);
|
2019-03-31 21:05:09 +00:00
|
|
|
|
2019-03-29 14:54:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SQUAWK_H
|