remove_unfree_recommendations.patch 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. diff --git a/minitube.pro b/minitube.pro
  2. index e75a41d..e3dbcb1 100644
  3. --- a/minitube.pro
  4. +++ b/minitube.pro
  5. @@ -117,7 +117,6 @@ HEADERS += src/video.h \
  6. src/searchwidget.h \
  7. src/channellistview.h \
  8. src/httputils.h \
  9. - src/appwidget.h \
  10. src/clickablelabel.h \
  11. src/ytvideo.h \
  12. src/toolbarmenu.h \
  13. @@ -192,7 +191,6 @@ SOURCES += src/main.cpp \
  14. src/paginatedvideosource.cpp \
  15. src/channellistview.cpp \
  16. src/httputils.cpp \
  17. - src/appwidget.cpp \
  18. src/clickablelabel.cpp \
  19. src/ytvideo.cpp \
  20. src/toolbarmenu.cpp \
  21. diff --git a/src/aboutview.cpp b/src/aboutview.cpp
  22. index 48b7dff..19140a8 100644
  23. --- a/src/aboutview.cpp
  24. +++ b/src/aboutview.cpp
  25. @@ -30,7 +30,6 @@ $END_LICENSE */
  26. #include "mac_startup.h"
  27. #include "macutils.h"
  28. #endif
  29. -#include "appwidget.h"
  30. #include "clickablelabel.h"
  31. #include "fontutils.h"
  32. #include "iconutils.h"
  33. @@ -197,8 +196,6 @@ AboutView::AboutView(QWidget *parent) : View(parent) {
  34. buttonLayout->addWidget(closeButton);
  35. layout->addLayout(buttonLayout);
  36. -
  37. - verticalLayout->addWidget(new AppsWidget());
  38. }
  39. void AboutView::appear() {
  40. diff --git a/src/appwidget.cpp b/src/appwidget.cpp
  41. deleted file mode 100644
  42. index 3c67e28..0000000
  43. --- a/src/appwidget.cpp
  44. +++ /dev/null
  45. @@ -1,120 +0,0 @@
  46. -#include "appwidget.h"
  47. -#include "constants.h"
  48. -#include "http.h"
  49. -#ifdef APP_EXTRA
  50. -#include "updatedialog.h"
  51. -#endif
  52. -
  53. -AppsWidget::AppsWidget(QWidget *parent) : QWidget(parent) {
  54. - const int padding = 30;
  55. -
  56. - QBoxLayout *layout = new QHBoxLayout(this);
  57. - layout->setMargin(padding);
  58. - layout->setSpacing(padding*2);
  59. - layout->setAlignment(Qt::AlignCenter);
  60. -
  61. -#ifdef APP_MAC
  62. - const QString ext = "dmg";
  63. -#elif defined APP_WIN
  64. - const QString ext = "exe";
  65. -#else
  66. - const QString ext = "deb";
  67. -#endif
  68. -
  69. -#ifdef APP_MAC
  70. - setupApp("Sofa", "sofa." + ext);
  71. -#endif
  72. - setupApp("Finetune", "finetune." + ext);
  73. - setupApp("Musictube", "musictube." + ext);
  74. - setupApp("Musique", "musique." + ext);
  75. -}
  76. -
  77. -void AppsWidget::setupApp(const QString &name, const QString &code) {
  78. - AppWidget *w = new AppWidget(name, code);
  79. - layout()->addWidget(w);
  80. -}
  81. -
  82. -void AppsWidget::paintEvent(QPaintEvent *e) {
  83. - Q_UNUSED(e);
  84. - QStyleOption o;
  85. - o.initFrom(this);
  86. - QPainter p(this);
  87. - style()->drawPrimitive(QStyle::PE_Widget, &o, &p, this);
  88. -}
  89. -
  90. -AppWidget::AppWidget(const QString &name, const QString &code, QWidget *parent)
  91. - : QWidget(parent), name(name), downloadButton(nullptr) {
  92. - const QString unixName = code.left(code.lastIndexOf('.'));
  93. - const QString baseUrl = QLatin1String("https://") + Constants::ORG_DOMAIN;
  94. - const QString filesUrl = baseUrl + QLatin1String("/files/");
  95. - url = filesUrl + unixName + QLatin1String("/") + code;
  96. - webPage = baseUrl + QLatin1String("/") + unixName;
  97. -
  98. - QBoxLayout *layout = new QVBoxLayout(this);
  99. - layout->setMargin(0);
  100. - layout->setAlignment(Qt::AlignHCenter);
  101. -
  102. - icon = new QLabel();
  103. - icon->setMinimumHeight(128);
  104. - layout->addWidget(icon);
  105. - QString pixelRatioString;
  106. - if (devicePixelRatioF() > 1.0)
  107. - pixelRatioString = '@' + QString::number(devicePixelRatio()) + 'x';
  108. - const QString iconUrl = filesUrl + QLatin1String("products/") + unixName + pixelRatioString +
  109. - QLatin1String(".png");
  110. - QObject *reply = Http::instance().get(iconUrl);
  111. - connect(reply, SIGNAL(data(QByteArray)), SLOT(iconDownloaded(QByteArray)));
  112. -
  113. - QLabel *appTitle = new QLabel(name);
  114. - appTitle->setAlignment(Qt::AlignHCenter);
  115. - layout->addWidget(appTitle);
  116. -
  117. -#ifdef APP_EXTRA
  118. -#if !defined(APP_UBUNTU) && !defined(APP_MAC_STORE)
  119. - downloadButton = new QPushButton(tr("Download"));
  120. - downloadButton->setAttribute(Qt::WA_MacSmallSize);
  121. - downloadButton->setCursor(Qt::ArrowCursor);
  122. - QSizePolicy sp = downloadButton->sizePolicy();
  123. - sp.setHorizontalPolicy(QSizePolicy::Fixed);
  124. - sp.setRetainSizeWhenHidden(true);
  125. - downloadButton->setSizePolicy(sp);
  126. - connect(downloadButton, SIGNAL(clicked(bool)), SLOT(downloadApp()));
  127. - layout->addWidget(downloadButton, Qt::AlignHCenter);
  128. - layout->setAlignment(downloadButton, Qt::AlignHCenter);
  129. - downloadButton->hide();
  130. -#endif
  131. -#endif
  132. -
  133. - setCursor(Qt::PointingHandCursor);
  134. -}
  135. -
  136. -void AppWidget::enterEvent(QEvent *e) {
  137. - Q_UNUSED(e);
  138. - if (downloadButton) downloadButton->show();
  139. -}
  140. -
  141. -void AppWidget::leaveEvent(QEvent *e) {
  142. - Q_UNUSED(e);
  143. - if (downloadButton) downloadButton->hide();
  144. -}
  145. -
  146. -void AppWidget::mouseReleaseEvent(QMouseEvent *e) {
  147. - if (e->button() == Qt::LeftButton) {
  148. - QDesktopServices::openUrl(webPage);
  149. - }
  150. -}
  151. -
  152. -void AppWidget::iconDownloaded(const QByteArray &bytes) {
  153. - QPixmap pixmap;
  154. - pixmap.loadFromData(bytes, "PNG");
  155. - icon->setPixmap(pixmap);
  156. -}
  157. -
  158. -void AppWidget::downloadApp() {
  159. -#ifdef APP_EXTRA
  160. - if (!icon) return;
  161. - UpdateDialog *dialog = new UpdateDialog(icon->pixmap(), name, QString(), url, this);
  162. - dialog->downloadUpdate();
  163. - dialog->show();
  164. -#endif
  165. -}
  166. diff --git a/src/appwidget.h b/src/appwidget.h
  167. deleted file mode 100644
  168. index a5ee272..0000000
  169. --- a/src/appwidget.h
  170. +++ /dev/null
  171. @@ -1,46 +0,0 @@
  172. -#ifndef APPWIDGET_H
  173. -#define APPWIDGET_H
  174. -
  175. -#include <QtWidgets>
  176. -
  177. -
  178. -class AppWidget : public QWidget {
  179. -
  180. - Q_OBJECT
  181. -
  182. -public:
  183. - AppWidget(const QString &name, const QString &code, QWidget *parent = 0);
  184. - QLabel *icon;
  185. -
  186. -protected:
  187. - void enterEvent(QEvent *e);
  188. - void leaveEvent(QEvent *e);
  189. - void mouseReleaseEvent(QMouseEvent *e);
  190. -
  191. -private slots:
  192. - void iconDownloaded(const QByteArray &bytes);
  193. - void downloadApp();
  194. -
  195. -private:
  196. - QPushButton *downloadButton;
  197. - QString name;
  198. - QString url;
  199. - QString webPage;
  200. -};
  201. -
  202. -class AppsWidget : public QWidget {
  203. -
  204. - Q_OBJECT
  205. -
  206. -public:
  207. - AppsWidget(QWidget *parent = 0);
  208. -
  209. -protected:
  210. - void paintEvent(QPaintEvent *e);
  211. -
  212. -private:
  213. - void setupApp(const QString &name, const QString &code);
  214. -
  215. -};
  216. -
  217. -#endif // APPWIDGET_H