mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-02 18:04:32 +00:00
Improve performance of checking path extension
This commit is contained in:
parent
bc94de5626
commit
293479a1f2
@ -155,7 +155,9 @@ QString Path::extension() const
|
|||||||
|
|
||||||
bool Path::hasExtension(const QString &ext) const
|
bool Path::hasExtension(const QString &ext) const
|
||||||
{
|
{
|
||||||
return (extension().compare(ext, Qt::CaseInsensitive) == 0);
|
Q_ASSERT(ext.startsWith(QLatin1Char('.')));
|
||||||
|
|
||||||
|
return m_pathStr.endsWith(ext, Qt::CaseInsensitive);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Path::hasAncestor(const Path &other) const
|
bool Path::hasAncestor(const Path &other) const
|
||||||
|
@ -141,7 +141,7 @@ namespace
|
|||||||
if (themePath.filename() == CONFIG_FILE_NAME)
|
if (themePath.filename() == CONFIG_FILE_NAME)
|
||||||
return std::make_unique<FolderThemeSource>(themePath);
|
return std::make_unique<FolderThemeSource>(themePath);
|
||||||
|
|
||||||
if ((themePath.extension() == QLatin1String(".qbtheme"))
|
if ((themePath.hasExtension(QLatin1String(".qbtheme")))
|
||||||
&& QResource::registerResource(themePath.data(), QLatin1String("/uitheme")))
|
&& QResource::registerResource(themePath.data(), QLatin1String("/uitheme")))
|
||||||
{
|
{
|
||||||
return std::make_unique<QRCThemeSource>();
|
return std::make_unique<QRCThemeSource>();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user