diff --git a/UI/CMakeLists.txt b/UI/CMakeLists.txt index f41448831..21717ec42 100644 --- a/UI/CMakeLists.txt +++ b/UI/CMakeLists.txt @@ -151,6 +151,7 @@ set(obs_SOURCES 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,6 +195,7 @@ set(obs_HEADERS window-basic-auto-config.hpp window-basic-main-outputs.hpp window-basic-source-select.hpp + window-basic-about.hpp window-license-agreement.hpp window-basic-status-bar.hpp window-basic-adv-audio.hpp @@ -228,7 +230,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 @@ -246,7 +249,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 +302,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..468bf24aa 100644 --- a/UI/data/locale/en-US.ini +++ b/UI/data/locale/en-US.ini @@ -544,6 +544,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 +858,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/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);