Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
malensek committed Sep 18, 2015
2 parents 7b46279 + 624fd5b commit 45e37da
Show file tree
Hide file tree
Showing 17 changed files with 205 additions and 82 deletions.
4 changes: 3 additions & 1 deletion 3RVX/3RVX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void _3RVX::Initialize() {

KillTimer(Window::Handle(), TIMER_FIRSTUPDATE);
KillTimer(Window::Handle(), TIMER_UPDATE);
if (settings->AutoUpdateEnabled()) {
if (settings->AutomaticUpdates()) {
SetTimer(
Window::Handle(),
TIMER_FIRSTUPDATE,
Expand Down Expand Up @@ -218,6 +218,7 @@ LRESULT _3RVX::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {

case WM_TIMER:
if (wParam == TIMER_FIRSTUPDATE || wParam == TIMER_UPDATE) {
CLOG(L"Received updater timer notification");
Settings *settings = Settings::Instance();
long long checkTime = settings->LastUpdateCheck();
if ((std::time(nullptr) - checkTime) > (UPDATE_INTERVAL / 1000)) {
Expand All @@ -230,6 +231,7 @@ LRESULT _3RVX::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
}

if (wParam == TIMER_FIRSTUPDATE) {
CLOG(L"Starting long-term update timer");
/* If this was the first update check (30 min after launch),
* then kill the first update timer and start the main timer
* (checks on 24-hour intervals) */
Expand Down
9 changes: 7 additions & 2 deletions 3RVX/3RVX.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ class _3RVX : public Window {
return FindWindow(CLASS_3RVX_SETTINGS, CLASS_3RVX_SETTINGS);
}

static HWND UpdaterHwnd() {
return FindWindow(CLASS_3RVX_UPDATER, CLASS_3RVX_UPDATER);
}

static void Message(WPARAM wParam, LPARAM lParam, bool post = false) {
HWND masterWnd = MasterHwnd();

Expand All @@ -64,8 +68,9 @@ class _3RVX : public Window {
}

public:
static const wchar_t *CLASS_3RVX;
static const wchar_t *CLASS_3RVX_SETTINGS;
static constexpr const wchar_t *CLASS_3RVX = L"3RVXv3";
static constexpr const wchar_t *CLASS_3RVX_SETTINGS = L"3RVXv3-Settings";
static constexpr const wchar_t *CLASS_3RVX_UPDATER = L"3RVXv3-Updater";

static const UINT WM_3RVX_CTRL;
static const UINT WM_3RVX_SETTINGSCTRL;
Expand Down
3 changes: 0 additions & 3 deletions 3RVX/3RVXConsts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

#include "3RVX.h"

const wchar_t *_3RVX::CLASS_3RVX = L"3RVXv3";
const wchar_t *_3RVX::CLASS_3RVX_SETTINGS = L"3RVXv3-Settings";

const UINT _3RVX::WM_3RVX_CTRL
= RegisterWindowMessage(L"WM_3RVX_CTRL");
const UINT _3RVX::WM_3RVX_SETTINGSCTRL
Expand Down
8 changes: 4 additions & 4 deletions 3RVX/OSD/VolumeOSD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ _muteWnd(L"3RVX-MuteOSD", L"3RVX-MuteOSD") {
MeterLevels(v);
_volumeSlider->MeterLevels(v);

/* TODO: check whether we should show the OSD on startup or not. If so, post
* a MSG_VOL_CHNG so that the volume level (or mute) is displayed: */
SendMessage(Window::Handle(), VolumeController::MSG_VOL_CHNG,
NULL, (LPARAM) 1);
if (_settings->ShowOnStartup()) {
SendMessage(Window::Handle(), VolumeController::MSG_VOL_CHNG,
NULL, (LPARAM) 1);
}
}

VolumeOSD::~VolumeOSD() {
Expand Down
44 changes: 13 additions & 31 deletions 3RVX/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,6 @@
#include "Skin/Skin.h"
#include "StringUtils.h"

#define XML_AUDIODEV "audioDeviceID"
#define XML_HIDE_WHENFULL "hideFullscreen"
#define XML_HIDE_DIRECTX "hideDirectX"
#define XML_HIDEANIM "hideAnimation"
#define XML_HIDETIME "hideDelay"
#define XML_HIDESPEED "hideSpeed"
#define XML_LANGUAGE "language"
#define XML_MONITOR "monitor"
#define XML_NOTIFYICON "notifyIcon"
#define XML_ONTOP "onTop"
#define XML_OSD_OFFSET "osdEdgeOffset"
#define XML_OSD_POS "osdPosition"
#define XML_OSD_X "osdX"
#define XML_OSD_Y "osdY"
#define XML_SKIN "skin"
#define XML_SOUNDS "soundEffects"
#define XML_UPDATEAUTO "automaticUpdates"
#define XML_UPDATECHECKTIME "lastUpdateCheck"
#define XML_IGNOREUPDATE "ignoreUpdateVersion"

const std::wstring Settings::MAIN_APP = L"3RVX.exe";
const std::wstring Settings::SETTINGS_APP = L"Settings.exe";
const std::wstring Settings::SETTINGS_FILE = L"Settings.xml";
const std::wstring Settings::LANG_DIR = L"Languages";
const std::wstring Settings::SKIN_DIR = L"Skins";
const std::wstring Settings::SKIN_XML = L"Skin.xml";

const std::wstring Settings::DefaultLanguage = L"English";
const std::wstring Settings::DefaultSkin = L"Classic";

std::wstring Settings::_appDir(L"");
Settings *Settings::instance;

Expand Down Expand Up @@ -592,10 +562,14 @@ tinyxml2::XMLElement *Settings::GetOrCreateElement(std::string elementName) {
return el;
}

bool Settings::AutoUpdateEnabled() {
bool Settings::AutomaticUpdates() {
return GetEnabled(XML_UPDATEAUTO, DefaultAutoUpdate);
}

void Settings::AutomaticUpdates(bool enabled) {
SetEnabled(XML_UPDATEAUTO, enabled);
}

void Settings::LastUpdateCheckNow() {
LastUpdateCheck(std::time(nullptr));
}
Expand Down Expand Up @@ -625,4 +599,12 @@ std::wstring Settings::IgnoreUpdate() {

void Settings::IgnoreUpdate(std::wstring versionString) {
SetText(XML_IGNOREUPDATE, StringUtils::Narrow(versionString));
}

bool Settings::ShowOnStartup() {
return GetEnabled(XML_SHOWONSTART, DefaultShowOnStartup);
}

void Settings::ShowOnStartup(bool show) {
SetEnabled(XML_SHOWONSTART, show);
}
50 changes: 39 additions & 11 deletions 3RVX/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,17 @@ class Settings {
std::unordered_map<int, HotkeyInfo> Hotkeys();
void Hotkeys(std::vector<HotkeyInfo> hotkeys);

bool AutoUpdateEnabled();
bool AutomaticUpdates();
void AutomaticUpdates(bool enabled);
void LastUpdateCheckNow();
void LastUpdateCheck(long long time);
long long LastUpdateCheck();
std::wstring IgnoreUpdate();
void IgnoreUpdate(std::wstring versionString);

bool ShowOnStartup();
void ShowOnStartup(bool show);

public:
/* Static settings methods */

Expand Down Expand Up @@ -129,7 +133,8 @@ class Settings {

private:
Settings() {

/* Don't allow instantiation for this Singleton class; see the
* Instance() method to retrieve an instance instead. */
}

static Settings *instance;
Expand All @@ -153,13 +158,6 @@ class Settings {
tinyxml2::XMLElement *GetOrCreateElement(std::string elementName);

public:
static const std::wstring MAIN_APP;
static const std::wstring SETTINGS_APP;
static const std::wstring SETTINGS_FILE;
static const std::wstring LANG_DIR;
static const std::wstring SKIN_DIR;
static const std::wstring SKIN_XML;

/* Default settings */
static const bool DefaultOnTop = true;
static const AnimationTypes::HideAnimation DefaultHideAnim
Expand All @@ -168,12 +166,42 @@ class Settings {
static const bool DefaultHideDirectX = false;
static const int DefaultHideSpeed = 765;
static const int DefaultHideTime = 800;
static const std::wstring DefaultLanguage;
static const bool DefaultNotifyIcon = true;
static const bool DefaultShowOnStartup = true;
static const bool DefaultSoundsEnabled = true;
static const int DefaultOSDOffset = 140;
static const Settings::OSDPos DefaultOSDPosition = OSDPos::Bottom;
static const std::wstring DefaultSkin;
static const bool DefaultAutoUpdate = false;

static constexpr const wchar_t *MAIN_APP = L"3RVX.exe";
static constexpr const wchar_t *SETTINGS_APP = L"Settings.exe";
static constexpr const wchar_t *SETTINGS_FILE = L"Settings.xml";
static constexpr const wchar_t *LANG_DIR = L"Languages";
static constexpr const wchar_t *SKIN_DIR = L"Skins";
static constexpr const wchar_t *SKIN_XML = L"Skin.xml";

static constexpr const wchar_t *DefaultLanguage = L"English";
static constexpr const wchar_t *DefaultSkin = L"Classic";

/* XML tag names */
static constexpr const char *XML_AUDIODEV = "audioDeviceID";
static constexpr const char *XML_HIDE_WHENFULL = "hideFullscreen";
static constexpr const char *XML_HIDE_DIRECTX = "hideDirectX";
static constexpr const char *XML_HIDEANIM = "hideAnimation";
static constexpr const char *XML_HIDETIME = "hideDelay";
static constexpr const char *XML_HIDESPEED = "hideSpeed";
static constexpr const char *XML_IGNOREUPDATE = "ignoreUpdateVersion";
static constexpr const char *XML_LANGUAGE = "language";
static constexpr const char *XML_MONITOR = "monitor";
static constexpr const char *XML_NOTIFYICON = "notifyIcon";
static constexpr const char *XML_ONTOP = "onTop";
static constexpr const char *XML_OSD_OFFSET = "osdEdgeOffset";
static constexpr const char *XML_OSD_POS = "osdPosition";
static constexpr const char *XML_OSD_X = "osdX";
static constexpr const char *XML_OSD_Y = "osdY";
static constexpr const char *XML_SHOWONSTART = "showOnStartup";
static constexpr const char *XML_SKIN = "skin";
static constexpr const char *XML_SOUNDS = "soundEffects";
static constexpr const char *XML_UPDATEAUTO = "automaticUpdates";
static constexpr const char *XML_UPDATECHECKTIME = "lastUpdateCheck";
};
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ Beta 10
* Custom volume limits
* Brightness OSD
* Keyboard OSD
* Automatic updates

Beta 9
Beta 9 (2.9.1)
------
* Automatic updates
* Compatiblity mode for the old (v2) skin format
* Skin fallback: resources that aren't found will be loaded from the default skin
* Hotkey to disable/enable the OSD
* Option to disable the OSD when another application is full screen
* Option to disable the OSD when a DirectX application has exclusive control of the screen
* Option to not show the volume OSD on startup
* Preliminary 64 bit support
* Bugfix: Translate 'Muted' for the notification icon
* Bugfix: Settings dialog is now re-translated on 'Apply'
Expand Down
37 changes: 37 additions & 0 deletions Languages/ChineseSimplified.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@
<string>
<original>Run on Windows startup</original>
<translation>启动 Windows 时自动运行</translation>
</string>
<string>
<original>Show volume OSD on startup</original>
<translation>启动时显示音量 OSD</translation>
</string>
<string>
<original>Enable volume notification icon</original>
Expand All @@ -80,6 +84,14 @@
<original>Enable sound effects</original>
<translation>声音效果</translation>
</string>
<string>
<original>Automatic updates</original>
<translation>自动更新</translation>
</string>
<string>
<original>Check Now</original>
<translation>马上检查更新</translation>
</string>

<string>
<original>Skin</original>
Expand Down Expand Up @@ -366,4 +378,29 @@
<translation>退出 3RVX</translation>
</string>

<!-- Update Strings -->
<string>
<original>Update Available</original>
<translation>有新的更新</translation>
</string>
<string>
<original>3RVX {1}</original>
<translation>3RVX {1}</translation>
</string>
<string>
<original>Install</original>
<translation>安装</translation>
</string>
<string>
<original>Ignore version</original>
<translation>忽略此版本</translation>
</string>
<string>
<original>Remind me later</original>
<translation>下次再提醒我</translation>
</string>
<string>
<original>Downloading...</original>
<translation>下载中...</translation>
</string>
</translation>
12 changes: 12 additions & 0 deletions Languages/TestLanguage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@
<original>Run on Windows startup</original>
<translation>XXX XX XXXXXXX XXXXXXX</translation>
</string>
<string>
<original>Show volume OSD on startup</original>
<translation>XXXX XXXXXX XXX XX XXXXXXX</translation>
</string>
<string>
<original>Enable volume notification icon</original>
<translation>XXXXXX XXXXXX XXXXXXXXXXXX XXXX</translation>
Expand All @@ -80,6 +84,14 @@
<original>Enable sound effects</original>
<translation>XXXXXX XXXXX XXXXXXX</translation>
</string>
<string>
<original>Automatic updates</original>
<translation>XXXXXXXXX XXXXXXX</translation>
</string>
<string>
<original>Check Now</original>
<translation>XXXXX XXX</translation>
</string>

<string>
<original>Skin</original>
Expand Down
Binary file modified Settings/Resource.h
Binary file not shown.
Binary file removed Settings/Settings.rc
Binary file not shown.
Loading

0 comments on commit 45e37da

Please sign in to comment.