123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223 |
- diff --git a/minitube.pro b/minitube.pro
- index 2308f10..853baff 100644
- --- a/minitube.pro
- +++ b/minitube.pro
- @@ -120,7 +120,6 @@ HEADERS += src/video.h \
- src/searchwidget.h \
- src/channellistview.h \
- src/httputils.h \
- - src/appwidget.h \
- src/clickablelabel.h \
- src/ytvideo.h \
- src/toolbarmenu.h \
- @@ -196,7 +195,6 @@ SOURCES += src/main.cpp \
- src/paginatedvideosource.cpp \
- src/channellistview.cpp \
- src/httputils.cpp \
- - src/appwidget.cpp \
- src/clickablelabel.cpp \
- src/ytvideo.cpp \
- src/toolbarmenu.cpp \
- diff --git a/src/aboutview.cpp b/src/aboutview.cpp
- index e60c173..70e2a50 100644
- --- a/src/aboutview.cpp
- +++ b/src/aboutview.cpp
- @@ -30,7 +30,6 @@ $END_LICENSE */
- #include "mac_startup.h"
- #include "macutils.h"
- #endif
- -#include "appwidget.h"
- #include "clickablelabel.h"
- #include "fontutils.h"
- #include "iconutils.h"
- @@ -197,10 +196,6 @@ AboutView::AboutView(QWidget *parent) : View(parent) {
- buttonLayout->addWidget(closeButton);
-
- layout->addLayout(buttonLayout);
- -
- -#ifndef APP_WIN_STORE
- - verticalLayout->addWidget(new AppsWidget());
- -#endif
- }
-
- void AboutView::appear() {
- diff --git a/src/appwidget.cpp b/src/appwidget.cpp
- deleted file mode 100644
- index c9c5181..0000000
- --- a/src/appwidget.cpp
- +++ /dev/null
- @@ -1,121 +0,0 @@
- -#include "appwidget.h"
- -#include "constants.h"
- -#include "http.h"
- -#ifdef APP_EXTRA
- -#include "updatedialog.h"
- -#endif
- -
- -AppsWidget::AppsWidget(QWidget *parent) : QWidget(parent) {
- - const int padding = 30;
- -
- - QBoxLayout *layout = new QHBoxLayout(this);
- - layout->setMargin(padding);
- - layout->setSpacing(padding*2);
- - layout->setAlignment(Qt::AlignCenter);
- -
- -#ifdef APP_MAC
- - const QString ext = "dmg";
- -#elif defined APP_WIN
- - const QString ext = "exe";
- -#else
- - const QString ext = "deb";
- -#endif
- -
- -#ifdef APP_MAC
- - setupApp("Sofa", "sofa." + ext);
- -#endif
- - setupApp("Finetune", "finetune." + ext);
- - setupApp("Musictube", "musictube." + ext);
- - setupApp("Musique", "musique." + ext);
- -}
- -
- -void AppsWidget::setupApp(const QString &name, const QString &code) {
- - AppWidget *w = new AppWidget(name, code);
- - layout()->addWidget(w);
- -}
- -
- -void AppsWidget::paintEvent(QPaintEvent *e) {
- - Q_UNUSED(e);
- - QStyleOption o;
- - o.initFrom(this);
- - QPainter p(this);
- - style()->drawPrimitive(QStyle::PE_Widget, &o, &p, this);
- -}
- -
- -AppWidget::AppWidget(const QString &name, const QString &code, QWidget *parent)
- - : QWidget(parent), name(name), downloadButton(nullptr) {
- - const QString unixName = code.left(code.lastIndexOf('.'));
- - const QString baseUrl = QLatin1String("https://") + Constants::ORG_DOMAIN;
- - const QString filesUrl = baseUrl + QLatin1String("/files/");
- - url = filesUrl + unixName + QLatin1String("/") + code;
- - webPage = baseUrl + QLatin1String("/") + unixName;
- -
- - QBoxLayout *layout = new QVBoxLayout(this);
- - layout->setMargin(0);
- - layout->setAlignment(Qt::AlignHCenter);
- -
- - icon = new QLabel();
- - icon->setMinimumHeight(128);
- - layout->addWidget(icon);
- - QString pixelRatioString;
- - if (devicePixelRatioF() > 1.0)
- - pixelRatioString = '@' + QString::number(devicePixelRatio()) + 'x';
- - const QString iconUrl = filesUrl + QLatin1String("products/") + unixName + pixelRatioString +
- - QLatin1String(".png");
- - QObject *reply = Http::instance().get(iconUrl);
- - connect(reply, SIGNAL(data(QByteArray)), SLOT(iconDownloaded(QByteArray)));
- -
- - QLabel *appTitle = new QLabel(name);
- - appTitle->setAlignment(Qt::AlignHCenter);
- - layout->addWidget(appTitle);
- -
- -#ifdef APP_EXTRA
- -#if !defined(APP_UBUNTU) && !defined(APP_MAC_STORE)
- - downloadButton = new QPushButton(tr("Download"));
- - downloadButton->setAttribute(Qt::WA_MacSmallSize);
- - downloadButton->setCursor(Qt::ArrowCursor);
- - QSizePolicy sp = downloadButton->sizePolicy();
- - sp.setHorizontalPolicy(QSizePolicy::Fixed);
- - sp.setRetainSizeWhenHidden(true);
- - downloadButton->setSizePolicy(sp);
- - connect(downloadButton, SIGNAL(clicked(bool)), SLOT(downloadApp()));
- - layout->addWidget(downloadButton, Qt::AlignHCenter);
- - layout->setAlignment(downloadButton, Qt::AlignHCenter);
- - downloadButton->hide();
- -#endif
- -#endif
- -
- - setCursor(Qt::PointingHandCursor);
- -}
- -
- -void AppWidget::enterEvent(QEvent *e) {
- - Q_UNUSED(e);
- - if (downloadButton) downloadButton->show();
- -}
- -
- -void AppWidget::leaveEvent(QEvent *e) {
- - Q_UNUSED(e);
- - if (downloadButton) downloadButton->hide();
- -}
- -
- -void AppWidget::mouseReleaseEvent(QMouseEvent *e) {
- - if (e->button() == Qt::LeftButton) {
- - QDesktopServices::openUrl(webPage);
- - }
- -}
- -
- -void AppWidget::iconDownloaded(const QByteArray &bytes) {
- - QPixmap pixmap;
- - pixmap.loadFromData(bytes, "PNG");
- - pixmap.setDevicePixelRatio(devicePixelRatioF());
- - icon->setPixmap(pixmap);
- -}
- -
- -void AppWidget::downloadApp() {
- -#ifdef APP_EXTRA
- - if (!icon) return;
- - UpdateDialog *dialog = new UpdateDialog(icon->pixmap(), name, QString(), url, this);
- - dialog->downloadUpdate();
- - dialog->show();
- -#endif
- -}
- diff --git a/src/appwidget.h b/src/appwidget.h
- deleted file mode 100644
- index a5ee272..0000000
- --- a/src/appwidget.h
- +++ /dev/null
- @@ -1,46 +0,0 @@
- -#ifndef APPWIDGET_H
- -#define APPWIDGET_H
- -
- -#include <QtWidgets>
- -
- -
- -class AppWidget : public QWidget {
- -
- - Q_OBJECT
- -
- -public:
- - AppWidget(const QString &name, const QString &code, QWidget *parent = 0);
- - QLabel *icon;
- -
- -protected:
- - void enterEvent(QEvent *e);
- - void leaveEvent(QEvent *e);
- - void mouseReleaseEvent(QMouseEvent *e);
- -
- -private slots:
- - void iconDownloaded(const QByteArray &bytes);
- - void downloadApp();
- -
- -private:
- - QPushButton *downloadButton;
- - QString name;
- - QString url;
- - QString webPage;
- -};
- -
- -class AppsWidget : public QWidget {
- -
- - Q_OBJECT
- -
- -public:
- - AppsWidget(QWidget *parent = 0);
- -
- -protected:
- - void paintEvent(QPaintEvent *e);
- -
- -private:
- - void setupApp(const QString &name, const QString &code);
- -
- -};
- -
- -#endif // APPWIDGET_H
|