New upstream version 25.0.3+dfsg1
This commit is contained in:
parent
04fe0efc67
commit
8b2e5f2130
569 changed files with 62491 additions and 5875 deletions
|
|
@ -23,6 +23,7 @@
|
|||
#include <QStandardPaths>
|
||||
#include "item-widget-helpers.hpp"
|
||||
#include "window-basic-main.hpp"
|
||||
#include "window-importer.hpp"
|
||||
#include "window-namedialog.hpp"
|
||||
#include "qt-wrappers.hpp"
|
||||
|
||||
|
|
@ -388,64 +389,12 @@ void OBSBasic::on_actionRemoveSceneCollection_triggered()
|
|||
|
||||
void OBSBasic::on_actionImportSceneCollection_triggered()
|
||||
{
|
||||
char path[512];
|
||||
OBSImporter *imp;
|
||||
imp = new OBSImporter(this);
|
||||
imp->exec();
|
||||
delete imp;
|
||||
|
||||
QString qhome = 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 qfilePath = QFileDialog::getOpenFileName(
|
||||
this, QTStr("Basic.MainMenu.SceneCollection.Import"), qhome,
|
||||
"JSON Files (*.json)");
|
||||
|
||||
QFileInfo finfo(qfilePath);
|
||||
QString qfilename = finfo.fileName();
|
||||
QString qpath = QT_UTF8(path);
|
||||
QFileInfo destinfo(QT_UTF8(path) + qfilename);
|
||||
|
||||
if (!qfilePath.isEmpty() && !qfilePath.isNull()) {
|
||||
string absPath = QT_TO_UTF8(finfo.absoluteFilePath());
|
||||
OBSData scenedata =
|
||||
obs_data_create_from_json_file(absPath.c_str());
|
||||
obs_data_release(scenedata);
|
||||
|
||||
string origName = obs_data_get_string(scenedata, "name");
|
||||
string name = origName;
|
||||
string file;
|
||||
int inc = 1;
|
||||
|
||||
while (SceneCollectionExists(name.c_str())) {
|
||||
name = origName + " (" + to_string(++inc) + ")";
|
||||
}
|
||||
|
||||
obs_data_set_string(scenedata, "name", name.c_str());
|
||||
|
||||
if (!GetFileSafeName(name.c_str(), file)) {
|
||||
blog(LOG_WARNING,
|
||||
"Failed to create "
|
||||
"safe file name for '%s'",
|
||||
name.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
string filePath = path + file;
|
||||
|
||||
if (!GetClosestUnusedFileName(filePath, "json")) {
|
||||
blog(LOG_WARNING,
|
||||
"Failed to get "
|
||||
"closest file name for %s",
|
||||
file.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
obs_data_save_json_safe(scenedata, filePath.c_str(), "tmp",
|
||||
"bak");
|
||||
RefreshSceneCollections();
|
||||
}
|
||||
RefreshSceneCollections();
|
||||
}
|
||||
|
||||
void OBSBasic::on_actionExportSceneCollection_triggered()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue