diff --git a/libs/ui/CMakeLists.txt b/libs/ui/CMakeLists.txt
--- a/libs/ui/CMakeLists.txt
+++ b/libs/ui/CMakeLists.txt
@@ -255,7 +255,7 @@
widgets/KoDualColorButton.cpp
widgets/KoStrokeConfigWidget.cpp
widgets/KoFillConfigWidget.cpp
-
+ widgets/KisNewsWidget.cpp
utils/kis_document_aware_spin_box_unit_manager.cpp
@@ -375,6 +375,7 @@
KisReferenceImage.cpp
flake/KisReferenceImagesLayer.cpp
flake/KisReferenceImagesLayer.h
+
)
if(WIN32)
@@ -485,6 +486,7 @@
forms/wdgsessionmanager.ui
forms/wdgnewwindowlayout.ui
forms/KisWelcomePage.ui
+ forms/KisNewsPage.ui
brushhud/kis_dlg_brush_hud_config.ui
dialogs/kis_delayed_save_dialog.ui
@@ -512,6 +514,7 @@
wdgsplash.ui
input/wintab/kis_screen_size_choice_dialog.ui
input/wintab/drawpile_tablettester/tablettest.ui
+
)
diff --git a/libs/ui/KisNetworkAccessManager.cpp b/libs/ui/KisNetworkAccessManager.cpp
--- a/libs/ui/KisNetworkAccessManager.cpp
+++ b/libs/ui/KisNetworkAccessManager.cpp
@@ -44,7 +44,6 @@
.arg(QSysInfo::prettyProductName())
.arg(QLocale::system().name())
.arg(QSysInfo::WordSize);
- qDebug() << "Agent String" << agentStr;
QNetworkRequest req(request);
req.setRawHeader("User-Agent", agentStr.toLatin1());
return QNetworkAccessManager::createRequest(op, req, outgoingData);
diff --git a/libs/ui/KisWelcomePageWidget.cpp b/libs/ui/KisWelcomePageWidget.cpp
--- a/libs/ui/KisWelcomePageWidget.cpp
+++ b/libs/ui/KisWelcomePageWidget.cpp
@@ -35,8 +35,8 @@
KisWelcomePageWidget::KisWelcomePageWidget(QWidget *parent)
+ : QWidget(parent)
{
- Q_UNUSED(parent);
setupUi(this);
recentDocumentsListView->viewport()->setAutoFillBackground(false);
diff --git a/libs/ui/forms/KisNewsPage.ui b/libs/ui/forms/KisNewsPage.ui
new file mode 100644
--- /dev/null
+++ b/libs/ui/forms/KisNewsPage.ui
@@ -0,0 +1,34 @@
+
+
+ KisNewsPage
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+ Form
+
+
+ -
+
+
+ Show news about Krita: this needs internet to retrieve information from the krita.org website
+
+
+ Show News about Krita
+
+
+
+ -
+
+
+
+
+
+
+
diff --git a/libs/ui/forms/KisWelcomePage.ui b/libs/ui/forms/KisWelcomePage.ui
--- a/libs/ui/forms/KisWelcomePage.ui
+++ b/libs/ui/forms/KisWelcomePage.ui
@@ -6,7 +6,7 @@
0
0
- 650
+ 1061
538
@@ -34,24 +34,22 @@
0
-
-
- 10
-
-
- 10
-
-
- 10
-
-
- 10
-
-
- 15
-
- -
-
+
+
-
+
+
+ Qt::Vertical
+
+
+
+ 5
+ 5
+
+
+
+
+ -
+
Qt::Horizontal
@@ -63,95 +61,36 @@
- -
-
+
-
+
5
-
- 0
-
0
- 30
-
-
- 0
+ 20
-
-
+
18
- Community
-
-
- 0
+ Start
-
-
-
- 0
-
-
-
-
-
-
- 0
- 0
-
-
-
-
- true
-
-
-
- Qt::NoFocus
-
-
- User Manual
-
-
- false
-
-
- true
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Expanding
-
-
-
- 40
- 5
-
-
-
-
-
-
- -
-
+
0
-
-
+
true
@@ -161,7 +100,7 @@
Qt::NoFocus
- Getting Started
+ New File
false
@@ -172,45 +111,25 @@
-
-
-
- Qt::Horizontal
-
-
+
+
- 40
- 5
+ 20
+ 0
-
-
-
-
- -
-
-
-
-
- true
+ false
-
- Qt::NoFocus
-
- Support Krita
-
-
- false
-
-
- true
+
-
-
+
Qt::Horizontal
@@ -225,9 +144,15 @@
-
-
+
+
+ 0
+
+
+ 30
+
-
-
+
true
@@ -237,7 +162,7 @@
Qt::NoFocus
- User Community
+ Open File
false
@@ -248,45 +173,25 @@
-
-
-
- Qt::Horizontal
-
-
+
+
- 40
- 20
+ 20
+ 0
-
-
-
-
- -
-
-
-
-
- true
+ false
-
- Qt::NoFocus
-
- Krita Website
-
-
- false
-
-
- true
+
-
-
+
Qt::Horizontal
@@ -301,56 +206,27 @@
-
-
-
- 0
-
-
- 0
-
+
-
-
+
- true
+ 18
-
- Qt::NoFocus
-
- Source Code
-
-
- false
-
-
- true
+ Recent Documents
-
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
+
+
+
+ 0
+ 0
+
-
-
-
-
- -
-
-
- 20
-
-
-
-
true
@@ -360,7 +236,7 @@
Qt::NoFocus
- Powered by KDE
+ Clear
false
@@ -371,13 +247,13 @@
-
-
+
Qt::Horizontal
- 40
+ 5
20
@@ -386,121 +262,116 @@
-
-
-
-
-
-
-
- 0
- 0
-
-
-
- QFrame::Box
-
-
- 2
-
-
- Drag Image in window to open
-
-
- Qt::AlignCenter
-
-
- true
-
-
- 30
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
- -
-
-
- Qt::Vertical
+
+
+
+ 0
+ 0
+
-
+
- 20
- 20
+ 300
+ 250
-
+
+
+ true
+ false
+
+
+
+ Qt::NoFocus
+
+
+ false
+
+
+ QFrame::NoFrame
+
+
+ QFrame::Plain
+
+
+ 0
+
+
+ false
+
+
+ false
+
+
+ QAbstractItemView::SelectItems
+
+
+ QListView::Snap
+
+
+ QListView::Fixed
+
+
+ 0
+
+
+ QListView::ListMode
+
+
+ true
+
+
+ false
+
+
- -
-
-
- Qt::Vertical
-
-
-
- 5
- 5
-
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 5
- 5
-
-
-
-
- -
-
+
-
+
5
+
+ 0
+
0
- 20
+ 30
+
+
+ 0
-
-
+
18
- Start
+ Community
+
+
+ 0
-
-
+
0
-
-
+
+
+
+ 0
+ 0
+
+
true
@@ -510,7 +381,7 @@
Qt::NoFocus
- New File
+ User Manual
false
@@ -521,25 +392,89 @@
-
-
-
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Expanding
+
+
- 20
- 0
+ 40
+ 5
+
+
+
+
+ -
+
+
+ 0
+
+
-
+
- false
+ true
+
+
+
+ Qt::NoFocus
+
+
+ Getting Started
+
+
+ false
+
+
+ true
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 5
+
+
+
+
+
+
+ -
+
+
-
+
+
+
+ true
+
+ Qt::NoFocus
+
-
+ Support Krita
+
+
+ false
+
+
+ true
-
-
+
Qt::Horizontal
@@ -554,15 +489,9 @@
-
-
-
- 0
-
-
- 30
-
+
-
-
+
true
@@ -572,7 +501,7 @@
Qt::NoFocus
- Open File
+ User Community
false
@@ -583,25 +512,45 @@
-
-
-
+
+
+ Qt::Horizontal
+
+
- 20
- 0
+ 40
+ 20
+
+
+
+
+ -
+
+
-
+
- false
+ true
+
+ Qt::NoFocus
+
-
+ Krita Website
+
+
+ false
+
+
+ true
-
-
+
Qt::Horizontal
@@ -616,27 +565,56 @@
-
-
+
+
+ 0
+
+
+ 0
+
-
-
+
- 18
+ true
+
+ Qt::NoFocus
+
- Recent Documents
+ Source Code
+
+
+ false
+
+
+ true
-
-
-
-
- 0
- 0
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+ -
+
+
+ 20
+
+
-
+
true
@@ -646,7 +624,7 @@
Qt::NoFocus
- Clear
+ Powered by KDE
false
@@ -657,13 +635,13 @@
-
-
+
Qt::Horizontal
- 5
+ 40
20
@@ -672,71 +650,100 @@
-
-
-
-
- 0
- 0
-
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ QFrame::Box
+
+
+ 2
+
+
+ Drag Image in window to open
+
+
+ Qt::AlignCenter
+
+
+ true
+
+
+ 30
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
-
+
- 300
- 250
+ 20
+ 20
+
+
+
+
+ -
+
+
-
+
- true
- false
+ 18
-
- Qt::NoFocus
-
-
- false
-
-
- QFrame::NoFrame
-
-
- QFrame::Plain
-
-
- 0
-
-
- false
-
-
- false
-
-
- QAbstractItemView::SelectItems
-
-
- QListView::Snap
-
-
- QListView::Fixed
+
+ News
-
+
0
-
- QListView::ListMode
-
-
- true
-
-
- false
-
+ -
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 5
+ 5
+
+
+
+
-
@@ -755,6 +762,14 @@
+
+
+ KisNewsWidget
+ QWidget
+
+ 1
+
+
diff --git a/libs/ui/widgets/KisNewsWidget.h b/libs/ui/widgets/KisNewsWidget.h
new file mode 100644
--- /dev/null
+++ b/libs/ui/widgets/KisNewsWidget.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018 boud
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#ifndef KISNEWSWIDGET_H
+#define KISNEWSWIDGET_H
+
+#include
+#include
+
+#include
+
+class MultiFeedRssModel;
+
+/**
+ * @brief The KisNewsWidget class shows the latest news from Krita.org
+ */
+class KisNewsWidget : public QWidget, public Ui::KisNewsPage
+{
+ Q_OBJECT
+public:
+ explicit KisNewsWidget(QWidget *parent = nullptr);
+private Q_SLOTS:
+ void toggleNews(bool toggle);
+ void itemSelected(const QModelIndex &idx);
+private:
+ bool m_getNews {false};
+ MultiFeedRssModel *m_rssModel {0};
+};
+
+#endif // KISNEWSWIDGET_H
diff --git a/libs/ui/widgets/KisNewsWidget.cpp b/libs/ui/widgets/KisNewsWidget.cpp
new file mode 100644
--- /dev/null
+++ b/libs/ui/widgets/KisNewsWidget.cpp
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2018 boud
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+#include "KisNewsWidget.h"
+
+#include
+#include
+
+#include "kis_config.h"
+#include "KisMultiFeedRSSModel.h"
+
+KisNewsWidget::KisNewsWidget(QWidget *parent)
+ : QWidget(parent)
+{
+ setupUi(this);
+ KisConfig cfg(true);
+ m_getNews = cfg.readEntry("FetchNews", false);
+ chkShowNews->setChecked(m_getNews);
+ connect(chkShowNews, SIGNAL(toggled(bool)), this, SLOT(toggleNews(bool)));
+ m_rssModel = new MultiFeedRssModel(this);
+
+ if (m_getNews) {
+ m_rssModel->addFeed(QLatin1String("https://krita.org/en/feed/"));
+ }
+ else {
+ m_rssModel->removeFeed(QLatin1String("https://krita.org/en/feed/"));
+ }
+ listNews->setModel(m_rssModel);
+ connect(listNews, SIGNAL(clicked(const QModelIndex&)), this, SLOT(itemSelected(const QModelIndex&)));
+}
+
+void KisNewsWidget::toggleNews(bool toggle)
+{
+ KisConfig cfg(false);
+ cfg.writeEntry("FetchNews", toggle);
+ m_getNews = toggle;
+
+ if (m_getNews) {
+ m_rssModel->addFeed(QLatin1String("https://krita.org/en/feed/"));
+ }
+ else {
+ m_rssModel->removeFeed(QLatin1String("https://krita.org/en/feed/"));
+ }
+}
+
+void KisNewsWidget::itemSelected(const QModelIndex &idx)
+{
+ if (idx.isValid()) {
+ QString link = idx.data(RssRoles::LinkRole).toString();
+ QDesktopServices::openUrl(QUrl(link));
+ }
+}