mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-12 08:16:16 -07:00
Code clean up
This commit is contained in:
parent
a9fbef62b6
commit
5696944c6f
7 changed files with 57 additions and 69 deletions
16
src/misc.cpp
16
src/misc.cpp
|
@ -752,3 +752,19 @@ QString misc::branchPath(QString file_path)
|
|||
file_path.replace("\\", "/");
|
||||
return file_path.left(file_path.lastIndexOf('/'));
|
||||
}
|
||||
|
||||
bool misc::isUrl(const QString &s)
|
||||
{
|
||||
const QString scheme = QUrl(s).scheme();
|
||||
QRegExp is_url("http[s]?|ftp", Qt::CaseInsensitive);
|
||||
return is_url.exactMatch(scheme);
|
||||
}
|
||||
|
||||
QString misc::fileName(QString file_path)
|
||||
{
|
||||
file_path.replace("\\", "/");
|
||||
const int slash_index = file_path.lastIndexOf('/');
|
||||
if(slash_index == -1)
|
||||
return file_path;
|
||||
return file_path.mid(slash_index);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue