mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03:07 -07:00
Improve constructor of Version class
Now we can write `Version<int, 3, 1>(1)` and provide only 1 parameter instead of all 3 parameters at once at the constructor. Note that for this instance of `Version` 3 numbers were specified but only 1 is truly mandatory. The added code are required to specify conditions of the template instantiation for the compiler.
This commit is contained in:
parent
958929aa77
commit
a4c2363f43
4 changed files with 174 additions and 15 deletions
|
@ -194,7 +194,7 @@ void Utils::Gui::openFolderSelect(const Path &path)
|
|||
proc.waitForFinished();
|
||||
const auto nautilusVerStr = QString::fromLocal8Bit(proc.readLine()).remove(QRegularExpression(u"[^0-9.]"_qs));
|
||||
using NautilusVersion = Utils::Version<int, 3>;
|
||||
if (NautilusVersion::tryParse(nautilusVerStr, {1, 0, 0}) > NautilusVersion {3, 28})
|
||||
if (NautilusVersion::tryParse(nautilusVerStr, {1, 0, 0}) > NautilusVersion {3, 28, 0})
|
||||
proc.startDetached(u"nautilus"_qs, {(Fs::isDir(path) ? path.parentPath() : path).toString()});
|
||||
else
|
||||
proc.startDetached(u"nautilus"_qs, {u"--no-desktop"_qs, (Fs::isDir(path) ? path.parentPath() : path).toString()});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue