|
|
@@ -20,6 +20,7 @@
|
|
|
#include <util/util.hpp>
|
|
|
#include <QMessageBox>
|
|
|
#include <QVariant>
|
|
|
+#include <QFileDialog>
|
|
|
#include "window-basic-main.hpp"
|
|
|
#include "window-namedialog.hpp"
|
|
|
#include "qt-wrappers.hpp"
|
|
|
@@ -448,6 +449,85 @@ void OBSBasic::on_actionRemoveProfile_triggered()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+void OBSBasic::on_actionImportProfile_triggered()
|
|
|
+{
|
|
|
+ char path[512];
|
|
|
+
|
|
|
+ QString home = QDir::homePath();
|
|
|
+
|
|
|
+ int ret = GetConfigPath(path, 512, "obs-studio/basic/profiles/");
|
|
|
+ if (ret <= 0) {
|
|
|
+ blog(LOG_WARNING, "Failed to get profile config path");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ QString dir = QFileDialog::getExistingDirectory(
|
|
|
+ this,
|
|
|
+ QTStr("Basic.MainMenu.Profile.Import"),
|
|
|
+ home,
|
|
|
+ QFileDialog::ShowDirsOnly |
|
|
|
+ QFileDialog::DontResolveSymlinks);
|
|
|
+
|
|
|
+ if (!dir.isEmpty() && !dir.isNull()) {
|
|
|
+ QString inputPath = QString::fromUtf8(path);
|
|
|
+ QFileInfo finfo(dir);
|
|
|
+ QString directory = finfo.fileName();
|
|
|
+ QString profileDir = inputPath + directory;
|
|
|
+ QDir folder(profileDir);
|
|
|
+
|
|
|
+ if (!folder.exists()) {
|
|
|
+ folder.mkpath(profileDir);
|
|
|
+ QFile::copy(dir + "/basic.ini",
|
|
|
+ profileDir + "/basic.ini");
|
|
|
+ QFile::copy(dir + "/service.json",
|
|
|
+ profileDir + "/service.json");
|
|
|
+ RefreshProfiles();
|
|
|
+ } else {
|
|
|
+ QMessageBox::information(this,
|
|
|
+ QTStr("Basic.MainMenu.Profile.Import"),
|
|
|
+ QTStr("Basic.MainMenu.Profile.Exists"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void OBSBasic::on_actionExportProfile_triggered()
|
|
|
+{
|
|
|
+ char path[512];
|
|
|
+
|
|
|
+ QString home = QDir::homePath();
|
|
|
+
|
|
|
+ QString currentProfile =
|
|
|
+ QString::fromUtf8(config_get_string(App()->GlobalConfig(),
|
|
|
+ "Basic", "ProfileDir"));
|
|
|
+
|
|
|
+ int ret = GetConfigPath(path, 512, "obs-studio/basic/profiles/");
|
|
|
+ if (ret <= 0) {
|
|
|
+ blog(LOG_WARNING, "Failed to get profile config path");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ QString dir = QFileDialog::getExistingDirectory(
|
|
|
+ this,
|
|
|
+ QTStr("Basic.MainMenu.Profile.Export"),
|
|
|
+ home,
|
|
|
+ QFileDialog::ShowDirsOnly |
|
|
|
+ QFileDialog::DontResolveSymlinks);
|
|
|
+
|
|
|
+ if (!dir.isEmpty() && !dir.isNull()) {
|
|
|
+ QString outputDir = dir + "/" + currentProfile;
|
|
|
+ QString inputPath = QString::fromUtf8(path);
|
|
|
+ QDir folder(outputDir);
|
|
|
+
|
|
|
+ if (!folder.exists()) {
|
|
|
+ folder.mkpath(outputDir);
|
|
|
+ QFile::copy(inputPath + currentProfile + "/basic.ini",
|
|
|
+ outputDir + "/basic.ini");
|
|
|
+ QFile::copy(inputPath + currentProfile + "/service.json",
|
|
|
+ outputDir + "/service.json");
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
void OBSBasic::ChangeProfile()
|
|
|
{
|
|
|
QAction *action = reinterpret_cast<QAction*>(sender());
|