File indexing completed on 2024-05-19 05:51:04

0001 /* Atelier KDE Printer Host for 3D Printing
0002     Copyright (C) <2018>
0003     Author: Lays Rodrigues - lays.rodrigues@kde.org
0004 
0005     This program is free software: you can redistribute it and/or modify
0006     it under the terms of the GNU General Public License as published by
0007     the Free Software Foundation, either version 3 of the License, or
0008     (at your option) any later version.
0009 
0010     This program is distributed in the hope that it will be useful,
0011     but WITHOUT ANY WARRANTY; without even the implied warranty of
0012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013     GNU General Public License for more details.
0014 
0015     You should have received a copy of the GNU General Public License
0016     along with this program.  If not, see <http://www.gnu.org/licenses/>.
0017 */
0018 
0019 #pragma once
0020 
0021 #include <QWidget>
0022 
0023 class QDomDocument;
0024 class QLayout;
0025 class QUrl;
0026 
0027 struct Post {
0028     QString date;
0029     QString title;
0030     QString url;
0031 };
0032 
0033 class WelcomeWidget : public QWidget
0034 {
0035     Q_OBJECT
0036 
0037 public:
0038     WelcomeWidget(QWidget *parent = nullptr);
0039     ~WelcomeWidget() = default;
0040 
0041 private:
0042     QWidget *m_newsFeedWidget;
0043     QList<Post> m_postList;
0044     void fallback();
0045     void parseRss(const QDomDocument &document);
0046     void retrieveRssFeed();
0047     void setNewsLayout(QLayout *newLayout);
0048     void setupRssFeed();
0049     static const QString m_telegramLink;
0050     static const QString m_documentsLink;
0051     static const QString m_linkClose;
0052 };