Make changes for windows build
This commit is contained in:
+11
-3
@@ -9,12 +9,15 @@
|
||||
#include <QMessageBox>
|
||||
#include <QProgressDialog>
|
||||
#include <QDebug>
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/btrfs.h>
|
||||
#include <QDockWidget>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef __linux__
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/btrfs.h>
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
int MainWindow::socketPair[2] = {0, 0};
|
||||
|
||||
@@ -131,6 +134,7 @@ void MainWindow::keyReleaseEvent(QKeyEvent *event)
|
||||
|
||||
void MainWindow::setupSigterm()
|
||||
{
|
||||
#ifdef __linux__
|
||||
struct sigaction signal;
|
||||
|
||||
signal.sa_handler = MainWindow::signalHandler;
|
||||
@@ -145,6 +149,7 @@ void MainWindow::setupSigterm()
|
||||
::socketpair(AF_UNIX, SOCK_STREAM, 0, socketPair);
|
||||
socketNotifier = new QSocketNotifier(socketPair[1], QSocketNotifier::Read, this);
|
||||
connect(socketNotifier, SIGNAL(activated(int)), this, SLOT(socketNotify()));
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainWindow::signalHandler(int)
|
||||
@@ -245,7 +250,7 @@ void MainWindow::copyMarked()
|
||||
|
||||
if(progress.wasCanceled())
|
||||
break;
|
||||
|
||||
#ifdef __linux__
|
||||
srcFile.open(QIODevice::ReadOnly);
|
||||
dstFile.open(QIODevice::WriteOnly);
|
||||
if(ioctl(dstFile.handle(), BTRFS_IOC_CLONE, srcFile.handle()) < 0)
|
||||
@@ -255,6 +260,9 @@ void MainWindow::copyMarked()
|
||||
qDebug() << dstFile.fileName();
|
||||
srcFile.copy(dstFile.fileName());
|
||||
}
|
||||
#else
|
||||
srcFile.copy(dstFile.fileName());
|
||||
#endif
|
||||
progress.setValue(i++);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user