Commit b059a66c authored by Nicolas Jager's avatar Nicolas Jager

fix : crlf

Change-Id: I92527662a9a6eb23bf4246f0c67fb2c6a560fe8d
Tuleap: #972
parent b4b8554d
......@@ -32,10 +32,10 @@ void
AccountsViewModel::add(std::string& name, std::string& ringID, std::string& accountType)
{
accountsList_->Append(ref new Account(
Utils::toPlatformString(name),
Utils::toPlatformString(ringID),
Utils::toPlatformString(accountType)
));
Utils::toPlatformString(name),
Utils::toPlatformString(ringID),
Utils::toPlatformString(accountType)
));
}
void
......
#pragma once
/**************************************************************************
* Copyright (C) 2016 by Savoir-faire Linux *
* Author: Jäger Nicolas <nicolas.jager@savoirfairelinux.com> *
* Author: Traczyk Andreas <traczyk.andreas@savoirfairelinux.com> *
* *
* 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/>. *
**************************************************************************/
using namespace Platform;
using namespace Windows::Data::Json;
using namespace Windows::UI::Xaml::Data;
/* strings required by Windows::Data::Json. Defined here on puprose */
String^ nameKey = "name";
String^ ringIDKey = "ringid";
String^ contactKey = "contact";
String^ contactListKey = "contactlist";
namespace RingClientUWP
{
ref class Conversation;
public ref class Contact sealed : public INotifyPropertyChanged
{
public:
Contact(String^ name, String^ ringID);
JsonObject^ ToJsonObject();
virtual event PropertyChangedEventHandler^ PropertyChanged;
property String^ name_;
property String^ ringID_;
property Conversation^ _conversation
{
Conversation^ get()
{
return conversation_;
}
}
protected:
void NotifyPropertyChanged(String^ propertyName);
private:
Conversation^ conversation_;
};
}
#pragma once
/**************************************************************************
* Copyright (C) 2016 by Savoir-faire Linux *
* Author: Jäger Nicolas <nicolas.jager@savoirfairelinux.com> *
* Author: Traczyk Andreas <traczyk.andreas@savoirfairelinux.com> *
* *
* 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/>. *
**************************************************************************/
using namespace Platform;
using namespace Windows::Data::Json;
using namespace Windows::UI::Xaml::Data;
/* strings required by Windows::Data::Json. Defined here on puprose */
String^ nameKey = "name";
String^ ringIDKey = "ringid";
String^ contactKey = "contact";
String^ contactListKey = "contactlist";
namespace RingClientUWP
{
ref class Conversation;
public ref class Contact sealed : public INotifyPropertyChanged
{
public:
Contact(String^ name, String^ ringID);
JsonObject^ ToJsonObject();
virtual event PropertyChangedEventHandler^ PropertyChanged;
property String^ name_;
property String^ ringID_;
property Conversation^ _conversation
{
Conversation^ get()
{
return conversation_;
}
}
protected:
void NotifyPropertyChanged(String^ propertyName);
private:
Conversation^ conversation_;
};
}
This diff is collapsed.
#pragma once
/**************************************************************************
* Copyright (C) 2016 by Savoir-faire Linux *
* Author: Jäger Nicolas <nicolas.jager@savoirfairelinux.com> *
* *
* 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/>. *
**************************************************************************/
using namespace Concurrency;
using namespace Platform::Collections;
namespace RingClientUWP
{
delegate void NewContactSelected();
delegate void NoContactSelected();
namespace ViewModel {
public ref class ContactsViewModel sealed
{
internal:
/* singleton */
static property ContactsViewModel^ instance
{
ContactsViewModel^ get()
{
static ContactsViewModel^ instance_ = ref new ContactsViewModel();
return instance_;
}
}
/* functions */
Contact^ findContactByName(String^ name);
Contact^ addNewContact(String^ name, String^ ringId);
void saveContactsToFile();
void openContactsFromFile();
String^ Stringify();
void Destringify(String^ data);
/* properties */
property Contact^ selectedContact
{
Contact^ get()
{
return currentItem_;
}
void set(Contact^ value)
{
oldItem_ = currentItem_;
currentItem_ = value;
if (value)
newContactSelected();
else
noContactSelected();
}
}
property Vector<Contact^>^ contactsList
{
Vector<Contact^>^ get()
{
return contactsList_;
}
}
/* events */
event NewContactSelected^ newContactSelected;
event NoContactSelected^ noContactSelected;
private:
ContactsViewModel(); // singleton
Vector<Contact^>^ contactsList_;
Contact^ currentItem_;
Contact^ oldItem_;
};
}
}
#pragma once
/**************************************************************************
* Copyright (C) 2016 by Savoir-faire Linux *
* Author: Jäger Nicolas <nicolas.jager@savoirfairelinux.com> *
* *
* 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/>. *
**************************************************************************/
using namespace Concurrency;
using namespace Platform::Collections;
namespace RingClientUWP
{
delegate void NewContactSelected();
delegate void NoContactSelected();
namespace ViewModel {
public ref class ContactsViewModel sealed
{
internal:
/* singleton */
static property ContactsViewModel^ instance
{
ContactsViewModel^ get()
{
static ContactsViewModel^ instance_ = ref new ContactsViewModel();
return instance_;
}
}
/* functions */
Contact^ findContactByName(String^ name);
Contact^ addNewContact(String^ name, String^ ringId);
void saveContactsToFile();
void openContactsFromFile();
String^ Stringify();
void Destringify(String^ data);
/* properties */
property Contact^ selectedContact
{
Contact^ get()
{
return currentItem_;
}
void set(Contact^ value)
{
oldItem_ = currentItem_;
currentItem_ = value;
if (value)
newContactSelected();
else
noContactSelected();
}
}
property Vector<Contact^>^ contactsList
{
Vector<Contact^>^ get()
{
return contactsList_;
}
}
/* events */
event NewContactSelected^ newContactSelected;
event NoContactSelected^ noContactSelected;
private:
ContactsViewModel(); // singleton
Vector<Contact^>^ contactsList_;
Contact^ currentItem_;
Contact^ oldItem_;
};
}
}
......@@ -49,7 +49,7 @@ LoadingPage::LoadingPage()
InitializeComponent();
Utils::fileExists(ApplicationData::Current->LocalFolder, ".config\\dring.yml")
.then([this](bool config_exists)
.then([this](bool config_exists)
{
if (config_exists) {
RingD::instance->hasConfig = true;
......
This diff is collapsed.
This diff is collapsed.
#pragma once
#include <pch.h>
using namespace Platform;
using namespace Windows::Storage;
namespace RingClientUWP
{
namespace Utils
{
task<bool>
fileExists(StorageFolder^ folder, String^ fileName)
{
return create_task(folder->GetFileAsync(fileName))
.then([](task<StorageFile^> taskResult)
{
bool exists;
try {
taskResult.get();
exists = true;
}
catch (COMException ^e) {
if (e->HResult == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) {
exists = false;
}
else {
throw;
}
}
return exists;
});
}
std::string makeString(const std::wstring& wstr)
{
auto wideData = wstr.c_str();
int bufferSize = WideCharToMultiByte(CP_UTF8, 0, wideData, -1, nullptr, 0, NULL, NULL);
std::unique_ptr<char[]> utf8;
utf8.reset(new char[bufferSize]);
if (WideCharToMultiByte(CP_UTF8, 0, wideData, -1, utf8.get(), bufferSize, NULL, NULL) == 0) {
return std::string();
}
return std::string(utf8.get());
}
std::wstring makeWString(const std::string& str)
{
auto utf8Data = str.c_str();
int bufferSize = MultiByteToWideChar(CP_UTF8, 0, utf8Data, -1, nullptr, 0);
std::unique_ptr<wchar_t[]> wide;
wide.reset(new wchar_t[bufferSize]);
if (MultiByteToWideChar(CP_UTF8, 0, utf8Data, -1, wide.get(), bufferSize) == 0) {
return std::wstring();
}
return std::wstring(wide.get());;
}
std::string toString(Platform::String ^str)
{
std::wstring wsstr(str->Data());
return makeString(wsstr);
}
Platform::String^ toPlatformString(const std::string& str)
{
std::wstring wsstr = makeWString(str);
return ref new Platform::String(wsstr.c_str(), wsstr.length());
}
}
#pragma once
#include <pch.h>
using namespace Platform;
using namespace Windows::Storage;
namespace RingClientUWP
{
namespace Utils
{
task<bool>
fileExists(StorageFolder^ folder, String^ fileName)
{
return create_task(folder->GetFileAsync(fileName))
.then([](task<StorageFile^> taskResult)
{
bool exists;
try {
taskResult.get();
exists = true;
}
catch (COMException ^e) {
if (e->HResult == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)) {
exists = false;
}
else {
throw;
}
}
return exists;
});
}
std::string makeString(const std::wstring& wstr)
{
auto wideData = wstr.c_str();
int bufferSize = WideCharToMultiByte(CP_UTF8, 0, wideData, -1, nullptr, 0, NULL, NULL);
std::unique_ptr<char[]> utf8;
utf8.reset(new char[bufferSize]);
if (WideCharToMultiByte(CP_UTF8, 0, wideData, -1, utf8.get(), bufferSize, NULL, NULL) == 0) {
return std::string();
}
return std::string(utf8.get());
}
std::wstring makeWString(const std::string& str)
{
auto utf8Data = str.c_str();
int bufferSize = MultiByteToWideChar(CP_UTF8, 0, utf8Data, -1, nullptr, 0);
std::unique_ptr<wchar_t[]> wide;
wide.reset(new wchar_t[bufferSize]);
if (MultiByteToWideChar(CP_UTF8, 0, utf8Data, -1, wide.get(), bufferSize) == 0) {
return std::wstring();
}
return std::wstring(wide.get());;
}
std::string toString(Platform::String ^str)
{
std::wstring wsstr(str->Data());
return makeString(wsstr);
}
Platform::String^ toPlatformString(const std::string& str)
{
std::wstring wsstr = makeWString(str);
return ref new Platform::String(wsstr.c_str(), wsstr.length());
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment