From cfaf0d32af27ba9353718cf9378d425882518496 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Thu, 15 May 2014 14:04:18 -0700 Subject: [PATCH] UI: Add name/version to window title Also, make the 'start stream' button say 'connecting...' when it's initially trying to connect. --- build/data/obs-studio/locale/en.txt | 1 + obs/obs-app.cpp | 16 ++++++++++++++++ obs/obs-app.hpp | 2 ++ obs/window-basic-main.cpp | 12 +++++++++++- 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/build/data/obs-studio/locale/en.txt b/build/data/obs-studio/locale/en.txt index 50144c13d..dc31809e6 100644 --- a/build/data/obs-studio/locale/en.txt +++ b/build/data/obs-studio/locale/en.txt @@ -64,6 +64,7 @@ Basic.Main.AddSourceHelp.Text="You need to have at least 1 scene to add a source # basic mode main window Basic.Main.Scenes="Scenes" Basic.Main.Sources="Sources" +Basic.Main.Connecting="Connecting..." Basic.Main.StartRecording="Start Recording" Basic.Main.StartStreaming="Start Streaming" Basic.Main.StopRecording="Stop Recording" diff --git a/obs/obs-app.cpp b/obs/obs-app.cpp index 497e094f9..75c376c55 100644 --- a/obs/obs-app.cpp +++ b/obs/obs-app.cpp @@ -201,6 +201,22 @@ void OBSApp::OBSInit() mainWindow->OBSInit(); } +string OBSApp::GetVersionString() const +{ + stringstream ver; + ver << "v" << + LIBOBS_API_MAJOR_VER << "." << + LIBOBS_API_MINOR_VER << "." << + LIBOBS_API_PATCH_VER; + + if (sizeof(void*) == 8) + ver << " (64bit)"; + else + ver << " (32bit)"; + + return ver.str(); +} + #ifdef __APPLE__ #define INPUT_AUDIO_SOURCE "coreaudio_input_capture" #define OUTPUT_AUDIO_SOURCE "coreaudio_output_capture" diff --git a/obs/obs-app.hpp b/obs/obs-app.hpp index bf7039c4f..f7da76e6d 100644 --- a/obs/obs-app.hpp +++ b/obs/obs-app.hpp @@ -69,6 +69,8 @@ public: return textLookup.GetString(lookupVal); } + std::string GetVersionString() const; + const char *InputAudioSource() const; const char *OutputAudioSource() const; diff --git a/obs/window-basic-main.cpp b/obs/window-basic-main.cpp index df63cefc1..01a007c15 100644 --- a/obs/window-basic-main.cpp +++ b/obs/window-basic-main.cpp @@ -1,6 +1,6 @@ /****************************************************************************** Copyright (C) 2013-2014 by Hugh Bailey - Copyright (C) 2014 by Zachary Lund + Zachary Lund 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 @@ -66,6 +66,11 @@ OBSBasic::OBSBasic(QWidget *parent) if (obs_get_video_info(&ovi)) ResizePreview(ovi.base_width, ovi.base_height); }); + + stringstream name; + name << "OBS " << App()->GetVersionString(); + + setWindowTitle(QT_UTF8(name.str().c_str())); } static void SaveAudioDevice(const char *name, int channel, obs_data_t parent) @@ -1129,6 +1134,7 @@ void OBSBasic::on_actionSourceDown_triggered() void OBSBasic::StreamingStart() { ui->streamButton->setText("Stop Streaming"); + ui->streamButton->setEnabled(true); } void OBSBasic::StreamingStop(int code) @@ -1159,6 +1165,7 @@ void OBSBasic::StreamingStop(int code) } ui->streamButton->setText(QTStr("Basic.Main.StartStreaming")); + ui->streamButton->setEnabled(true); if (code != OBS_OUTPUT_SUCCESS) QMessageBox::information(this, @@ -1180,6 +1187,9 @@ void OBSBasic::on_streamButton_clicked() int audioBitrate = config_get_uint(basicConfig, "SimpleOutput", "ABitrate"); + ui->streamButton->setEnabled(false); + ui->streamButton->setText(QTStr("Basic.Main.Connecting")); + SaveService(); obs_data_setint(x264Settings, "bitrate", videoBitrate);