mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-04-28 17:17:00 -05:00
"Ignore Window Names" option added
This commit is contained in:
parent
04ffb09db9
commit
63946020b8
24
settings.cpp
24
settings.cpp
|
|
@ -23,6 +23,7 @@ void Settings::load() {
|
|||
settings = map<string, Data>();
|
||||
sceneRoundTrip = vector<string>();
|
||||
pauseScenes = vector<string>();
|
||||
ignoreNames = vector<string>();
|
||||
//read the settings file
|
||||
vector<string> settingsElements;
|
||||
ifstream infile(settingsFilePath);
|
||||
|
|
@ -65,10 +66,12 @@ void Settings::load() {
|
|||
if (sceneRoundTrip.size() > 0) {
|
||||
sceneRoundTrip.back().pop_back();
|
||||
}
|
||||
//add missing values
|
||||
if (sceneRoundTrip.size() == 0 || sceneRoundTrip.size() % 2 != 0) {
|
||||
sceneRoundTrip.push_back("");
|
||||
}
|
||||
}
|
||||
//find Pause Scene Names
|
||||
if (temp.find("Pause Scene Names") != temp.npos) {
|
||||
//discard the first value ("Pause Scene Names")
|
||||
getline(lineStream, value, ',');
|
||||
|
|
@ -82,8 +85,22 @@ void Settings::load() {
|
|||
pauseScenes.back().pop_back();
|
||||
}
|
||||
}
|
||||
//find window names to ignroe
|
||||
if (temp.find("Ignore Window Names") != temp.npos) {
|
||||
//discard the first value "Ignore Window Names"
|
||||
getline(lineStream, value, ',');
|
||||
while (lineStream.good()) {
|
||||
//Ignore Window Names,windowName1,windowName2,...
|
||||
getline(lineStream, value, ',');
|
||||
ignoreNames.push_back(value);
|
||||
}
|
||||
//remove trailing /" of last value
|
||||
if (ignoreNames.size() > 0) {
|
||||
ignoreNames.back().pop_back();
|
||||
}
|
||||
}
|
||||
//find values for Scene switching
|
||||
if (temp.find("Pause Scene Names") == temp.npos && temp.find("Scene Round Trip") == temp.npos)
|
||||
if (temp.find("Pause Scene Names") == temp.npos && temp.find("Scene Round Trip") == temp.npos && temp.find("Ignore Window Names") == temp.npos)
|
||||
{
|
||||
//windowTitle,sceneName,isFullscreenValue
|
||||
while (lineStream.good()) {
|
||||
|
|
@ -138,3 +155,8 @@ vector<string> Settings::getPauseScenes() {
|
|||
return pauseScenes;
|
||||
}
|
||||
|
||||
vector<string> Settings::getIgnoreNames()
|
||||
{
|
||||
return ignoreNames;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ public:
|
|||
map<string, Data> getMap();
|
||||
vector<string> getSceneRoundTrip();
|
||||
vector<string> getPauseScenes();
|
||||
vector<string> getIgnoreNames();
|
||||
string getSettingsFilePath();
|
||||
void setSettingsFilePath(string path);
|
||||
private:
|
||||
|
|
@ -24,5 +25,6 @@ private:
|
|||
map<string, Data> settings;
|
||||
vector<string> sceneRoundTrip;
|
||||
vector<string> pauseScenes;
|
||||
vector<string> ignoreNames;
|
||||
bool startMessageDisable = false;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -78,6 +78,9 @@ void Switcher::switcherThreadFunc() {
|
|||
else {
|
||||
//get active window title and reset values
|
||||
windowname = GetActiveWindowTitle();
|
||||
//should we ignore this window name?
|
||||
if (find(ignoreNames.begin(), ignoreNames.end(), windowname) == ignoreNames.end()) {
|
||||
//reset values
|
||||
match = false;
|
||||
sceneName = "";
|
||||
checkFullscreen = false;
|
||||
|
|
@ -126,6 +129,7 @@ void Switcher::switcherThreadFunc() {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//sleep for a bit
|
||||
this_thread::sleep_for(chrono::milliseconds(1000));
|
||||
}
|
||||
|
|
@ -138,6 +142,7 @@ void Switcher::firstLoad() {
|
|||
settingsMap = settings.getMap();
|
||||
sceneRoundTrip = settings.getSceneRoundTrip();
|
||||
pauseScenes = settings.getPauseScenes();
|
||||
ignoreNames = settings.getIgnoreNames();
|
||||
if (!settings.getStartMessageDisable()) {
|
||||
string message = "The following settings were found for Scene Switcher:\n";
|
||||
for (auto it = settingsMap.cbegin(); it != settingsMap.cend(); ++it)
|
||||
|
|
@ -156,6 +161,7 @@ void Switcher::firstLoad() {
|
|||
settingsMap = settings.getMap();
|
||||
sceneRoundTrip = settings.getSceneRoundTrip();
|
||||
pauseScenes = settings.getPauseScenes();
|
||||
ignoreNames = settings.getIgnoreNames();
|
||||
if (!settings.getStartMessageDisable()) {
|
||||
string message = "The following settings were found for Scene Switcher:\n";
|
||||
for (auto it = settingsMap.cbegin(); it != settingsMap.cend(); ++it)
|
||||
|
|
@ -191,6 +197,7 @@ void Switcher::load() {
|
|||
settingsMap = settings.getMap();
|
||||
sceneRoundTrip = settings.getSceneRoundTrip();
|
||||
pauseScenes = settings.getPauseScenes();
|
||||
ignoreNames = settings.getIgnoreNames();
|
||||
}
|
||||
|
||||
//start thread
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ private:
|
|||
map<string, Data> settingsMap;
|
||||
vector<string> sceneRoundTrip;
|
||||
vector<string> pauseScenes;
|
||||
vector<string> ignoreNames;
|
||||
void switcherThreadFunc();
|
||||
bool isWindowFullscreen();
|
||||
string GetActiveWindowTitle();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user