Skip to content

Commit

Permalink
remove using namespace std
Browse files Browse the repository at this point in the history
  • Loading branch information
WarmUpTill committed Jun 12, 2020
1 parent bbe6a30 commit 6810ba7
Show file tree
Hide file tree
Showing 21 changed files with 298 additions and 289 deletions.
149 changes: 76 additions & 73 deletions src/advanced-scene-switcher.cpp

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions src/executable-switch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void SceneSwitcher::on_executables_currentRowChanged(int idx)

QString exec = item->data(Qt::UserRole).toString();

lock_guard<mutex> lock(switcher->m);
std::lock_guard<std::mutex> lock(switcher->m);
for (auto &s : switcher->executableSwitches) {
if (exec.compare(s.mExe) == 0) {
QString sceneName = GetWeakSourceName(s.mScene).c_str();
Expand All @@ -50,7 +50,7 @@ void SceneSwitcher::on_executableUp_clicked()
ui->executables->takeItem(index));
ui->executables->setCurrentRow(index - 1);

lock_guard<mutex> lock(switcher->m);
std::lock_guard<std::mutex> lock(switcher->m);

iter_swap(switcher->executableSwitches.begin() + index,
switcher->executableSwitches.begin() + index - 1);
Expand All @@ -65,7 +65,7 @@ void SceneSwitcher::on_executableDown_clicked()
ui->executables->takeItem(index));
ui->executables->setCurrentRow(index + 1);

lock_guard<mutex> lock(switcher->m);
std::lock_guard<std::mutex> lock(switcher->m);

iter_swap(switcher->executableSwitches.begin() + index,
switcher->executableSwitches.begin() + index + 1);
Expand All @@ -92,7 +92,7 @@ void SceneSwitcher::on_executableAdd_clicked()
int idx = executableFindByData(exeName);

if (idx == -1) {
lock_guard<mutex> lock(switcher->m);
std::lock_guard<std::mutex> lock(switcher->m);
switcher->executableSwitches.emplace_back(
source, transition, exeName.toUtf8().constData(),
inFocus);
Expand All @@ -105,7 +105,7 @@ void SceneSwitcher::on_executableAdd_clicked()
item->setText(text);

{
lock_guard<mutex> lock(switcher->m);
std::lock_guard<std::mutex> lock(switcher->m);
for (auto &s : switcher->executableSwitches) {
if (s.mExe == exeName) {
s.mScene = source;
Expand All @@ -127,7 +127,7 @@ void SceneSwitcher::on_executableRemove_clicked()
QString exe = item->data(Qt::UserRole).toString();

{
lock_guard<mutex> lock(switcher->m);
std::lock_guard<std::mutex> lock(switcher->m);
auto &switches = switcher->executableSwitches;

for (auto it = switches.begin(); it != switches.end(); ++it) {
Expand All @@ -146,7 +146,7 @@ void SceneSwitcher::on_executableRemove_clicked()
void SwitcherData::checkExeSwitch(bool &match, OBSWeakSource &scene,
OBSWeakSource &transition)
{
string title;
std::string title;
QStringList runningProcesses;
bool ignored = false;

Expand Down
16 changes: 8 additions & 8 deletions src/file-switch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void SceneSwitcher::on_readFileCheckBox_stateChanged(int state)
if (loading)
return;

lock_guard<mutex> lock(switcher->m);
std::lock_guard<std::mutex> lock(switcher->m);
if (!state) {
ui->browseButton_2->setDisabled(true);
ui->readPathLineEdit->setDisabled(true);
Expand All @@ -35,7 +35,7 @@ void SceneSwitcher::on_readPathLineEdit_textChanged(const QString &text)
if (loading)
return;

lock_guard<mutex> lock(switcher->m);
std::lock_guard<std::mutex> lock(switcher->m);
if (text.isEmpty()) {
switcher->fileIO.readEnabled = false;
return;
Expand All @@ -49,7 +49,7 @@ void SceneSwitcher::on_writePathLineEdit_textChanged(const QString &text)
if (loading)
return;

lock_guard<mutex> lock(switcher->m);
std::lock_guard<std::mutex> lock(switcher->m);
if (text.isEmpty()) {
switcher->fileIO.writeEnabled = false;
return;
Expand Down Expand Up @@ -196,7 +196,7 @@ void SceneSwitcher::on_fileAdd_clicked()
new QListWidgetItem(switchText, ui->fileScenesList);
item->setData(Qt::UserRole, v);

lock_guard<mutex> lock(switcher->m);
std::lock_guard<std::mutex> lock(switcher->m);
switcher->fileSwitches.emplace_back(source, transition,
fileName.toUtf8().constData(),
text.toUtf8().constData(), useRegex,
Expand All @@ -214,7 +214,7 @@ void SceneSwitcher::on_fileRemove_clicked()
return;

{
lock_guard<mutex> lock(switcher->m);
std::lock_guard<std::mutex> lock(switcher->m);

auto &switches = switcher->fileSwitches;
switches.erase(switches.begin() + idx);
Expand All @@ -229,14 +229,14 @@ void SceneSwitcher::on_fileScenesList_currentRowChanged(int idx)
if (idx == -1)
return;

lock_guard<mutex> lock(switcher->m);
std::lock_guard<std::mutex> lock(switcher->m);

if (switcher->fileSwitches.size() <= idx)
return;
FileSwitch s = switcher->fileSwitches[idx];

string sceneName = GetWeakSourceName(s.scene);
string transitionName = GetWeakSourceName(s.transition);
std::string sceneName = GetWeakSourceName(s.scene);
std::string transitionName = GetWeakSourceName(s.transition);

ui->fileScenes->setCurrentText(sceneName.c_str());
ui->fileTransitions->setCurrentText(transitionName.c_str());
Expand Down
12 changes: 6 additions & 6 deletions src/general.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ void SceneSwitcher::on_startAtLaunch_toggled(bool value)
if (loading)
return;

lock_guard<mutex> lock(switcher->m);
std::lock_guard<std::mutex> lock(switcher->m);
switcher->startAtLaunch = value;
}

Expand All @@ -31,7 +31,7 @@ void SceneSwitcher::on_noMatchDontSwitch_clicked()
if (loading)
return;

lock_guard<mutex> lock(switcher->m);
std::lock_guard<std::mutex> lock(switcher->m);
switcher->switchIfNotMatching = NO_SWITCH;
ui->noMatchSwitchScene->setEnabled(false);
}
Expand All @@ -41,7 +41,7 @@ void SceneSwitcher::on_noMatchSwitch_clicked()
if (loading)
return;

lock_guard<mutex> lock(switcher->m);
std::lock_guard<std::mutex> lock(switcher->m);
switcher->switchIfNotMatching = SWITCH;
ui->noMatchSwitchScene->setEnabled(true);
UpdateNonMatchingScene(ui->noMatchSwitchScene->currentText());
Expand All @@ -52,7 +52,7 @@ void SceneSwitcher::on_noMatchRandomSwitch_clicked()
if (loading)
return;

lock_guard<mutex> lock(switcher->m);
std::lock_guard<std::mutex> lock(switcher->m);
switcher->switchIfNotMatching = RANDOM_SWITCH;
ui->noMatchSwitchScene->setEnabled(false);
}
Expand All @@ -62,7 +62,7 @@ void SceneSwitcher::on_noMatchSwitchScene_currentTextChanged(const QString &text
if (loading)
return;

lock_guard<mutex> lock(switcher->m);
std::lock_guard<std::mutex> lock(switcher->m);
UpdateNonMatchingScene(text);
}

Expand All @@ -71,7 +71,7 @@ void SceneSwitcher::on_checkInterval_valueChanged(int value)
if (loading)
return;

lock_guard<mutex> lock(switcher->m);
std::lock_guard<std::mutex> lock(switcher->m);
switcher->interval = value;
}

Expand Down
6 changes: 3 additions & 3 deletions src/headers/advanced-scene-switcher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ bool isFullscreen(std::string &title);
/********************************************************************************
* Screenregion helper
********************************************************************************/
pair<int, int> getCursorPos();
std::pair<int, int> getCursorPos();

/********************************************************************************
* Idle detection helper
Expand All @@ -174,7 +174,7 @@ typedef struct obs_weak_source obs_weak_source_t;
obs_weak_source_t *getNextTransition(obs_weak_source_t *scene1,
obs_weak_source_t *scene2);
void switchScene(OBSWeakSource &scene, OBSWeakSource &transition,
unique_lock<mutex> &lock);
std::unique_lock<std::mutex> &lock);

/********************************************************************************
* Hotkey helper
Expand All @@ -190,7 +190,7 @@ void startHotkeyFunc(void *data, obs_hotkey_id id, obs_hotkey_t *hotkey,
bool pressed);
void startStopToggleHotkeyFunc(void *data, obs_hotkey_id id,
obs_hotkey_t *hotkey, bool pressed);
void loadKeybinding(obs_hotkey_id hotkeyId, string path);
void loadKeybinding(obs_hotkey_id hotkeyId, std::string path);

/********************************************************************************
* Main SwitcherData
Expand Down
Loading

0 comments on commit 6810ba7

Please sign in to comment.