2019-09-01 19:46:12 +00:00
|
|
|
/*
|
|
|
|
* Squawk messenger.
|
|
|
|
* Copyright (C) 2019 Yury Gubich <blue@macaw.me>
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2019-04-03 15:09:29 +00:00
|
|
|
#ifndef MODELS_ACCOUNT_H
|
|
|
|
#define MODELS_ACCOUNT_H
|
|
|
|
|
2019-04-03 18:15:36 +00:00
|
|
|
#include "../../global.h"
|
2019-04-03 15:09:29 +00:00
|
|
|
#include "item.h"
|
2019-04-03 18:15:36 +00:00
|
|
|
#include <QVariant>
|
2019-04-07 20:14:15 +00:00
|
|
|
#include <QIcon>
|
2019-04-03 15:09:29 +00:00
|
|
|
|
|
|
|
namespace Models {
|
|
|
|
class Account : public Item {
|
2019-06-23 11:31:03 +00:00
|
|
|
Q_OBJECT
|
2019-04-03 15:09:29 +00:00
|
|
|
public:
|
|
|
|
explicit Account(const QMap<QString, QVariant> &data, Item *parentItem = 0);
|
|
|
|
~Account();
|
|
|
|
|
2019-04-07 20:14:15 +00:00
|
|
|
void setState(unsigned int p_state);
|
|
|
|
void setState(Shared::ConnectionState p_state);
|
|
|
|
Shared::ConnectionState getState() const;
|
2019-04-03 15:09:29 +00:00
|
|
|
|
|
|
|
void setLogin(const QString& p_login);
|
|
|
|
QString getLogin() const;
|
|
|
|
|
|
|
|
void setServer(const QString& p_server);
|
|
|
|
QString getServer() const;
|
|
|
|
|
|
|
|
void setPassword(const QString& p_password);
|
|
|
|
QString getPassword() const;
|
|
|
|
|
2019-04-12 05:51:36 +00:00
|
|
|
void setResource(const QString& p_resource);
|
|
|
|
QString getResource() const;
|
|
|
|
|
2019-05-24 14:46:34 +00:00
|
|
|
void setError(const QString& p_resource);
|
|
|
|
QString getError() const;
|
|
|
|
|
2019-04-07 20:14:15 +00:00
|
|
|
void setAvailability(Shared::Availability p_avail);
|
|
|
|
void setAvailability(unsigned int p_avail);
|
|
|
|
Shared::Availability getAvailability() const;
|
|
|
|
|
2019-06-23 21:09:39 +00:00
|
|
|
QIcon getStatusIcon(bool big = false) const;
|
2019-04-07 20:14:15 +00:00
|
|
|
|
2019-04-03 15:09:29 +00:00
|
|
|
QVariant data(int column) const override;
|
|
|
|
int columnCount() const override;
|
|
|
|
|
2019-04-03 18:15:36 +00:00
|
|
|
void update(const QString& field, const QVariant& value);
|
|
|
|
|
2019-04-03 15:09:29 +00:00
|
|
|
private:
|
|
|
|
QString login;
|
|
|
|
QString password;
|
|
|
|
QString server;
|
2019-04-12 05:51:36 +00:00
|
|
|
QString resource;
|
2019-05-24 14:46:34 +00:00
|
|
|
QString error;
|
2019-04-07 20:14:15 +00:00
|
|
|
Shared::ConnectionState state;
|
|
|
|
Shared::Availability availability;
|
2019-06-23 11:31:03 +00:00
|
|
|
|
|
|
|
protected slots:
|
|
|
|
void toOfflineState() override;
|
2019-04-03 15:09:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // MODELS_ACCOUNT_H
|