add draft of remote file support

This commit is contained in:
WarmUpTill 2020-06-14 20:35:02 +02:00
parent 560044bbbf
commit 2a92df4f3c
5 changed files with 30 additions and 1 deletions

View File

@ -2198,10 +2198,20 @@
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_36">
<item>
<widget class="QLabel" name="label_62">
<property name="text">
<string>If the</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="fileType"/>
</item>
<item>
<widget class="QLabel" name="label_44">
<property name="text">
<string>If the file</string>
<string>file</string>
</property>
</widget>
</item>

View File

@ -289,6 +289,9 @@ void SceneSwitcher::loadUI()
item->setData(Qt::UserRole, text);
}
ui->fileType->addItem("local");
ui->fileType->addItem("remote");
for (auto &s : switcher->fileSwitches) {
std::string sceneName = GetWeakSourceName(s.scene);
std::string transitionName = GetWeakSourceName(s.transition);

View File

@ -2,8 +2,13 @@
#include <QTextStream>
#include <QDateTime>
#include <obs.hpp>
#include <curl/curl.h>
#include "headers/advanced-scene-switcher.hpp"
#define LOCAL_FILE_IDX 0
#define REMOTE_FILE_IDX 1
void SceneSwitcher::on_browseButton_clicked()
{
QString path = QFileDialog::getOpenFileName(
@ -176,6 +181,15 @@ void SceneSwitcher::on_browseButton_3_clicked()
ui->filePathLineEdit->setText(path);
}
void SceneSwitcher::on_fileType_currentIndexChanged(int idx) {
if (idx == -1)
return;
if (idx == LOCAL_FILE_IDX)
ui->browseButton_3->setDisabled(false);
if (idx == REMOTE_FILE_IDX)
ui->browseButton_3->setDisabled(true);
}
void SceneSwitcher::on_fileAdd_clicked()
{
QString sceneName = ui->fileScenes->currentText();

View File

@ -104,6 +104,7 @@ public slots:
void on_browseButton_clicked();
void on_readFileCheckBox_stateChanged(int state);
void on_fileType_currentIndexChanged(int idx);
void on_readPathLineEdit_textChanged(const QString &text);
void on_writePathLineEdit_textChanged(const QString &text);
void on_browseButton_2_clicked();

View File

@ -169,6 +169,7 @@ struct FileSwitch {
OBSWeakSource transition;
std::string file;
std::string text;
bool local = true;
bool useRegex = false;
bool useTime = false;
QDateTime lastMod;