diff --git a/ClientServerLib/ClientServerLib/CServer.cs b/ClientServerLib/ClientServerLib/CServer.cs index c6435566..57bbe01d 100644 --- a/ClientServerLib/ClientServerLib/CServer.cs +++ b/ClientServerLib/ClientServerLib/CServer.cs @@ -203,6 +203,18 @@ namespace ServerLib _Init(port, encrypted); } + public static string GetLocalAddress() + { + IPAddress[] ips = Dns.GetHostAddresses(Dns.GetHostName()); + string IPAddress = ""; + foreach (IPAddress ip in ips) + { + if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) + IPAddress = ip.ToString(); + } + return IPAddress; + } + #region server control private void _Init(int port, bool encrypted) diff --git a/Output/LICENSE QRCoder.txt b/Output/LICENSE QRCoder.txt new file mode 100644 index 00000000..5624f5cf --- /dev/null +++ b/Output/LICENSE QRCoder.txt @@ -0,0 +1,22 @@ +// QRCode.dll from https://github.com/codebude/QRCoder/ + +The MIT License (MIT) + +Copyright (c) 2013 Raffael Herrmann + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/Output/QRCoder.dll b/Output/QRCoder.dll new file mode 100644 index 00000000..5e9f62c3 Binary files /dev/null and b/Output/QRCoder.dll differ diff --git a/Output/Themes/Ambient/Screens/PopupScreenServerQR.xml b/Output/Themes/Ambient/Screens/PopupScreenServerQR.xml new file mode 100644 index 00000000..bb9ce46a --- /dev/null +++ b/Output/Themes/Ambient/Screens/PopupScreenServerQR.xml @@ -0,0 +1,255 @@ + + + + 1 + + + SongMenuBG + + 0 + 0 + -1,99 + 1280 + 720 + + + 1,00 + 1,00 + 1,00 + 0,80 + + + + + + + Menu + + 490 + 210 + -2,00 + 300 + 300 + + + Visible + + + + + + + Menu + + 25 + 25 + -2,00 + 200 + 200 + + + Visible + + + + + + + Menu + + 1055 + 25 + -2,00 + 200 + 200 + + + Visible + + + + + + + Menu + + 25 + 495 + -2,00 + 200 + 200 + + + Visible + + + + + + + Menu + + 1055 + 495 + -2,00 + 200 + 200 + + + Visible + + + + + + + 640 + 180 + + -2,00 + + 35 + + 300 + + + StaticColor + + + TextSColor + + Center + + Center + + + + Outline + + TR_SCREENPSERVERQR_ADDRESS + + + + + + + 125 + 230 + + -2,00 + + 27 + + 200 + + + StaticColor + + + TextSColor + + Center + + Center + + + + Outline + + Android + + + + + + + 1155 + 230 + + -2,00 + + 27 + + 200 + + + StaticColor + + + TextSColor + + Center + + Center + + + + Outline + + Symbian + + + + + + + 125 + 460 + + -2,00 + + 27 + + 200 + + + StaticColor + + + TextSColor + + Center + + Center + + + + Outline + + WebOS + + + + + + + 1155 + 460 + + -2,00 + + 27 + + 200 + + + StaticColor + + + TextSColor + + Center + + Center + + + + Outline + + Windows Phone + + + + + + diff --git a/Vocaluxe/Base/CGraphics.cs b/Vocaluxe/Base/CGraphics.cs index 5a7fdd54..91878e51 100644 --- a/Vocaluxe/Base/CGraphics.cs +++ b/Vocaluxe/Base/CGraphics.cs @@ -90,6 +90,7 @@ namespace Vocaluxe.Base _PopupScreens.Add(new CPopupScreenPlayerControl()); _PopupScreens.Add(new CPopupScreenVolumeControl()); + _PopupScreens.Add(new CPopupScreenServerQR()); CLog.StopBenchmark(1, "Build Screen List"); @@ -379,6 +380,14 @@ namespace Vocaluxe.Base _Cursor.FadeOut(); } + if (keyEvent.Key == Keys.F11) + { + if (_CurrentPopupScreen == EPopupScreens.NoPopup) + ShowPopup(EPopupScreens.PopupServerQR); + else + HidePopup(EPopupScreens.PopupServerQR); + } + if (popupPlayerControlAllowed && keyEvent.Key == Keys.Tab) { if (_CurrentPopupScreen == EPopupScreens.NoPopup && CConfig.BackgroundMusic == EOffOn.TR_CONFIG_ON) diff --git a/Vocaluxe/Base/CSettings.cs b/Vocaluxe/Base/CSettings.cs index 64fec3d6..bfd0aa35 100644 --- a/Vocaluxe/Base/CSettings.cs +++ b/Vocaluxe/Base/CSettings.cs @@ -116,6 +116,11 @@ namespace Vocaluxe.Base public const string FolderPartyModeLanguages = "Languages"; public const string FolderPartyModeFonts = "Fonts"; + public const string LinkAndroidApp = "https://build.phonegap.com/apps/639714/download/android/?qr_key=uY98ymvTr6K144RyTdhs"; + public const string LinkSymbianApp = "https://build.phonegap.com/apps/639714/download/symbian/?qr_key=uY98ymvTr6K144RyTdhs"; + public const string LinkWebOSApp = "https://build.phonegap.com/apps/639714/download/webos/?qr_key=uY98ymvTr6K144RyTdhs"; + public const string LinkWindowsPhoneApp = "https://build.phonegap.com/apps/639714/download/winphone/?qr_key=uY98ymvTr6K144RyTdhs"; + //public const String[] ToneStrings = new String[]{ "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B" }; public const int ToneMin = -36; public const int ToneMax = 89; diff --git a/Vocaluxe/Screens/CPopupScreenServerQR.cs b/Vocaluxe/Screens/CPopupScreenServerQR.cs new file mode 100644 index 00000000..73a11a88 --- /dev/null +++ b/Vocaluxe/Screens/CPopupScreenServerQR.cs @@ -0,0 +1,114 @@ +#region license +// This file is part of Vocaluxe. +// +// Vocaluxe is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Vocaluxe is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Vocaluxe. If not, see . +#endregion + +using ServerLib; +using Vocaluxe.Base; +using VocaluxeLib; +using VocaluxeLib.Menu; +using VocaluxeLib.Draw; +using QRCoder; + +namespace Vocaluxe.Screens +{ + class CPopupScreenServerQR : CMenu + { + // Version number for theme files. Increment it, if you've changed something on the theme files! + protected override int _ScreenVersion + { + get { return 1; } + } + + private CTexture _QRServerAddress; + private CTexture _QRAndroidLink; + private CTexture _QRSymbianLink; + private CTexture _QRWebOSLink; + private CTexture _QRWindowsPhoneLink; + + private const string _StaticQRServer = "StaticQRServer"; + private const string _StaticQRAndroid = "StaticQRAndroid"; + private const string _StaticQRSymbian = "StaticQRSymbian"; + private const string _StaticQRWebOS = "StaticQRWebOS"; + private const string _StaticQRWindowsPhone = "StaticQRWindowsPhone"; + + public override void Init() + { + base.Init(); + + _ThemeStatics = new string[] { _StaticQRServer, _StaticQRAndroid, _StaticQRSymbian, _StaticQRWebOS, _StaticQRWindowsPhone }; + } + + public override void LoadTheme(string xmlPath) + { + base.LoadTheme(xmlPath); + _GenerateQRs(); + _Statics[_StaticQRServer].Texture = _QRServerAddress; + _Statics[_StaticQRAndroid].Texture = _QRAndroidLink; + _Statics[_StaticQRSymbian].Texture = _QRSymbianLink; + _Statics[_StaticQRWebOS].Texture = _QRWebOSLink; + _Statics[_StaticQRWindowsPhone].Texture = _QRWindowsPhoneLink; + + } + + public override bool HandleMouse(SMouseEvent mouseEvent) + { + if (mouseEvent.LB) + { + CGraphics.HidePopup(EPopupScreens.PopupServerQR); + return true; + } + return false; + } + + public override bool UpdateGame() + { + return true; + } + + public override bool Draw() + { + if (!_Active) + return false; + + return base.Draw(); + } + + private void _GenerateQRs() + { + QRCodeGenerator qr = new QRCodeGenerator(); + + //ServerAddress + QRCodeGenerator.QRCode qrcode = qr.CreateQrCode(CServer.GetLocalAddress() + ":" + CConfig.ServerPort, QRCodeGenerator.ECCLevel.H); + _QRServerAddress = CDraw.AddTexture(qrcode.GetGraphic(20)); + + //Android + qrcode = qr.CreateQrCode(CSettings.LinkAndroidApp, QRCodeGenerator.ECCLevel.H); + _QRAndroidLink = CDraw.AddTexture(qrcode.GetGraphic(20)); + + //Symbian + qrcode = qr.CreateQrCode(CSettings.LinkSymbianApp, QRCodeGenerator.ECCLevel.H); + _QRSymbianLink = CDraw.AddTexture(qrcode.GetGraphic(20)); + + //WebOS + qrcode = qr.CreateQrCode(CSettings.LinkWebOSApp, QRCodeGenerator.ECCLevel.H); + _QRWebOSLink = CDraw.AddTexture(qrcode.GetGraphic(20)); + + //WindowsPhone + qrcode = qr.CreateQrCode(CSettings.LinkWindowsPhoneApp, QRCodeGenerator.ECCLevel.H); + _QRWindowsPhoneLink = CDraw.AddTexture(qrcode.GetGraphic(20)); + } + } +} diff --git a/Vocaluxe/Vocaluxe.csproj b/Vocaluxe/Vocaluxe.csproj index 2dec4b8e..69fdef19 100644 --- a/Vocaluxe/Vocaluxe.csproj +++ b/Vocaluxe/Vocaluxe.csproj @@ -1,4 +1,4 @@ - + DebugWin @@ -191,6 +191,10 @@ ..\Output\OpenTK.GLControl.dll + + False + ..\Output\QRCoder.dll + @@ -239,6 +243,7 @@ + diff --git a/VocaluxeLib/Enums.cs b/VocaluxeLib/Enums.cs index 97e008a8..ca33f94e 100644 --- a/VocaluxeLib/Enums.cs +++ b/VocaluxeLib/Enums.cs @@ -345,6 +345,7 @@ namespace VocaluxeLib { PopupPlayerControl = 0, PopupVolumeControl = 1, + PopupServerQR = 2, NoPopup = -1 }