Browse Source

Use QBT_EXT in all places

Cleanup headers on the way
adaptive-webui-19844
Chocobo1 8 years ago
parent
commit
b9403774e6
  1. 12
      src/base/utils/fs.cpp
  2. 2
      src/gui/previewselect.cpp
  3. 4
      src/gui/torrentcontentmodelfile.cpp
  4. 5
      src/gui/torrentcontentmodelfolder.cpp

12
src/base/utils/fs.cpp

@ -37,8 +37,9 @@ @@ -37,8 +37,9 @@
#include <QDirIterator>
#include <QCoreApplication>
#ifndef Q_OS_WIN
#if defined(Q_OS_MAC) || defined(Q_OS_FREEBSD)
#if defined(Q_OS_WIN)
#include <Windows.h>
#elif defined(Q_OS_MAC) || defined(Q_OS_FREEBSD)
#include <sys/param.h>
#include <sys/mount.h>
#elif defined(Q_OS_HAIKU)
@ -46,9 +47,8 @@ @@ -46,9 +47,8 @@
#else
#include <sys/vfs.h>
#endif
#else
#include <Windows.h>
#endif
#include "base/bittorrent/torrenthandle.h"
/**
* Converts a path to a string suitable for display.
@ -70,7 +70,7 @@ QString Utils::Fs::fromNativePath(const QString &path) @@ -70,7 +70,7 @@ QString Utils::Fs::fromNativePath(const QString &path)
*/
QString Utils::Fs::fileExtension(const QString &filename)
{
QString ext = QString(filename).remove(".!qB");
QString ext = QString(filename).remove(QB_EXT);
const int point_index = ext.lastIndexOf(".");
return (point_index >= 0) ? ext.mid(point_index + 1) : QString();
}

2
src/gui/previewselect.cpp

@ -69,7 +69,7 @@ PreviewSelect::PreviewSelect(QWidget* parent, BitTorrent::TorrentHandle *const t @@ -69,7 +69,7 @@ PreviewSelect::PreviewSelect(QWidget* parent, BitTorrent::TorrentHandle *const t
int nbFiles = torrent->filesCount();
for (int i = 0; i < nbFiles; ++i) {
QString fileName = torrent->fileName(i);
if (fileName.endsWith(".!qB"))
if (fileName.endsWith(QB_EXT))
fileName.chop(4);
QString extension = Utils::Fs::fileExtension(fileName).toUpper();
if (Utils::Misc::isPreviewable(extension)) {

4
src/gui/torrentcontentmodelfile.cpp

@ -29,6 +29,8 @@ @@ -29,6 +29,8 @@
*/
#include "torrentcontentmodelfile.h"
#include "base/bittorrent/torrenthandle.h"
#include "torrentcontentmodelfolder.h"
TorrentContentModelFile::TorrentContentModelFile(const QString &fileName, qulonglong fileSize,
@ -41,7 +43,7 @@ TorrentContentModelFile::TorrentContentModelFile(const QString &fileName, qulong @@ -41,7 +43,7 @@ TorrentContentModelFile::TorrentContentModelFile(const QString &fileName, qulong
m_name = fileName;
// Do not display incomplete extensions
if (m_name.endsWith(".!qB"))
if (m_name.endsWith(QB_EXT))
m_name.chop(4);
m_size = fileSize;

5
src/gui/torrentcontentmodelfolder.cpp

@ -28,16 +28,17 @@ @@ -28,16 +28,17 @@
* Contact : chris@qbittorrent.org
*/
#include <QDebug>
#include "torrentcontentmodelfolder.h"
#include "base/bittorrent/torrenthandle.h"
TorrentContentModelFolder::TorrentContentModelFolder(const QString &name, TorrentContentModelFolder *parent)
: TorrentContentModelItem(parent)
{
Q_ASSERT(parent);
m_name = name;
// Do not display incomplete extensions
if (m_name.endsWith(".!qB"))
if (m_name.endsWith(QB_EXT))
m_name.chop(4);
}

Loading…
Cancel
Save