tooltips, status text fetching, window titles, app icon
This commit is contained in:
parent
3d15682b37
commit
e456ba980d
13 changed files with 206 additions and 15 deletions
|
@ -67,9 +67,22 @@ void Models::Contact::setAvailability(Shared::Availability p_state)
|
|||
}
|
||||
}
|
||||
|
||||
QString Models::Contact::getStatus() const
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
void Models::Contact::setStatus(const QString& p_state)
|
||||
{
|
||||
if (status != p_state) {
|
||||
status = p_state;
|
||||
changed(5);
|
||||
}
|
||||
}
|
||||
|
||||
int Models::Contact::columnCount() const
|
||||
{
|
||||
return 5;
|
||||
return 6;
|
||||
}
|
||||
|
||||
QVariant Models::Contact::data(int column) const
|
||||
|
@ -85,6 +98,8 @@ QVariant Models::Contact::data(int column) const
|
|||
return availability;
|
||||
case 4:
|
||||
return getMessagesCount();
|
||||
case 5:
|
||||
return getStatus();
|
||||
default:
|
||||
return QVariant();
|
||||
}
|
||||
|
@ -161,8 +176,10 @@ void Models::Contact::refresh()
|
|||
|
||||
if (presence != 0) {
|
||||
setAvailability(presence->getAvailability());
|
||||
setStatus(presence->getStatus());
|
||||
} else {
|
||||
setAvailability(Shared::offline);
|
||||
setStatus("");
|
||||
}
|
||||
|
||||
if (childMessages != count) {
|
||||
|
|
|
@ -37,6 +37,7 @@ public:
|
|||
QString getAccountJid() const;
|
||||
QString getAccountResource() const;
|
||||
QString getContactName() const;
|
||||
QString getStatus() const;
|
||||
|
||||
void addMessage(const Shared::Message& data);
|
||||
unsigned int getMessagesCount() const;
|
||||
|
@ -56,6 +57,7 @@ protected:
|
|||
void setState(Shared::SubscriptionState p_state);
|
||||
void setState(unsigned int p_state);
|
||||
void setJid(const QString p_jid);
|
||||
void setStatus(const QString& p_state);
|
||||
|
||||
private:
|
||||
QString jid;
|
||||
|
@ -64,6 +66,7 @@ private:
|
|||
QMap<QString, Presence*> presences;
|
||||
Messages messages;
|
||||
unsigned int childMessages;
|
||||
QString status;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -93,6 +93,61 @@ QVariant Models::Roster::data (const QModelIndex& index, int role) const
|
|||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case Qt::ToolTipRole:
|
||||
switch (item->type) {
|
||||
case Item::account: {
|
||||
Account* acc = static_cast<Account*>(item);
|
||||
result = QString(Shared::connectionStateNames[acc->getAvailability()]);
|
||||
}
|
||||
break;
|
||||
case Item::contact: {
|
||||
Contact* contact = static_cast<Contact*>(item);
|
||||
QString str = QString("");
|
||||
int mc = contact->getMessagesCount();
|
||||
if (mc > 0) {
|
||||
str += QString("New messages: ") + std::to_string(mc).c_str() + "\n";
|
||||
}
|
||||
Shared::SubscriptionState ss = contact->getState();
|
||||
if (ss == Shared::both) {
|
||||
Shared::Availability av = contact->getAvailability();
|
||||
str += "Availability: " + Shared::availabilityNames[av];
|
||||
if (av != Shared::offline) {
|
||||
QString s = contact->getStatus();
|
||||
if (s.size() > 0) {
|
||||
str += "\nStatus: " + s;
|
||||
}
|
||||
}
|
||||
str += "\nSubscription: " + Shared::subscriptionStateNames[ss];
|
||||
} else {
|
||||
str += "Subscription: " + Shared::subscriptionStateNames[ss];
|
||||
}
|
||||
|
||||
result = str;
|
||||
}
|
||||
break;
|
||||
case Item::presence: {
|
||||
Presence* contact = static_cast<Presence*>(item);
|
||||
QString str = QString("");
|
||||
int mc = contact->getMessagesCount();
|
||||
if (mc > 0) {
|
||||
str += QString("New messages: ") + std::to_string(mc).c_str() + "\n";
|
||||
}
|
||||
Shared::Availability av = contact->getAvailability();
|
||||
str += "Availability: " + Shared::availabilityNames[av];
|
||||
QString s = contact->getStatus();
|
||||
if (s.size() > 0) {
|
||||
str += "\nStatus: " + s;
|
||||
}
|
||||
|
||||
result = str;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
result = "";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue