mac stuff implemented, settings location changed

This commit is contained in:
WarmUpTill
2016-06-27 06:06:52 +02:00
committed by GitHub
parent 843e3c9343
commit b906917531
5 changed files with 24 additions and 6 deletions

View File

@@ -81,6 +81,7 @@ void SceneSwitcherPauseHotkey(void *data, obs_hotkey_id id, obs_hotkey_t *hotkey
pauseHotkeyData = obs_hotkey_save(pauseHotkeyId);
}
bool obs_module_load(void)
{
//set config path
@@ -92,6 +93,7 @@ bool obs_module_load(void)
loadKeybinding(PAUSE_HOTKEY_NAME, pauseHotkeyData, pauseHotkeyId);
//loadKeybinding(OPTIONS_HOTKEY_NAME, optionsHotkeyData, optionsHotkeyId);
//load settings file
switcher->setSettingsFilePath(configPath);
switcher->firstLoad();
//start the switching thread
switcher->start();

View File

@@ -14,6 +14,11 @@ string Settings::getSettingsFilePath()
return settingsFilePath;
}
void Settings::setSettingsFilePath(string path)
{
settingsFilePath = path.append("settings.txt");
}
void Settings::load() {

View File

@@ -1,6 +1,7 @@
#pragma once
#include <map>
#include <string>
#include <obs-module.h>
using namespace std;
class Settings {
@@ -9,7 +10,8 @@ public:
void load();
map<string, string> getMap();
string getSettingsFilePath();
void setSettingsFilePath(string path);
private:
string settingsFilePath = "/Users/Till/Desktop/SceneSwitcher/settings.txt";
string settingsFilePath = "";
void addToMap(string, string);
};

View File

@@ -6,7 +6,8 @@
#include <thread>
#include <regex>
#include "switcher.h"
#ifdef __WINDOWS__
#ifdef _WIN32
#define NOMINMAX
#include <windows.h>
#endif
#ifdef __APPLE__
@@ -78,7 +79,7 @@ void Switcher::switcherThreadFunc() {
}
}
#ifdef __WINDOWS__
#ifdef _WIN32
void Switcher::firstLoad() {
settings.load();
settingsMap = settings.getMap();
@@ -88,6 +89,7 @@ void Switcher::firstLoad() {
{
message += (it->first) + " -> " + it->second + "\n";
}
message += "\n(settings file located at: " + settings.getSettingsFilePath() + ")";
MessageBoxA(0, message.c_str(), "Scene Switcher", 0);
}
}
@@ -103,6 +105,7 @@ void Switcher::firstLoad() {
{
message += (it->first) + " -> " + it->second + "\n";
}
message += "\n(settings file located at: " + settings.getSettingsFilePath() + ")";
SInt32 nRes = 0;
CFUserNotificationRef pDlg = NULL;
const void* keys[] = { kCFUserNotificationAlertHeaderKey,
@@ -139,7 +142,7 @@ void Switcher::start()
}
//checks if active window is in fullscreen
#ifdef __WINDOWS__
#ifdef _WIN32
bool Switcher::isWindowFullscreen() {
RECT appBounds;
RECT rc;
@@ -167,7 +170,7 @@ bool Switcher::isWindowFullscreen() {
#endif
//reads the title of the currently active window
#ifdef __WINDOWS__
#ifdef _WIN32
string Switcher::GetActiveWindowTitle()
{
char wnd_title[256];
@@ -198,12 +201,16 @@ void Switcher::stop() {
return;
}
string Switcher::getSettingsFilePath()
{
return settings.getSettingsFilePath();;
}
void Switcher::setSettingsFilePath(string path)
{
settings.setSettingsFilePath(path);
}
bool Switcher::getIsRunning()
{
return isRunning;

View File

@@ -12,7 +12,9 @@ public:
void load();
void start();
void stop();
void openUI();
string getSettingsFilePath();
void setSettingsFilePath(string path);
thread switcherThread;
private:
bool isRunning = true;