mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03:07 -07:00
Improve coding style
This commit is contained in:
parent
acad35c5bc
commit
c41df9ffbd
147 changed files with 4454 additions and 2227 deletions
|
@ -105,7 +105,8 @@ QPixmap Utils::Gui::scaledPixmapSvg(const QString &path, const QWidget *widget,
|
|||
|
||||
QPixmap pm;
|
||||
QPixmapCache cache;
|
||||
if (!cache.find(normalizedKey, &pm)) {
|
||||
if (!cache.find(normalizedKey, &pm))
|
||||
{
|
||||
pm = QIcon(path).pixmap(scaledHeight);
|
||||
cache.insert(normalizedKey, pm);
|
||||
}
|
||||
|
@ -178,7 +179,8 @@ void Utils::Gui::openFolderSelect(const QString &absolutePath)
|
|||
QString path {Utils::Fs::toUniformPath(absolutePath)};
|
||||
const QFileInfo pathInfo {path};
|
||||
// If the item to select doesn't exist, try to open its parent
|
||||
if (!pathInfo.exists(path)) {
|
||||
if (!pathInfo.exists(path))
|
||||
{
|
||||
openPath(path.left(path.lastIndexOf('/')));
|
||||
return;
|
||||
}
|
||||
|
@ -186,7 +188,8 @@ void Utils::Gui::openFolderSelect(const QString &absolutePath)
|
|||
#ifdef Q_OS_WIN
|
||||
HRESULT hresult = ::CoInitializeEx(nullptr, COINIT_MULTITHREADED);
|
||||
PIDLIST_ABSOLUTE pidl = ::ILCreateFromPathW(reinterpret_cast<PCTSTR>(Utils::Fs::toNativePath(path).utf16()));
|
||||
if (pidl) {
|
||||
if (pidl)
|
||||
{
|
||||
::SHOpenFolderAndSelectItems(pidl, 0, nullptr, 0);
|
||||
::ILFree(pidl);
|
||||
}
|
||||
|
@ -197,11 +200,13 @@ void Utils::Gui::openFolderSelect(const QString &absolutePath)
|
|||
proc.start("xdg-mime", {"query", "default", "inode/directory"});
|
||||
proc.waitForFinished();
|
||||
const QString output = proc.readLine().simplified();
|
||||
if ((output == "dolphin.desktop") || (output == "org.kde.dolphin.desktop")) {
|
||||
if ((output == "dolphin.desktop") || (output == "org.kde.dolphin.desktop"))
|
||||
{
|
||||
proc.startDetached("dolphin", {"--select", Utils::Fs::toNativePath(path)});
|
||||
}
|
||||
else if ((output == "nautilus.desktop") || (output == "org.gnome.Nautilus.desktop")
|
||||
|| (output == "nautilus-folder-handler.desktop")) {
|
||||
|| (output == "nautilus-folder-handler.desktop"))
|
||||
{
|
||||
if (pathInfo.isDir())
|
||||
path = path.left(path.lastIndexOf('/'));
|
||||
proc.start("nautilus", {"--version"});
|
||||
|
@ -213,15 +218,18 @@ void Utils::Gui::openFolderSelect(const QString &absolutePath)
|
|||
else
|
||||
proc.startDetached("nautilus", {"--no-desktop", Utils::Fs::toNativePath(path)});
|
||||
}
|
||||
else if (output == "nemo.desktop") {
|
||||
else if (output == "nemo.desktop")
|
||||
{
|
||||
if (pathInfo.isDir())
|
||||
path = path.left(path.lastIndexOf('/'));
|
||||
proc.startDetached("nemo", {"--no-desktop", Utils::Fs::toNativePath(path)});
|
||||
}
|
||||
else if ((output == "konqueror.desktop") || (output == "kfmclient_dir.desktop")) {
|
||||
else if ((output == "konqueror.desktop") || (output == "kfmclient_dir.desktop"))
|
||||
{
|
||||
proc.startDetached("konqueror", {"--select", Utils::Fs::toNativePath(path)});
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
// "caja" manager can't pinpoint the file, see: https://github.com/qbittorrent/qBittorrent/issues/5003
|
||||
openPath(path.left(path.lastIndexOf('/')));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue