mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-12 23:35:33 +08:00
Style: renaming methods
This commit is contained in:
@@ -27,13 +27,13 @@ namespace BlackMisc
|
||||
: m_name(name), m_url(url), m_size(size)
|
||||
{ }
|
||||
|
||||
QString CRemoteFile::getNameAndSize() const
|
||||
QString CRemoteFile::getBaseNameAndSize() const
|
||||
{
|
||||
if (!this->hasName()) { return {}; }
|
||||
return QStringLiteral("%1 (%2)").arg(this->getName(), this->getSizeHumanReadable());
|
||||
return QStringLiteral("%1 (%2)").arg(this->getBaseName(), this->getSizeHumanReadable());
|
||||
}
|
||||
|
||||
bool CRemoteFile::matchesName(const QString &name) const
|
||||
bool CRemoteFile::matchesBaseName(const QString &name) const
|
||||
{
|
||||
if (name.isEmpty()) { return false; }
|
||||
if (caseInsensitiveStringCompare(name, this->getBaseName())) { return true; }
|
||||
|
||||
@@ -66,13 +66,13 @@ namespace BlackMisc
|
||||
bool hasName() const { return !m_name.isEmpty(); }
|
||||
|
||||
//! Name + human readable size
|
||||
QString getNameAndSize() const;
|
||||
QString getBaseNameAndSize() const;
|
||||
|
||||
//! Name
|
||||
void setName(const QString &name) { m_name = name.trimmed(); }
|
||||
|
||||
//! Matching name?
|
||||
bool matchesName(const QString &name) const;
|
||||
bool matchesBaseName(const QString &baseName) const;
|
||||
|
||||
//! Description
|
||||
const QString &getDescription() const { return m_description; }
|
||||
|
||||
@@ -35,12 +35,12 @@ namespace BlackMisc
|
||||
return fileNames;
|
||||
}
|
||||
|
||||
QStringList CRemoteFileList::getNamesPlusSize(bool sorted) const
|
||||
QStringList CRemoteFileList::getBaseNamesPlusSize(bool sorted) const
|
||||
{
|
||||
QStringList fileNames;
|
||||
for (const CRemoteFile &rf : *this)
|
||||
{
|
||||
fileNames.append(rf.getNameAndSize());
|
||||
fileNames.append(rf.getBaseNameAndSize());
|
||||
}
|
||||
if (sorted) { fileNames.sort(); }
|
||||
return fileNames;
|
||||
@@ -62,12 +62,12 @@ namespace BlackMisc
|
||||
return CRemoteFile();
|
||||
}
|
||||
|
||||
CRemoteFile CRemoteFileList::findFirstByMatchingNameOrDefault(const QString &name) const
|
||||
CRemoteFile CRemoteFileList::findFirstByMatchingBaseNameOrDefault(const QString &baseName) const
|
||||
{
|
||||
if (name.isEmpty()) { return CRemoteFile(); }
|
||||
if (baseName.isEmpty()) { return CRemoteFile(); }
|
||||
for (const CRemoteFile &rf : *this)
|
||||
{
|
||||
if (rf.matchesName(name)) { return rf; }
|
||||
if (rf.matchesBaseName(baseName)) { return rf; }
|
||||
}
|
||||
return CRemoteFile();
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace BlackMisc
|
||||
QStringList getNames(bool sorted = true) const;
|
||||
|
||||
//! All file names plus size
|
||||
QStringList getNamesPlusSize(bool sorted = true) const;
|
||||
QStringList getBaseNamesPlusSize(bool sorted = true) const;
|
||||
|
||||
//! First by name of default
|
||||
CRemoteFile findFirstByNameOrDefault(const QString &name) const;
|
||||
@@ -54,7 +54,7 @@ namespace BlackMisc
|
||||
CRemoteFile findFirstContainingNameOrDefault(const QString &name, Qt::CaseSensitivity cs) const;
|
||||
|
||||
//! Find first matching name of default
|
||||
CRemoteFile findFirstByMatchingNameOrDefault(const QString &name) const;
|
||||
CRemoteFile findFirstByMatchingBaseNameOrDefault(const QString &name) const;
|
||||
|
||||
//! Find all executable files (decided by appendix)
|
||||
CRemoteFileList findExecutableFiles() const;
|
||||
|
||||
Reference in New Issue
Block a user