SmartPanel.xaml.h 11.2 KB
Newer Older
1
/**************************************************************************
Nicolas Jager's avatar
Nicolas Jager committed
2
3
* Copyright (C) 2016 by Savoir-faire Linux                                *
* Author: Jäger Nicolas <nicolas.jager@savoirfairelinux.com>              *
4
* Author: Traczyk Andreas <andreas.traczyk@savoirfairelinux.com>          *
Nicolas Jager's avatar
Nicolas Jager committed
5
6
7
8
9
10
11
12
13
14
15
16
17
18
*                                                                         *
* This program 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.                                     *
*                                                                         *
* This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.   *
**************************************************************************/
19
20
#pragma once

Nicolas Jager's avatar
Nicolas Jager committed
21
22
#include "SmartPanel.g.h"

23
24
#include <regex>

25
26
27
28
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Controls;
using namespace Windows::UI::Xaml::Input;
using namespace Windows::UI::Xaml::Interop;
29
using namespace Windows::UI::Xaml::Documents;
30

Nicolas Jager's avatar
Nicolas Jager committed
31
32
namespace RingClientUWP
{
Nicolas Jager's avatar
Nicolas Jager committed
33
34

delegate void ToggleSmartPan();
Nicolas Jager's avatar
Nicolas Jager committed
35
36
37
delegate void SummonMessageTextPage();
delegate void SummonVideoPage();
delegate void SummonWelcomePage();
38
39
delegate void SummonPreviewPage();
delegate void HidePreviewPage();
Nicolas Jager's avatar
Nicolas Jager committed
40

Nicolas Jager's avatar
Nicolas Jager committed
41
42
namespace Views
{
Nicolas Jager's avatar
Nicolas Jager committed
43

Nicolas Jager's avatar
Nicolas Jager committed
44
45
46
47
public ref class SmartPanel sealed
{
public:
    SmartPanel();
48
    void updatePageContent();
Nicolas Jager's avatar
Nicolas Jager committed
49
50
51
52

internal:
    enum class Mode { Minimized, Normal };
    event ToggleSmartPan^ toggleSmartPan;
Nicolas Jager's avatar
Nicolas Jager committed
53
54
55
    event SummonMessageTextPage^ summonMessageTextPage;
    event SummonVideoPage^ summonVideoPage;
    event SummonWelcomePage^ summonWelcomePage;
56
57
    event SummonPreviewPage^ summonPreviewPage;
    event HidePreviewPage^ hidePreviewPage;
Nicolas Jager's avatar
Nicolas Jager committed
58
59
60
    void setMode(RingClientUWP::Views::SmartPanel::Mode mode);

private:
61
62
    enum class MenuOpen {
        CONTACTS_LIST,
63
        CONTACTREQUEST_LIST,
64
65
66
67
68
69
        ACCOUNTS_LIST,
        SHARE,
        DEVICE,
        SETTINGS
    } menuOpen;

70
    /* functions */
71
    void setBannedListState(bool visible);
72
73
74
75
76
77
78
    void _addAccountBtn__Click(Platform::Object^ sender, RoutedEventArgs^ e);
    void _createAccountYes__Click(Platform::Object^ sender, RoutedEventArgs^ e);
    void _createAccountNo__Click(Platform::Object^ sender, RoutedEventArgs^ e);
    void _smartList__SelectionChanged(Platform::Object^ sender, SelectionChangedEventArgs^ e);
    void _accountList__SelectionChanged(Platform::Object^ sender, SelectionChangedEventArgs^ e);
    void _rejectIncomingCallBtn__Click(Platform::Object^ sender, RoutedEventArgs^ e);
    void _acceptIncomingCallBtn__Click(Platform::Object^ sender, RoutedEventArgs^ e);
79
    void _callBtn__Click(Platform::Object^ sender, RoutedEventArgs^ e);
80
    void _cancelCallBtn__Click(Platform::Object^ sender, RoutedEventArgs^ e);
81
82
    void SmartPanelItem_Grid_PointerEntered(Platform::Object^ sender, PointerRoutedEventArgs^ e);
    void SmartPanelItem_Grid_PointerExited(Platform::Object^ sender, PointerRoutedEventArgs^ e);
83
84
85
    void _videoDeviceComboBox__SelectionChanged(Platform::Object^ sender, RoutedEventArgs^);
    void _videoResolutionComboBox__SelectionChanged(Platform::Object^ sender, RoutedEventArgs^);
    void _videoRateComboBox__SelectionChanged(Platform::Object^ sender, RoutedEventArgs^);
86
87
88
    void populateVideoDeviceSettingsComboBox();
    void populateVideoResolutionSettingsComboBox();
    void populateVideoRateSettingsComboBox();
Nicolas Jager's avatar
Nicolas Jager committed
89
90
    void checkStateAddAccountMenu();
    void checkStateEditionMenu();
91
    void ringTxtBxPlaceHolderDelay(String^ placeHolderText, int delayInMilliSeconds);
92
    void showLinkThisDeviceStep1();
93
    void OnstateChange(Platform::String ^callId, RingClientUWP::CallStatus state, int code);
94
95
96
    void addToContactList(String^ name);
    void undoListBoxDeselection(ListBox^ listBox, SelectionChangedEventArgs^ e);
    void placeCall(SmartPanelItem^ item);
97
    void _addDevice__Click(Platform::Object^ sender, RoutedEventArgs^ e);
98
    void OndevicesListRefreshed(Map<String^, String^>^ deviceMap);
99
100
    void _pinGeneratorYes__Click(Platform::Object^ sender, RoutedEventArgs^ e);
    void _pinGeneratorNo__Click(Platform::Object^ sender, RoutedEventArgs^ e);
101
    void OnexportOnRingEnded(Platform::String ^accountId, Platform::String ^pin);
102
103
104
105
    void _closePin__Click(Platform::Object^ sender, RoutedEventArgs^ e);
    void _editAccountMenuButton__Click(Platform::Object^ sender, RoutedEventArgs^ e);
    void _acceptAccountModification__Click(Platform::Object^ sender, RoutedEventArgs^ e);
    void _cancelAccountModification__Click(Platform::Object^ sender, RoutedEventArgs^ e);
106
    void OnaccountUpdated(RingClientUWP::Account ^account);
107
108
109
110
111
112
113
114
    void _passwordBoxAccountCreationCheck__PasswordChanged(Platform::Object^ sender, RoutedEventArgs^ e);
    void _accountTypeComboBox__SelectionChanged(Platform::Object^ sender, SelectionChangedEventArgs^ e);
    void _accountAliasTextBox__TextChanged(Platform::Object^ sender, TextChangedEventArgs^ e);
    void _accountAliasTextBoxEdition__TextChanged(Platform::Object^ sender, TextChangedEventArgs^ e);
    void _selectedAccountAvatarContainer__PointerEntered(Platform::Object^ sender, PointerRoutedEventArgs^ e);
    void _selectedAccountAvatarContainer__PointerReleased(Platform::Object^ sender, PointerRoutedEventArgs^ e);
    void _selectedAccountAvatarContainer__PointerExited(Platform::Object^ sender, PointerRoutedEventArgs^ e);
    void _smartList__PointerExited(Platform::Object^ sender, PointerRoutedEventArgs^ e);
115
    void SmartPanelItem_Grid_PointerMoved(Platform::Object^ sender, PointerRoutedEventArgs^ e);
116
117
    void _registerOnBlockchainEdition__Click(Platform::Object^ sender, RoutedEventArgs^ e);
    void _usernameTextBoxEdition__KeyUp(Platform::Object^ sender, KeyRoutedEventArgs^ e);
118
    void OnregisteredNameFound(RingClientUWP::LookupStatus status, const std::string& accountId, const std::string& address, const std::string& name);
119
120
121
122
123
124
125
126
127
    void _RegisterState__Toggled(Platform::Object^ sender, RoutedEventArgs^ e);
    void _usernameTextBox__KeyUp(Platform::Object^ sender, KeyRoutedEventArgs^ e);
    void _RegisterStateEdition__Toggled(Platform::Object^ sender, RoutedEventArgs^ e);
    void _ringTxtBx__KeyUp(Platform::Object^ sender, KeyRoutedEventArgs^ e);
    void _linkThisDeviceBtn__Click(Platform::Object^ sender, RoutedEventArgs^ e);
    void _step2button__Click(Platform::Object^ sender, RoutedEventArgs^ e);
    void _step1button__Click(Platform::Object^ sender, RoutedEventArgs^ e);
    void _addAccountNo__Click(Platform::Object^ sender, RoutedEventArgs^ e);
    void _addAccountYes__Click(Platform::Object^ sender, RoutedEventArgs^ e);
128
    void OnregistrationStateErrorGeneric(const std::string& accountId);
129
    void _PINTextBox__GotFocus(Platform::Object^ sender, RoutedEventArgs^ e);
130
    void OnnameRegistred(bool status, String ^accountId);
131
    void OnregistrationStateRegistered(const std::string& accountId);
132
    void OncallPlaced(Platform::String ^callId);
133
134
135
136
    void OncontactDataModified(Platform::String ^account, Contact^ contact);
    void OnnewBuddyNotification(const std::string& accountId, const std::string& address, int status);
    void updateContactNotificationsState(Contact^ contact);
    void updateNotificationsState();
137
    void selectMenu(MenuOpen menu);
138
139
140
    void _addAccountInputValidation__KeyUp(Platform::Object^ sender, RoutedEventArgs^ e);
    void OnregistrationStateChanged(const std::string& accountId);
    void updateCallAnimationState(SmartPanelItem^ item, bool state);
141
    void OnincomingAccountMessage(Platform::String ^accountId, Platform::String ^from, Platform::String ^payload);
142
143
144
145
146
147
    void _ringTxtBx__Click(Platform::Object^ sender, RoutedEventArgs^ e);
    void _contactsListMenuButton__Click(Platform::Object^ sender, RoutedEventArgs^ e);
    void _accountsMenuButton__Click(Platform::Object^ sender, RoutedEventArgs^ e);
    void _shareMenuButton__Click(Platform::Object^ sender, RoutedEventArgs^ e);
    void _devicesMenuButton__Click(Platform::Object^ sender, RoutedEventArgs^ e);
    void _settingsMenuButton__Click(Platform::Object^ sender, RoutedEventArgs^ e);
148
    void showWelcomePage();
149
    void _passwordForPinGenerator__KeyUp(Platform::Object^ sender, KeyRoutedEventArgs^ e);
150
    void requestPin();
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
    void ContactRequestItem_Grid_PointerReleased(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e);
    void ContactRequestItem_Grid_PointerEntered(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e);
    void ContactRequestItem_Grid_PointerExited(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e);
    void ContactRequestItem_Grid_PointerMoved(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e);
    void _contactRequestListMenuButton__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
    void _acceptContactRequestBtn__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
    void _rejectContactRequestBtn__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
    void _blockContactBtn__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
    void _smartList__GotFocus(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
    void _showBannedList__PointerPressed(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e);
    void _addBannedContactBtn__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
    void SmartPanelItem_Grid_RightTapped(Platform::Object^ sender, Windows::UI::Xaml::Input::RightTappedRoutedEventArgs^ e);
    void _videocall_MenuFlyoutItem_Tapped(Platform::Object^ sender, Windows::UI::Xaml::Input::TappedRoutedEventArgs^ e);
    void _addToConference_MenuFlyoutItem__Tapped(Platform::Object^ sender, Windows::UI::Xaml::Input::TappedRoutedEventArgs^ e);
    void _copyRingID_MenuFlyoutItem__Tapped(Platform::Object^ sender, Windows::UI::Xaml::Input::TappedRoutedEventArgs^ e);
    void SmartPanelItem_Grid_DoubleTapped(Platform::Object^ sender, Windows::UI::Xaml::Input::DoubleTappedRoutedEventArgs^ e);
    void _revokeDeviceButton__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
    void _deviceName__KeyUp(Platform::Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e);
    void _deviceName__LostFocus(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
    void _turnEnabledToggle__Toggled(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
    void _deleteAccountButton__Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);
    void _removeContact_MenuFlyoutItem__Tapped(Platform::Object^ sender, Windows::UI::Xaml::Input::TappedRoutedEventArgs^ e);
Nicolas Jager's avatar
Nicolas Jager committed
173
174
};
}
Nicolas Jager's avatar
Nicolas Jager committed
175
}