Allow only one instance for useLocalServer option activated. If exists,

pass to it arguments.

For now, only allow to pass RsCollection file and retroshare://
protocol.
This commit is contained in:
Phenom 2016-03-01 13:08:33 +01:00
parent 9871b37ef2
commit 10bb542e83
19 changed files with 547 additions and 426 deletions

View file

@ -1,7 +1,7 @@
/****************************************************************
* This file is distributed under the following license:
*
* Copyright (c) 2008, crypton
* This file is distributed under the following license:
*
* Copyright (c) 2008, crypton
* Copyright (c) 2008, Matt Edman, Justin Hipple
*
* This program is free software; you can redistribute it and/or
@ -28,6 +28,11 @@
#include "stringutil.h"
//#define CHAR_ARRAY_TO_STRINGLIST_DEBUG
#ifdef CHAR_ARRAY_TO_STRINGLIST_DEBUG
#include <iostream>
#include <QFile>
#endif
/** Create a QStringList from the array of C-style strings. */
QStringList
@ -35,7 +40,20 @@ char_array_to_stringlist(char **arr, int len)
{
QStringList list;
for (int i = 0; i < len; i++) {
list << QString(arr[i]);
#ifdef WINDOWS_SYS
list << QString::fromLatin1(arr[i]);
#else
list << QString::fromUtf8(arr[i]);
#endif
#ifdef CHAR_ARRAY_TO_STRINGLIST_DEBUG
std::cerr << "arr[" << i << "]==" << arr[i] << std::endl;
if (QFile(arr[i]).exists()) std::cerr << "arr[i] File exists" << std::endl;
std::cerr << "QString UTF8==" << QString::fromUtf8(arr[i]).toStdString() << std::endl;
if (QFile(QString::fromUtf8(arr[i])).exists()) std::cerr << "QString UTF8 File exists" << std::endl;
std::cerr << "QString Latin1==" << QString::fromLatin1(arr[i]).toStdString() << std::endl;
if (QFile(QString::fromLatin1(arr[i])).exists()) std::cerr << "QString Latin1 File exists" << std::endl;
#endif
}
return list;
}