Created
March 31, 2018 17:02
-
-
Save Kirek/2e227ce1b44a7f18d589c99283f32a37 to your computer and use it in GitHub Desktop.
Boxit qt5 patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/boxit/src/boxit/boxit.pro b/boxit/src/boxit/boxit.pro | |
index 79dfc70..6b7ac55 100644 | |
--- a/boxit/src/boxit/boxit.pro | |
+++ b/boxit/src/boxit/boxit.pro | |
@@ -19,14 +19,12 @@ TEMPLATE = app | |
SOURCES += main.cpp \ | |
boxitsocket.cpp \ | |
version.cpp \ | |
- timeoutreset.cpp \ | |
interactiveprocess.cpp | |
HEADERS += \ | |
boxitsocket.h \ | |
const.h \ | |
version.h \ | |
- timeoutreset.h \ | |
interactiveprocess.h | |
diff --git a/boxit/src/boxit/main.cpp b/boxit/src/boxit/main.cpp | |
index 8ce90a0..46525db 100644 | |
--- a/boxit/src/boxit/main.cpp | |
+++ b/boxit/src/boxit/main.cpp | |
@@ -40,12 +40,12 @@ | |
#include <QFileInfo> | |
#include <QMap> | |
#include <QProcess> | |
+#include <QTimer> | |
#include <dbusclient.h> | |
#include "boxitsocket.h" | |
#include "const.h" | |
#include "version.h" | |
-#include "timeoutreset.h" | |
#include "interactiveprocess.h" | |
using namespace std; | |
@@ -2160,7 +2160,14 @@ bool uploadData(const QString path, const int currentIndex, const int maxIndex) | |
bool listenOnStatus(bool exitOnSessionEnd) { | |
- TimeOutReset timeOutReset(&boxitSocket); | |
+ QTimer timer; | |
+ QObject::connect(&timer, &QTimer::timeout, | |
+ [=]( ) { | |
+ if (boxitSocket.state() != QAbstractSocket::ConnectedState) | |
+ return; | |
+ boxitSocket.sendData(MSG_RESET_TIMEOUT); } | |
+ ); | |
+ | |
QString host = ""; | |
if (!connectAndLoginToHost(host)) | |
@@ -2175,7 +2182,7 @@ bool listenOnStatus(bool exitOnSessionEnd) { | |
} | |
// Start our reset timeout timer | |
- timeOutReset.start(); | |
+ timer.start(10000); | |
bool firstBranch = true; | |
bool firstRepo = true; | |
diff --git a/boxit/src/boxit/timeoutreset.cpp b/boxit/src/boxit/timeoutreset.cpp | |
deleted file mode 100644 | |
index ea7b60d..0000000 | |
--- a/boxit/src/boxit/timeoutreset.cpp | |
+++ /dev/null | |
@@ -1,56 +0,0 @@ | |
-/* | |
- * BoxIt - Manjaro Linux Repository Management Software | |
- * Roland Singer <roland@manjaro.org> | |
- * | |
- * Copyright (C) 2007 Free Software Foundation, Inc. | |
- * | |
- * This program is free software: you can redistribute it and/or modify | |
- * it under the terms of the GNU General Public License as published by | |
- * the Free Software Foundation, either version 3 of the License, or | |
- * (at your option) any later version. | |
- * | |
- * This program is distributed in the hope that it will be useful, | |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
- * GNU General Public License for more details. | |
- * | |
- * You should have received a copy of the GNU General Public License | |
- * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
- */ | |
- | |
-#include "timeoutreset.h" | |
- | |
-TimeOutReset::TimeOutReset(BoxitSocket *socket, QObject *parent) : | |
- QThread(parent) | |
-{ | |
- this->socket = socket; | |
-} | |
- | |
- | |
- | |
-TimeOutReset::~TimeOutReset() { | |
- stop(); | |
-} | |
- | |
- | |
- | |
-void TimeOutReset::stop() { | |
- if (!isRunning()) | |
- return; | |
- | |
- terminate(); | |
- wait(); | |
-} | |
- | |
- | |
- | |
-void TimeOutReset::run() { | |
- while (true) { | |
- sleep(10); | |
- | |
- if (socket->state() != QAbstractSocket::ConnectedState) | |
- return; | |
- | |
- socket->sendData(MSG_RESET_TIMEOUT); | |
- } | |
-} | |
diff --git a/boxit/src/boxit/timeoutreset.h b/boxit/src/boxit/timeoutreset.h | |
deleted file mode 100644 | |
index 04a30dd..0000000 | |
--- a/boxit/src/boxit/timeoutreset.h | |
+++ /dev/null | |
@@ -1,47 +0,0 @@ | |
-/* | |
- * BoxIt - Manjaro Linux Repository Management Software | |
- * Roland Singer <roland@manjaro.org> | |
- * | |
- * Copyright (C) 2007 Free Software Foundation, Inc. | |
- * | |
- * This program is free software: you can redistribute it and/or modify | |
- * it under the terms of the GNU General Public License as published by | |
- * the Free Software Foundation, either version 3 of the License, or | |
- * (at your option) any later version. | |
- * | |
- * This program is distributed in the hope that it will be useful, | |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
- * GNU General Public License for more details. | |
- * | |
- * You should have received a copy of the GNU General Public License | |
- * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
- */ | |
- | |
-#ifndef TIMEOUTRESET_H | |
-#define TIMEOUTRESET_H | |
- | |
-#include <QObject> | |
-#include <QThread> | |
-#include <iostream> | |
-#include "boxitsocket.h" | |
-#include "const.h" | |
- | |
-using namespace std; | |
- | |
- | |
-class TimeOutReset : public QThread | |
-{ | |
- Q_OBJECT | |
-public: | |
- explicit TimeOutReset(BoxitSocket *socket, QObject *parent = 0); | |
- ~TimeOutReset(); | |
- void stop(); | |
- void run(); | |
- | |
-private: | |
- BoxitSocket *socket; | |
- | |
-}; | |
- | |
-#endif // TIMEOUTRESET_H |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment