From b90691753168b7b0b6dfe92538466788c2d33c98 Mon Sep 17 00:00:00 2001 From: WarmUpTill Date: Mon, 27 Jun 2016 06:06:52 +0200 Subject: [PATCH] mac stuff implemented, settings location changed --- SceneSwitcher.cpp | 2 ++ settings.cpp | 5 +++++ settings.h | 4 +++- switcher.cpp | 17 ++++++++++++----- switcher.h | 2 ++ 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/SceneSwitcher.cpp b/SceneSwitcher.cpp index 1269ec57..5e853181 100644 --- a/SceneSwitcher.cpp +++ b/SceneSwitcher.cpp @@ -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(); diff --git a/settings.cpp b/settings.cpp index c0f2fa7f..c93374d0 100644 --- a/settings.cpp +++ b/settings.cpp @@ -14,6 +14,11 @@ string Settings::getSettingsFilePath() return settingsFilePath; } +void Settings::setSettingsFilePath(string path) +{ + settingsFilePath = path.append("settings.txt"); +} + void Settings::load() { diff --git a/settings.h b/settings.h index 50a76175..f6bdefde 100644 --- a/settings.h +++ b/settings.h @@ -1,6 +1,7 @@ #pragma once #include #include +#include using namespace std; class Settings { @@ -9,7 +10,8 @@ public: void load(); map getMap(); string getSettingsFilePath(); + void setSettingsFilePath(string path); private: - string settingsFilePath = "/Users/Till/Desktop/SceneSwitcher/settings.txt"; + string settingsFilePath = ""; void addToMap(string, string); }; diff --git a/switcher.cpp b/switcher.cpp index be7c71dd..94da00f0 100644 --- a/switcher.cpp +++ b/switcher.cpp @@ -6,7 +6,8 @@ #include #include #include "switcher.h" -#ifdef __WINDOWS__ +#ifdef _WIN32 + #define NOMINMAX #include #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; diff --git a/switcher.h b/switcher.h index 4a7dff70..cfb09657 100644 --- a/switcher.h +++ b/switcher.h @@ -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;