Browse Source

Add patches for support Haiku (https://www.haiku-os.org)

adaptive-webui-19844
diger 11 years ago
parent
commit
c22190fbf7
  1. 8
      src/filesystemwatcher.h
  2. 15
      src/fs_utils.cpp
  3. 4
      src/main.cpp
  4. 2
      unixconf.pri

8
src/filesystemwatcher.h

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
#include <sys/param.h>
#include <sys/mount.h>
#include <string.h>
#else
#elif !defined Q_WS_HAIKU
#include <sys/vfs.h>
#endif
#endif
@ -56,7 +56,7 @@ private: @@ -56,7 +56,7 @@ private:
QHash<QString, int> m_partialTorrents;
QPointer<QTimer> m_partialTorrentTimer;
#ifndef Q_OS_WIN
#if !defined Q_WS_WIN && !defined Q_WS_HAIKU
private:
static bool isNetworkFileSystem(QString path) {
QString file = path;
@ -145,7 +145,7 @@ public: @@ -145,7 +145,7 @@ public:
}
void addPath(const QString & path) {
#ifndef Q_OS_WIN
#if !defined Q_WS_WIN && !defined Q_WS_HAIKU
QDir dir(path);
if (!dir.exists())
return;
@ -167,7 +167,7 @@ public: @@ -167,7 +167,7 @@ public:
qDebug("FS Watching is watching %s in normal mode", qPrintable(path));
QFileSystemWatcher::addPath(path);
scanLocalFolder(path);
#ifndef Q_OS_WIN
#if !defined Q_WS_WIN && !defined Q_WS_HAIKU
}
#endif
}

15
src/fs_utils.cpp

@ -52,6 +52,8 @@ @@ -52,6 +52,8 @@
#if defined(Q_OS_MAC) || defined(Q_OS_FREEBSD)
#include <sys/param.h>
#include <sys/mount.h>
#elif defined(Q_WS_HAIKU)
#include <kernel/fs_info.h>
#else
#include <sys/vfs.h>
#endif
@ -289,6 +291,18 @@ long long fsutils::freeDiskSpaceOnPath(QString path) { @@ -289,6 +291,18 @@ long long fsutils::freeDiskSpaceOnPath(QString path) {
#ifndef Q_OS_WIN
unsigned long long available;
#ifdef Q_WS_HAIKU
const QString statfs_path = dir_path.path()+"/.";
dev_t device = dev_for_path (qPrintable(statfs_path));
if (device >= 0) {
fs_info info;
if(fs_stat_dev(device, &info)==B_OK){
available = ((unsigned long long)(info.free_blocks*info.block_size));
return available;
}
}
return -1;
#else
struct statfs stats;
const QString statfs_path = dir_path.path()+"/.";
const int ret = statfs (qPrintable(statfs_path), &stats) ;
@ -299,6 +313,7 @@ long long fsutils::freeDiskSpaceOnPath(QString path) { @@ -299,6 +313,7 @@ long long fsutils::freeDiskSpaceOnPath(QString path) {
} else {
return -1;
}
#endif
#else
typedef BOOL (WINAPI *GetDiskFreeSpaceEx_t)(LPCTSTR,
PULARGE_INTEGER,

4
src/main.cpp

@ -156,7 +156,7 @@ void sigtermHandler(int) { @@ -156,7 +156,7 @@ void sigtermHandler(int) {
void sigsegvHandler(int) {
signal(SIGABRT, 0);
signal(SIGSEGV, 0);
#ifndef Q_OS_WIN
#if !defined Q_WS_WIN && !defined Q_WS_HAIKU
std::cerr << "\n\n*************************************************************\n";
std::cerr << "Catching SIGSEGV, please report a bug at http://bug.qbittorrent.org\nand provide the following backtrace:\n";
std::cerr << "qBittorrent version: " << VERSION << std::endl;
@ -173,7 +173,7 @@ void sigsegvHandler(int) { @@ -173,7 +173,7 @@ void sigsegvHandler(int) {
void sigabrtHandler(int) {
signal(SIGABRT, 0);
signal(SIGSEGV, 0);
#ifndef Q_OS_WIN
#if !defined Q_WS_WIN && !defined Q_WS_HAIKU
std::cerr << "\n\n*************************************************************\n";
std::cerr << "Catching SIGABRT, please report a bug at http://bug.qbittorrent.org\nand provide the following backtrace:\n";
std::cerr << "qBittorrent version: " << VERSION << std::endl;

2
unixconf.pri

@ -15,7 +15,9 @@ exists($$OUT_PWD/../conf.pri) { @@ -15,7 +15,9 @@ exists($$OUT_PWD/../conf.pri) {
}
QMAKE_CXXFLAGS += -Wformat -Wformat-security
!haiku {
QMAKE_LFLAGS_APP += -rdynamic
}
# Man page
nox {

Loading…
Cancel
Save