diff --git a/UI/CMakeLists.txt b/UI/CMakeLists.txt index f41448831..37e74745d 100644 --- a/UI/CMakeLists.txt +++ b/UI/CMakeLists.txt @@ -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) diff --git a/UI/clickable-label.hpp b/UI/clickable-label.hpp new file mode 100644 index 000000000..3c76a8b4c --- /dev/null +++ b/UI/clickable-label.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include +#include + +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(); + } +}; diff --git a/UI/data/locale/en-US.ini b/UI/data/locale/en-US.ini index ca6d6a740..b2cdaf3dd 100644 --- a/UI/data/locale/en-US.ini +++ b/UI/data/locale/en-US.ini @@ -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 GNU General Public License v2.0. 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?" diff --git a/UI/data/themes/Acri.qss b/UI/data/themes/Acri.qss index ca9637ee5..be52cd3df 100644 --- a/UI/data/themes/Acri.qss +++ b/UI/data/themes/Acri.qss @@ -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); +} diff --git a/UI/data/themes/Dark.qss b/UI/data/themes/Dark.qss index 934706a42..aa3197518 100644 --- a/UI/data/themes/Dark.qss +++ b/UI/data/themes/Dark.qss @@ -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 */ +} diff --git a/UI/data/themes/Default.qss b/UI/data/themes/Default.qss index 37f4b2063..5a2929ab7 100644 --- a/UI/data/themes/Default.qss +++ b/UI/data/themes/Default.qss @@ -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); +} diff --git a/UI/data/themes/Rachni.qss b/UI/data/themes/Rachni.qss index e5a836283..8e996a7d3 100644 --- a/UI/data/themes/Rachni.qss +++ b/UI/data/themes/Rachni.qss @@ -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 */ +} diff --git a/UI/forms/OBSAbout.ui b/UI/forms/OBSAbout.ui new file mode 100644 index 000000000..4679f1799 --- /dev/null +++ b/UI/forms/OBSAbout.ui @@ -0,0 +1,166 @@ + + + OBSAbout + + + + 0 + 0 + 792 + 389 + + + + About + + + + + 30 + 30 + 261 + 261 + + + + + + + :res/images/obs.png + + + + + + 320 + 30 + 441 + 261 + + + + + 0 + + + + + OBS Studio + + + + + + + Version + + + + + + + About.Info + + + true + + + + + + + Contribute + + + true + + + + + + + Donate + + + + + + + Get Involved + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + 0 + 320 + 791 + 71 + + + + + 0 + + + + + About + + + Qt::AlignCenter + + + + + + + Authors + + + Qt::AlignCenter + + + + + + + License + + + Qt::AlignCenter + + + + + + + + + ClickableLabel + QLabel +
clickable-label.hpp
+
+
+ + +
diff --git a/UI/forms/OBSBasic.ui b/UI/forms/OBSBasic.ui index 77d53d326..fcd88076a 100644 --- a/UI/forms/OBSBasic.ui +++ b/UI/forms/OBSBasic.ui @@ -7,7 +7,7 @@ 0 0 - 1079 + 1238 730 @@ -105,8 +105,8 @@ 0 0 - 1079 - 21 + 1238 + 22 @@ -152,6 +152,8 @@ + + @@ -642,7 +644,7 @@ 0 0 - 230 + 78 16 @@ -696,7 +698,7 @@ 0 0 16 - 230 + 28 @@ -1683,6 +1685,11 @@ Basic.Stats + + + Basic.MainMenu.Help.About + + diff --git a/UI/forms/OBSLicenseAgreement.ui b/UI/forms/OBSLicenseAgreement.ui deleted file mode 100644 index e9c2d4970..000000000 --- a/UI/forms/OBSLicenseAgreement.ui +++ /dev/null @@ -1,108 +0,0 @@ - - - OBSLicenseAgreement - - - - 0 - 0 - 457 - 430 - - - - - 200 - 300 - - - - LicenseAgreement - - - - - - LicenseAgreement.PleaseReview - - - Qt::RichText - - - true - - - true - - - Qt::TextBrowserInteraction - - - - - - - - - - true - - - - - - - - - - Qt::Horizontal - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - OK - - - - - - - - - - - - agree - clicked() - OBSLicenseAgreement - accept() - - - 138 - 419 - - - 40 - 424 - - - - - diff --git a/UI/obs-app.cpp b/UI/obs-app.cpp index 35f224c2f..d6d6710b0 100644 --- a/UI/obs-app.cpp +++ b/UI/obs-app.cpp @@ -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 diff --git a/UI/window-basic-about.cpp b/UI/window-basic-about.cpp new file mode 100644 index 000000000..24a10e4d9 --- /dev/null +++ b/UI/window-basic-about.cpp @@ -0,0 +1,120 @@ +#include "window-basic-about.hpp" +#include "window-basic-main.hpp" +#include "qt-wrappers.hpp" +#include +#include +#include +#include + +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("" + + QTStr("About.Donate") + ""); + ui->donate->setTextInteractionFlags(Qt::TextBrowserInteraction); + ui->donate->setOpenExternalLinks(true); + + ui->getInvolved->setText("" + + QTStr("About.GetInvolved") + ""); + ui->getInvolved->setTextInteractionFlags(Qt::TextBrowserInteraction); + ui->getInvolved->setOpenExternalLinks(true); + + ui->about->setText("" + QTStr("About") + ""); + ui->authors->setText("" + QTStr("About.Authors") + ""); + ui->license->setText("" + QTStr("About.License") + ""); + + 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 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 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(); +} diff --git a/UI/window-basic-about.hpp b/UI/window-basic-about.hpp new file mode 100644 index 000000000..3a21bbe67 --- /dev/null +++ b/UI/window-basic-about.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include +#include + +#include "ui_OBSAbout.h" + +class OBSAbout : public QDialog { + Q_OBJECT + +public: + explicit OBSAbout(QWidget *parent = 0); + +private: + std::unique_ptr ui; + +private slots: + void ShowAbout(); + void ShowAuthors(); + void ShowLicense(); +}; diff --git a/UI/window-basic-main.cpp b/UI/window-basic-main.cpp index fd5e2245b..6ccf5d6d4 100644 --- a/UI/window-basic-main.cpp +++ b/UI/window-basic-main.cpp @@ -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) diff --git a/UI/window-basic-main.hpp b/UI/window-basic-main.hpp index 24e0036e9..360708f62 100644 --- a/UI/window-basic-main.hpp +++ b/UI/window-basic-main.hpp @@ -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 @@ -147,6 +148,7 @@ private: QPointer transformWindow; QPointer advAudioWindow; QPointer filters; + QPointer about; QPointer 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); diff --git a/UI/window-license-agreement.cpp b/UI/window-license-agreement.cpp deleted file mode 100644 index a7a5f3b33..000000000 --- a/UI/window-license-agreement.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include -#include -#include -#include -#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 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)); -} diff --git a/UI/window-license-agreement.hpp b/UI/window-license-agreement.hpp deleted file mode 100644 index aa3a6f45b..000000000 --- a/UI/window-license-agreement.hpp +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include -#include "ui_OBSLicenseAgreement.h" - -class OBSLicenseAgreement : public QDialog { - Q_OBJECT - -private: - std::unique_ptr ui; - -public: - OBSLicenseAgreement(QWidget *parent); -};