Use QString::fromStdString() instead of c_str()

This commit is contained in:
Myned 2020-06-09 07:10:30 -04:00
parent e693794549
commit 8e4a8b7e9d
No known key found for this signature in database
GPG Key ID: BC58C09870A63E59
3 changed files with 12 additions and 10 deletions

View File

@ -157,7 +157,7 @@ void SwitcherData::checkExeSwitch(bool &match, OBSWeakSource &scene,
bool equals = (title == window);
// True if ignored switch matches title
bool matches = QString::fromStdString(title).contains(
QRegularExpression(window.c_str()));
QRegularExpression(QString::fromStdString(window)));
if (equals || matches) {
ignored = true;

View File

@ -274,7 +274,7 @@ bool isFullscreen(std::string &title)
bool equals = (title == name);
// True if switch matches window
bool matches = QString::fromStdString(name).contains(
QRegularExpression(title.c_str()));
QRegularExpression(QString::fromStdString(title)));
// If found, check if switch is fullscreen
if (equals || matches) {

View File

@ -7,10 +7,10 @@ bool isRunning(std::string &title)
GetWindowList(windows);
// True if switch is running (direct)
bool equals = windows.contains(title.c_str());
bool equals = windows.contains(QString::fromStdString(title));
// True if switch is running (regex)
bool matches =
(windows.indexOf(QRegularExpression(title.c_str())) != -1);
bool matches = (windows.indexOf(QRegularExpression(
QString::fromStdString(title))) != -1);
return (equals || matches);
}
@ -24,7 +24,7 @@ bool isFocused(std::string &title)
bool equals = (title == current);
// True if switch matches current window
bool matches = QString::fromStdString(current).contains(
QRegularExpression(title.c_str()));
QRegularExpression(QString::fromStdString(title)));
return (equals || matches);
}
@ -277,7 +277,7 @@ void SwitcherData::checkWindowTitleSwitch(bool &match, OBSWeakSource &scene,
bool equals = (title == window);
// True if ignored switch matches current window
bool matches = QString::fromStdString(title).contains(
QRegularExpression(window.c_str()));
QRegularExpression(QString::fromStdString(window)));
if (equals || matches) {
ignored = true;
@ -295,9 +295,11 @@ void SwitcherData::checkWindowTitleSwitch(bool &match, OBSWeakSource &scene,
// True if focus is disabled OR switch is focused
bool focus = (!s.focus || isFocused(s.window));
// True if current window is ignored AND switch matches last window
bool ignore = (ignored &&
QString::fromStdString(title).contains(
QRegularExpression(s.window.c_str())));
bool ignore =
(ignored &&
QString::fromStdString(title).contains(
QRegularExpression(
QString::fromStdString(s.window))));
if (isRunning(s.window) && (fullscreen && (focus || ignore))) {
match = true;