|
@@ -1,9 +1,14 @@
|
|
#include "window-basic-about.hpp"
|
|
#include "window-basic-about.hpp"
|
|
#include "window-basic-main.hpp"
|
|
#include "window-basic-main.hpp"
|
|
#include "qt-wrappers.hpp"
|
|
#include "qt-wrappers.hpp"
|
|
|
|
+#include "remote-text.hpp"
|
|
#include <util/util.hpp>
|
|
#include <util/util.hpp>
|
|
#include <util/platform.h>
|
|
#include <util/platform.h>
|
|
#include <platform.hpp>
|
|
#include <platform.hpp>
|
|
|
|
+#include <json11.hpp>
|
|
|
|
+#include <sstream>
|
|
|
|
+
|
|
|
|
+using namespace json11;
|
|
|
|
|
|
OBSAbout::OBSAbout(QWidget *parent)
|
|
OBSAbout::OBSAbout(QWidget *parent)
|
|
: QDialog(parent),
|
|
: QDialog(parent),
|
|
@@ -11,8 +16,6 @@ OBSAbout::OBSAbout(QWidget *parent)
|
|
{
|
|
{
|
|
ui->setupUi(this);
|
|
ui->setupUi(this);
|
|
|
|
|
|
- setFixedSize(size());
|
|
|
|
-
|
|
|
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
|
|
|
|
|
QString bitness;
|
|
QString bitness;
|
|
@@ -34,12 +37,12 @@ OBSAbout::OBSAbout(QWidget *parent)
|
|
ui->version->setText(ver + bitness);
|
|
ui->version->setText(ver + bitness);
|
|
|
|
|
|
ui->contribute->setText(QTStr("About.Contribute"));
|
|
ui->contribute->setText(QTStr("About.Contribute"));
|
|
- ui->donate->setText("<a href='https://obsproject.com/donate'>" +
|
|
|
|
|
|
+ ui->donate->setText(" <a href='https://obsproject.com/donate'>" +
|
|
QTStr("About.Donate") + "</a>");
|
|
QTStr("About.Donate") + "</a>");
|
|
ui->donate->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
|
ui->donate->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
|
ui->donate->setOpenExternalLinks(true);
|
|
ui->donate->setOpenExternalLinks(true);
|
|
|
|
|
|
- ui->getInvolved->setText("<a href='https://github.com/obsproject/obs-studio/blob/master/CONTRIBUTING.rst'>" +
|
|
|
|
|
|
+ ui->getInvolved->setText(" <a href='https://github.com/obsproject/obs-studio/blob/master/CONTRIBUTING.rst'>" +
|
|
QTStr("About.GetInvolved") + "</a>");
|
|
QTStr("About.GetInvolved") + "</a>");
|
|
ui->getInvolved->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
|
ui->getInvolved->setTextInteractionFlags(Qt::TextBrowserInteraction);
|
|
ui->getInvolved->setOpenExternalLinks(true);
|
|
ui->getInvolved->setOpenExternalLinks(true);
|
|
@@ -48,8 +51,6 @@ OBSAbout::OBSAbout(QWidget *parent)
|
|
ui->authors->setText("<a href='#'>" + QTStr("About.Authors") + "</a>");
|
|
ui->authors->setText("<a href='#'>" + QTStr("About.Authors") + "</a>");
|
|
ui->license->setText("<a href='#'>" + QTStr("About.License") + "</a>");
|
|
ui->license->setText("<a href='#'>" + QTStr("About.License") + "</a>");
|
|
|
|
|
|
- ui->textBrowser->hide();
|
|
|
|
-
|
|
|
|
ui->name->setProperty("themeID", "aboutName");
|
|
ui->name->setProperty("themeID", "aboutName");
|
|
ui->version->setProperty("themeID", "aboutVersion");
|
|
ui->version->setProperty("themeID", "aboutVersion");
|
|
ui->about->setProperty("themeID", "aboutHLayout");
|
|
ui->about->setProperty("themeID", "aboutHLayout");
|
|
@@ -60,15 +61,65 @@ OBSAbout::OBSAbout(QWidget *parent)
|
|
connect(ui->about, SIGNAL(clicked()), this, SLOT(ShowAbout()));
|
|
connect(ui->about, SIGNAL(clicked()), this, SLOT(ShowAbout()));
|
|
connect(ui->authors, SIGNAL(clicked()), this, SLOT(ShowAuthors()));
|
|
connect(ui->authors, SIGNAL(clicked()), this, SLOT(ShowAuthors()));
|
|
connect(ui->license, SIGNAL(clicked()), this, SLOT(ShowLicense()));
|
|
connect(ui->license, SIGNAL(clicked()), this, SLOT(ShowLicense()));
|
|
|
|
+
|
|
|
|
+ QPointer<OBSAbout> about(this);
|
|
|
|
+
|
|
|
|
+ OBSBasic *main = OBSBasic::Get();
|
|
|
|
+ if (main->patronJson.empty() && !main->patronJsonThread) {
|
|
|
|
+ RemoteTextThread *thread = new RemoteTextThread(
|
|
|
|
+ "https://obsproject.com/patreon/about-box.json",
|
|
|
|
+ "application/json");
|
|
|
|
+ QObject::connect(thread, &RemoteTextThread::Result,
|
|
|
|
+ main, &OBSBasic::UpdatePatronJson);
|
|
|
|
+ QObject::connect(thread, SIGNAL(Result(const QString &, const QString &)),
|
|
|
|
+ this, SLOT(ShowAbout()));
|
|
|
|
+ main->patronJsonThread.reset(thread);
|
|
|
|
+ thread->start();
|
|
|
|
+ } else {
|
|
|
|
+ ShowAbout();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
void OBSAbout::ShowAbout()
|
|
void OBSAbout::ShowAbout()
|
|
{
|
|
{
|
|
- ui->textBrowser->hide();
|
|
|
|
- ui->info->show();
|
|
|
|
- ui->contribute->show();
|
|
|
|
- ui->donate->show();
|
|
|
|
- ui->getInvolved->show();
|
|
|
|
|
|
+ OBSBasic *main = OBSBasic::Get();
|
|
|
|
+
|
|
|
|
+ if (main->patronJson.empty())
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+ std::string error;
|
|
|
|
+ Json json = Json::parse(main->patronJson, error);
|
|
|
|
+ const Json::array &patrons = json.array_items();
|
|
|
|
+ std::stringstream text;
|
|
|
|
+
|
|
|
|
+ text << "<h1>Top Patreon contributors:</h1>";
|
|
|
|
+ text << "<p style=\"font-size:16px;\">";
|
|
|
|
+ bool first = true;
|
|
|
|
+ bool top = true;
|
|
|
|
+
|
|
|
|
+ for (const Json &patron : patrons) {
|
|
|
|
+ std::string name = patron["name"].string_value();
|
|
|
|
+ std::string link = patron["link"].string_value();
|
|
|
|
+ int amount = patron["amount"].int_value();
|
|
|
|
+
|
|
|
|
+ if (top && amount < 10000) {
|
|
|
|
+ text << "</p>";
|
|
|
|
+ top = false;
|
|
|
|
+ } else if (!first) {
|
|
|
|
+ text << "<br/>";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!link.empty())
|
|
|
|
+ text << "<a href=\"" << link << "\">";
|
|
|
|
+ text << name;
|
|
|
|
+ if (!link.empty())
|
|
|
|
+ text << "</a>";
|
|
|
|
+
|
|
|
|
+ if (first)
|
|
|
|
+ first = false;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ui->textBrowser->setHtml(QT_UTF8(text.str().c_str()));
|
|
}
|
|
}
|
|
|
|
|
|
void OBSAbout::ShowAuthors()
|
|
void OBSAbout::ShowAuthors()
|
|
@@ -92,12 +143,6 @@ void OBSAbout::ShowAuthors()
|
|
}
|
|
}
|
|
|
|
|
|
ui->textBrowser->setPlainText(QT_UTF8(text));
|
|
ui->textBrowser->setPlainText(QT_UTF8(text));
|
|
-
|
|
|
|
- ui->info->hide();
|
|
|
|
- ui->contribute->hide();
|
|
|
|
- ui->donate->hide();
|
|
|
|
- ui->getInvolved->hide();
|
|
|
|
- ui->textBrowser->show();
|
|
|
|
}
|
|
}
|
|
|
|
|
|
void OBSAbout::ShowLicense()
|
|
void OBSAbout::ShowLicense()
|
|
@@ -119,10 +164,4 @@ void OBSAbout::ShowLicense()
|
|
}
|
|
}
|
|
|
|
|
|
ui->textBrowser->setPlainText(QT_UTF8(text));
|
|
ui->textBrowser->setPlainText(QT_UTF8(text));
|
|
-
|
|
|
|
- ui->info->hide();
|
|
|
|
- ui->contribute->hide();
|
|
|
|
- ui->donate->hide();
|
|
|
|
- ui->getInvolved->hide();
|
|
|
|
- ui->textBrowser->show();
|
|
|
|
}
|
|
}
|