Added handling of RetroShare protocol under Windows.

Added new command line parameter "-r retroshare://..." for adding links to the registered running RetroShare.
Recompile of the GUI needed.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4156 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2011-04-14 21:59:51 +00:00
parent a337941555
commit 20fa00c40e
12 changed files with 380 additions and 16 deletions

View file

@ -42,6 +42,7 @@
#include "gui/connect/ConfCertDialog.h"
#include "idle/idle.h"
#include "gui/common/Emoticons.h"
#include "util/EventReceiver.h"
/*** WINDOWS DON'T LIKE THIS - REDEFINES VER numbers.
#include <gui/qskinobject/qskinobject.h>
@ -107,6 +108,14 @@ int main(int argc, char *argv[])
Rshare rshare(args, argc, argv,
QString::fromStdString(RsInit::RsConfigDirectory()));
std::string link = RsInit::getRetroShareLink();
if (!link.empty()) {
/* start with RetroShare link */
EventReceiver eventReceiver;
eventReceiver.sendRetroShareLink(QString::fromStdString(link));
return 0;
}
QSplashScreen splashScreen(QPixmap(":/images/splash.png")/* , Qt::WindowStaysOnTopHint*/);
switch (initResult) {
@ -229,6 +238,15 @@ int main(int argc, char *argv[])
MainWindow *w = MainWindow::Create ();
splashScreen.finish(w);
EventReceiver *eventReceiver = NULL;
if (Settings->getRetroShareProtocol()) {
/* Create event receiver */
eventReceiver = new EventReceiver;
if (eventReceiver->start()) {
QObject::connect(eventReceiver, SIGNAL(linkReceived(const QUrl&)), w, SLOT(linkActivated(const QUrl&)));
}
}
// I'm using a signal to transfer the hashing info to the mainwindow, because Qt schedules signals properly to
// avoid clashes between infos from threads.
//
@ -268,7 +286,7 @@ int main(int argc, char *argv[])
w->installGroupChatNotifier();
/* only show window, if not startMinimized */
if (RsInit::setStartMinimised() || Settings->getStartMinimized())
if (RsInit::getStartMinimised() || Settings->getStartMinimized())
{
splashScreen.close();
} else {
@ -286,6 +304,12 @@ int main(int argc, char *argv[])
#ifndef MINIMAL_RSGUI
delete w ;
if (eventReceiver) {
/* Destroy event receiver */
delete eventReceiver;
eventReceiver = NULL;
}
/* cleanup */
PopupChatDialog::cleanupChat();
#endif // MINIMAL_RSGUI