mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-09-10 10:35:59 -05:00
add warning if translation cannot be found (#99)
* add warning if translation cannot be found * extract displaying message boxes to separate function
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#include <QtGui/qstandarditemmodel.h>
|
||||
#include <QPropertyAnimation>
|
||||
#include <QGraphicsColorizeEffect>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <obs-module.h>
|
||||
#include <obs-frontend-api.h>
|
||||
@@ -28,8 +29,19 @@ AdvSceneSwitcher::AdvSceneSwitcher(QWidget *parent)
|
||||
loadUI();
|
||||
}
|
||||
|
||||
bool translationAvailable()
|
||||
{
|
||||
return !!strcmp(obs_module_text("AdvSceneSwitcher.pluginName"),
|
||||
"AdvSceneSwitcher.pluginName");
|
||||
}
|
||||
|
||||
void AdvSceneSwitcher::loadUI()
|
||||
{
|
||||
if (!translationAvailable()) {
|
||||
DisplayMessage("Failed to find plug-in's 'data' directory.\n"
|
||||
"Please check installation instructions!");
|
||||
}
|
||||
|
||||
#if __APPLE__
|
||||
setMinimumHeight(700);
|
||||
#endif
|
||||
@@ -55,6 +67,13 @@ void AdvSceneSwitcher::loadUI()
|
||||
/********************************************************************************
|
||||
* UI helpers
|
||||
********************************************************************************/
|
||||
void AdvSceneSwitcher::DisplayMessage(QString msg)
|
||||
{
|
||||
QMessageBox Msgbox;
|
||||
Msgbox.setWindowTitle("Advanced Scene Switcher");
|
||||
Msgbox.setText(msg);
|
||||
Msgbox.exec();
|
||||
}
|
||||
|
||||
void addSelectionEntry(QComboBox *sel, const char *description,
|
||||
const char *tooltip = "")
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
#include "headers/utility.hpp"
|
||||
@@ -349,10 +348,8 @@ void AdvSceneSwitcher::on_importSettings_clicked()
|
||||
file.fileName().toUtf8().constData());
|
||||
|
||||
if (!obj) {
|
||||
QMessageBox Msgbox;
|
||||
Msgbox.setText(obs_module_text(
|
||||
DisplayMessage(obs_module_text(
|
||||
"AdvSceneSwitcher.generalTab.saveOrLoadsettings.loadFail"));
|
||||
Msgbox.exec();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -373,10 +370,8 @@ void AdvSceneSwitcher::on_importSettings_clicked()
|
||||
|
||||
obs_data_release(obj);
|
||||
|
||||
QMessageBox Msgbox;
|
||||
Msgbox.setText(obs_module_text(
|
||||
DisplayMessage(obs_module_text(
|
||||
"AdvSceneSwitcher.generalTab.saveOrLoadsettings.loadSuccess"));
|
||||
Msgbox.exec();
|
||||
close();
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ public:
|
||||
void setupAudioTab();
|
||||
void setTabOrder();
|
||||
|
||||
void DisplayMessage(QString msg);
|
||||
static void populateSceneSelection(QComboBox *sel,
|
||||
bool addPrevious = false,
|
||||
bool addSelect = true);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include <QFileDialog>
|
||||
#include <QTextStream>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "headers/advanced-scene-switcher.hpp"
|
||||
#include "headers/utility.hpp"
|
||||
@@ -126,10 +125,8 @@ void AdvSceneSwitcher::on_sceneSequenceLoad_clicked()
|
||||
file.fileName().toUtf8().constData());
|
||||
|
||||
if (!obj) {
|
||||
QMessageBox Msgbox;
|
||||
Msgbox.setText(obs_module_text(
|
||||
DisplayMessage(obs_module_text(
|
||||
"AdvSceneSwitcher.sceneSequenceTab.loadFail"));
|
||||
Msgbox.exec();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -146,10 +143,8 @@ void AdvSceneSwitcher::on_sceneSequenceLoad_clicked()
|
||||
|
||||
obs_data_release(obj);
|
||||
|
||||
QMessageBox Msgbox;
|
||||
Msgbox.setText(obs_module_text(
|
||||
DisplayMessage(obs_module_text(
|
||||
"AdvSceneSwitcher.sceneSequenceTab.loadSuccess"));
|
||||
Msgbox.exec();
|
||||
close();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user