diff --git a/WinRt/keypadhelper.cpp b/WinRt/keypadhelper.cpp deleted file mode 100755 index 688580ff6f24f92d270b8bb311278118b65e7658..0000000000000000000000000000000000000000 --- a/WinRt/keypadhelper.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "keypadhelper.h" - -#include <vccorlib.h> -#include <collection.h> -#include <ppltasks.h> -#include <windows.networking.h> -#include <windows.networking.sockets.h> -#include <windows.storage.streams.h> -#include <windows.foundation.h> -#include <windows.ui.core.h> -#include <windows.ui.viewmanagement.h> - -#include <iostream> - -using namespace Windows::Networking::Sockets; -using namespace Windows::Storage::Streams; -using namespace Windows::Foundation; -using namespace Platform; -using namespace Windows::Web; -using namespace Windows::UI::Core; -using namespace concurrency; - - -KeypadHelper::KeypadHelper(QObject *parent) : QObject(parent) -{ - -} - -void KeypadHelper::showKeypad() { - if(ip){ - ip->TryShow(); - } - -} - -void KeypadHelper::hideKeypad() { - ip->TryHide(); -} \ No newline at end of file diff --git a/WinRt/keypadhelper.h b/WinRt/keypadhelper.h deleted file mode 100755 index c0e7c93742f691d01b05ab878bb83ae7e5e522ba..0000000000000000000000000000000000000000 --- a/WinRt/keypadhelper.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef KEYPADHELPER_H -#define KEYPADHELPER_H - -#include <QObject> -#include <windows.ui.viewmanagement.h> -#include <vccorlib.h> - -#include "WinRt/winrtfix.h" - - -class KeypadHelper : public QObject -{ - Q_OBJECT -public: - explicit KeypadHelper(QObject *parent = 0); - void showKeypad(); - void hideKeypad(); -private: - Windows::UI::ViewManagement::InputPane^ ip = Windows::UI::ViewManagement::InputPane::GetForCurrentView(); - -signals: - -}; - -#endif // KEYPADHELPER_H diff --git a/WinRt/winrtfix.h b/WinRt/winrtfix.h deleted file mode 100755 index 500e4b96adc2490983e1f5f8ff45e2e34263332b..0000000000000000000000000000000000000000 --- a/WinRt/winrtfix.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef WINRTFIX_H -#define WINRTFIX_H - -#include <vccorlib.h> - -using namespace Platform; - -HRESULT __stdcall GetActivationFactoryByPCWSTR(void*, Guid&, void**); -namespace __winRT -{ - HRESULT __stdcall __getActivationFactoryByPCWSTR(const void* str, ::Platform::Guid& pGuid, void** ppActivationFactory) - { - return GetActivationFactoryByPCWSTR(const_cast<void*>(str), pGuid, ppActivationFactory); - } -} - -#endif // WINRTFIX_H diff --git a/ddpRequests/rocketchatupdatepushtokenrequest.cpp b/ddpRequests/rocketchatupdatepushtokenrequest.cpp index 605feba38d6cdfff3d910d2d19980ea1bf156f9d..f3a396b6377fa30c51d5b006cd60c99338b3e675 100755 --- a/ddpRequests/rocketchatupdatepushtokenrequest.cpp +++ b/ddpRequests/rocketchatupdatepushtokenrequest.cpp @@ -37,9 +37,6 @@ RocketChatUpdatePushTokenRequest::RocketChatUpdatePushTokenRequest( const QStrin #ifdef Q_OS_IOS tokenObject["apn"] = pToken; #endif -#ifdef Q_OS_WINRT - //TODO: implement -#endif if ( tokenObject.size() ) { options[QStringLiteral( "userId" )] = pUserId; diff --git a/engine.pro b/engine.pro index b9dddf132d6835c4142037aa4a2a7c2f959b1e26..749f4e6734ea270c592c3534b3a9efc618f99f59 100644 --- a/engine.pro +++ b/engine.pro @@ -2,7 +2,6 @@ TEMPLATE = lib QT += core network websockets sql concurrent CONFIG += c++11 static INCLUDEPATH += websocket\ - websocket/winrtwebsocket\ websocket/linuxwebsocket SOURCES += api/meteorddp.cpp \ diff --git a/notifications/notifications.cpp b/notifications/notifications.cpp index e9404f89736a5ea9b474b02cc0d91aedfacba18b..9be6626d38fb5e6142a578f4570f96508e3afa84 100755 --- a/notifications/notifications.cpp +++ b/notifications/notifications.cpp @@ -36,9 +36,6 @@ Notifications::Notifications() #endif #ifdef Q_OS_IOS mNotificationInstance = new ApplePushNotifications; -#endif -#ifdef Q_OS_WINRT - #endif if ( mNotificationInstance != nullptr ) { diff --git a/rocketchat.cpp b/rocketchat.cpp index 8890a0271c67e97b39d3d1ea565102b8d9d64fae..5c3793087ff853fd9d9d2271fd891e1808b9a2d2 100755 --- a/rocketchat.cpp +++ b/rocketchat.cpp @@ -37,10 +37,6 @@ #include "android/androidcheckpermissions.h" #include "android/androidbadges.h" #endif -#ifdef Q_OS_WINRT -#include "WinRt/keypadhelper.h" -#include <QInputMethod> -#endif #include <QCoreApplication> /** @@ -60,12 +56,6 @@ RocketChat::RocketChat( QGuiApplication *app ) connect( app, &QGuiApplication::applicationStateChanged, this, &RocketChat::onApplicationStateChanged, Qt::UniqueConnection ); this->mStorage = PersistanceLayer::instance(); -#ifdef Q_OS_WINRT - //KeypadHelper *helper = new KeypadHelper(); - //helper->showKeypad(); - mInputMethod = QGuiApplication::inputMethod(); - connect( mInputMethod, &QInputMethod::visibleChanged, this, &RocketChat::onKeyboardVisiblityChanged ); -#endif #ifdef Q_OS_ANDROID mAndroidStatusBarColor = new AndroidStatusBarColor; #endif @@ -834,14 +824,6 @@ void RocketChat::openFileNameReady( const QString &pFile ) } } -void RocketChat::onKeyboardVisiblityChanged() -{ - QRectF keyBoardRect = mInputMethod->keyboardRectangle(); - float height = floor( keyBoardRect.height() / 2 ) - 5; - bool visible = mInputMethod->isVisible(); - emit keyboardVisibilityChanged( visible, height ); -} - void RocketChat::onEmojisReady( const QVariantList &pEmojiList ) { mEmojisReady = true; diff --git a/utils.h b/utils.h index ecde00d0c73f2f366c80a38f452dd5107412ddcc..fffe29758b7e9de9ae18f75ada4e3714e2156cfb 100755 --- a/utils.h +++ b/utils.h @@ -32,19 +32,6 @@ class Utils { public: Utils( const Utils & ) {} -#ifdef Q_OS_WINRT - static Platform::String ^QStringToPlatformString( QString string ) - { - std::wstring wstring = string.toStdWString(); - return ref new Platform::String( wstring.c_str() ); - } - static QString PlatformStringToQString( Platform::String ^string ) - { - std::wstring wString = string->Data(); - QString returnString( QString::fromWCharArray( wString.c_str() ) ); - return returnString.length() ? returnString : ""; - } -#endif static QString removeUtf8Emojis( const QString &pText ); static QString linkiFy( const QString &pText ); static QString emojiFy( const QString &pText, EmojiRepo *pEmojiRepo ); diff --git a/websocket/websocket.cpp b/websocket/websocket.cpp index f4f2a5ded5e39a0d2499200e2010ab57f2ffca50..df19655dcd67ed816cd37628a9a1ddcc730939ab 100755 --- a/websocket/websocket.cpp +++ b/websocket/websocket.cpp @@ -25,21 +25,12 @@ #include <QDebug> #include "websocket.h" -#ifdef Q_OS_WINRT -#include "websocket/winrtwebsocket/websocketwinrt.h" -#else #include "websocketlinux.h" -#endif Websocket::Websocket( QObject *parent ): WebsocketAbstract( parent ) { qRegisterMetaType<QAbstractSocket::SocketState>( "QAbstractSocket::SocketState" ); -#ifdef Q_OS_WINRT - qDebug() << "Windows RT websocket instantiated"; - mWebsocketInstance = new WinRTWebsocket; -#else mWebsocketInstance = new websocketLinux( this ); -#endif connect( mWebsocketInstance, &WebsocketAbstract::connected, this, &Websocket::connected, Qt::UniqueConnection ); connect( mWebsocketInstance, &WebsocketAbstract::textMessageReceived, this, &Websocket::textMessageReceived, Qt::UniqueConnection ); connect( mWebsocketInstance, &WebsocketAbstract::error, this, &Websocket::error, Qt::UniqueConnection ); diff --git a/websocket/winrtwebsocket/websocketwinrt.cpp b/websocket/winrtwebsocket/websocketwinrt.cpp deleted file mode 100755 index d6b44019aad5d75a98fc93b76d5780982f16a647..0000000000000000000000000000000000000000 --- a/websocket/winrtwebsocket/websocketwinrt.cpp +++ /dev/null @@ -1,215 +0,0 @@ -#include "websocketwinrt.h" - -#include <QDebug> -#include <QString> -#include <QUrl> -#include <QObject> -#include <QThread> -#include <QTimer> - -#include <vccorlib.h> -#include <collection.h> -#include <ppltasks.h> -#include <windows.networking.h> -#include <windows.networking.sockets.h> -#include <windows.storage.streams.h> -#include <windows.foundation.h> -#include <windows.ui.core.h> - -#include <iostream> - -using namespace Windows::Networking::Sockets; -using namespace Windows::Storage::Streams; -using namespace Windows::Foundation; -using namespace Platform; -using namespace Windows::Web; -using namespace Windows::UI::Core; -using namespace concurrency; -/* -HRESULT __stdcall GetActivationFactoryByPCWSTR(void*,Guid&, void**); -namespace __winRT -{ - HRESULT __stdcall __getActivationFactoryByPCWSTR(const void* str, ::Platform::Guid& pGuid, void** ppActivationFactory) - { - return GetActivationFactoryByPCWSTR(const_cast<void*>(str), pGuid, ppActivationFactory); - } -}*/ - -WinRTQTSignalHelperClass* WinRTQTSignalHelperClass::helper = NULL; - -WinRTQTSignalHelperClass* WinRTQTSignalHelperClass::instance(){ - if(!helper){ - helper = new WinRTQTSignalHelperClass; - } - return helper; -} - - - -WinRTWebsocket::WinRTWebsocket() -{ - helper = WinRTQTSignalHelperClass::instance(); - connect(helper,&WinRTQTSignalHelperClass::onMessageReceived,this,&WinRTWebsocket::textMessageReceived, Qt::UniqueConnection ); - connect(helper,&WinRTQTSignalHelperClass::onClosed,this,&WinRTWebsocket::closed, Qt::UniqueConnection ); - connect(helper, &WinRTQTSignalHelperClass::onConnected, this, &WinRTWebsocket::connected, Qt::UniqueConnection ); -} - - -void WinRTWebsocket::open(QUrl url){ - QString urlString = url.toString(); - std::wstring urlWString = urlString.toStdWString(); - Platform::String^ refUrl = ref new Platform::String(urlWString.c_str()); - Uri^ server = ref new Uri(refUrl); - serverAdrr = server; - m_context = ref new ReceiveContext; - m_context->init(server); - -} - -void WinRTWebsocket::checkForConnection(){ - if(connectionOpen){ - timer->stop(); - disconnect(timer,&QTimer::timeout,this,&WinRTWebsocket::checkForConnection); - emit(connected()); - } - else{ - //init(serverAdrr); - } -} - -void WinRTWebsocket::close(){ - m_context->close(); -} - -void WinRTWebsocket::sendTextMessage(QString message){ - - m_context->SendMessage(WinRTWebsocket::QStringToPlatformString(message)); - -} - -bool WinRTWebsocket::isValid() -{ - //todo: fix it! - return true; -} - -void WinRTWebsocket::emitOnMessageReceived(QString message) -{ - //emit(MessageReceived(message)); -} - -void WinRTWebsocket::emitOnClosed(){ - close(); - emit(closed()); -} - -void WinRTQTSignalHelperClass::emitOnMessageReceived(QString message) -{ - emit(onMessageReceived(message)); -} - -void WinRTQTSignalHelperClass::emitOnClosed(){ - emit(onClosed()); -} - -void WinRTQTSignalHelperClass::emitOnConnected() { - emit(onConnected()); -} - -WinRTWebsocket::~WinRTWebsocket(){ - close(); - disconnect(helper, &WinRTQTSignalHelperClass::onMessageReceived, this, &WinRTWebsocket::textMessageReceived); - disconnect(helper, &WinRTQTSignalHelperClass::onClosed, this, &WinRTWebsocket::closed); - disconnect(helper, &WinRTQTSignalHelperClass::onConnected, this, &WinRTWebsocket::connected); - // delete helper; - timer->deleteLater(); -} - - -ReceiveContext::ReceiveContext(){ - helper = WinRTQTSignalHelperClass::instance(); -} - -void ReceiveContext::init(Uri^ server){ - qDebug()<<"WinRT init connection"; - - webSocket = ref new MessageWebSocket(); - - webSocket->Control->MessageType = SocketMessageType::Utf8; - webSocket->MessageReceived += ref new TypedEventHandler<MessageWebSocket^, MessageWebSocketMessageReceivedEventArgs^>(this, &ReceiveContext::OnReceive); - webSocket->Closed += ref new TypedEventHandler<IWebSocket^, WebSocketClosedEventArgs^>(this, &ReceiveContext::Closed); - qDebug()<<"start connection task"; - webSocket->ConnectAsync(server); - qDebug()<<"started connection task"; -} - -void ReceiveContext::SendMessage(Platform::String ^message){ - - if(messageWriter){ - messageWriter->WriteString(message); - - messageWriter->StoreAsync(); - } -} - -void ReceiveContext::HandleException(Exception^ exception){ - qDebug()<<"exception"; - WebErrorStatus status = WebSocketError::GetStatus(exception->HResult); - Platform::String^ error = status.ToString(); - qDebug()<<QString::fromStdWString(error->Data()); -} - -void ReceiveContext::OnReceive(MessageWebSocket^ sender, MessageWebSocketMessageReceivedEventArgs^ args){ - if (!connected) { - connected = true; - helper->emitOnConnected(); - } - if(messageWriter == nullptr){ - messageWebSocket = webSocket; - messageWriter = ref new DataWriter(webSocket->OutputStream); - } - - DataReader^ reader = args->GetDataReader(); - reader->UnicodeEncoding = UnicodeEncoding::Utf8; - String^ read = reader->ReadString(reader->UnconsumedBufferLength); - helper->emitOnMessageReceived(WinRTWebsocket::PlatformStringToQString(read)); -} - -void ReceiveContext::Closed(IWebSocket^ sender, WebSocketClosedEventArgs^ args){ - qDebug()<<"closing"; - - helper->emitOnClosed(); -} - -void setupWriter() -{ - -} - -void ReceiveContext::checkMessage(Platform::String^ message) -{ -// if(MessageWebSocket == nullptr){ -// messageWebSocket -// } -} - -void ReceiveContext::close() -{ - try - { - if (messageWebSocket != nullptr) - { - qDebug()<<"closing connection"; - messageWebSocket->Close(1000, "Closed due to user request."); - messageWebSocket = nullptr; - } - else - { - qDebug()<<"connection allready closed"; - } - } - catch (Exception^ exception) - { - HandleException(exception); - } -} diff --git a/websocket/winrtwebsocket/websocketwinrt.h b/websocket/winrtwebsocket/websocketwinrt.h deleted file mode 100755 index 5d40dba6ca28e009ec62f1dbf786458efb074e86..0000000000000000000000000000000000000000 --- a/websocket/winrtwebsocket/websocketwinrt.h +++ /dev/null @@ -1,132 +0,0 @@ -#ifndef WINRTWEBSOCKET_H -#define WINRTWEBSOCKET_H - -#include <QObject> -#include <QTimer> -#include <QVector> -#include <vccorlib.h> -#include <collection.h> -#include <ppltasks.h> -#include <windows.networking.h> -#include <windows.networking.sockets.h> -#include <windows.storage.streams.h> -#include <windows.foundation.h> -#include <windows.ui.core.h> -#include <codecvt> - -#include "websocketabstract.h" -#include "WinRt/winrtfix.h" - - -using namespace Windows::Networking::Sockets; -using namespace Windows::Storage::Streams; -using namespace Windows::Foundation; -using namespace Platform; -using namespace Windows::Web; -using namespace Windows::UI::Core; -using namespace concurrency; - - -//singelton to communicate between ref class an QT -class WinRTQTSignalHelperClass:public QObject{ - Q_OBJECT -public: - WinRTQTSignalHelperClass(){}; - WinRTQTSignalHelperClass(const WinRTQTSignalHelperClass&){}; - - ~WinRTQTSignalHelperClass(){}; - - static WinRTQTSignalHelperClass *helper; - static WinRTQTSignalHelperClass* instance(); - void emitOnClosed(); - void emitOnMessageReceived(QString); - void emitOnConnected(); - -signals: - - void onMessageReceived(QString); - void onClosed(); - void onConnected(); -}; - - -//class to handle responses -ref class ReceiveContext sealed{ -private: - //ugly hack because of Microsoft... - WinRTQTSignalHelperClass* helper; - - MessageWebSocket^ messageWebSocket; - MessageWebSocket^ webSocket; - - bool connected = false; - - DataWriter^ messageWriter; - void HandleException(Exception^ exception); - void checkMessage(Platform::String^); - - -public: - friend class WinRTWebsocket; - ReceiveContext(); - void SendMessage(Platform::String^); - void init( Uri^); - void close(); - void OnReceive(MessageWebSocket^ sender, MessageWebSocketMessageReceivedEventArgs^ args); - void Closed(IWebSocket^ sender, WebSocketClosedEventArgs^ args); - -}; - -class WinRTWebsocket:public WebsocketAbstract -{ - Q_OBJECT -public: - WinRTWebsocket(); - - virtual void open(QUrl) override; - virtual void close() override; - virtual void sendTextMessage(QString) override; - virtual bool isValid(); - - static Platform::String^ QStringToPlatformString(QString string){ - std::string stdString = string.toStdString(); - std::wstring_convert<std::codecvt_utf8<wchar_t>> converter; - std::wstring wstdString = converter.from_bytes(stdString); - return ref new Platform::String(wstdString.c_str()); - } - static QString PlatformStringToQString(Platform::String ^string){ - std::wstring wString = string->Data(); - - using convert_type = std::codecvt_utf8<wchar_t>; - std::wstring_convert<convert_type, wchar_t> converter; - std::string stdString = converter.to_bytes(wString); - - QString retString = QString::fromStdString(stdString); - - return retString.length()?retString:""; - } - - ~WinRTWebsocket(); - -private: - QTimer *timer; - bool connectionOpen=false; - - Uri^ serverAdrr; - int newMessage=0; - WinRTQTSignalHelperClass* helper; - - ReceiveContext^ m_context; - - void checkForConnection(); -signals: - void MessageReceived(QString); - -private slots: - void emitOnMessageReceived(QString); - void emitOnClosed(); -}; - - - -#endif // WINRTWEBSOCKET_H