mirror of
				https://git.wownero.com/wowlet/wowlet.git
				synced 2024-08-15 01:03:14 +00:00 
			
		
		
		
	SuchWidget - display listing of suchwow.xyz posts
This commit is contained in:
		
							parent
							
								
									7cf050ff8e
								
							
						
					
					
						commit
						db5ba12190
					
				
					 8 changed files with 322 additions and 0 deletions
				
			
		| 
						 | 
					@ -431,6 +431,11 @@ void AppContext::onWSMessage(const QJsonObject &msg) {
 | 
				
			||||||
        this->onWSCCS(ccs_data);
 | 
					        this->onWSCCS(ccs_data);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    else if(cmd == "suchwow") {
 | 
				
			||||||
 | 
					        QJsonArray such_data = msg.value("data").toArray();
 | 
				
			||||||
 | 
					        emit suchWowUpdated(such_data);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    else if(cmd == "txFiatHistory") {
 | 
					    else if(cmd == "txFiatHistory") {
 | 
				
			||||||
        auto txFiatHistory_data = msg.value("data").toObject();
 | 
					        auto txFiatHistory_data = msg.value("data").toObject();
 | 
				
			||||||
        AppContext::txFiatHistory->onWSData(txFiatHistory_data);
 | 
					        AppContext::txFiatHistory->onWSData(txFiatHistory_data);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -162,6 +162,7 @@ signals:
 | 
				
			||||||
    void redditUpdated(QList<QSharedPointer<RedditPost>> &posts);
 | 
					    void redditUpdated(QList<QSharedPointer<RedditPost>> &posts);
 | 
				
			||||||
    void nodesUpdated(QList<QSharedPointer<FeatherNode>> &nodes);
 | 
					    void nodesUpdated(QList<QSharedPointer<FeatherNode>> &nodes);
 | 
				
			||||||
    void ccsUpdated(QList<QSharedPointer<CCSEntry>> &entries);
 | 
					    void ccsUpdated(QList<QSharedPointer<CCSEntry>> &entries);
 | 
				
			||||||
 | 
					    void suchWowUpdated(const QJsonArray &such_data);
 | 
				
			||||||
    void nodeSourceChanged(NodeSource nodeSource);
 | 
					    void nodeSourceChanged(NodeSource nodeSource);
 | 
				
			||||||
    void XMRigDownloads(const QJsonObject &data);
 | 
					    void XMRigDownloads(const QJsonObject &data);
 | 
				
			||||||
    void setCustomNodes(QList<FeatherNode> nodes);
 | 
					    void setCustomNodes(QList<FeatherNode> nodes);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,6 +6,7 @@
 | 
				
			||||||
#include <QDesktopServices>
 | 
					#include <QDesktopServices>
 | 
				
			||||||
#include <QCoreApplication>
 | 
					#include <QCoreApplication>
 | 
				
			||||||
#include <QSystemTrayIcon>
 | 
					#include <QSystemTrayIcon>
 | 
				
			||||||
 | 
					#include <QMessageBox>
 | 
				
			||||||
#include <QFileDialog>
 | 
					#include <QFileDialog>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "mainwindow.h"
 | 
					#include "mainwindow.h"
 | 
				
			||||||
| 
						 | 
					@ -166,6 +167,8 @@ MainWindow::MainWindow(AppContext *ctx, QWidget *parent) :
 | 
				
			||||||
    connect(ui->ccsWidget, &CCSWidget::selected, this, &MainWindow::showSendScreen);
 | 
					    connect(ui->ccsWidget, &CCSWidget::selected, this, &MainWindow::showSendScreen);
 | 
				
			||||||
    connect(m_ctx, &AppContext::ccsUpdated, ui->ccsWidget->model(), &CCSModel::updateEntries);
 | 
					    connect(m_ctx, &AppContext::ccsUpdated, ui->ccsWidget->model(), &CCSModel::updateEntries);
 | 
				
			||||||
    connect(m_ctx, &AppContext::redditUpdated, ui->redditWidget->model(), &RedditModel::updatePosts);
 | 
					    connect(m_ctx, &AppContext::redditUpdated, ui->redditWidget->model(), &RedditModel::updatePosts);
 | 
				
			||||||
 | 
					    connect(m_ctx, &AppContext::suchWowUpdated, ui->suchWowWidget, &SuchWowWidget::onWS);
 | 
				
			||||||
 | 
					    connect(ui->suchWowWidget, &SuchWowWidget::donate, this, &MainWindow::suchDonate);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    connect(ui->redditWidget, &RedditWidget::setStatusText, this, &MainWindow::setStatusText);
 | 
					    connect(ui->redditWidget, &RedditWidget::setStatusText, this, &MainWindow::setStatusText);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1060,6 +1063,12 @@ void MainWindow::showSendScreen(const CCSEntry &entry) {
 | 
				
			||||||
    ui->tabWidget->setCurrentIndex(Tabs::SEND);
 | 
					    ui->tabWidget->setCurrentIndex(Tabs::SEND);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void MainWindow::suchDonate(const QString address) {
 | 
				
			||||||
 | 
					    double donation = AppContext::prices->convert("EUR", "WOW", 2);
 | 
				
			||||||
 | 
					    ui->sendWidget->fill(address, "SuchWow contribution :-)", donation);
 | 
				
			||||||
 | 
					    ui->tabWidget->setCurrentIndex(Tabs::SEND);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void MainWindow::onViewOnBlockExplorer(const QString &txid) {
 | 
					void MainWindow::onViewOnBlockExplorer(const QString &txid) {
 | 
				
			||||||
    QString blockExplorerLink = Utils::blockExplorerLink(config()->get(Config::blockExplorer).toString(), m_ctx->networkType, txid);
 | 
					    QString blockExplorerLink = Utils::blockExplorerLink(config()->get(Config::blockExplorer).toString(), m_ctx->networkType, txid);
 | 
				
			||||||
    Utils::externalLinkWarning(this, blockExplorerLink);
 | 
					    Utils::externalLinkWarning(this, blockExplorerLink);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -109,6 +109,7 @@ public slots:
 | 
				
			||||||
    void showSendTab();
 | 
					    void showSendTab();
 | 
				
			||||||
    void showHistoryTab();
 | 
					    void showHistoryTab();
 | 
				
			||||||
    void showSendScreen(const CCSEntry &entry);
 | 
					    void showSendScreen(const CCSEntry &entry);
 | 
				
			||||||
 | 
					    void suchDonate(const QString address);
 | 
				
			||||||
    void skinChanged(const QString &skinName);
 | 
					    void skinChanged(const QString &skinName);
 | 
				
			||||||
    void menuTorClicked();
 | 
					    void menuTorClicked();
 | 
				
			||||||
    void onBlockchainSync(int height, int target);
 | 
					    void onBlockchainSync(int height, int target);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -101,6 +101,35 @@
 | 
				
			||||||
          <property name="documentMode">
 | 
					          <property name="documentMode">
 | 
				
			||||||
           <bool>true</bool>
 | 
					           <bool>true</bool>
 | 
				
			||||||
          </property>
 | 
					          </property>
 | 
				
			||||||
 | 
					          <widget class="QWidget" name="tab_3">
 | 
				
			||||||
 | 
					           <attribute name="title">
 | 
				
			||||||
 | 
					            <string>SuchWow</string>
 | 
				
			||||||
 | 
					           </attribute>
 | 
				
			||||||
 | 
					           <layout class="QVBoxLayout" name="verticalLayout_4">
 | 
				
			||||||
 | 
					            <property name="leftMargin">
 | 
				
			||||||
 | 
					             <number>0</number>
 | 
				
			||||||
 | 
					            </property>
 | 
				
			||||||
 | 
					            <property name="topMargin">
 | 
				
			||||||
 | 
					             <number>0</number>
 | 
				
			||||||
 | 
					            </property>
 | 
				
			||||||
 | 
					            <property name="rightMargin">
 | 
				
			||||||
 | 
					             <number>0</number>
 | 
				
			||||||
 | 
					            </property>
 | 
				
			||||||
 | 
					            <property name="bottomMargin">
 | 
				
			||||||
 | 
					             <number>0</number>
 | 
				
			||||||
 | 
					            </property>
 | 
				
			||||||
 | 
					            <item>
 | 
				
			||||||
 | 
					             <widget class="SuchWowWidget" name="suchWowWidget" native="true">
 | 
				
			||||||
 | 
					              <property name="minimumSize">
 | 
				
			||||||
 | 
					               <size>
 | 
				
			||||||
 | 
					                <width>0</width>
 | 
				
			||||||
 | 
					                <height>320</height>
 | 
				
			||||||
 | 
					               </size>
 | 
				
			||||||
 | 
					              </property>
 | 
				
			||||||
 | 
					             </widget>
 | 
				
			||||||
 | 
					            </item>
 | 
				
			||||||
 | 
					           </layout>
 | 
				
			||||||
 | 
					          </widget>
 | 
				
			||||||
          <widget class="QWidget" name="tab">
 | 
					          <widget class="QWidget" name="tab">
 | 
				
			||||||
           <attribute name="title">
 | 
					           <attribute name="title">
 | 
				
			||||||
            <string>CCS</string>
 | 
					            <string>CCS</string>
 | 
				
			||||||
| 
						 | 
					@ -749,6 +778,12 @@
 | 
				
			||||||
   <header>widgets/redditwidget.h</header>
 | 
					   <header>widgets/redditwidget.h</header>
 | 
				
			||||||
   <container>1</container>
 | 
					   <container>1</container>
 | 
				
			||||||
  </customwidget>
 | 
					  </customwidget>
 | 
				
			||||||
 | 
					  <customwidget>
 | 
				
			||||||
 | 
					   <class>SuchWowWidget</class>
 | 
				
			||||||
 | 
					   <extends>QWidget</extends>
 | 
				
			||||||
 | 
					   <header>widgets/suchwowwidget.h</header>
 | 
				
			||||||
 | 
					   <container>1</container>
 | 
				
			||||||
 | 
					  </customwidget>
 | 
				
			||||||
 </customwidgets>
 | 
					 </customwidgets>
 | 
				
			||||||
 <resources>
 | 
					 <resources>
 | 
				
			||||||
  <include location="assets.qrc"/>
 | 
					  <include location="assets.qrc"/>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										131
									
								
								src/widgets/suchwowwidget.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										131
									
								
								src/widgets/suchwowwidget.cpp
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,131 @@
 | 
				
			||||||
 | 
					// SPDX-License-Identifier: BSD-3-Clause
 | 
				
			||||||
 | 
					// Copyright (c) 2020-2021, The Monero Project.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <QStandardItemModel>
 | 
				
			||||||
 | 
					#include <QMessageBox>
 | 
				
			||||||
 | 
					#include <QTableWidget>
 | 
				
			||||||
 | 
					#include <QDesktopServices>
 | 
				
			||||||
 | 
					#include <QListWidgetItem>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "suchwowwidget.h"
 | 
				
			||||||
 | 
					#include "ui_suchwowwidget.h"
 | 
				
			||||||
 | 
					#include "utils/utils.h"
 | 
				
			||||||
 | 
					#include "utils/config.h"
 | 
				
			||||||
 | 
					#include "mainwindow.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SuchWowPost::SuchWowPost(AppContext *ctx, QObject *parent) :
 | 
				
			||||||
 | 
					        QObject(parent),
 | 
				
			||||||
 | 
					        m_ctx(ctx) {
 | 
				
			||||||
 | 
					    m_networkImg = new UtilsNetworking(m_ctx->network, this);
 | 
				
			||||||
 | 
					    m_networkThumb = new UtilsNetworking(m_ctx->network, this);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void SuchWowPost::onThumbReceived(QByteArray data) {
 | 
				
			||||||
 | 
					    thumb_data.loadFromData(data, "JPEG");
 | 
				
			||||||
 | 
					    emit thumbReceived(this);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void SuchWowPost::onImgReceived(QByteArray data) {
 | 
				
			||||||
 | 
					    img_data.loadFromData(data);
 | 
				
			||||||
 | 
					    emit imgReceived(this);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SuchWowPost::~SuchWowPost() = default;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SuchWowWidget::SuchWowWidget(QWidget *parent) :
 | 
				
			||||||
 | 
					        QWidget(parent),
 | 
				
			||||||
 | 
					        ui(new Ui::SuchWowWidget),
 | 
				
			||||||
 | 
					        m_contextMenu(new QMenu(this))
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    ui->setupUi(this);
 | 
				
			||||||
 | 
					    this->setupTable();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    m_contextMenu->addAction("View image", this, &SuchWowWidget::suchImage);
 | 
				
			||||||
 | 
					    m_contextMenu->addAction("Donate", this, &SuchWowWidget::suchDonate);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    connect(ui->listWidget, &QListWidget::customContextMenuRequested, this, &SuchWowWidget::showContextMenu);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void SuchWowWidget::setupTable() {
 | 
				
			||||||
 | 
					    ui->listWidget->setViewMode(QListWidget::IconMode);
 | 
				
			||||||
 | 
					    ui->listWidget->setIconSize(QSize(256, 256));
 | 
				
			||||||
 | 
					    ui->listWidget->setResizeMode(QListWidget::Adjust);
 | 
				
			||||||
 | 
					    ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void SuchWowWidget::onWS(QJsonArray such_data) {
 | 
				
			||||||
 | 
					    if(this->m_rendered) return; // only draw once
 | 
				
			||||||
 | 
					    if(this->m_ctx == nullptr) {
 | 
				
			||||||
 | 
					        m_ctx = MainWindow::getContext();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for (auto &&such_post: such_data) {
 | 
				
			||||||
 | 
					        auto obj = such_post.toObject();
 | 
				
			||||||
 | 
					        auto s = new SuchWowPost(m_ctx, this);
 | 
				
			||||||
 | 
					        s->added_by = obj.value("added_by").toString();
 | 
				
			||||||
 | 
					        s->addy = obj.value("addy").toString();
 | 
				
			||||||
 | 
					        s->title = obj.value("title").toString();
 | 
				
			||||||
 | 
					        s->img = obj.value("img").toString();
 | 
				
			||||||
 | 
					        s->thumb = obj.value("thumb").toString();
 | 
				
			||||||
 | 
					        s->href = obj.value("href").toString();
 | 
				
			||||||
 | 
					        m_posts.push_back(s);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        connect(s, &SuchWowPost::thumbReceived, this, &SuchWowWidget::addThumb);
 | 
				
			||||||
 | 
					        s->download_thumb();
 | 
				
			||||||
 | 
					        s->download_img();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void SuchWowWidget::addThumb(SuchWowPost *test) {
 | 
				
			||||||
 | 
					    auto *item = new QListWidgetItem(QIcon(test->thumb_data), test->title);
 | 
				
			||||||
 | 
					    ui->listWidget->addItem(item);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void SuchWowWidget::showContextMenu(const QPoint &pos) {
 | 
				
			||||||
 | 
					    QModelIndex index = ui->listWidget->indexAt(pos);
 | 
				
			||||||
 | 
					    if (!index.isValid())
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					    m_contextMenu->exec(ui->listWidget->viewport()->mapToGlobal(pos));
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void SuchWowWidget::suchImage() {
 | 
				
			||||||
 | 
					    auto *post = this->itemToPost();
 | 
				
			||||||
 | 
					    if(post == nullptr)
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					    if(!post->img_data) {
 | 
				
			||||||
 | 
					        QMessageBox::warning(this, "wh00pz", "Image not dowloaded yet.");
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    const auto title = QString("%1 - %2").arg(post->title).arg(post->added_by);
 | 
				
			||||||
 | 
					    QMessageBox mb(title, "",
 | 
				
			||||||
 | 
					                   QMessageBox::NoIcon,
 | 
				
			||||||
 | 
					                   QMessageBox::Ok,
 | 
				
			||||||
 | 
					                   QMessageBox::NoButton,
 | 
				
			||||||
 | 
					                   QMessageBox::NoButton);
 | 
				
			||||||
 | 
					    mb.setIconPixmap(post->img_data);
 | 
				
			||||||
 | 
					    mb.exec();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void SuchWowWidget::suchDonate() {
 | 
				
			||||||
 | 
					    auto *post = this->itemToPost();
 | 
				
			||||||
 | 
					    if(post != nullptr)
 | 
				
			||||||
 | 
					        emit donate(post->addy);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SuchWowPost *SuchWowWidget::itemToPost() {
 | 
				
			||||||
 | 
					    QListWidgetItem *item = ui->listWidget->currentItem();
 | 
				
			||||||
 | 
					    QString title = item->text();
 | 
				
			||||||
 | 
					    for(auto &post: m_posts){
 | 
				
			||||||
 | 
					        if(post->title == title) {
 | 
				
			||||||
 | 
					            return post;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return nullptr;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SuchWowWidget::~SuchWowWidget() {
 | 
				
			||||||
 | 
					    delete ui;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										98
									
								
								src/widgets/suchwowwidget.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										98
									
								
								src/widgets/suchwowwidget.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,98 @@
 | 
				
			||||||
 | 
					// SPDX-License-Identifier: BSD-3-Clause
 | 
				
			||||||
 | 
					// Copyright (c) 2020-2021, The Monero Project.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifndef SUCHWOWWIDGET_H
 | 
				
			||||||
 | 
					#define SUCHWOWWIDGET_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <QMenu>
 | 
				
			||||||
 | 
					#include <QWidget>
 | 
				
			||||||
 | 
					#include <QItemSelection>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "utils/networking.h"
 | 
				
			||||||
 | 
					#include "appcontext.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace Ui {
 | 
				
			||||||
 | 
					    class SuchWowWidget;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class SuchWowPost : public QObject
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					Q_OBJECT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
					    explicit SuchWowPost(AppContext *ctx, QObject *parent = nullptr);
 | 
				
			||||||
 | 
					    ~SuchWowPost();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    QString title;
 | 
				
			||||||
 | 
					    QString added_by;
 | 
				
			||||||
 | 
					    QString thumb;
 | 
				
			||||||
 | 
					    QString img;
 | 
				
			||||||
 | 
					    QString addy;
 | 
				
			||||||
 | 
					    QString href;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    QPixmap thumb_data;
 | 
				
			||||||
 | 
					    QPixmap img_data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void download_thumb() {
 | 
				
			||||||
 | 
					        const QString url = QString("%1/%2").arg(m_weburl).arg(this->thumb);
 | 
				
			||||||
 | 
					        qDebug() << url;
 | 
				
			||||||
 | 
					        connect(m_networkThumb, &UtilsNetworking::webReceived, this, &SuchWowPost::onThumbReceived);
 | 
				
			||||||
 | 
					        m_networkThumb->get(url);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    void download_img() {
 | 
				
			||||||
 | 
					        const QString url = QString("%1/%2").arg(m_weburl).arg(this->img);
 | 
				
			||||||
 | 
					        qDebug() << url;
 | 
				
			||||||
 | 
					        connect(m_networkImg, &UtilsNetworking::webReceived, this, &SuchWowPost::onImgReceived);
 | 
				
			||||||
 | 
					        m_networkImg->get(url);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					private slots:
 | 
				
			||||||
 | 
					    void onThumbReceived(QByteArray data);
 | 
				
			||||||
 | 
					    void onImgReceived(QByteArray data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					signals:
 | 
				
			||||||
 | 
					    void imgReceived(SuchWowPost *test);
 | 
				
			||||||
 | 
					    void thumbReceived(SuchWowPost *test);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					private:
 | 
				
			||||||
 | 
					    QString m_weburl = "http://feathercitimllbmdktu6cmjo3fizgmyfrntntqzu6xguqa2rlq5cgid.onion/suchwow";
 | 
				
			||||||
 | 
					    AppContext *m_ctx = nullptr;
 | 
				
			||||||
 | 
					    UtilsNetworking *m_networkThumb = nullptr;
 | 
				
			||||||
 | 
					    UtilsNetworking *m_networkImg = nullptr;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class SuchWowWidget : public QWidget
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					Q_OBJECT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
					    explicit SuchWowWidget(QWidget *parent = nullptr);
 | 
				
			||||||
 | 
					    ~SuchWowWidget();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public slots:
 | 
				
			||||||
 | 
					    void onWS(QJsonArray such_data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					private slots:
 | 
				
			||||||
 | 
					    void addThumb(SuchWowPost *test);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					signals:
 | 
				
			||||||
 | 
					    void donate(QString donate);
 | 
				
			||||||
 | 
					    void openImage(SuchWowPost *test);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					private:
 | 
				
			||||||
 | 
					    void setupTable();
 | 
				
			||||||
 | 
					    void suchDonate();
 | 
				
			||||||
 | 
					    void suchImage();
 | 
				
			||||||
 | 
					    SuchWowPost* itemToPost();
 | 
				
			||||||
 | 
					    void showContextMenu(const QPoint &pos);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    bool m_rendered = false;  // because we're too lazy to re-render on changes.
 | 
				
			||||||
 | 
					    Ui::SuchWowWidget *ui;
 | 
				
			||||||
 | 
					    QList<SuchWowPost*> m_posts;
 | 
				
			||||||
 | 
					    AppContext *m_ctx = nullptr;
 | 
				
			||||||
 | 
					    QMenu *m_contextMenu;
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#endif // SUCHWOWWIDGET_H
 | 
				
			||||||
							
								
								
									
										42
									
								
								src/widgets/suchwowwidget.ui
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								src/widgets/suchwowwidget.ui
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,42 @@
 | 
				
			||||||
 | 
					<?xml version="1.0" encoding="UTF-8"?>
 | 
				
			||||||
 | 
					<ui version="4.0">
 | 
				
			||||||
 | 
					 <class>SuchWowWidget</class>
 | 
				
			||||||
 | 
					 <widget class="QWidget" name="SuchWowWidget">
 | 
				
			||||||
 | 
					  <property name="geometry">
 | 
				
			||||||
 | 
					   <rect>
 | 
				
			||||||
 | 
					    <x>0</x>
 | 
				
			||||||
 | 
					    <y>0</y>
 | 
				
			||||||
 | 
					    <width>492</width>
 | 
				
			||||||
 | 
					    <height>409</height>
 | 
				
			||||||
 | 
					   </rect>
 | 
				
			||||||
 | 
					  </property>
 | 
				
			||||||
 | 
					  <property name="windowTitle">
 | 
				
			||||||
 | 
					   <string>Form</string>
 | 
				
			||||||
 | 
					  </property>
 | 
				
			||||||
 | 
					  <layout class="QVBoxLayout" name="verticalLayout">
 | 
				
			||||||
 | 
					   <property name="spacing">
 | 
				
			||||||
 | 
					    <number>4</number>
 | 
				
			||||||
 | 
					   </property>
 | 
				
			||||||
 | 
					   <property name="leftMargin">
 | 
				
			||||||
 | 
					    <number>0</number>
 | 
				
			||||||
 | 
					   </property>
 | 
				
			||||||
 | 
					   <property name="topMargin">
 | 
				
			||||||
 | 
					    <number>0</number>
 | 
				
			||||||
 | 
					   </property>
 | 
				
			||||||
 | 
					   <property name="rightMargin">
 | 
				
			||||||
 | 
					    <number>0</number>
 | 
				
			||||||
 | 
					   </property>
 | 
				
			||||||
 | 
					   <property name="bottomMargin">
 | 
				
			||||||
 | 
					    <number>0</number>
 | 
				
			||||||
 | 
					   </property>
 | 
				
			||||||
 | 
					   <item>
 | 
				
			||||||
 | 
					    <widget class="QListWidget" name="listWidget"/>
 | 
				
			||||||
 | 
					   </item>
 | 
				
			||||||
 | 
					  </layout>
 | 
				
			||||||
 | 
					 </widget>
 | 
				
			||||||
 | 
					 <resources/>
 | 
				
			||||||
 | 
					 <connections/>
 | 
				
			||||||
 | 
					 <slots>
 | 
				
			||||||
 | 
					  <slot>linkClicked()</slot>
 | 
				
			||||||
 | 
					 </slots>
 | 
				
			||||||
 | 
					</ui>
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue