Merge pull request #1435 from cg2121/about-dialog

UI: Add about dialog
master
Jim 2018-09-07 18:18:54 -07:00 committed by GitHub
commit 461acd631c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 480 additions and 204 deletions

View File

@ -146,11 +146,11 @@ set(obs_SOURCES
window-basic-main-transitions.cpp
window-basic-main-dropfiles.cpp
window-basic-main-profiles.cpp
window-license-agreement.cpp
window-basic-status-bar.cpp
window-basic-adv-audio.cpp
window-basic-transform.cpp
window-basic-preview.cpp
window-basic-about.cpp
window-namedialog.cpp
window-log-reply.cpp
window-projector.cpp
@ -194,7 +194,7 @@ set(obs_HEADERS
window-basic-auto-config.hpp
window-basic-main-outputs.hpp
window-basic-source-select.hpp
window-license-agreement.hpp
window-basic-about.hpp
window-basic-status-bar.hpp
window-basic-adv-audio.hpp
window-basic-transform.hpp
@ -228,7 +228,8 @@ set(obs_HEADERS
source-label.hpp
remote-text.hpp
audio-encoders.hpp
qt-wrappers.hpp)
qt-wrappers.hpp
clickable-label.hpp)
set(obs_UI
forms/NameDialog.ui
@ -237,7 +238,6 @@ set(obs_UI
forms/AutoConfigStreamPage.ui
forms/AutoConfigTestPage.ui
forms/ColorSelect.ui
forms/OBSLicenseAgreement.ui
forms/OBSLogReply.ui
forms/OBSBasic.ui
forms/OBSBasicTransform.ui
@ -246,7 +246,8 @@ set(obs_UI
forms/OBSBasicSourceSelect.ui
forms/OBSBasicInteraction.ui
forms/OBSUpdate.ui
forms/OBSRemux.ui)
forms/OBSRemux.ui
forms/OBSAbout.ui)
set(obs_QRC
forms/obs.qrc)
@ -298,6 +299,7 @@ define_graphic_modules(obs)
install_obs_core(obs)
install_obs_data(obs data obs-studio)
install_obs_data_file(obs ../AUTHORS obs-studio/authors)
if (UNIX AND UNIX_STRUCTURE AND NOT APPLE)
install(FILES dist/obs.desktop DESTINATION ${CMAKE_INSTALL_FULL_DATAROOTDIR}/applications)

21
UI/clickable-label.hpp Normal file
View File

@ -0,0 +1,21 @@
#pragma once
#include <QLabel>
#include <QMouseEvent>
class ClickableLabel : public QLabel {
Q_OBJECT
public:
inline ClickableLabel(QWidget *parent = 0) : QLabel(parent) {}
signals:
void clicked();
protected:
void mousePressEvent(QMouseEvent *event)
{
emit clicked();
event->accept();
}
};

View File

@ -267,13 +267,6 @@ LogReturnDialog="Log Upload Successful"
LogReturnDialog.CopyURL="Copy URL"
LogReturnDialog.ErrorUploadingLog="Error uploading log file"
# license agreement dialog
LicenseAgreement="License Agreement"
LicenseAgreement.PleaseReview="Please review the license terms before using OBS. By using this program, you acknowledge that you have read and agree to the terms of the <a href='http://www.gnu.org/licenses/gpl-2.0.html'>GNU General Public License v2.0</a>. Please scroll down to see the rest of the agreement."
LicenseAgreement.ClickIAgreeToContinue="If you accept the terms of the agreement, click I Agree to continue. You must accept the agreement to use OBS."
LicenseAgreement.IAgree="I Agree"
LicenseAgreement.Exit="Exit"
# remux dialog
Remux.SourceFile="OBS Recording"
Remux.TargetFile="Target File"
@ -544,6 +537,7 @@ Basic.MainMenu.Help.CheckForUpdates="Check For Updates"
Basic.MainMenu.Help.CrashLogs="Crash &Reports"
Basic.MainMenu.Help.CrashLogs.ShowLogs="&Show Crash Reports"
Basic.MainMenu.Help.CrashLogs.UploadLastLog="Upload &Last Crash Report"
Basic.MainMenu.Help.About="&About"
# basic mode settings dialog
Basic.Settings.ProgramRestart="The program must be restarted for these settings to take effect."
@ -857,3 +851,12 @@ CustomColor="Custom Color"
# Global settings for the browser source
BrowserSource.EnableHardwareAcceleration="Enable Browser Source Hardware Acceleration"
# about dialog
About="About"
About.Info="OBS Studio is a free and open source video recording and live streaming software."
About.Donate="Make a Donation"
About.GetInvolved="Get Involved"
About.Authors="Authors"
About.License="License"
About.Contribute="Want to contribute?"

View File

@ -860,3 +860,23 @@ FocusList::item {
background: transparent;
min-height: 26px;
}
/* About dialog */
* [themeID="aboutName"] {
font-size: 36px;
font-weight: bold;
}
* [themeID="aboutVersion"] {
font-size: 16px;
margin-bottom: 20px;
}
* [themeID="aboutInfo"] {
margin-bottom: 20px;
}
* [themeID="aboutHLayout"] {
background-color: rgb(8, 8, 11);
}

View File

@ -636,3 +636,23 @@ QLabel#errorLabel {
color: rgb(0, 192, 0);
font-weight: bold;
}
/* About dialog */
* [themeID="aboutName"] {
font-size: 36px;
font-weight: bold;
}
* [themeID="aboutVersion"] {
font-size: 16px;
margin-bottom: 20px;
}
* [themeID="aboutInfo"] {
margin-bottom: 20px;
}
* [themeID="aboutHLayout"] {
background-color: rgb(31, 30, 31); /* veryDark */
}

View File

@ -115,3 +115,23 @@ QLabel#errorLabel {
color: rgb(0, 128, 0);
font-weight: bold;
}
/* About dialog */
* [themeID="aboutName"] {
font-size: 36px;
font-weight: bold;
}
* [themeID="aboutVersion"] {
font-size: 16px;
margin-bottom: 20px;
}
* [themeID="aboutInfo"] {
margin-bottom: 20px;
}
* [themeID="aboutHLayout"] {
background-color: rgb(169, 169, 169);
}

View File

@ -1214,3 +1214,23 @@ QToolTip {
background-color: rgb(49, 54, 59); /* Blue-gray */
color: rgb(240, 98, 146); /* Pink (Secondary) */
}
/* About dialog */
* [themeID="aboutName"] {
font-size: 36px;
font-weight: bold;
}
* [themeID="aboutVersion"] {
font-size: 16px;
margin-bottom: 20px;
}
* [themeID="aboutInfo"] {
margin-bottom: 20px;
}
* [themeID="aboutHLayout"] {
background-color: rgb(35, 38, 41); /* Dark Gray */
}

166
UI/forms/OBSAbout.ui Normal file
View File

@ -0,0 +1,166 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>OBSAbout</class>
<widget class="QDialog" name="OBSAbout">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>792</width>
<height>389</height>
</rect>
</property>
<property name="windowTitle">
<string>About</string>
</property>
<widget class="QLabel" name="icon">
<property name="geometry">
<rect>
<x>30</x>
<y>30</y>
<width>261</width>
<height>261</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap>:res/images/obs.png</pixmap>
</property>
</widget>
<widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>320</x>
<y>30</y>
<width>441</width>
<height>261</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="name">
<property name="text">
<string>OBS Studio</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="version">
<property name="text">
<string>Version</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="info">
<property name="text">
<string>About.Info</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="contribute">
<property name="text">
<string>Contribute</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="donate">
<property name="text">
<string>Donate</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="getInvolved">
<property name="text">
<string>Get Involved</string>
</property>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="textBrowser"/>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="horizontalLayoutWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>320</y>
<width>791</width>
<height>71</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="ClickableLabel" name="about">
<property name="text">
<string>About</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="ClickableLabel" name="authors">
<property name="text">
<string>Authors</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="ClickableLabel" name="license">
<property name="text">
<string>License</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<customwidgets>
<customwidget>
<class>ClickableLabel</class>
<extends>QLabel</extends>
<header>clickable-label.hpp</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@ -7,7 +7,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>1079</width>
<width>1238</width>
<height>730</height>
</rect>
</property>
@ -105,8 +105,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1079</width>
<height>21</height>
<width>1238</width>
<height>22</height>
</rect>
</property>
<widget class="QMenu" name="menu_File">
@ -152,6 +152,8 @@
<addaction name="menuCrashLogs"/>
<addaction name="separator"/>
<addaction name="actionCheckForUpdates"/>
<addaction name="actionShowAbout"/>
<addaction name="separator"/>
</widget>
<widget class="QMenu" name="menuBasic_MainMenu_Edit">
<property name="title">
@ -642,7 +644,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>230</width>
<width>78</width>
<height>16</height>
</rect>
</property>
@ -696,7 +698,7 @@
<x>0</x>
<y>0</y>
<width>16</width>
<height>230</height>
<height>28</height>
</rect>
</property>
<property name="sizePolicy">
@ -1683,6 +1685,11 @@
<string>Basic.Stats</string>
</property>
</action>
<action name="actionShowAbout">
<property name="text">
<string>Basic.MainMenu.Help.About</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>

View File

@ -1,108 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>OBSLicenseAgreement</class>
<widget class="QDialog" name="OBSLicenseAgreement">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>457</width>
<height>430</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>300</height>
</size>
</property>
<property name="windowTitle">
<string>LicenseAgreement</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="agreement">
<property name="text">
<string>LicenseAgreement.PleaseReview</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextBrowserInteraction</set>
</property>
</widget>
</item>
<item>
<widget class="QPlainTextEdit" name="license">
<property name="documentTitle">
<string/>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="plainText">
<string/>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item alignment="Qt::AlignHCenter|Qt::AlignVCenter">
<widget class="QWidget" name="widget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<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="QPushButton" name="agree">
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>agree</sender>
<signal>clicked()</signal>
<receiver>OBSLicenseAgreement</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>138</x>
<y>419</y>
</hint>
<hint type="destinationlabel">
<x>40</x>
<y>424</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -39,7 +39,6 @@
#include "obs-app.hpp"
#include "window-basic-main.hpp"
#include "window-basic-settings.hpp"
#include "window-license-agreement.hpp"
#include "crash-report.hpp"
#include "platform.hpp"
@ -1218,56 +1217,42 @@ bool OBSApp::OBSInit()
setAttribute(Qt::AA_UseHighDpiPixmaps);
bool licenseAccepted = config_get_bool(globalConfig, "General",
"LicenseAccepted");
OBSLicenseAgreement agreement(nullptr);
if (licenseAccepted || agreement.exec() == QDialog::Accepted) {
if (!licenseAccepted) {
config_set_bool(globalConfig, "General",
"LicenseAccepted", true);
config_save(globalConfig);
}
if (!StartupOBS(locale.c_str(), GetProfilerNameStore()))
return false;
if (!StartupOBS(locale.c_str(), GetProfilerNameStore()))
return false;
#ifdef _WIN32
bool browserHWAccel = config_get_bool(globalConfig, "General",
"BrowserHWAccel");
bool browserHWAccel = config_get_bool(globalConfig, "General",
"BrowserHWAccel");
obs_data_t *settings = obs_data_create();
obs_data_set_bool(settings, "BrowserHWAccel", browserHWAccel);
obs_apply_private_data(settings);
obs_data_release(settings);
obs_data_t *settings = obs_data_create();
obs_data_set_bool(settings, "BrowserHWAccel", browserHWAccel);
obs_apply_private_data(settings);
obs_data_release(settings);
blog(LOG_INFO, "Browser Hardware Acceleration: %s",
browserHWAccel ? "true" : "false");
blog(LOG_INFO, "Browser Hardware Acceleration: %s",
browserHWAccel ? "true" : "false");
#endif
blog(LOG_INFO, "Portable mode: %s",
portable_mode ? "true" : "false");
blog(LOG_INFO, "Portable mode: %s",
portable_mode ? "true" : "false");
setQuitOnLastWindowClosed(false);
setQuitOnLastWindowClosed(false);
mainWindow = new OBSBasic();
mainWindow = new OBSBasic();
mainWindow->setAttribute(Qt::WA_DeleteOnClose, true);
connect(mainWindow, SIGNAL(destroyed()), this, SLOT(quit()));
mainWindow->setAttribute(Qt::WA_DeleteOnClose, true);
connect(mainWindow, SIGNAL(destroyed()), this, SLOT(quit()));
mainWindow->OBSInit();
mainWindow->OBSInit();
connect(this, &QGuiApplication::applicationStateChanged,
[this](Qt::ApplicationState state)
{
ResetHotkeyState(
state != Qt::ApplicationActive);
});
ResetHotkeyState(applicationState() != Qt::ApplicationActive);
return true;
} else {
return false;
}
connect(this, &QGuiApplication::applicationStateChanged,
[this](Qt::ApplicationState state)
{
ResetHotkeyState(
state != Qt::ApplicationActive);
});
ResetHotkeyState(applicationState() != Qt::ApplicationActive);
return true;
}
string OBSApp::GetVersionString() const

120
UI/window-basic-about.cpp Normal file
View File

@ -0,0 +1,120 @@
#include "window-basic-about.hpp"
#include "window-basic-main.hpp"
#include "qt-wrappers.hpp"
#include <string>
#include <util/util.hpp>
#include <util/platform.h>
#include <platform.hpp>
OBSAbout::OBSAbout(QWidget *parent)
: QDialog(parent),
ui(new Ui::OBSAbout)
{
ui->setupUi(this);
QString bitness;
if(sizeof(void*) == 4)
bitness = " (32 bit)";
else if(sizeof(void*) == 8)
bitness = " (64 bit)";
ui->version->setText(
QString::number(LIBOBS_API_MAJOR_VER) + "." +
QString::number(LIBOBS_API_MINOR_VER) + "." +
QString::number(LIBOBS_API_PATCH_VER) +
bitness);
ui->contribute->setText(QTStr("About.Contribute"));
ui->donate->setText("<a href='https://obsproject.com/donate'>" +
QTStr("About.Donate") + "</a>");
ui->donate->setTextInteractionFlags(Qt::TextBrowserInteraction);
ui->donate->setOpenExternalLinks(true);
ui->getInvolved->setText("<a href='https://github.com/obsproject/obs-studio/blob/master/CONTRIBUTING.rst'>" +
QTStr("About.GetInvolved") + "</a>");
ui->getInvolved->setTextInteractionFlags(Qt::TextBrowserInteraction);
ui->getInvolved->setOpenExternalLinks(true);
ui->about->setText("<a href='#'>" + QTStr("About") + "</a>");
ui->authors->setText("<a href='#'>" + QTStr("About.Authors") + "</a>");
ui->license->setText("<a href='#'>" + QTStr("About.License") + "</a>");
ui->textBrowser->hide();
ui->name->setProperty("themeID", "aboutName");
ui->version->setProperty("themeID", "aboutVersion");
ui->about->setProperty("themeID", "aboutHLayout");
ui->authors->setProperty("themeID", "aboutHLayout");
ui->license->setProperty("themeID", "aboutHLayout");
ui->info->setProperty("themeID", "aboutInfo");
connect(ui->about, SIGNAL(clicked()), this, SLOT(ShowAbout()));
connect(ui->authors, SIGNAL(clicked()), this, SLOT(ShowAuthors()));
connect(ui->license, SIGNAL(clicked()), this, SLOT(ShowLicense()));
}
void OBSAbout::ShowAbout()
{
ui->textBrowser->hide();
ui->info->show();
ui->contribute->show();
ui->donate->show();
ui->getInvolved->show();
}
void OBSAbout::ShowAuthors()
{
std::string path;
QString error = "Error! File could not be read.\n\n \
Go to: https://github.com/obsproject/obs-studio/blob/master/AUTHORS";
if (!GetDataFilePath("authors/AUTHORS", path)) {
ui->textBrowser->setPlainText(error);
return;
}
ui->textBrowser->setPlainText(QString::fromStdString(path));
BPtr<char> text = os_quick_read_utf8_file(path.c_str());
if (!text || !*text) {
ui->textBrowser->setPlainText(error);
return;
}
ui->textBrowser->setPlainText(QT_UTF8(text));
ui->info->hide();
ui->contribute->hide();
ui->donate->hide();
ui->getInvolved->hide();
ui->textBrowser->show();
}
void OBSAbout::ShowLicense()
{
std::string path;
QString error = "Error! File could not be read.\n\n \
Go to: https://github.com/obsproject/obs-studio/blob/master/COPYING";
if (!GetDataFilePath("license/gplv2.txt", path)) {
ui->textBrowser->setPlainText(error);
return;
}
BPtr<char> text = os_quick_read_utf8_file(path.c_str());
if (!text || !*text) {
ui->textBrowser->setPlainText(error);
return;
}
ui->textBrowser->setPlainText(QT_UTF8(text));
ui->info->hide();
ui->contribute->hide();
ui->donate->hide();
ui->getInvolved->hide();
ui->textBrowser->show();
}

