Added Popup with QR-Codes for easier server-connection and app-download (open with F11)

This commit is contained in:
Florian Küpper committed 2013-12-19 08:54:20 +01:00
1 parent 524d0bee75
commit ae0e63d193
9 files changed
+424 -1

No files matched your search

@@ -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)
+22
View File
@@ -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.
Binary file not shown.
@@ -0,0 +1,255 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<PopupScreenServerQR>
<ScreenVersion>1</ScreenVersion>
<Static1>
<!--<Skin>: Texture name-->
<Skin>SongMenuBG</Skin>
<!--<X>, <Y>, <Z>, <W>, <H>: Static position, width and height-->
<X>0</X>
<Y>0</Y>
<Z>-1,99</Z>
<W>1280</W>
<H>720</H>
<!--<Color>: Static color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<R>1,00</R>
<G>1,00</G>
<B>1,00</B>
<A>0,80</A>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</Static1>
<StaticQRServer>
<!--<Skin>: Texture name-->
<Skin>Menu</Skin>
<!--<X>, <Y>, <Z>, <W>, <H>: Static position, width and height-->
<X>490</X>
<Y>210</Y>
<Z>-2,00</Z>
<W>300</W>
<H>300</H>
<!--<Color>: Static color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>Visible</Color>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</StaticQRServer>
<StaticQRAndroid>
<!--<Skin>: Texture name-->
<Skin>Menu</Skin>
<!--<X>, <Y>, <Z>, <W>, <H>: Static position, width and height-->
<X>25</X>
<Y>25</Y>
<Z>-2,00</Z>
<W>200</W>
<H>200</H>
<!--<Color>: Static color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>Visible</Color>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</StaticQRAndroid>
<StaticQRSymbian>
<!--<Skin>: Texture name-->
<Skin>Menu</Skin>
<!--<X>, <Y>, <Z>, <W>, <H>: Static position, width and height-->
<X>1055</X>
<Y>25</Y>
<Z>-2,00</Z>
<W>200</W>
<H>200</H>
<!--<Color>: Static color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>Visible</Color>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</StaticQRSymbian>
<StaticQRWebOS>
<!--<Skin>: Texture name-->
<Skin>Menu</Skin>
<!--<X>, <Y>, <Z>, <W>, <H>: Static position, width and height-->
<X>25</X>
<Y>495</Y>
<Z>-2,00</Z>
<W>200</W>
<H>200</H>
<!--<Color>: Static color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>Visible</Color>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</StaticQRWebOS>
<StaticQRWindowsPhone>
<!--<Skin>: Texture name-->
<Skin>Menu</Skin>
<!--<X>, <Y>, <Z>, <W>, <H>: Static position, width and height-->
<X>1055</X>
<Y>495</Y>
<Z>-2,00</Z>
<W>200</W>
<H>200</H>
<!--<Color>: Static color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>Visible</Color>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</StaticQRWindowsPhone>
<Text1>
<!--<X>, <Y>: Text position-->
<X>640</X>
<Y>180</Y>
<!--<Z>: Text position-->
<Z>-2,00</Z>
<!--<H>: Text height-->
<H>35</H>
<!--<MaxW>: Maximum text width (if exists)-->
<MaxW>300</MaxW>
<!--<Color>: Text color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>StaticColor</Color>
<!--<SColor>: Selected Text color from ColorScheme (high priority)-->
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
<SColor>TextSColor</SColor>
<!--<Align>: Text align horizontal: Left, Center, Right-->
<Align>Center</Align>
<!--<ResizeAlign>: Text align vertical (on downsizing): Top, Center, Bottom-->
<HAlign>Center</HAlign>
<!--<Style>: Text style: Normal, Italic, Bold, BoldItalic-->
<Style>Bold</Style>
<!--<Font>: Text font name-->
<Font>Outline</Font>
<!--<Text>: Nothing or translation tag-->
<Text>TR_SCREENPSERVERQR_ADDRESS</Text>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</Text1>
<Text2>
<!--<X>, <Y>: Text position-->
<X>125</X>
<Y>230</Y>
<!--<Z>: Text position-->
<Z>-2,00</Z>
<!--<H>: Text height-->
<H>27</H>
<!--<MaxW>: Maximum text width (if exists)-->
<MaxW>200</MaxW>
<!--<Color>: Text color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>StaticColor</Color>
<!--<SColor>: Selected Text color from ColorScheme (high priority)-->
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
<SColor>TextSColor</SColor>
<!--<Align>: Text align horizontal: Left, Center, Right-->
<Align>Center</Align>
<!--<ResizeAlign>: Text align vertical (on downsizing): Top, Center, Bottom-->
<HAlign>Center</HAlign>
<!--<Style>: Text style: Normal, Italic, Bold, BoldItalic-->
<Style>Bold</Style>
<!--<Font>: Text font name-->
<Font>Outline</Font>
<!--<Text>: Nothing or translation tag-->
<Text>Android</Text>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</Text2>
<Text3>
<!--<X>, <Y>: Text position-->
<X>1155</X>
<Y>230</Y>
<!--<Z>: Text position-->
<Z>-2,00</Z>
<!--<H>: Text height-->
<H>27</H>
<!--<MaxW>: Maximum text width (if exists)-->
<MaxW>200</MaxW>
<!--<Color>: Text color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>StaticColor</Color>
<!--<SColor>: Selected Text color from ColorScheme (high priority)-->
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
<SColor>TextSColor</SColor>
<!--<Align>: Text align horizontal: Left, Center, Right-->
<Align>Center</Align>
<!--<ResizeAlign>: Text align vertical (on downsizing): Top, Center, Bottom-->
<HAlign>Center</HAlign>
<!--<Style>: Text style: Normal, Italic, Bold, BoldItalic-->
<Style>Bold</Style>
<!--<Font>: Text font name-->
<Font>Outline</Font>
<!--<Text>: Nothing or translation tag-->
<Text>Symbian</Text>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</Text3>
<Text4>
<!--<X>, <Y>: Text position-->
<X>125</X>
<Y>460</Y>
<!--<Z>: Text position-->
<Z>-2,00</Z>
<!--<H>: Text height-->
<H>27</H>
<!--<MaxW>: Maximum text width (if exists)-->
<MaxW>200</MaxW>
<!--<Color>: Text color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>StaticColor</Color>
<!--<SColor>: Selected Text color from ColorScheme (high priority)-->
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
<SColor>TextSColor</SColor>
<!--<Align>: Text align horizontal: Left, Center, Right-->
<Align>Center</Align>
<!--<ResizeAlign>: Text align vertical (on downsizing): Top, Center, Bottom-->
<HAlign>Center</HAlign>
<!--<Style>: Text style: Normal, Italic, Bold, BoldItalic-->
<Style>Bold</Style>
<!--<Font>: Text font name-->
<Font>Outline</Font>
<!--<Text>: Nothing or translation tag-->
<Text>WebOS</Text>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</Text4>
<Text5>
<!--<X>, <Y>: Text position-->
<X>1155</X>
<Y>460</Y>
<!--<Z>: Text position-->
<Z>-2,00</Z>
<!--<H>: Text height-->
<H>27</H>
<!--<MaxW>: Maximum text width (if exists)-->
<MaxW>200</MaxW>
<!--<Color>: Text color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>StaticColor</Color>
<!--<SColor>: Selected Text color from ColorScheme (high priority)-->
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
<SColor>TextSColor</SColor>
<!--<Align>: Text align horizontal: Left, Center, Right-->
<Align>Center</Align>
<!--<ResizeAlign>: Text align vertical (on downsizing): Top, Center, Bottom-->
<HAlign>Center</HAlign>
<!--<Style>: Text style: Normal, Italic, Bold, BoldItalic-->
<Style>Bold</Style>
<!--<Font>: Text font name-->
<Font>Outline</Font>
<!--<Text>: Nothing or translation tag-->
<Text>Windows Phone</Text>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</Text5>
</PopupScreenServerQR>
</root>
+9
View File
@@ -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)
+5
View File
@@ -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;
+114
View File
@@ -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 <http://www.gnu.org/licenses/>.
#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));
}
}
}
+6 -1
View File
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">DebugWin</Configuration>
@@ -191,6 +191,10 @@
<Reference Include="OpenTK.GLControl">
<HintPath>..\Output\OpenTK.GLControl.dll</HintPath>
</Reference>
<Reference Include="QRCoder, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Output\QRCoder.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
@@ -239,6 +243,7 @@
<Compile Include="Lib\Input\CControllerFramework.cs" />
<Compile Include="Lib\Video\Acinerella\CDecoder.cs" />
<Compile Include="Lib\Video\Acinerella\CFramebuffer.cs" />
<Compile Include="Screens\CPopupScreenServerQR.cs" />
<Compile Include="SongQueue\CSongQueue.cs" />
<Compile Include="GameModes\IGameMode.cs" />
<Compile Include="SongQueue\ISongQueue.cs" />
+1
View File
@@ -345,6 +345,7 @@ namespace VocaluxeLib
{
PopupPlayerControl = 0,
PopupVolumeControl = 1,
PopupServerQR = 2,
NoPopup = -1
}