651 lines
24 KiB
Diff
651 lines
24 KiB
Diff
diff -Naur -x '.git*' clipgrab-main/clipgrab.cpp clipgrab-qt5/clipgrab.cpp
|
|
--- clipgrab-main/clipgrab.cpp 2018-10-10 11:45:58.383957000 +0200
|
|
+++ clipgrab-qt5/clipgrab.cpp 2018-10-10 09:41:24.146033000 +0200
|
|
@@ -23,6 +23,13 @@
|
|
|
|
#include "clipgrab.h"
|
|
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
+#include <QMessageBox>
|
|
+#else
|
|
+#include <QtWidgets/QMessageBox>
|
|
+#include <QUrlQuery>
|
|
+#endif
|
|
+
|
|
ClipGrab::ClipGrab()
|
|
{
|
|
//*
|
|
@@ -286,16 +293,25 @@
|
|
|
|
QString firstStarted = settings.value("firstStarted", "").toString();
|
|
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
QUrl updateInfoRequestUrl("https://clipgrab.org/update/" + sys + "/");
|
|
+#else
|
|
+ QUrlQuery updateInfoRequestUrl("https://clipgrab.org/update/" + sys + "/");
|
|
+#endif
|
|
updateInfoRequestUrl.addQueryItem("v", this->version);
|
|
updateInfoRequestUrl.addQueryItem("l", QLocale::system().name().split("_")[0]);
|
|
if (!firstStarted.isEmpty())
|
|
{
|
|
updateInfoRequestUrl.addQueryItem("t", firstStarted);
|
|
}
|
|
-
|
|
QNetworkRequest updateInfoRequest;
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
updateInfoRequest.setUrl(updateInfoRequestUrl);
|
|
+#else
|
|
+ QUrl url;
|
|
+ url.setQuery(updateInfoRequestUrl);
|
|
+ updateInfoRequest.setUrl(url);
|
|
+#endif
|
|
QNetworkAccessManager* updateInfoNAM = new QNetworkAccessManager;
|
|
updateInfoNAM->get(updateInfoRequest);
|
|
connect(updateInfoNAM, SIGNAL(finished(QNetworkReply*)), this, SLOT(parseUpdateInfo(QNetworkReply*)));
|
|
diff -Naur -x '.git*' clipgrab-main/clipgrab.h clipgrab-qt5/clipgrab.h
|
|
--- clipgrab-main/clipgrab.h 2018-10-10 11:45:58.384140000 +0200
|
|
+++ clipgrab-qt5/clipgrab.h 2018-10-10 09:41:24.146276000 +0200
|
|
@@ -29,6 +29,10 @@
|
|
#include <QtXml>
|
|
#include <QtDebug>
|
|
|
|
+#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
|
+#include <QtWidgets/QSystemTrayIcon>
|
|
+#endif
|
|
+
|
|
#include "video.h"
|
|
#include "video_youtube.h"
|
|
#include "video_vimeo.h"
|
|
diff -Naur -x '.git*' clipgrab-main/clipgrab.pro clipgrab-qt5/clipgrab.pro
|
|
--- clipgrab-main/clipgrab.pro 2018-10-10 11:47:49.068510000 +0200
|
|
+++ clipgrab-qt5/clipgrab.pro 2018-10-10 11:47:00.926979000 +0200
|
|
@@ -1,16 +1,24 @@
|
|
# #####################################################################
|
|
# Automatically generated by qmake (2.01a) Mo 26. Okt 18:26:00 2009
|
|
# #####################################################################
|
|
+CONFIG += debug_and_release
|
|
TEMPLATE = app
|
|
-TARGET = clipgrab
|
|
-DEPENDPATH += . \
|
|
- release
|
|
-INCLUDEPATH += .
|
|
+QT += core
|
|
+QT += gui
|
|
QT += network
|
|
-QT += webkit
|
|
QT += xml
|
|
-
|
|
+lessThan(QT_MAJOR_VERSION, 5) {
|
|
+ QT += webkit
|
|
+} else {
|
|
+ QT += webkitwidgets
|
|
+}
|
|
+INCLUDEPATH += .
|
|
# Input
|
|
+FORMS += mainwindow.ui \
|
|
+ metadata-dialog.ui \
|
|
+ update_message.ui \
|
|
+ message_dialog.ui \
|
|
+ login_dialog.ui
|
|
HEADERS += clipgrab.h \
|
|
converter.h \
|
|
converter_copy.h \
|
|
@@ -26,11 +34,6 @@
|
|
http_handler.h \
|
|
notifications.h \
|
|
message_dialog.h
|
|
-FORMS += mainwindow.ui \
|
|
- metadata-dialog.ui \
|
|
- update_message.ui \
|
|
- message_dialog.ui \
|
|
- login_dialog.ui
|
|
SOURCES += clipgrab.cpp \
|
|
converter.cpp \
|
|
converter_copy.cpp \
|
|
@@ -79,6 +82,7 @@
|
|
clipgrab_vi.ts \
|
|
clipgrab_zh.ts \
|
|
clipgrab_strings.ts
|
|
+TARGET = clipgrab
|
|
CODECFORTR = UTF-8
|
|
win32:RC_FILE = windows_icon.rc
|
|
macx {
|
|
diff -Naur -x '.git*' clipgrab-main/http_handler.cpp clipgrab-qt5/http_handler.cpp
|
|
--- clipgrab-main/http_handler.cpp 2018-10-10 11:45:58.384600000 +0200
|
|
+++ clipgrab-qt5/http_handler.cpp 2018-06-05 15:47:16.000000000 +0200
|
|
@@ -45,14 +45,22 @@
|
|
QNetworkReply* http_handler::addDownload(QString url, bool chunked, QByteArray postData, QStringList segments)
|
|
{
|
|
download* newDownload = new download;
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
QNetworkRequest request = createRequest(QUrl::fromEncoded(url.toAscii()));
|
|
+#else
|
|
+ QNetworkRequest request = createRequest(QUrl::fromEncoded(url.toLatin1()));
|
|
+#endif
|
|
newDownload->tempFile = new QTemporaryFile(QDir::tempPath() + "/clipgrab-download-XXXXXX");
|
|
newDownload->size = 0;
|
|
newDownload->redirectLevel = 0;
|
|
newDownload->chunked = chunked;
|
|
if (newDownload->chunked)
|
|
{
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
request.setRawHeader("Range", QString("bytes=0-1397760").toAscii());
|
|
+#else
|
|
+ request.setRawHeader("Range", QString("bytes=0-1397760").toLatin1());
|
|
+#endif
|
|
}
|
|
if (!segments.isEmpty())
|
|
{
|
|
@@ -121,7 +129,11 @@
|
|
//If more parts need to be downloaded
|
|
else
|
|
{
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
request.setRawHeader("Range", QString("bytes=" + QString::number(dl->getProgress()) + "-" + QString::number(targetBytes)).toAscii());
|
|
+#else
|
|
+ request.setRawHeader("Range", QString("bytes=" + QString::number(dl->getProgress()) + "-" + QString::number(targetBytes)).toLatin1());
|
|
+#endif
|
|
}
|
|
}
|
|
|
|
@@ -133,7 +145,11 @@
|
|
dl->currentProgress = 0;
|
|
dl->redirectLevel = 0;
|
|
qint64 targetBytes = dl->size;
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
request.setRawHeader("Range", QString("bytes=" + QString::number(dl->getProgress()) + "-" + QString::number(targetBytes)).toAscii());
|
|
+#else
|
|
+ request.setRawHeader("Range", QString("bytes=" + QString::number(dl->getProgress()) + "-" + QString::number(targetBytes)).toLatin1());
|
|
+#endif
|
|
}
|
|
|
|
|
|
@@ -227,7 +243,11 @@
|
|
|
|
dl->redirectLevel = 0;
|
|
dl->segmentPosition++;
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
QNetworkRequest request = createRequest(QUrl::fromEncoded(dl->segments.at(dl->segmentPosition).toAscii()));
|
|
+#else
|
|
+ QNetworkRequest request = createRequest(QUrl::fromEncoded(dl->segments.at(dl->segmentPosition).toLatin1()));
|
|
+#endif
|
|
dl->progress = dl->getProgress();
|
|
dl->currentProgress = 0;
|
|
dl->reply = this->networkAccessManager->get(request);
|
|
@@ -381,8 +401,16 @@
|
|
QList<QNetworkCookie> cookies;
|
|
for (int i = 0; i < serializedCookies.length(); i++)
|
|
{
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
QString cookieString = QUrl::fromPercentEncoding(serializedCookies.at(i).toAscii());
|
|
+#else
|
|
+ QString cookieString = QUrl::fromPercentEncoding(serializedCookies.at(i).toLatin1());
|
|
+#endif
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
QList<QNetworkCookie> parsedCookies = QNetworkCookie::parseCookies(cookieString.toAscii());
|
|
+#else
|
|
+ QList<QNetworkCookie> parsedCookies = QNetworkCookie::parseCookies(cookieString.toLatin1());
|
|
+#endif
|
|
for (int j = 0; j < parsedCookies.length(); j++)
|
|
{
|
|
cookies.append(parsedCookies.at(j));
|
|
diff -Naur -x '.git*' clipgrab-main/main.cpp clipgrab-qt5/main.cpp
|
|
--- clipgrab-main/main.cpp 2018-10-10 11:45:58.384773000 +0200
|
|
+++ clipgrab-qt5/main.cpp 2018-06-05 15:47:16.000000000 +0200
|
|
@@ -19,9 +19,14 @@
|
|
along with ClipGrab. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
-
|
|
-
|
|
+#include <qglobal.h>
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
#include <QtGui/QApplication>
|
|
+#include <QSplashScreen>
|
|
+#else
|
|
+#include <QtWidgets/QApplication>
|
|
+#include <QtWidgets/QSplashScreen>
|
|
+#endif
|
|
#include <QTranslator>
|
|
#include "mainwindow.h"
|
|
#include "clipgrab.h"
|
|
@@ -39,8 +44,8 @@
|
|
QCoreApplication::setApplicationName("ClipGrab");
|
|
QCoreApplication::setApplicationVersion(QString(STRINGIZE_VALUE_OF(CLIPGRAB_VERSION)).replace("\"", ""));
|
|
QSplashScreen splash(QPixmap(":/img/splash.png"), Qt::FramelessWindowHint);
|
|
- QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
|
|
- QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
|
|
+// QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
|
|
+// QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
|
|
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
|
|
|
|
splash.setMask(QPixmap(":/img/splash.png").mask());
|
|
@@ -69,10 +74,22 @@
|
|
}
|
|
|
|
MainWindow w;
|
|
+ splash.finish(&w);
|
|
w.cg = &cg;
|
|
w.init();
|
|
- w.show();
|
|
- splash.finish(w.centralWidget());
|
|
+ if ("" != settings.value("x", ""))
|
|
+ {
|
|
+ w.move(settings.value("x").toInt(), settings.value("y").toInt());
|
|
+ w.resize(settings.value("width").toInt(), settings.value("height").toInt());
|
|
+ }
|
|
+ if (settings.value("isMaximized", false).toBool())
|
|
+ {
|
|
+ w.showMaximized();
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ w.show();
|
|
+ }
|
|
cg.getUpdateInfo();
|
|
return app.exec();
|
|
}
|
|
diff -Naur -x '.git*' clipgrab-main/mainwindow.cpp clipgrab-qt5/mainwindow.cpp
|
|
--- clipgrab-main/mainwindow.cpp 2018-10-10 11:45:58.385273000 +0200
|
|
+++ clipgrab-qt5/mainwindow.cpp 2018-10-10 09:41:24.147874000 +0200
|
|
@@ -23,7 +23,23 @@
|
|
|
|
#include "mainwindow.h"
|
|
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
+#include <QSystemTrayIcon>
|
|
+#include <QShortcut>
|
|
+#include <QFileDialog>
|
|
+#include <QMessageBox>
|
|
+#else
|
|
+#include <QtWidgets/QSystemTrayIcon>
|
|
+#include <QtWidgets/QShortcut>
|
|
+#include <QtWidgets/QFileDialog>
|
|
+#include <QtWidgets/QMessageBox>
|
|
+#endif
|
|
+
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
MainWindow::MainWindow(QWidget *parent, Qt::WFlags flags)
|
|
+#else
|
|
+MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags flags)
|
|
+#endif
|
|
: QMainWindow(parent, flags)
|
|
{
|
|
ui.setupUi(this);
|
|
@@ -34,6 +50,14 @@
|
|
|
|
MainWindow::~MainWindow()
|
|
{
|
|
+ QSettings settings;
|
|
+ settings.setValue("isMaximized", isMaximized());
|
|
+ if (!isMaximized()) { // the position and size is only valid if not maximized
|
|
+ settings.setValue("x", x());
|
|
+ settings.setValue("y", y());
|
|
+ settings.setValue("width", width());
|
|
+ settings.setValue("height", height());
|
|
+ }
|
|
}
|
|
|
|
void MainWindow::init()
|
|
@@ -64,9 +88,14 @@
|
|
connect(ui.downloadLineEdit, SIGNAL(textChanged(QString)), cg, SLOT(determinePortal(QString)));
|
|
connect(this, SIGNAL(itemToRemove(int)), cg, SLOT(removeDownload(int)));
|
|
//connect(ui.downloadTree, SIGNAL(doubleClicked(QModelIndex)), this, openFinishedVideo(QModelIndex));
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
ui.downloadTree->header()->setResizeMode(1, QHeaderView::Stretch);
|
|
- ui.downloadTree->header()->setStretchLastSection(false);
|
|
ui.downloadTree->header()->setResizeMode(3, QHeaderView::ResizeToContents);
|
|
+#else
|
|
+ ui.downloadTree->header()->setSectionResizeMode(1, QHeaderView::Stretch);
|
|
+ ui.downloadTree->header()->setSectionResizeMode(3, QHeaderView::ResizeToContents);
|
|
+#endif
|
|
+ ui.downloadTree->header()->setStretchLastSection(false);
|
|
ui.downloadLineEdit->setFocus(Qt::OtherFocusReason);
|
|
|
|
int lastFormat = cg->settings.value("LastFormat", 0).toInt();
|
|
@@ -100,7 +129,11 @@
|
|
connect(this->ui.settingsRadioNotificationsNever, SIGNAL(toggled(bool)), this, SLOT(settingsNotifications_toggled(bool)));
|
|
|
|
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
this->ui.settingsSavedPath->setText(cg->settings.value("savedPath", QDesktopServices::storageLocation(QDesktopServices::DesktopLocation)).toString());
|
|
+#else
|
|
+ this->ui.settingsSavedPath->setText(cg->settings.value("savedPath", QStandardPaths::standardLocations(QStandardPaths::DesktopLocation)).toString());
|
|
+#endif
|
|
this->ui.settingsSaveLastPath->setChecked(cg->settings.value("saveLastPath", true).toBool());
|
|
ui.settingsNeverAskForPath->setChecked(cg->settings.value("NeverAskForPath", false).toBool());
|
|
|
|
@@ -239,7 +272,11 @@
|
|
|
|
void MainWindow::startDownload()
|
|
{
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
QString targetDirectory = cg->settings.value("savedPath", QDesktopServices::storageLocation(QDesktopServices::DesktopLocation)).toString();
|
|
+#else
|
|
+ QString targetDirectory = cg->settings.value("savedPath", QStandardPaths::standardLocations(QStandardPaths::DesktopLocation)).toString();
|
|
+#endif
|
|
QString fileName = currentVideo->getSaveTitle();
|
|
|
|
if (cg->settings.value("NeverAskForPath", false).toBool() == false)
|
|
@@ -566,6 +603,7 @@
|
|
if (exitBox->exec() == QMessageBox::Yes)
|
|
{
|
|
cg->cancelAll();
|
|
+ systemTrayIcon.hide();
|
|
event->accept();
|
|
}
|
|
else
|
|
@@ -575,6 +613,7 @@
|
|
}
|
|
else
|
|
{
|
|
+ systemTrayIcon.hide();
|
|
event->accept();;
|
|
}
|
|
}
|
|
@@ -668,9 +707,17 @@
|
|
if (downloadProgress.first != 0 && downloadProgress.second != 0)
|
|
{
|
|
#ifdef Q_WS_X11
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
systemTrayIcon.setToolTip("<strong style=\"font-size:14px\">" + tr("ClipGrab") + "</strong><br /><span style=\"font-size:13px\">" + QString::number(downloadProgress.first*100/downloadProgress.second) + " %</span><br />" + QString::number((double)downloadProgress.first/1024/1024, QLocale::system().decimalPoint().toAscii(), 1) + tr(" MiB") + "/" + QString::number((double)downloadProgress.second/1024/1024, QLocale::system().decimalPoint().toAscii(), 1) + tr(" MiB"));
|
|
+#else
|
|
+ systemTrayIcon.setToolTip("<strong style=\"font-size:14px\">" + tr("ClipGrab") + "</strong><br /><span style=\"font-size:13px\">" + QString::number(downloadProgress.first*100/downloadProgress.second) + " %</span><br />" + QString::number((double)downloadProgress.first/1024/1024, QLocale::system().decimalPoint().toLatin1(), 1) + tr(" MiB") + "/" + QString::number((double)downloadProgress.second/1024/1024, QLocale::system().decimalPoint().toLatin1(), 1) + tr(" MiB"));
|
|
+#endif
|
|
#else
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
systemTrayIcon.setToolTip(tr("ClipGrab") + " - " + QString::number(downloadProgress.first*100/downloadProgress.second) + " % - " + QString::number((double)downloadProgress.first/1024/1024, QLocale::system().decimalPoint().toAscii(), 1) + tr(" MiB") + "/" + QString::number((double)downloadProgress.second/1024/1024, QLocale::system().decimalPoint().toAscii(), 1) + tr(" KiB"));
|
|
+#else
|
|
+ systemTrayIcon.setToolTip(tr("ClipGrab") + " - " + QString::number(downloadProgress.first*100/downloadProgress.second) + " % - " + QString::number((double)downloadProgress.first/1024/1024, QLocale::system().decimalPoint().toLatin1(), 1) + tr(" MiB") + "/" + QString::number((double)downloadProgress.second/1024/1024, QLocale::system().decimalPoint().toLatin1(), 1) + tr(" KiB"));
|
|
+#endif
|
|
#endif
|
|
setWindowTitle("ClipGrab - " + QString::number(downloadProgress.first*100/downloadProgress.second) + " %");
|
|
}
|
|
diff -Naur -x '.git*' clipgrab-main/mainwindow.h clipgrab-qt5/mainwindow.h
|
|
--- clipgrab-main/mainwindow.h 2018-10-10 11:45:58.385468000 +0200
|
|
+++ clipgrab-qt5/mainwindow.h 2018-10-10 09:41:24.148113000 +0200
|
|
@@ -24,10 +24,14 @@
|
|
#ifndef MAINWINDOW_H
|
|
#define MAINWINDOW_H
|
|
|
|
-#include <QtGui/QMainWindow>
|
|
#include <QSignalMapper>
|
|
#include <QtXml>
|
|
#include <QUrl>
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
+#include <QMainWindow>
|
|
+#else
|
|
+#include <QtWidgets/QMainWindow>
|
|
+#endif
|
|
#include "ui_mainwindow.h"
|
|
#include "ui_metadata-dialog.h"
|
|
#include "clipgrab.h"
|
|
@@ -43,7 +47,11 @@
|
|
Q_OBJECT
|
|
|
|
public:
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
MainWindow(QWidget *parent = 0, Qt::WFlags flags = 0);
|
|
+#else
|
|
+ MainWindow(QWidget *parent = 0, Qt::WindowFlags flags = 0);
|
|
+#endif
|
|
~MainWindow();
|
|
void init();
|
|
|
|
diff -Naur -x '.git*' clipgrab-main/message_dialog.h clipgrab-qt5/message_dialog.h
|
|
--- clipgrab-main/message_dialog.h 2018-10-10 11:45:58.385612000 +0200
|
|
+++ clipgrab-qt5/message_dialog.h 2018-06-05 15:47:16.000000000 +0200
|
|
@@ -1,9 +1,14 @@
|
|
#ifndef MESSAGE_DIALOG_H
|
|
#define MESSAGE_DIALOG_H
|
|
|
|
+#include <QtGui/QDesktopServices>
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
#include <QDialog>
|
|
#include <QWebPage>
|
|
-#include <QDesktopServices>
|
|
+#else
|
|
+#include <QtWidgets/QDialog>
|
|
+#include <QtWebKitWidgets/QWebPage>
|
|
+#endif
|
|
|
|
namespace Ui {
|
|
class messageDialog;
|
|
diff -Naur -x '.git*' clipgrab-main/notifications.h clipgrab-qt5/notifications.h
|
|
--- clipgrab-main/notifications.h 2018-10-10 11:45:58.385983000 +0200
|
|
+++ clipgrab-qt5/notifications.h 2018-06-05 15:47:16.000000000 +0200
|
|
@@ -25,6 +25,11 @@
|
|
#define FOO_H
|
|
|
|
#include <QtGui>
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
+#include <QSystemTrayIcon>
|
|
+#else
|
|
+#include <QtWidgets/QSystemTrayIcon>
|
|
+#endif
|
|
|
|
#ifdef Q_WS_MAC64
|
|
#include "notifications_mac.h"
|
|
diff -Naur -x '.git*' clipgrab-main/video_dailymotion.cpp clipgrab-qt5/video_dailymotion.cpp
|
|
--- clipgrab-main/video_dailymotion.cpp 2018-10-10 11:47:49.068974000 +0200
|
|
+++ clipgrab-qt5/video_dailymotion.cpp 2018-10-10 11:47:00.927165000 +0200
|
|
@@ -22,6 +22,9 @@
|
|
|
|
|
|
#include "video_dailymotion.h"
|
|
+#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
|
+ #include <QtWebKitWidgets/QtWebKitWidgets>
|
|
+#endif
|
|
|
|
video_dailymotion::video_dailymotion()
|
|
{
|
|
diff -Naur -x '.git*' clipgrab-main/video_dailymotion.h clipgrab-qt5/video_dailymotion.h
|
|
--- clipgrab-main/video_dailymotion.h 2018-10-10 11:47:49.069372000 +0200
|
|
+++ clipgrab-qt5/video_dailymotion.h 2018-10-10 11:47:00.927336000 +0200
|
|
@@ -23,8 +23,9 @@
|
|
|
|
#ifndef VIDEO_DAILYMOTION_H
|
|
#define VIDEO_DAILYMOTION_H
|
|
+
|
|
+#include <QtWebKit/QtWebKit>
|
|
#include "video.h"
|
|
-#include "QtWebKit"
|
|
|
|
struct dailymotion_quality
|
|
{
|
|
diff -Naur -x '.git*' clipgrab-main/video_facebook.cpp clipgrab-qt5/video_facebook.cpp
|
|
--- clipgrab-main/video_facebook.cpp 2018-10-10 11:45:58.387121000 +0200
|
|
+++ clipgrab-qt5/video_facebook.cpp 2018-10-10 09:41:24.148378000 +0200
|
|
@@ -22,6 +22,10 @@
|
|
|
|
|
|
#include "video_facebook.h"
|
|
+#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
|
+ #include <QtWebKitWidgets/QtWebKitWidgets>
|
|
+ #include <QUrlQuery>
|
|
+#endif
|
|
|
|
video_facebook::video_facebook()
|
|
{
|
|
@@ -152,6 +156,7 @@
|
|
|
|
QString playerLink = "https://www.facebook.com/video/tahoe/async/" + videoIDRegExp.cap(1) + "/?payloadtype=primary";
|
|
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
QUrl postData;
|
|
postData.addQueryItem("__a", "1");
|
|
postData.addQueryItem("__user", userID);
|
|
@@ -159,6 +164,15 @@
|
|
|
|
qDebug() << "Downloading player ..." << playerLink << postData.encodedQuery();
|
|
handler->addDownload(playerLink, false, postData.encodedQuery());
|
|
+#else
|
|
+ QUrlQuery postData;
|
|
+ postData.addQueryItem("__a", "1");
|
|
+ postData.addQueryItem("__user", userID);
|
|
+ postData.addQueryItem("fb_dtsg", dtsg);
|
|
+
|
|
+ qDebug() << "Downloading player ..." << playerLink << postData.query(QUrl::FullyEncoded).toUtf8();
|
|
+ handler->addDownload(playerLink, false, postData.query(QUrl::FullyEncoded).toUtf8());
|
|
+#endif
|
|
return;
|
|
}
|
|
|
|
diff -Naur -x '.git*' clipgrab-main/video_facebook.h clipgrab-qt5/video_facebook.h
|
|
--- clipgrab-main/video_facebook.h 2018-10-10 11:45:58.387308000 +0200
|
|
+++ clipgrab-qt5/video_facebook.h 2018-06-05 15:47:16.000000000 +0200
|
|
@@ -24,9 +24,9 @@
|
|
#ifndef VIDEO_FACEBOOK_H
|
|
#define VIDEO_FACEBOOK_H
|
|
|
|
+#include <QtWebKit/QtWebKit>
|
|
#include "video.h"
|
|
#include "ui_login_dialog.h"
|
|
-#include "QtWebKit"
|
|
|
|
class video_facebook : public video
|
|
{
|
|
diff -Naur -x '.git*' clipgrab-main/video_heuristic.cpp clipgrab-qt5/video_heuristic.cpp
|
|
--- clipgrab-main/video_heuristic.cpp 2018-10-10 11:45:58.387486000 +0200
|
|
+++ clipgrab-qt5/video_heuristic.cpp 2018-06-05 15:47:16.000000000 +0200
|
|
@@ -124,7 +124,11 @@
|
|
{
|
|
videoQuality newQuality;
|
|
newQuality.containerName = expression.cap(2).prepend(".");
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
newQuality.videoUrl = QUrl::fromPercentEncoding(expression.cap(1).toAscii());
|
|
+#else
|
|
+ newQuality.videoUrl = QUrl::fromPercentEncoding(expression.cap(1).toLatin1());
|
|
+#endif
|
|
newQuality.quality = tr("normal");
|
|
_supportedQualities.append(newQuality);
|
|
emit analysingFinished();
|
|
@@ -138,7 +142,11 @@
|
|
{
|
|
videoQuality newQuality;
|
|
newQuality.containerName = expression.cap(2).prepend(".");
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
newQuality.videoUrl = QUrl::fromPercentEncoding(expression.cap(1).toAscii());
|
|
+#else
|
|
+ newQuality.videoUrl = QUrl::fromPercentEncoding(expression.cap(1).toLatin1());
|
|
+#endif
|
|
newQuality.quality = tr("normal");
|
|
_supportedQualities.append(newQuality);
|
|
emit analysingFinished();
|
|
diff -Naur -x '.git*' clipgrab-main/video_vimeo.h clipgrab-qt5/video_vimeo.h
|
|
--- clipgrab-main/video_vimeo.h 2018-10-10 11:45:58.387671000 +0200
|
|
+++ clipgrab-qt5/video_vimeo.h 2018-06-05 15:47:16.000000000 +0200
|
|
@@ -24,10 +24,15 @@
|
|
#ifndef video_vimeo_H
|
|
#define video_vimeo_H
|
|
|
|
+#include <qglobal.h>
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
+#include <QWebPage>
|
|
+#include <QWebFrame>
|
|
+#include <QWebElement>
|
|
+#else
|
|
+#include <QtWebKitWidgets/QtWebKitWidgets>
|
|
+#endif
|
|
#include "video.h"
|
|
-#include "QWebPage"
|
|
-#include "QWebFrame"
|
|
-#include "QWebElement"
|
|
#include "ui_login_dialog.h"
|
|
|
|
class video_vimeo : public video
|
|
diff -Naur -x '.git*' clipgrab-main/video_youtube.cpp clipgrab-qt5/video_youtube.cpp
|
|
--- clipgrab-main/video_youtube.cpp 2018-10-10 11:47:49.070132000 +0200
|
|
+++ clipgrab-qt5/video_youtube.cpp 2018-10-10 11:47:00.927690000 +0200
|
|
@@ -22,7 +22,11 @@
|
|
|
|
|
|
#include "video_youtube.h"
|
|
+
|
|
#include "QMutableListIterator"
|
|
+#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
|
+ #include <QtWebKitWidgets/QtWebKitWidgets>
|
|
+#endif
|
|
|
|
video_youtube::video_youtube()
|
|
{
|
|
@@ -103,7 +107,11 @@
|
|
|
|
if (urlExpression.indexIn(link) > -1)
|
|
{
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
QString url = QUrl::fromEncoded(QUrl::fromEncoded(urlExpression.cap(1).toAscii()).toString().toAscii()).toString();
|
|
+#else
|
|
+ QString url = QUrl::fromPercentEncoding(QUrl::fromPercentEncoding(urlExpression.cap(1).toUtf8()).toUtf8());
|
|
+#endif
|
|
|
|
QRegExp sigExpression;
|
|
sigExpression = QRegExp("(?:^|[^a-zA-Z])[,]?s(ig)?=([^,]+)");
|
|
@@ -674,7 +682,11 @@
|
|
{
|
|
videoQuality newQuality;
|
|
newQuality.quality = tr("normal");
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
newQuality.videoUrl = QUrl::fromEncoded(QString("http://www.youtube.com/get_video?video_id=" + expression2.cap(1) + "&t=" + expression.cap(1)).toAscii()).toString(QUrl::None);
|
|
+#else
|
|
+ newQuality.videoUrl = QUrl::fromEncoded(QString("http://www.youtube.com/get_video?video_id=" + expression2.cap(1) + "&t=" + expression.cap(1)).toLatin1()).toString(QUrl::None);
|
|
+#endif
|
|
_supportedQualities.append(newQuality);
|
|
}
|
|
else
|
|
diff -Naur -x '.git*' clipgrab-main/video_youtube.h clipgrab-qt5/video_youtube.h
|
|
--- clipgrab-main/video_youtube.h 2018-10-10 11:45:58.388234000 +0200
|
|
+++ clipgrab-qt5/video_youtube.h 2018-10-10 09:41:24.149013000 +0200
|
|
@@ -24,13 +24,17 @@
|
|
#ifndef video_YOUTUBE_H
|
|
#define video_YOUTUBE_H
|
|
|
|
-#include "video.h"
|
|
-#include "QtWebKit"
|
|
+#include <qglobal.h>
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
+#include <QtWebKit>
|
|
+#else
|
|
+#include <QtWebKit/QtWebKit>
|
|
+#endif
|
|
#include <QtGui>
|
|
-#include "QDomDocument"
|
|
+#include <QFile>
|
|
+#include <QDomDocument>
|
|
#include "ui_login_dialog.h"
|
|
-
|
|
-#include "QFile"
|
|
+#include "video.h"
|
|
|
|
struct fmtQuality
|
|
{
|
|
diff -Naur -x '.git*' clipgrab-main/video.cpp clipgrab-qt5/video.cpp
|
|
--- clipgrab-main/video.cpp 2018-10-10 11:45:58.386216000 +0200
|
|
+++ clipgrab-qt5/video.cpp 2018-06-05 15:47:16.000000000 +0200
|
|
@@ -195,7 +195,11 @@
|
|
this->_progressBar->setFormat("%p%");
|
|
this->_progressBar->setMaximum(bytesTotal);
|
|
this->_progressBar->setValue(bytesReceived);
|
|
+#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
|
|
setToolTip("<strong>" + tr("Downloading ...") + "</strong><br />" + QString::number((double)(bytesReceived)/1024/1024, QLocale::system().decimalPoint().toAscii(), 1) + tr(" MiB") + "/" + QString::number((double)bytesTotal/1024/1024, QLocale::system().decimalPoint().toAscii(), 1) + tr(" MiB"));
|
|
+#else
|
|
+ setToolTip("<strong>" + tr("Downloading ...") + "</strong><br />" + QString::number((double)(bytesReceived)/1024/1024, QLocale::system().decimalPoint().toLatin1(), 1) + tr(" MiB") + "/" + QString::number((double)bytesTotal/1024/1024, QLocale::system().decimalPoint().toLatin1(), 1) + tr(" MiB"));
|
|
+#endif
|
|
}
|
|
}
|
|
else
|
|
diff -Naur -x '.git*' clipgrab-main/video.h clipgrab-qt5/video.h
|
|
--- clipgrab-main/video.h 2018-10-10 11:45:58.386404000 +0200
|
|
+++ clipgrab-qt5/video.h 2018-06-05 15:47:16.000000000 +0200
|
|
@@ -26,6 +26,10 @@
|
|
|
|
#include <QtGui>
|
|
#include <QtNetwork>
|
|
+#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
|
+#include <QtWidgets/QTreeWidgetItem>
|
|
+#include <QtWidgets/QProgressBar>
|
|
+#endif
|
|
#include "converter.h"
|
|
#include "converter_ffmpeg.h"
|
|
#include "http_handler.h"
|
|
|