remove_unfree_recommendations.patch 6.0 KB

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