blob: 89b957c4deffdb970d4169846102f3c7584c8931 [file] [log] [blame]
atraczykbee42712016-12-12 17:12:41 -05001/**************************************************************************
2* Copyright (C) 2016 by Savoir-faire Linux *
atraczykbee42712016-12-12 17:12:41 -05003* Author: Traczyk Andreas <andreas.traczyk@savoirfairelinux.com> *
4* *
5* This program is free software; you can redistribute it and/or modify *
6* it under the terms of the GNU General Public License as published by *
7* the Free Software Foundation; either version 3 of the License, or *
8* (at your option) any later version. *
9* *
10* This program is distributed in the hope that it will be useful, *
11* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13* GNU General Public License for more details. *
14* *
15* You should have received a copy of the GNU General Public License *
16* along with this program. If not, see <http://www.gnu.org/licenses/>. *
17**************************************************************************/
18#include "pch.h"
19
20#include "AboutPage.xaml.h"
21
22using namespace RingClientUWP;
23using namespace RingClientUWP::Views;
24
25using namespace Windows::UI::ViewManagement;
26using namespace Windows::UI::Core;
27using namespace Windows::UI::Xaml::Controls;
28
atraczyk746f3762017-02-28 14:12:51 -050029#define BUILD_YEAR_CH0 (__DATE__[ 7])
30#define BUILD_YEAR_CH1 (__DATE__[ 8])
31#define BUILD_YEAR_CH2 (__DATE__[ 9])
32#define BUILD_YEAR_CH3 (__DATE__[10])
33
34#define BUILD_MONTH_IS_JAN (__DATE__[0] == 'J' && __DATE__[1] == 'a' && __DATE__[2] == 'n')
35#define BUILD_MONTH_IS_FEB (__DATE__[0] == 'F')
36#define BUILD_MONTH_IS_MAR (__DATE__[0] == 'M' && __DATE__[1] == 'a' && __DATE__[2] == 'r')
37#define BUILD_MONTH_IS_APR (__DATE__[0] == 'A' && __DATE__[1] == 'p')
38#define BUILD_MONTH_IS_MAY (__DATE__[0] == 'M' && __DATE__[1] == 'a' && __DATE__[2] == 'y')
39#define BUILD_MONTH_IS_JUN (__DATE__[0] == 'J' && __DATE__[1] == 'u' && __DATE__[2] == 'n')
40#define BUILD_MONTH_IS_JUL (__DATE__[0] == 'J' && __DATE__[1] == 'u' && __DATE__[2] == 'l')
41#define BUILD_MONTH_IS_AUG (__DATE__[0] == 'A' && __DATE__[1] == 'u')
42#define BUILD_MONTH_IS_SEP (__DATE__[0] == 'S')
43#define BUILD_MONTH_IS_OCT (__DATE__[0] == 'O')
44#define BUILD_MONTH_IS_NOV (__DATE__[0] == 'N')
45#define BUILD_MONTH_IS_DEC (__DATE__[0] == 'D')
46
47#define BUILD_MONTH_CH0 \
48 ((BUILD_MONTH_IS_OCT || BUILD_MONTH_IS_NOV || BUILD_MONTH_IS_DEC) ? '1' : '0')
49
50#define BUILD_MONTH_CH1 \
51 ( \
52 (BUILD_MONTH_IS_JAN) ? '1' : \
53 (BUILD_MONTH_IS_FEB) ? '2' : \
54 (BUILD_MONTH_IS_MAR) ? '3' : \
55 (BUILD_MONTH_IS_APR) ? '4' : \
56 (BUILD_MONTH_IS_MAY) ? '5' : \
57 (BUILD_MONTH_IS_JUN) ? '6' : \
58 (BUILD_MONTH_IS_JUL) ? '7' : \
59 (BUILD_MONTH_IS_AUG) ? '8' : \
60 (BUILD_MONTH_IS_SEP) ? '9' : \
61 (BUILD_MONTH_IS_OCT) ? '0' : \
62 (BUILD_MONTH_IS_NOV) ? '1' : \
63 (BUILD_MONTH_IS_DEC) ? '2' : \
64 /* error default */ '?' \
65 )
66
67#define BUILD_DAY_CH0 ((__DATE__[4] >= '0') ? (__DATE__[4]) : '0')
68#define BUILD_DAY_CH1 (__DATE__[ 5])
69
atraczykbee42712016-12-12 17:12:41 -050070AboutPage::AboutPage()
71{
72 InitializeComponent();
atraczyk746f3762017-02-28 14:12:51 -050073
74 const char completeVersion[] =
75 {
76 BUILD_YEAR_CH0, BUILD_YEAR_CH1, BUILD_YEAR_CH2, BUILD_YEAR_CH3,
77 '/',
78 BUILD_MONTH_CH0, BUILD_MONTH_CH1,
79 '/',
80 BUILD_DAY_CH0, BUILD_DAY_CH1,
81 '\0'
82 };
83 auto buildDate = std::string(reinterpret_cast<const char*>(completeVersion));
84 PackageVersion version = Package::Current->Id->Version;
85 auto buildVersion = version.Major.ToString() + "." + version.Minor.ToString() + "." + version.Build.ToString();
86 _aboutVersionString_->Text = "Ring version: " + Utils::toPlatformString(buildDate) + " build: " + buildVersion;
atraczykbee42712016-12-12 17:12:41 -050087};
88
89void RingClientUWP::Views::AboutPage::_aboutBasicButton__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
90{
91 _aboutNavGrid_->SetRow(_aboutScrollViewer_, 1);
92 _aboutNavGrid_->SetRow(_creditsScrollViewer_, 0);
93}
94
95
96void RingClientUWP::Views::AboutPage::_aboutCreditsButton__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
97{
98 _aboutNavGrid_->SetRow(_aboutScrollViewer_, 0);
99 _aboutNavGrid_->SetRow(_creditsScrollViewer_, 1);
100}
101
102
103void RingClientUWP::Views::AboutPage::_aboutCloseButton__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
104{
105 auto rootFrame = dynamic_cast<Windows::UI::Xaml::Controls::Frame^>(Window::Current->Content);
106 rootFrame->Navigate(Windows::UI::Xaml::Interop::TypeName(MainPage::typeid), true);
atraczyk746f3762017-02-28 14:12:51 -0500107}