21
UI/window-basic-about.hpp Normal file
View File

@ -0,0 +1,21 @@
#pragma once
#include <memory>
#include <QDialog>
#include "ui_OBSAbout.h"
class OBSAbout : public QDialog {
Q_OBJECT
public:
explicit OBSAbout(QWidget *parent = 0);
private:
std::unique_ptr<Ui::OBSAbout> ui;
private slots:
void ShowAbout();
void ShowAuthors();
void ShowLicense();
};

View File

@ -2119,6 +2119,9 @@ OBSBasic::~OBSBasic()
if (advAudioWindow)
delete advAudioWindow;
if (about)
delete about;
obs_display_remove_draw_callback(ui->preview->GetDisplay(),
OBSBasic::RenderMain, this);
@ -6690,6 +6693,17 @@ void OBSBasic::on_stats_triggered()
stats = statsDlg;
}
void OBSBasic::on_actionShowAbout_triggered()
{
if (about)
about->close();
about = new OBSAbout(this);
about->show();
about->setAttribute(Qt::WA_DeleteOnClose, true);
}
ColorSelect::ColorSelect(QWidget *parent)
: QWidget(parent),
ui(new Ui::ColorSelect)

View File

@ -30,6 +30,7 @@
#include "window-basic-adv-audio.hpp"
#include "window-basic-filters.hpp"
#include "window-projector.hpp"
#include "window-basic-about.hpp"
#include <obs-frontend-internal.hpp>
@ -147,6 +148,7 @@ private:
QPointer<OBSBasicTransform> transformWindow;
QPointer<OBSBasicAdvAudio> advAudioWindow;
QPointer<OBSBasicFilters> filters;
QPointer<OBSAbout> about;
QPointer<QTimer> cpuUsageTimer;
os_cpu_usage_info_t *cpuUsageInfo = nullptr;
@ -477,6 +479,8 @@ private slots:
SourceTreeItem *GetItemWidgetFromSceneItem(obs_sceneitem_t *sceneItem);
void on_actionShowAbout_triggered();
private:
/* OBS Callbacks */
static void SceneReordered(void *data, calldata_t *params);

View File

@ -1,25 +0,0 @@
#include <string>
#include <util/util.hpp>
#include <util/platform.h>
#include <platform.hpp>
#include "window-license-agreement.hpp"
#include "qt-wrappers.hpp"
using namespace std;
OBSLicenseAgreement::OBSLicenseAgreement(QWidget *parent)
: QDialog (parent),
ui (new Ui::OBSLicenseAgreement)
{
ui->setupUi(this);
string path;
if (!GetDataFilePath("license/gplv2.txt", path))
throw "Could not find license file";
BPtr<char> licenseText = os_quick_read_utf8_file(path.c_str());
if (!licenseText || !*licenseText || strlen(licenseText) < 1000)
throw "Invalid license file data";
ui->license->setPlainText(QT_UTF8(licenseText));
}

View File

@ -1,14 +0,0 @@
#pragma once
#include <memory>
#include "ui_OBSLicenseAgreement.h"
class OBSLicenseAgreement : public QDialog {
Q_OBJECT
private:
std::unique_ptr<Ui::OBSLicenseAgreement> ui;
public:
OBSLicenseAgreement(QWidget *parent);
};