فهرست منبع

UI: Make sure all message box buttons are translated

Instead of QMessageBox::question and QMessageBox::information, use the
OBSMessageBox class, which translates all buttons.
jp9000 8 سال پیش
والد
کامیت
522f5cdf3b

+ 2 - 1
UI/win-update/win-update.cpp

@@ -1,6 +1,7 @@
 #include "win-update-helpers.hpp"
 #include "update-window.hpp"
 #include "remote-text.hpp"
+#include "qt-wrappers.hpp"
 #include "win-update.hpp"
 #include "obs-app.hpp"
 
@@ -479,7 +480,7 @@ void GenerateGUID(string &guid)
 
 void AutoUpdateThread::infoMsg(const QString &title, const QString &text)
 {
-	QMessageBox::information(App()->GetMainWindow(), title, text);
+	OBSMessageBox::information(App()->GetMainWindow(), title, text);
 }
 
 void AutoUpdateThread::info(const QString &title, const QString &text)

+ 1 - 1
UI/window-basic-auto-config.cpp

@@ -330,7 +330,7 @@ bool AutoConfigStreamPage::validatePage()
 	if (wiz->service != AutoConfig::Service::Twitch && wiz->bandwidthTest) {
 		QMessageBox::StandardButton button;
 #define WARNING_TEXT(x) QTStr("Basic.AutoConfig.StreamPage.StreamWarning." x)
-		button = QMessageBox::question(this,
+		button = OBSMessageBox::question(this,
 				WARNING_TEXT("Title"),
 				WARNING_TEXT("Text"));
 #undef WARNING_TEXT

+ 4 - 4
UI/window-basic-filters.cpp

@@ -365,7 +365,7 @@ void OBSBasicFilters::AddNewFilter(const char *id)
 			return;
 
 		if (name.empty()) {
-			QMessageBox::information(this,
+			OBSMessageBox::information(this,
 					QTStr("NoNameEntered.Title"),
 					QTStr("NoNameEntered.Text"));
 			AddNewFilter(id);
@@ -375,7 +375,7 @@ void OBSBasicFilters::AddNewFilter(const char *id)
 		existing_filter = obs_source_get_filter_by_name(source,
 				name.c_str());
 		if (existing_filter) {
-			QMessageBox::information(this,
+			OBSMessageBox::information(this,
 					QTStr("NameExists.Title"),
 					QTStr("NameExists.Text"));
 			obs_source_release(existing_filter);
@@ -678,13 +678,13 @@ void OBSBasicFilters::FilterNameEdited(QWidget *editor, QListWidget *list)
 		listItem->setText(QT_UTF8(prevName));
 
 		if (foundFilter) {
-			QMessageBox::information(window(),
+			OBSMessageBox::information(window(),
 				QTStr("NameExists.Title"),
 				QTStr("NameExists.Text"));
 			obs_source_release(foundFilter);
 
 		} else if (name.empty()) {
-			QMessageBox::information(window(),
+			OBSMessageBox::information(window(),
 				QTStr("NoNameEntered.Title"),
 				QTStr("NoNameEntered.Text"));
 		}

+ 3 - 2
UI/window-basic-main-outputs.cpp

@@ -1,6 +1,7 @@
 #include <string>
 #include <algorithm>
 #include <QMessageBox>
+#include "qt-wrappers.hpp"
 #include "audio-encoders.hpp"
 #include "window-basic-main.hpp"
 #include "window-basic-main-outputs.hpp"
@@ -778,7 +779,7 @@ bool SimpleOutput::ConfigureRecording(bool updateReplayBuffer)
 
 	if (!dir) {
 		if (main->isVisible())
-			QMessageBox::information(main,
+			OBSMessageBox::information(main,
 					QTStr("Output.BadPath.Title"),
 					QTStr("Output.BadPath.Text"));
 		else
@@ -1398,7 +1399,7 @@ bool AdvancedOutput::StartRecording()
 
 		if (!dir) {
 			if (main->isVisible())
-				QMessageBox::information(main,
+				OBSMessageBox::information(main,
 						QTStr("Output.BadPath.Title"),
 						QTStr("Output.BadPath.Text"));
 			else

+ 4 - 4
UI/window-basic-main-profiles.cpp

@@ -102,13 +102,13 @@ static bool GetProfileName(QWidget *parent, std::string &name,
 			return false;
 		}
 		if (name.empty()) {
-			QMessageBox::information(parent,
+			OBSMessageBox::information(parent,
 					QTStr("NoNameEntered.Title"),
 					QTStr("NoNameEntered.Text"));
 			continue;
 		}
 		if (ProfileExists(name.c_str())) {
-			QMessageBox::information(parent,
+			OBSMessageBox::information(parent,
 					QTStr("NameExists.Title"),
 					QTStr("NameExists.Text"));
 			continue;
@@ -407,7 +407,7 @@ void OBSBasic::on_actionRemoveProfile_triggered()
 	QString text = QTStr("ConfirmRemove.Text");
 	text.replace("$1", QT_UTF8(oldName.c_str()));
 
-	QMessageBox::StandardButton button = QMessageBox::question(this,
+	QMessageBox::StandardButton button = OBSMessageBox::question(this,
 			QTStr("ConfirmRemove.Title"), text);
 	if (button == QMessageBox::No)
 		return;
@@ -487,7 +487,7 @@ void OBSBasic::on_actionImportProfile_triggered()
 					profileDir + "/recordEncoder.json");
 			RefreshProfiles();
 		} else {
-			QMessageBox::information(this,
+			OBSMessageBox::information(this,
 					QTStr("Basic.MainMenu.Profile.Import"),
 					QTStr("Basic.MainMenu.Profile.Exists"));
 		}

+ 4 - 4
UI/window-basic-main-scene-collections.cpp

@@ -114,13 +114,13 @@ static bool GetSceneCollectionName(QWidget *parent, std::string &name,
 			return false;
 		}
 		if (name.empty()) {
-			QMessageBox::information(parent,
+			OBSMessageBox::information(parent,
 					QTStr("NoNameEntered.Title"),
 					QTStr("NoNameEntered.Text"));
 			continue;
 		}
 		if (SceneCollectionExists(name.c_str())) {
-			QMessageBox::information(parent,
+			OBSMessageBox::information(parent,
 					QTStr("NameExists.Title"),
 					QTStr("NameExists.Text"));
 			continue;
@@ -317,7 +317,7 @@ void OBSBasic::on_actionRemoveSceneCollection_triggered()
 	QString text = QTStr("ConfirmRemove.Text");
 	text.replace("$1", QT_UTF8(oldName.c_str()));
 
-	QMessageBox::StandardButton button = QMessageBox::question(this,
+	QMessageBox::StandardButton button = OBSMessageBox::question(this,
 			QTStr("ConfirmRemove.Title"), text);
 	if (button == QMessageBox::No)
 		return;
@@ -382,7 +382,7 @@ void OBSBasic::on_actionImportSceneCollection_triggered()
 			QFile::copy(file, path + filename);
 			RefreshSceneCollections();
 		} else {
-			QMessageBox::information(this,
+			OBSMessageBox::information(this,
 				QTStr("Basic.MainMenu.SceneCollection.Import"),
 				QTStr("Basic.MainMenu.SceneCollection.Exists"));
 		}

+ 4 - 4
UI/window-basic-main-transitions.cpp

@@ -364,7 +364,7 @@ void OBSBasic::AddTransition()
 
 	if (accepted) {
 		if (name.empty()) {
-			QMessageBox::information(this,
+			OBSMessageBox::information(this,
 					QTStr("NoNameEntered.Title"),
 					QTStr("NoNameEntered.Text"));
 			AddTransition();
@@ -373,7 +373,7 @@ void OBSBasic::AddTransition()
 
 		source = FindTransition(name.c_str());
 		if (source) {
-			QMessageBox::information(this,
+			OBSMessageBox::information(this,
 					QTStr("NameExists.Title"),
 					QTStr("NameExists.Text"));
 
@@ -464,7 +464,7 @@ void OBSBasic::RenameTransition()
 
 	if (accepted) {
 		if (name.empty()) {
-			QMessageBox::information(this,
+			OBSMessageBox::information(this,
 					QTStr("NoNameEntered.Title"),
 					QTStr("NoNameEntered.Text"));
 			RenameTransition();
@@ -473,7 +473,7 @@ void OBSBasic::RenameTransition()
 
 		source = FindTransition(name.c_str());
 		if (source) {
-			QMessageBox::information(this,
+			OBSMessageBox::information(this,
 					QTStr("NameExists.Title"),
 					QTStr("NameExists.Text"));
 

+ 22 - 22
UI/window-basic-main.cpp

@@ -1443,14 +1443,14 @@ void OBSBasic::OBSInit()
 		msg += QTStr("Basic.FirstStartup.RunWizard.BetaWarning");
 
 		QMessageBox::StandardButton button =
-			QMessageBox::question(this, QTStr("Basic.AutoConfig"),
+			OBSMessageBox::question(this, QTStr("Basic.AutoConfig"),
 					msg);
 
 		if (button == QMessageBox::Yes) {
 			on_autoConfigure_triggered();
 		} else {
 			msg = QTStr("Basic.FirstStartup.RunWizard.NoClicked");
-			QMessageBox::information(this,
+			OBSMessageBox::information(this,
 					QTStr("Basic.AutoConfig"), msg);
 		}
 	}
@@ -2196,7 +2196,7 @@ bool OBSBasic::QueryRemoveSource(obs_source_t *source)
 		int count = ui->scenes->count();
 
 		if (count == 1) {
-			QMessageBox::information(this,
+			OBSMessageBox::information(this,
 						QTStr("FinalScene.Title"),
 						QTStr("FinalScene.Text"));
 			return false;
@@ -2306,7 +2306,7 @@ void OBSBasic::DuplicateSelectedScene()
 			return;
 
 		if (name.empty()) {
-			QMessageBox::information(this,
+			OBSMessageBox::information(this,
 					QTStr("NoNameEntered.Title"),
 					QTStr("NoNameEntered.Text"));
 			continue;
@@ -2314,7 +2314,7 @@ void OBSBasic::DuplicateSelectedScene()
 
 		obs_source_t *source = obs_get_source_by_name(name.c_str());
 		if (source) {
-			QMessageBox::information(this,
+			OBSMessageBox::information(this,
 					QTStr("NameExists.Title"),
 					QTStr("NameExists.Text"));
 
@@ -2941,7 +2941,7 @@ void OBSBasic::closeEvent(QCloseEvent *event)
 	if (outputHandler && outputHandler->Active()) {
 		SetShowing(true);
 
-		QMessageBox::StandardButton button = QMessageBox::question(
+		QMessageBox::StandardButton button = OBSMessageBox::question(
 				this, QTStr("ConfirmExit.Title"),
 				QTStr("ConfirmExit.Text"));
 
@@ -3161,7 +3161,7 @@ void OBSBasic::on_actionAddScene_triggered()
 
 	if (accepted) {
 		if (name.empty()) {
-			QMessageBox::information(this,
+			OBSMessageBox::information(this,
 					QTStr("NoNameEntered.Title"),
 					QTStr("NoNameEntered.Text"));
 			on_actionAddScene_triggered();
@@ -3170,7 +3170,7 @@ void OBSBasic::on_actionAddScene_triggered()
 
 		obs_source_t *source = obs_get_source_by_name(name.c_str());
 		if (source) {
-			QMessageBox::information(this,
+			OBSMessageBox::information(this,
 					QTStr("NameExists.Title"),
 					QTStr("NameExists.Text"));
 
@@ -3592,7 +3592,7 @@ void OBSBasic::AddSourcePopupMenu(const QPoint &pos)
 {
 	if (!GetCurrentScene()) {
 		// Tell the user he needs a scene first (help beginners).
-		QMessageBox::information(this,
+		OBSMessageBox::information(this,
 				QTStr("Basic.Main.AddSourceHelp.Title"),
 				QTStr("Basic.Main.AddSourceHelp.Text"));
 		return;
@@ -3827,7 +3827,7 @@ void OBSBasic::logUploadFinished(const QString &text, const QString &error)
 	ui->menuLogFiles->setEnabled(true);
 
 	if (text.isEmpty()) {
-		QMessageBox::information(this,
+		OBSMessageBox::information(this,
 				QTStr("LogReturnDialog.ErrorUploadingLog"),
 				error);
 		return;
@@ -3855,11 +3855,11 @@ static void RenameListItem(OBSBasic *parent, QListWidget *listWidget,
 		listItem->setText(QT_UTF8(prevName));
 
 		if (foundSource) {
-			QMessageBox::information(parent,
+			OBSMessageBox::information(parent,
 				QTStr("NameExists.Title"),
 				QTStr("NameExists.Text"));
 		} else if (name.empty()) {
-			QMessageBox::information(parent,
+			OBSMessageBox::information(parent,
 				QTStr("NoNameEntered.Title"),
 				QTStr("NoNameEntered.Text"));
 		}
@@ -4206,7 +4206,7 @@ void OBSBasic::StreamingStop(int code)
 	blog(LOG_INFO, STREAMING_STOP);
 
 	if (code != OBS_OUTPUT_SUCCESS && isVisible()) {
-		QMessageBox::information(this,
+		OBSMessageBox::information(this,
 				QTStr("Output.ConnectFail.Title"),
 				QT_UTF8(errorMessage));
 	} else if (code != OBS_OUTPUT_SUCCESS && !isVisible()) {
@@ -4284,17 +4284,17 @@ void OBSBasic::RecordingStop(int code)
 	blog(LOG_INFO, RECORDING_STOP);
 
 	if (code == OBS_OUTPUT_UNSUPPORTED && isVisible()) {
-		QMessageBox::information(this,
+		OBSMessageBox::information(this,
 				QTStr("Output.RecordFail.Title"),
 				QTStr("Output.RecordFail.Unsupported"));
 
 	} else if (code == OBS_OUTPUT_NO_SPACE && isVisible()) {
-		QMessageBox::information(this,
+		OBSMessageBox::information(this,
 				QTStr("Output.RecordNoSpace.Title"),
 				QTStr("Output.RecordNoSpace.Msg"));
 
 	} else if (code != OBS_OUTPUT_SUCCESS && isVisible()) {
-		QMessageBox::information(this,
+		OBSMessageBox::information(this,
 				QTStr("Output.RecordError.Title"),
 				QTStr("Output.RecordError.Msg"));
 
@@ -4338,7 +4338,7 @@ void OBSBasic::StartReplayBuffer()
 	obs_data_release(hotkeys);
 
 	if (!count) {
-		QMessageBox::information(this,
+		OBSMessageBox::information(this,
 				RP_NO_HOTKEY_TITLE,
 				RP_NO_HOTKEY_TEXT);
 		return;
@@ -4411,17 +4411,17 @@ void OBSBasic::ReplayBufferStop(int code)
 	blog(LOG_INFO, REPLAY_BUFFER_STOP);
 
 	if (code == OBS_OUTPUT_UNSUPPORTED && isVisible()) {
-		QMessageBox::information(this,
+		OBSMessageBox::information(this,
 				QTStr("Output.RecordFail.Title"),
 				QTStr("Output.RecordFail.Unsupported"));
 
 	} else if (code == OBS_OUTPUT_NO_SPACE && isVisible()) {
-		QMessageBox::information(this,
+		OBSMessageBox::information(this,
 				QTStr("Output.RecordNoSpace.Title"),
 				QTStr("Output.RecordNoSpace.Msg"));
 
 	} else if (code != OBS_OUTPUT_SUCCESS && isVisible()) {
-		QMessageBox::information(this,
+		OBSMessageBox::information(this,
 				QTStr("Output.RecordError.Title"),
 				QTStr("Output.RecordError.Msg"));
 
@@ -4452,7 +4452,7 @@ void OBSBasic::on_streamButton_clicked()
 
 		if (confirm && isVisible()) {
 			QMessageBox::StandardButton button =
-				QMessageBox::question(this,
+				OBSMessageBox::question(this,
 						QTStr("ConfirmStop.Title"),
 						QTStr("ConfirmStop.Text"));
 
@@ -4467,7 +4467,7 @@ void OBSBasic::on_streamButton_clicked()
 
 		if (confirm && isVisible()) {
 			QMessageBox::StandardButton button =
-				QMessageBox::question(this,
+				OBSMessageBox::question(this,
 						QTStr("ConfirmStart.Title"),
 						QTStr("ConfirmStart.Text"));
 

+ 1 - 1
UI/window-basic-properties.cpp

@@ -265,7 +265,7 @@ bool OBSBasicProperties::ConfirmQuit()
 {
 	QMessageBox::StandardButton button;
 
-	button = QMessageBox::question(this,
+	button = OBSMessageBox::question(this,
 			QTStr("Basic.PropertiesWindow.ConfirmTitle"),
 			QTStr("Basic.PropertiesWindow.Confirm"),
 			QMessageBox::Save | QMessageBox::Discard |

+ 3 - 4
UI/window-basic-settings.cpp

@@ -3006,7 +3006,7 @@ bool OBSBasicSettings::QueryChanges()
 {
 	QMessageBox::StandardButton button;
 
-	button = QMessageBox::question(this,
+	button = OBSMessageBox::question(this,
 			QTStr("Basic.Settings.ConfirmTitle"),
 			QTStr("Basic.Settings.Confirm"),
 			QMessageBox::Yes | QMessageBox::No |
@@ -3871,10 +3871,9 @@ void OBSBasicSettings::SimpleRecordingQualityLosslessWarning(int idx)
 			QString("\n\n") +
 			SIMPLE_OUTPUT_WARNING("Lossless.Msg");
 
-		button = QMessageBox::question(this,
+		button = OBSMessageBox::question(this,
 				SIMPLE_OUTPUT_WARNING("Lossless.Title"),
-				warningString,
-				QMessageBox::Yes | QMessageBox::No);
+				warningString);
 
 		if (button == QMessageBox::No) {
 			QMetaObject::invokeMethod(ui->simpleOutRecQuality,

+ 2 - 2
UI/window-basic-source-select.cpp

@@ -154,7 +154,7 @@ bool AddNew(QWidget *parent, const char *id, const char *name,
 
 	obs_source_t *source = obs_get_source_by_name(name);
 	if (source) {
-		QMessageBox::information(parent,
+		OBSMessageBox::information(parent,
 				QTStr("NameExists.Title"),
 				QTStr("NameExists.Text"));
 
@@ -190,7 +190,7 @@ void OBSBasicSourceSelect::on_buttonBox_accepted()
 		AddExisting(QT_TO_UTF8(item->text()), visible, false);
 	} else {
 		if (ui->sourceName->text().isEmpty()) {
-			QMessageBox::information(this,
+			OBSMessageBox::information(this,
 					QTStr("NoNameEntered.Title"),
 					QTStr("NoNameEntered.Text"));
 			return;

+ 3 - 4
UI/window-remux.cpp

@@ -157,9 +157,8 @@ void OBSRemux::BrowseOutput()
 void OBSRemux::Remux()
 {
 	if (QFileInfo::exists(ui->targetFile->text()))
-		if (QMessageBox::question(this, QTStr("Remux.FileExistsTitle"),
-					QTStr("Remux.FileExists"),
-					QMessageBox::Yes | QMessageBox::No) !=
+		if (OBSMessageBox::question(this, QTStr("Remux.FileExistsTitle"),
+					QTStr("Remux.FileExists")) !=
 				QMessageBox::Yes)
 			return;
 
@@ -201,7 +200,7 @@ void OBSRemux::updateProgress(float percent)
 
 void OBSRemux::remuxFinished(bool success)
 {
-	QMessageBox::information(this, QTStr("Remux.FinishedTitle"),
+	OBSMessageBox::information(this, QTStr("Remux.FinishedTitle"),
 			success ?
 			QTStr("Remux.Finished") : QTStr("Remux.FinishedError"));