diff --git a/src/macro-core/macro-condition-file.cpp b/src/macro-core/macro-condition-file.cpp index 3fbf0d06..2cc23aa3 100644 --- a/src/macro-core/macro-condition-file.cpp +++ b/src/macro-core/macro-condition-file.cpp @@ -40,7 +40,7 @@ static std::string getRemoteData(std::string &url) return readBuffer; } -bool MacroConditionFile::matchFileContent(QString &filedata) +bool MacroConditionFile::MatchFileContent(QString &filedata) { if (_onlyMatchIfChanged) { size_t newHash = strHash(filedata.toUtf8().constData()); @@ -63,14 +63,14 @@ bool MacroConditionFile::matchFileContent(QString &filedata) return compareIgnoringLineEnding(text, filedata); } -bool MacroConditionFile::checkRemoteFileContent() +bool MacroConditionFile::CheckRemoteFileContent() { std::string data = getRemoteData(_file); QString qdata = QString::fromStdString(data); - return matchFileContent(qdata); + return MatchFileContent(qdata); } -bool MacroConditionFile::checkLocalFileContent() +bool MacroConditionFile::CheckLocalFileContent() { QString t = QString::fromStdString(_text); QFile file(QString::fromStdString(_file)); @@ -87,7 +87,7 @@ bool MacroConditionFile::checkLocalFileContent() } QString filedata = QTextStream(&file).readAll(); - bool match = matchFileContent(filedata); + bool match = MatchFileContent(filedata); file.close(); return match; @@ -96,9 +96,9 @@ bool MacroConditionFile::checkLocalFileContent() bool MacroConditionFile::CheckCondition() { if (_fileType == FileType::REMOTE) { - return checkRemoteFileContent(); + return CheckRemoteFileContent(); } else { - return checkLocalFileContent(); + return CheckLocalFileContent(); } } @@ -222,9 +222,10 @@ void MacroConditionFileEdit::FileTypeChanged(int index) return; } - FileType type = static_cast(index); + MacroConditionFile::FileType type = + static_cast(index); - if (type == FileType::LOCAL) { + if (type == MacroConditionFile::FileType::LOCAL) { _filePath->Button()->setDisabled(false); _checkModificationDate->setDisabled(false); } else { diff --git a/src/macro-core/macro-condition-file.hpp b/src/macro-core/macro-condition-file.hpp index 363c3841..a3a54791 100644 --- a/src/macro-core/macro-condition-file.hpp +++ b/src/macro-core/macro-condition-file.hpp @@ -11,11 +11,6 @@ #include #include -enum class FileType { - LOCAL, - REMOTE, -}; - class MacroConditionFile : public MacroCondition { public: MacroConditionFile(Macro *m) : MacroCondition(m) {} @@ -29,6 +24,11 @@ public: return std::make_shared(m); } + enum class FileType { + LOCAL, + REMOTE, + }; + std::string _file = obs_module_text("AdvSceneSwitcher.enterPath"); std::string _text = obs_module_text("AdvSceneSwitcher.enterText"); FileType _fileType = FileType::LOCAL; @@ -37,9 +37,9 @@ public: bool _onlyMatchIfChanged = false; private: - bool matchFileContent(QString &filedata); - bool checkRemoteFileContent(); - bool checkLocalFileContent(); + bool MatchFileContent(QString &filedata); + bool CheckRemoteFileContent(); + bool CheckLocalFileContent(); QDateTime _lastMod; size_t _lastHash = 0;