New upstream version 18.0.1+dfsg1

This commit is contained in:
Sebastian Ramacher 2017-04-19 21:54:15 +02:00
parent 6efda2859e
commit f2cf6cce50
1337 changed files with 41178 additions and 84670 deletions

View file

@ -19,6 +19,8 @@
#include <util/util.hpp>
#include <QMessageBox>
#include <QVariant>
#include <QFileDialog>
#include <QStandardPaths>
#include "item-widget-helpers.hpp"
#include "window-basic-main.hpp"
#include "window-namedialog.hpp"
@ -191,7 +193,7 @@ void OBSBasic::RefreshSceneCollections()
int count = 0;
for (int i = 0; i < menuActions.count(); i++) {
QVariant v = menuActions[i]->property("fileName");
QVariant v = menuActions[i]->property("file_name");
if (v.typeName() != nullptr)
delete menuActions[i];
}
@ -205,7 +207,7 @@ void OBSBasic::RefreshSceneCollections()
file.erase(file.size() - 5, 5);
QAction *action = new QAction(QT_UTF8(name), this);
action->setProperty("fileName", QT_UTF8(path));
action->setProperty("file_name", QT_UTF8(path));
connect(action, &QAction::triggered,
this, &OBSBasic::ChangeSceneCollection);
action->setCheckable(true);
@ -220,6 +222,9 @@ void OBSBasic::RefreshSceneCollections()
EnumSceneCollections(addCollection);
ui->actionRemoveSceneCollection->setEnabled(count > 1);
OBSBasic *main = reinterpret_cast<OBSBasic*>(App()->GetMainWindow());
main->OpenSavedProjectors();
}
void OBSBasic::on_actionNewSceneCollection_triggered()
@ -347,6 +352,67 @@ void OBSBasic::on_actionRemoveSceneCollection_triggered()
}
}
void OBSBasic::on_actionImportSceneCollection_triggered()
{
char path[512];
QString home = QDir::homePath();
int ret = GetConfigPath(path, 512, "obs-studio/basic/scenes/");
if (ret <= 0) {
blog(LOG_WARNING, "Failed to get scene collection config path");
return;
}
QString file = QFileDialog::getOpenFileName(
this,
QTStr("Basic.MainMenu.SceneCollection.Import"),
home,
"JSON Files (*.json)");
QFileInfo finfo(file);
QString filename = finfo.fileName();
QFileInfo destinfo(path + filename);
if (!file.isEmpty() && !file.isNull()) {
if (!destinfo.exists()) {
QFile::copy(file, path + filename);
RefreshSceneCollections();
} else {
QMessageBox::information(this,
QTStr("Basic.MainMenu.SceneCollection.Import"),
QTStr("Basic.MainMenu.SceneCollection.Exists"));
}
}
}
void OBSBasic::on_actionExportSceneCollection_triggered()
{
char path[512];
QString home = QDir::homePath();
QString currentFile = QT_UTF8(config_get_string(App()->GlobalConfig(),
"Basic", "SceneCollectionFile"));
int ret = GetConfigPath(path, 512, "obs-studio/basic/scenes/");
if (ret <= 0) {
blog(LOG_WARNING, "Failed to get scene collection config path");
return;
}
QString exportFile = QFileDialog::getSaveFileName(
this,
QTStr("Basic.MainMenu.SceneCollection.Export"),
home + "/" + currentFile,
"JSON Files (*.json)");
string file = QT_TO_UTF8(exportFile);
if (!exportFile.isEmpty() && !exportFile.isNull())
QFile::copy(path + currentFile + ".json", exportFile);
}
void OBSBasic::ChangeSceneCollection()
{
QAction *action = reinterpret_cast<QAction*>(sender());
@ -355,7 +421,7 @@ void OBSBasic::ChangeSceneCollection()
if (!action)
return;
fileName = QT_TO_UTF8(action->property("fileName").value<QString>());
fileName = QT_TO_UTF8(action->property("file_name").value<QString>());
if (fileName.empty())
return;