Style changes

* Move FileType definition
* Change capitalization
This commit is contained in:
WarmUpTill
2022-09-11 01:37:55 +02:00
committed by WarmUpTill
parent 7ddfdcf5be
commit 99ceb6a42a
2 changed files with 18 additions and 17 deletions

View File

@@ -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<FileType>(index);
MacroConditionFile::FileType type =
static_cast<MacroConditionFile::FileType>(index);
if (type == FileType::LOCAL) {
if (type == MacroConditionFile::FileType::LOCAL) {
_filePath->Button()->setDisabled(false);
_checkModificationDate->setDisabled(false);
} else {

View File

@@ -11,11 +11,6 @@
#include <QPushButton>
#include <QCheckBox>
enum class FileType {
LOCAL,
REMOTE,
};
class MacroConditionFile : public MacroCondition {
public:
MacroConditionFile(Macro *m) : MacroCondition(m) {}
@@ -29,6 +24,11 @@ public:
return std::make_shared<MacroConditionFile>(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;