forked from blue/squawk
refactoring: UI squawk now belongs to a new class, it enables me doing trayed mode, when main window is destroyed
This commit is contained in:
parent
83cb220175
commit
721d3a1a89
16 changed files with 908 additions and 769 deletions
|
@ -927,11 +927,29 @@ QString Models::Roster::getContactIconPath(const QString& account, const QString
|
|||
return path;
|
||||
}
|
||||
|
||||
Models::Account * Models::Roster::getAccount(const QString& name)
|
||||
Models::Account * Models::Roster::getAccount(const QString& name) {
|
||||
return const_cast<Models::Account*>(getAccountConst(name));}
|
||||
|
||||
const Models::Account * Models::Roster::getAccountConst(const QString& name) const {
|
||||
return accounts.at(name);}
|
||||
|
||||
const Models::Element * Models::Roster::getElementConst(const Models::Roster::ElId& id) const
|
||||
{
|
||||
return accounts.find(name)->second;
|
||||
std::map<ElId, Contact*>::const_iterator cItr = contacts.find(id);
|
||||
|
||||
if (cItr != contacts.end()) {
|
||||
return cItr->second;
|
||||
} else {
|
||||
std::map<ElId, Room*>::const_iterator rItr = rooms.find(id);
|
||||
if (rItr != rooms.end()) {
|
||||
return rItr->second;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
QModelIndex Models::Roster::getAccountIndex(const QString& name)
|
||||
{
|
||||
std::map<QString, Account*>::const_iterator itr = accounts.find(name);
|
||||
|
@ -1005,20 +1023,20 @@ void Models::Roster::fileError(const std::list<Shared::MessageInfo>& msgs, const
|
|||
|
||||
Models::Element * Models::Roster::getElement(const Models::Roster::ElId& id)
|
||||
{
|
||||
std::map<ElId, Contact*>::iterator cItr = contacts.find(id);
|
||||
|
||||
if (cItr != contacts.end()) {
|
||||
return cItr->second;
|
||||
} else {
|
||||
std::map<ElId, Room*>::iterator rItr = rooms.find(id);
|
||||
if (rItr != rooms.end()) {
|
||||
return rItr->second;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return const_cast<Models::Element*>(getElementConst(id));
|
||||
}
|
||||
|
||||
Models::Item::Type Models::Roster::getContactType(const Models::Roster::ElId& id) const
|
||||
{
|
||||
const Models::Element* el = getElementConst(id);
|
||||
if (el == NULL) {
|
||||
return Item::root;
|
||||
}
|
||||
|
||||
return el->type;
|
||||
}
|
||||
|
||||
|
||||
void Models::Roster::onAccountReconnected()
|
||||
{
|
||||
Account* acc = static_cast<Account*>(sender());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue