mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 20:15:35 +08:00
refs #471, allow to search server by name and occupy less height for form
This commit is contained in:
committed by
Mathew Sutcliffe
parent
ace3b60062
commit
012543ef02
@@ -29,6 +29,12 @@ namespace BlackMisc
|
||||
return s;
|
||||
}
|
||||
|
||||
bool CServer::matchesName(const QString &name) const
|
||||
{
|
||||
return m_name.length() == name.length() &&
|
||||
m_name.startsWith(name, Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
bool CServer::isValidForLogin() const
|
||||
{
|
||||
return this->m_user.hasValidCredentials() && this->m_port > 0 && !this->m_address.isEmpty() && this->isAcceptingConnections();
|
||||
|
||||
@@ -61,6 +61,9 @@ namespace BlackMisc
|
||||
//! Set name
|
||||
void setName(const QString &name) { m_name = name.trimmed(); }
|
||||
|
||||
//! Matches server name?
|
||||
bool matchesName(const QString &name) const;
|
||||
|
||||
//! Get description
|
||||
const QString &getDescription() const { return m_description; }
|
||||
|
||||
|
||||
@@ -20,5 +20,14 @@ namespace BlackMisc
|
||||
CSequence<CServer>(other)
|
||||
{ }
|
||||
|
||||
bool CServerList::containsName(const QString &name) const
|
||||
{
|
||||
for (const CServer &s : *this)
|
||||
{
|
||||
if (s.matchesName(name)) { return true; }
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -34,6 +34,9 @@ namespace BlackMisc
|
||||
|
||||
//! Construct from a base class object.
|
||||
CServerList(const CSequence<CServer> &other);
|
||||
|
||||
//! Contains name
|
||||
bool containsName(const QString &name) const;
|
||||
};
|
||||
|
||||
} //namespace
|
||||
|
||||
Reference in New Issue
Block a user